:root {
  --ink: #08111f;
  --glass: rgba(9, 17, 31, 0.78);
  --glass-2: rgba(16, 28, 48, 0.86);
  --line: rgba(255, 255, 255, 0.1);
  --fg: #f5f3ec;
  --dim: #9fb0c6;
  --gold: #ffd23a;
  --c: #ff5a5f;
  --sans: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", system-ui, sans-serif;
  --display: Anton, Impact, "Pretendard Variable", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ink); color: var(--fg); font-family: var(--sans);
  -webkit-font-smoothing: antialiased; }
canvas { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.vignette { position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, transparent 55%, rgba(4, 8, 16, 0.55) 100%); }
.hidden { display: none !important; }
kbd { font-family: var(--sans); font-size: 0.86em; font-weight: 700; padding: 3px 9px; border-radius: 7px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16); border-bottom-width: 2px; }

/* ---------- 점수판 ---------- */
.hud { position: fixed; top: 24px; left: 28px; right: 28px; display: flex; justify-content: space-between;
  align-items: flex-start; pointer-events: none; }
.bug { display: flex; align-items: stretch; height: 78px; border-radius: 14px; overflow: hidden;
  background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.bug-who { display: grid; place-items: center; min-width: 96px; padding: 0 18px; background: var(--c);
  color: #0b0f17; font-family: var(--display); font-size: 40px; letter-spacing: 0.02em; }
.bug-main { display: flex; flex-direction: column; justify-content: center; gap: 9px; padding: 0 20px; }
.bug-top { display: flex; align-items: baseline; gap: 8px; }
.bug-top b { font-family: var(--display); font-size: 34px; line-height: 1; font-weight: 400; }
.bug-top b.sm { font-size: 24px; }
.bug-label { color: var(--dim); font-size: 13px; font-weight: 700; letter-spacing: 0.08em; }
.bug-sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.pips { display: flex; gap: 5px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.85); }
.pips i.used { background: rgba(255, 255, 255, 0.16); }
.pips i.hr { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.bug-pitch { display: grid; place-items: center; padding: 0 18px; min-width: 150px; border-left: 1px solid var(--line);
  font-size: 15px; font-weight: 700; color: var(--dim); text-align: center; line-height: 1.3; }
.bug-pitch:empty { display: none; }
.bug-pitch b { display: block; color: var(--fg); font-family: var(--display); font-size: 26px; font-weight: 400; }

.leader { margin-right: 168px; min-width: 230px; border-radius: 14px; overflow: hidden; background: var(--glass);
  backdrop-filter: blur(10px); border: 1px solid var(--line); }
.leader .row { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line);
  font-weight: 700; transition: background 0.3s; }
.leader .row:first-child { border-top: 0; }
.leader .row.now { background: rgba(255, 255, 255, 0.07); }
.leader .row i { width: 6px; height: 26px; border-radius: 3px; }
.leader .row .n { flex: 1; font-family: var(--display); font-weight: 400; font-size: 22px; }
.leader .row b { font-family: var(--display); font-weight: 400; font-size: 26px; min-width: 1.5ch; text-align: right; }
.leader .row small { color: var(--dim); font-size: 13px; min-width: 4.5ch; text-align: right; }

.join { position: fixed; top: 24px; right: 28px; width: 148px; padding: 10px; border-radius: 16px; background: var(--glass);
  backdrop-filter: blur(10px); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.join img { width: 128px; height: 128px; border-radius: 10px; background: #fff; padding: 6px; }
.join div { display: flex; align-items: baseline; gap: 8px; }
.join-k { color: var(--dim); font-size: 12px; font-weight: 700; }
.join b { font-family: var(--display); font-weight: 400; letter-spacing: 0.18em; font-size: 22px; }

/* ---------- 투타 대결 점수판 ---------- */
.duel { position: fixed; top: 24px; left: 28px; pointer-events: none; border-radius: 14px; overflow: hidden;
  background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.sb { display: flex; align-items: stretch; }
.ls { border-collapse: collapse; font-weight: 700; }
.ls th { padding: 8px 10px 6px; font-size: 12px; color: var(--dim); letter-spacing: 0.08em; text-align: center;
  border-bottom: 1px solid var(--line); }
.ls th.inn { text-align: left; color: var(--gold); font-size: 14px; min-width: 128px; }
.ls td { padding: 6px 10px; text-align: center; font-family: var(--display); font-weight: 400; font-size: 22px; min-width: 34px;
  border-top: 1px solid var(--line); }
.ls tr:first-child td { border-top: 0; }
.ls td.who { text-align: left; display: flex; align-items: center; gap: 8px; }
.ls td.who i { width: 6px; height: 22px; border-radius: 3px; }
.ls td.who em { font-family: var(--sans); font-style: normal; font-weight: 800; font-size: 11px; padding: 2px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, 0.12); color: var(--fg); letter-spacing: 0.04em; }
.ls td.who em.bat { background: var(--gold); color: #1a1406; }
.ls td.r { color: var(--gold); border-left: 1px solid var(--line); }
.ls td.dim { color: rgba(255, 255, 255, 0.28); }
.ls tr.now td { background: rgba(255, 255, 255, 0.07); }
.sb-side { display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-left: 1px solid var(--line); }
.diamond { position: relative; width: 62px; height: 52px; }
.diamond i { position: absolute; width: 18px; height: 18px; transform: rotate(45deg); border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.06); transition: background 0.25s, box-shadow 0.25s; }
.diamond i.on { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 12px var(--gold); }
#dB2 { left: 22px; top: 2px; }
#dB3 { left: 2px; top: 24px; }
#dB1 { left: 42px; top: 24px; }
.bso { display: flex; flex-direction: column; gap: 6px; }
.bso div { display: flex; align-items: center; gap: 5px; }
.bso span { width: 14px; font-family: var(--display); font-size: 16px; color: var(--dim); }
.bso i { width: 13px; height: 13px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); transition: background 0.2s; }
.bso .b i.on { background: #5ee07a; box-shadow: 0 0 8px #5ee07a; }
.bso .s i.on { background: var(--gold); box-shadow: 0 0 8px var(--gold); }
.bso .o i.on { background: #ff5a5f; box-shadow: 0 0 8px #ff5a5f; }
.sb-pitch { display: grid; place-items: center; padding: 0 18px; min-width: 132px; border-left: 1px solid var(--line);
  font-size: 15px; font-weight: 700; color: var(--dim); text-align: center; line-height: 1.3; }
.sb-pitch:empty { display: none; }
.sb-pitch b { display: block; color: var(--fg); font-family: var(--display); font-size: 26px; font-weight: 400; }
.sb-foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 8px 14px;
  border-top: 1px solid var(--line); font-size: 14px; font-weight: 700; color: var(--dim); }
.sb-foot b { color: var(--fg); }
.sb-foot b.go { color: var(--gold); }

.tracker { position: fixed; left: 28px; bottom: 34px; width: 140px; height: 140px; border-radius: 14px; background: var(--glass);
  backdrop-filter: blur(10px); border: 1px solid var(--line); pointer-events: none; overflow: hidden; }
.tk-zone { position: absolute; left: 29.2%; right: 29.2%; top: 25%; bottom: 25%; border: 2px solid rgba(255, 255, 255, 0.6);
  background-image: linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 33.4% 33.4%; background-position: -1px -1px; }
.tracker i { position: absolute; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; display: grid; place-items: center;
  font-style: normal; font-size: 11px; font-weight: 800; color: #0b0f17; box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.35); }
.tracker i.strike { background: #ff7a7e; }
.tracker i.ball { background: #5ee07a; }
.tracker i.foul { background: var(--gold); }
.tracker i.play { background: #7fc6ff; }
.tracker i.last { animation: pop 0.4s cubic-bezier(.2, 1.6, .4, 1); }
.tk-k { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 10px; font-weight: 700; color: var(--dim); }

/* ---------- 판정 글자 ---------- */
.call { position: fixed; left: 0; right: 0; top: 24%; text-align: center; pointer-events: none; opacity: 0;
  transform: translateY(14px) scale(0.94); transition: opacity 0.22s, transform 0.32s cubic-bezier(.2, 1.4, .4, 1); }
.call.on { opacity: 1; transform: none; }
.call-main { font-weight: 900; font-size: 112px; line-height: 1; letter-spacing: -0.03em;
  text-shadow: 0 8px 40px rgba(0, 0, 0, 0.55); }
.call-sub { margin-top: 14px; font-size: 28px; font-weight: 700; color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6); }
.call.hr .call-main { font-family: var(--display); font-weight: 400; font-size: 176px; letter-spacing: 0.01em;
  background: linear-gradient(180deg, #fff6c4 0%, #ffd23a 45%, #ff9d1a 100%); -webkit-background-clip: text;
  background-clip: text; color: transparent; filter: drop-shadow(0 10px 30px rgba(255, 170, 0, 0.45)); }
.call.miss .call-main { color: #dfe7f2; font-size: 84px; }
.call.player .call-main { font-family: var(--display); font-weight: 400; font-size: 120px; color: var(--c); }

.live { position: fixed; left: 50%; bottom: 128px; transform: translateX(-50%); font-family: var(--display);
  font-size: 92px; line-height: 1; pointer-events: none; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.6); }
.live small { font-size: 0.45em; margin-left: 4px; color: var(--dim); }

.stats { position: fixed; left: 50%; bottom: 34px; transform: translate(-50%, 20px); display: flex; gap: 10px;
  pointer-events: none; opacity: 0; transition: opacity 0.3s, transform 0.4s cubic-bezier(.2, 1.2, .4, 1); }
.stats.on { opacity: 1; transform: translate(-50%, 0); }
.stat { min-width: 150px; padding: 12px 20px; border-radius: 14px; background: var(--glass); backdrop-filter: blur(10px);
  border: 1px solid var(--line); text-align: center; }
.stat span { display: block; font-size: 13px; font-weight: 700; color: var(--dim); letter-spacing: 0.06em; }
.stat b { font-family: var(--display); font-weight: 400; font-size: 34px; }

.timing { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); width: 420px; pointer-events: none;
  opacity: 0; transition: opacity 0.25s; }
.timing.on { opacity: 1; }
.timing.up { bottom: 140px; }
.timing-bar { position: relative; display: flex; height: 26px; border-radius: 13px; overflow: hidden;
  background: var(--glass); border: 1px solid var(--line); }
.tz { flex: 1; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--dim); }
.tz.good { flex: 0.5; background: rgba(94, 224, 122, 0.25); border-inline: 1px solid rgba(94, 224, 122, 0.5); }
.timing-bar i { position: absolute; top: 3px; bottom: 3px; width: 6px; margin-left: -3px; border-radius: 3px;
  background: #fff; box-shadow: 0 0 12px #fff; left: 50%; transition: left 0.35s cubic-bezier(.2, 1.3, .4, 1); }
.timing-label { margin-top: 8px; text-align: center; font-weight: 700; font-size: 16px; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.6); }

/* ---------- 대기실 ---------- */
body[data-mode="duel"] .only-derby, body:not([data-mode="duel"]) .only-duel { display: none !important; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 22px 0 0; }
.mode { font: inherit; color: var(--fg); text-align: left; display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px;
  align-items: center; padding: 14px 18px; border-radius: 16px; background: var(--glass-2); border: 2px solid var(--line);
  cursor: pointer; opacity: 0.6; transition: opacity 0.2s, border-color 0.2s, background 0.2s; }
.mode kbd { grid-row: span 2; }
.mode b { font-size: 20px; font-weight: 800; }
.mode span { font-size: 13px; color: var(--dim); }
.mode.on { opacity: 1; border-color: var(--gold);
  background: linear-gradient(135deg, color-mix(in srgb, var(--gold) 22%, transparent), var(--glass-2)); }
.mode.on b::after { content: "선택됨"; margin-left: 10px; font-size: 11px; font-weight: 800; color: #1a1406; background: var(--gold);
  padding: 2px 8px; border-radius: 999px; vertical-align: 3px; }
.slot.bot { border-style: solid; }
.screen { position: fixed; inset: 0; display: grid; place-items: center; padding: 40px;
  background: linear-gradient(90deg, rgba(6, 11, 21, 0.92) 0%, rgba(6, 11, 21, 0.7) 50%, rgba(6, 11, 21, 0.35) 100%); }
.lobby { display: flex; align-items: center; gap: 72px; width: min(1180px, 100%); }
.lobby-copy { flex: 1; min-width: 0; }
.eyebrow { font-size: 14px; font-weight: 800; letter-spacing: 0.24em; color: var(--gold); margin-bottom: 14px; }
.wordmark { margin: 0; font-family: var(--display); font-weight: 400; font-size: clamp(64px, 9vw, 132px); line-height: 0.9;
  letter-spacing: 0.005em; text-transform: uppercase; background: linear-gradient(180deg, #ffffff 0%, #ffffff 55%, #ffd23a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.wordmark.sm { font-family: var(--sans); font-weight: 900; font-size: 64px; letter-spacing: -0.03em; }
.lede { margin: 22px 0 30px; font-size: 21px; color: #d5dde9; line-height: 1.5; }
.steps { list-style: none; margin: 0 0 30px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.steps li { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 16px; background: var(--glass-2);
  border: 1px solid var(--line); }
.steps svg { flex: none; width: 40px; height: 40px; fill: none; stroke: var(--gold); stroke-width: 2.4;
  stroke-linecap: round; stroke-linejoin: round; }
.steps b { display: block; font-size: 17px; margin-bottom: 4px; }
.steps span { font-size: 14px; color: var(--dim); line-height: 1.45; }
.slots { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.slot { position: relative; height: 72px; border-radius: 14px; border: 2px dashed rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: center; gap: 10px; color: rgba(255, 255, 255, 0.3);
  font-weight: 700; font-size: 15px; transition: all 0.3s; }
.slot b { font-family: var(--display); font-weight: 400; font-size: 30px; }
.slot.on { border: 2px solid var(--c); background: linear-gradient(135deg, color-mix(in srgb, var(--c) 30%, transparent), transparent);
  color: var(--fg); animation: pop 0.4s cubic-bezier(.2, 1.6, .4, 1); }
/* 들어온 사람의 준비 상태: 준비 완료 ✓ / 준비 전 / 연습 중 / 연결 끊김 */
.slot-st { position: absolute; top: 7px; right: 9px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
  border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: 0.02em; color: var(--dim);
  background: rgba(255, 255, 255, 0.07); }
.slot-st i { font-style: normal; font-weight: 900; }
.slot.ready { box-shadow: 0 0 0 1px var(--c), 0 8px 26px color-mix(in srgb, var(--c) 28%, transparent); }
.slot.ready .slot-st { background: var(--c); color: #0b1220; }
.slot.practice .slot-st { color: #ffd23a; background: rgba(255, 210, 58, 0.14); }
.slot.practice .slot-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ffd23a;
  box-shadow: 0 0 8px #ffd23a; animation: blink 0.7s infinite alternate; }
.slot.wait b { opacity: 0.85; }
.slot.away { opacity: 0.45; }
/* 연습 중: 이름 아래에 지금 단계 제목, 칸 아래쪽에 단계 막대 */
.slot-st em { font-style: normal; font-family: var(--display); font-weight: 400; font-size: 12px; letter-spacing: 0.04em; }
.slot.practice, .slot.tut-done { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 5px;
  padding: 10px 12px 12px; }
.slot.practice b, .slot.tut-done b { font-size: 24px; line-height: 1; }
.slot-tut { max-width: 100%; font-size: 12.5px; font-weight: 700; color: #e8edf5; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.slot.tut-done .slot-tut { color: #9dffb5; }
.slot-bar { position: absolute; left: 10px; right: 10px; bottom: 6px; display: flex; gap: 3px; }
.slot-bar i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.16); }
.slot-bar i.d { background: color-mix(in srgb, var(--c) 70%, transparent); }
.slot-bar i.c { background: #ffd23a; box-shadow: 0 0 6px #ffd23a; animation: blink 0.7s infinite alternate; }
@keyframes blink { to { opacity: 0.25; } }
/* 난이도 패널(공통 settings.js). 모드는 위의 큰 카드로 고르므로 패널의 모드 줄은 숨깁니다. */
.set-box { margin: -8px 0 22px; max-width: 760px; }
.set-box .pcgs-row[data-key="mode"], .over-set .pcgs-row[data-key="mode"] { display: none !important; }
.set-box .pcgs-panel { background: var(--glass-2); border-color: var(--line); --pcgs-accent: var(--gold); }
.set-box .pcgs-label, .over-set .pcgs-label { width: 96px; }
.over-set { display: flex; justify-content: center; margin: -6px 0 18px; }
.over-set .pcgs-panel { --pcgs-accent: var(--gold); }
/* 경기 끝 화면의 연습 현황(공통 tutorial-board 를 이 안에 붙임) */
.over-tut { margin: -4px 0 18px; }
.over-tut .pcgb { align-items: center; }
.over-tut .pcgb.inline .pcgb-head { align-self: center; }
.over-tut .pcgb.inline .pcgb-tiles { justify-content: center; }
.over-tut .pcgb.inline .pcgb-tile { flex: 0 1 300px; }
/* 경기 중 점수판의 난이도 표시 */
.bug-diff { display: grid; place-items: center; padding: 0 14px; border-left: 1px solid var(--line); font-size: 13px; font-weight: 800;
  color: var(--dim); letter-spacing: 0.04em; writing-mode: horizontal-tb; }
.bug-diff:empty { display: none; }
.bug-diff[data-lv="easy"], .diff-chip[data-lv="easy"] { color: #5ee07a; }
.bug-diff[data-lv="normal"], .diff-chip[data-lv="normal"] { color: #8fd8ff; }
.bug-diff[data-lv="hard"], .diff-chip[data-lv="hard"] { color: #ff7a59; }
.sb-right { display: inline-flex; align-items: center; gap: 10px; }
.diff-chip { font-style: normal; font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); }
.diff-chip:empty { display: none; }
@keyframes pop { from { transform: scale(0.9); } to { transform: none; } }
.hint { color: var(--dim); font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hint .dot { width: 4px; height: 4px; border-radius: 50%; background: rgba(255, 255, 255, 0.25); margin: 0 4px; }
.qr-card { flex: none; width: 360px; padding: 26px; border-radius: 26px; background: #f7f5ee; color: #0b1220;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); text-align: center; }
.qr-card img { width: 100%; aspect-ratio: 1; display: block; border-radius: 10px; }
.qr-code { margin-top: 16px; display: flex; align-items: baseline; justify-content: center; gap: 12px; }
.qr-code span { font-size: 13px; font-weight: 800; color: #5d6a7c; letter-spacing: 0.1em; }
.qr-code b { font-family: var(--display); font-weight: 400; font-size: 54px; letter-spacing: 0.2em; line-height: 1; }
.qr-url { margin-top: 6px; font-size: 13px; color: #5d6a7c; word-break: break-all; }
.qr-warn { margin-top: 12px; padding: 10px 12px; border-radius: 10px; background: #fff1c7; color: #6a4b00; font-size: 13px;
  line-height: 1.45; font-weight: 600; }

/* ---------- 경기 끝 ---------- */
.over { width: min(720px, 100%); text-align: center; }
.over .eyebrow { margin-bottom: 8px; }
.podium { display: flex; flex-direction: column; gap: 12px; margin: 30px 0 26px; }
.podium .r { display: flex; align-items: center; gap: 18px; padding: 18px 24px; border-radius: 18px; background: var(--glass-2);
  border: 1px solid var(--line); text-align: left; animation: rise 0.5s backwards cubic-bezier(.2, 1.2, .4, 1); }
.podium .r:first-child { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 35%, transparent), var(--glass-2));
  border-color: var(--c); padding: 24px; }
.podium .rank { font-family: var(--display); font-size: 40px; width: 1.4em; color: var(--dim); }
.podium .r:first-child .rank { color: var(--gold); font-size: 52px; }
.podium .who { font-family: var(--display); font-size: 34px; flex: 1; color: var(--c); }
.podium .num { text-align: right; min-width: 64px; }
.podium .num b { font-family: var(--display); font-weight: 400; font-size: 40px; }
.podium .num span { display: block; color: var(--dim); font-size: 13px; font-weight: 700; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.over .hint { justify-content: center; }

@media (max-width: 1000px) {
  .lobby { flex-direction: column; gap: 28px; }
  .steps { grid-template-columns: 1fr; }
  .qr-card { width: 280px; }
  .leader { display: none; }
  .modes { grid-template-columns: 1fr; }
  .duel { transform: scale(0.82); transform-origin: top left; }
  .call-main { font-size: 72px; }
  .call.hr .call-main { font-size: 110px; }
}
