/* 쿼리도 — 월넛 판, 메이플 칸, 원목 벽. 초록 펠트는 쓰지 않는다. */

:root {
  --bg: #efe6d8;
  --bg-glow: #f9f2e6;
  --bg-deep: #e2d3bd;
  --ink: #2a1f16;
  --ink-2: #6b5846;
  --faint: #a08d77;
  --card: rgba(255, 251, 244, .74);
  --card-solid: #fbf6ee;
  --line: rgba(84, 56, 30, .14);
  --line-2: rgba(84, 56, 30, .24);
  --accent: #c9572e;
  --accent-2: #a9401f;
  --accent-ink: #fff8f0;
  --shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 10px 30px -12px rgba(70, 40, 15, .28);
  --board-shadow: 0 44px 70px -30px rgba(60, 30, 8, .6), 0 14px 24px -12px rgba(60, 30, 8, .35);

  --frame-hi: #86593a;
  --frame: #5f3c23;
  --frame-lo: #3a2314;
  --bed: #2b190d;
  --tile-hi: #f4e5c9;
  --tile-lo: #dcc29a;
  --tile-side: #b0916a;
  --tile-edge: rgba(255, 255, 255, .45);
  --wall-hi: #ffe9b8;
  --wall: #e0b56a;
  --wall-lo: #a8792f;
  --wall-side: #6c4a1c;
  --goal-tint: .55;
  --grain: .5;

  --s0: #ef6a4f; --s0-hi: #ffb9a3; --s0-lo: #b3402b;   /* 코랄 */
  --s1: #e9a43a; --s1-hi: #ffe3a0; --s1-lo: #a96d12;   /* 호박 */
  --s2: #3b86f5; --s2-hi: #acd1ff; --s2-lo: #1d56b8;   /* 하늘 */
  --s3: #9a5bd6; --s3-hi: #dbb9ff; --s3-lo: #65339b;   /* 자두 */

  --r: 18px;
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Noto Sans KR', system-ui, sans-serif;
  --serif: 'Gowun Batang', 'Nanum Myeongjo', 'AppleMyungjo', serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #131217;
  --bg-glow: #221d1c;
  --bg-deep: #0c0b0e;
  --ink: #f3eadc;
  --ink-2: #b9aa95;
  --faint: #7c7264;
  --card: rgba(36, 32, 34, .72);
  --card-solid: #221f22;
  --line: rgba(255, 232, 196, .09);
  --line-2: rgba(255, 232, 196, .18);
  --accent: #e8744a;
  --accent-2: #c8552e;
  --accent-ink: #1b120c;
  --shadow: 0 1px 0 rgba(255,255,255,.05) inset, 0 12px 34px -14px rgba(0, 0, 0, .7);
  --board-shadow: 0 50px 80px -30px rgba(0, 0, 0, .85), 0 16px 30px -14px rgba(0, 0, 0, .6), 0 0 120px -30px rgba(232, 150, 90, .18);

  --frame-hi: #4e3525;
  --frame: #35241a;
  --frame-lo: #1b120c;
  --bed: #0e0906;
  --tile-hi: #54412f;
  --tile-lo: #3d2e22;
  --tile-side: #221810;
  --tile-edge: rgba(255, 230, 190, .09);
  --wall-hi: #fae6bd;
  --wall: #dcb679;
  --wall-lo: #9c7441;
  --wall-side: #5f4323;
  --goal-tint: .34;
  --grain: .38;

  --s0: #ff7a5c; --s0-hi: #ffc2ad; --s0-lo: #b8452e;
  --s1: #f4b447; --s1-hi: #ffe7a8; --s1-lo: #aa6f14;
  --s2: #58a0ff; --s2-hi: #bcdcff; --s2-lo: #2460c4;
  --s3: #b07cf0; --s3-hi: #e2c7ff; --s3-lo: #6f3fac;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 15px/1.55 var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 12% -10%, var(--bg-glow), transparent 60%),
    radial-gradient(900px 700px at 110% 110%, var(--bg-deep), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background-color .3s;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }

.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .22 0 0 0 0 .1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] .grain { opacity: .35; }

/* ───────────── 공통 ───────────── */

.screen { display: none; position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; flex-direction: column; }
.screen.on { display: flex; animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
}
.tools { display: flex; gap: 6px; }
.brand-mini {
  font-family: var(--serif); font-weight: 700; letter-spacing: .02em;
  color: var(--ink-2); text-decoration: none; font-size: 15px; padding: 6px 4px;
}
.brand-mini:hover { color: var(--accent); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--line); background: var(--card); color: var(--ink-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: transform .15s, color .15s, background .15s, border-color .15s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn.sm svg { width: 17px; height: 17px; }
.icon-btn[aria-pressed="true"] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 12%, var(--card)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 18px; border-radius: 14px; font-weight: 700; letter-spacing: -.01em;
  border: 1px solid var(--line-2); background: var(--card-solid); color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 2px 0 var(--line);
  transition: transform .15s, box-shadow .15s, background .15s, opacity .15s;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.5) inset, 0 6px 16px -8px rgba(60,30,10,.35); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn[hidden] { display: none; }   /* inline-flex 가 hidden 을 이기지 않게 — 방장이 아니면 시작하기가 안 보여야 한다 */
.btn.primary {
  color: var(--accent-ink); border-color: transparent;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 88%, #fff) 0%, var(--accent) 45%, var(--accent-2) 100%);
  box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 -2px 0 rgba(0,0,0,.14) inset, 0 10px 22px -10px color-mix(in srgb, var(--accent) 80%, #000);
}
:root[data-theme="dark"] .btn.primary { color: #fff8f0; }
.btn.ghost { background: transparent; box-shadow: none; }
.btn.small { padding: 8px 12px; font-size: 13.5px; border-radius: 11px; }
.btn.big { padding: 16px 22px; font-size: 17px; border-radius: 16px; }

.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .14em; color: var(--faint); text-transform: uppercase; }

.seg {
  display: flex; padding: 3px; gap: 2px; border-radius: 12px;
  background: color-mix(in srgb, var(--ink) 6%, transparent); border: 1px solid var(--line);
}
.seg button {
  flex: 1; border: 0; background: transparent; padding: 7px 8px; border-radius: 9px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
  transition: background .18s, color .18s, box-shadow .18s;
}
.seg button.on { background: var(--card-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(40,20,5,.16), 0 0 0 1px var(--line); }
.seg.locked { pointer-events: none; opacity: .75; }

input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--card-solid); outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
input::placeholder { color: var(--faint); }

.link-btn { background: none; border: 0; color: var(--ink-2); font-weight: 600; padding: 8px 2px; }
.link-btn:hover { color: var(--accent); }

/* ───────────── 판 SVG ───────────── */

.board-svg { width: 100%; height: auto; overflow: visible; user-select: none; -webkit-user-select: none; }
.board-svg .grain-over { opacity: var(--grain); pointer-events: none; }
.frame-bevel { fill: none; stroke: rgba(255, 228, 185, .2); stroke-width: 3; }
.bed { fill: var(--bed); }
.tile-side { fill: var(--tile-side); }
.board-svg .tile-grain { opacity: calc(var(--grain) * .55); }
.tile-tint { fill: transparent; transition: opacity .4s; mix-blend-mode: color; }
.tile-edge { fill: none; stroke: var(--tile-edge); stroke-width: 1.5; }
.goal-bar { opacity: .95; filter: drop-shadow(0 0 6px currentColor); }

.wall-in { transform-box: fill-box; transform-origin: center; }
.wall-shadow { fill: rgba(0, 0, 0, .3); }
.wall-side { fill: var(--wall-side); }
.board-svg .wall-grain { opacity: calc(var(--grain) * .9); }
.wall-cap { opacity: .92; }
.wall-hi { fill: none; stroke: rgba(255, 255, 255, .5); stroke-width: 1.5; }
:root[data-theme="dark"] .wall-hi { stroke: rgba(255, 255, 255, .35); }
.wall.drop .wall-in { animation: wallDrop .46s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes wallDrop {
  0% { transform: translateY(-70px) scale(1.14); opacity: 0; }
  55% { transform: translateY(5px) scale(.99); opacity: 1; }
  78% { transform: translateY(-3px); }
  100% { transform: none; }
}
.thud { fill: none; stroke-width: 5; transform-box: fill-box; transform-origin: center; animation: thud .8s .2s ease-out both; }
@keyframes thud { 0% { opacity: .85; transform: scale(1); } 100% { opacity: 0; transform: scale(1.35, 1.9); } }
.board-svg.shake { animation: shake .32s .22s ease-out; }
@keyframes shake { 0%, 100% { transform: none; } 30% { transform: translateY(2px); } 60% { transform: translateY(-1px); } }

.ghost-wall { pointer-events: none; opacity: .78; }
.ghost-wall .wall-shadow { opacity: .4; }
.ghost-wall.ok .wall-in { animation: ghostIn .18s ease-out; }
.ghost-wall.pending .wall-in { animation: pending .9s ease-in-out infinite alternate; }
.ghost-wall.bad { opacity: .9; }
.ghost-wall.bad .wall-in { animation: nope .28s ease-in-out; }
.bad-over { fill: rgba(214, 48, 36, .62); }
@keyframes ghostIn { from { transform: translateY(-10px); opacity: .3; } to { transform: none; opacity: 1; } }
@keyframes pending { from { transform: translateY(-9px); } to { transform: translateY(-2px); } }
@keyframes nope { 25% { transform: translateX(-7px); } 75% { transform: translateX(7px); } }

.pawn { transition: transform .44s cubic-bezier(.3, .85, .25, 1); }
.pawn-body, .pawn-lift, .pawn-shadow, .halo { transform-origin: 0 0; }
.pawn-ring { fill: none; stroke: rgba(255, 255, 255, .3); stroke-width: 3; }
.pawn-dimple { opacity: .28; }
.pawn-gloss { fill: rgba(255, 255, 255, .6); }
.halo { fill: none; stroke-width: 5; opacity: 0; }
.pawn.active .halo { animation: halo 1.7s ease-out infinite; }
@keyframes halo { 0% { opacity: .8; transform: scale(.72); } 100% { opacity: 0; transform: scale(1.3); } }
.pawn.hop .pawn-lift, .pawn-body.hop .pawn-lift { animation: hopLift .44s cubic-bezier(.3, .7, .3, 1); }
.pawn-body.hop .pawn-shadow { animation: hopShadow .44s cubic-bezier(.3, .7, .3, 1); }
.pawn-body.step .pawn-lift { animation: stepLift .44s cubic-bezier(.3, .7, .3, 1); }
.pawn-body.step .pawn-shadow { animation: stepShadow .44s cubic-bezier(.3, .7, .3, 1); }
@keyframes hopLift { 45% { transform: translateY(-46px) scale(1.14); } }
@keyframes hopShadow { 45% { transform: scale(.7); opacity: .5; } }
@keyframes stepLift { 40% { transform: translateY(-14px) scale(1.05); } }
@keyframes stepShadow { 40% { transform: scale(.88); } }
.pawn.pop .pawn-body { animation: pop .5s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { transform: scale(0); } to { transform: none; } }
.pawn.gone { transition: opacity .45s, transform .45s; opacity: 0; }
.ghost-pawn { opacity: .42; pointer-events: none; transition: none; }

.hint-bg { fill: var(--c); opacity: .16; }
.hint-dot { fill: var(--c); opacity: .8; }
.hint-ring { fill: none; stroke: var(--c); stroke-width: 3; transform-box: fill-box; transform-origin: center; animation: ring 1.5s ease-out infinite; }
@keyframes ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.6); opacity: 0; } }

.path { fill: none; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: .1 22; opacity: .5; animation: march 1.3s linear infinite; pointer-events: none; }
.path.mine { stroke-width: 11; opacity: .95; }
.path-end { opacity: .5; } .path-end.mine { opacity: .95; }
@keyframes march { to { stroke-dashoffset: -22.1; } }
.foot { fill: none; stroke-width: 4; stroke-dasharray: 7 9; opacity: .6; animation: footFade 2.8s ease-out both; }
@keyframes footFade { from { opacity: .9; } to { opacity: .35; } }
.float-emote { font-size: 72px; animation: floatUp 1.8s cubic-bezier(.2, .8, .3, 1) forwards; pointer-events: none; }
@keyframes floatUp { 0% { transform: translateY(20px) scale(.4); opacity: 0; } 20% { transform: translateY(0) scale(1.1); opacity: 1; } 100% { transform: translateY(-90px) scale(1); opacity: 0; } }

/* ───────────── 타이틀 ───────────── */

#title .hero {
  flex: 1; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  align-items: center; gap: clamp(28px, 5vw, 80px);
  width: 100%; max-width: 1180px; margin: 0 auto; padding: 10px clamp(18px, 4vw, 48px) 30px;
}
.hero-board { position: relative; perspective: 1600px; padding: 4% 2%; }
.hero-board .board-svg {
  transform: rotateX(24deg) rotateZ(-9deg) translateY(-2%);
  border-radius: 3.8%;
  box-shadow: var(--board-shadow);
  animation: floaty 7s ease-in-out infinite;
}
@keyframes floaty { 50% { transform: rotateX(22deg) rotateZ(-8deg) translateY(-4%); } }
.hero-shine {
  position: absolute; inset: 10% 8% 0; pointer-events: none; border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 16%, transparent), transparent);
  filter: blur(30px); z-index: -1;
}

.hero-copy { display: flex; flex-direction: column; gap: 14px; max-width: 470px; }
.logo {
  font-family: var(--serif); font-weight: 700; margin: 0; line-height: 1;
  font-size: clamp(54px, 8vw, 92px); letter-spacing: -.03em; position: relative; width: max-content;
}
.logo::after {
  content: ''; position: absolute; left: 4%; right: 30%; bottom: -12px; height: 9px; border-radius: 6px;
  background: linear-gradient(180deg, var(--wall-hi), var(--wall) 55%, var(--wall-lo));
  box-shadow: 0 4px 0 var(--wall-side), 0 8px 12px -4px rgba(0,0,0,.35);
}
.tagline { margin: 16px 0 6px; font-size: clamp(17px, 2vw, 20px); color: var(--ink-2); line-height: 1.5; font-family: var(--serif); }

/* 첫 화면 — 원목 벽 조각 같은 시작 단추 · 월넛 토막 같은 규칙 단추. 누르면 쑥 들어간다 */
.intro { display: flex; flex-direction: column; gap: 22px; margin-top: 18px; width: 100%; max-width: 440px; }
.cta { display: flex; gap: 12px; align-items: stretch; padding-bottom: 10px; }
.begin, .rules-btn {
  position: relative; border: 0; cursor: pointer; overflow: hidden; isolation: isolate;
  transition: transform .12s ease, box-shadow .12s ease, filter .2s;
}
.begin::before, .rules-btn::before {   /* 나뭇결 */
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--grain-img, none) 0 0 / 420px; opacity: .32; mix-blend-mode: multiply;
}
.begin {
  flex: 1; display: flex; align-items: center; gap: 16px; min-height: 80px; padding: 0 12px 0 14px;
  border-radius: 20px; color: #3a1e0b; font: 700 24px/1 var(--serif); letter-spacing: -.02em;
  background: linear-gradient(180deg, var(--wall-hi) 0%, var(--wall) 55%, var(--wall-lo) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .7), inset 0 -2px 0 rgba(90, 50, 10, .18),
    0 9px 0 var(--wall-side), 0 26px 34px -14px rgba(60, 30, 8, .55);
}
.begin::after {   /* 빛이 한 번씩 훑고 지나간다 */
  content: ''; position: absolute; top: 0; bottom: 0; width: 34%; left: -50%; z-index: 0; pointer-events: none;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .5), transparent);
  transform: skewX(-18deg); animation: sweep 4.6s ease-in-out infinite;
}
@keyframes sweep { 0%, 60% { left: -50%; } 88%, 100% { left: 125%; } }
.begin-txt { flex: 1; text-align: left; position: relative; z-index: 1; text-shadow: 0 1px 0 rgba(255, 245, 225, .8); }
.begin-pawn {
  width: 52px; height: 52px; border-radius: 50%; flex: none; position: relative; z-index: 1;
  background: radial-gradient(circle at 36% 30%, var(--s0-hi), var(--s0) 55%, var(--s0-lo));
  box-shadow: 0 5px 0 var(--s0-lo), 0 10px 12px -4px rgba(60, 20, 5, .45), inset 0 0 0 7px rgba(255, 255, 255, .1);
  animation: idleHop 3.2s cubic-bezier(.3, .7, .3, 1) infinite;
}
.begin-pawn::after { content: ''; position: absolute; inset: 29%; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .35); }
@keyframes idleHop { 0%, 78%, 100% { transform: none; } 86% { transform: translateY(-9px) scale(1.05); } 93% { transform: translateY(1px) scaleY(.96); } }
.begin-go {
  width: 50px; height: 50px; border-radius: 15px; flex: none; display: grid; place-items: center; position: relative; z-index: 1;
  color: #fbeedb; background: linear-gradient(160deg, var(--frame-hi), var(--frame) 55%, var(--frame-lo));
  box-shadow: inset 0 1px 0 rgba(255, 230, 190, .25), 0 3px 0 rgba(40, 20, 5, .45);
  transition: transform .2s;
}
.begin-arrow { width: 24px; height: 24px; transition: transform .25s cubic-bezier(.3, .8, .3, 1.4); }
.begin:hover { transform: translateY(-2px); box-shadow: inset 0 2px 0 rgba(255,255,255,.7), inset 0 -2px 0 rgba(90,50,10,.18), 0 11px 0 var(--wall-side), 0 32px 40px -14px rgba(60,30,8,.55); }
.begin:hover .begin-arrow { transform: translateX(4px); }
.begin:active, .rules-btn:active { transform: translateY(7px); }
.begin:active { box-shadow: inset 0 2px 0 rgba(255,255,255,.6), 0 2px 0 var(--wall-side), 0 8px 14px -8px rgba(60,30,8,.5); }
.begin:focus-visible, .rules-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 4px; }

.rules-btn {
  width: 80px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  border-radius: 20px; color: #f6e4c6; font: 700 13.5px/1 var(--font);
  background: linear-gradient(160deg, var(--frame-hi), var(--frame) 55%, var(--frame-lo));
  box-shadow: inset 0 1px 0 rgba(255, 228, 185, .3), 0 9px 0 #22140a, 0 26px 34px -14px rgba(40, 20, 5, .55);
}
.rules-btn svg { width: 24px; height: 24px; }
.rules-btn:hover { transform: translateY(-2px); box-shadow: inset 0 1px 0 rgba(255,228,185,.3), 0 11px 0 #22140a, 0 32px 40px -14px rgba(40,20,5,.55); }
.rules-btn:active { box-shadow: inset 0 1px 0 rgba(255,228,185,.3), 0 2px 0 #22140a, 0 8px 14px -8px rgba(40,20,5,.5); }
:root[data-theme="dark"] .begin::before { mix-blend-mode: multiply; opacity: .4; }
:root[data-theme="dark"] .rules-btn { box-shadow: inset 0 1px 0 rgba(255,228,185,.18), 0 9px 0 #0b0604, 0 26px 34px -14px rgba(0,0,0,.8); }

.eyebrow .eb-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: 0; }
.eyebrow .eb-dot.s0 { background: var(--s0); }
.eyebrow .eb-dot.s2 { background: var(--s2); margin-right: 8px; }

/* 구경용 판 아래 '생방송' 표 */
.live {
  position: absolute; left: 50%; bottom: -4px; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 999px; white-space: nowrap;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 12.5px; color: var(--ink-2);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.live b { color: var(--ink); font-variant-numeric: tabular-nums; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: livePulse 1.4s ease-in-out infinite; }
@keyframes livePulse { 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 22%, transparent); } }

/* 배경에 흩어진 말과 벽 */
.deco { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.d-pawn, .d-wall { position: absolute; left: var(--x); top: var(--y); transform: scale(var(--s)); animation: drift 14s ease-in-out infinite; animation-delay: var(--d); opacity: .55; }
.d-pawn { width: 58px; height: 58px; border-radius: 50%; filter: blur(.6px);
  background: radial-gradient(circle at 36% 30%, var(--hi), var(--c) 55%, var(--lo)); box-shadow: 0 6px 0 var(--lo), 0 18px 26px -8px rgba(0,0,0,.3); }
.d-pawn.s0 { --c: var(--s0); --hi: var(--s0-hi); --lo: var(--s0-lo); }
.d-pawn.s1 { --c: var(--s1); --hi: var(--s1-hi); --lo: var(--s1-lo); }
.d-pawn.s2 { --c: var(--s2); --hi: var(--s2-hi); --lo: var(--s2-lo); }
.d-pawn.s3 { --c: var(--s3); --hi: var(--s3-hi); --lo: var(--s3-lo); }
.d-wall { width: 120px; height: 16px; border-radius: 6px; rotate: var(--r);
  background: linear-gradient(180deg, var(--wall-hi), var(--wall) 55%, var(--wall-lo)); box-shadow: 0 5px 0 var(--wall-side), 0 16px 20px -8px rgba(0,0,0,.3); }
@keyframes drift { 50% { translate: 0 -16px; } }
#title .topbar, #title .hero, #title .foot { position: relative; z-index: 1; }
:root[data-theme="dark"] .d-pawn, :root[data-theme="dark"] .d-wall { opacity: .35; }
.setup { display: flex; flex-direction: column; gap: 14px; animation: setupIn .38s cubic-bezier(.2, .9, .3, 1) both; }
.setup[hidden], .intro[hidden] { display: none; }
#title.setting .tagline { display: none; }
#title.setting .logo::after { bottom: -8px; }
@keyframes setupIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.link-btn.back { align-self: flex-start; padding: 2px 0; margin-top: 22px; font-size: 14px; }
.name-field { display: grid; gap: 6px; }
.name-field span { font-size: 12.5px; font-weight: 700; color: var(--faint); }

.card-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.choice {
  display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.choice-head { display: flex; align-items: center; gap: 10px; margin-bottom: 2px; }
.choice-head b { display: block; font-size: 16px; letter-spacing: -.02em; }
.choice-head small { color: var(--faint); font-size: 12.5px; }
.choice-ico img { width: 28px; height: auto; display: block; }
.choice-ico { font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.choice .btn { margin-top: auto; }
.join-row { display: flex; gap: 6px; }
.join-row input { text-transform: uppercase; letter-spacing: .2em; text-align: center; font-weight: 700; padding: 10px; min-width: 0; }
.join-row .btn { padding: 10px 12px; white-space: nowrap; flex: none; }
.join-row input { flex: 1; letter-spacing: .12em; }

/* 비공개 방 고르기 */
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); cursor: pointer; flex-wrap: wrap; }
.check input { width: 17px; height: 17px; padding: 0; margin: 0; flex: none; accent-color: var(--accent); box-shadow: none; }
.check small { font-weight: 500; font-size: 12px; color: var(--faint); }

/* 열린 방 목록 — 친구와 하기 화면 아래 */
.open-rooms {
  display: grid; gap: 8px; padding: 14px 16px; border-radius: 20px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.or-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.or-head b { font-size: 15px; letter-spacing: -.02em; }
.or-head span { font-size: 12.5px; color: var(--faint); }
.room-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 248px; overflow-y: auto; }
.room-list:empty { display: none; }
.room-row {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--card-solid);
  text-align: left; transition: transform .15s, border-color .15s, background .15s;
}
.room-row:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.room-row:active { transform: translateY(1px); }
.room-row:disabled { opacity: .55; background: transparent; cursor: default; transform: none; border-color: var(--line); }
.rr-code { font-weight: 800; letter-spacing: .12em; font-size: 14px; }
.rr-host { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-n { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rr-st { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 99px; color: var(--faint); background: color-mix(in srgb, var(--ink) 6%, transparent); white-space: nowrap; }
.room-row.open .rr-st { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.room-empty { margin: 4px 0 2px; font-size: 13px; color: var(--faint); text-align: center; }
.room-empty[hidden] { display: none; }

.foot { text-align: center; color: var(--faint); font-size: 12px; padding: 0 16px max(14px, env(safe-area-inset-bottom)); }
.legal { font-size: 11.5px; line-height: 1.7; color: var(--faint); word-break: keep-all; }
.legal a { color: inherit; }
.rules-legal { margin: 16px 0 0; padding-top: 14px; border-top: 1px dashed var(--line-2); }

/* ───────────── 대기실 ───────────── */

.lobby-wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 18px 40px; display: flex; flex-direction: column; gap: 18px; }
.code-card {
  text-align: center; padding: 22px 16px 16px; border-radius: 24px; position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--frame-hi), var(--frame) 50%, var(--frame-lo));
  color: #fbeedb; box-shadow: var(--board-shadow);
}
.code-card::before { content: ''; position: absolute; inset: 0; background: var(--grain-img, none) center / 512px; opacity: .7; pointer-events: none; }
.code-card::after { content: ''; position: absolute; left: 50%; top: 0; width: 38%; height: 6px; transform: translateX(-50%); border-radius: 0 0 6px 6px; background: linear-gradient(180deg, var(--wall-hi), var(--wall) 60%, var(--wall-lo)); }
.code-card .eyebrow { color: rgba(251, 238, 219, .6); }
.code { font-family: var(--serif); font-size: 58px; font-weight: 700; letter-spacing: .22em; margin: 2px 0 10px; padding-left: .22em; text-shadow: 0 3px 0 rgba(0,0,0,.25); }
.code-card .btn { color: #fbeedb; border-color: rgba(251, 238, 219, .28); position: relative; }

.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seat {
  display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 16px; min-height: 66px;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); position: relative;
  animation: seatIn .35s cubic-bezier(.2, 1.2, .4, 1) both;
}
@keyframes seatIn { from { transform: scale(.92); opacity: 0; } }
.seat.empty { background: transparent; border-style: dashed; box-shadow: none; color: var(--faint); justify-content: center; animation: none; }
.seat.empty button { border: 0; background: none; color: var(--ink-2); font-weight: 700; padding: 10px; width: 100%; border-radius: 12px; }
.seat.empty button:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.seat .nm { font-weight: 700; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat .sub { font-size: 12px; color: var(--faint); }
.seat .who { min-width: 0; flex: 1; }
.seat .kick { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 8px; border: 0; background: transparent; color: var(--faint); display: grid; place-items: center; }
.seat .kick:hover { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.seat .kick svg { width: 14px; height: 14px; }
.seat-hint { margin: -6px 0 0; text-align: center; font-size: 13px; color: var(--ink-2); min-height: 20px; }

.opts { display: grid; gap: 10px; padding: 14px; border-radius: 18px; background: var(--card); border: 1px solid var(--line); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.opt > span { font-size: 14px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.opt .seg { flex: 0 1 290px; }
.wait-host { text-align: center; color: var(--faint); margin: 0; font-size: 14px; display: none; }
.wait-host.on { display: block; animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .5; } }

/* 작은 말 (칩 · 자리) */
.mini-pawn {
  --c: var(--s0); --hi: var(--s0-hi); --lo: var(--s0-lo);
  display: inline-block; width: 36px; height: 36px; border-radius: 50%; flex: none; position: relative;
  background: radial-gradient(circle at 36% 30%, var(--hi), var(--c) 55%, var(--lo));
  box-shadow: 0 3px 0 var(--lo), 0 6px 10px -3px rgba(0,0,0,.35), inset 0 0 0 5px rgba(255,255,255,.08);
}
.mini-pawn::after { content: ''; position: absolute; inset: 27%; border-radius: 50%; border: 2px solid rgba(255,255,255,.3); }
.mini-pawn.s1 { --c: var(--s1); --hi: var(--s1-hi); --lo: var(--s1-lo); }
.mini-pawn.s2 { --c: var(--s2); --hi: var(--s2-hi); --lo: var(--s2-lo); }
.mini-pawn.s3 { --c: var(--s3); --hi: var(--s3-hi); --lo: var(--s3-lo); }
.mini-pawn.neutral { --c: #b9a78f; --hi: #e9dccb; --lo: #7d6d59; }
.mini-pawn.sm { width: 26px; height: 26px; box-shadow: 0 2px 0 var(--lo), 0 4px 8px -3px rgba(0,0,0,.35); }
.mini-pawn .bot-tag { position: absolute; right: -6px; bottom: -5px; font-size: 13px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }

/* ───────────── 판 화면 ───────────── */

#game { overflow: hidden; }
.turn-pill {
  display: flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line); font-weight: 700; font-size: 14.5px;
  box-shadow: var(--shadow); max-width: 52vw; white-space: nowrap; overflow: hidden;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background .3s, color .3s, border-color .3s;
}
.turn-pill span:last-child { overflow: hidden; text-overflow: ellipsis; }
.turn-pill .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--tc, var(--faint)); flex: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--tc, var(--faint)) 25%, transparent); }
.turn-pill.mine { border-color: color-mix(in srgb, var(--tc) 50%, transparent); background: color-mix(in srgb, var(--tc) 14%, var(--card)); }
.turn-pill.mine .dot { animation: dotPulse 1.2s ease-in-out infinite; }
@keyframes dotPulse { 50% { box-shadow: 0 0 0 7px color-mix(in srgb, var(--tc) 10%, transparent); } }
.turn-pill.thinking span:last-child::after { content: ''; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '·'; } 50% { content: '··'; } 75% { content: '···'; } }
.turn-pill.flash { animation: pillFlash .6s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pillFlash { 0% { transform: scale(.9); } 100% { transform: none; } }

.table { --bw: min(94vw, calc(100dvh - 330px), 700px); flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 0 12px max(12px, env(safe-area-inset-bottom)); min-height: 0; }
.side-head { display: none; flex-direction: column; gap: 2px; padding-bottom: 6px; }
.logo-sm { font-family: var(--serif); font-weight: 700; font-size: 34px; letter-spacing: -.03em; line-height: 1.1; }
.room-tag { font-size: 13px; color: var(--faint); font-weight: 600; font-variant-numeric: tabular-nums; }
.rail { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; width: 100%; }
.rail:empty { display: none; }
.board-area { display: flex; align-items: center; justify-content: center; gap: 14px; }
.rail-side { flex-direction: column; width: auto; }

.board-wrap {
  width: var(--bw); position: relative; border-radius: 3.9%;
  box-shadow: var(--board-shadow); transition: box-shadow .4s;
}
.board-wrap::after {
  content: ''; position: absolute; inset: -5px; border-radius: 5%; pointer-events: none;
  box-shadow: 0 0 0 3px var(--mc, transparent), 0 0 34px -4px var(--mc, transparent);
  opacity: 0; transition: opacity .4s;
}
.board-wrap.my-turn::after { opacity: .75; animation: turnGlow 2.2s ease-in-out infinite; }
@keyframes turnGlow { 50% { opacity: .35; } }
#board { cursor: pointer; touch-action: manipulation; }
.board-wrap.watching #board { cursor: default; }

.wall-tip {
  position: absolute; left: 0; top: 0; transform: translate(-50%, -140%); pointer-events: none;
  padding: 6px 10px; border-radius: 10px; font-size: 13px; font-weight: 700; white-space: nowrap;
  background: #2a1a12; color: #ffe9dc; opacity: 0; transition: opacity .15s; z-index: 3;
  box-shadow: 0 8px 20px -8px rgba(0,0,0,.5);
}
.wall-tip.on { opacity: 1; }
.confirm {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, 8px); z-index: 4; white-space: nowrap;
  display: flex; gap: 6px; align-items: center; padding: 6px; border-radius: 16px;
  background: var(--card-solid); border: 1px solid var(--line-2); box-shadow: 0 16px 30px -12px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.confirm.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

.pchip {
  --c: var(--s0);
  display: flex; align-items: center; gap: 10px; padding: 8px 12px 8px 8px; border-radius: 16px; position: relative;
  background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); min-width: 0;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: border-color .3s, box-shadow .3s, opacity .3s, transform .3s;
}
.pchip.s1 { --c: var(--s1); } .pchip.s2 { --c: var(--s2); } .pchip.s3 { --c: var(--s3); }
.pchip .info { min-width: 0; }
.pchip .nm { font-weight: 700; font-size: 14px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; display: flex; align-items: center; gap: 5px; }
.pchip .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.pchip .dist { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--ink); }
.pchip .dist small { font-weight: 500; color: var(--faint); }
.pchip.active { border-color: color-mix(in srgb, var(--c) 60%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent), var(--shadow); transform: translateY(-1px); }
.pchip.out { opacity: .45; filter: grayscale(.7); }
.pchip.away .nm::after { content: '자리 비움'; font-size: 10.5px; font-weight: 700; color: var(--faint); border: 1px solid var(--line-2); border-radius: 6px; padding: 0 4px; }
.pchip .timer { position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--c); transform-origin: left; opacity: 0; }
.pchip.active .timer.on { opacity: .9; }
.pchip .bubble {
  position: absolute; top: -18px; right: -6px; font-size: 26px; pointer-events: none;
  animation: bubble 1.8s cubic-bezier(.2, .9, .3, 1) forwards; filter: drop-shadow(0 4px 6px rgba(0,0,0,.25));
}
@keyframes bubble { 0% { transform: scale(0) translateY(10px); opacity: 0; } 15% { transform: scale(1.2); opacity: 1; } 30% { transform: scale(1); } 80% { opacity: 1; } 100% { transform: translateY(-16px); opacity: 0; } }
.pchip .say {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%); z-index: 5;
  max-width: 200px; width: max-content; padding: 6px 10px; border-radius: 12px; font-size: 13px; font-weight: 600;
  background: var(--ink); color: var(--bg); pointer-events: none; animation: say 3.6s ease forwards;
}
@keyframes say { 0% { opacity: 0; transform: translate(-50%, -4px); } 8%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

.sticks { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.sticks i { width: 4px; height: 12px; border-radius: 2px; background: linear-gradient(90deg, var(--wall-hi), var(--wall) 60%, var(--wall-lo)); box-shadow: 0 1px 0 var(--wall-side); }
.sticks i.used { background: var(--line-2); box-shadow: none; height: 6px; }

.me-panel { width: var(--bw); max-width: 100%; display: grid; gap: 8px; }
.me-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.me-card .pchip { padding: 8px 14px 8px 8px; }
.stock { display: flex; gap: 5px; align-items: flex-end; height: 44px; padding: 0 4px; }
.stock i {
  width: 9px; height: 40px; border-radius: 4px; position: relative;
  background: linear-gradient(90deg, var(--wall-hi), var(--wall) 55%, var(--wall-lo));
  box-shadow: 2px 3px 0 var(--wall-side), 0 6px 10px -4px rgba(0,0,0,.35);
  transition: transform .35s cubic-bezier(.2, 1.3, .4, 1), opacity .35s, height .35s;
}
.stock i::after { content: ''; position: absolute; left: 3px; right: 3px; top: 8px; bottom: 8px; border-radius: 2px; background: var(--mc, transparent); opacity: .85; }
.stock i.used { height: 10px; opacity: .25; transform: translateY(0); box-shadow: none; }
.stock i.used::after { display: none; }
.stock.armed i:not(.used):last-of-type { transform: translateY(-6px) rotate(6deg); }
.hint { margin: 0; text-align: center; font-size: 13.5px; color: var(--ink-2); min-height: 21px; transition: color .2s; }
.hint.warn { color: var(--accent); font-weight: 700; }

/* 채팅 — 허브의 다른 게임(로보77 · 할리갈리)과 같은 짜임 */
.chat[hidden], .chat-peek[hidden], .chat-btn[hidden], .chat-n[hidden] { display: none; }
.chat-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 45;
  width: 48px; height: 48px; border-radius: 50%; font-size: 20px; line-height: 1;
  border: 1px solid var(--line); background: var(--card-solid); color: var(--ink);
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.5);
}
.chat-btn:hover { filter: brightness(1.06); }
.chat-n {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; border-radius: 999px; padding: 0 5px;
  font-size: 11px; font-weight: 800; line-height: 18px; background: var(--accent); color: #fff;
}
.chat-n.pop { animation: chatPop .5s cubic-bezier(.3, 1.7, .5, 1); }
@keyframes chatPop { from { transform: scale(.3); } }
.chat-peek {
  position: fixed; right: 74px; bottom: 21px; z-index: 45;
  max-width: min(260px, calc(100vw - 96px));
  padding: 8px 12px; border-radius: 13px 13px 4px 13px;
  background: var(--card-solid); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 12px 26px -12px rgba(0,0,0,.5);
  font-size: 13px; line-height: 1.45; cursor: pointer; word-break: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  animation: chatPeekIn .2s ease-out; transition: opacity .25s, transform .25s;
}
.chat-peek b { color: var(--ink-2); font-weight: 700; margin-right: 6px; }
.chat-peek.bye { opacity: 0; transform: translateX(6px); }
@keyframes chatPeekIn { from { opacity: 0; transform: translateX(8px); } }
.chat {
  position: fixed; right: 16px; bottom: 16px; z-index: 46;
  width: min(320px, calc(100vw - 32px)); height: min(380px, 60vh);
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden;
  background: var(--card-solid); border: 1px solid var(--line);
  box-shadow: 0 22px 50px -18px rgba(0,0,0,.6);
}
.chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.chat-sub { color: var(--faint); font-size: 11.5px; }
.chat-x {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  color: var(--faint); font-size: 15px; line-height: 1; padding: 2px 4px;
}
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { font-size: 13px; line-height: 1.5; color: var(--ink); word-break: break-word; margin: 0; }
.chat-msg b { color: var(--ink-2); font-weight: 700; margin-right: 5px; }
.chat-msg.mine b { color: var(--accent); }
.chat-msg.sys { color: var(--faint); font-size: 12px; }
.chat-log:empty::before { content: '아직 아무 말도 없습니다'; color: var(--faint); font-size: 12px; opacity: .7; }
.chat-in { display: flex; gap: 6px; padding: 9px 10px; border-top: 1px solid var(--line); }
.chat-in input {
  flex: 1; min-width: 0; font: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  background: var(--card); color: var(--ink);
}
.chat-in .btn { padding: 8px 12px; font-size: 13px; border-radius: 9px; }
/* 좁은 화면에서는 아래에 두면 판과 내 패널을 덮는다 — 위쪽으로 */
@media (max-width: 560px) {
  .chat-peek { top: 56px; bottom: auto; left: 12px; right: 12px; max-width: none; border-radius: 13px; animation-name: chatPeekDown; }
  .chat-peek.bye { transform: translateY(-6px); }
  .chat { top: 56px; bottom: auto; height: min(46vh, 330px); left: 12px; right: 12px; width: auto; }
}
@keyframes chatPeekDown { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .chat-peek, .chat-n.pop { animation: none; transition: none; } }

/* ───────────── 오버레이 ───────────── */

.overlay {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 18px;
  background: color-mix(in srgb, var(--bg) 50%, rgba(30, 16, 6, .28));
  backdrop-filter: blur(5px) saturate(1.1); -webkit-backdrop-filter: blur(5px) saturate(1.1);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.overlay.on { opacity: 1; pointer-events: auto; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.over-card {
  position: relative; width: min(420px, 100%); text-align: center; padding: 70px 24px 22px; border-radius: 28px;
  background: var(--card-solid); border: 1px solid var(--line-2); box-shadow: 0 40px 80px -30px rgba(0,0,0,.6);
  transform: translateY(24px) scale(.96); transition: transform .45s cubic-bezier(.2, 1.3, .4, 1);
}
.overlay.on .over-card { transform: none; }
.crown { position: absolute; left: 50%; top: -50px; transform: translateX(-50%); line-height: 0; }
.crown .mini-pawn { width: 92px; height: 92px; box-shadow: 0 7px 0 var(--lo), 0 18px 30px -8px rgba(0,0,0,.45), inset 0 0 0 10px rgba(255,255,255,.08); animation: crownBob 2.4s ease-in-out infinite; }
.crown .mini-pawn::after { border-width: 3px; }
.crown::before { content: '👑'; position: absolute; left: 50%; top: -30px; transform: translateX(-50%) rotate(-8deg); font-size: 36px; z-index: 2; animation: crownBob 2.4s ease-in-out infinite; }
.crown.lost::before { content: ''; }
@keyframes crownBob { 50% { translate: 0 -6px; } }
.over-card h2 { font-family: var(--serif); font-size: 38px; margin: 4px 0 6px; letter-spacing: -.02em; }
.over-sub { color: var(--ink-2); margin: 0 0 14px; }
.over-stats { list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 6px; }
.over-stats li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 4%, transparent); font-size: 14px; text-align: left; }
.over-stats li .nm { flex: 1; font-weight: 700; }
.over-stats li .v { color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 13px; }
.over-stats li.win { background: color-mix(in srgb, var(--wc, var(--accent)) 14%, transparent); }
.over-acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.over-acts .btn.primary { grid-column: 1 / -1; }
.over-card .wait-host { margin-top: 10px; }

.sheet-bg { place-items: end center; }
.sheet {
  width: min(420px, 100%); padding: 8px; border-radius: 22px; display: grid; gap: 2px;
  background: var(--card-solid); border: 1px solid var(--line-2); box-shadow: 0 30px 60px -20px rgba(0,0,0,.5);
  transform: translateY(30px); transition: transform .25s cubic-bezier(.2, 1.2, .4, 1); margin-bottom: env(safe-area-inset-bottom);
}
.overlay.on .sheet { transform: none; }
.sheet-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 0; background: none; border-radius: 14px; font-weight: 600; font-size: 15.5px; text-align: left; }
.sheet-item svg { width: 20px; height: 20px; color: var(--ink-2); }
.sheet-item:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.sheet-item.muted { justify-content: center; color: var(--faint); }

.rules-card {
  position: relative; width: min(760px, 100%); max-height: calc(100dvh - 36px); overflow-y: auto;
  padding: 24px clamp(18px, 3vw, 30px) 20px; border-radius: 28px;
  background: var(--card-solid); border: 1px solid var(--line-2); box-shadow: 0 40px 80px -30px rgba(0,0,0,.6);
}
.rules-card h2 { font-family: var(--serif); font-size: 34px; margin: 2px 0 16px; }
.rules-card .close { position: absolute; top: 14px; right: 14px; }
.rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rule-grid figure { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 16px; align-items: center; }
.rule-grid .board-svg { border-radius: 14px; overflow: hidden; background: var(--bed); box-shadow: 0 14px 26px -12px rgba(40,20,5,.55); }
.rule-grid .pawn.active .halo { animation: none; }
.rule-grid figcaption { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.rule-grid figcaption b { display: block; color: var(--ink); font-size: 15.5px; margin-bottom: 2px; }
.rule-grid em { font-style: normal; color: var(--accent); font-weight: 700; }
.rules-tip { margin: 18px 0 0; padding: 12px 14px; border-radius: 14px; background: color-mix(in srgb, var(--accent) 9%, transparent); font-size: 13.5px; color: var(--ink-2); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 60;
  padding: 11px 16px; border-radius: 14px; background: #2a1a12; color: #ffeede; font-weight: 600; font-size: 14px;
  box-shadow: 0 16px 30px -10px rgba(0,0,0,.5); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100vw - 32px); text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* ───────────── 반응형 ───────────── */

@media (max-width: 860px) {
  #title .hero { grid-template-columns: 1fr; gap: 6px; padding-top: 0; }
  .hero-board { width: min(76vw, 380px); margin: 0 auto 18px; padding: 2% 0 6%; }
  .hero-copy { margin: 0 auto; width: 100%; align-items: stretch; }
  .logo { margin: 0 auto; }
  .hero-copy > .eyebrow { text-align: center; }
  .logo::after { left: 15%; right: 15%; }
  .tagline { text-align: center; margin-top: 18px; }
  .tagline br { display: none; }
  .link-btn { align-self: center; }
  .intro { margin: 8px auto 34px; }
  .begin { min-height: 72px; font-size: 21px; }
  .begin-pawn { width: 46px; height: 46px; }
  .begin-go { width: 44px; height: 44px; }
  .rules-btn { width: 72px; }
  .live { bottom: 0; }
  .d-pawn, .d-wall { opacity: .3; }
  #title.setting .hero-board { display: none; }
  #title.setting .hero { padding-top: 12px; }
}
@media (max-width: 520px) {
  .card-choice { grid-template-columns: 1fr; }
  .seats { grid-template-columns: 1fr; }
  .opt { flex-direction: column; align-items: stretch; gap: 6px; }
  .opt .seg { flex: 1; }
  .rule-grid { grid-template-columns: 1fr; }
  .rule-grid figure { grid-template-columns: 116px 1fr; }
  .table { --bw: min(calc(100vw - 20px), calc(100dvh - 300px)); }
  .pchip { padding: 6px 10px 6px 6px; gap: 8px; }
  .pchip .mini-pawn { width: 28px; height: 28px; }
  .pchip .nm { max-width: 84px; font-size: 13px; }
  .stock { gap: 4px; }
  .stock i { width: 7px; height: 32px; }
  .turn-pill { font-size: 13.5px; }
}
/* 넓은 화면 — 판은 왼쪽에 크게, 사람들과 내 패널은 오른쪽 기둥에 */
@media (min-width: 1000px) and (min-aspect-ratio: 5/4) {
  .table {
    --bw: min(calc(100dvh - 120px), calc(100vw - 440px), 880px);
    display: grid; grid-template-columns: var(--bw) 300px;
    grid-template-areas: "board ." "board head" "board top" "board me" "board .";
    grid-template-rows: 1fr auto auto auto 1fr; column-gap: 36px; row-gap: 16px;
    align-content: center; justify-content: center; padding-bottom: 28px;
  }
  .board-area { grid-area: board; }
  .rail-top { grid-area: top; flex-direction: column; flex-wrap: nowrap; }
  .side-head { display: flex; grid-area: head; }
  .rail-top .pchip .nm { max-width: 170px; }
  .me-panel { grid-area: me; width: 300px; padding-top: 14px; border-top: 1px dashed var(--line-2); }
  .me-row { flex-direction: column; align-items: stretch; }
  .me-card .pchip { width: 100%; }
  .stock { justify-content: center; padding: 6px 0 2px; }
  .hint { text-align: left; }
  .rail-side { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
