/* Delta A/B web player. Palette = the app's "Amber Bridge" glass, with the brand A/B: A blue (as in the app), B amber. */
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/JetBrainsMono-Regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/static/fonts/JetBrainsMono-Bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --faceplate: #161719;   /* page */
  --glass: #16110b;       /* the screens */
  --ink: #f4f2ec;         /* phosphor white */
  --a: #73b2c6;           /* A: blue, as in the app (Planetarium) */
  --b: #e2a85a;           /* B: amber */
  --loop: #7a5a2e;
  --lit: #f6dfb0;
  --cue: #d4806c;
  --dim: #8b867a;
  --line: #34322d;
  --note: #c9b8f0;       /* revision notes: a colour of their own, apart from A, B, loops and cues */
  --font: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--faceplate); color: var(--ink); font: 15px/1.5 var(--font); }
body { min-height: 100vh; padding: env(safe-area-inset-top) 16px 0; -webkit-text-size-adjust: 100%; }
#app { max-width: 880px; margin: 0 auto; padding: 16px 0 28px; }
.dim { color: var(--dim); }
[hidden] { display: none !important; }

.bar { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; border: 1px solid var(--line); padding: 8px 12px; background: #1b1c1f; }
.mark { width: 22px; height: 22px; color: var(--ink); flex: none; }
.brand { font-weight: 700; letter-spacing: .12em; }
.room { font-size: 12px; letter-spacing: .14em; }
.status { color: var(--dim); font-size: 13px; letter-spacing: .08em; }
.status.playing { color: var(--lit); }
.tag { margin-left: auto; font-size: 11px; color: var(--dim); letter-spacing: .08em; border: 1px solid var(--line); padding: 1px 8px; }
.tag:not([hidden]) ~ .tag { margin-left: 0; }
.tag.preview { color: var(--lit); border-color: var(--lit); }
.notice { font-size: 13px; margin: 8px 2px 0; padding: 8px 10px; border: 1px solid var(--lit); color: var(--lit); }

.panel { border: 1px solid var(--line); padding: 12px 14px; margin-top: 10px; background: #1b1c1f; }
#title { margin: 0; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
#title:empty { display: none; }
#note { margin: 8px 0 0; color: #cfcabd; white-space: pre-wrap; overflow-wrap: anywhere; }
#note:empty { display: none; }
.error { color: var(--cue); margin: 0; }

.tracks { display: grid; gap: 10px; margin-top: 10px; }
.track { --ink-c: var(--a); border: 1px solid var(--line); padding: 6px 8px 8px; cursor: pointer; background: var(--glass); color: var(--ink-c); outline-offset: 2px; opacity: .72; transition: opacity .08s; }
.track.b { --ink-c: var(--b); }
.track.active { opacity: 1; border-color: var(--ink-c); box-shadow: 0 0 0 1px var(--ink-c) inset, 0 0 18px -6px var(--ink-c); }
.trackhead { display: flex; gap: 8px; align-items: baseline; font-size: 14px; margin-bottom: 4px; min-width: 0; }
.trackhead b { font-size: 17px; }
.marker::before { content: " "; white-space: pre; }
.track.active .marker::before { content: ">"; }
.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; font-size: 12px; opacity: .8; }
canvas { display: block; width: 100%; height: 88px; touch-action: pan-y; cursor: crosshair; user-select: none; -webkit-user-select: none; }
.hint { font-size: 12px; margin: 6px 2px 0; }

.btn {
  font: inherit; color: var(--ink); background: #1b1c1f; border: 1px solid var(--line);
  padding: 10px 12px; min-height: 44px; cursor: pointer; border-radius: 0; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { background: #222327; border-color: var(--dim); }
.btn:active:not(:disabled) { background: var(--ink); color: var(--faceplate); }
.btn:focus-visible, .track:focus-visible { outline: 2px solid var(--lit); }
.btn[aria-pressed="true"], .btn.on { color: var(--lit); border-color: var(--lit); }
.btn:disabled { color: #5d5a52; cursor: default; }

.time { font-variant-numeric: tabular-nums; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.rowlabel { width: 52px; font-size: 13px; }
.presets { display: contents; }
.row .btn { min-width: 44px; padding: 8px 12px; }
.btn.cue { color: var(--cue); }
.btn.cue:active:not(:disabled) { background: var(--cue); color: var(--faceplate); }
.btn.cue:disabled { color: #6a4b43; }
.btn.loopsel.on { color: var(--lit); border-color: var(--lit); }

.help { margin-top: 18px; font-size: 12px; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; }
@media (max-width: 520px) {
  body { padding-left: 10px; padding-right: 10px; font-size: 14px; }

}
@media (prefers-reduced-motion: no-preference) {
  .status.playing::after { content: " \25AE"; animation: blink 1s steps(2, start) infinite; }
  @keyframes blink { to { visibility: hidden; } }
}

/* ---------- revision notes ---------- */
.notes { border: 1px solid var(--line); background: #1b1c1f; margin-top: 16px; padding: 12px 14px 14px; }
.noteshead { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; }
.notes h2 { margin: 0; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--note); }
.notes .count:not(:empty) { margin-left: 6px; color: var(--ink); border: 1px solid var(--line); padding: 0 6px; font-size: 12px; letter-spacing: 0; }
.who { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.who input { width: 12em; }
input { font: inherit; color: var(--ink); background: var(--glass); border: 1px solid var(--line); border-radius: 0; padding: 8px 10px; min-height: 40px; }
input:focus { outline: 2px solid var(--note); outline-offset: -1px; }
input::placeholder { color: #6b675d; }
kbd { font: inherit; border: 1px solid var(--line); padding: 0 5px; color: var(--ink); }
.narrow { display: none; }

.composer { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; margin-top: 10px;
  padding: 8px; border: 1px solid var(--note); background: var(--glass); }
.stamp { font-variant-numeric: tabular-nums; color: var(--note); white-space: nowrap; padding: 0 4px; }
.stamp[data-side="A"]::after, .stamp[data-side="B"]::after { content: ""; }
.composer input { width: 100%; min-width: 0; }
.composer .btn { min-height: 40px; padding: 6px 14px; }
.btn.ghost { color: var(--dim); }
.empty { margin: 10px 0 0; font-size: 13px; }

.notetable { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
.notetable th { text-align: left; font-weight: 400; font-size: 12px; color: var(--dim); letter-spacing: .08em; text-transform: uppercase;
  border-bottom: 1px solid var(--line); padding: 4px 8px 6px 0; }
.notetable td { border-bottom: 1px solid #26251f; padding: 6px 8px 6px 0; vertical-align: top; }
.notetable tr.now td { background: #221f2b; }
.notetable tr.fresh td { animation: fresh 1.6s ease-out; }
@keyframes fresh { from { background: #3a3150; } to { background: transparent; } }
.nt { width: 1%; white-space: nowrap; }
.tbtn { text-decoration: none; font: inherit; font-variant-numeric: tabular-nums; color: var(--note); background: none; border: 1px solid transparent; padding: 4px 6px; margin: -4px 0 -4px -6px;
  cursor: pointer; min-height: 32px; }
.tbtn:hover, .tbtn:focus-visible { border-color: var(--note); outline: none; }
.ns { width: 1%; text-align: center; font-weight: 700; color: var(--dim); }
.ns.a { color: var(--a); } .ns.b { color: var(--b); }
.nx { overflow-wrap: anywhere; white-space: pre-wrap; }
.nby { color: var(--dim); font-size: 12px; margin-top: 2px; }
.na { width: 1%; white-space: nowrap; text-align: right; padding-right: 0; }
.mini { font: inherit; font-size: 12px; color: var(--dim); background: none; border: 1px solid var(--line); padding: 4px 8px; margin-left: 4px; cursor: pointer; min-height: 30px; }
.mini:hover, .mini:focus-visible { color: var(--ink); border-color: var(--dim); }
.mini[data-armed="1"] { color: var(--cue); border-color: var(--cue); }
.editform { display: flex; gap: 6px; }
.editform input { flex: 1; min-width: 0; min-height: 34px; padding: 4px 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.maker { text-align: center; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; margin-top: 22px; }

/* ---------- the dock: the app's transport strip, always under your thumb ---------- */
body { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
.dock:not([hidden]) { position: fixed; left: 0; right: 0; bottom: var(--kb, 0px); z-index: 10;
  background: var(--faceplate); border-top: 1px solid var(--line); box-shadow: 0 -12px 24px -12px #000;
  padding: 8px max(10px, env(safe-area-inset-left)) calc(10px + env(safe-area-inset-bottom)); }
.dockinner { max-width: 880px; margin: 0 auto; display: grid; gap: 8px; }
.readout { display: flex; align-items: baseline; gap: 8px; font-variant-numeric: tabular-nums; }
.readout .time { font-size: 22px; letter-spacing: .02em; margin: 0; text-align: left; }
.readout .total { font-size: 13px; flex: 1; }
.readout .seek { min-height: 34px; min-width: 52px; }
.keys { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 8px; }
.key { font: inherit; font-weight: 700; font-size: 18px; color: var(--ink); background: #1b1c1f; border: 1px solid var(--line);
  border-radius: 0; min-height: 60px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; }
.key:disabled { color: #5d5a52; cursor: default; }
.key:focus-visible { outline: 2px solid var(--lit); outline-offset: 1px; }
.key.play:not(:disabled):active { background: var(--ink); color: var(--faceplate); }
.key.play[aria-label="Pause"] { color: var(--lit); border-color: var(--lit); }
/* one wide key, two halves: the lit half is what you hear. Tap anywhere on it to flip. */
.key.toggle { display: grid; grid-template-columns: 1fr 1fr; padding: 0; font-size: 26px; }
.half { display: grid; place-items: center; color: #5d5a52; transition: background-color 40ms, color 40ms; }
.toggle:not(:disabled)[data-now="A"] .half.a { background: var(--a); color: var(--faceplate); }
.toggle:not(:disabled)[data-now="B"] .half.b { background: var(--b); color: var(--faceplate); }
.toggle:not(:disabled) .half { color: var(--dim); }
.half.a { border-right: 1px solid var(--line); }
.key.notebtn { color: var(--note); border-color: var(--note); }
.key.notebtn:not(:disabled):active { background: var(--note); color: var(--faceplate); }

/* the note being written sits just above the dock, so it stays on screen while the track plays;
   --kb lifts both above a phone's keyboard (set from visualViewport in notes.js) */
.composer:not([hidden]) { position: fixed; left: 0; right: 0; z-index: 11; margin: 0;
  bottom: calc(var(--kb, 0px) + 118px + env(safe-area-inset-bottom)); border-width: 1px 0;
  padding: 8px max(10px, calc((100vw - 880px) / 2)); background: #19161f; }
.composer input { font-size: 16px; /* 16px stops iOS zooming in */ }
@media (hover: none) { .keyshelp { display: none; } }

@media (max-width: 700px) {
  .wide { display: none; } .narrow { display: inline; }
  .who { width: 100%; }
  .who input { flex: 1; width: auto; }
  .composer .stamp { font-size: 13px; padding: 0; }
  .composer .btn { padding: 6px 10px; }
  .who input, .editform input { font-size: 16px; }
  .key { font-size: 17px; min-height: 64px; }
  .bar .tag { display: none; }   /* no room on a phone */
  .bar .tag.preview:not([hidden]) { display: inline-block; margin-left: auto; }   /* but not this: it changes what they hear */
  .bar { gap: 2px 10px; }
  .bar .room { font-size: 11px; }
  canvas { height: 72px; }
  .key.toggle { font-size: 28px; }

  /* table rows become cards: time + side on one line, the note under them, actions to the right */
  .notetable thead { display: none; }
  .notetable, .notetable tbody { display: block; }
  .notetable tr { display: grid; grid-template-columns: auto auto 1fr; grid-template-areas: "t s a" "x x x"; align-items: center;
    border-bottom: 1px solid #26251f; padding: 8px 0; }
  .notetable td { border: 0; padding: 0; width: auto !important; }
  .notetable .nt { grid-area: t; } .notetable .ns { grid-area: s; text-align: left; padding-left: 8px; }
  .notetable .na { grid-area: a; } .notetable .nx { grid-area: x; padding-top: 4px; }
  .notetable tr.now { background: #221f2b; } .notetable tr.now td { background: none; }
  .tbtn { min-height: 40px; padding: 6px 8px; font-size: 16px; }
  .mini { min-height: 36px; padding: 6px 10px; }
}
.vtag { font-size: 10px; color: var(--dim); border: 1px solid var(--line); padding: 0 4px; }
tr.oldrev .ntext { color: var(--dim); }
