/* Wire Choir app: pure black, SF Pro, heads in the top three quarters, the song grows like a poem in the bottom quarter. */
:root {
  --ink: #f5f5f7;
  --dim: #8e8e93;
  --faint: #48484a;
  --ghost: #2c2c2e;
  --line: rgba(255, 255, 255, 0.1);
  --sf: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Helvetica Neue', 'Segoe UI', Inter, system-ui, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --stage: 75vh;
}
@supports (height: 100dvh) { :root { --stage: 75dvh; } }
html.kb-open { --stage: calc(var(--vvh, 100vh) - 150px); }
html.kb-open #dock { top: auto; bottom: var(--kb, 0px); padding-bottom: 12px; }
html.kb-open #history { max-height: 0; margin: 0; }
html.kb-open #hint, html.kb-open #rail { display: none; }
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: #000; color: var(--ink); font-family: var(--sf); -webkit-font-smoothing: antialiased; height: 100%; overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:focus-visible, textarea:focus-visible, input:focus-visible, select:focus-visible { outline: 1px solid rgba(255, 255, 255, 0.5); outline-offset: 3px; border-radius: 6px; }
#stage { position: fixed; left: 0; top: 0; width: 100vw; height: var(--stage); display: block; touch-action: pan-y; }
body.recording #stage { object-fit: contain; }

#bar { position: fixed; left: 0; right: 0; top: 0; height: 34px; display: flex; align-items: center; padding: 0 18px; font-size: 12px; z-index: 5; pointer-events: none; }
#bar > * { pointer-events: auto; }
.bar-l { color: var(--dim); font-weight: 500; }
.bar-c { margin-left: auto; color: var(--faint); font-size: 12px; padding: 4px 8px; border-radius: 8px; transition: color 0.2s; white-space: nowrap; }
.bar-c:hover { color: var(--ink); }

#rail { position: fixed; left: 10px; top: calc(var(--stage) / 2); transform: translateY(-50%); display: flex; flex-direction: column; gap: 4px; z-index: 6; }
#rail button { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; position: relative; color: #5a5a5e; transition: color 0.15s, background 0.15s; }
#rail button:hover, #rail button.on { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
#rail svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#rail span { position: absolute; left: 46px; white-space: nowrap; font-size: 12px; color: var(--ink); background: #111; border: 1px solid var(--line); padding: 4px 8px; border-radius: 7px; opacity: 0; transform: translateX(-4px); transition: 0.15s; pointer-events: none; }
#rail button:hover span { opacity: 1; transform: none; }

#dock { position: fixed; left: 0; right: 0; bottom: 0; top: var(--stage); display: flex; flex-direction: column; justify-content: flex-end; padding: 0 8vw calc(5vh + env(safe-area-inset-bottom)); }
#history { display: flex; flex-direction: column; gap: 2px; margin-bottom: 6px; max-height: 12vh; overflow-y: auto; scrollbar-width: none; mask-image: linear-gradient(to bottom, transparent, #000 40%); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40%); }
#history::-webkit-scrollbar { display: none; }
.verse { display: flex; align-items: center; gap: 10px; font-size: clamp(16px, 1.6vw, 21px); color: var(--faint); text-align: left; padding: 1px 0; }
.verse i { width: 6px; height: 6px; border-radius: 50%; flex: none; opacity: 0.8; }
.verse:hover { color: var(--dim); }
.verse.on { color: var(--ink); }
#field { position: relative; width: 100%; }
#field::before { content: ''; position: absolute; left: -16px; top: 0.62em; width: 6px; height: 6px; border-radius: 50%; background: var(--head, #4fd2ff); }
#input, #kara { font-family: var(--sf); font-size: clamp(22px, 2.5vw, 34px); line-height: 1.2; font-weight: 400; letter-spacing: -0.015em; }
#input { width: 100%; resize: none; background: transparent; border: 0; outline: none; color: var(--ink); caret-color: var(--ink); overflow: hidden; display: block; }
#input::placeholder { color: var(--ghost); }
#input:focus-visible { outline: none; }
#kara { position: absolute; left: 0; top: 0; right: 0; pointer-events: none; white-space: pre-wrap; word-break: break-word; color: var(--ink); transition: opacity 0.8s; display: none; }
body.kara-on #kara { display: block; }
body.kara-on #input::placeholder { color: transparent; }
body.kara-fade #kara { opacity: 0; }
.syl { color: var(--faint); background-clip: text; -webkit-background-clip: text; }
#hint { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--faint); transition: opacity 0.25s; }
#hint kbd { font-family: var(--sf); color: var(--dim); margin-right: 4px; }
#input:not(:placeholder-shown) ~ #hint { opacity: 0; }
body.can-save #hint span:first-child kbd { color: var(--ink); }
#toast { position: absolute; right: 8vw; bottom: calc(5vh + 4px + env(safe-area-inset-bottom)); font-size: 12px; color: var(--dim); opacity: 0; transition: opacity 0.3s; }
#toast.show { opacity: 1; }

/* Windows */
.win { position: fixed; background: #000; border: 1px solid rgba(255, 255, 255, 0.13); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9); font-size: 13px; }
.win-h { height: 38px; flex: none; display: flex; align-items: center; padding: 0 8px 0 14px; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; }
.win-h:active { cursor: grabbing; }
.win-t { font-size: 12px; color: var(--dim); font-weight: 500; }
.win-x { margin-left: auto; width: 26px; height: 26px; border-radius: 7px; color: var(--faint); font-size: 18px; line-height: 1; }
.win-x:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.win-b { flex: 1; overflow-y: auto; padding: 4px 14px 16px; scrollbar-width: thin; scrollbar-color: #2c2c2e transparent; display: flex; flex-direction: column; }
.win-b > * { flex: none; }
.win-r { position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none; }
.win-r::after { content: ''; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 7px; border-right: 1px solid #48484a; border-bottom: 1px solid #48484a; }

.lbl { font-size: 11px; color: var(--faint); margin: 14px 0 7px; display: flex; justify-content: space-between; align-items: center; }
.lbl b { font-weight: 400; color: var(--dim); font-variant-numeric: tabular-nums; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chips button { padding: 5px 10px; border-radius: 8px; color: var(--dim); background: rgba(255, 255, 255, 0.05); font-size: 12px; }
.chips button:hover { color: var(--ink); }
.chips button.on { background: var(--ink); color: #000; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 20px; background: none; }
input[type=range]::-webkit-slider-runnable-track { height: 2px; background: #2c2c2e; border-radius: 2px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--ink); margin-top: -6px; }
input[type=range]::-moz-range-track { height: 2px; background: #2c2c2e; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border: 0; border-radius: 50%; background: var(--ink); }
.btn { padding: 8px 12px; border-radius: 9px; background: rgba(255, 255, 255, 0.07); color: var(--ink); font-size: 12.5px; }
.btn:hover { background: rgba(255, 255, 255, 0.12); }
.btn.pri { background: var(--ink); color: #000; }
.btn.quiet { background: none; color: var(--faint); }
.btn.quiet:hover { color: var(--ink); }
.btn.rec { color: #000; background: #ffb454; }
.btn:disabled { opacity: 0.35; cursor: default; }
.row2 { display: flex; gap: 6px; margin-top: 14px; flex-wrap: wrap; align-items: center; }
.note { color: var(--faint); font-size: 12px; line-height: 1.5; margin-top: 10px; }

.hrow { display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-top: 1px solid var(--line); cursor: pointer; }
.hrow:first-of-type { border-top: 0; }
.hrow i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.hrow b { font-weight: 500; font-size: 13px; }
.hrow span { color: var(--faint); font-size: 12px; margin-left: auto; }
.hed { padding: 0 4px 12px; }
.listen { width: 100%; margin-top: 14px; padding: 11px; border-radius: 10px; border: 1px solid var(--line); color: var(--dim); font-size: 12.5px; user-select: none; -webkit-user-select: none; touch-action: none; }
.listen.on { color: #000; background: var(--ink); }
.lrow { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--line); }
.lrow:first-child { border-top: 0; }
.lrow p { flex: 1; color: var(--ink); font-size: 13px; outline: none; }
.lrow .who { width: 10px; height: 10px; border-radius: 50%; }
.lrow button { color: var(--faint); width: 24px; height: 24px; border-radius: 6px; font-size: 13px; }
.lrow button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.empty { color: var(--faint); font-size: 12.5px; line-height: 1.5; padding: 6px 0; }
select { background: #111; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; font: inherit; font-size: 12px; }

.roll { position: relative; flex: 1 1 auto !important; min-height: 160px; margin: 6px -14px 0; border-top: 1px solid var(--line); overflow: hidden; touch-action: none; }
.roll canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.rollbar { display: flex; align-items: center; gap: 6px; padding-top: 4px; flex-wrap: wrap; }
.rollbar .tag { font-size: 11px; color: var(--faint); margin-right: auto; }
.rollbar .tag b { color: var(--dim); font-weight: 400; }

.kbd { position: relative; height: 120px; margin-top: 12px; display: flex; user-select: none; -webkit-user-select: none; touch-action: none; }
.kbd .k { flex: 1; margin-right: 2px; border-radius: 0 0 7px 7px; background: #141416; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 6px; font-size: 9.5px; color: var(--faint); transition: background 0.06s; }
.kbd .k.b { position: absolute; top: 0; height: 60%; background: #000; border: 1px solid #2c2c2e; border-top: 0; z-index: 2; }
.kbd .k.down { background: var(--head, #4fd2ff); color: #000; }
.stream { font-size: 18px; line-height: 1.4; min-height: 52px; margin-top: 4px; color: var(--faint); }
.stream span { padding: 0 1px; }
.stream .cur { color: var(--ink); border-bottom: 1.5px solid var(--head, #4fd2ff); }
.stream .done { color: var(--dim); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); margin-right: 6px; }
.status-dot.on { background: #7dffb6; }
.status-dot.rec { background: #ffb454; }
.prog { height: 2px; background: #1c1c1e; border-radius: 2px; overflow: hidden; margin-top: 10px; }
.prog i { display: block; height: 100%; width: 0; background: var(--ink); }

@media (max-width: 720px) {
  :root { --stage: 70vh; }
  @supports (height: 100dvh) { :root { --stage: 70dvh; } }
  #dock { padding: 0 22px calc(3vh + env(safe-area-inset-bottom)); }
  #rail { top: auto; bottom: calc(100vh - var(--stage) + 6px); transform: none; flex-direction: row; left: 12px; }
  #rail span { display: none; }
  #hint { display: none; }
  .win { left: 8px !important; right: 8px; width: auto !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
#save { display: none; position: absolute; right: -6px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); color: var(--dim); font-size: 18px; }
@media (hover: none) { #input:not(:placeholder-shown) ~ #save, body.can-save #save { display: grid; place-items: center; } #input { padding-right: 40px; } }
