:root {
  --bg: #0a0c0f;
  --stage: #10141c;
  --surface: #161a24;
  --raised: #202634;
  --ink: #eceef2;
  --muted: rgba(236, 238, 242, 0.68);
  --faint: rgba(236, 238, 242, 0.42);
  --accent: #e8784a;
  --success: #7bae7f;
  --danger: #dc5a64;
  --highlight: #c77dff;
  --pad: 16px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "SF Pro Display", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
body {
  padding: calc(12px + var(--safe-top)) var(--pad) calc(88px + var(--safe-bottom));
  max-width: 480px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.brand img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}
.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.beta-pill {
  display: inline-block;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(199, 125, 255, 0.2);
  border: 1px solid rgba(199, 125, 255, 0.45);
  color: var(--highlight);
  text-transform: uppercase;
}

.text-input {
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--raised);
  color: var(--ink);
  padding: 12px;
  font: inherit;
  font-size: 1rem;
  margin-bottom: 4px;
}

.nav-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  margin: 0 0 8px;
  border-radius: 12px;
  border: 1px solid rgba(199, 125, 255, 0.45);
  background: rgba(199, 125, 255, 0.16);
  color: var(--ink);
  text-align: left;
  font: inherit;
}
.nav-icon {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(199, 125, 255, 0.28);
  color: var(--highlight);
  font-size: 0.95rem;
  font-weight: 800;
}
.nav-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.nav-row strong { font-size: 1rem; }
.nav-row .nav-copy > span { font-size: 0.85rem; color: var(--faint); }
.nav-chevron { color: var(--faint); font-size: 1.1rem; }

.nuke-btn {
  width: 100%;
  margin-top: 12px;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(32, 38, 52, 0.9);
  color: var(--faint);
  font: inherit;
  font-weight: 700;
  opacity: 0.55;
}
.nuke-btn.nuke-ready {
  background: var(--danger);
  color: #fff;
  border-color: transparent;
  opacity: 1;
  box-shadow: 0 8px 22px rgba(220, 90, 100, 0.35);
}
.nuke-btn:disabled { cursor: not-allowed; }

.support.ok { color: var(--success); }
.support.warn { color: var(--accent); }
.support.faint { color: var(--faint); }

.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: space-between;
  margin: 18px 0 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.app-footer button,
.app-footer a {
  background: transparent;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  padding: 0;
  text-decoration: none;
  cursor: pointer;
}
.app-footer button:hover,
.app-footer a:hover { color: var(--highlight); }

.sheet {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  padding-bottom: calc(12px + var(--safe-bottom));
}
.sheet-card {
  width: min(520px, 100%);
  max-height: min(88vh, 760px);
  background: var(--bg);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px 16px 12px 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#sheetBody {
  overflow: auto;
  padding: 16px;
  flex: 1;
}
.sheet-bar {
  padding: 10px 16px calc(10px + var(--safe-bottom));
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sheet-bar .secondary { width: 100%; }
.punch {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  font-size: 0.85rem;
}
.ring {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 6px solid rgba(232, 120, 74, 0.35);
  border-top-color: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ring .big { font-size: 1.4rem; font-weight: 800; }
.ring .small { font-size: 0.65rem; letter-spacing: 0.08em; color: var(--faint); font-weight: 700; }
.stretch-row {
  display: flex;
  gap: 14px;
  align-items: center;
}
.history-item {
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.history-item:last-child { border-bottom: 0; }

.checkline {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 6px 0;
  color: var(--ink);
  font-size: 0.95rem;
}
.checkline input {
  width: 18px;
  height: 18px;
}
#secList {
  display: grid;
  gap: 8px;
}
#secBody { margin-top: 12px; }

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + var(--safe-bottom));
  background: rgba(10, 12, 15, 0.94);
  border-top: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(12px);
  max-width: 480px;
  margin: 0 auto;
  z-index: 20;
}
.tabs button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tabs button.active {
  background: var(--raised);
  color: var(--ink);
}

.panel { display: none; }
.panel.active { display: block; }

.bubble {
  background: linear-gradient(165deg, var(--surface), var(--stage));
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 12px;
}
.kicker {
  margin: 0 0 6px;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--highlight);
  font-weight: 700;
}
.lead {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.2;
}
.support {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}
.feedback {
  margin-top: 10px;
  min-height: 1.2em;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.95rem;
}

.drink-count {
  font-size: 2.6rem;
  font-weight: 800;
  color: var(--accent);
  margin: 4px 0;
  font-variant-numeric: tabular-nums;
}

.stack-actions {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}
button.cta, button.secondary, button.ghost {
  min-height: 48px;
  border-radius: 10px;
  border: 0;
  font-size: 1rem;
  font-weight: 700;
  padding: 0 16px;
  width: 100%;
}
button.cta {
  background: linear-gradient(120deg, #e8784a, #b44824);
  color: #fffaf8;
}
button.secondary {
  background: rgba(32, 38, 52, 0.9);
  color: var(--ink);
  border: 1px solid rgba(201, 184, 150, 0.35);
}
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,0.12);
}
button:disabled { opacity: 0.55; }

.start-wrap {
  display: flex;
  justify-content: center;
  margin: 14px 0 10px;
}
.start-btn {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  background: var(--success);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(123, 174, 127, 0.35);
}
.start-btn.locked {
  background: rgba(123, 174, 127, 0.55);
  font-size: 1.8rem;
  border-color: rgba(123, 174, 127, 0.9);
}

.clock {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
  margin-top: 8px;
}
.clock .v {
  font-size: 1.35rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.clock .sec { color: var(--accent); }
.clock .c {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-weight: 700;
}

.daystrip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.day {
  text-align: center;
  padding: 8px 2px;
  border-radius: 8px;
  background: var(--raised);
  font-size: 0.7rem;
  font-weight: 700;
}
.day.clear { background: rgba(123, 174, 127, 0.28); color: var(--success); }
.day.drank { background: rgba(232, 120, 74, 0.28); color: var(--accent); }
.day.blank { color: var(--faint); }

label.field {
  display: block;
  margin: 10px 0 6px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 700;
}
textarea {
  width: 100%;
  min-height: 110px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: var(--raised);
  color: var(--ink);
  padding: 12px;
  font: inherit;
  font-size: 1rem;
  resize: vertical;
}
.manifesto {
  white-space: pre-wrap;
  font-size: 1.15rem;
  line-height: 1.45;
  font-weight: 650;
  margin: 0;
}
.manifesto.empty { color: var(--faint); font-weight: 500; font-size: 0.95rem; }
.wtf-title {
  font-size: 2.4rem;
  font-weight: 900;
  margin: 0 0 4px;
}
.install-hint {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(199, 125, 255, 0.12);
  border: 1px solid rgba(199, 125, 255, 0.28);
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.35;
}
.hidden { display: none !important; }

.intro {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--bg);
  overflow: auto;
  padding: calc(12px + var(--safe-top)) var(--pad) calc(24px + var(--safe-bottom));
}
.intro-inner {
  max-width: 480px;
  margin: 0 auto;
}
.intro-phase { margin-top: 4px; }
.stack-actions.row2 {
  grid-template-columns: 1fr 1fr;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0 8px;
}
.chip {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: var(--raised);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
}
.chip.active {
  background: rgba(232, 120, 74, 0.28);
  border-color: rgba(232, 120, 74, 0.7);
  color: #fff;
}
.feedback.error { color: var(--danger); }
body.intro-open .tabs,
body.intro-open #appShell { display: none !important; }
body.intro-open { padding-bottom: 24px; }

/* —— Aurora Legal (Mac LegalView parity; Legal-only colors) —— */
:root {
  --legal-ink: #140816;
  --legal-ink-deep: #0c050f;
  --legal-text: #f4f0f7;
  --legal-muted: #c9bfd4;
  --legal-violet: #a855f7;
  --legal-magenta: #ec4899;
  --legal-cyan: #22d3ee;
  --legal-amber: #fbbf24;
  --legal-panel: rgba(30, 14, 36, 0.92);
  --legal-warn-panel: rgba(48, 18, 28, 0.95);
}

.legal-aurora {
  position: fixed;
  inset: 0;
  z-index: 45;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(168, 85, 247, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 10%, rgba(236, 72, 153, 0.18), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(34, 211, 238, 0.12), transparent 55%),
    var(--legal-ink);
  color: var(--legal-text);
  overflow: auto;
  padding: calc(12px + var(--safe-top)) var(--pad) calc(28px + var(--safe-bottom));
}
.legal-inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
body.legal-open .tabs,
body.legal-open #appShell { display: none !important; }
body.legal-open { padding: 0; }

.aurora-back {
  align-self: flex-start;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid rgba(168, 85, 247, 0.35);
  background: rgba(30, 14, 36, 0.75);
  color: var(--legal-text);
  font: inherit;
  font-weight: 700;
}
.aurora-hero {
  padding: 8px 2px 4px;
}
.aurora-kicker {
  margin: 0 0 8px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--legal-cyan);
}
.aurora-lead {
  margin: 0 0 10px;
  font-size: 1.85rem;
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: -0.02em;
  color: var(--legal-text);
}
.aurora-support {
  margin: 0 0 10px;
  color: var(--legal-muted);
  line-height: 1.45;
  font-size: 0.98rem;
}
.aurora-meta {
  margin: 0;
  color: rgba(201, 191, 212, 0.75);
  font-size: 0.82rem;
}
.aurora-bubble {
  position: relative;
  background: var(--legal-panel);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aurora-bubble.warn {
  background: var(--legal-warn-panel);
  border-color: rgba(251, 191, 36, 0.45);
}
.aurora-accent {
  width: 48px;
  height: 3px;
  border-radius: 2px;
  background: var(--legal-violet);
  margin-bottom: 4px;
}
.aurora-bubble.warn .aurora-accent { background: var(--legal-amber); }
.aurora-section-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--legal-text);
}
.aurora-body {
  margin: 0;
  color: var(--legal-muted);
  line-height: 1.45;
  font-size: 0.95rem;
  white-space: pre-wrap;
}
.aurora-bullet {
  margin: 0;
  color: var(--legal-text);
  line-height: 1.4;
  font-size: 0.95rem;
}
.aurora-field {
  display: block;
  margin-top: 6px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(201, 191, 212, 0.75);
  font-weight: 700;
}
.aurora-select {
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid rgba(168, 85, 247, 0.4);
  background: var(--legal-ink-deep);
  color: var(--legal-text);
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
}
.aurora-detail { display: flex; flex-direction: column; gap: 10px; }
.aurora-card-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.aurora-card-head .aurora-section-title { flex: 1; }
.aurora-close {
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--legal-muted);
  font: inherit;
  font-weight: 700;
}
.aurora-jump {
  display: block;
  padding: 10px 0;
  font-weight: 750;
  font-size: 1rem;
  text-decoration: none;
}
.aurora-jump.cyan { color: var(--legal-cyan); }
.aurora-jump.magenta { color: var(--legal-magenta); }
