:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --bg: #eef1f6; --panel: #ffffff; --soft: #e4e9f1; --fg: #151a24; --muted: #5b6577;
  --accent: #2f5bea; --accent-fg: #ffffff; --sel: rgba(47, 91, 234, 0.18); --danger: #b3261e; --ok: #1d7a46;
  --ticker: #151a24; --ticker-fg: #e9edf5;
  --radius: 12px; --wrap: 920px;
  --z-sticky: 20; --z-nav: 50; --z-dropdown: 150;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131b; --panel: #181e2a; --soft: #232b3b; --fg: #eef1f7; --muted: #a2adc1;
    --accent: #7c9bff; --accent-fg: #0b1020; --sel: rgba(124, 155, 255, 0.22); --danger: #ff8a80; --ok: #6fd69a;
    --ticker: #0a0d13; --ticker-fg: #dfe5f1;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans CJK KR", "Noto Sans CJK JP", "Noto Sans CJK TC", sans-serif; }
img, canvas, audio { max-width: 100%; }
a { color: var(--accent); }
h1 { font-size: clamp(1.6rem, 1.2rem + 2vw, 2.4rem); line-height: 1.2; margin: 0 0 var(--s4); }
h2 { font-size: clamp(1.25rem, 1.05rem + 1vw, 1.6rem); line-height: 1.3; margin: var(--s6) 0 var(--s3); }
h3 { font-size: 1.1rem; margin: var(--s5) 0 var(--s2); }
p { margin: 0 0 var(--s4); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--s4)); margin-inline: auto; padding-inline: var(--s4); }

.site-header { position: sticky; top: 0; z-index: var(--z-nav); background: var(--panel); }
.ticker { background: var(--ticker); color: var(--ticker-fg); overflow: hidden; font-size: 14px; line-height: 20px; }
.ticker-track { display: flex; width: max-content; animation: tick 70s linear infinite; }
.ticker ul { display: flex; list-style: none; margin: 0; padding: 0; flex-shrink: 0; }
.ticker li { white-space: nowrap; scroll-snap-align: start; }
.ticker a { display: block; padding: var(--s2) var(--s4); color: inherit; text-decoration: none; }
.ticker a:hover, .ticker a:focus-visible { text-decoration: underline; }
.ticker:hover .ticker-track, .ticker:focus-within .ticker-track { animation-play-state: paused; }
@keyframes tick { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) {
  .ticker { overflow-x: auto; scroll-snap-type: x proximity; }
  .ticker-track { animation: none; }
  .ticker ul[aria-hidden="true"] { display: none; }
}
.bar-row { display: flex; align-items: center; gap: var(--s4); min-height: 56px; }
.brand { font-weight: 800; font-size: 1.35rem; color: var(--fg); text-decoration: none; letter-spacing: -0.02em; padding-block: var(--s2); }
.site-nav { margin-left: auto; }
.nav-list { display: flex; gap: var(--s1); list-style: none; margin: 0; padding: 0; }
.nav-list a { display: block; padding: var(--s3) var(--s3); color: var(--fg); text-decoration: none; border-radius: 8px; white-space: nowrap; font-size: 15px; }
.nav-list a:hover, .nav-list a[aria-current="page"] { background: var(--soft); }
.nav-toggle { display: none; margin-left: auto; min-width: 44px; min-height: 44px; border: 0; border-radius: 8px; background: var(--soft); color: var(--fg); font-size: 1.3rem; cursor: pointer; }
@media (max-width: 1020px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .site-nav { margin-left: 0; position: static; }
  .nav-list { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; background: var(--panel); padding: var(--s2) var(--s4) var(--s4); z-index: var(--z-dropdown); }
  .nav-list.is-open { display: flex; }
  .nav-list a { padding: var(--s3); min-height: 44px; }
}

.ticker { order: -1; }
main { flex: 1; padding-block: var(--s5) var(--s7); }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: var(--s3); }
.crumbs a { color: var(--muted); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 70ch; }
.panel { background: var(--panel); border-radius: var(--radius); padding: var(--s5); margin: var(--s5) 0; display: grid; gap: var(--s4); }
@media (max-width: 480px) { .panel { padding: var(--s4); } }
.panel > * { margin: 0; min-width: 0; }
.noscript { background: var(--soft); border-radius: var(--radius); padding: var(--s4); }
.row { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s4); }
.field { display: grid; gap: var(--s2); }
.field label, .stat, .meter-label { color: var(--muted); font-size: 15px; }
.stat { margin: 0; }
select, input[type="number"] { min-height: 44px; border: 0; border-radius: 8px; background: var(--soft); color: var(--fg); padding: 0 var(--s3); font: inherit; width: 100%; }
input[type="range"] { width: 100%; min-height: 44px; accent-color: var(--accent); }
.check { display: flex; gap: var(--s3); align-items: center; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: 44px; padding: 0 var(--s5); border: 0; border-radius: 10px; background: var(--soft); color: var(--fg); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover:not(:disabled) { filter: brightness(0.95); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.icon { min-width: 44px; padding: 0 var(--s3); }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-fg); }
.file-btn:focus-within, .btn:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.file-btn { position: relative; }
.status { color: var(--muted); font-size: 15px; }
.status.on { color: var(--ok); font-weight: 600; }
.seg { gap: var(--s2); }
.viz, .graph, .wave { width: 100%; height: 160px; background: var(--soft); border-radius: 10px; display: block; touch-action: none; }
.wave { height: 140px; cursor: ew-resize; }
.graph { height: 200px; }
.meter { display: grid; grid-template-columns: auto 1fr auto; gap: var(--s3); align-items: center; }
.meter output { min-width: 11ch; text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.meter .bar { position: relative; height: 16px; background: var(--soft); border-radius: 8px; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ok); }
.bar b { position: absolute; top: 0; bottom: 0; width: 3px; background: var(--danger); left: 0; }
@media (max-width: 480px) { .meter { grid-template-columns: 1fr auto; } .meter .meter-label { grid-column: 1 / -1; } }
.bpm-box { flex-wrap: wrap; display: flex; justify-content: center; align-items: center; gap: var(--s4); }
.bpm-box input { width: 7ch; min-height: 64px; font-size: 2.4rem; font-weight: 800; text-align: center; background: var(--soft); border: 0; border-radius: 12px; color: var(--fg); font-variant-numeric: tabular-nums; }
.dots { display: flex; gap: var(--s3); justify-content: center; min-height: 24px; }
.dot { width: 24px; height: 24px; border-radius: 50%; background: var(--soft); }
.dot.on { background: var(--accent); }
.timer { font-size: 2.4rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.rec { background: var(--danger); color: #fff; }
.result { display: grid; gap: var(--s3); background: var(--soft); border-radius: 10px; padding: var(--s4); }
.result audio, #player { width: 100%; }
.tracks { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.tracks li { display: flex; gap: var(--s2); align-items: center; background: var(--soft); border-radius: 10px; padding: var(--s2) var(--s3); }
.track-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.big { font-size: clamp(2.6rem, 2rem + 4vw, 4.4rem); font-weight: 800; line-height: 1.1; margin: 0; font-variant-numeric: tabular-nums; }
.unit { font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.chip { display: inline-block; background: var(--soft); border-radius: 999px; padding: 0 var(--s3); font-weight: 600; color: var(--fg); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s3); margin: 0; }
.stats div { background: var(--soft); border-radius: 10px; padding: var(--s3); text-align: center; }
.stats dt { color: var(--muted); font-size: 14px; }
.stats dd { margin: 0; font-weight: 800; font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.note { background: var(--soft); border-radius: 10px; padding: var(--s3) var(--s4); font-size: 15px; margin: 0; }
.err { background: rgba(179, 38, 30, 0.12); color: var(--fg); border-radius: 10px; padding: var(--s4); }
.err p { margin: 0 0 var(--s2); }
.err-title { font-weight: 700; color: var(--danger); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s4); margin: var(--s5) 0; padding: 0; list-style: none; }
.card { display: grid; gap: var(--s2); align-content: start; height: 100%; background: var(--panel); border-radius: var(--radius); padding: var(--s5); color: var(--fg); text-decoration: none; }
.card:hover { background: var(--soft); }
.card h2 { margin: 0; font-size: 1.2rem; }
.card p { margin: 0; color: var(--muted); font-size: 16px; }
.card .go { color: var(--accent); font-weight: 600; }

.prose { max-width: 75ch; }
.prose ul, .prose ol { padding-left: var(--s5); margin: 0 0 var(--s4); }
.table-wrap { overflow-x: auto; min-width: 0; margin: 0 0 var(--s4); }
.cards-on-mobile { border-collapse: collapse; width: 100%; }
.cards-on-mobile td, .cards-on-mobile th { padding: var(--s2) var(--s3); text-align: left; vertical-align: top; }
.cards-on-mobile tbody tr:nth-child(even) { background: var(--soft); }
@media (max-width: 640px) {
  .cards-on-mobile thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .cards-on-mobile, .cards-on-mobile tbody { display: block; }
  .cards-on-mobile tr { display: block; margin-bottom: var(--s3); padding: var(--s2) var(--s3); background: var(--panel); border-radius: 10px; }
  .cards-on-mobile tbody tr:nth-child(even) { background: var(--panel); }
  .cards-on-mobile td { display: grid; grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr); gap: var(--s3); padding: var(--s2) 0; overflow-wrap: anywhere; }
  .cards-on-mobile td::before { content: attr(data-label); font-weight: 600; color: var(--muted); }
}

.site-footer { background: var(--panel); padding-block: var(--s6); }
.foot-links, .lang-list { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); list-style: none; margin: 0 0 var(--s4); padding: 0; }
.foot-links a, .lang-list a { display: inline-block; padding: var(--s2) 0; min-height: 44px; line-height: 28px; color: var(--fg); }
.lang-list a[aria-current="true"] { font-weight: 700; text-decoration: none; }
.foot-note { color: var(--muted); font-size: 15px; margin: 0; }
.lang-title { color: var(--muted); font-size: 14px; margin: 0; }
.warn { background: rgba(179, 38, 30, 0.12); border-radius: 10px; padding: var(--s3) var(--s4); font-weight: 600; }
.preset { width: 100%; min-height: 56px; font-size: 1.1rem; }
.remain { font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 14px; margin: 0; }
.opts { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); }
:lang(ko) { word-break: keep-all; }
.ico { color: var(--accent); display: inline-flex; }
[hidden] { display: none !important; }
.game-page { padding-top: 0; }
.game-head { display: flex; align-items: center; height: 44px; padding-block: 0; }
.game-head h1 { font-size: 0.95rem; line-height: 1.2; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.game-stage { width: 100%; }
.scream-root { --sg-height: calc(100vh - 136px); min-width: 0; }
@supports (height: 100dvh) { .scream-root { --sg-height: calc(100dvh - 136px); } }
.game-text { padding-top: var(--s6); }
#editor, #fx-panel { display: grid; gap: var(--s4); }
#editor > *, #fx-panel > * { margin: 0; min-width: 0; }
#live-box { display: grid; gap: var(--s3); }
.card-wide { grid-column: 1 / -1; }
.card--game { background: linear-gradient(135deg, #14214f, #3a1f55); color: #fff; }
.card--game:hover { background: linear-gradient(135deg, #1b2c68, #4a2769); }
.card--game p { color: rgba(255, 255, 255, 0.82); }
.card--game .ico, .card--game .go { color: #ffd27a; }
.game-stage { position: relative; }
.consent { position: absolute; top: var(--s2); left: var(--s2); right: var(--s2); max-width: 560px; margin-inline: auto; z-index: var(--z-dropdown); display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s2) var(--s3); border-radius: 12px; background: rgba(3, 5, 11, 0.94); color: #f3ecd9; font-size: 13px; line-height: 1.3; }
.consent p { flex: 1 1 220px; margin: 0; }
.consent a { color: #ffd27a; }
.consent-actions { display: flex; gap: var(--s2); flex: 0 0 auto; }
.consent .btn { min-height: 44px; padding-inline: var(--s4); }
@media (max-width: 480px) { .consent-actions { width: 100%; } .consent-actions .btn { flex: 1 1 0; } }
