/* 블록 퍼즐: 밝은 종이 느낌 + 선명한 블록 색. 색은 전부 여기 맨 위 토큰에서만 정한다. */
:root {
  --font-body: 'IBM Plex Sans KR', 'Noto Sans SC', 'Noto Sans JP', 'Noto Sans Devanagari', 'Noto Sans Bengali', 'Noto Sans Arabic', system-ui,
    -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --font-num: 'Baloo 2', var(--font-body);
  --page: #eef1f7;
  --page-2: #f7f9fc;
  --ink: #1e2430;
  --ink-soft: #566074;
  --ink-faint: #8b94a6;
  --rule: #d6dce8;
  --panel: #ffffff;
  --panel-line: #dde3ee;
  --board: #cfd7e6;
  --cell: #e8edf6;
  --cell-line: #dbe2ef;
  --accent: #ff7a59;
  --accent-deep: #e0583a;
  --shadow: rgba(30, 36, 48, 0.16);
  --alert: #d6453d;
  /* 블록 색 (가족마다 하나씩) */
  --c0: #ff7a59;
  --c1: #ffb938;
  --c2: #6fd150;
  --c3: #26bfa6;
  --c4: #4da3ff;
  --c5: #7c6cff;
  --c6: #c86bfa;
  --c7: #ff6fb5;
  --c8: #f0cf36;
  --c9: #8a9bb3;
  --c10: #9aa7ba; /* 다시 불러온 판처럼 원래 색을 모를 때 */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --page: #141926;
    --page-2: #1a2030;
    --ink: #e8ecf5;
    --ink-soft: #a3adc2;
    --ink-faint: #6d7791;
    --rule: #2a3246;
    --panel: #1e2536;
    --panel-line: #2c3550;
    --board: #0f1420;
    --cell: #232c42;
    --cell-line: #1b2236;
    --accent: #ff8a6b;
    --accent-deep: #e9684a;
    --shadow: rgba(0, 0, 0, 0.5);
    --alert: #ef7a72;
  }
}
:root[data-theme='dark'] {
  --page: #141926;
  --page-2: #1a2030;
  --ink: #e8ecf5;
  --ink-soft: #a3adc2;
  --ink-faint: #6d7791;
  --rule: #2a3246;
  --panel: #1e2536;
  --panel-line: #2c3550;
  --board: #0f1420;
  --cell: #232c42;
  --cell-line: #1b2236;
  --accent: #ff8a6b;
  --accent-deep: #e9684a;
  --shadow: rgba(0, 0, 0, 0.5);
  --alert: #ef7a72;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  background: var(--page);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
}
button {
  font-family: inherit;
  color: inherit;
}
#app {
  position: relative;
  height: 100dvh;
  max-width: 560px;
  margin: 0 auto;
  background: var(--page);
}
.screen {
  display: none;
  flex-direction: column;
  height: 100%;
}
#app[data-screen='home'] .screen[data-name='home'],
#app[data-screen='play'] .screen[data-name='play'],
#app[data-screen='vs-menu'] .screen[data-name='vs-menu'],
#app[data-screen='vs-room'] .screen[data-name='vs-room'],
#app[data-screen='vs-watch'] .screen[data-name='vs-watch'] {
  display: flex;
}

/* ---------- 공통 조각 ---------- */
.eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.num {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}
.icon-btn {
  width: 40px;
  height: 40px;
  font-size: 20px;
  line-height: 1;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  cursor: pointer;
}
.icon-btn.small {
  width: 30px;
  height: 30px;
  font-size: 16px;
}
.ctl {
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
  cursor: pointer;
}
.ctl.primary {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-deep);
  box-shadow: 0 3px 0 var(--accent-deep);
}
.ctl.wide {
  flex: 1 1 100%;
}
.ctl:active {
  transform: translateY(1px);
}
.ctl:focus-visible,
.icon-btn:focus-visible {
  outline: 3px solid var(--c4);
  outline-offset: 2px;
}

/* ---------- 홈 ---------- */
.home-top {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 24px;
}
.logo {
  display: grid;
  grid-template-columns: repeat(3, 34px);
  gap: 4px;
  margin-bottom: 18px;
  filter: drop-shadow(0 6px 10px var(--shadow));
}
h1 {
  margin: 2px 0 0;
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.tagline {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.home-best {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 26px 20px 0;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
}
.home-best .num {
  font-size: 26px;
  color: var(--accent-deep);
}
.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 20px calc(30px + env(safe-area-inset-bottom));
}

.home-foot {
  flex: 1 1 100%;
  margin: 2px 0 0;
  text-align: center;
  font-size: 12px;
}
.home-foot a {
  color: var(--ink-faint);
}

/* ---------- 블록(칸) 그리기: 판과 트레이와 끌고 있는 블록이 같은 모양을 쓴다 ---------- */
.blk {
  border-radius: 22%;
  background: var(--c10);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.38);
}
.blk.c0 { background: var(--c0); }
.blk.c1 { background: var(--c1); }
.blk.c2 { background: var(--c2); }
.blk.c3 { background: var(--c3); }
.blk.c4 { background: var(--c4); }
.blk.c5 { background: var(--c5); }
.blk.c6 { background: var(--c6); }
.blk.c7 { background: var(--c7); }
.blk.c8 { background: var(--c8); }
.blk.c9 { background: var(--c9); }

/* ---------- 상단 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 4px;
}
.hud {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.hud-score,
.hud-best {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.hud-best {
  align-items: flex-end;
}
.hud-score .num {
  font-size: 38px;
  line-height: 1;
}
.hud-best .num {
  font-size: 20px;
  line-height: 1.1;
  color: var(--ink-soft);
}

/* ---------- 판 ---------- */
.board-area {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 8px 12px;
}
.board-wrap {
  position: relative;
  width: var(--board-size, 320px);
  height: var(--board-size, 320px);
}
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: var(--gap, 3px);
  width: 100%;
  height: 100%;
  padding: var(--gap, 3px);
  background: var(--board);
  border-radius: 16px;
  box-shadow: 0 6px 18px -8px var(--shadow);
}
.cell {
  border-radius: 22%;
  background: var(--cell);
  box-shadow: inset 0 0 0 1px var(--cell-line);
  transition: background 0.08s;
}
.cell.blk {
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.38);
}
/* 놓을 자리 미리 보기 */
.cell.preview {
  background: color-mix(in srgb, var(--pv, var(--c4)) 55%, var(--cell));
}
.cell.preview.blk {
  filter: none;
}
.cell.will-clear {
  outline: 2px solid color-mix(in srgb, var(--accent) 85%, transparent);
  outline-offset: -2px;
  filter: brightness(1.12);
}

/* 지워지는 줄 효과와 점수 글자 */
.fx {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}
.sweep {
  position: absolute;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.95), transparent);
  border-radius: 10px;
  opacity: 0;
  animation: sweep 0.45s ease-out forwards;
}
.sweep.col {
  background: linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.95), transparent);
}
@keyframes sweep {
  0% { opacity: 0.95; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.06); }
}
.pop {
  position: absolute;
  left: 50%;
  top: 40%;
  transform: translate(-50%, 0);
  font-family: var(--font-num);
  font-size: 34px;
  font-weight: 800;
  color: var(--accent-deep);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
  animation: pop 0.9s ease-out forwards;
  white-space: nowrap;
}
.pop.big {
  font-size: 46px;
}
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(0.7); }
  15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
  100% { opacity: 0; transform: translate(-50%, -46px) scale(1); }
}
.combo {
  position: absolute;
  right: 6px;
  top: -22px;
  font-family: var(--font-num);
  font-size: 15px;
  font-weight: 800;
  color: var(--accent-deep);
}
.combo[hidden] {
  display: none;
}

/* ---------- 블록 트레이 ---------- */
.tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 6px 12px 4px;
  min-height: calc(var(--tray-cell, 24px) * 5 + 24px);
}
.slot {
  display: grid;
  place-items: center;
  min-width: 0;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border-radius: 14px;
  touch-action: none;
  cursor: grab;
}
.slot.used {
  visibility: hidden;
}
.slot.dragging .piece {
  opacity: 0.22;
}
.piece {
  display: grid;
  gap: 2px;
}
.slot .piece .blk {
  width: var(--tray-cell, 24px);
  height: var(--tray-cell, 24px);
}
.ghost {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  display: grid;
  filter: drop-shadow(0 8px 10px var(--shadow));
}
.hintline {
  margin: 0;
  padding: 4px 20px calc(14px + env(safe-area-inset-bottom));
  font-size: 12px;
  text-align: center;
  color: var(--ink-faint);
}

/* ---------- 게임 끝 ---------- */
.over {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--page) 78%, transparent);
  backdrop-filter: blur(3px);
}
.over[hidden] {
  display: none;
}
.over-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(86%, 340px);
  padding: 24px 20px 20px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 20px;
  box-shadow: 0 18px 40px -16px var(--shadow);
}
.stamp {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink-soft);
}
.over-score {
  font-family: var(--font-num);
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-deep);
}
.over-new {
  font-size: 14px;
  font-weight: 700;
  color: var(--c3);
}
.over-new[hidden] {
  display: none;
}
.btn-row {
  display: flex;
  gap: 8px;
  align-self: stretch;
  margin-top: 6px;
}
.btn-row .ctl {
  flex: 1;
  padding: 13px 8px;
}

/* ---------- 언어 ---------- */
.lang-btn {
  display: none;
  position: fixed;
  top: calc(10px + env(safe-area-inset-top));
  inset-inline-end: 12px;
  z-index: 20;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 10px;
  cursor: pointer;
}
#app[data-screen='home'] .lang-btn,
#app[data-screen='vs-menu'] .lang-btn {
  display: block;
}
.lang-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
}
.lang-modal[hidden] {
  display: none;
}
.lang-sheet {
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--page);
  border-radius: 18px 18px 0 0;
}
.lang-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.lang-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}
.lang-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.lang-item {
  width: 100%;
  padding: 13px 12px;
  font-size: 15px;
  text-align: start;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  cursor: pointer;
}
.lang-item[aria-current='true'] {
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-deep);
}

html[dir='rtl'] [data-back],
html[dir='rtl'] #btn-back,
html[dir='rtl'] #room-leave,
html[dir='rtl'] #watch-leave {
  transform: scaleX(-1);
}
html[lang='ar'] *,
html[lang='hi'] *,
html[lang='bn'] *,
html[lang='ja'] *,
html[lang='zh'] * {
  letter-spacing: normal !important;
  text-transform: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .sweep,
  .pop {
    animation-duration: 0.01s;
  }
}

/* ---------- 혼자 하기 / 대결 모드 전환 ---------- */
.vs-only {
  display: none;
}
#app[data-mode='versus'] .solo-only {
  display: none;
}
#app[data-mode='versus'] .vs-head {
  display: flex;
}
#app[data-mode='versus'] p.vs-only:not([hidden]) {
  display: block;
}
#app[data-mode='versus'] .controls.vs-only {
  display: flex;
}
.spacer {
  flex: 1;
}

/* ---------- 대결: 메뉴 · 대기실 ---------- */
.vs-scroll {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 8px 16px calc(24px + env(safe-area-inset-bottom));
}
.vs-rule {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.vs-rule b {
  color: var(--ink);
  font-weight: 600;
}
.vs-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-faint);
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field[hidden],
.vs-hint[hidden],
.vs-empty[hidden],
.vs-toast[hidden],
.vs-overlay[hidden],
.w-rows[hidden],
.sheet-modal[hidden],
button[hidden] {
  display: none;
}
.field input,
.code-input {
  width: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
  padding: 12px 12px;
  -webkit-user-select: text;
  user-select: text;
}
.field input:focus-visible,
.code-input:focus-visible {
  outline: 3px solid var(--c4);
  outline-offset: 1px;
}
.vs-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 16px;
}
.vs-card h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}
.vs-card .field input,
.vs-card .code-input {
  background: var(--page-2);
}
.vs-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}
.check input {
  accent-color: var(--accent-deep);
  width: 16px;
  height: 16px;
}
.vs-card .row {
  display: flex;
  gap: 8px;
}
.code-input {
  flex: 1;
  min-width: 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-family: var(--font-num);
  font-weight: 800;
}
.vs-card .row button.ctl {
  flex: none;
  padding-left: 18px;
  padding-right: 18px;
}
.vs-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.vs-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--page-2);
}
.vs-list .who {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.vs-list .who b {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vs-list .who span {
  font-size: 12px;
  color: var(--ink-faint);
}
.vs-list .actions {
  display: flex;
  flex: none;
  gap: 6px;
}
.vs-list li button.ctl {
  flex: none;
  padding: 9px 14px;
  font-size: 14px;
}
.vs-empty {
  margin: 0;
  font-size: 13px;
  color: var(--ink-faint);
}
.vs-msg {
  margin: 0;
  min-height: 1.5em;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}
.room-switch {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.room-switch [hidden] {
  display: none;
}
.room-code {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 14px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 16px;
}
.room-code strong {
  font-size: 44px;
  line-height: 1;
  letter-spacing: 0.2em;
  padding-left: 0.2em;
  color: var(--accent-deep);
}
.room-kind {
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}
.room-code button.ctl {
  align-self: stretch;
  padding: 11px 14px;
  font-size: 14px;
}
.room-config {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 8px 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 14px;
}
.room-summary {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
}
.room-config button.ctl {
  flex: none;
  padding: 9px 18px;
  font-size: 14px;
}
.slots {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.seat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
}
.seat-item b {
  min-width: 0;
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seat-item .tag {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--accent-deep);
}
.seat-item.empty {
  border-style: dashed;
  background: transparent;
}
.seat-item.empty b {
  font-weight: 400;
  color: var(--ink-faint);
}
.seat-item.away {
  opacity: 0.55;
}
#room-start {
  flex: none;
}
.room-teams.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: start;
}
.team-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.team-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-faint);
}
.team-head b {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.team-col.team-a .team-head b {
  color: var(--c4);
}
.team-col.team-b .team-head b {
  color: var(--accent-deep);
}
.team-col .seat-item {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px;
  min-width: 0;
}
.team-col .seat-item b {
  max-width: 100%;
  font-size: 14px;
}
.team-col button.ctl {
  padding: 9px 6px;
  font-size: 12px;
}

/* 단추 묶음 (팀당 인원·대결 시간) */
.seg {
  display: flex;
  gap: 6px;
}
.seg-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  font-family: var(--font-num);
  font-size: 14px;
  font-weight: 800;
  color: var(--ink-soft);
  background: var(--page-2);
  border: 1px solid var(--rule);
  border-radius: 10px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.seg-btn[aria-checked='true'] {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-deep);
}
.seg-btn:focus-visible {
  outline: 3px solid var(--c4);
  outline-offset: 1px;
}
.seg-btn:disabled {
  cursor: default;
}
.seg-btn:disabled:not([aria-checked='true']) {
  opacity: 0.55;
}

/* 설정 창 (아래에서 올라오는 시트) */
.sheet-modal {
  position: absolute;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: color-mix(in srgb, var(--ink) 45%, transparent);
}
.sheet-modal .sheet {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--page);
  border-radius: 18px 18px 0 0;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

/* ---------- 대결: 플레이 ---------- */
.vs-head {
  flex: 1;
  min-width: 0;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
}
.screen[data-name='vs-watch'] .vs-head {
  display: flex;
}
.vs-score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.vs-score.opp {
  align-items: flex-end;
  text-align: end;
}
.vs-score .k,
.vs-timer .k {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-faint);
  max-width: 100%;
}
.vs-score .k {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.vs-score .v {
  font-family: var(--font-num);
  font-size: 34px;
  font-weight: 800;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.vs-score.opp .v {
  color: var(--ink-soft);
}
.vs-timer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: none;
}
.vs-timer .v {
  font-family: var(--font-num);
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.vs-timer .v.low {
  color: var(--alert);
}
.vs-timer .watchers {
  font-size: 11px;
  color: var(--ink-faint);
}
.vs-timer .watchers[hidden] {
  display: none;
}
.vs-banner {
  margin: 4px 16px 0;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 12px;
}
.controls {
  display: flex;
  gap: 8px;
  padding: 0 16px;
}
.controls .ctl {
  flex: 1;
  padding: 11px 8px;
  font-size: 14px;
}

.vs-overlay {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: blur(3px);
}
.vs-overlay.solid {
  background: var(--page);
  backdrop-filter: none;
}
.watch-area > .vs-overlay {
  border-radius: 16px;
}
.vs-overlay .card {
  width: min(88%, 360px);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--panel-line);
  border-radius: 20px;
  box-shadow: 0 18px 40px -16px var(--shadow);
}
.vs-overlay.solid .card {
  background: none;
  border: 0;
  box-shadow: none;
}
.vs-overlay .kicker {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}
.vs-overlay .count {
  font-family: var(--font-num);
  font-size: 96px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-deep);
}
.vs-overlay .stamp {
  font-size: clamp(26px, 7vw, 34px);
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  transform: rotate(-3deg);
  border: 3px solid currentColor;
  border-radius: 12px;
  padding: 5px 16px 7px;
}
.vs-overlay .stamp.win {
  color: var(--accent-deep);
}
.vs-overlay .detail {
  font-size: 14px;
  font-weight: 500;
}
.vs-overlay .small {
  margin: 0;
  font-size: 12px;
  color: var(--ink-soft);
}
.vs-overlay .btn-row {
  display: flex;
  gap: 8px;
  align-self: stretch;
  justify-content: center;
  margin-top: 4px;
}
.vs-overlay .btn-row button.ctl {
  flex: 1;
  max-width: 180px;
}

.vs-toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 80;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--page);
  background: var(--ink);
  box-shadow: 0 8px 24px -8px var(--shadow);
}

/* ---------- 관전 ---------- */
.w-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px 16px 4px;
}
.w-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.w-team {
  flex: none;
  min-width: 3.2em;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-faint);
}
.w-chip {
  max-width: 100%;
  padding: 5px 10px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-chip.on {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent-deep);
}
.w-chip.away {
  opacity: 0.55;
}
.w-chip:focus-visible {
  outline: 3px solid var(--c4);
  outline-offset: 1px;
}
.watch-area {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  gap: 10px;
  padding: 6px 16px;
}
.watch-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: var(--wb, 200px);
}
.watch-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  height: 22px;
  font-size: 13px;
}
.watch-label b {
  max-width: 70%;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watch-label .tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent-deep);
}
.wb-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  gap: 2px;
  width: var(--wb, 200px);
  height: var(--wb, 200px);
  padding: 2px;
  background: var(--board);
  border-radius: 10px;
  box-shadow: 0 6px 18px -8px var(--shadow);
}
.wb-grid .cell {
  border-radius: 20%;
}
.watch-board.team-a .wb-grid .cell.blk {
  background: var(--c4);
}
.watch-board.team-b .wb-grid .cell.blk {
  background: var(--c0);
}
.wb-tray {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  height: calc(var(--wb, 200px) * 0.2);
}
.wb-slot {
  display: grid;
  place-items: center;
  min-width: 0;
  background: color-mix(in srgb, var(--panel) 70%, transparent);
  border-radius: 8px;
}
.wb-slot.used {
  visibility: hidden;
}
.wb-piece {
  display: grid;
  gap: 1px;
}
.wb-piece .blk {
  background: var(--c10);
}
.watch-board.over .wb-grid {
  opacity: 0.55;
}
