:root {
  --bg: #07070a;
  --ink: #f4efe6;
  --muted: #8b8578;
  --soft: #c8c1b4;
  --line: rgba(244, 239, 230, 0.12);
  --volt: #d6f071;
  --rose: #e38a8a;
  --gold: #d8b56a;
  --display: "Oswald", "Arial Narrow", sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  overflow: hidden;
}

button,
a,
input,
textarea {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

button {
  border: 0;
  background: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--volt);
  outline-offset: 3px;
}

.grain,
.halo {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.grain {
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.halo {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(214, 240, 113, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(216, 181, 106, 0.08), transparent 50%);
}

body.is-savage .halo {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(227, 138, 138, 0.16), transparent 55%),
    radial-gradient(ellipse 50% 40% at 90% 10%, rgba(214, 240, 113, 0.06), transparent 50%);
}

.stage {
  position: relative;
  z-index: 1;
  height: 100dvh;
}

.view {
  height: 100%;
  display: flex;
  flex-direction: column;
  animation: rise 420ms ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .view { animation: none; }
}

.chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + var(--safe-top)) max(18px, var(--safe-right)) 0 max(18px, var(--safe-left));
}

.mark {
  font-family: var(--display);
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: var(--soft);
}

.mark span {
  color: var(--volt);
}

.mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
}

.mode-pill.is-on {
  color: var(--rose);
  border-color: rgba(227, 138, 138, 0.35);
}

.mode-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #2a2a2f;
  position: relative;
}

.mode-pill.is-on .mode-dot {
  background: var(--rose);
}

.home-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 max(22px, var(--safe-right)) 0 max(22px, var(--safe-left));
  position: relative;
  overflow: hidden;
}

.home-media {
  position: absolute;
  inset: 8% 0 28%;
  background-size: cover;
  background-position: center;
  mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 70%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 18%, #000 70%, transparent);
  opacity: 0.28;
}

.home-copy {
  position: relative;
  z-index: 1;
  padding-bottom: 18px;
}

.kicker {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--volt);
}

.home-copy h1 {
  font-family: var(--display);
  font-size: clamp(3.4rem, 16vw, 6.4rem);
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 10px 0 14px;
  max-width: 9ch;
}

.home-copy .lede {
  font-family: var(--serif);
  font-size: clamp(1.25rem, 4.4vw, 1.7rem);
  font-style: italic;
  color: var(--soft);
  max-width: 22ch;
}

.home-copy .blurb {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  max-width: 38ch;
  line-height: 1.5;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 22px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat b {
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}

.stat span {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.home-foot {
  padding: 18px max(22px, var(--safe-right)) calc(18px + var(--safe-bottom)) max(22px, var(--safe-left));
}

.primary {
  width: 100%;
  min-height: 64px;
  border-radius: 999px;
  background: var(--ink);
  color: #11110f;
  font-family: var(--display);
  font-size: 1.15rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.primary.danger {
  background: #1b1212;
  color: var(--rose);
  border: 1px solid rgba(227, 138, 138, 0.4);
}

.primary.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  min-height: 44px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.day-rail {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}

.day-dot {
  min-height: 54px;
  border-radius: 16px;
  border: 1px solid var(--line);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.day-dot small {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
}

.day-dot b {
  font-family: var(--display);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.day-dot.is-today:not(.is-on) {
  color: var(--soft);
}

.day-dot.is-on {
  background: var(--ink);
  color: #11110f;
  border-color: var(--ink);
}

.day-dot.is-done:not(.is-on) {
  box-shadow: inset 0 0 0 1px rgba(214, 240, 113, 0.45);
}

.session,
.debrief,
.done {
  background: var(--bg);
}

.session-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.18;
  mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 78%);
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 42%, transparent 78%);
}

.session-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(10px + var(--safe-top)) max(16px, var(--safe-right)) 0 max(16px, var(--safe-left));
}

.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 1.1rem;
}

.session-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--soft);
}

.session-track {
  height: 2px;
  margin: 12px max(18px, var(--safe-right)) 0 max(18px, var(--safe-left));
  background: rgba(244, 239, 230, 0.08);
  position: relative;
  z-index: 1;
}

.session-track i {
  display: block;
  height: 100%;
  background: var(--volt);
  width: 0;
  transition: width 280ms ease;
}

.session-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px max(22px, var(--safe-right)) 12px max(22px, var(--safe-left));
  min-height: 0;
  overflow-y: auto;
}

.phase-line {
  font-family: var(--mono);
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

.ex-code {
  display: inline-block;
  margin-top: 14px;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--volt);
}

.session-main h2 {
  font-family: var(--display);
  font-size: clamp(2.3rem, 11vw, 4.4rem);
  line-height: 0.92;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 8px 0 10px;
  max-width: 12ch;
}

.muscle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  color: var(--soft);
}

.clock-block {
  margin: 28px 0 8px;
}

.clock-label {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.clock {
  font-family: var(--display);
  font-size: clamp(4.6rem, 22vw, 7.5rem);
  line-height: 0.84;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.clock.is-live {
  color: var(--volt);
}

.rx {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.rx b {
  display: block;
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.rx span {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.apt {
  margin-top: 16px;
  font-size: 0.9rem;
  color: var(--soft);
  line-height: 1.45;
  max-width: 42ch;
}

.apt em {
  font-family: var(--mono);
  font-style: normal;
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--gold);
  display: block;
  margin-bottom: 4px;
}

.cue-toggle {
  margin-top: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cue-panel {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
  max-width: 46ch;
}

.session-foot {
  position: relative;
  z-index: 1;
  padding: 10px max(22px, var(--safe-right)) calc(16px + var(--safe-bottom)) max(22px, var(--safe-left));
}

.up-next {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.78rem;
}

.up-next strong {
  color: var(--soft);
  font-weight: 600;
}

.debrief,
.done {
  overflow: auto;
}

.debrief-inner,
.done-inner {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: calc(16px + var(--safe-top)) max(22px, var(--safe-right)) calc(18px + var(--safe-bottom)) max(22px, var(--safe-left));
}

.debrief-inner h2,
.done-inner h2 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 9vw, 3.6rem);
  font-weight: 500;
  line-height: 0.95;
  margin: 18px 0 8px;
}

.debrief-ex {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.felt {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0;
}

.chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 0.86rem;
}

.chip.is-on {
  background: var(--ink);
  color: #11110f;
  border-color: var(--ink);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.field span,
.pr-row span {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}

.field input,
.field textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
  color: var(--ink);
  padding: 10px 0;
  font-size: 16px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.5;
  font-family: var(--serif);
  font-size: 1.2rem;
}

.pr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 6px 0 20px;
}

.switch {
  width: 52px;
  height: 30px;
  border-radius: 999px;
  background: #242428;
  position: relative;
}

.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #111;
  transition: transform 180ms ease;
}

.switch.is-on {
  background: var(--volt);
}

.switch.is-on i {
  transform: translateX(22px);
}

.next-card {
  margin: 8px 0 22px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.next-card small {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.16em;
  color: var(--gold);
}

.next-card strong {
  display: block;
  margin-top: 6px;
  font-family: var(--display);
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.done-inner {
  justify-content: flex-end;
}

.done-inner .kicker {
  margin-bottom: 8px;
}

.done-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 28px 0;
}

.note-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

.note-list article {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.note-list b {
  display: block;
  font-family: var(--display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.note-list p {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--soft);
}

.resume-banner {
  margin-bottom: 12px;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-height: 720px) {
  .session-main h2 {
    font-size: clamp(1.8rem, 8vw, 2.6rem);
  }

  .clock {
    font-size: clamp(3.4rem, 16vw, 5rem);
  }

  .clock-block {
    margin: 16px 0 4px;
  }

  .home-copy h1 {
    font-size: clamp(2.8rem, 12vw, 4.6rem);
  }
}

@media (min-width: 860px) {
  .home-body {
    justify-content: center;
    padding-left: 8vw;
  }

  .home-copy h1 {
    max-width: 11ch;
  }

  .home-foot,
  .session-foot,
  .chrome,
  .session-top,
  .session-main,
  .debrief-inner,
  .done-inner {
    width: min(720px, 100%);
    margin-left: auto;
    margin-right: auto;
  }

  .home-foot {
    width: min(520px, 100%);
    margin-left: max(22px, 8vw);
    margin-right: auto;
  }
}
