/* 딴짓 · 노래방 점수 — 1990~2000년대 노래방 브라운관: 파랑→보라 그라데이션, 반짝이 점, 주사선, 도트 글씨, 무지개 멘트 */
@font-face { font-family: 'KaraokePixel'; src: url(/vendor/galmuri/galmuri11-ks.woff2) format('woff2'); font-display: block; }
:root {
  --room: #16123a; --room-2: #241a52; --ink: #0a0820; --paper: #f4f1ff; --dim: #b9b2e6;
  --yellow: #ffe14f; --pink: #ff4fd8; --cyan: #4fe0ff; --green: #7dff6a; --red: #ff3b5c;
  --px: 'KaraokePixel', 'Pretendard Variable', monospace;
  --ui: 'Pretendard Variable', Pretendard, -apple-system, 'Apple SD Gothic Neo', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; overflow-x: clip; touch-action: manipulation; }
body { margin: 0; min-height: 100svh; color: var(--paper); font: 500 16px/1.55 var(--ui); overflow-x: clip;
  background: radial-gradient(ellipse at 50% 0%, #3a2a7a 0%, var(--room) 55%) fixed var(--room); }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }

.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; max-width: 1080px; margin: 0 auto; }
.logo { font: 400 20px/1 var(--px); color: var(--ink); background: var(--yellow); padding: 10px 12px 8px; text-decoration: none; box-shadow: 4px 4px 0 var(--pink); }
.top-r { display: flex; gap: 8px; }
.chip { appearance: none; min-height: 44px; padding: 0 12px; border: 2px solid var(--paper); border-radius: 999px; background: transparent; font-weight: 700; font-size: 14px; cursor: pointer; }
.chip[aria-pressed="false"] { opacity: .6; }

.stage { max-width: 1080px; margin: 0 auto; padding: 0 16px 24px; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 16px; min-height: calc(100svh - 64px); }

/* 기계: 브라운관 + 조작판 */
.machine { min-width: 0; background: linear-gradient(180deg, #2c2c34, #17171d); border: 3px solid #000; border-radius: 22px; padding: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.12); }
.screen { position: relative; min-height: clamp(300px, 86vw, 470px); border-radius: 26px / 22px; overflow: hidden; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 18px 10px 34px;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,.16) 0 2px, transparent 2px 4px),
    radial-gradient(rgba(255,255,255,.55) 1px, transparent 1.6px) 0 0 / 23px 19px,
    linear-gradient(180deg, #1b2bb8 0%, #3a1fa8 55%, #a01f8a 100%);
  box-shadow: inset 0 0 60px rgba(0,0,0,.55), inset 0 0 0 4px #000; }
.screen::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.14), transparent 50%); }
#fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.label { margin: 0 0 8px; font: 400 clamp(18px, 5vw, 26px)/1 var(--px); color: var(--yellow); letter-spacing: .3em; text-shadow: 3px 3px 0 var(--ink); }
.num { margin: 2px 0 0; font: 400 clamp(84px, 27vw, 190px)/.95 var(--px); color: #fff; text-shadow: 6px 6px 0 var(--ink), 0 0 24px rgba(255,255,255,.35); font-variant-numeric: tabular-nums; }
.head { margin: 6px 0 0; font: 400 clamp(26px, 8vw, 40px)/1.1 var(--px); background: linear-gradient(90deg, var(--pink), var(--yellow), var(--green), var(--cyan)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(3px 3px 0 var(--ink)); word-break: keep-all; }
.sub { margin: 6px 0 0; font: 400 clamp(14px, 4.2vw, 19px)/1.3 var(--px); color: #e8e4ff; text-shadow: 2px 2px 0 var(--ink); word-break: keep-all; max-width: 92%; }
.who2 { margin: 4px 0 0; font: 400 clamp(13px, 3.8vw, 17px)/1.3 var(--px); color: #fff; min-height: 1.3em; }
.screen[data-s="idle"] .num, .screen[data-s="clap"] .num { opacity: .35; }
.screen[data-s="score"] .num { animation: pop .5s cubic-bezier(.2,1.8,.4,1); }
@keyframes pop { from { transform: scale(.6); } }
.screen[data-s="score"] .head { animation: blink .5s steps(2) 3; }
.screen[data-s="idle"] .sub { animation: blink 1.6s steps(2) infinite; }
.screen.flash::before { content: ''; position: absolute; inset: 0; z-index: 3; background: #fff; pointer-events: none; animation: flash .5s ease-out forwards; }
@keyframes flash { from { opacity: .9; } to { opacity: 0; } }
.screen.flash { animation: shake .45s; }
@keyframes shake { 20% { transform: translate(-6px, 4px); } 40% { transform: translate(6px, -4px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -2px); } }
.tv-rank { display: none; }
@keyframes blink { 50% { opacity: .2; } }
.meter { display: none; width: 70%; height: 16px; margin-top: 10px; border: 3px solid #fff; background: rgba(0,0,0,.35); }
.meter i { display: block; height: 100%; width: calc(var(--m, 0) * 100%); background: linear-gradient(90deg, var(--green), var(--yellow), var(--red)); }
.screen[data-s="clap"] .meter { display: block; }
.marquee { position: absolute; left: 0; right: 0; bottom: 6px; margin: 0; overflow: hidden; white-space: nowrap; font: 400 13px/1 var(--px); color: var(--cyan); opacity: .85; }
.marquee span { display: inline-block; padding-left: 100%; animation: mq 16s linear infinite; }
@keyframes mq { to { transform: translateX(-100%); } }

.panel { padding: 12px 4px 4px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.who-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); gap: 8px; }
.fld { display: grid; gap: 3px; font-size: 12px; font-weight: 700; color: var(--dim); }
.fld input { width: 100%; min-width: 0; min-height: 44px; border: 2px solid #4a4a5a; border-radius: 10px; background: #0f0f14; color: #fff; padding: 0 10px; font: inherit; font-size: 16px; }
.go { appearance: none; min-height: 72px; border: 3px solid #000; border-radius: 999px; background: radial-gradient(circle at 40% 30%, #ff8aa0, var(--red) 55%, #a01030); color: #fff; font: 400 clamp(24px, 7vw, 30px)/1 var(--px); cursor: pointer; box-shadow: 0 6px 0 #000, inset 0 -6px 0 rgba(0,0,0,.25); text-shadow: 2px 2px 0 var(--ink); }
.go:active { transform: translateY(4px); box-shadow: 0 2px 0 #000; }
.go:disabled { cursor: progress; filter: saturate(.6); }
.after { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.after:has(button:not([hidden])) { margin-top: -2px; }
.btn { appearance: none; min-height: 48px; border: 2px solid #000; border-radius: 12px; background: var(--yellow); color: var(--ink); font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 3px 0 #000; }
.btn[hidden] { display: none; }
.btn.wide { width: 100%; background: var(--cyan); }
.go[hidden] { display: none; }
.fld input:disabled { opacity: .6; }
.modes button:disabled { cursor: progress; }
.modes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.modes button { appearance: none; min-height: 46px; border: 2px solid #4a4a5a; border-radius: 10px; background: #0f0f14; color: #cfcfe0; font-weight: 800; font-size: clamp(12px, 3.4vw, 14px); cursor: pointer; padding: 0 2px; }
.modes [aria-checked="true"] { background: var(--cyan); color: var(--ink); border-color: #000; }
.mode-note { margin: 0; font-size: 12.5px; color: var(--dim); word-break: keep-all; }

.rank { background: rgba(10,8,32,.55); border: 2px solid #3a2f7a; border-radius: 16px; padding: 12px 14px; }
.rank h2 { margin: 0 0 6px; font: 400 20px/1.2 var(--px); color: var(--yellow); }
.rank ol { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 36px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dashed rgba(185,178,230,.25); }
.rank li.top .who { color: var(--yellow); }
.rank .who { font-weight: 800; white-space: nowrap; }
.rank .song { font-size: 13px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank b { font: 400 20px/1 var(--px); }
.rank li.none { display: block; color: var(--dim); border: 0; }
.rank .del { appearance: none; width: 36px; height: 36px; border: 0; border-radius: 8px; background: none; color: var(--dim); font-size: 15px; cursor: pointer; }
.rank .del:hover { background: rgba(255,255,255,.08); color: #fff; }
.rank-note { margin: 8px 0 0; font-size: 12px; color: var(--dim); word-break: keep-all; }
.rank-act { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.rank-act .btn { min-height: 44px; padding: 0 14px; font-size: 14px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tv-exit { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 95; appearance: none; min-height: 48px; padding: 0 18px; border: 2px solid #fff; border-radius: 999px; background: rgba(10,8,32,.8); color: #fff; font-weight: 800; font-size: 15px; cursor: pointer; }
.tv-exit[hidden] { display: none; }
.link { appearance: none; border: 0; background: none; color: var(--dim); text-decoration: underline; text-underline-offset: 3px; min-height: 40px; cursor: pointer; font-size: 13px; padding: 0; }
.link[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; margin: 0; padding: 12px 16px; background: var(--yellow); color: var(--ink); border: 2px solid #000; border-radius: 12px; font-weight: 800; width: max-content; max-width: calc(100vw - 32px); }
.toast[hidden] { display: none; }

/* TV 화면: 점수 화면과 버튼만 크게. 전체 화면 API가 없는 폰은 이 CSS만으로 화면을 채운다 */
body.tvmode { overflow: hidden; }
body.tvmode .top, body.tvmode .rank, body.tvmode .guide, body.tvmode .modes, body.tvmode .mode-note, body.tvmode .ad-slot { display: none; }
body.tvmode .stage { display: block; max-width: none; min-height: 100svh; padding: 2vh 3vw; }
body.tvmode .machine { height: 96svh; display: grid; grid-template-rows: minmax(0, 1fr) auto; max-width: 177svh; margin: 0 auto; }
body.tvmode .screen { min-height: 0; }
body.tvmode .label { font-size: 4vh; }
body.tvmode .num { font-size: min(30vh, 40vw); }
body.tvmode .head { font-size: min(7vh, 9vw); }
body.tvmode .sub { font-size: min(3.4vh, 5vw); }
body.tvmode .who2 { font-size: min(5vh, 7vw); color: var(--yellow); }
body.tvmode .tv-rank { display: block; position: absolute; left: 0; right: 0; bottom: 4.5vh; margin: 0; font: 400 min(2.8vh, 4vw)/1 var(--px); color: #fff; text-shadow: 2px 2px 0 var(--ink); }
body.tvmode .marquee { font-size: min(2.2vh, 3.4vw); }
body.tvmode .panel { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); align-items: center; padding-right: 180px; }
body.tvmode .who-row { grid-column: 1; }
body.tvmode .go, body.tvmode #fallback { grid-column: 2; min-height: 56px; }
body.tvmode .after { grid-column: 3; }
@media (max-width: 700px) {
  body.tvmode .panel { grid-template-columns: minmax(0, 1fr); padding-right: 0; padding-bottom: 60px; }
  body.tvmode .who-row, body.tvmode .go, body.tvmode #fallback, body.tvmode .after { grid-column: 1; }
}
@media (orientation: landscape) and (max-height: 520px) {
  body.tvmode .panel { padding-top: 6px; } body.tvmode .who-row .fld span { display: none; }
  body.tvmode .fld input, body.tvmode .go, body.tvmode .btn { min-height: 40px; }
}

/* 설명서 */
.guide { position: relative; max-width: 760px; margin: 24px auto 0; padding: 28px 20px 40px; background: var(--paper); color: #1a1636; border-top: 6px solid var(--pink); content-visibility: auto; contain-intrinsic-size: auto 1800px; }
.guide h2 { font: 400 23px/1.3 var(--px); margin: 28px 0 10px; word-break: keep-all; }
.guide section:first-of-type h2 { margin-top: 8px; }
.guide p, .guide li, .guide dd { word-break: keep-all; }
.guide ol, .ments, .others { padding-left: 1.3em; }
.ments b { margin-right: 6px; }
.faq dl { margin: 0; }
.faq dt { font-weight: 800; margin-top: 14px; }
.faq dd { margin: 4px 0 0; color: #3a3460; }
.others a { font-weight: 800; color: #1a1636; display: inline-block; padding: 8px 0; }
.site-foot { margin-top: 32px; font-size: 14px; display: flex; gap: 8px; }
.site-foot a { color: #4a4470; display: inline-block; padding: 12px 0; }

@media (min-width: 900px) {
  .stage { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; }
  .screen { min-height: 400px; }
  .rank { position: sticky; top: 16px; }
}
@media (prefers-reduced-motion: reduce) { .marquee span, .screen[data-s="score"] .num, .screen[data-s="score"] .head, .screen[data-s="idle"] .sub, .screen.flash, .screen.flash::before { animation: none; } .marquee span { padding-left: 0; } .screen.flash::before { display: none; } }
