/* Line-drawn cassettes on paper. Colours are tokens so a design pass can
   change them in one place; dark mode redefines them. */

:root {
  --bg: #fafaf7;
  --card: #fff;
  --ink: #111;
  --muted: #6b6b66;
  --line: #d9d8d2;
  --accent: #d9542b;
  --tape: #3b2a1e;
  --splice: #e8c547;
  --sticker-1: #f3d9a4;
  --sticker-2: #bcd9c7;
  --sticker-3: #f2b8a8;
  --sticker-4: #c9c6ec;
  --sticker-5: #f6efc1;

  /* Read by the waveform drawing code. */
  --wave-ink: #222;
  --wave-other: rgba(0, 0, 0, 0.06);
  --wave-active: rgba(217, 84, 43, 0.18);
  --wave-edge: #d9542b;
  --wave-cursor: #d00;
  --wave-playhead: #111;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161614;
    --card: #1f1e1b;
    --ink: #eeede8;
    --muted: #9a9993;
    --line: #34332f;
    --accent: #f07a50;
    --tape: #c9a27e;
    --wave-ink: #ddd;
    --wave-other: rgba(255, 255, 255, 0.06);
    --wave-active: rgba(240, 122, 80, 0.22);
    --wave-edge: #f07a50;
    --wave-playhead: #eee;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, sans-serif;
}

main { max-width: 1040px; margin: 0 auto; padding: 28px 16px 80px; }
h1 { font-size: 26px; margin: 0 0 4px; letter-spacing: -0.01em; }
.lede { color: var(--muted); margin: 0 0 28px; }
h2 { font-size: 18px; margin: 0 0 4px; display: flex; align-items: center; }
h3 { font-size: 16px; margin: 0; }
.step {
  display: inline-grid; place-items: center;
  width: 26px; height: 26px; margin-right: 8px; border-radius: 50%;
  background: var(--ink); color: var(--bg); font-size: 14px;
}
.hint { color: var(--muted); margin: 0 0 14px; }
section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 24px;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }

button, select, input { font: inherit; color: inherit; }
button {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}
button:disabled { opacity: 0.45; cursor: default; }
button[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }

/* --- cassettes --- */
.cassette { width: 100%; height: auto; display: block; overflow: hidden; }
.cassette .shell { fill: none; stroke: var(--ink); stroke-width: 3; }
.cassette .thin { fill: none; stroke: var(--ink); stroke-width: 2; }
.cassette .post { fill: var(--ink); }
.cassette .reel { fill: none; stroke: var(--ink); stroke-width: 14; }
.cassette .hub { fill: none; stroke: var(--ink); stroke-width: 3; stroke-dasharray: 9 6; }
.cassette .tape-under { fill: none; stroke: var(--tape); stroke-width: 4; stroke-linejoin: round; opacity: 0.6; }
.cassette .tape { fill: none; stroke: var(--tape); stroke-width: 4; stroke-linejoin: round; stroke-dasharray: 2 14; }
.cassette .splice { fill: var(--splice); stroke: var(--ink); stroke-width: 1.5; }
.cassette .head { fill: var(--accent); }
.cassette .sticker { stroke: var(--ink); stroke-width: 2; }
.cassette .sticker-text { font: 700 32px Caveat, cursive; fill: #222; }
.cassette .sticker-sub { font: 500 24px Caveat, cursive; fill: #444; }
.cassette .note { font-size: 20px; fill: var(--muted); }

/* --- step 1: make your tape --- */
.maker { display: grid; grid-template-columns: 1.15fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .maker { grid-template-columns: 1fr; } }
#wave {
  display: block; width: 100%; height: 110px;
  border: 1px solid var(--line); border-radius: 8px;
  cursor: crosshair; touch-action: none;
}
.sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0; }
@media (max-width: 560px) { .sizes { grid-template-columns: repeat(2, 1fr); } }
.size { padding: 8px; text-align: center; border-radius: 10px; }
.size b { display: block; font-size: 14px; }
.size small { color: var(--muted); font-variant-numeric: tabular-nums; }
.size[aria-pressed="true"] small { color: inherit; opacity: 0.8; }
.size[aria-pressed="true"] .cassette .shell,
.size[aria-pressed="true"] .cassette .thin,
.size[aria-pressed="true"] .cassette .hub,
.size[aria-pressed="true"] .cassette .reel { stroke: var(--bg); }
.size[aria-pressed="true"] .cassette .post { fill: var(--bg); }
.size[aria-pressed="true"] .cassette .tape-under,
.size[aria-pressed="true"] .cassette .tape { stroke: var(--splice); }
.size .cassette .splice { display: none; }
.speeds { display: inline-flex; gap: 6px; }
.big-tape { max-width: 440px; margin: 0 auto; }
.readout { color: var(--muted); font-variant-numeric: tabular-nums; margin: 8px 0; min-height: 2.9em; }
.name {
  width: 100%; padding: 2px 0;
  font: 700 24px Caveat, cursive;
  border: 0; border-bottom: 2px dashed var(--line); background: none;
}
.name:focus { outline: none; border-bottom-color: var(--accent); }
.nick { display: inline-flex; align-items: baseline; gap: 6px; color: var(--muted); }
.nick input {
  width: 11em; padding: 2px 0;
  font: 700 20px Caveat, cursive; color: var(--text, inherit);
  border: 0; border-bottom: 2px dashed var(--line); background: none;
}
.nick input:focus { outline: none; border-bottom-color: var(--accent); }
.shelf-tape .shared-tag { font-size: 11px; color: var(--muted); }

/* --- step 2: mix --- */
.transport { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#status { color: var(--muted); min-height: 1.45em; margin: 10px 0 14px; }
.decks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 760px) { .decks { grid-template-columns: repeat(2, 1fr); } }
.deck {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  display: flex; flex-direction: column; gap: 8px; min-height: 250px;
  background: var(--bg);
}
.deck.empty { align-items: center; justify-content: center; color: var(--muted); border-style: dashed; text-align: center; }
.deck.out .cassette { opacity: 0.35; }
.deck-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.deck .who, .deck .what { font-size: 12px; color: var(--muted); }
.deck .num { font-size: 11px; font-weight: 700; color: var(--muted); }
.yours { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); }
.deck .bring { padding: 0; border: 0; background: none; border-radius: 6px; }
.deck .bring:focus-visible { outline: 2px solid var(--accent); }
.fader { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.fader input { flex: 1; accent-color: var(--accent); }
.deck .controls { display: flex; gap: 6px; flex-wrap: wrap; }
.deck .controls button { padding: 3px 8px; font-size: 13px; }

.shelf-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; }
.filters button { font-size: 13px; padding: 3px 10px; border-radius: 999px; }
.shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.shelf-tape { border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--bg); display: flex; flex-direction: column; gap: 6px; }
.shelf-tape .meta { font-size: 12px; color: var(--muted); line-height: 1.3; }
.shelf-tape .role { font-size: 11px; color: var(--accent); font-weight: 600; }
.shelf-tape .actions { display: flex; gap: 6px; }
.shelf-tape button { font-size: 13px; padding: 3px 8px; flex: 1; }
.empty-shelf { color: var(--muted); }

.note {
  margin-top: 28px; padding: 14px 16px; color: var(--muted);
  border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 10px 10px 0;
}
