/* Self-hosted, not a CDN: a cross-origin font request is returned early by the
   service worker (sw.js leaves cross-origin to the browser), so an offline
   launch would silently fall back to system fonts. */
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('./fonts/dm-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'DM Sans'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('./fonts/dm-sans-700.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('./fonts/plex-mono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('./fonts/plex-mono-600.woff2') format('woff2');
}
@font-face {
  font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('./fonts/plex-mono-700.woff2') format('woff2');
}

*, *::before, *::after { box-sizing: border-box; }

/* viewport-fit=cover + black-translucent means content sits under the notch and
   home indicator. Without these insets the top of the UI is unreachable. */
body {
  margin: 0;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
  min-height: 100vh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-prose);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 42rem; margin: 0 auto; padding: var(--gap) 1rem 4rem; }

/* ── app bar ─────────────────────────────────────────────────────────── */
.app-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: var(--gap);
  padding: var(--gap) 1rem;
  padding-top: calc(var(--gap) + var(--safe-top));
  margin-top: calc(-1 * var(--safe-top));
  background: color-mix(in srgb, var(--color-bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
}
.app-title {
  margin: 0; flex: 1;
  font-family: var(--font-data); font-size: 1rem; font-weight: 700;
  letter-spacing: 0.02em; color: var(--color-accent-green);
}

/* ── controls ────────────────────────────────────────────────────────── */
.btn {
  min-height: var(--tap); min-width: var(--tap);
  padding: 0 1rem;
  border: 1px solid transparent; border-radius: var(--radius);
  background: var(--color-accent-blue); color: #06101f;
  font-family: var(--font-prose); font-size: 0.95rem; font-weight: 700;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-ghost {
  background: transparent; color: var(--color-text);
  border-color: var(--color-border); font-weight: 400;
}
.btn-ghost:hover { background: var(--color-surface); }
:where(button, input, a):focus-visible {
  outline: 2px solid var(--color-accent-green); outline-offset: 2px;
}

.input {
  flex: 1; min-height: var(--tap); padding: 0 0.85rem;
  border: 1px solid var(--color-border); border-radius: var(--radius);
  background: var(--color-surface); color: var(--color-text);
  font-family: var(--font-prose);
  font-size: 16px;   /* below 16px, iOS Safari zooms the page on focus */
}
.input::placeholder { color: var(--color-text-dim); }

.row { display: flex; gap: var(--gap); align-items: center; margin: var(--gap) 0; }
.row-end { justify-content: flex-end; }
.muted { color: var(--color-text-dim); font-size: 0.9rem; }

/* ── demo: notes list ────────────────────────────────────────────────── */
.notes { list-style: none; margin: var(--gap) 0; padding: 0; }
.note {
  display: flex; align-items: center; gap: var(--gap);
  padding: 0.6rem 0.85rem; margin-bottom: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius);
}
.note-text { flex: 1; overflow-wrap: anywhere; }
.note-delete { padding: 0; font-size: 1.3rem; line-height: 1; color: var(--color-danger); }

/* ── banner + toast ──────────────────────────────────────────────────── */
.banner, .toast {
  position: fixed; left: 1rem; right: 1rem; z-index: 20;
  bottom: calc(1rem + var(--safe-bottom));
  display: flex; align-items: center; gap: var(--gap);
  padding: 0.75rem 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius);
  box-shadow: 0 8px 28px rgb(0 0 0 / 45%);
}
.banner[hidden], .toast[hidden] { display: none; }
.banner-text, .toast-text { flex: 1; margin: 0; font-size: 0.92rem; }
.toast { border-color: var(--color-accent-green); }

@media (min-width: 34rem) {
  .banner, .toast { left: auto; right: 1rem; max-width: 26rem; }
}

/* ── mixer ───────────────────────────────────────────────────────────── */
.sprite { display: none; }

/* Room for the fixed stack, which can be three banners deep. */
.mixer { padding-bottom: 10rem; }

.mix-section { margin: 1.5rem 0 var(--gap); }
.mix-section:first-child { margin-top: var(--gap); }
.section-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-data); font-size: 0.74rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--color-text-dim);
}
.srow-list { list-style: none; margin: 0; padding: 0; }

.srow {
  padding: 0.35rem 0.85rem 0.6rem; margin-bottom: 0.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius);
}
.srow-head {
  display: flex; align-items: center; gap: 0.6rem;
  min-height: var(--tap); cursor: pointer;
}
.srow-check {
  width: 22px; height: 22px; flex: none; margin: 0;
  accent-color: var(--color-accent-green);
}
.srow-icon { width: 20px; height: 20px; flex: none; color: var(--color-text-dim); }
.srow-label { flex: 1; }
.srow-value {
  font-family: var(--font-data); font-size: 0.8rem;
  color: var(--color-text-dim); font-variant-numeric: tabular-nums;
}
.srow-caption { margin: 0 0 0.15rem 2.1rem; font-size: 0.78rem; color: var(--color-text-dim); }
.srow-note { margin: 0.35rem 0 0; font-size: 0.8rem; color: var(--color-danger); }
.srow-note[hidden] { display: none; }

.srow--playing { border-color: var(--color-accent-green); }
.srow--playing .srow-icon { color: var(--color-accent-green); }
.srow--pending { border-style: dashed; border-color: var(--color-accent-blue); }
.srow--busy .srow-icon { opacity: 0.4; }
.srow--missing { border-color: var(--color-danger); }
.srow--missing .srow-head, .srow--missing .srow-vol { opacity: 0.45; }

/* Range input. WebKit and Moz pseudo-elements CANNOT share a selector list —
   one unrecognised pseudo invalidates the whole rule — so these stay split. */
.srow-vol {
  -webkit-appearance: none; appearance: none;
  display: block; width: 100%; height: var(--tap);   /* full 44px hit area */
  margin: 0; padding: 0; background: transparent; cursor: pointer;
  /* Without this the page steals the horizontal drag and the slider only moves
     on the second try. Verify on the actual phone, not the desktop. */
  touch-action: pan-y;
}
.srow-vol:disabled { cursor: default; }

/* WebKit has no ::-webkit-slider-progress, so the filled portion is a gradient
   driven from JS via --fill. Custom properties inherit into pseudo-elements. */
.srow-vol::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px;
  background: linear-gradient(to right,
    var(--color-accent-blue) var(--fill, 60%), var(--color-border) var(--fill, 60%));
}
.srow-vol::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--color-accent-blue); border: 2px solid var(--color-bg);
  margin-top: -9px;                       /* (6 - 24) / 2 — centre on the track */
}
.srow-vol::-moz-range-track { height: 6px; border-radius: 3px; background: var(--color-border); }
.srow-vol::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--color-accent-blue); }
.srow-vol::-moz-range-thumb {
  width: 24px; height: 24px; border: 2px solid var(--color-bg); border-radius: 50%;
  background: var(--color-accent-blue);
}

/* ── bottom stack ────────────────────────────────────────────────────── */
.stack-bottom {
  position: fixed; z-index: 20;
  left: 1rem; right: 1rem; bottom: calc(1rem + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 0.5rem;
}
/* The children keep .banner/.toast for their look but are laid out by the
   stack, not by their own fixed positioning. */
.stack-bottom > .banner, .stack-bottom > .toast {
  position: static; left: auto; right: auto; bottom: auto; max-width: none;
}
.banner-resume { border-color: var(--color-accent-blue); }

@media (min-width: 34rem) {
  .stack-bottom { left: auto; right: 1rem; width: min(26rem, calc(100vw - 2rem)); }
}

/* ── credits ─────────────────────────────────────────────────────────── */
.credit-line {
  margin: 2rem 0 0; font-size: 0.75rem; line-height: 1.5;
  color: var(--color-text-dim);
}
.credit-line a { color: var(--color-accent-blue); }

.notice {
  margin: var(--gap) 0; padding: 0.6rem 0.85rem;
  background: var(--color-surface);
  border: 1px solid var(--color-danger); border-radius: var(--radius);
  font-size: 0.85rem;
}
