/* 코노 배틀 — 오디션 무대 (모바일 세로 우선, 어두운 노래방 시인성) */
:root {
  --stage-deep: #0b0410;
  --stage-mid: #1a0a1e;
  --hot-pink: #ff2d78;
  --gold: #ffd84d;
  --blue: #4dafff;
  --orange: #ff8c42;
  --ink: #ffffff;
  --ink-dim: rgba(255, 255, 255, 0.55);
  --panel-bg: rgba(255, 255, 255, 0.06);
  --panel-line: rgba(255, 255, 255, 0.14);
  --font-display: 'Black Han Sans', sans-serif;
  --font-body: 'Pretendard', -apple-system, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--stage-deep);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
}

#stage {
  position: relative;
  height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  /* LED 벽 텍스처 + 무대 그라디언트 */
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 24px),
    linear-gradient(180deg, var(--stage-mid) 0%, var(--stage-deep) 60%);
}

/* ── 무대 조명 ── */
#stage-lights { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.beam {
  position: absolute; top: -12%; width: 34%; height: 62%;
  background: linear-gradient(180deg, rgba(255, 45, 120, 0.22), transparent 80%);
  filter: blur(6px);
  transform-origin: top center;
}
.beam-l { left: 4%; transform: rotate(16deg); animation: sway 5.2s ease-in-out infinite alternate; }
.beam-r { right: 4%; transform: rotate(-16deg); animation: sway 6.1s ease-in-out infinite alternate-reverse; }
@keyframes sway { from { transform: rotate(12deg); } to { transform: rotate(22deg); } }
.beam-r { animation-name: swayR; }
@keyframes swayR { from { transform: rotate(-12deg); } to { transform: rotate(-22deg); } }
.spot {
  position: absolute; left: 50%; top: 30%;
  width: 130vw; height: 130vw; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 45, 120, 0.16) 0%, transparent 55%);
  transition: opacity 0.8s;
}
#stage.dimmed .beam { opacity: 0.15; }
#stage.dimmed .spot { opacity: 0.3; }

/* ── 헤더 ── */
#head { text-align: center; padding: max(14px, env(safe-area-inset-top)) 16px 4px; z-index: 2; }
#head h1 {
  font-family: var(--font-display);
  font-size: clamp(30px, 9vw, 44px);
  letter-spacing: 2px;
  text-shadow: 0 0 24px rgba(255, 45, 120, 0.65);
}
#head h1 b { color: var(--hot-pink); }
#subtitle { color: var(--ink-dim); font-size: 13px; margin-top: 2px; }

/* ── 심사위원석 ── */
#judges {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  padding: 10px 12px 0; z-index: 2;
}
.judge { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; padding-top: 52px; }
.judge .bubble {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%) scale(0);
  min-width: 92%; padding: 7px 9px;
  background: #17101f; border: 1.5px solid var(--jcolor);
  border-radius: 10px; font-size: 12px; font-weight: 700; text-align: center;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 3; line-height: 1.35;
}
.judge .bubble.show { transform: translateX(-50%) scale(1); }
.judge .desk {
  width: 100%; aspect-ratio: 1 / 0.92;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.03));
  border: 1.5px solid var(--panel-line);
  border-bottom: 4px solid var(--jcolor);
  border-radius: 14px;
  transition: transform 0.25s, box-shadow 0.25s;
}
.judge.react .desk { transform: scale(1.07); box-shadow: 0 0 22px color-mix(in srgb, var(--jcolor) 55%, transparent); }
.judge.spotlit .desk { box-shadow: 0 0 34px var(--jcolor); transform: scale(1.1); }

/* 대기 = 조명 꺼짐, 무대 시작 = 점등 */
.judge .desk { transition: transform 0.25s, box-shadow 0.25s, filter 0.6s; }
#judges.lights-off .judge .desk { filter: grayscale(1) opacity(0.45); }

/* 발표 중 비대상 심사위원은 그늘로 */
.judge { transition: opacity 0.4s; }
.judge.shaded { opacity: 0.3; }

/* 캐스팅보트 — 심장박동 링 */
.judge.casting .desk {
  border-bottom-color: #ff4d4d;
  animation: heartbeat 0.6s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { box-shadow: 0 0 12px rgba(255, 77, 77, 0.4); }
  50% { box-shadow: 0 0 38px rgba(255, 77, 77, 0.95); transform: scale(1.08); }
}

/* REC 점멸 */
.rec-flag { color: #ff3b3b; font-weight: 900; font-size: 13px; letter-spacing: 2px; animation: recblink 1s step-end infinite; }
@keyframes recblink { 50% { opacity: 0.15; } }

#tally-wit { color: var(--ink-dim); font-size: 13.5px; min-height: 18px; transition: opacity 0.3s; }
.judge .avatar { font-size: clamp(30px, 9vw, 42px); line-height: 1; }
.judge .jname { font-family: var(--font-display); font-size: 17px; letter-spacing: 1px; color: var(--jcolor); }
.judge .jtitle { font-size: 10px; color: var(--ink-dim); }
.judge .jscore {
  font-family: var(--font-display); font-size: 24px; min-height: 28px; color: var(--ink);
  opacity: 0; transform: translateY(4px); transition: all 0.3s;
}
.judge .jscore.show { opacity: 1; transform: none; }
.judge .jscore.bump { animation: bump 0.35s; }
@keyframes bump { 40% { transform: scale(1.45); color: var(--gold); } }

/* ── 무대 바닥 ── */
#floor { flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px 18px calc(16px + env(safe-area-inset-bottom)); z-index: 2; }
.panel { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.hidden { display: none !important; }

.vs-row { display: flex; align-items: center; gap: 10px; width: 100%; }
.vs-row input {
  flex: 1; min-width: 0; padding: 14px 10px;
  background: var(--panel-bg); border: 1.5px solid var(--panel-line); border-radius: 12px;
  color: var(--ink); font-size: 17px; font-weight: 700; text-align: center; font-family: var(--font-body);
}
.vs-row input:focus { outline: none; border-color: var(--hot-pink); }
#challengerName {
  width: 100%; padding: 14px 10px;
  background: var(--panel-bg); border: 1.5px solid var(--panel-line); border-radius: 12px;
  color: var(--ink); font-size: 17px; font-weight: 700; text-align: center; font-family: var(--font-body);
}
#challengerName:focus { outline: none; border-color: var(--gold); }
.vs { font-family: var(--font-display); color: var(--hot-pink); font-size: 22px; text-shadow: 0 0 12px rgba(255, 45, 120, 0.8); }

button {
  font-family: var(--font-body); font-weight: 900; border: none; cursor: pointer;
  border-radius: 14px; color: var(--ink);
}
button.big {
  width: 100%; padding: 17px; font-size: 19px;
  background: linear-gradient(135deg, var(--hot-pink), #b3186f);
  box-shadow: 0 6px 24px rgba(255, 45, 120, 0.4);
  transition: transform 0.15s;
}
button.big:active { transform: scale(0.97); }
button.big.rec { background: linear-gradient(135deg, #ff3b3b, #c11d1d); box-shadow: 0 6px 24px rgba(255, 59, 59, 0.4); }
button.big.stop { background: linear-gradient(135deg, #333, #111); border: 1.5px solid var(--panel-line); box-shadow: none; }
button.ghost { background: transparent; border: 1.5px solid var(--panel-line); color: var(--ink-dim); }

.hint { color: var(--ink-dim); font-size: 12.5px; }

.turn-label { color: var(--hot-pink); font-weight: 900; font-size: 15px; letter-spacing: 3px; }
.turn-name { font-family: var(--font-display); font-size: clamp(34px, 11vw, 52px); text-shadow: 0 0 20px rgba(255, 216, 77, 0.4); }
.turn-name.small { font-size: 24px; }

#wave { width: 100%; height: 84px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--panel-line); }
#timer { font-family: var(--font-display); font-size: 30px; color: var(--gold); letter-spacing: 2px; }

.tally-text { font-size: 20px; font-weight: 700; }
.dots i { animation: blink 1.2s infinite; font-style: normal; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; } }

.verdict-votes { font-family: var(--font-display); font-size: 34px; color: var(--ink-dim); }
.verdict-winner {
  font-family: var(--font-display); font-size: clamp(40px, 13vw, 62px); color: var(--gold);
  text-shadow: 0 0 32px rgba(255, 216, 77, 0.55);
  animation: winner-in 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes winner-in { from { transform: scale(0.3); opacity: 0; } }
.verdict-record { color: var(--blue); font-weight: 700; font-size: 15px; }
.result-actions { display: flex; flex-direction: column; gap: 9px; width: 100%; }
.result-actions button { padding: 14px; font-size: 16px; background: var(--panel-bg); border: 1.5px solid var(--panel-line); }
.result-actions #btn-card { background: linear-gradient(135deg, var(--hot-pink), #b3186f); border: none; }

/* 색종이 */
.confetti { position: absolute; top: -12px; font-size: 18px; z-index: 5; animation: fall linear forwards; pointer-events: none; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
