:root {
  --bg: #121110; --panel: #1a1816; --line: #2c2925; --ink: #ece6dc; --muted: #9a9188; --dim: #6c655d;
  --accent: #e8a65a;
  --voce: #e8a65a; --fischio: #7fc4d8; --bisbiglio: #b9a3e3; --rombo: #d9725f; --stridore: #c9d46a; --legno: #a39a8e;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 14px/1.45 ui-sans-serif, -apple-system, "Helvetica Neue", Arial, sans-serif; min-height: 100vh; }
h1 { font: 500 26px/1.1 "Iowan Old Style", Georgia, serif; margin: 0 0 4px; letter-spacing: .01em; }
h2 { font: 600 11px/1 ui-sans-serif, -apple-system, sans-serif; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 0 0 10px; }
#top { padding: 18px 20px 6px; }
.lede { margin: 0; color: var(--muted); max-width: 70ch; }

#layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 10px 20px 24px; align-items: start; }
#stagewrap { position: sticky; top: 10px; min-width: 0; }
#stage { position: relative; height: min(72vh, 820px); background: #0b0a09; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
#view { width: 100%; height: 100%; display: block; touch-action: none; }
#busy { position: absolute; inset: 0; display: flex; gap: 10px; align-items: center; justify-content: center; background: rgba(12,11,10,.55); color: var(--muted); }
#busy[hidden], #drop[hidden] { display: none; }
.spin { width: 16px; height: 16px; border: 2px solid var(--dim); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
#drop { position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 18px; background: rgba(18,17,16,.8); }
#now { min-height: 22px; margin: 10px 2px 6px; color: var(--ink); font-variant-numeric: tabular-nums; }
#now .k { color: var(--muted); }
#timeline { width: 100%; height: 44px; display: block; border: 1px solid var(--line); border-radius: 6px; background: #0e0d0c; }

#panel { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.hint, .modehint { color: var(--muted); margin: -2px 0 10px; font-size: 13px; }
.modehint { min-height: 2.9em; margin: 10px 0; }
#works { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.work { position: relative; aspect-ratio: 1; border: 1px solid var(--line); border-radius: 5px; overflow: hidden; padding: 0; background: #0b0a09; cursor: pointer; }
.work img { width: 100%; height: 100%; object-fit: cover; display: block; }
.work span { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; line-height: 1.2; padding: 10px 4px 3px; color: var(--ink); text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.85)); }
.work.on { outline: 2px solid var(--accent); outline-offset: 1px; }
.work:focus-visible, button:focus-visible, .upload:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.upload { display: block; margin-top: 8px; padding: 8px; text-align: center; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); cursor: pointer; }
.upload:hover { color: var(--ink); border-color: var(--dim); }

button { font: inherit; color: var(--ink); background: #24211e; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; cursor: pointer; }
button:hover:not(:disabled) { border-color: var(--dim); }
button:disabled { opacity: .45; cursor: default; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 7px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-radius: 0; background: transparent; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: #2e2a25; color: var(--ink); }
.seg.small button { padding: 5px 8px; font-size: 12px; }
.primary { width: 100%; padding: 11px; font-size: 15px; background: var(--accent); color: #1a1208; border-color: var(--accent); font-weight: 600; }
.primary:hover:not(:disabled) { filter: brightness(1.07); }
.primary.stop { background: #2e2a25; color: var(--ink); border-color: var(--dim); }
.ghost { width: 100%; margin-top: 10px; background: transparent; }
.ghost.first { margin: 0 0 10px; }
.row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.row .seg { flex: 1 1 140px; }
.check { color: var(--muted); display: flex; gap: 5px; align-items: center; cursor: pointer; font-size: 13px; }

#reading { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; margin: 0; }
#reading dt { color: var(--muted); }
#reading dd { margin: 0; font-variant-numeric: tabular-nums; }
#reading dd.big { font-size: 20px; line-height: 1; }
#reading .wide { grid-column: 1 / -1; color: var(--muted); font-size: 12.5px; }
#parity { margin-top: 10px; font-size: 12px; color: var(--muted); }
#parity .ok { color: #9fd49a; }
#parity .bad { color: #e88d7a; }

#voices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#voices li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 13px; }
#voices .sw { width: 10px; height: 10px; border-radius: 50%; }
#voices .bar { grid-column: 2 / -1; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; }
#voices .bar i { display: block; height: 100%; }
#voices .muted { color: var(--muted); }

#how summary { cursor: pointer; font: 600 11px/1 ui-sans-serif, sans-serif; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
#how ul { padding-left: 18px; margin: 12px 0 8px; }
#how li { margin-bottom: 7px; }
.small { font-size: 12px; color: var(--muted); }
code { font: 12px ui-monospace, Menlo, monospace; color: var(--ink); }

@media (max-width: 860px) {
  #layout { grid-template-columns: 1fr; padding: 8px 16px 24px; }
  #top { padding: 14px 16px 4px; }
  #stagewrap { position: static; }
  #stage { height: 58vh; }
  #works { grid-template-columns: repeat(5, 1fr); }
  #playblock { order: -1; }
}
@media (max-width: 420px) { #works { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
