/* 주사위 레이스 — 보드판(검정 바탕 + 원색 칸) 분위기 */
:root {
  --bg: #121016;
  --bg2: #1b1820;
  --panel: #221e29;
  --panel2: #2b2633;
  --ink: #f4efe6;
  --muted: #a49cae;
  --line: #3a3443;
  --red: #e8553a;
  --purple: #c47bd6;
  --yellow: #f3a63a;
  --green: #4f9e4c;
  --blue: #4d86d8;
  --accent: #f3a63a;
  --accent-ink: #1a1410;
  --danger: #ff6b5b;
  --hi: rgba(243, 166, 58, 0.16);
  --title: 'Black Han Sans', 'Jua', system-ui, sans-serif;
  --round: 'Jua', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  background-image: radial-gradient(circle at 15% 0%, rgba(196, 123, 214, .12), transparent 40%), radial-gradient(circle at 90% 100%, rgba(77, 134, 216, .12), transparent 45%);
  color: var(--ink);
  font-family: 'Jua', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 15px; line-height: 1.45;
  word-break: keep-all; overflow-wrap: break-word;
}
h1 { font-family: var(--title); font-weight: 400; font-size: 1.3rem; margin: 0; letter-spacing: .02em; }
h1 small { color: var(--muted); font-family: var(--round); font-size: .8rem; margin-left: .3rem; }
h2 { font-family: var(--title); font-weight: 400; font-size: 1.35rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: 1rem 0 .45rem; color: var(--muted); font-weight: 400; }
small { color: var(--muted); }
b { font-weight: 400; color: #fff; }
button {
  font: inherit; border: 2px solid #000; background: var(--panel2); color: var(--ink);
  border-radius: 12px; padding: .5rem .85rem; cursor: pointer;
  box-shadow: 0 3px 0 #000; transition: transform .08s, box-shadow .08s, background .15s;
}
button:hover:not(:disabled) { background: #362f40; }
button:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 0 0 #000; }
button:disabled { opacity: .45; cursor: default; }
button.big { display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; padding: .9rem; font-size: 1.25rem; background: var(--yellow); color: var(--accent-ink); margin-top: .6rem; }
button.big:hover:not(:disabled) { background: #ffb851; }
button.danger { color: var(--danger); }
button.ghost { background: transparent; border-color: var(--line); box-shadow: none; }
button.mini { padding: .15rem .5rem; font-size: .85rem; border-radius: 8px; box-shadow: 0 2px 0 #000; }
input, select { font: inherit; padding: .65rem .8rem; border-radius: 12px; border: 2px solid var(--line); background: var(--bg2); color: var(--ink); }
input:focus { outline: none; border-color: var(--yellow); }
select { padding: .2rem .4rem; border-radius: 8px; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.center { text-align: center; }
header { display: flex; align-items: center; gap: .6rem; padding: .55rem 16px; background: #0c0a0f; border-bottom: 3px solid #000; position: sticky; top: 0; z-index: 30; }
header h1 .logo { display: inline-block; animation: wobble 3s ease-in-out infinite; }
.net { font-size: .85rem; color: var(--muted); }
header button { white-space: nowrap; }
header button.update { background: var(--yellow); color: var(--accent-ink); animation: blink 1.6s ease-in-out infinite; }
header button.icon { padding: .35rem .55rem; font-size: 1.05rem; }
header button.icon.off { opacity: .45; }
header .speed { display: inline-flex; align-items: center; gap: .3rem; color: var(--muted); font-size: .9rem; }
header .speed select { padding: .3rem .4rem; }
header h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 560px) {
  header { gap: .4rem; }
  header h1 { font-size: 1.1rem; }
  header h1 small, body.host .net { display: none; }
  header .speed select { max-width: 6.5rem; }
  header button { padding: .4rem .6rem; font-size: .9rem; }
}
.flash { background: rgba(232, 85, 58, .18); border: 2px solid var(--red); padding: .5rem .7rem; border-radius: 10px; margin: .5rem 0; }
.dot { display: inline-block; width: .8em; height: .8em; border-radius: 50%; margin-right: .35em; vertical-align: -0.05em; border: 2px solid #000; }
.ok { color: #6ee08a; } .off { color: var(--danger); }
.row { display: flex; flex-wrap: wrap; gap: .45rem; margin: .7rem 0; }
section { margin-bottom: .6rem; }

/* 캐릭터 그림 */
.art { --bg: var(--blue); display: inline-flex; align-items: center; justify-content: center; flex: none; width: 3rem; height: 3rem; border-radius: 14px; background: var(--bg); border: 2px solid #000; box-shadow: inset 0 -5px 0 rgba(0,0,0,.18); font-size: 1.75rem; line-height: 1; overflow: hidden; }
.art img { width: 100%; height: 100%; object-fit: cover; }
.art svg.ch { width: 92%; height: 92%; overflow: visible; filter: drop-shadow(0 2px 0 rgba(0,0,0,.25)); }
.art.sm { width: 2.2rem; height: 2.2rem; font-size: 1.25rem; border-radius: 10px; }
.art.xs { width: 1.4rem; height: 1.4rem; font-size: .85rem; border-radius: 6px; vertical-align: middle; }
.art.lg { width: 5rem; height: 5rem; font-size: 3rem; border-radius: 20px; }

/* 랜딩 */
.landing main { max-width: 600px; margin: 0 auto; padding: 2.5rem 16px; text-align: center; }
.landing h1 { font-size: 2.6rem; }
.hero-tiles { display: flex; justify-content: center; gap: 6px; margin: 1rem 0 1.4rem; }
.hero-tiles span { width: 2.4rem; height: 2.4rem; border: 2px solid #000; border-radius: 8px; animation: hop 1.6s ease-in-out infinite; animation-delay: calc(var(--i) * .12s); }
.landing .sub { color: var(--muted); }
.big-link { display: block; margin: .9rem 0; padding: 1.1rem; border-radius: 16px; background: var(--yellow); color: var(--accent-ink); font-size: 1.35rem; text-decoration: none; border: 3px solid #000; box-shadow: 0 5px 0 #000; }
.big-link.host { background: var(--blue); color: #fff; }
.big-link:active { transform: translateY(4px); box-shadow: 0 1px 0 #000; }
.note { color: var(--muted); font-size: .9rem; }
.landing details { text-align: left; margin-top: 1.5rem; }

/* 카드 */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .55rem; }
.card-grid.small { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.card { display: flex; gap: .6rem; align-items: flex-start; background: var(--panel); border: 2px solid #000; border-radius: 14px; padding: .55rem .6rem; box-shadow: 0 3px 0 #000; }
.card-body { min-width: 0; }
.card-name { font-size: 1.05rem; color: #fff; }
.card-desc { font-size: .8rem; color: var(--muted); margin-top: .15rem; line-height: 1.35; }
.card.used { opacity: .4; filter: grayscale(.7); }
.card.granted { border-style: dashed; border-color: var(--purple); margin-top: .45rem; }
.badge { font-size: .72rem; background: var(--yellow); color: #1a1410; border-radius: 6px; padding: .05rem .4rem; margin-left: .2rem; vertical-align: 1px; }
.chip { display: inline-block; font-size: .85rem; padding: 0 .35rem; border-radius: 999px; border: 2px solid #000; margin-right: 2px; }
.chip.trophy { background: #f6c445; color: #3a2400; }
.chip.second { background: #cfd6e2; color: #1d2530; }
.chip.star { background: var(--purple); color: #fff; }

/* 질문 */
.prompt { background: var(--panel); border: 3px solid var(--yellow); border-radius: 18px; padding: .85rem; box-shadow: 0 5px 0 #000, 0 0 30px rgba(243,166,58,.15); animation: pop-in .35s cubic-bezier(.2,1.4,.5,1); }
.prompt.sent, .sent .prompt { opacity: .55; pointer-events: none; border-color: var(--line); animation: none; }
.prompt-text { font-size: 1.15rem; margin-bottom: .6rem; color: #fff; }
.options { display: flex; flex-wrap: wrap; gap: .45rem; }
.options .opt { flex: 1 1 auto; min-width: 5rem; padding: .75rem .85rem; font-size: 1.05rem; }
.options.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card-opt { text-align: left; display: flex; gap: .6rem; align-items: flex-start; }
.card-opt b { display: block; font-size: 1.1rem; }
.card-opt small { display: block; font-size: .8rem; line-height: 1.35; }
.roll-btn { font-size: 1.45rem !important; padding: 1.1rem !important; }
.roll .manual { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .35rem; margin-top: .8rem; }
.roll .manual .manual-label { width: 100%; font-size: .85rem; color: var(--muted); }
.pip-btn { flex: 1 1 0; min-width: 2.6rem; max-width: 4.5rem; padding: .4rem 0 !important; display: flex; justify-content: center; background: var(--panel2); }
.your-turn { font-family: var(--title); color: var(--yellow); font-size: 1.1rem; margin: 0 0 .3rem .2rem; animation: blink 1.2s ease-in-out infinite; }
.waiting { color: var(--muted); font-size: .9rem; padding: .5rem 0; }
.phase { font-family: var(--title); font-size: 1.25rem; padding: .35rem 0 .55rem; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.my-chip { font-family: var(--round); font-size: .9rem; background: var(--panel2); border: 2px solid #000; border-radius: 999px; padding: .1rem .55rem .1rem .2rem; display: inline-flex; align-items: center; gap: .3rem; }

/* 작은 주사위 면 */
.pip-btn .die-mini, .roll-btn .die-mini { flex: 0 0 auto !important; }
.die-mini { flex: none; max-width: none; min-width: 0; aspect-ratio: 1 / 1; box-sizing: border-box; display: inline-grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); width: 1.9rem; height: 1.9rem; padding: .22rem; gap: 1px; background: #fbf7ef; border: 2px solid #000; border-radius: 7px; }
.die-mini i { border-radius: 50%; }
.die-mini i.on { background: #141217; }
.roll-btn .die-mini { width: 2.2rem; height: 2.2rem; animation: wobble 1.4s ease-in-out infinite; }

/* 표/목록 */
table.score { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.score th { font-weight: 400; color: var(--muted); font-size: .8rem; text-align: left; padding: .25rem .35rem; }
table.score td { text-align: left; padding: .35rem; border-top: 1px solid var(--line); white-space: nowrap; }
table.score td.total { font-family: var(--title); font-size: 1.2rem; color: var(--yellow); }
table.score tr.me td { background: var(--hi); }
ul.racers, ul.members { list-style: none; margin: 0; padding: 0; }
ul.racers li, ul.members li { display: flex; align-items: center; gap: .5rem; padding: .35rem .3rem; border-bottom: 1px solid var(--line); }
ul.members li b { white-space: nowrap; flex: none; }
ul.members li select { flex: none; }
ul.racers .who { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
ul.racers .who span { font-size: .82rem; color: var(--muted); }
ul.racers li.current { background: var(--hi); border-radius: 10px; }
ul.racers li.current .art { animation: hop .9s ease-in-out infinite; }
ul.racers .st { margin-left: auto; font-size: .95rem; white-space: nowrap; }
ol.log { margin: 0; padding: 0; list-style: none; font-size: .86rem; max-height: 40vh; overflow-y: auto; font-family: system-ui, sans-serif; }
ol.log li { padding: .2rem 0; border-bottom: 1px dashed var(--line); color: #d9d2e2; }
ol.log li:first-child { color: #fff; }
.results div { font-size: .9rem; padding: .2rem 0; }
.final { background: linear-gradient(135deg, rgba(246,196,69,.18), rgba(232,85,58,.12)); border: 3px solid #f6c445; border-radius: 18px; padding: .9rem 1.1rem; margin: .5rem 0; box-shadow: 0 5px 0 #000; }
.final ol { margin: 0; padding-left: 1.3rem; font-size: 1.1rem; }
.final li.win { color: #f6c445; }

/* ---------- 보드 ---------- */
svg.board { position: absolute; inset: 0; width: 100%; height: 100%; display: block; overflow: visible; }
.board-wrap, .mini-board { position: relative; min-height: 0; overflow: visible; }
.board text { font-family: var(--round); }
.start-txt { font-family: var(--title) !important; font-size: .4px; fill: #e8553a; stroke: #141217; stroke-width: .03; paint-order: stroke; }
.tile-num { font-family: var(--title) !important; font-size: .56px; stroke: #141217; stroke-width: .025; paint-order: stroke; }
.tile-small { font-size: .19px; fill: rgba(20,18,23,.55); }
.tile-big { font-family: var(--title) !important; font-size: .34px; stroke: #141217; stroke-width: .025; paint-order: stroke; }
.fall-txt { font-family: var(--title) !important; font-size: .2px; fill: #fff; stroke: #141217; stroke-width: .045; paint-order: stroke; }
.tile-emoji { font-size: .36px; }
.pod-txt { font-family: var(--title) !important; font-size: .14px; fill: #fff; }
.board-title { font-family: var(--title) !important; font-size: .95px; fill: #fbf7ef; stroke: #000; stroke-width: .04; paint-order: stroke; letter-spacing: .04px; }
.board-info { font-size: .2px; fill: #a49cae; }
.board-info.big { font-family: var(--title) !important; font-size: .36px; fill: #f3a63a; }
.twinkle { font-size: .22px; animation: twinkle 2.4s ease-in-out infinite; }
.twinkle:nth-child(2n) { animation-delay: 1.2s; }
.tk { transition: none; }
.tk-halo { transform-box: fill-box; transform-origin: center; }
.tk-emoji { font-size: .38px; }
.tk-halo { fill: none; stroke: #fff; stroke-width: .06; opacity: 0; }
.tk.current .tk-halo { animation: halo 1.2s ease-out infinite; }
.tk.current .tk-in { animation: bob .9s ease-in-out infinite; }
.tk-fall { font-size: .24px; opacity: 0; }
.tk.fallen .tk-fall { opacity: 1; animation: spin 1.6s linear infinite; transform-box: fill-box; transform-origin: center; }
.tk.fallen.current .tk-in { animation: none; }

/* 능력 연출 */
.fx-name { font-family: var(--title) !important; font-size: .27px; fill: #141217; }
.fx-line { font-size: .2px; fill: #4a4352; }
.fx-p { font-size: .42px; pointer-events: none; }
.fx-p.big { font-size: .9px; }
.fx-p.tiny { font-size: .28px; }
.fx-bubble { pointer-events: none; filter: drop-shadow(0 .08px 0 #000); }

/* ---------- 주사위 연출 ---------- */
.dice-layer { pointer-events: none; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.stage-dice { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 5; gap: .6rem; }
.stage-dice .die3 { width: clamp(3.4rem, 9vmin, 5.6rem); height: clamp(3.4rem, 9vmin, 5.6rem); }
.stage-dice .dice-pop { filter: drop-shadow(0 8px 18px rgba(0,0,0,.6)); }
.toast-dice { position: fixed; top: 64px; left: 0; right: 0; z-index: 40; padding: 0 16px; }
.dice-pop { display: flex; flex-direction: column; align-items: center; gap: .45rem; animation: pop-in .3s cubic-bezier(.2,1.5,.5,1); transition: opacity .4s, transform .4s; }
.dice-pop.out { opacity: 0; transform: translateY(-20px) scale(.8); }
.die3 { width: 6.5rem; height: 6.5rem; perspective: 300px; }
.die3 .face { width: 100%; height: 100%; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 14%; gap: 6%; background: #fbf7ef; border: 4px solid #000; border-radius: 22%; box-shadow: inset -6px -8px 0 rgba(0,0,0,.12), 0 6px 0 #000; }
.die3 .face i { border-radius: 50%; }
.die3 .face i.on { background: #141217; }
.die3.rolling .face { animation: tumble .34s linear infinite; }
.die3.landed .face { animation: land .5s cubic-bezier(.2,1.6,.4,1); border-color: var(--pc, #000); }
.dice-cap { background: #0c0a0f; border: 2px solid var(--pc, #000); border-radius: 999px; padding: .2rem .8rem; display: flex; align-items: center; gap: .45rem; font-size: .95rem; white-space: nowrap; }
.dice-cap small { color: var(--muted); }
.dice-cap em { font-style: normal; font-family: var(--title); font-size: 1.3rem; color: var(--yellow); }
.toast-dice .dice-pop { flex-direction: row; background: rgba(12,10,15,.92); border: 2px solid var(--pc, #000); border-radius: 16px; padding: .4rem .7rem; }
.toast-dice .die3 { width: 2.8rem; height: 2.8rem; }
.toast-dice .die3 .face { border-width: 3px; box-shadow: 0 3px 0 #000; }
.toast-dice .dice-cap { border: none; background: none; padding: 0; }
.toast-dice .dice-pop.mine { position: fixed; inset: 0; margin: auto; width: max-content; height: max-content; flex-direction: column; padding: 1.2rem 1.6rem; z-index: 50; }
.toast-dice .dice-pop.mine .die3 { width: 8rem; height: 8rem; }

/* ---------- 오버레이 (공개/결과) ---------- */
.stage-layer { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.stage { pointer-events: auto; position: absolute; inset: 0; background: rgba(8,6,10,.82); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; animation: fade-in .3s; transition: opacity .45s; overflow: hidden; text-align: center; }
.stage.out { opacity: 0; pointer-events: none; }
.stage h2 { font-size: clamp(1.6rem, 5vw, 3rem); color: var(--yellow); text-shadow: 0 4px 0 #000; animation: pop-in .5s cubic-bezier(.2,1.5,.5,1); }
.rv-row { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; max-width: 1000px; }
.rv-card { width: clamp(6.5rem, 18vw, 9rem); aspect-ratio: 3 / 4; perspective: 800px; }
.rv-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: flip .7s cubic-bezier(.3,1.3,.5,1) both; animation-delay: var(--d); }
.rv-back, .rv-front { position: absolute; inset: 0; border: 3px solid #000; border-radius: 16px; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; box-shadow: 0 5px 0 #000; }
.rv-back { background: repeating-linear-gradient(45deg, var(--blue) 0 12px, #3e70bb 12px 24px); font-family: var(--title); font-size: 3rem; color: #fff; }
.rv-front { background: var(--panel); transform: rotateY(180deg); border-color: var(--pc); padding: .4rem; }
.rv-front .art { width: 60%; height: auto; aspect-ratio: 1; font-size: clamp(2rem, 6vw, 3.4rem); }
.rv-front b { font-size: 1.05rem; }
.res-row { display: flex; gap: 1.2rem; align-items: flex-end; justify-content: center; }
.res-slot { display: flex; flex-direction: column; align-items: center; gap: .35rem; background: var(--panel); border: 3px solid #000; border-radius: 18px; padding: 1rem 1.2rem; box-shadow: 0 6px 0 #000; animation: rise .7s cubic-bezier(.2,1.4,.5,1) both; }
.res-slot.first { border-color: #f6c445; padding: 1.4rem 1.6rem; animation-delay: .35s; }
.res-slot.first .art { width: 6rem; height: 6rem; font-size: 3.6rem; }
.res-slot .medal { font-size: 2.4rem; }
.res-slot.empty { opacity: .5; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
.confetti i { position: absolute; top: -20px; left: var(--x); width: 10px; height: 16px; background: var(--c); border: 1px solid #000; animation: fall 2.6s linear both; animation-delay: var(--d); }

/* ---------- 방장 ---------- */
body.host { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body.host main { flex: 1; min-height: 0; }
/* ===== 방장 화면: 큰 보드 + 스크롤 없는 상황판 ===== */
.host-stage { --fs: clamp(13px, 1.05vw, 19px); font-size: var(--fs); display: grid; height: 100%; padding: .55rem 14px .7rem; gap: .6rem;
  /* 세로로 긴 화면(패드 세로 등): 왼쪽 세로 판 + 오른쪽 상황판 */
  grid-template-columns: calc((100dvh - 80px) * 0.2606) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
.board-col { position: relative; min-height: 0; }
.board-wrap { height: 100%; width: 100%; }
.dash { min-height: 0; display: grid; gap: .6rem; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); }
.dash-now, .dash-log { grid-column: 1 / -1; }
.dash-box { min-height: 0; overflow: hidden; background: rgba(34, 30, 41, .72); border: 2px solid #000; border-radius: 16px; padding: .5rem .8rem; box-shadow: 0 4px 0 #000; position: relative; }
.dash-box h3 { margin: .1rem 0 .35rem; font-size: .9em; }
.dash-log::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2.5em; background: linear-gradient(transparent, rgba(34,30,41,.95)); }
.dash ol.log { max-height: none; font-size: .9em; }
.dash ul.racers li { padding: .22em .2em; }
.dash ul.racers .art.sm { width: 1.9em; height: 1.9em; }
.dash .results div { font-size: .88em; }
.dash .phase { font-size: 1.25em; padding: 0 0 .3rem; }
.dash .waiting { padding: .2rem 0 0; }
/* 가로로 넓은 화면(노트북, TV, 패드 가로): 위에 큰 가로 판, 아래에 상황판 4칸 */
@media (min-aspect-ratio: 5/4) {
  .host-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .board-col { height: min(60dvh, calc((100vw - 28px) / 3.838)); }
  .dash { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.1fr); grid-template-rows: minmax(0, 1fr); }
  .dash-now, .dash-log { grid-column: auto; }
  .dash-now { overflow-y: auto; }
}
/* 지금 차례 */
.now-turn { display: flex; align-items: center; gap: .7em; margin: .2rem 0 .3rem; padding: .4em .5em; border-radius: 14px; border: 2px solid var(--pc); background: rgba(0,0,0,.25); }
.now-turn .art.lg { width: clamp(3rem, 4.4vw, 5.2rem); height: clamp(3rem, 4.4vw, 5.2rem); font-size: 2rem; animation: hop 1s ease-in-out infinite; }
.now-who { font-family: var(--title); font-size: 1.35em; color: #fff; }
.now-card { color: var(--yellow); }
.now-pos { color: var(--muted); font-size: .9em; }
.dash .host-prompt .prompt { padding: .55rem; }
.dash .host-prompt .prompt-text { font-size: 1.05em; }
/* 점수 목록 */
ol.scorelist { list-style: none; margin: 0; padding: 0; }
ol.scorelist li { display: flex; align-items: center; gap: .35em; padding: .28em .1em; border-bottom: 1px solid var(--line); }
ol.scorelist .rk { width: 1.3em; color: var(--muted); text-align: center; }
ol.scorelist .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
ol.scorelist .chips { margin-left: auto; display: flex; flex-wrap: wrap; gap: 2px; justify-content: flex-end; }
ol.scorelist .tot { font-family: var(--title); font-size: 1.3em; color: var(--yellow); min-width: 1.6em; text-align: right; }
ol.scorelist .chip { font-size: .78em; }
/* 보드 위 오버레이 */
.board-overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; z-index: 6; pointer-events: none; padding: 4%; }
.board-overlay.on { display: flex; }
.ov-panel { pointer-events: auto; font-size: clamp(12px, 1.6vmin, 18px); max-width: 100%; max-height: 100%; overflow: auto; background: rgba(12,10,15,.93); border: 3px solid #000; border-radius: 20px; padding: .8em 1.1em; box-shadow: 0 6px 0 #000, 0 0 40px rgba(0,0,0,.6); text-align: center; animation: pop-in .3s cubic-bezier(.2,1.4,.5,1); }
.ov-title { font-family: var(--title); font-size: 1.35em; color: #fff; margin-bottom: .55em; }
.ov-title small { color: var(--muted); font-family: var(--round); font-size: .7em; }
.ov-title .hl { color: var(--yellow); }
.ov-note { margin-top: .6em; color: var(--yellow); font-size: 1.1em; }
.rb-row { display: flex; flex-wrap: wrap; gap: .7em; justify-content: center; }
.rb-cell { display: flex; flex-direction: column; align-items: center; gap: .25em; padding: .5em .6em; min-width: 5.2em; border-radius: 14px; border: 2px solid var(--pc); background: rgba(255,255,255,.04); transition: transform .3s, box-shadow .3s; }
.rb-cell b { color: #fff; }
.rb-cell small { color: var(--muted); }
.rb-cell .rb-v { font-family: var(--title); font-size: 1.3em; color: var(--yellow); }
.rb-cell.wait .rb-v { font-family: var(--round); font-size: .85em; color: var(--muted); }
.rb-cell.void { opacity: .5; border-style: dashed; }
.rb-cell.void .rb-v { text-decoration: line-through; text-decoration-thickness: 3px; color: var(--muted); }
.rb-cell.void .rb-die { filter: grayscale(1); }
.rb-void { font-size: .75em; color: var(--danger); }
.rb-cell.win { transform: scale(1.12); box-shadow: 0 0 0 3px var(--yellow), 0 0 30px rgba(243,166,58,.6); }
.rb-die { width: clamp(2.6rem, 6vmin, 4.2rem); height: clamp(2.6rem, 6vmin, 4.2rem); }
.rb-die .face { border-width: 3px; }
.rb-die.rolling .face { animation: tumble .34s linear infinite; }
.pool { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.2em, 1fr)); gap: .4em; }
.pool-card { display: flex; flex-direction: column; align-items: center; gap: .15em; padding: .3em .15em; background: var(--panel); border: 2px solid #000; border-radius: 12px; }
.pool-card .art { width: clamp(2.4rem, 5.2vmin, 3.8rem); height: clamp(2.4rem, 5.2vmin, 3.8rem); font-size: 1.5rem; }
.pool-card b { font-size: .85em; }
.draftboard { width: min(100%, 60em); }
.sel-row { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; }
.sel { border: 2px solid var(--pc); border-radius: 12px; padding: .4em .8em; display: flex; flex-direction: column; }
.sel.done span { color: #6ee08a; }
.ov-panel .final { margin: 0; text-align: left; }
/* 휴대폰으로 방장 화면을 열었을 때: 위아래로 쌓고 스크롤 */
@media (max-width: 700px) and (max-aspect-ratio: 5/4) {
  body.host { height: auto; overflow: auto; }
  .host-stage { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; }
  .board-col { height: 75dvh; }
  .dash { grid-template-columns: 1fr; grid-template-rows: none; }
  .dash-box { max-height: 60vh; overflow-y: auto; }
  .lobby { grid-template-columns: 1fr; height: auto; }
}
.host-prompt { margin-bottom: .6rem; }
.lobby { display: grid; grid-template-columns: minmax(260px, 360px) 1fr; gap: 1.5rem; padding: 1.2rem 16px; max-width: 1100px; margin: 0 auto; height: 100%; overflow-y: auto; }
.join-box { text-align: center; background: var(--panel); border: 3px solid #000; border-radius: 18px; padding: 1rem; box-shadow: 0 5px 0 #000; }
.join-box .qr svg, #qr svg { width: 100%; max-width: 260px; height: auto; background: #fff; border-radius: 10px; border: 3px solid #000; }
.join-url { word-break: break-all; margin: .4rem 0; color: var(--yellow); }
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; z-index: 70; }
.overlay-box { background: var(--panel); padding: 1.2rem; border-radius: 18px; text-align: center; max-width: 92vw; border: 3px solid #000; }
.overlay-box #qr svg { max-width: 420px; }
.lobby ul.members li { font-size: 1.1rem; }

/* ---------- 개인 기기 ---------- */
body.player main { max-width: 980px; margin: 0 auto; padding: .6rem 16px 2rem; }
.join-form { text-align: center; padding-top: 1.5rem; }
.join-hero { font-size: 3rem; animation: hop 1.4s ease-in-out infinite; }
.join-form input { width: 100%; font-size: 1.2rem; text-align: center; }
.my-prompt { position: sticky; top: 56px; z-index: 20; margin-bottom: .6rem; max-height: calc(100vh - 66px); max-height: calc(100dvh - 66px); overflow-y: auto; border-radius: 18px; }
.tabs { display: flex; gap: .3rem; overflow-x: auto; margin: .3rem 0 .6rem; padding-bottom: 4px; }
.tabs button { flex: 1 0 auto; padding: .4rem .6rem; font-size: .92rem; }
.tabs button.on { background: var(--yellow); color: var(--accent-ink); }
.board-area { display: flex; gap: .7rem; align-items: flex-start; height: calc(100dvh - 200px); min-height: 360px; margin: .2rem 0 .8rem; }
.mini-board { flex: none; height: 100%; aspect-ratio: 4.44 / 17.04; }
.board-side { flex: 1 1 auto; min-width: 0; max-height: 100%; overflow-y: auto; }
.board-side ul.racers li { padding: .3rem .1rem; gap: .35rem; }
.board-side ul.racers .who b { font-size: .92rem; }
/* 가로로 넓은 화면(휴대폰 가로, 패드): 가로 판 위, 순위 아래 */
@media (min-aspect-ratio: 1/1) {
  .board-area { flex-direction: column; height: auto; min-height: 0; }
  .mini-board { width: 100%; height: auto; aspect-ratio: 17.04 / 4.44; }
  .board-side { width: 100%; max-height: none; }
}

/* ---------- 애니메이션 ---------- */
@keyframes pop-in { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tumble { 0% { transform: rotate(0) translateY(0) scale(1); } 25% { transform: rotate(90deg) translateY(-12%) scale(.92); } 50% { transform: rotate(180deg) translateY(0) scale(1); } 75% { transform: rotate(270deg) translateY(-12%) scale(.92); } 100% { transform: rotate(360deg) translateY(0) scale(1); } }
@keyframes land { 0% { transform: scale(1.35) rotate(-12deg); } 60% { transform: scale(.92) rotate(4deg); } 100% { transform: scale(1) rotate(0); } }
@keyframes hop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-.1px); } }
@keyframes halo { from { opacity: .9; transform: scale(.7); } to { opacity: 0; transform: scale(1.3); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
@keyframes twinkle { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }
@keyframes flip { from { transform: rotateY(0) scale(.7); } to { transform: rotateY(180deg) scale(1); } }
@keyframes rise { from { transform: translateY(60px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes fall { from { transform: translateY(0) rotate(0); } to { transform: translateY(110vh) rotate(720deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* ---------- 좁은 화면 보정 (파일 끝에 두어 앞 규칙보다 우선) ---------- */
@media (max-width: 760px) {
  .lobby { grid-template-columns: minmax(0, 1fr); height: auto; padding: 1rem 12px; gap: 1rem; }
  body.host { height: auto; overflow: auto; }
  .join-box .qr svg { max-width: 200px; }
  .lobby .row button { flex: 1 1 auto; }
  .lobby ul.members li { gap: .35rem; }
  .lobby ul.members li .mini { padding: .15rem .4rem; }
}

.err-bar { position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 90; background: #3a1512; border: 2px solid var(--red); color: #ffd9d3; padding: .6rem .8rem; border-radius: 12px; font-size: .9rem; cursor: pointer; }
