:root {
  color-scheme: dark;
  --bg: #090b10;
  --panel: rgba(255, 255, 255, 0.075);
  --panel-strong: rgba(255, 255, 255, 0.13);
  --text: #f7f7f2;
  --muted: #a9adb7;
  --line: rgba(255, 255, 255, 0.12);
  --brand: #a3ff12;
  --brand-2: #58e6ff;
  --danger: #ff6262;
  --warning: #ffca3a;
  --ok: #65f4a6;
  --radius: 24px;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.45);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(163, 255, 18, 0.16), transparent 35rem),
    radial-gradient(circle at top right, rgba(88, 230, 255, 0.12), transparent 30rem),
    linear-gradient(180deg, #10131c 0%, #090b10 45%);
  color: var(--text);
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px max(92px, env(safe-area-inset-bottom));
}

.hero {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: -18px -16px 16px;
  padding: max(18px, env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(180deg, rgba(9, 11, 16, 0.96), rgba(9, 11, 16, 0.76) 78%, transparent);
  backdrop-filter: blur(18px);
}

.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kicker::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 20px rgba(163, 255, 18, 0.85);
}

h1, h2, h3, p { margin: 0; }

h1 {
  margin-top: 6px;
  font-size: clamp(2.1rem, 12vw, 3.8rem);
  line-height: 0.9;
  letter-spacing: -0.08em;
}

.hero p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

select, input, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  outline: none;
}

select, input {
  height: 48px;
  padding: 0 12px;
}

select option { background: #11151f; }

textarea {
  min-height: 88px;
  padding: 12px;
  resize: vertical;
  line-height: 1.35;
}

.summary-card {
  padding: 16px;
  margin-bottom: 14px;
}

.summary-card h2 {
  font-size: 1.22rem;
  letter-spacing: -0.03em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.metric {
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
}

.metric strong {
  display: block;
  font-size: 1.15rem;
}

.metric span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
}

.action-row {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

.btn {
  min-height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--text);
  font-weight: 800;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease;
}

.btn:active { transform: scale(0.97); }

.btn.primary {
  flex: 1;
  background: var(--brand);
  color: #101400;
  box-shadow: 0 14px 38px rgba(163, 255, 18, 0.22);
}

.btn.ghost { border: 1px solid var(--line); }
.btn.danger { color: #250606; background: var(--danger); }
.btn.ok { color: #03200f; background: var(--ok); }
.btn.small { min-height: 36px; padding: 0 12px; font-size: 0.85rem; }

.tabs {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 20;
  display: grid;
  width: min(calc(100% - 28px), 492px);
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 16, 23, 0.92);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.42);
}

.tab {
  min-height: 44px;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.tab.active {
  background: var(--text);
  color: #0a0d11;
}

.exercise-card {
  overflow: hidden;
  margin: 12px 0;
}

.exercise-head {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.exercise-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.exercise-card h3 {
  font-size: 1.05rem;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.pill.brand {
  background: rgba(163, 255, 18, 0.14);
  color: var(--brand);
}

.pill.warn {
  background: rgba(255, 202, 58, 0.13);
  color: var(--warning);
}

.prescriptions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 8px;
}

.rx {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.055);
}

.rx-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--brand);
  font-weight: 900;
}

.rx-scheme {
  margin-top: 5px;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.rx-weight {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.set-list {
  display: grid;
  gap: 8px;
  padding: 0 16px 16px;
}

.set-row {
  display: grid;
  grid-template-columns: 32px 1fr 1fr 38px;
  gap: 8px;
  align-items: center;
}

.set-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 900;
  font-size: 0.78rem;
}

.set-row input {
  height: 42px;
  border-radius: 14px;
  text-align: center;
}

.check {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-weight: 900;
}

.check.done {
  background: var(--brand);
  color: #111500;
}

.note-box {
  padding: 0 16px 16px;
}

.mini-copy {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.history-item, .settings-item {
  padding: 14px;
  margin: 10px 0;
}

.history-top, .settings-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.history-item h3, .settings-item h3 {
  font-size: 1rem;
}

.status {
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status.completed { background: rgba(101, 244, 166, 0.18); color: var(--ok); }
.status.discarded { background: rgba(255, 98, 98, 0.18); color: var(--danger); }

.empty {
  padding: 28px 18px;
  text-align: center;
}

.empty strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.install-card {
  display: none;
  padding: 14px;
  margin-bottom: 14px;
  border-color: rgba(163, 255, 18, 0.35);
}

.install-card.show { display: block; }

.install-card .action-row { margin-bottom: 0; }

.settings-grid {
  display: grid;
  gap: 10px;
}

.rm-row {
  display: grid;
  grid-template-columns: 1fr 88px;
  gap: 10px;
  align-items: center;
}

.rm-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.drawer {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

@media (min-width: 700px) {
  .app-shell { padding-top: 28px; }
  .hero { border-radius: 0 0 28px 28px; }
}
