/* Console-style music-game UI layer (docs_working/31-music-game-ui-ux.md). Loaded after game.css. */
:root {
  --ink: #1d2440; --cream: #fff7e5; --orange: #ef8862; --gold: #ffd36e;
  --violet: #8f6bd8; --pink: #ff7aa8; --sky: #5cc8f0; --mint: #6fd9a8;
  --display: "Black Han Sans", "Malgun Gothic", system-ui, sans-serif;
  --outline: .14cqw .14cqw 0 var(--ink), -.14cqw -.14cqw 0 var(--ink), .14cqw -.14cqw 0 var(--ink), -.14cqw .14cqw 0 var(--ink);
}
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
#menu {
  display: block; padding: 0; backdrop-filter: none; overflow: hidden; color: var(--cream);
  background: #1d2440 url("/assets/ui/v1/title-bg.webp") center / cover no-repeat;
}
#menu::before { content: ""; position: absolute; inset: 0; pointer-events: none; }
#menu[data-screen="title"]::before { background: linear-gradient(90deg, #1d244099 0%, #1d244033 42%, #0000 62%); }
#menu[data-screen="select"]::before { background: radial-gradient(ellipse at 70% 50%, #2c2560c0, #141a30f0 75%); backdrop-filter: blur(5px) saturate(1.1); }
#menu[data-screen="result"]::before { background: radial-gradient(circle at 25% 45%, #ffd36e40, #1d2440ec 62%); backdrop-filter: blur(6px); }
#menu[data-screen="result"]:has(#result.failed)::before { background: radial-gradient(circle at 25% 45%, #5cc8f030, #141a30f4 62%); }
/* halftone dot texture shared with the concept art */
#menu[data-screen="select"]::after, #menu[data-screen="result"]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .18;
  background: radial-gradient(circle, #fff7e5 22%, transparent 24%) 0 0 / .9cqw .9cqw;
  mask-image: linear-gradient(160deg, #000 0%, transparent 45%, transparent 70%, #000 100%);
}
.screen { position: absolute; inset: 0; z-index: 1; }
#menu button { font-family: inherit; cursor: pointer; }

/* ---------- console plate buttons ---------- */
.plate {
  position: relative; display: grid; place-items: center; width: 24cqw; height: 5cqw; min-height: 34px; padding: 0 2.6cqw .35cqw;
  border: 0; background: url("/assets/ui/v1/ui-button.webp") center / 100% 100% no-repeat; color: var(--cream);
  font-family: var(--display) !important; font-size: max(14px, 2.05cqw); letter-spacing: .04em; text-shadow: var(--outline);
  transition: transform .12s ease-out, filter .12s; filter: drop-shadow(0 .3cqw 0 #0006);
}
.plate.primary { background-image: url("/assets/ui/v1/ui-button-primary.webp"); }
.plate:is(:hover, :focus):not(:disabled) { transform: translateX(1.2cqw) scale(1.06); filter: brightness(1.12) drop-shadow(0 0 1.2cqw #ffd36e99); outline: none; }
.plate::before {
  content: ""; position: absolute; left: -4.6cqw; top: 50%; width: 4.4cqw; height: 4.4cqw; transform: translateY(-50%);
  background: url("/assets/ui/v1/ui-cursor-glove.webp") center / contain no-repeat; opacity: 0; pointer-events: none;
}
.plate:is(:hover, :focus):not(:disabled)::before { opacity: 1; animation: glove-jab .7s ease-in-out infinite; }
.plate:active:not(:disabled) { transform: translateX(1.2cqw) scale(.98); }
.plate:disabled { filter: grayscale(.85) brightness(.75); cursor: not-allowed; }
@keyframes glove-jab { 50% { transform: translate(.6cqw, -50%); } }
.console-menu { display: grid; gap: .6cqw; justify-items: start; }
.console-menu.small .plate { width: 17cqw; height: 3.6cqw; font-size: max(11px, 1.25cqw); }

/* ---------- button prompt bar ---------- */
.prompt-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 5.2%; display: flex; justify-content: flex-end; align-items: center; gap: 1.8cqw; padding: 0 2.5%;
  background: linear-gradient(90deg, #0000, #141a30d8 25%); border-top: 2px solid #ffffff22;
}
.prompt { display: inline-flex; align-items: center; gap: .5cqw; border: 0; background: none; padding: 0; color: var(--cream); font-family: var(--display) !important; font-size: max(10px, 1.05cqw); letter-spacing: .03em; }
button.prompt:hover { color: var(--gold); }
.prompt kbd, #song-list kbd {
  display: inline-grid; place-items: center; width: auto; min-width: 2cqw; height: 1.8cqw; min-height: 16px; padding: 0 .5cqw;
  font-family: system-ui, sans-serif; font-size: max(9px, .85cqw); font-weight: 900; color: var(--ink);
  background: var(--cream); border: 0; border-radius: .9cqw; box-shadow: 0 .18cqw 0 #9a8f7a;
}
.prompt.accent kbd { background: var(--gold); }

/* ---------- title ---------- */
#title-screen h1 { position: absolute; left: 3%; top: 3%; width: 43%; margin: 0; animation: logo-in .7s cubic-bezier(.2,1.6,.4,1) both; }
#title-screen h1 img { width: 100%; filter: drop-shadow(0 .6cqw 0 #1d244088); animation: logo-bob 2.4s ease-in-out .7s infinite; }
#title-menu { position: absolute; left: 7%; top: 52%; }
#title-menu .plate { animation: plate-in .45s cubic-bezier(.2,1.4,.4,1) both; }
#title-menu .plate:nth-child(2) { animation-delay: .06s; } #title-menu .plate:nth-child(3) { animation-delay: .12s; }
#title-menu .plate:nth-child(4) { animation-delay: .18s; } #title-menu .plate:nth-child(5) { animation-delay: .24s; }
@keyframes logo-in { from { transform: scale(.6) rotate(-6deg); opacity: 0; } }
@keyframes logo-bob { 50% { transform: translateY(-.5cqw) rotate(-.6deg); } }
@keyframes plate-in { from { transform: translateX(-30%); opacity: 0; } }

/* ---------- song select ---------- */
.select-head { position: absolute; left: 2%; top: 1.5%; height: 10%; }
.select-head img { height: 100%; filter: drop-shadow(0 .3cqw 0 #0006); }
#song-list {
  position: absolute; left: 0; top: 13%; bottom: 7%; width: 41%; margin: 0; padding: .4cqw 0 2cqw 2.2%;
  list-style: none; overflow-y: auto; overflow-x: hidden; scrollbar-width: none;
  mask-image: linear-gradient(#0000, #000 4%, #000 92%, #0000);
}
#song-list li { margin: 0 0 .45cqw; }
.song-card {
  position: relative; width: 34cqw; height: 5.1cqw; display: grid; grid-template-columns: 3.5cqw 1fr auto; align-items: center; gap: 1.1cqw;
  padding: 0 2.6cqw 0 2.15cqw; border: 0; text-align: left; color: var(--cream);
  background: url("/assets/ui/v1/ui-song-plate.webp") center / 100% 100% no-repeat; opacity: .78;
  transition: transform .14s ease-out, opacity .14s, filter .14s; filter: drop-shadow(0 .25cqw 0 #0007);
}
.song-card img:first-child { width: 3.5cqw; height: 3.5cqw; object-fit: cover; border-radius: .25cqw; border: 2px solid var(--ink); }
.song-card .meta { display: grid; min-width: 0; line-height: 1.08; }
.song-card small { font-family: var(--display); font-size: max(9px, .85cqw); color: var(--gold); letter-spacing: .06em; }
.song-card b { font-family: var(--display); font-weight: 400; font-size: max(12px, 1.55cqw); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: var(--outline); }
.song-card .meta span { font-size: max(9px, .85cqw); opacity: .8; }
.song-card .mini-rank { width: 2.8cqw; filter: drop-shadow(0 1px 0 var(--ink)); }
.song-card .lock { position: absolute; right: 3cqw; top: .7cqw; font-style: normal; font-family: var(--display); font-size: max(8px, .72cqw); padding: 0 .5cqw; border-radius: .6cqw; background: #0009; color: #ffb1a0; }
#song-list.preview .lock { color: #c9d3ff; }
#song-list.preview .lock::after { content: " · 시연 가능"; }
.song-card:hover { opacity: .95; }
.song-card.active { opacity: 1; transform: translateX(1.6cqw) scale(1.04); background-image: url("/assets/ui/v1/ui-song-plate-active.webp"); filter: drop-shadow(0 .3cqw 0 #0008) drop-shadow(0 0 1cqw #ffd36e77); }
.song-card.active small { color: #fff; }
.song-card:focus { outline: none; }
.song-card.active:focus::before {
  content: ""; position: absolute; left: -1.6cqw; top: 50%; width: 3.2cqw; height: 3.2cqw; transform: translateY(-50%);
  background: url("/assets/ui/v1/ui-cursor-glove.webp") center / contain no-repeat; animation: glove-jab .7s ease-in-out infinite;
}
#song-panel {
  position: absolute; left: 43%; right: 2%; top: 4%; bottom: 7.5%; padding: .6cqw .8cqw .4cqw;
  border: 2.4cqw solid transparent; border-image: url("/assets/ui/v1/ui-panel.webp") 100 fill / 2.4cqw stretch;
  display: grid; grid-template-columns: 17cqw 1fr; grid-template-rows: auto 1fr auto; gap: 1.1cqw 1.8cqw; align-content: start;
  filter: drop-shadow(.4cqw .5cqw 0 #0007); animation: panel-in .35s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes panel-in { from { transform: translateX(6%); opacity: 0; } }
.jacket-wrap { position: relative; aspect-ratio: 1; transform: rotate(-3deg); }
#song-jacket { width: 100%; height: 100%; object-fit: cover; border: .3cqw solid var(--cream); border-radius: .9cqw; box-shadow: .45cqw .55cqw 0 var(--ink); background: #3a4470; }
#song-lock { position: absolute; inset: 0; display: grid; place-items: center; border-radius: .9cqw; background: #1d2440b8; font-family: var(--display); font-size: max(16px, 2.2cqw); color: #ffb1a0; text-shadow: var(--outline); }
.song-info { display: grid; gap: .55cqw; align-content: start; min-width: 0; }
.song-code { margin: 0; justify-self: start; padding: .1cqw .9cqw; border-radius: .5cqw; background: var(--gold); color: var(--ink); font-family: var(--display); font-size: max(9px, .9cqw); letter-spacing: .08em; transform: skewX(-8deg); }
#song-title { margin: 0; font-family: var(--display); font-weight: 400; font-size: max(20px, 2.8cqw); line-height: 1.1; color: #fff; text-shadow: var(--outline), .25cqw .3cqw 0 var(--ink); }
#song-detail { margin: 0; font-size: max(10px, 1.02cqw); line-height: 1.5; color: #fff7e5cc; }
#difficulty-tabs { display: flex; gap: .4cqw; align-items: center; }
.diff { position: relative; flex: 1; max-width: 9.5cqw; padding: 0; border: 0; background: none; opacity: .45; filter: grayscale(.6); transition: transform .12s, opacity .12s, filter .12s; }
.diff .badge { width: 100%; display: block; }
.diff .rank { position: absolute; right: -.4cqw; top: -.9cqw; width: 2.4cqw; }
.diff:hover { opacity: .75; }
.diff.active { opacity: 1; filter: drop-shadow(0 0 .8cqw #ffd36e99); transform: translateY(-.25cqw) scale(1.08); }
#record-card { display: flex; align-items: center; gap: .8cqw; min-height: 3.6cqw; padding: .4cqw .9cqw; border-radius: .7cqw; background: #0004; border: 2px solid #ffffff1f; }
#record-rank { height: 3.2cqw; }
#record-detail { margin: 0; font-family: var(--display); font-size: max(10px, 1cqw); letter-spacing: .02em; }
#option-list { grid-column: 1 / -1; gap: .35cqw; justify-items: stretch; align-content: end; }
.opt-row {
  display: grid; grid-template-columns: 1fr 2.4cqw minmax(12cqw, 16cqw) 2.4cqw; align-items: center; gap: .4cqw; height: 3cqw; min-height: 24px; padding: 0 .8cqw 0 1.2cqw;
  border-radius: .6cqw; background: linear-gradient(90deg, #ffffff10, #ffffff06); border: 2px solid transparent; font-family: var(--display); font-size: max(10px, 1.1cqw);
  transform: skewX(-8deg); transition: background .12s, border-color .12s;
}
.opt-row > * { transform: skewX(8deg); }
.opt-row .label { color: #fff7e5c8; }
.opt-row .value { text-align: center; font-weight: 400; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt-row .arrow { border: 0; background: none; color: var(--gold); font-size: max(10px, 1.05cqw); padding: 0; opacity: .55; }
.opt-row:is(:focus, :hover) { outline: none; background: linear-gradient(90deg, #ef886266, #8f6bd855); border-color: var(--gold); }
.opt-row:is(:focus, :hover) .arrow { opacity: 1; }
.opt-row:focus .arrow[data-step="-1"] { animation: nudge-l .8s ease-in-out infinite; }
.opt-row:focus .arrow[data-step="1"] { animation: nudge-r .8s ease-in-out infinite; }
.opt-row.disabled { opacity: .45; } .opt-row.disabled .arrow { visibility: hidden; }
@keyframes nudge-l { 50% { transform: skewX(8deg) translateX(-.3cqw); } }
@keyframes nudge-r { 50% { transform: skewX(8deg) translateX(.3cqw); } }
#start { grid-column: 1 / -1; justify-self: center; width: 30cqw; height: 5.8cqw; font-size: max(17px, 2.4cqw); }
#start:is(:hover, :focus):not(:disabled) { transform: scale(1.06); }
#status { position: absolute; left: 2.5%; bottom: 1.4%; max-width: 48%; margin: 0; z-index: 2; font-size: max(9px, .85cqw); color: #fff7e5a0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- result ---------- */
.result-hero { position: absolute; left: 2%; top: 4%; bottom: 7%; width: 42%; }
#result-banner { position: absolute; left: 0; top: 0; width: 100%; max-height: 30%; object-fit: contain; animation: banner-in .6s cubic-bezier(.2,1.6,.4,1) both; z-index: 1; }
#result-bunny { position: absolute; left: 14%; bottom: 0; height: 70%; max-width: 78%; object-fit: contain; animation: bunny-in .7s .15s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes banner-in { from { transform: scale(1.8); opacity: 0; } }
@keyframes bunny-in { from { transform: translateY(15%); opacity: 0; } }
.result-card {
  position: absolute; right: 2%; top: 3%; bottom: 17%; width: 55%; overflow-y: auto; scrollbar-width: thin; padding: .4cqw 1cqw;
  border: 2.4cqw solid transparent; border-image: url("/assets/ui/v1/ui-panel.webp") 100 fill / 2.4cqw stretch; filter: drop-shadow(.4cqw .5cqw 0 #0007);
  display: grid; gap: .7cqw; align-content: start; color: var(--cream); text-align: left;
}
.result-song { display: flex; gap: 1cqw; align-items: center; }
.result-song img { width: 4.4cqw; height: 4.4cqw; object-fit: cover; border-radius: .5cqw; border: 2px solid var(--cream); }
.result-song div { display: grid; gap: .1cqw; }
.result-song b { font-family: var(--display); font-weight: 400; font-size: max(13px, 1.6cqw); text-shadow: var(--outline); }
.result-song span { font-family: var(--display); font-size: max(10px, .95cqw); color: var(--gold); letter-spacing: .05em; }
#result-title { margin: 0; font-size: max(11px, 1.1cqw); color: #fff7e5b0; }
.result-main { display: flex; align-items: center; gap: 1.5cqw; }
#result-rank { width: 9.5cqw; animation: rank-in .55s .5s cubic-bezier(.2,1.8,.4,1) both; }
@keyframes rank-in { from { transform: scale(2.6) rotate(-20deg); opacity: 0; } }
.result-score { display: grid; gap: .15cqw; }
.result-score > span { font-family: var(--display); font-size: max(10px, 1cqw); letter-spacing: .2em; color: #fff7e5a0; }
#result-score { font-family: var(--display); font-weight: 400; font-size: max(26px, 4.3cqw); line-height: 1; color: #fff; text-shadow: var(--outline), .3cqw .3cqw 0 var(--ink); font-variant-numeric: tabular-nums; }
#result-accuracy { font-style: normal; font-family: var(--display); font-size: max(11px, 1.15cqw); color: var(--sky); }
#result-badges { display: flex; gap: .5cqw; flex-wrap: wrap; }
#result-badges b { padding: .1cqw .8cqw; border-radius: .5cqw; transform: skewX(-8deg); font-family: var(--display); font-weight: 400; font-size: max(9px, .95cqw); background: linear-gradient(90deg, var(--gold), var(--pink)); color: var(--ink); animation: blink 1s ease-in-out 3; }
@keyframes blink { 50% { opacity: .35; } }
#result-judgments { list-style: none; margin: 0; padding: 0; display: grid; gap: .4cqw; }
#result-judgments li { display: grid; grid-template-columns: 7cqw 1fr 4cqw; align-items: center; gap: 1cqw; font-family: var(--display); font-size: max(11px, 1.15cqw); }
#result-judgments i { height: .9cqw; border-radius: 1cqw; background: #ffffff18; overflow: hidden; transform: skewX(-12deg); }
#result-judgments i b { display: block; height: 100%; animation: grow .8s .3s ease-out both; transform-origin: left; }
#result-judgments strong { font-weight: 400; text-align: right; font-variant-numeric: tabular-nums; }
#result-judgments .perfect span { color: var(--gold); } #result-judgments .perfect b { background: linear-gradient(90deg, var(--gold), var(--pink)); }
#result-judgments .great span { color: var(--sky); } #result-judgments .great b { background: var(--sky); }
#result-judgments .good span { color: var(--mint); } #result-judgments .good b { background: var(--mint); }
#result-judgments .miss span { color: #a9a3c4; } #result-judgments .miss b { background: #8a84a8; }
@keyframes grow { from { transform: scaleX(0); } }
#result-combo { margin: 0; font-family: var(--display); font-size: max(11px, 1.1cqw); }
.result-card details { font-size: max(10px, .9cqw); opacity: .85; }
.result-card summary { cursor: pointer; font-family: var(--display); }
.result-card pre { color: var(--cream); font-size: max(10px, .9cqw); margin: .4cqw 0; }
#save-status { margin: 0; font-size: max(10px, .9cqw); color: #fff7e5b0; }
.result-menu { position: absolute; right: 2%; width: 55%; bottom: 7%; height: 9%; display: flex; justify-content: center; align-items: center; gap: 1.2cqw; }
.result-menu > span { display: contents; }
.result-menu > span[hidden] { display: none; }
.result-menu .plate { width: 12.5cqw; height: 4.2cqw; padding: 0 1.4cqw .3cqw; font-size: max(11px, 1.4cqw); }
.result-menu .plate:is(:hover, :focus):not(:disabled) { transform: translateY(-.3cqw) scale(1.06); }
.result-menu .plate::before { left: 50%; top: -3.4cqw; transform: translateX(-50%) rotate(90deg); width: 3cqw; height: 3cqw; }
.result-menu .plate:is(:hover, :focus):not(:disabled)::before { animation: glove-down .7s ease-in-out infinite; }
@keyframes glove-down { 50% { transform: translate(-50%, .4cqw) rotate(90deg); } }
#save-recovery { display: flex; flex-wrap: wrap; gap: .6cqw 2cqw; padding-left: 1.6cqw; }
#save-recovery[hidden] { display: none; }
#ending { margin: 0; padding: .7cqw 1cqw; border-radius: .7cqw; background: #0005; border: 2px solid #ffd36e88; color: var(--cream); font-size: max(10px, .95cqw); line-height: 1.55; white-space: pre-line; }

/* ---------- HUD ---------- */
#health { background: #1d2440d0; border-color: #fff7e5aa; }
#health span { display: inline-flex; }
#health .on { color: #fa8277; } #health .off { color: #3b4565; opacity: .75; }
#health .lost { animation: heart-lost .45s; }
@keyframes heart-lost { 30% { transform: scale(1.5) rotate(-15deg); color: #fff; } }
#combo { transition: opacity .2s; font-family: var(--display); }
#combo.zero { opacity: 0; }
#combo.pop strong { animation: combo-pop .22s ease-out; }
@keyframes combo-pop { from { transform: scale(1.45); color: #fff; } }
#score-box { display: grid; justify-items: end; line-height: 1; padding: .4cqw 1.1cqw; border-radius: 1cqw; background: #1d2440d0; border: 2px solid #d4e9ff; color: #fff9e7; }
#score-box span { font-family: var(--display); font-size: max(8px, .8cqw); letter-spacing: .2em; color: #97d9f2; }
#score { font-family: var(--display); font-weight: 400; font-size: max(14px, 2cqw); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
#time { font-family: var(--display); font-weight: 400; }
#progress { position: absolute; left: 0; right: 0; top: 112%; height: .45cqw; min-height: 3px; border-radius: 1cqw; background: #1d244088; overflow: hidden; }
#progress-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--sky), var(--violet), var(--orange)); }
#stop { border-radius: 50%; width: 4.2cqw; height: 4.2cqw; min-width: 28px; min-height: 28px; padding: 0; display: grid; place-items: center; }
#controls button span { font-family: var(--display); font-weight: 400; }
#judge { position: absolute; z-index: 3; left: 46%; top: 52%; width: 22cqw; transform: translate(-50%, -50%); pointer-events: none; opacity: 0; display: grid; justify-items: center; }
#judge img { width: 100%; filter: drop-shadow(0 .3cqw 0 #1d244066); }
#judge.miss img { width: 72%; }
#judge.show { animation: judge-pop .5s ease-out forwards; }
#judge-counter { margin-top: -.5cqw; font-family: var(--display); font-size: 2.4cqw; color: var(--gold); text-shadow: var(--outline), .2cqw .2cqw 0 var(--ink); }
@keyframes judge-pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(.95); } 25% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -62%) scale(1); } }
#judge.miss.show { animation-name: judge-miss; }
@keyframes judge-miss { 0% { opacity: 0; transform: translate(-50%, -60%); } 20% { opacity: 1; transform: translate(-50%, -50%); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -40%); } }
#judge-delta { margin-top: -.3cqw; font-family: var(--display); font-size: 1.9cqw; letter-spacing: .03em; text-shadow: var(--outline), .15cqw .15cqw 0 var(--ink); }
#judge-delta.fast { color: #9fd8ff; } #judge-delta.slow { color: #ffb1a0; } #judge-delta.perfect { color: var(--cream); font-size: 1.5cqw; }
#timing-meter {
  position: absolute; z-index: 4; left: 50%; top: 41%; width: 24cqw; transform: translateX(-50%); display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: .8cqw;
  padding: .55cqw 1cqw; border-radius: 1cqw; background: #1d2440d8; border: 2px solid #ffffff33; pointer-events: none;
}
#timing-meter[hidden] { display: none; }
#timing-meter > span { font-family: var(--display); font-size: max(9px, .95cqw); }
#timing-meter .fast { color: #9fd8ff; } #timing-meter .slow { color: #ffb1a0; }
#timing-meter .track { position: relative; height: 2.4cqw; }
#timing-meter .track > i { position: absolute; top: 50%; left: 50%; height: .8cqw; transform: translate(-50%, -50%); }
#timing-meter .track > .good { background: #6fd9a8; } #timing-meter .track > .great { background: #5cc8f0; } #timing-meter .track > .perfect { background: #ffd36e; }
#timing-meter .center { position: absolute; left: 50%; top: 0; bottom: 0; width: .25cqw; transform: translateX(-50%); background: #fff; }
#timing-ticks i { position: absolute; top: 8%; bottom: 8%; width: .35cqw; min-width: 2px; transform: translateX(-50%); border-radius: 1px; background: #fff; box-shadow: 0 0 0 1px #1d2440; }
#timing-ticks i.perfect { background: #ffd36e; } #timing-ticks i.great { background: #5cc8f0; } #timing-ticks i.good { background: #6fd9a8; } #timing-ticks i.miss { background: #ff7a7a; }
#timing-ticks i.latest { top: -18%; bottom: -18%; width: .5cqw; }

/* ---------- count-in / loading ---------- */
#rewind { inset: 32% 26%; background: none; border-radius: 0; border: 2.4cqw solid transparent; border-image: url("/assets/ui/v1/ui-panel.webp") 100 fill / 2.4cqw stretch; }
#rewind.count, #rewind.go { border-image: none; border-color: transparent; }
#rewind strong { font-family: var(--display); font-weight: 400; font-size: max(13px, 1.8cqw); color: var(--gold); text-shadow: var(--outline); }
#rewind-count { font-size: max(12px, 1.3cqw); }
#rewind.count, #rewind.go { inset: 22% 25%; background: none; }
#rewind.count #rewind-count, #rewind.go #rewind-count {
  font-family: var(--display); font-size: 11cqw; line-height: 1; color: #fff; margin: 0;
  text-shadow: .5cqw .5cqw 0 var(--ink), -.2cqw -.2cqw 0 var(--ink), .2cqw -.2cqw 0 var(--ink), -.2cqw .2cqw 0 var(--ink); animation: count-beat .5s ease-out;
}
#rewind.go #rewind-count { color: var(--gold); animation: go-pop .45s ease-out forwards; }
@keyframes count-beat { from { transform: scale(1.4); } }
@keyframes go-pop { from { transform: scale(.6); } 60% { transform: scale(1.2); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

/* ---------- pause ---------- */
#pause { background: #141a30cc; backdrop-filter: blur(5px); }
.pause-panel {
  width: 36cqw; min-width: 280px; display: grid; gap: .8cqw; justify-items: center; padding: .6cqw 1cqw; text-align: center; color: var(--cream);
  border: 2.4cqw solid transparent; border-image: url("/assets/ui/v1/ui-panel.webp") 100 fill / 2.4cqw stretch; filter: drop-shadow(.4cqw .5cqw 0 #0007);
}
.pause-panel h2 { margin: 0; } .pause-panel h2 img { height: 5.5cqw; min-height: 36px; }
.pause-panel p { margin: 0; font-size: max(10px, .95cqw); opacity: .85; }
.pause-panel .console-menu { justify-items: center; }
#pause .plate { border: 0; border-radius: 0; box-shadow: none; padding: 0 2.6cqw .35cqw; color: var(--cream); background: url("/assets/ui/v1/ui-button.webp") center / 100% 100% no-repeat; }
#pause .plate.primary { background-image: url("/assets/ui/v1/ui-button-primary.webp"); }
.song-card.active .meta { transform: translateY(.3cqw); }
.pause-panel .plate { width: 22cqw; height: 4.2cqw; font-size: max(12px, 1.5cqw); }
.pause-panel .plate:is(:hover, :focus):not(:disabled) { transform: scale(1.06); }
.toggle { display: inline-flex; align-items: center; gap: .6cqw; font-family: var(--display); font-weight: 400; font-size: max(11px, 1.1cqw); cursor: pointer; }
.toggle input { appearance: none; width: 3.2cqw; height: 1.7cqw; min-width: 28px; min-height: 15px; margin: 0; border-radius: 1cqw; background: #ffffff33; border: 2px solid var(--ink); position: relative; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 50%; left: .15cqw; width: 1.2cqw; height: 1.2cqw; min-width: 10px; min-height: 10px; border-radius: 50%; background: var(--cream); transform: translateY(-50%); transition: left .15s; }
.toggle input:checked { background: var(--mint); }
.toggle input:checked::after { left: calc(100% - 1.4cqw); }
.toggle input:focus-visible { outline: 3px solid var(--gold); }

/* ---------- console dialogs (settings, credits, import, confirm) ---------- */
dialog.console-dialog {
  --stage-w: min(100vw, 177.78dvh);
  width: var(--stage-w); height: calc(var(--stage-w) * .5625); max-width: none; max-height: none; margin: auto; padding: 0;
  border: 0; outline: 0; border-radius: 0; box-shadow: none; overflow: visible; background: none; color: var(--cream);
}
dialog.console-dialog::backdrop { background: #141a30d8; backdrop-filter: blur(6px); }
.cd-frame {
  container-type: inline-size; position: absolute; inset: 4% 9% 3%; display: grid; grid-template-rows: auto auto 1fr auto auto auto auto; gap: .8cqw;
  padding: 0 1.4cqw; border: 2.4cqw solid transparent; border-image: url("/assets/ui/v1/ui-panel.webp") 100 fill / 2.4cqw stretch;
  filter: drop-shadow(.5cqw .6cqw 0 #0008); animation: panel-in .3s cubic-bezier(.2,1.3,.4,1) both;
}
.console-dialog.small .cd-frame { inset: 14% 20%; grid-template-rows: none; align-content: center; gap: 1.6cqw; text-align: center; justify-items: center; }
.cd-head { display: flex; align-items: baseline; gap: 2cqw; }
.cd-head h2 { margin: 0; font-family: var(--display); font-weight: 400; font-style: italic; font-size: 4cqw; letter-spacing: .04em; color: var(--gold); text-shadow: var(--outline), .3cqw .3cqw 0 var(--ink); }
.console-dialog.small .cd-head { flex-direction: column; align-items: center; gap: .3cqw; }
.console-dialog.small .cd-head h2 { font-size: 4.4cqw; }
.cd-sub { margin: 0; font-size: max(10px, 1.4cqw); color: #fff7e5a8; }
.cd-tabs { display: flex; align-items: center; gap: .8cqw; padding-bottom: .6cqw; border-bottom: 2px solid #ffffff22; }
.cd-tabs .tab-key { display: inline-grid; place-items: center; min-width: 3cqw; height: 2.6cqw; font-family: system-ui, sans-serif; font-size: 1.3cqw; font-weight: 900; color: var(--ink); background: var(--cream); border-radius: .6cqw; box-shadow: 0 .25cqw 0 #9a8f7a; }
.cd-tab {
  flex: 1; height: 4.2cqw; border: 2px solid #ffffff2a; border-radius: .8cqw; background: #ffffff0d; color: #fff7e5a0;
  font-family: var(--display); font-size: max(12px, 2cqw); transform: skewX(-10deg); cursor: pointer; transition: all .12s;
}
.cd-tab:hover { color: var(--cream); border-color: #ffffff66; }
.cd-tab.active { color: var(--ink); background: linear-gradient(180deg, #ffd36e, #ef8862); border-color: var(--ink); box-shadow: 0 .35cqw 0 var(--ink); transform: skewX(-10deg) translateY(-.2cqw); }
.cd-tab:focus-visible { outline: 3px solid var(--gold); }
.cd-body { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ffffff44 transparent; padding: .4cqw 1.6cqw .4cqw 5cqw; }
.set-page { display: grid; gap: 1.2cqw; align-content: start; }
.set-rows { display: grid; gap: .5cqw; }
.set-row {
  position: relative; display: grid; grid-template-columns: 1fr 3cqw 30cqw 3cqw; align-items: center; gap: .6cqw; height: 4.6cqw; padding: 0 1.4cqw 0 2cqw;
  border-radius: .8cqw; border: 2px solid transparent; background: linear-gradient(90deg, #ffffff12, #ffffff05);
  font-family: var(--display); font-size: max(12px, 1.9cqw); transform: skewX(-8deg); cursor: pointer; transition: background .12s, border-color .12s;
}
.set-row > * { transform: skewX(8deg); }
.set-row .label { color: #fff7e5d8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-row .value { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1.2cqw; }
.set-row .value em { font-style: normal; color: #fff; text-align: center; min-width: 7cqw; grid-column: 2; }
.set-row[data-kind="bool"] .value em, .set-row[data-kind="key"] .value em { grid-column: 1 / -1; }
.set-row .gauge { grid-column: 1; height: 1.1cqw; border-radius: 1cqw; background: #0006; border: 2px solid #ffffff33; overflow: hidden; transform: skewX(-12deg); }
.set-row .gauge[hidden] { display: none; }
.set-row .gauge b { display: block; height: 100%; background: linear-gradient(90deg, var(--sky), var(--violet), var(--orange)); }
.set-row[data-kind="bool"] em { justify-self: center; padding: .1cqw 1.6cqw; border-radius: .6cqw; background: #0006; color: #fff7e588; }
.set-row.on em { background: var(--mint); color: var(--ink); }
.set-row[data-kind="key"] em { justify-self: center; min-width: 6cqw; padding: .1cqw 1.2cqw; border-radius: .6cqw; background: var(--cream); color: var(--ink); box-shadow: 0 .3cqw 0 #9a8f7a; font-family: system-ui, sans-serif; font-weight: 900; }
.set-row.capturing em { background: var(--gold); animation: blink .8s ease-in-out infinite; }
.set-row .arrow { border: 0; background: none; padding: 0; color: var(--gold); font-size: max(11px, 1.6cqw); opacity: .4; cursor: pointer; }
.set-row:is(:focus, :hover) { outline: none; border-color: var(--gold); background: linear-gradient(90deg, #ef886270, #8f6bd855); }
.set-row:is(:focus, :hover) .arrow { opacity: 1; }
.set-row:focus .arrow[data-step="-1"] { animation: nudge-l .8s ease-in-out infinite; }
.set-row:focus .arrow[data-step="1"] { animation: nudge-r .8s ease-in-out infinite; }
.set-row:focus::before {
  content: ""; position: absolute; left: -4.6cqw; top: 50%; width: 4cqw; height: 4cqw; transform: skewX(8deg) translateY(-50%);
  background: url("/assets/ui/v1/ui-cursor-glove.webp") center / contain no-repeat;
}
.set-row.disabled { opacity: .45; cursor: not-allowed; } .set-row.disabled .arrow { visibility: hidden; }
.calib { display: grid; grid-template-columns: auto 1fr; gap: .8cqw 1.6cqw; align-items: center; padding: 1.2cqw 1.6cqw; border-radius: 1cqw; background: #0004; border: 2px solid #ffffff1f; }
.calib-buttons, .data-actions, .cd-row-buttons, .cd-foot { display: flex; flex-wrap: wrap; gap: 1cqw 1.6cqw; align-items: center; }
.cd-row-buttons { justify-content: center; }
.cd-frame .plate { width: auto; min-width: 16cqw; height: 4.4cqw; padding: 0 2.6cqw .35cqw; font-size: max(12px, 1.7cqw); }
.cd-frame .plate:is(:hover, :focus):not(:disabled) { transform: translateY(-.25cqw) scale(1.05); }
.cd-frame .plate::before { left: 50%; top: -3.6cqw; transform: translateX(-50%) rotate(90deg); width: 3.2cqw; height: 3.2cqw; }
.cd-frame .plate:is(:hover, :focus):not(:disabled)::before { animation: glove-down .7s ease-in-out infinite; }
.plate.danger { filter: hue-rotate(-35deg) saturate(1.4) drop-shadow(0 .3cqw 0 #0006); }
.plate.danger:is(:hover, :focus):not(:disabled) { filter: hue-rotate(-35deg) saturate(1.6) brightness(1.1) drop-shadow(0 0 1.2cqw #ff7aa899); }
#calibration-beat { grid-row: 1 / 3; width: 6cqw; height: 6cqw; margin: 0; border: .4cqw solid var(--ink); border-radius: 50%; background: #ffffff22; box-shadow: inset 0 0 0 .3cqw #ffffff33; transition: transform .05s; }
#calibration-beat.beat { background: var(--orange); box-shadow: 0 0 0 1.2cqw #ef886255; transform: scale(1.1); }
#calibration-readout { margin: 0; font-size: max(10px, 1.3cqw); line-height: 1.5; color: #fff7e5c8; }
.data-actions { padding: 1.2cqw 0 0; }
.cd-help { min-height: 2.6cqw; margin: 0; padding: .6cqw 1.4cqw; border-radius: .8cqw; background: #0005; border-left: .5cqw solid var(--gold); font-size: max(10px, 1.35cqw); line-height: 1.45; color: #fff7e5d8; }
.cd-help:empty { visibility: hidden; }
.cd-warning { padding: 1cqw 1.4cqw; border-radius: .8cqw; background: #ff7aa822; border: 2px solid var(--pink); font-size: max(10px, 1.35cqw); }
.cd-warning[hidden] { display: none; }
.cd-warning p { margin: 0 0 1cqw; }
.cd-status { margin: 0; font-size: max(10px, 1.25cqw); color: #ffd36ed0; }
.cd-status:empty { display: none; }
.cd-foot { justify-content: flex-end; }
.cd-frame > .prompt-bar { position: static; height: auto; padding: .6cqw 0 0; background: none; border-top: 2px solid #ffffff22; }
.cd-frame .prompt { font-size: max(10px, 1.35cqw); }
.cd-frame .prompt kbd { min-width: 2.6cqw; height: 2.3cqw; font-size: max(9px, 1.1cqw); border-radius: .6cqw; }
.cd-text { margin: 0; max-width: 90%; font-size: max(11px, 1.7cqw); line-height: 1.6; color: #fff7e5d8; }
.cd-text.dim { font-size: max(10px, 1.3cqw); color: #fff7e588; }
.console-dialog .toggle { font-size: max(11px, 1.6cqw); }
.console-dialog .toggle input { width: 4.4cqw; height: 2.4cqw; }
.console-dialog .toggle input::after { width: 1.7cqw; height: 1.7cqw; left: .25cqw; }
.console-dialog .toggle input:checked::after { left: calc(100% - 2cqw); }
.cd-frame.stage-options { grid-template-rows: auto auto 1fr auto auto auto auto; }
.stage-options .set-rows { align-content: start; gap: .9cqw; }
.credits { display: grid; grid-template-columns: auto 1fr; gap: .7cqw 2cqw; margin: 0; text-align: left; font-size: max(10px, 1.45cqw); }
.credits dt { font-family: var(--display); color: var(--gold); }
.credits dd { margin: 0; color: #fff7e5d8; }
.credits a { color: #9fd8ff; }

@media (prefers-reduced-motion: reduce) {
  #menu *, #menu *::before, #judge, #combo strong, #rewind-count { animation: none !important; }
  #judge.show { opacity: 1; }
}
/* small console dialogs: cqw is relative to the narrower frame, so scale text up */
.console-dialog.small .cd-head h2 { font-size: 6.4cqw; }
.console-dialog.small .cd-sub { font-size: max(11px, 2cqw); }
.console-dialog.small .cd-text { font-size: max(12px, 2.4cqw); }
.console-dialog.small .cd-text.dim { font-size: max(10px, 1.9cqw); }
.console-dialog.small .credits { font-size: max(11px, 2.1cqw); gap: 1cqw 3cqw; }
.console-dialog.small .toggle { font-size: max(12px, 2.3cqw); }
.console-dialog.small .plate { min-width: 22cqw; height: 6.2cqw; font-size: max(13px, 2.5cqw); }
.console-dialog.small .plate::before { top: -5cqw; width: 4.4cqw; height: 4.4cqw; }

/* ---------- wide phone view ----------
   #stage stays the 16:9 box (so cqw sizes are unchanged). On wider windows the canvases, HUD row, thumb
   buttons and full-screen layers extend past it to the window edges: --side is the visible extra width on
   each side, --canvas-side the extra width the canvases are allocated for (set by resize() in game.ts). */
#viewport { overflow: hidden; }
#stage { --side: 0px; --canvas-side: 0px; overflow: visible; }
#stage::before { content: ""; position: absolute; inset: 0 calc(-1 * var(--side)); z-index: -1; background: #b2c5ed; }
#stage > canvas { left: calc(-1 * var(--canvas-side)); right: auto; width: calc(100% + 2 * var(--canvas-side)); }
#hud { left: calc(2.5% - var(--side)); right: calc(2.5% - var(--side)); }
#controls, #menu, #pause { left: calc(-1 * var(--side)); right: calc(-1 * var(--side)); }
/* Fullscreen toggle on the title (shown only where the browser allows page fullscreen). */
#fullscreen-toggle { position: absolute; right: 3%; top: 4%; z-index: 2; }
