/* Layout: one column for phones, widening for the player stage on desktop.
   Same identity as the overview page — ink, paper, saffron. */
:root {
  --paper:      #f6f2e9;
  --surface:    #efe9dc;
  --ink:        #221d33;
  --muted:      #6a6279;
  --line:       #ddd4c2;
  --accent:     #b9761f;
  --accent-ink: #fff8ec;
  --ok:         #3f7d4e;
  --danger:     #b4492f;
  --display: "Marcellus", Georgia, serif;
  --body:    "Spectral", Georgia, serif;
  --mono:    "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #16131f;
    --surface:    #211c2e;
    --ink:        #ece6da;
    --muted:      #9a92ab;
    --line:       #332c45;
    --accent:     #e0a046;
    --accent-ink: #1a1408;
    --ok:         #7cc48d;
    --danger:     #e57a5f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.55;
  padding-top: max(20px, env(safe-area-inset-top, 0px));
  padding-bottom: max(48px, env(safe-area-inset-bottom, 0px));
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 44rem; margin: 0 auto; }
.wrap.wide { max-width: 60rem; }
.narrow { max-width: 24rem; }
a { color: inherit; }
p { margin: 0 0 .8rem; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.15; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(1.9rem, 7vw, 2.6rem); margin-bottom: .3rem; }
h2 { font-size: 1.45rem; }
h3 { font-size: 1.1rem; }
.eyebrow {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .4rem;
}
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: .78rem; }
.back { font-family: var(--mono); font-size: .8rem; text-decoration: none; color: var(--muted); }
section { margin-top: 2.5rem; }
.sechead {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  border-bottom: 1px solid var(--line); padding-bottom: .5rem; margin-bottom: .75rem;
}
.sechead .muted { font-family: var(--mono); font-size: .72rem; white-space: nowrap; }

/* cards */
.cards { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.card {
  display: block; text-decoration: none; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1rem;
}
.card h3 { margin-top: .1rem; }
.bar { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; margin-top: .7rem; }
.bar > i { display: block; height: 100%; background: var(--accent); }

/* lists */
.rows { list-style: none; margin: 0; padding: 0; }
.rows a {
  display: grid; grid-template-columns: 1.6rem 1fr auto; gap: .6rem; align-items: baseline;
  padding: .7rem .2rem; border-bottom: 1px solid var(--line); text-decoration: none; min-height: 44px;
}
.rows li:last-child a { border-bottom: 0; }
.rows .n { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.rows .t { min-width: 0; }
.rows .s { font-family: var(--mono); font-size: .76rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rows .done .s { color: var(--ok); }
details { border-bottom: 1px solid var(--line); }
summary {
  cursor: pointer; list-style: none; padding: .9rem 0;
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline;
}
summary::-webkit-details-marker { display: none; }
summary h3::before { content: "+ "; color: var(--accent); font-family: var(--mono); font-size: .9rem; }
details[open] summary h3::before { content: "– "; }
summary .muted { font-family: var(--mono); font-size: .72rem; white-space: nowrap; }
.hint { font-size: .88rem; color: var(--muted); margin: -.2rem 0 .6rem; }

/* player */
.stage {
  background: #000; border-radius: 6px; overflow: hidden; width: 100%; max-width: 100%;
  aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center;
}
.stage video { width: 100%; height: 100%; display: block; background: #000; }
.stage.audio {
  background: var(--surface); border: 1px solid var(--line); aspect-ratio: auto;
  flex-direction: column; padding: 1rem; gap: 1rem;
}
.stage.audio img { width: 100%; max-height: 38vh; object-fit: cover; border-radius: 4px; }
.stage.audio .glyph {
  font-family: var(--display); font-size: 4rem; color: var(--accent); line-height: 1; padding: 1.5rem 0 .5rem;
}
.stage audio { width: 100%; }
.meta { margin-top: 1.1rem; }
.controls { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; align-items: center; }
button, .btn {
  font: inherit; font-family: var(--mono); font-size: .8rem; letter-spacing: .03em;
  background: transparent; color: var(--ink); border: 1px solid var(--line); border-radius: 4px;
  padding: .55rem .8rem; min-height: 42px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
button.on, button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; min-height: 40px; }
.seg button + button { border-left: 1px solid var(--line); }
.nav { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: 1rem; }
.nav .btn { min-width: 0; }
.nav .btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notice {
  margin-top: 1rem; padding: .9rem 1rem; border: 1px solid var(--accent); border-radius: 6px;
  display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between;
}
.notice p { margin: 0; }

/* track days */
.day { display: block; padding: .75rem .3rem; border-bottom: 1px solid var(--line); text-decoration: none; }
.day.today { background: var(--surface); border-left: 3px solid var(--accent); padding-left: .7rem; }
.day .head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.day .head span { font-family: var(--mono); font-size: .74rem; color: var(--muted); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .4rem; }
.chip {
  font-family: var(--mono); font-size: .72rem; border: 1px solid var(--line); border-radius: 999px;
  padding: .15rem .55rem; color: var(--muted);
}
.chip.ok { border-color: var(--ok); color: var(--ok); }

/* login */
.login main { margin-top: 12vh; }
.login form { display: grid; gap: .6rem; margin-top: 1.5rem; }
.login label { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.login input {
  font: inherit; padding: .75rem .8rem; border: 1px solid var(--line); border-radius: 4px;
  background: var(--surface); color: var(--ink);
}
.login button { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.login .err { color: var(--danger); min-height: 1.5em; margin: 0; }

footer { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
