:root {
  color-scheme: light dark;
  --bg: #f4f4f1; --card: #fff; --fg: #1c1c1a; --mute: #6c6c66; --line: #dcdcd5; --accent: #14805c;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #141413; --card: #1f1f1d; --fg: #ecece8; --mute: #9a9a92; --line: #343431; --accent: #35c48f; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, "Noto Sans KR", sans-serif; word-break: keep-all; }
main { max-width: 1100px; margin: 0 auto; padding: 12px 12px calc(32px + env(safe-area-inset-bottom)); }
header { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
h1 { font-size: 1.35rem; margin: 0; }
h2 { font-size: 1.02rem; margin: 22px 0 8px; }
h2 em { font-style: normal; font-weight: 400; font-size: .8rem; color: var(--mute); margin-left: 6px; }
.badge { font-size: .75rem; color: var(--mute); border: 1px solid var(--line); border-radius: 99px; padding: 1px 9px; }

#stage { position: relative; height: min(54vh, 520px); min-height: 280px; overflow: hidden;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#loading { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; padding: 24px;
  text-align: center; color: var(--mute); }
.hud { position: absolute; left: 12px; top: 10px; display: flex; gap: 8px; align-items: baseline; pointer-events: none; }
.hud strong { font-size: 1.1rem; }
.hud span { color: var(--accent); font-weight: 600; }
.tag { position: absolute; transform: translate(-50%, -130%); pointer-events: none; white-space: nowrap;
  background: #0f6f4f; color: #fff; font-size: .82rem; font-weight: 600; border-radius: 6px; padding: 2px 8px; }
.tag.bad { background: #c02a22; }
#warn { margin-top: 8px; padding: 9px 12px; border-radius: 10px; border: 1px solid #e5392f;
  background: color-mix(in srgb, #e5392f 12%, var(--card)); }

button { font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 12px; cursor: pointer; }
button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.controls { margin-top: 8px; display: grid; gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
#scrub { width: 100%; margin: 0; accent-color: var(--accent); }
#steps { display: flex; gap: 3px; font-size: .72rem; color: var(--mute); }
#steps span { flex-basis: 0; text-align: center; border-bottom: 3px solid var(--line); white-space: nowrap; overflow: hidden; }
#steps span.on { color: var(--fg); border-color: var(--accent); }

ol, ul { margin: 0; padding: 0; list-style: none; }
#cues { display: grid; gap: 8px; }
#cues button { width: 100%; text-align: left; display: grid; gap: 3px; padding: 11px 13px; }
#cues span { font-size: .92rem; }
#cues small { color: var(--mute); }
.role { margin-bottom: 12px; --c: #e5392f; }
.role.secondary { --c: #f59a23; }
.role.brace { --c: #2f7fe0; }
.role button::before { content: ""; display: inline-block; width: 11px; height: 11px; border-radius: 50%;
  background: var(--c); margin-right: 7px; }
.role button[aria-pressed="false"]::before { background: transparent; box-shadow: inset 0 0 0 2px var(--c); }
.role li { margin: 6px 0 0 4px; font-size: .92rem; }
.note { font-size: .86rem; color: var(--mute); }
.note a { color: var(--accent); }

@media (min-width: 880px) {
  main { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 20px; align-items: start; }
  header { grid-column: 1 / -1; }
  .left { position: sticky; top: 12px; }
  #stage { height: min(68vh, 640px); }
  .right section:first-child h2 { margin-top: 0; }
}
