* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #4A5D7E;
  --primary-container: #D6E3FF;
  --on-primary-container: #001B3D;
  --surface: #F9F9FC;
  --surface-variant: #E0E2EC;
  --on-surface: #1A1C1E;
  --on-surface-variant: #44474E;
  --card: #FFFFFF;
}
/* 다크 — 설정(⚙️)에서 고른 값(html[data-theme])이 우선, 없으면 기기 설정. 카드·바탕·글자 토큰만 바뀜(게임판은 그대로) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #9DB3DB;
    --primary-container: #2C3A52;
    --on-primary-container: #D6E3FF;
    --surface: #1A1C1F;
    --surface-variant: #3A3D44;
    --on-surface: #EEF0F4;
    --on-surface-variant: #B3B8C2;
    --card: #24272C;
  }
}
:root[data-theme="dark"] {
  --primary: #9DB3DB;
  --primary-container: #2C3A52;
  --on-primary-container: #D6E3FF;
  --surface: #1A1C1F;
  --surface-variant: #3A3D44;
  --on-surface: #EEF0F4;
  --on-surface-variant: #B3B8C2;
  --card: #24272C;
}

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

[hidden] {
  display: none !important;
}

main {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ── 홈 ──────────────────────────────────── */

.app-header {
  text-align: center;
  padding: 48px 16px 24px;
}
.app-header h1 {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--primary);
}
/* 로그인 화면 브랜드: 로고 크게 + 부제 */
.app-header .brand {
  font-size: 44px;
  letter-spacing: 6px;
}
.brand-sub {
  margin-top: 6px;
  font-size: 17px;
  font-weight: 600;
  color: var(--on-surface-variant);
  letter-spacing: 2px;
}

.game-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 16px;
}

.game-card {
  position: relative;
  aspect-ratio: 1;
  border: none;
  border-radius: 20px;
  background: var(--card);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
  cursor: pointer;
  transition: transform 0.1s;
}
.game-card:active { transform: scale(0.96); }
.game-card.disabled { opacity: 0.45; cursor: default; }
.game-emoji { font-size: 44px; }
.game-badge {
  position: absolute;
  bottom: 14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--on-surface-variant);
  background: var(--surface-variant);
  border-radius: 10px;
  padding: 2px 10px;
}

/* ── 로그인 ──────────────────────────────── */

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 8px 32px;
  max-width: 360px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}
.login-form input {
  height: 48px;
  border: 1px solid var(--surface-variant);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 15px;
  background: var(--card);
  color: var(--on-surface);
}
.login-form input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}
.login-error {
  color: #D32F2F;
  font-size: 13px;
  min-height: 1.2em;
  text-align: center;
}
.login-btn { margin: 0; height: 48px; }
.login-link { text-align: center; text-decoration: none; display: block; }
.login-guest { color: var(--on-surface-variant); }
/* 우리 가족 (공통 패널) */
.family-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* 상단 바 — 한자 앱(.topbar)과 같은 구성: 제목(로비) · 사용자 · 다른 앱 링크 · 로그아웃 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-variant);
}
.topbar > * { white-space: nowrap; flex: 0 0 auto; }
.topbar-title { font-weight: 800; color: var(--primary); margin-right: auto; text-decoration: none; }
.topbar-user { color: var(--on-surface-variant); font-size: 14px; flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.topbar-link { color: var(--primary); font-weight: 700; font-size: 18px; text-decoration: none; padding: 4px 6px; }
.topbar-btn { margin: 0; height: 32px; padding: 0 8px; font-size: 14px; }
.lobby-header { padding-top: 20px; }

/* ── 게임 화면 ────────────────────────────── */

.game-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
}
.game-header h2 { font-size: 20px; font-weight: 700; }

.icon-btn {
  border: none;
  background: none;
  font-size: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  color: var(--on-surface);
}
.icon-btn:active { background: var(--surface-variant); }

.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
}

.chip {
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 14px;
}
.chip.active {
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-weight: 700;
}

.turn-text {
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  min-height: 1.2em;
}

.board-wrap {
  padding: 12px;
}
#board,
#go-board,
#ot-board,
#bk-board,
#wg-board,
#yut-board {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  touch-action: manipulation;
}

/* ── 바둑 ─────────────────────────────────── */
.go-tabs { padding-top: 8px; }
.go-tabs[hidden], #go-opts[hidden], .go-actions[hidden], .go-learn[hidden], .go-l-list[hidden] { display: none; }
.go-turn { margin: 0 16px; min-height: 1.4em; font-size: 14px; font-weight: 600; text-align: center; color: var(--on-surface); }
.go-seg { padding-top: 6px; gap: 4px; }
.go-seg .seg-label { flex: 0 0 auto; min-width: 2em; }
.go-seg .seg-btn { min-width: 0; padding: 0 2px; font-size: 13px; }
.go-actions { display: flex; gap: 8px; padding: 0 16px 10px; }
.go-actions .seg-btn { height: 42px; font-weight: 600; }
.go-actions .seg-btn:disabled { opacity: 0.4; }
.go-actions .go-hl { background: #2E7D32; border-color: #2E7D32; color: #fff; animation: go-hl 1.2s ease-in-out infinite; }
@keyframes go-hl { 50% { box-shadow: 0 0 0 4px rgba(46, 125, 50, 0.35); } }
.go-agree { background: #2E7D32; border-color: #2E7D32; color: #fff; }
.go-learn { padding: 8px 16px 0; }
.go-l-head { display: flex; align-items: center; gap: 8px; }
.go-l-list-btn { flex: none; height: 32px; padding: 0 10px; border-radius: 16px; border: 1px solid var(--primary); background: var(--card); color: var(--primary); font-weight: 700; cursor: pointer; }
.go-l-title { flex: 1; min-width: 0; font-weight: 800; font-size: 15px; }
.go-l-count { flex: none; font-size: 12px; color: var(--on-surface-variant); }
/* ⏭ 대국으로 — 배우기를 건너뛰고 대국 탭 (한 번 누르면 다음부터 대국 탭으로 시작) */
.go-l-skip-btn { flex: none; height: 32px; padding: 0 10px; border-radius: 16px; border: none; background: var(--surface-variant); color: var(--on-surface); font-weight: 600; font-size: 13px; cursor: pointer; }
.go-l-text { margin: 8px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-variant); font-size: 14px; line-height: 1.55; white-space: pre-line; }
.go-l-msg { margin: 0 16px 8px; min-height: 1.4em; font-size: 14px; font-weight: 700; text-align: center; white-space: pre-line; }
.go-l-msg.ok { color: #2E7D32; }
.go-l-msg.no { color: #C62828; }
.go-view:not(.go-learning) .go-l-msg:empty { display: none; }
.go-l-list { margin-top: 8px; display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow-y: auto; padding: 10px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); }
.go-l-ch-head { font-weight: 800; font-size: 14px; }
.go-l-ch-head span { font-weight: 500; font-size: 12px; color: var(--on-surface-variant); }
.go-l-items { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.go-l-item { border: 1px solid var(--surface-variant); background: var(--surface); color: var(--on-surface); border-radius: 14px; padding: 4px 10px; font-size: 13px; cursor: pointer; }
.go-l-item.current { border-color: var(--primary); color: var(--primary); font-weight: 700; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .go-l-msg.ok { color: #81C784; } :root:not([data-theme=light]) .go-l-msg.no { color: #EF9A9A; } }
:root[data-theme=dark] .go-l-msg.ok { color: #81C784; }
:root[data-theme=dark] .go-l-msg.no { color: #EF9A9A; }

/* ── 윷놀이 ───────────────────────────────── */

/* ── 틱택토 ── */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(82vw, 360px);
  margin: 16px auto;
}
.ttt-cell {
  aspect-ratio: 1 / 1;
  border: 2px solid var(--surface-variant);
  border-radius: 12px;
  background: var(--card);
  font-size: 13vw;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
@media (min-width: 480px) { .ttt-cell { font-size: 56px; } }
.ttt-cell.x { color: #1E88E5; }
.ttt-cell.o { color: #E53935; }
.ttt-cell:disabled { cursor: default; }

.yut-sticks { display: flex; gap: 14px; perspective: 700px; padding-bottom: 8px; }
.yut-stick {                                /* 토스(상하 포물선) 담당 + 착지 그림자 */
  width: 20px;
  height: 66px;
  transform-origin: center;
  position: relative;
}
.yut-stick::after {                         /* 착지 그림자 */
  content: '';
  position: absolute;
  left: 50%; bottom: -10px;
  width: 22px; height: 6px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.28);
  border-radius: 50%;
  filter: blur(2px);
}
.yut-stick-spin {                           /* X축 공중제비 담당 (preserve-3d) */
  width: 100%; height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
}
.yut-face {                                 /* 양면: 평(밝음)/배(어둠) */
  position: absolute;
  inset: 0;
  border-radius: 10px;
  border: 1px solid #8a6d3b;
  backface-visibility: hidden;
  box-shadow: inset 0 0 6px rgba(0,0,0,.15);
}
.yut-face.flat  { background: linear-gradient(180deg, #F7EBCE, #E9D2A0); transform: rotateX(0deg); }
.yut-face.round { background: linear-gradient(180deg, #7A5A36, #543C22); transform: rotateX(180deg); }
.yut-face.round::after {                    /* 배 면 가운데 결 */
  content: '';
  position: absolute;
  left: 50%; top: 8%;
  width: 2px; height: 84%;
  transform: translateX(-50%);
  background: rgba(0,0,0,.25);
  border-radius: 2px;
}

/* 던지는 중: 막대는 위로 떴다 떨어지고, 안쪽은 빠르게 회전 */
.yut-stick.throwing            { animation: yut-toss .65s cubic-bezier(.25,.7,.4,1) both; }
.yut-stick.throwing .yut-stick-spin { animation: yut-spin .65s cubic-bezier(.3,.6,.45,1) both; }
.yut-stick:nth-child(2).throwing,
.yut-stick:nth-child(2).throwing .yut-stick-spin { animation-delay: .05s; }
.yut-stick:nth-child(3).throwing,
.yut-stick:nth-child(3).throwing .yut-stick-spin { animation-delay: .03s; }
.yut-stick:nth-child(4).throwing,
.yut-stick:nth-child(4).throwing .yut-stick-spin { animation-delay: .08s; }

@keyframes yut-toss {
  0%   { transform: translateY(0)     rotate(-8deg); }
  40%  { transform: translateY(-54px) rotate(6deg); }
  70%  { transform: translateY(-18px) rotate(-3deg); }
  88%  { transform: translateY(-30px) rotate(2deg); }   /* 작은 튕김 */
  100% { transform: translateY(0)     rotate(0deg); }
}
@keyframes yut-spin {
  0%   { transform: rotateX(0deg); }
  100% { transform: rotateX(1080deg); }                 /* 3바퀴 공중제비 */
}
.yut-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px 12px;
}
.yut-btn {
  flex: 1;
  margin: 0;
}

/* ── 윷놀이 (앱 게임 화면) ── */
/* 선수 카드 */
.yut-players { display: flex; gap: 8px; padding: 8px 12px 0; }
.yut-pcard {
  flex: 1; min-width: 0; position: relative;
  padding: 8px 10px 7px; border-radius: 14px;
  background: var(--card); border: 2px solid transparent;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  border-top: 4px solid var(--tc);
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.yut-pcard.active {
  border-color: var(--tc); transform: translateY(-2px) scale(1.02);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 25%, transparent), 0 6px 14px rgba(0,0,0,.14);
}
.yut-phead { display: flex; align-items: center; gap: 6px; min-width: 0; padding-right: 34px; }
.yut-avas { display: flex; flex: none; }
.yut-avas .yut-ava + .yut-ava { margin-left: -8px; }
.yut-ava {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--sc) 16%, var(--card)); box-shadow: 0 0 0 2px var(--sc);
  font-weight: 800; font-size: 14px; color: var(--sc);
}
.yut-ava.letter { background: var(--sc); color: #fff; }
.yut-ava-emoji { font-size: 19px; line-height: 1; }
.yut-pname { font-weight: 800; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.yut-pname .now { text-decoration: underline 3px var(--tc); text-underline-offset: 3px; }
.yut-ptoks { display: flex; gap: 4px; margin-top: 5px; }
.yut-ptoks .t { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-style: normal; box-sizing: border-box; }
.yut-ptoks .t.wait { border: 2px solid var(--tc); background: transparent; }
.yut-ptoks .t.on { background: var(--tc); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); }
.yut-ptoks .t.done { background: #FFC107; color: #fff; box-shadow: 0 0 0 2px #FFE082; }
.yut-pstat { position: absolute; right: 8px; top: 7px; font-size: 11px; color: var(--on-surface-variant); }
.yut-pstat b { color: #fff; background: var(--tc); padding: 2px 7px; border-radius: 999px; font-size: 11px; animation: yut-blink 1.4s ease-in-out infinite; }
@keyframes yut-blink { 50% { opacity: .6; } }

/* 판 + 무대 + 알림 띠 */
.yut-board-wrap { position: relative; padding: 10px 12px 6px; }
#yut-board { border-radius: 16px; box-shadow: 0 4px 16px rgba(80, 50, 10, .18); }
.yut-banner {
  position: absolute; left: 50%; top: 22px; z-index: 6; pointer-events: none;
  transform: translateX(-50%); white-space: nowrap;
  padding: 8px 18px; border-radius: 999px; font-weight: 800; font-size: 16px; color: #fff;
  background: var(--bc, #2B3550); box-shadow: 0 6px 18px rgba(0,0,0,.25);
}
.yut-banner.show { animation: yut-banner 1.5s ease-out both; }
@keyframes yut-banner {
  0% { opacity: 0; transform: translate(-50%, -16px) scale(.9); }
  14% { opacity: 1; transform: translate(-50%, 0) scale(1.04); }
  24% { transform: translate(-50%, 0) scale(1); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -6px); }
}
.yut-stage {
  position: absolute; inset: 10px 12px 6px; z-index: 5; border-radius: 16px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: radial-gradient(circle at 50% 45%, rgba(40, 28, 12, .55), rgba(20, 14, 6, .78));
  opacity: 0; pointer-events: none; transition: opacity .18s;
}
.yut-stage.show { opacity: 1; }
.yut-stage-who { color: #FFE9C2; font-weight: 800; font-size: 16px; min-height: 1.3em; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.yut-stage .yut-sticks { gap: 16px; padding: 6px 0 10px; }
.yut-stage .yut-stick { width: 26px; height: 92px; }
.yut-stage .yut-stick::after { width: 28px; }
.yut-stick.charging { animation: yut-shake .35s ease-in-out infinite; }
.yut-stick.charging:nth-child(2) { animation-delay: .08s; }
.yut-stick.charging:nth-child(3) { animation-delay: .16s; }
.yut-stick.charging:nth-child(4) { animation-delay: .04s; }
@keyframes yut-shake { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }
.yut-face.flat.mark::before {                 /* 백도 표시 가락 */
  content: '✕'; position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  color: #C62828; font-weight: 900; font-size: 15px;
}
.yut-stage-result { min-height: 64px; font-size: 56px; font-weight: 900; line-height: 1; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.35), 0 0 18px rgba(255,255,255,.25); }
.yut-stage-result.pop { animation: yut-stamp .45s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes yut-stamp { 0% { opacity: 0; transform: scale(2.4) rotate(-12deg); } 100% { opacity: 1; transform: scale(1) rotate(0); } }
.yut-stage-result.k-yut, .yut-stage-result.k-mo { color: #FFD54F; }
.yut-stage-result.k-back { color: #FF8A80; }
.yut-stage-sub { color: #FFE9C2; font-weight: 700; font-size: 15px; min-height: 1.2em; }

/* 이번 차례 윷 카드 */
.yut-panel { margin: 4px 12px 0; padding: 8px 10px 8px; border-radius: 14px; background: var(--card); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.yut-tray-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.yut-tray-title { font-weight: 800; font-size: 14px; }
.yut-tray-hint { font-size: 12px; color: var(--on-surface-variant); }
.yut-tray { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; min-height: 76px; align-items: center; }
.yut-tray-empty { color: var(--on-surface-variant); font-size: 13px; padding: 4px 2px; }
.yut-card {
  --kc: #1E88E5;
  position: relative; width: 58px; height: 76px; padding: 6px 0 0; box-sizing: border-box;
  border-radius: 12px; border: 2px solid var(--kc); background: var(--card); color: var(--kc);
  display: flex; flex-direction: column; align-items: center; gap: 1px; cursor: pointer;
  font: inherit; transition: transform .18s, box-shadow .18s, opacity .25s;
}
.yut-card b { font-size: 22px; font-weight: 900; line-height: 1.05; }
.yut-card small { font-size: 10px; font-weight: 700; opacity: .85; }
.yut-mini { display: flex; gap: 2px; margin-top: 3px; }
.yut-mini i { width: 6px; height: 16px; border-radius: 3px; background: #E9D2A0; border: 1px solid #8a6d3b; position: relative; }
.yut-mini i.r { background: #6B4D2D; }
.yut-mini i.x::after { content: ''; position: absolute; left: 1px; right: 1px; top: 6px; height: 2px; background: #C62828; }
.yut-card.k-do { --kc: #43A047; } .yut-card.k-gae { --kc: #00897B; } .yut-card.k-geol { --kc: #1E88E5; }
.yut-card.k-yut { --kc: #8E24AA; } .yut-card.k-mo { --kc: #F9A825; } .yut-card.k-back { --kc: #E53935; }
.yut-card.sel { background: var(--kc); color: #fff; transform: translateY(-4px); box-shadow: 0 6px 14px color-mix(in srgb, var(--kc) 45%, transparent); }
.yut-card.used { opacity: .45; cursor: default; }
.yut-card.burned { opacity: .4; cursor: default; filter: grayscale(.8); }
.yut-card.fresh { animation: yut-card-in .4s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes yut-card-in { 0% { opacity: 0; transform: translateY(-30px) scale(.6) rotate(-10deg); } 100% { opacity: 1; transform: none; } }
.yut-card.fresh.sel { animation: yut-card-in-sel .4s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes yut-card-in-sel { 0% { opacity: 0; transform: translateY(-30px) scale(.6) rotate(-10deg); } 100% { opacity: 1; transform: translateY(-4px); } }
.yut-card.ghost { border-style: dashed; border-color: var(--on-surface-variant); color: var(--on-surface-variant); justify-content: center; font-size: 22px; cursor: default; }
.yut-card.ghost.again { animation: yut-blink 1.2s ease-in-out infinite; }
.yut-card.small { width: 50px; height: 66px; }
.yut-card.small b { font-size: 19px; }
.yut-seq { position: absolute; left: 4px; top: 3px; font-size: 9px; font-weight: 800; opacity: .7; }
.yut-mark { position: absolute; right: -6px; top: -6px; width: 20px; height: 20px; border-radius: 50%; background: #43A047; color: #fff; font-size: 12px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.yut-mark.no { background: #9E9E9E; }
.yut-dcard { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 12px; }
.yut-dcard.cur { background: color-mix(in srgb, var(--tc) 14%, transparent); }
.yut-dname { font-size: 12px; font-weight: 800; color: var(--tc); max-width: 76px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.yut-team-opt { padding: 10px 14px; border-radius: 12px; border: 2px solid var(--primary); background: var(--card); color: var(--primary); font: inherit; font-weight: 700; cursor: pointer; }
.yut-guide { margin-top: 6px; min-height: 1.3em; font-size: 13px; font-weight: 600; color: var(--on-surface-variant); text-align: center; }

/* 아래 조작: 대기 말 · 큰 던지기 버튼 · 되돌리기 */
.yut-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; padding: 12px 12px 4px; }
.yut-home, .yut-undo {
  height: 56px; border-radius: 14px; border: 2px solid var(--surface-variant); background: var(--card); color: var(--on-surface);
  font: inherit; font-size: 13px; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; cursor: pointer;
}
.yut-home:disabled, .yut-undo:disabled { opacity: .55; cursor: default; }
.yut-home-toks { display: flex; gap: 3px; min-height: 14px; }
.yut-home-toks i { width: 13px; height: 13px; border-radius: 50%; background: var(--tc); }
.yut-home.ready { border-color: #FFB300; box-shadow: 0 0 0 3px rgba(255, 193, 7, .35); animation: yut-ready 1.1s ease-in-out infinite; }
@keyframes yut-ready { 50% { box-shadow: 0 0 0 7px rgba(255, 193, 7, .12); } }
.yut-undo { visibility: hidden; }
.yut-undo.show { visibility: visible; }
.yut-undo span { font-size: 12px; }
.yut-throw-btn {
  width: 96px; height: 96px; border-radius: 50%; border: 0; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 35% 30%, #8FA6CE, var(--primary) 70%); color: #fff;
  font: inherit; font-weight: 900; font-size: 15px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 6px 0 color-mix(in srgb, var(--primary) 60%, #000), 0 10px 18px rgba(0,0,0,.2);
  transition: transform .1s, box-shadow .1s, filter .2s;
}
.yut-throw-ico { font-size: 28px; line-height: 1; }
.yut-throw-btn:disabled { filter: grayscale(.7) opacity(.6); cursor: default; }
.yut-throw-btn.ready { animation: yut-pulse 1.2s ease-in-out infinite; }
.yut-throw-btn:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 color-mix(in srgb, var(--primary) 60%, #000), 0 4px 8px rgba(0,0,0,.2); }
.yut-throw-btn.confirm { background: radial-gradient(circle at 35% 30%, #81C784, #2E7D32 70%); box-shadow: 0 6px 0 #1B5E20, 0 10px 18px rgba(0,0,0,.2); }
@keyframes yut-pulse { 50% { filter: brightness(1.12); } }

/* 지난 기록 (접기) */
.yut-log-box { margin: 8px 12px 0; padding: 6px 10px; border-radius: 12px; background: var(--surface-variant); font-size: 13px; }
.yut-log-box summary { cursor: pointer; font-weight: 700; color: var(--on-surface-variant); }
.yut-log { margin-top: 4px; max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; line-height: 1.4; }
.yut-log-line { color: var(--on-surface-variant); }
.yut-log-line.fresh { color: var(--on-surface); font-weight: 600; }

/* ── 벽바둑 ─────────────────────────────── */

.wg-help-btn { padding: 6px 8px; font-size: 14px; white-space: nowrap; }
.wg-seats { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 12px 0; }
.wg-seat {
  flex: 1 1 calc(50% - 6px);
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--surface-variant);
  color: var(--on-surface-variant);
  font-size: 14px;
}
.wg-dot { flex: none; width: 14px; height: 14px; border-radius: 4px; background: var(--wg-c); box-shadow: inset 0 -3px 0 rgba(0,0,0,.22); }
.wg-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.wg-seat.me .wg-name { text-decoration: underline; text-underline-offset: 3px; }
.wg-seat.active { border-color: var(--primary); background: var(--primary-container); color: var(--on-primary-container); }
.wg-seat.active { border-color: var(--wg-c); background: color-mix(in srgb, var(--wg-c) 16%, var(--card)); color: var(--on-surface); box-shadow: 0 2px 8px color-mix(in srgb, var(--wg-c) 30%, transparent); }
.wg-seat.active .wg-name { font-weight: 800; }
.wg-score { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wg-score b { font-size: 17px; font-weight: 800; margin-right: 1px; }
.wg-bar { display: flex; height: 8px; margin: 8px 12px 0; border-radius: 4px; overflow: hidden; background: var(--surface-variant); }
.wg-bar i { flex: none; width: 0; transition: width .4s ease; }
.wg-hm { font-size: 13px; }
.wg-hm.used { opacity: 0.25; filter: grayscale(1); }
.wg-sec { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wg-sec:empty { display: none; }
.wg-sec.hurry { color: #D32F2F; font-weight: 700; }
/* 안내 글은 늘 한 줄 — 글이 넘쳐 줄이 바뀌면 판이 밀려 엉뚱한 곳을 누르게 됨 */
.wg-turn { margin: 8px 16px 0; min-height: 1.4em; font-size: clamp(12px, 3.6vw, 14px); font-weight: 600; text-align: center; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#wg-board { touch-action: none; }
.wg-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; padding: 0 12px 12px; }
.wg-actions .text-btn:disabled { opacity: 0.4; cursor: default; }
.wg-actions .text-btn[hidden] { display: none; }
#wg-break.on { background: var(--primary-container); }
.wg-actions .wg-ok { padding: 8px 20px; background: var(--primary); color: #fff; }
.wg-actions .wg-ok:active { background: var(--primary); opacity: 0.85; }
#wg-reset { margin-left: auto; }
.wg-help { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 6px; max-width: 420px; font-size: 14px; line-height: 1.55; }
.wg-help p { margin: 0; }

/* ── 블로커스 ─────────────────────────────── */

.bk-tray {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  overflow-x: auto;
  padding: 8px 12px;
  min-height: 70px;
}
.bk-piece {
  display: grid;
  gap: 1px;
  flex-shrink: 0;
  padding: 5px;
  border: none;
  border-radius: 6px;
  background: rgba(41, 98, 255, 0.08);
}
.bk-piece.selected {
  outline: 2px solid #2962FF;
  background: rgba(41, 98, 255, 0.18);
}
.bk-cell {
  background: #2962FF;
  border-radius: 2px;
}
.bk-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 12px 12px;
}
.bk-btn {
  flex: 1;
  margin: 0;
}

/* ── 우노 ─────────────────────────────────── */

.uno-opps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px 0;
}
.uno-opp {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 6px 8px;
  border: 1px solid var(--surface-variant);
  border-radius: 10px;
  background: var(--card);
}
.uno-opp.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary) inset;
}
.uno-opp-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface-variant);
}
.uno-opp-hand {
  display: flex;
  gap: 2px;
  margin-top: 4px;
  min-height: 32px;
  flex-wrap: wrap;
}
.uno-opp-hand .uno-card.uno-back {
  width: 18px;
  height: 28px;
  box-shadow: none;
}
.uno-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 16px 12px;
}
.uno-pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.uno-drawpile {
  width: 56px;
  height: 84px;
  border-radius: 10px;
  border: 2px dashed var(--on-surface-variant);
  background: rgba(0, 0, 0, 0.04);
  font-size: 30px;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.uno-drawpile:disabled {
  opacity: 0.4;
}
.uno-color-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--on-surface-variant);
}
.uno-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid rgba(0, 0, 0, 0.2);
}
.uno-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 84px;
  flex-shrink: 0;
  border-radius: 10px;
  font-size: 26px;
  font-weight: 700;
  color: #FFF;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  user-select: none;
}
.uno-card.uno-dark-text { color: #2A2A2A; }
.uno-card.uno-wild {
  background: conic-gradient(#E53935 0 25%, #FBC02D 0 50%, #43A047 0 75%, #1E88E5 0) !important;
  color: #FFF;
  text-shadow: 0 0 3px #000, 0 1px 2px #000;
}
.uno-card.uno-back {
  width: 30px;
  height: 44px;
  background: repeating-linear-gradient(45deg, #37474F, #37474F 4px, #455A64 4px, #455A64 8px);
  border-radius: 5px;
}
.uno-ai-hand .uno-card.uno-back { box-shadow: none; }
.uno-discard .uno-card {
  width: 64px;
  height: 96px;
  font-size: 30px;
}
.uno-hand {
  /* 내 카드 — 가로 스크롤 없이 줄바꿈해 한눈에 (낼 수 있는 카드가 위로 뜨니 위 여백) */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 6px;
  padding: 12px 8px 8px;
  min-height: 100px;
}
@media (max-width: 480px) {
  .uno-hand { gap: 7px 5px; }
  .uno-hand .uno-card { width: 48px; height: 72px; font-size: 22px; border-radius: 8px; }
}
.uno-card.uno-playable {
  cursor: pointer;
  outline: 3px solid #4A90D9;
  transform: translateY(-6px);
}
.uno-card.uno-dim { opacity: 0.55; }
.uno-msg {
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--primary);
  min-height: 1.2em;
  padding: 0 12px;
}
.uno-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 8px 12px 12px;
}
.uno-picker-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}
.uno-color-btn {
  height: 56px;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #FFF;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
#jg-board {
  display: block;
  width: 100%;
  aspect-ratio: 9 / 10;
  border-radius: 8px;
  touch-action: manipulation;
}

.primary-btn {
  margin: auto 16px 12px;
  height: 50px;
  border: none;
  border-radius: 25px;
  background: var(--primary);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.primary-btn:active { opacity: 0.85; }

/* ── 다빈치코드 ───────────────────────────── */
/* 보라 펠트 판 (라이트·다크 같음). 세로 화면: 상대 자리들 → 안내·기록 → 내 랙 → 더미·뽑은 타일·그만 / 가로 화면: 오른쪽 칸에 더미·뽑은 타일·그만
   (가로 조건 min-aspect-ratio 5/4 는 davinci-view.ts LANDSCAPE 와 같게). 타일 크기는 JS(fit)가 --tw(상대) · --me-tw(나) 로 맞춤 */
#davinci-view {
  --me-tw: 48px;
  max-width: 1280px;
  height: 100dvh;
  min-height: 0;
  color: #FFF;
  background: radial-gradient(ellipse at 50% 28%, #5D4BC0 0%, #3B2D8C 45%, #1C1550 100%);
  overflow: hidden;
  position: relative;
}
.dv-header { padding: 6px 8px; flex: none; }
.dv-header h2 { font-size: 18px; }
.dv-header .icon-btn, .dv-header .sfx-toggle { color: #FFF; }
.dv-setup-btn { font-size: 20px; }
.dv-setup-btn[hidden] { display: none; }

.dv-board {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  grid-template-areas: "opps" "msgs" "me" "side";
}
.dv-opps { grid-area: opps; }
.dv-msgs { grid-area: msgs; }
.dv-me { grid-area: me; }
.dv-side { grid-area: side; }

/* 자리 — 상대는 반투명 판, 차례면 초록 테 */
.dv-opps { --tw: 44px; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.dv-seat { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 16px; background: rgba(12, 6, 48, 0.38); transition: box-shadow 0.25s, opacity 0.25s; }
.dv-opps .dv-seat { flex: 1 1 0; min-height: 0; justify-content: center; }
.dv-seat.turn { box-shadow: 0 0 0 2px rgba(124, 240, 138, 0.7), 0 0 18px rgba(124, 240, 138, 0.25); }
.dv-seat.out { opacity: 0.45; }
.dv-who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dv-ava {
  position: relative; flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; background: var(--seat);
  font-weight: 800; font-size: 14px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.dv-ava-emoji { font-size: 1.45em; line-height: 1; }   /* AI·내 이모지 얼굴은 글자보다 크게 */
.dv-seat.turn .dv-ava::before {
  content: ''; position: absolute; inset: -4px; border-radius: 50%;
  border: 3px solid #7CF08A; animation: dv-ring 1.4s ease-in-out infinite;
}
@keyframes dv-ring { 50% { transform: scale(1.12); opacity: 0.5; } }
.dv-who-info { display: flex; align-items: baseline; gap: 6px; min-width: 0; line-height: 1.15; }
.dv-name { font-size: 14px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 120px; }
.dv-cnt { font-size: 12px; opacity: 0.75; white-space: nowrap; }
.dv-say {
  margin-left: auto; padding: 3px 10px; border-radius: 999px; white-space: nowrap;
  background: #FFF8E1; color: #3A2C00; font-size: 12px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); animation: dv-say 0.25s ease-out;
}
@keyframes dv-say { from { transform: translateY(4px); opacity: 0; } }

/* 타일 줄 + 칸 번호 */
.dv-row { display: flex; justify-content: center; gap: calc(var(--tw) * 0.14); min-width: 0; }
.dv-cell { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dv-idx { font-size: max(10px, calc(var(--tw) * 0.2)); font-weight: 700; opacity: 0.55; line-height: 1; }

/* 타일 — 흑(검정 바탕 흰 숫자) / 백(상아 바탕 검은 숫자). 크기는 둘러싼 곳의 --tw */
.dv-tile {
  position: relative;
  flex: none;
  width: var(--tw);
  height: calc(var(--tw) * 1.42);
  box-sizing: border-box;
  border: none;
  border-radius: calc(var(--tw) * 0.13);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0 calc(var(--tw) * 0.06);
  font: 900 calc(var(--tw) * 0.62) / 1 system-ui, -apple-system, 'Segoe UI', sans-serif;
  letter-spacing: -0.05em;
  user-select: none;
  -webkit-user-select: none;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}
.dv-b {
  background: linear-gradient(160deg, #4A4A57 0%, #24242C 45%, #141418 100%);
  color: #FFF;
  box-shadow: 0 calc(var(--tw) * 0.06) 0 #050507, 0 3px 7px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.dv-w {
  background: linear-gradient(160deg, #FFFFFF 0%, #F3EEE2 55%, #DCD2BC 100%);
  color: #17171C;
  box-shadow: 0 calc(var(--tw) * 0.06) 0 #A79A7E, 0 3px 7px rgba(0, 0, 0, 0.4), inset 0 1px 0 #FFF;
}
.dv-back { font-size: calc(var(--tw) * 0.44); }
.dv-back.dv-b { color: rgba(255, 255, 255, 0.28); }
.dv-back.dv-w { color: rgba(0, 0, 0, 0.22); }
/* 공개된 상대 타일 — 숫자 + 아래 주황 띠 */
.dv-open::after {
  content: ''; position: absolute; left: 18%; right: 18%; bottom: calc(var(--tw) * 0.1);
  height: max(3px, calc(var(--tw) * 0.07)); border-radius: 2px; background: #FFA94D;
}
/* 남들이 아는 내 타일 — 흐리게 + 👁 */
.dv-known { opacity: 0.6; }
.dv-known::before {
  content: '👁'; position: absolute; top: calc(var(--tw) * -0.16); right: calc(var(--tw) * -0.16);
  font-size: max(11px, calc(var(--tw) * 0.3)); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}
/* 누를 수 있는 타일 / 고른 칸 / AI가 노리는 칸 */
.dv-pick { cursor: pointer; }
.dv-pick:hover { transform: translateY(calc(var(--tw) * -0.1)); }
.dv-opps .dv-pick { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55), 0 3px 7px rgba(0, 0, 0, 0.45); }
.dv-me .dv-pick { animation: dv-bob 1.2s ease-in-out infinite; }
@keyframes dv-bob { 50% { transform: translateY(calc(var(--tw) * -0.12)); } }
.dv-sel { transform: translateY(calc(var(--tw) * -0.12)); box-shadow: 0 0 0 3px #FFD54F, 0 0 16px 4px rgba(255, 213, 79, 0.75) !important; }
.dv-aim { box-shadow: 0 0 0 3px #FFB300, 0 0 16px 4px rgba(255, 179, 0, 0.8) !important; animation: dv-aim 0.6s ease-in-out infinite; }
@keyframes dv-aim { 50% { transform: translateY(calc(var(--tw) * -0.12)) scale(1.05); } }
/* 맞힘(초록) · 틀려서 공개(빨강) — 몇 초 빛남 */
.dv-ok { box-shadow: 0 0 0 3px #5BE37A, 0 0 18px 5px rgba(91, 227, 122, 0.85) !important; opacity: 1; }
.dv-no { box-shadow: 0 0 0 3px #FF5252, 0 0 18px 5px rgba(255, 82, 82, 0.8) !important; opacity: 1; }
.dv-flip { animation: dv-flip 0.6s ease-in-out; }
@keyframes dv-flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg) scale(1.1); } 100% { transform: rotateY(0); } }
.dv-in { animation: dv-in 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes dv-in { from { transform: translateY(calc(var(--tw) * -0.8)) scale(1.25); opacity: 0; } }

/* 안내·추리 기록 */
.dv-msgs { text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.dv-status { font-size: 14px; font-weight: 800; min-height: 1.4em; }
.dv-status[data-tone=good] { color: #8EF5A0; }
.dv-status[data-tone=bad] { color: #FFB4A9; }
.dv-status[data-tone=me] { color: #FFE082; }
.dv-log {
  list-style: none; margin: 0; padding: 4px 12px; border-radius: 10px; max-width: 100%;
  background: rgba(12, 6, 48, 0.35); font-size: 12px; cursor: pointer;
  display: flex; flex-direction: column; gap: 1px;
}
.dv-log[hidden] { display: none; }
.dv-log li { opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dv-log li.latest { opacity: 1; font-weight: 700; }
.dv-log.open { max-height: 40dvh; overflow: auto; }
.dv-log:not(.open)::after { content: '📜 눌러서 전체 기록'; font-size: 10px; opacity: 0.5; }

/* 내 자리 — 나무 랙 */
.dv-me { --tw: var(--me-tw); flex-direction: row; align-items: center; gap: 10px; background: rgba(12, 6, 48, 0.25); }
.dv-me .dv-who { flex-direction: column; gap: 4px; flex: none; min-width: 52px; }
.dv-me .dv-who-info { flex-direction: column; align-items: center; gap: 1px; }
.dv-me .dv-ava { width: 40px; height: 40px; font-size: 16px; }
.dv-rack {
  flex: 1; min-width: 0;
  padding: calc(var(--tw) * 0.22) 8px 6px;
  border-radius: 10px 10px 6px 6px;
  background: linear-gradient(#EBC896, #D2A36A 60%, #B9864C);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.dv-rack .dv-idx { color: #5A3A14; opacity: 0.7; margin-top: 3px; }
.dv-me .dv-name { display: none; } /* 아바타가 이미 '나' */

/* 더미 · 뽑은 타일 · 그만 */
.dv-side { --tw: var(--me-tw); display: flex; gap: 10px; align-items: center; padding-bottom: env(safe-area-inset-bottom); }
.dv-deck { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.dv-deck-stack { position: relative; width: calc(var(--tw) * 0.8); height: calc(var(--tw) * 1.1); }
.dv-deck-stack i { --tw: calc(var(--me-tw) * 0.8); position: absolute; width: var(--tw); height: calc(var(--tw) * 1.38); border-radius: 5px; }
.dv-deck-stack i:nth-child(1) { left: -4px; top: 0; transform: rotate(-8deg); }
.dv-deck-stack i:nth-child(2) { left: 0; top: -2px; transform: rotate(3deg); }
.dv-deck-stack i:nth-child(3) { left: 4px; top: -4px; transform: rotate(-2deg); }
.dv-deck-text { font-size: 12px; opacity: 0.85; white-space: nowrap; margin-top: calc(var(--tw) * 0.1); }
.dv-deck-text b { font-size: 15px; }
.dv-drawn { display: flex; flex-direction: column; align-items: center; gap: 4px; flex: none; }
.dv-pending {
  --tw: calc(var(--me-tw) * 1.05);
  width: calc(var(--tw) + 8px); height: calc(var(--tw) * 1.42 + 8px);
  display: grid; place-items: center; border-radius: 10px;
}
.dv-pending.empty { border: 2px dashed rgba(255, 255, 255, 0.3); }
.dv-pending .dv-tile { box-shadow: 0 0 0 3px #5BE37A, 0 0 14px 4px rgba(91, 227, 122, 0.6); }
.dv-draw-in { animation: dv-draw 0.6s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes dv-draw { from { transform: translate(calc(var(--tw) * -1.4), calc(var(--tw) * -0.2)) rotate(-25deg) scale(0.6); opacity: 0; } }
.dv-pending-label { font-size: 11px; opacity: 0.8; white-space: nowrap; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.dv-stop {
  flex: 1; height: 56px; min-width: 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 2px solid rgba(255, 255, 255, 0.25); border-radius: 14px;
  background: linear-gradient(#6B58D6, #4A39A8); color: #FFF;
  font: inherit; font-weight: 800; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 3px 8px rgba(0, 0, 0, 0.35);
}
.dv-stop:disabled { opacity: 0.4; cursor: default; }
.dv-stop.ready { background: linear-gradient(#43B35A, #2B8C40); border-color: #B7F5C2; animation: dv-ready 1.2s ease-in-out infinite; }
@keyframes dv-ready { 50% { box-shadow: 0 0 0 5px rgba(124, 240, 138, 0.35), 0 3px 8px rgba(0, 0, 0, 0.35); } }
.dv-stop-icon { font-size: 22px; }
.dv-stop-label { font-size: 17px; }
.dv-stop small { font-size: 11px; font-weight: 600; opacity: 0.8; }
/* 온라인 — 오른쪽 아래 💬 방 채팅 버튼 자리 비우기 */
.dv-online .dv-side { padding-right: 62px; }

/* 숫자판 — 그 칸 색의 타일 모양 0~11, 올 수 없는 숫자는 흐리게 */
.dv-picker { width: min(400px, calc(100vw - 24px)); padding: 18px 16px 12px; }
.dv-picker-title { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 17px; font-weight: 800; margin-bottom: 14px; }
.dv-mini { --tw: 18px; display: inline-flex; }
.dv-picker-grid { --tw: min(52px, calc((100vw - 24px - 32px - 50px) / 6)); display: grid; grid-template-columns: repeat(6, var(--tw)); gap: 10px 8px; justify-content: center; }
.dv-picker-grid .dv-num { cursor: pointer; }
.dv-picker-grid .dv-num:hover:not(:disabled) { transform: translateY(-3px); }
.dv-picker-grid .dv-num:active:not(:disabled) { transform: scale(0.94); }
.dv-picker-grid .dv-num:disabled { opacity: 0.18; cursor: default; box-shadow: none; }
.dv-picker-note { margin: 12px 0 4px !important; font-size: 12px; text-align: center; }

/* 넓은 PC에서 🏆 리더보드가 오른쪽에 떠 있을 때(💬 오른쪽 칸이 없을 때) — 그만큼 비켜 줌 */
@media (min-width: 1280px) {
  body:not(.ylc-docked) #davinci-view { margin-right: 302px; }
}
/* 가로 화면 — 오른쪽 칸에 더미·뽑은 타일·그만, 상대 자리는 이름이 왼쪽 */
@media (min-aspect-ratio: 5/4) {
  .dv-header { padding: 2px 8px; }
  .dv-board {
    grid-template-columns: minmax(0, 1fr) 120px;
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas: "opps side" "msgs side" "me side";
    gap: 6px 12px;
  }
  .dv-opps .dv-seat { flex-direction: row; align-items: center; gap: 12px; }
  .dv-opps .dv-who { flex-direction: column; flex: none; width: 76px; gap: 4px; }
  .dv-opps .dv-who-info { flex-direction: column; align-items: center; gap: 1px; }
  .dv-opps .dv-ava { width: 42px; height: 42px; font-size: 18px; }
  .dv-opps .dv-name { max-width: 76px; }
  .dv-opps .dv-row { flex: 1; }
  .dv-opps .dv-say { position: absolute; top: 6px; right: 10px; z-index: 2; }
  .dv-side { flex-direction: column; justify-content: flex-start; padding-top: 4px; }
  .dv-stop { flex: 1; flex-direction: column; width: 100%; height: auto; min-height: 100px; max-height: 180px; margin-top: auto; gap: 2px; }
  .dv-stop-icon { font-size: 30px; }
  .dv-online .dv-side { padding-right: 0; padding-bottom: 66px; }
}
/* 폰 가로(낮은 화면) — 이름 칸·기록을 줄여 상대 타일 줄을 크게 */
@media (min-aspect-ratio: 5/4) and (max-height: 520px) {
  .dv-board { gap: 4px 10px; padding-bottom: 6px; }
  .dv-opps { gap: 4px; }
  .dv-opps .dv-seat { padding: 4px 8px; gap: 8px; }
  .dv-opps .dv-who { width: 58px; gap: 2px; }
  .dv-opps .dv-ava, .dv-me .dv-ava { width: 28px; height: 28px; font-size: 13px; }
  .dv-opps .dv-name { font-size: 12px; max-width: 58px; }
  .dv-cnt { font-size: 11px; }
  .dv-status { font-size: 13px; min-height: 0; }
  .dv-log li:not(.latest) { display: none; }
  .dv-log.open li:not(.latest) { display: block; }
  .dv-log::after { display: none; }
  .dv-me { padding: 4px 8px; }
  .dv-me .dv-who { min-width: 40px; }
  .dv-side { gap: 6px; }
  .dv-stop { min-height: 70px; }
}

/* ── 체스 ────────────────────────────────── */

/* ── 체스 3D 보드 ───────────────────────── */
.cs-3d {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #10131a;
  touch-action: none;
  user-select: none;
}
.cs-3d canvas { display: block; }

.cs-toolbar { display: flex; gap: 8px; padding: 6px 16px 0; }
.cs-toolbar .seg-btn { flex: 0 0 auto; padding: 0 14px; height: 32px; }
/* 무르기 요청/응답 띠 (체스 등 2인 게임) */
.undo-banner {
  margin: 8px 16px 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-variant);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.undo-banner span { flex: 1 1 auto; }
.undo-banner button {
  height: 32px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
}
.undo-banner button.secondary { background: var(--card); color: inherit; border: 1px solid var(--surface-variant); }

/* ── 체스 2D 보드 (토글) — 나무 테두리 + SVG 기물 ── */
.cs-3d.cs2-host {
  padding: 10px;
  border-radius: 14px;
  background: linear-gradient(145deg, #7a4f2e, #4a2e19 60%, #5d3a20);
  box-shadow: 0 6px 18px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.18), inset 0 -2px 4px rgba(0,0,0,.35);
  box-sizing: border-box;
}
.cs2-board {
  --cs2-light: #f0dcbc;
  --cs2-dark: #b5845b;
  position: relative;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 0 0 3px rgba(255,220,170,.12);
}
.cs2-sq {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background-color: var(--cs2-light);
}
.cs2-dark { background-color: var(--cs2-dark); }
/* 칸 안 좌표 — 판 색과 반대 색으로 작게 */
.cs2-rank, .cs2-file {
  position: absolute;
  font-size: clamp(8px, 2.2vw, 12px);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  color: var(--cs2-dark);
  opacity: .9;
}
.cs2-dark .cs2-rank, .cs2-dark .cs2-file { color: var(--cs2-light); }
.cs2-rank { top: 3px; left: 3px; }
.cs2-file { bottom: 2px; right: 3px; }
/* 직전 수(출발·도착) — 상대가 뭘 움직였는지 한눈에. 새로 생기면 한 번 깜빡 */
.cs2-last { background-image: linear-gradient(rgba(255,208,40,.55), rgba(255,208,40,.55)); }
.cs2-flash { animation: cs2-flash 1s ease-out 1; }
@keyframes cs2-flash { 0%, 30% { box-shadow: inset 0 0 0 100px rgba(255,170,0,.55); } 100% { box-shadow: inset 0 0 0 100px rgba(255,170,0,0); } }
/* 고른 말 */
.cs2-sel { background-image: linear-gradient(rgba(46,125,50,.55), rgba(46,125,50,.55)); }
/* 체크 — 킹 아래 빨간 빛 */
.cs2-chk { background-image: radial-gradient(circle, rgba(255,40,40,.95) 0%, rgba(230,0,0,.7) 30%, rgba(200,0,0,0) 72%); }
/* 기물 */
.cs2-pc {
  position: relative;
  z-index: 1;
  width: 88%;
  height: 88%;
  pointer-events: none;
  transition: transform .15s ease, opacity .25s ease;
}
.cs2-pc.cs2-fade { opacity: 0; transform: scale(.55); }
.cs2-sel .cs2-pc { transform: translateY(-5%) scale(1.08); }
.cs2-sel .cs2-pc .csp { filter: drop-shadow(0 5px 3px rgba(0,0,0,.4)); }
/* 갈 수 있는 칸 점 · 잡을 수 있는 칸 고리 */
.cs2-dot { display: none; position: absolute; z-index: 2; pointer-events: none; border-radius: 50%; }
.cs2-tgt .cs2-dot { display: block; width: 28%; height: 28%; background: rgba(30,90,40,.45); }
.cs2-cap .cs2-dot {
  display: block; inset: 0; width: auto; height: auto; border-radius: 0;
  background: radial-gradient(circle, transparent 0 66%, rgba(30,90,40,.5) 67% 100%);
}
@media (hover: hover) {
  .cs2-tgt:hover, .cs2-cap:hover { background-image: linear-gradient(rgba(46,125,50,.35), rgba(46,125,50,.35)); }
  .cs2-tgt:hover .cs2-dot { width: 34%; height: 34%; }
}
/* 움직이는 말 — 살짝 들린 채 미끄러짐 */
.cs2-fly {
  position: absolute;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 5; will-change: transform;
}
.cs2-fly .csp { width: 88%; height: 88%; transform: scale(1.08); filter: drop-shadow(0 6px 4px rgba(0,0,0,.4)); }

/* SVG 기물 색 (2D 판·잡힌 말 줄 공통) */
.csp {
  display: block;
  width: 100%;
  height: 100%;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 2px 1.5px rgba(0,0,0,.35));
}
.csp-w { fill: #fbf6ec; stroke: #3b332b; }
.csp-b { fill: #2d2a30; stroke: #121014; }
.csp .d { fill: none; stroke-width: 3; }
.csp-w .d { stroke: #8a7c6a; }
.csp-b .d { stroke: #8f8796; }
.csp .e { stroke: none; }
.csp-w .e { fill: #3b332b; }
.csp-b .e { fill: #d9d1c4; }

/* ── 장기 차림 선택 ── */
.jg-setup { padding: 8px 16px 0; }
.jg-setup-title { font-size: 14px; font-weight: 700; color: var(--on-surface-variant); margin-bottom: 6px; text-align: center; }
.jg-setup-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jg-form-btn {
  height: 44px;
  border: 1px solid var(--primary);
  background: var(--card);
  color: var(--primary);
  font-size: 16px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
}
.jg-form-btn:active { background: var(--primary); color: #FFF; }

/* 3D 확대/축소 버튼 (캔버스 위 오버레이) */
.r3d-zoom {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
}
.r3d-zoom button {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: rgba(20, 24, 32, 0.7);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.r3d-zoom button:active { background: rgba(58, 110, 165, 0.9); }

/* 잡힌 말 트레이 + 득실 */
.cs-cap-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 2px 16px;
}
.cs-cap-pieces {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
/* 잡은 말 — 작은 SVG 를 살짝 겹쳐 놓고, 종류가 바뀌면 조금 띄움 */
.cs-cap-pieces .csp { flex: 0 0 auto; width: 22px; height: 22px; margin-right: -7px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.cs-cap-pieces .csp.gap { margin-left: 9px; }
.cs-cap-pieces .csp:first-child { margin-left: 0; }
.cs-cap-score {
  font-size: 13px;
  font-weight: 800;
  color: var(--primary);
  min-width: 30px;
  text-align: right;
}

/* ── 난이도 선택 바 ───────────────────────── */

.seg-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 16px 0;
}
.seg-label {
  font-size: 13px;
  color: var(--on-surface-variant);
}
.seg-btn {
  flex: 1;
  height: 34px;
  border: 1px solid var(--primary);
  background: var(--card);
  color: var(--primary);
  font-size: 14px;
  border-radius: 8px;
  cursor: pointer;
}
.seg-btn.active {
  background: var(--primary);
  color: #FFF;
}

/* ── 루미큐브 ─────────────────────────────── */
/* 파란 펠트 판 (라이트·다크 같음). 세로 화면: 자리 줄 → 바닥 → 안내 → 랙 → 버튼 줄 / 가로 화면: 왼쪽 자리 · 가운데 바닥+랙 · 오른쪽 버튼
   (가로 조건 min-aspect-ratio 5/4 는 rummikub-view.ts LANDSCAPE 와 같게) */

#rummikub-view {
  max-width: 1280px;
  height: 100dvh;
  min-height: 0;
  color: #FFF;
  background: radial-gradient(ellipse at 50% 30%, #3569D2 0%, #2150AE 45%, #14357A 100%);
  overflow: hidden;
  position: relative;
}
.rk-header { padding: 6px 8px; flex: none; }
.rk-header h2 { font-size: 18px; }
.rk-header .icon-btn, .rk-header .sfx-toggle { color: #FFF; }
.rk-setup-btn { font-size: 20px; }

.rk-board {
  flex: 1;
  min-height: 0;
  display: grid;
  gap: 6px;
  padding: 0 10px 10px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  grid-template-areas: "players" "table" "msgs" "rack" "side";
}
.rk-players { grid-area: players; }
.rk-table { grid-area: table; }
.rk-msgs { grid-area: msgs; }
.rk-rack-wrap { grid-area: rack; }
.rk-side { grid-area: side; }

/* 자리 패널 — 차례인 사람은 초록 고리(차례 시간이면 줄어드는 고리 + 남은 초) */
.rk-players { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.rk-seat { display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 4px; border-radius: 999px; background: rgba(5, 20, 60, 0.45); }
.rk-seat.me { order: 9; }
.rk-seat.passed { opacity: 0.7; }
.rk-seat.turn { box-shadow: 0 0 0 2px rgba(124, 240, 138, 0.55); }
.rk-ava {
  --p: 1;
  position: relative;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--seat);
  font-weight: 800;
  font-size: 16px;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.2);
}
.rk-ava > span { grid-area: 1 / 1; }
/* 마이페이지에서 올린 사진 — 아바타 동그라미를 채움 */
.ava-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.rk-ava-face:has(> .ava-photo) { width: 100%; height: 100%; }
.rk-ava-emoji { font-size: 1.45em; line-height: 1; }   /* AI·내 이모지 얼굴은 글자보다 크게 */
.rk-seat.turn .rk-ava::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 50%;
  background: conic-gradient(#7CF08A calc(var(--p) * 360deg), rgba(255, 255, 255, 0.18) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3.5px));
}
.rk-seat.turn.hurry .rk-ava::before { background: conic-gradient(#FF5252 calc(var(--p) * 360deg), rgba(255, 255, 255, 0.18) 0); }
.rk-ava-sec:not(:empty) { font-size: 17px; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); z-index: 1; }
.rk-ava:has(.rk-ava-sec:not(:empty)) .rk-ava-face { opacity: 0.25; }
.rk-seat-info { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.rk-seat-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 84px; }
.rk-cnt { display: inline-flex; align-items: center; gap: 3px; font-size: 13px; font-weight: 800; }
.rk-unopened { font-size: 10px; opacity: 0.75; }
.rk-mini { display: inline-block; width: 9px; height: 12px; box-sizing: border-box; border-radius: 2px; border: 1.5px solid currentColor; opacity: 0.85; }

/* 바닥 — 줄 자동 배치(가운데 정렬), 패 크기는 JS(fit)가 --tw 로 맞춤. 아래에 새 줄 놓을 여유를 늘 남김 */
.rk-table {
  --tw: 40px;
  position: relative;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start; /* 위부터 — 아래(내 앞)에 새 줄 놓을 자리 */
  justify-content: center;
  gap: calc(var(--tw) * 0.32) calc(var(--tw) * 0.5);
  padding: 8px 6px;
  border-radius: 14px;
  outline: 2px dashed transparent;
  outline-offset: -4px;
}
.rk-table.rk-over { background: rgba(255, 213, 79, 0.1); outline-color: rgba(255, 213, 79, 0.7); }   /* 새 줄로 놓기 */
.rk-table-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; font-size: 13px; opacity: 0.7; padding: 0 12px; pointer-events: none; }
.rk-meld { position: relative; display: flex; gap: 2px; border-radius: calc(var(--tw) * 0.16); }
.rk-table.rk-free { display: block; }                  /* 내 차례 — 줄 자리 고정(JS 가 left/top) */
.rk-free .rk-meld { position: absolute; }
.rk-meld-bad { outline: 2px solid #FF5252; outline-offset: 2px; background: rgba(255, 82, 82, 0.22); }
.rk-bad-label { position: absolute; top: -11px; right: -9px; font-size: 12px; z-index: 3; }
.rk-meld.rk-over { outline: 2px solid #FFD54F; outline-offset: 3px; background: rgba(255, 213, 79, 0.16); }
.rk-ins {                         /* 끼워 넣을 자리 */
  position: fixed;
  z-index: 900;
  width: 5px;
  margin-left: -2.5px;
  border-radius: 3px;
  background: #FFD54F;
  box-shadow: 0 0 8px 2px rgba(255, 213, 79, 0.8);
  pointer-events: none;
}

/* 패 — 크기는 둘러싼 곳(바닥·랙·끌기)의 --tw */
.rk-tile {
  position: relative;
  flex: none;
  width: var(--tw);
  height: calc(var(--tw) * 1.32);
  box-sizing: border-box;
  border-radius: calc(var(--tw) * 0.14);
  background:
    radial-gradient(circle at 50% 42%, rgba(0, 0, 0, 0.045) 0 33%, transparent 34%),
    linear-gradient(#FFFFFF, #F3EEE2 65%, #E2D8C2);
  box-shadow: 0 calc(var(--tw) * 0.05) 0 #B5A88C, 0 2px 5px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: calc(var(--tw) * 0.16);
  font-size: calc(var(--tw) * 0.6);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1;
  font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  cursor: grab;
  transition: transform 0.12s;
}
.rk-jk { width: 78%; height: auto; }
.rk-red { color: #C2002F; }                 /* 진한 다홍 — 주황과 헷갈리지 않게 붉은 보라 쪽으로 */
.rk-blue { color: #1450C8; }
.rk-orange { color: #F5A000; text-shadow: 0 0 1px rgba(140, 80, 0, 0.55); } /* 노란 기 도는 주황 + 옅은 테두리(크림색 패에서 또렷하게) */
.rk-black { color: #1A1A1A; }
.rk-selected { transform: translateY(calc(var(--tw) * -0.16)); outline: 3px solid #FFD54F; outline-offset: -1px; }
.rk-new { box-shadow: 0 0 0 2px #FF8A3D, 0 0 10px 3px rgba(255, 138, 61, 0.85); }
.rk-recent { box-shadow: 0 0 0 2px rgba(255, 196, 120, 0.85), 0 0 8px 2px rgba(255, 170, 80, 0.45); }
.rk-moved { box-shadow: 0 0 0 2px #64B5F6, 0 0 10px 3px rgba(100, 181, 246, 0.8); }   /* 다른 사람이 다른 줄에서 옮긴 패 */
.rk-focus { animation: rk-focus 0.45s ease-out; }                                       /* 방금 놓인 줄 */
@keyframes rk-focus { 0% { transform: translateY(calc(var(--tw) * -0.5)) scale(1.1); opacity: 0.3; } 100% { transform: none; opacity: 1; } }
.rk-dragging { opacity: 0.35; }
/* 내가 방금 뽑은 패 — 내 차례가 다시 올 때까지 초록 빛 + NEW */
.rk-drawn { box-shadow: 0 0 0 3px #5BE37A, 0 0 14px 4px rgba(91, 227, 122, 0.85); }
.rk-drawn::after {
  content: 'NEW';
  position: absolute;
  top: calc(var(--tw) * -0.2);
  left: 50%;
  transform: translateX(-50%);
  padding: 1px calc(var(--tw) * 0.1);
  border-radius: 999px;
  background: #2E9E4A;
  color: #FFF;
  font-size: max(9px, calc(var(--tw) * 0.22));
  font-weight: 900;
  letter-spacing: 0.02em;
  text-shadow: none;
  pointer-events: none;
}
.rk-fly { position: fixed; z-index: 60; margin: 0; pointer-events: none; transform-origin: center; }
.rk-chain { animation: rk-chain 0.22s ease-out; }
@keyframes rk-chain { 0% { transform: translateY(0) scale(1); } 60% { transform: translateY(calc(var(--tw) * -0.24)) scale(1.08); } 100% { transform: translateY(calc(var(--tw) * -0.16)); } }
.rk-ghost {
  --tw: 40px;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1000;
  display: flex;
  gap: 2px;
  pointer-events: none;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.45));
}
.rk-ghost .rk-tile { transform: rotate(-3deg); }

/* 안내 */
.rk-msgs { text-align: center; min-height: 2.4em; }
.rk-msg { font-size: 13px; font-weight: 700; }
.rk-hint { font-size: 11px; opacity: 0.7; }

/* 나무 랙 2줄 */
.rk-rack-wrap { display: flex; justify-content: center; min-width: 0; }
.rk-rack {
  --tw: 40px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 7px 0;
  border-radius: 10px 10px 6px 6px;
  background: linear-gradient(#EBC896, #D2A36A 60%, #B9864C);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.rk-rack-row { display: flex; gap: 3px; padding-bottom: 5px; border-bottom: 3px solid rgba(110, 66, 25, 0.45); }
.rk-rack-row:last-child { border-bottom: none; }
.rk-slot { width: var(--tw); height: calc(var(--tw) * 1.32); border-radius: calc(var(--tw) * 0.14); flex: none; }
.rk-slot:empty { background: rgba(90, 50, 15, 0.12); }
.rk-picking .rk-slot:empty { background: rgba(255, 255, 255, 0.22); }
.rk-slot.rk-over { background: rgba(255, 255, 255, 0.35); outline: 2px solid #FFD54F; }

/* 버튼 */
.rk-side { display: flex; gap: 8px; align-items: stretch; padding-bottom: env(safe-area-inset-bottom); }
.rk-sort, .rk-undo, .rk-end {
  border: none;
  border-radius: 14px;
  color: #FFF;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(#3E6FD6, #2550A8);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 3px 8px rgba(0, 0, 0, 0.35);
}
.rk-sort { width: 64px; height: 48px; font-size: 20px; letter-spacing: 0.02em; }
.rk-undo { padding: 0 6px; min-width: 52px; height: 48px; font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; line-height: 1.1; }
.rk-undo[hidden] { display: none; }
.rk-undo b { font-size: 20px; line-height: 1; }
.rk-back { background: linear-gradient(#F0A33E, #D07F14); }
.rk-end {
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 2px solid #E9A267;
}
.rk-end:disabled { opacity: 0.55; cursor: default; }
.rk-end-icon { font-size: 26px; color: #FF9A3D; line-height: 1; }
.rk-end.ready { background: linear-gradient(#43B35A, #2B8C40); border-color: #B7F5C2; }
.rk-end.ready .rk-end-icon { color: #FFF; }
.rk-end-label { font-size: 16px; }
.rk-pool { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; opacity: 0.9; }
/* 온라인 — 오른쪽 아래 💬 방 채팅 버튼 자리 비우기 */
.rk-online .rk-side { padding-right: 62px; }

/* 일시정지 — 머리줄 ⏸N(남은 기회) · 동의 묻기 띠 · 멈춤 화면 */
.rk-pause-btn {
  display: inline-flex; align-items: center; gap: 3px;
  border: 1.5px solid rgba(255, 255, 255, 0.5); border-radius: 999px;
  background: rgba(255, 255, 255, 0.12); color: #FFF;
  font: inherit; font-size: 14px; font-weight: 800; padding: 3px 10px; cursor: pointer;
}
.rk-pause-btn[hidden] { display: none; }
.rk-pause-btn b { font-size: 12px; opacity: 0.85; }
.rk-pause-btn:disabled { opacity: 0.4; cursor: default; }
.rk-pause-ask {
  position: absolute; top: 52px; left: 50%; transform: translateX(-50%); z-index: 40;
  width: min(360px, calc(100% - 24px)); box-sizing: border-box;
  padding: 12px 14px; border-radius: 16px;
  background: #FFF8E1; color: #3A2C00; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
  font-weight: 700; font-size: 15px; text-align: center;
  animation: rk-ask-in 0.25s ease-out;
}
.rk-pause-ask[hidden] { display: none; }
@keyframes rk-ask-in { from { transform: translate(-50%, -12px); opacity: 0; } }
.rk-pause-ask-btns { display: flex; gap: 8px; margin-top: 10px; }
.rk-pause-ask-btns button { flex: 1; height: 42px; border: none; border-radius: 12px; font: inherit; font-weight: 800; cursor: pointer; }
#rk-pause-no { background: #E0E0E0; color: #333; }
#rk-pause-yes { background: #2B8C40; color: #FFF; }
.rk-paused {
  position: absolute; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  background: rgba(8, 22, 60, 0.72); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
}
.rk-paused[hidden] { display: none; }
.rk-paused-box { text-align: center; padding: 20px; max-width: 340px; }
.rk-paused-icon { font-size: 56px; line-height: 1; }
.rk-paused-title { font-size: 24px; font-weight: 900; margin: 6px 0 4px; }
.rk-paused-text { font-size: 15px; opacity: 0.9; }
.rk-resume {
  margin-top: 16px; height: 50px; padding: 0 28px; border: none; border-radius: 14px;
  background: linear-gradient(#43B35A, #2B8C40); color: #FFF; font: inherit; font-size: 18px; font-weight: 900; cursor: pointer;
}
.rk-resume:disabled { opacity: 0.45; cursor: default; }
.rk-paused-note { margin-top: 10px; font-size: 12px; opacity: 0.75; }

/* 대전 설정 */
.rk-setup-body { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 6px; min-width: min(320px, 80vw); }
.rk-setup-note { font-size: 12px; color: var(--on-surface-variant); }

/* 세로 화면 — 4명이 한 줄에 들어가게 자리를 세로로 작게 */
@media not (min-aspect-ratio: 5/4) {
  .rk-players { flex-wrap: nowrap; gap: 4px; }
  .rk-seat { flex-direction: column; gap: 7px; padding: 8px 4px 4px; border-radius: 14px; min-width: 0; flex: 0 1 84px; }
  .rk-seat-info { align-items: center; }
  .rk-seat-name { max-width: 76px; font-size: 12px; }
  .rk-cnt { font-size: 12px; }
}
/* 넓은 PC에서 🏆 리더보드가 오른쪽에 떠 있을 때(💬 오른쪽 칸이 없을 때) — 그만큼 비켜 줌 */
@media (min-width: 1280px) {
  body:not(.ylc-docked) #rummikub-view { margin-right: 302px; }
}
/* 가로 화면 */
@media (min-aspect-ratio: 5/4) {
  .rk-header { padding: 2px 8px; }
  .rk-board {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: minmax(0, 1fr) auto auto;
    grid-template-areas: "players table side" "players msgs side" "players rack side";
    gap: 4px 12px;
  }
  .rk-players { flex-direction: column; flex-wrap: nowrap; justify-content: flex-start; align-items: stretch; }
  .rk-seat { border-radius: 16px; }
  .rk-seat.me { margin-top: auto; }
  .rk-ava { width: 46px; height: 46px; font-size: 19px; }
  .rk-msgs { min-height: 2em; }
  .rk-side { flex-direction: column; width: 88px; }
  .rk-sort { width: 100%; height: 52px; }
  .rk-sort:first-child { margin-top: auto; }   /* 789·777 은 뽑기 버튼 바로 위로 */
  .rk-undo { height: 46px; flex-direction: row; gap: 6px; font-size: 13px; }
  .rk-end { flex: 1; flex-direction: column; height: auto; min-height: 110px; max-height: 200px; gap: 6px; }
  .rk-end-icon { font-size: 40px; }
  .rk-online .rk-side { padding-right: 0; padding-bottom: 66px; }
}
/* 폰 가로(낮은 화면) — 한 줄 도움말은 빼고, 머리줄은 양옆 칸 위로 띄워(제목 숨김) 바닥이 맨 위부터 */
@media (min-aspect-ratio: 5/4) and (max-height: 520px) {
  .rk-hint { display: none; }
  .rk-msgs { min-height: 0; }
  .rk-header { position: absolute; top: 0; left: 0; right: 0; z-index: 5; pointer-events: none; }
  .rk-header > * { pointer-events: auto; }
  .rk-header h2 { display: none; }
  .rk-board { padding-top: 6px; }
  .rk-players, .rk-side { margin-top: 42px; }
  .rk-header .rk-pause-btn { position: absolute; left: 10px; top: 48px; }   /* ⏸ 는 ⚙ 아래 — 바닥에 안 걸치게 */
  .rk-view:has(.rk-pause-btn:not([hidden])) .rk-players { margin-top: 80px; }
}

/* ── 다이얼로그 ───────────────────────────── */

dialog {
  margin: auto; /* 맨 위 * { margin: 0 } 이 모달 가운데 정렬을 지우지 않게 */
  border: none;
  border-radius: 20px;
  padding: 24px;
  min-width: 280px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
dialog h3 { font-size: 20px; margin-bottom: 12px; }
dialog p { color: var(--on-surface-variant); margin-bottom: 20px; }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.dialog-actions .cheer-btn { margin-right: auto; }          /* 이긴 창 — 빵파레 다시 (왼쪽) */
.cheer-btn[hidden] { display: none; }
/* 👀 판 보기 — 결과 창을 잠깐 내리고 끝난 판 보기(shared/peek.ts) → 아래 📋 결과 보기 알약으로 다시 */
.peek-btn { position: absolute; top: 12px; right: 12px; height: 32px; padding: 0 12px; border: 1.5px solid rgba(127, 127, 127, 0.35); border-radius: 16px; background: none; color: var(--on-surface-variant); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.peek-btn:hover { color: var(--on-surface); border-color: var(--primary); }
dialog.has-peek > h3 { padding-right: 96px; }
dialog.solo-result.has-peek > h3 { padding: 30px 0 0; } /* 가운데 제목 — 버튼은 위로 비켜 */
.peek-pill { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 70; height: 46px; padding: 0 22px; border: none; border-radius: 23px; background: var(--primary); color: #fff; font: inherit; font-size: 16px; font-weight: 800; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3); cursor: pointer; white-space: nowrap; }
.peek-pill[hidden] { display: none; }
.peek-pill.ping { animation: peek-ping 1s ease-in-out infinite; }
@keyframes peek-ping { 50% { transform: translateX(-50%) scale(1.08); box-shadow: 0 0 0 6px rgba(255, 193, 7, 0.55); } }
.text-btn {
  border: none;
  background: none;
  color: var(--primary);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.text-btn:active { background: var(--primary-container); }

/* ── 로비 ─────────────────────────────────── */

.lobby { display: flex; flex-direction: column; padding-top: 4px; }
@media (min-width: 900px) { #home-view, #profile-view, #family-view { max-width: 1080px; } }
/* 💬 로비 채팅은 공통 오른쪽 고정 칸(shared-web/lobby-chat.ts dock, 1200px 이상) — 폰·좁은 화면은 상단 바 💬 알약 → 펼침 창 (퀴즈·한자와 같게) */

/* 로비 접속자 — 이름 + @아이디 알약 */
.lobby-users { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.lobby-users[hidden] { display: none; }
.lobby-user { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; font-weight: 700; max-width: 100%; }
.lobby-user.me { border-color: var(--primary); background: var(--primary-container); }
.lobby-user-dot { width: 7px; height: 7px; border-radius: 50%; background: #2E7D32; flex: 0 0 auto; }
.lobby-user-id { font-weight: 500; font-size: 11px; color: var(--on-surface-variant); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 게임 대분류 묶음 (로비·대기방) — 분류 제목(+설명·개수) + 그 분류의 카드 그리드 */
.game-cats { display: flex; flex-direction: column; gap: 6px; }
.game-cat-title { font-size: 14px; font-weight: 700; color: var(--on-surface-variant); margin: 6px 0 2px; }
.game-cats > .game-cat-title:first-child { margin-top: 0; }
.game-cat-head { display: flex; align-items: baseline; gap: 8px; margin: 10px 0 2px; }
.game-cats > .game-cat-head:first-child { margin-top: 0; }
.game-cat-head .game-cat-title { margin: 0; color: var(--on-surface); font-size: 15px; }
.game-cat-desc { flex: 1; min-width: 0; font-size: 12px; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-cat-count { font-size: 12px; font-weight: 700; color: var(--on-surface-variant); }
/* NEW / 🔒 비공개 (관리자 시험 플레이) 꼬리표 — 카드 왼쪽 위 */
.game-ribbon { position: absolute; top: 0; left: 0; padding: 2px 8px; border-radius: 12px 0 10px 0; background: #E53935; color: #fff; font-size: 11px; font-weight: 800; letter-spacing: 0.5px; }
.game-ribbon.locked { background: var(--on-surface-variant); letter-spacing: 0; padding: 2px 7px; }
/* 혼자 게임 카드 — 넓은 카드: 이모지 · 이름 / 👑 1등 / 참가자·내 최고 · 플레이 → */
.solo-view { display: flex; flex-direction: column; min-height: 100dvh; }
.solo-view .game-header h2 { flex: 1; }
.solo-best { font-size: 14px; font-weight: 700; color: var(--on-surface-variant); padding-right: 8px; }
.solo-hud { display: flex; justify-content: center; gap: 10px; padding: 0 12px 8px; flex-wrap: wrap; }
.solo-hud:empty { display: none; }
.solo-body { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 0 12px 16px; }
/* ── 2048 ── */
.g2048-chip { position: relative; display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.g2048-chip b { font-size: 18px; color: var(--on-surface); }
.g2048-gain { position: absolute; right: 6px; top: -4px; font-style: normal; font-weight: 800; font-size: 13px; color: #E07B00; opacity: 0; pointer-events: none; }
.g2048-gain.show { animation: g2048-gain 0.7s ease-out; }
@keyframes g2048-gain { 0% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-18px); } }
.g2048-board { --gap: 10px; position: relative; width: min(92vw, 440px, calc(100dvh - 260px)); min-width: 260px; aspect-ratio: 1; border-radius: 14px; background: #BBADA0; touch-action: none; user-select: none; -webkit-user-select: none; }
.g2048-cells { position: absolute; inset: 0; padding: var(--gap); display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr); gap: var(--gap); }
.g2048-cells > div { border-radius: 8px; background: rgba(238, 228, 218, 0.35); }
.g2048-tiles { position: absolute; inset: 0; }
.g2048-tile { --size: calc((100% - 5 * var(--gap)) / 4); position: absolute; left: var(--gap); top: var(--gap); width: var(--size); height: var(--size); border-radius: 8px; display: grid; place-items: center; font-weight: 900; font-size: clamp(20px, 8vw, 40px); color: #776E65; background: #EEE4DA;
  transform: translate(calc(var(--c) * (100% + var(--gap))), calc(var(--r) * (100% + var(--gap)))); transition: transform 110ms ease-in-out; }
.g2048-tile.big { font-size: clamp(16px, 6.2vw, 32px); }
.g2048-tile.v4 { background: #EDE0C8; }
.g2048-tile.v8 { background: #F2B179; color: #fff; }
.g2048-tile.v16 { background: #F59563; color: #fff; }
.g2048-tile.v32 { background: #F67C5F; color: #fff; }
.g2048-tile.v64 { background: #F65E3B; color: #fff; }
.g2048-tile.v128 { background: #EDCF72; color: #fff; box-shadow: 0 0 12px rgba(237, 207, 114, 0.4); }
.g2048-tile.v256 { background: #EDCC61; color: #fff; box-shadow: 0 0 14px rgba(237, 204, 97, 0.5); }
.g2048-tile.v512 { background: #EDC850; color: #fff; box-shadow: 0 0 16px rgba(237, 200, 80, 0.55); }
.g2048-tile.v1024 { background: #EDC53F; color: #fff; box-shadow: 0 0 18px rgba(237, 197, 63, 0.6); }
.g2048-tile.v2048 { background: #EDC22E; color: #fff; box-shadow: 0 0 22px rgba(237, 194, 46, 0.7); }
.g2048-tile.v4096, .g2048-tile.v8192 { background: #3C3A32; color: #fff; }
.g2048-tile.appear { animation: g2048-appear 160ms ease-out; }
.g2048-tile.pop { animation: g2048-pop 160ms ease-out; z-index: 1; }
@keyframes g2048-appear { from { opacity: 0; scale: 0.4; } to { opacity: 1; scale: 1; } }
@keyframes g2048-pop { 0% { scale: 1; } 50% { scale: 1.18; } 100% { scale: 1; } }
.g2048-toast { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 2; width: 80%; padding: 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.75); color: #fff; font-weight: 800; text-align: center; }
.g2048-actions { display: flex; gap: 8px; margin-top: 12px; }
.g2048-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; }
@media (prefers-reduced-motion: reduce) { .g2048-tile { transition: none; } .g2048-tile.appear, .g2048-tile.pop { animation: none; } }

/* ── 같은 색 지우기 ── */
.sg-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.sg-chip b { font-size: 18px; color: var(--on-surface); }
.sg-pick { min-height: 22px; margin-bottom: 6px; font-size: 14px; font-weight: 700; color: var(--primary); text-align: center; }
.sg-board { position: relative; width: min(94vw, 460px, calc((100dvh - 270px) * var(--cols) / var(--rows))); min-width: 240px; aspect-ratio: var(--cols) / var(--rows); border-radius: 12px; background: var(--surface-variant); overflow: hidden; touch-action: manipulation; user-select: none; -webkit-user-select: none; cursor: pointer; }
.sg-tile { position: absolute; left: 0; top: 0; width: calc(100% / var(--cols)); height: calc(100% / var(--rows)); border: 2px solid transparent; background-clip: padding-box; border-radius: 9px;
  display: grid; place-items: center; color: rgba(255, 255, 255, 0.55); font-size: clamp(10px, 3vw, 16px); line-height: 1;
  transform: translate(calc(var(--c) * 100%), calc(var(--r) * 100%)); transition: transform 230ms ease-in, opacity 170ms, scale 170ms, filter 120ms; }
.sg-tile::after { content: attr(data-shape); }
.sg-tile.c0 { background-color: #E5484D; }
.sg-tile.c1 { background-color: #3E7BEA; }
.sg-tile.c2 { background-color: #F2B416; }
.sg-tile.c3 { background-color: #30A46C; }
.sg-board.picking .sg-tile:not(.sel) { filter: brightness(0.62) saturate(0.7); }
.sg-tile.sel { z-index: 1; box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.9); color: #fff; }
.sg-tile.gone { opacity: 0; scale: 0.2; }
.sg-tile.nope { animation: sg-nope 0.28s; }
@keyframes sg-nope { 25% { translate: -3px 0; } 75% { translate: 3px 0; } }
.sg-actions { display: flex; gap: 8px; margin-top: 12px; }
.sg-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 460px; }
@media (prefers-reduced-motion: reduce) { .sg-tile { transition: none; } .sg-tile.nope { animation: none; } }

/* ── 슬라이드 퍼즐 ── */
.sl-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.sl-chip b { font-size: 17px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.sl-board { --gap: 8px; position: relative; width: min(92vw, 420px, calc(100dvh - 270px)); min-width: 240px; aspect-ratio: 1; border-radius: 16px; background: var(--surface-variant); padding: var(--gap); touch-action: none; user-select: none; -webkit-user-select: none; }
.sl-tile { --size: calc((100% - (var(--n) + 1) * var(--gap)) / var(--n)); position: absolute; left: var(--gap); top: var(--gap); width: var(--size); height: var(--size); border: none; border-radius: 12px; background: var(--card); color: var(--on-surface); font: inherit; font-weight: 900; font-size: clamp(20px, 8vw, 36px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.12); cursor: pointer;
  transform: translate(calc(var(--c) * (100% + var(--gap))), calc(var(--r) * (100% + var(--gap)))); transition: transform 100ms ease-out, background 0.2s, color 0.2s; }
.sl-tile.ok { background: var(--primary-container); color: var(--on-primary-container); }
.sl-board.instant .sl-tile { transition: none; }
.sl-board.done .sl-tile { background: #30A46C; color: #fff; animation: sl-done 0.4s ease-out; }
@keyframes sl-done { 50% { scale: 1.06; } }
.sl-paused { position: absolute; inset: auto 12px 12px; z-index: 2; padding: 8px; border-radius: 10px; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 13px; font-weight: 700; text-align: center; pointer-events: none; }
.sl-actions { display: flex; gap: 8px; margin-top: 12px; }
.sl-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 440px; }
@media (prefers-reduced-motion: reduce) { .sl-tile { transition: none; } .sl-board.done .sl-tile { animation: none; } }

/* ── 지뢰찾기 ── */
.mn-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.mn-chip b { font-size: 17px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.mn-mode { padding: 6px 14px; border-radius: 12px; border: 2px solid var(--surface-variant); background: var(--card); color: var(--on-surface); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.mn-mode.on { border-color: #E5484D; background: #FDECEC; color: #B42318; }
.mn-board { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 3px; width: min(94vw, 440px, calc((100dvh - 250px) * var(--cols) / var(--rows))); min-width: 240px; padding: 6px; border-radius: 12px; background: var(--surface-variant); user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.mn-cell { aspect-ratio: 1; border: none; border-radius: 6px; padding: 0; background: #8FA3C2; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.18); color: #fff; font: inherit; font-weight: 900; font-size: clamp(13px, 4.6vw, 22px); line-height: 1; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.mn-board.flagging .mn-cell:not(.open) { background: #B6A3C9; }
.mn-cell:active:not(.open) { filter: brightness(1.1); }
.mn-cell.open { background: var(--card); box-shadow: none; cursor: default; }
.mn-cell.flag { font-size: clamp(12px, 4vw, 19px); }
.mn-cell.n1 { color: #2563EB; } .mn-cell.n2 { color: #16A34A; } .mn-cell.n3 { color: #DC2626; } .mn-cell.n4 { color: #7C3AED; }
.mn-cell.n5 { color: #B45309; } .mn-cell.n6 { color: #0891B2; } .mn-cell.n7 { color: #111827; } .mn-cell.n8 { color: #6B7280; }
.mn-cell.mine { font-size: clamp(12px, 4vw, 19px); }
.mn-cell.boom { background: #E5484D; font-size: clamp(12px, 4vw, 19px); }
.mn-cell.wrong { background: #F4C7C7; font-size: clamp(11px, 3.6vw, 17px); }
.mn-board.won .mn-cell.flag { background: #30A46C; }
.mn-board.lost { animation: mn-shake 0.35s; }
@keyframes mn-shake { 20% { translate: -5px 0; } 40% { translate: 5px 0; } 60% { translate: -3px 0; } 80% { translate: 3px 0; } }
.mn-actions { display: flex; gap: 8px; margin-top: 12px; }
.mn-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 440px; }
@media (prefers-reduced-motion: reduce) { .mn-board.lost { animation: none; } }

/* ── 물병 색 정렬 ── */
.ws-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.ws-chip b { font-size: 18px; color: var(--on-surface); }
.ws-msg { min-height: 22px; margin: 2px 0 8px; font-size: 14px; font-weight: 700; color: var(--primary); text-align: center; }
.ws-tubes { display: grid; grid-template-columns: repeat(var(--per-row, 5), 1fr); gap: 26px 10px; width: min(94vw, 460px); padding: 20px 8px 4px; justify-items: center; }
.ws-tube { width: min(15vw, 62px); height: calc(min(15vw, 62px) * 3.3); padding: 6px 5px 5px; border: 3px solid var(--on-surface-variant); border-top-width: 2px; border-radius: 6px 6px 26px 26px; background: rgba(255, 255, 255, 0.35); display: flex; flex-direction: column-reverse; gap: 3px; cursor: pointer; transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s; -webkit-tap-highlight-color: transparent; }
:root[data-theme=dark] .ws-tube { background: rgba(255, 255, 255, 0.06); }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .ws-tube { background: rgba(255, 255, 255, 0.06); } }
.ws-tube.sel { transform: translateY(-16px); border-color: var(--primary); box-shadow: 0 8px 14px rgba(0, 0, 0, 0.18); }
.ws-tube.target { border-color: #30A46C; }
.ws-tube.done { border-color: #30A46C; box-shadow: 0 0 0 3px rgba(48, 164, 108, 0.25); }
.ws-tube.poured .ws-seg:not(.empty) { animation: ws-fill 0.25s ease-out; }
@keyframes ws-fill { from { filter: brightness(1.35); } }
.ws-tube.nope { animation: ws-nope 0.28s; }
@keyframes ws-nope { 25% { translate: -4px 0; } 75% { translate: 4px 0; } }
.ws-seg { flex: 1; border-radius: 4px; display: grid; place-items: center; color: rgba(255, 255, 255, 0.6); font-size: clamp(10px, 3vw, 15px); line-height: 1; }
.ws-seg:first-child { border-radius: 4px 4px 20px 20px; }
.ws-seg.empty { background: transparent; }
.ws-seg.c0 { background: #E5484D; } .ws-seg.c1 { background: #3E7BEA; } .ws-seg.c2 { background: #F2B416; } .ws-seg.c3 { background: #30A46C; }
.ws-seg.c4 { background: #8E4EC6; } .ws-seg.c5 { background: #F76B15; } .ws-seg.c6 { background: #12A5B8; }
.ws-tubes.won .ws-tube { animation: ws-won 0.6s ease-out; }
@keyframes ws-won { 40% { transform: translateY(-10px); } }
.ws-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin-top: 16px; }
.ws-actions .text-btn:disabled { opacity: 0.4; }
.ws-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 460px; }
@media (prefers-reduced-motion: reduce) { .ws-tube { transition: none; } .ws-tube.nope, .ws-tubes.won .ws-tube, .ws-tube.poured .ws-seg { animation: none; } }

/* ── 선 잇기 ── */
.fl-chip { display: inline-flex; gap: 5px; align-items: baseline; padding: 6px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.fl-chip b { font-size: 17px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.fl-board { display: block; width: min(94vw, 440px, calc(100dvh - 260px)); min-width: 240px; aspect-ratio: 1; border-radius: 14px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.fl-board.won { animation: fl-won 0.5s ease-out; }
@keyframes fl-won { 40% { scale: 1.03; } }
.fl-actions { display: flex; gap: 8px; margin-top: 12px; }
.fl-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 440px; }
@media (prefers-reduced-motion: reduce) { .fl-board.won { animation: none; } }

/* ── 울타리 잇기 ── */
.fc-chip { display: inline-flex; gap: 5px; align-items: baseline; padding: 6px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.fc-chip b { font-size: 17px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.fc-sizes { display: flex; flex-basis: 100%; justify-content: center; gap: 6px; }
.fc-sizes button { display: inline-flex; flex-direction: column; align-items: center; min-width: 76px; padding: 5px 12px; border-radius: 12px; border: 2px solid var(--surface-variant); background: var(--card); color: var(--on-surface); font: inherit; font-size: 15px; font-weight: 800; line-height: 1.2; cursor: pointer; }
.fc-sizes button small { font-size: 11px; font-weight: 600; color: var(--on-surface-variant); }
.fc-sizes button.on { border-color: var(--primary); background: var(--primary-container); color: var(--on-primary-container); }
.fc-sizes button.on small { color: inherit; }
.fc-board { display: block; width: min(96vw, 480px, calc(100dvh - 330px)); min-width: 260px; aspect-ratio: 1; border-radius: 14px; background: var(--card); border: 1px solid var(--surface-variant); box-sizing: border-box; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.fc-board.won { animation: fl-won 0.5s ease-out; }
.fc-msg { min-height: 20px; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--on-surface-variant); text-align: center; }
.fc-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; margin-top: 4px; }
.fc-actions .text-btn:disabled { opacity: 0.4; }
.fc-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 480px; }
@media (prefers-reduced-motion: reduce) { .fc-board.won { animation: none; } }

/* ── 비밀 코드(혼자) · 코드 대결 ─────────────────────────── */
/* 판은 테마와 상관없이 짙은 회색 판(구멍 + 색 말). 말마다 모양 표시(색약 배려) — secret/pegs.ts */
.cb-board {
  --peg: 32px;
  display: flex; flex-direction: column; gap: 3px;
  width: max-content; max-width: 100%;
  padding: 8px 10px; border-radius: 16px; box-sizing: border-box;
  background: linear-gradient(180deg, #4A5563, #3A4350);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 2px 6px rgba(0,0,0,0.25);
}
.cb-row { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 10px; }
.cb-row.done { cursor: pointer; }
.cb-row.done:active { background: rgba(255,255,255,0.08); }
.cb-row.cur { background: rgba(255,255,255,0.13); box-shadow: inset 0 0 0 2px rgba(255,255,255,0.35); }
.cb-row.future { padding-top: 0; padding-bottom: 0; opacity: 0.45; }
.cb-row.future .cb-peg { width: calc(var(--peg) * 0.42); height: calc(var(--peg) * 0.42); margin: 0 calc(var(--peg) * 0.29); transform: none; }
.cb-row.future .cb-fb { visibility: hidden; height: 6px; }
.cb-row.future .cb-num { font-size: 10px; }
.cb-row.sent { opacity: 0.75; cursor: default; }
.cb-row.mine { cursor: default; }
.cb-row.small { --peg: 22px; gap: 6px; padding: 1px 6px; cursor: default; }
.cb-answer { margin-bottom: 4px; padding-bottom: 7px; border-bottom: 2px solid rgba(255,255,255,0.18); border-radius: 10px 10px 4px 4px; }
.cb-answer.open { background: rgba(255,214,0,0.16); }
.cb-num { width: 22px; flex: none; text-align: center; font-size: 13px; font-weight: 800; color: rgba(255,255,255,0.7); font-variant-numeric: tabular-nums; }
.cb-note { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.75); white-space: nowrap; }
.cb-pegs { display: flex; gap: 5px; }
.cb-peg {
  position: relative; flex: none; display: grid; place-items: center;
  width: var(--peg); height: var(--peg); border-radius: 50%; box-sizing: border-box;
  background: radial-gradient(circle at 34% 28%, rgba(255,255,255,0.75) 0, rgba(255,255,255,0) 38%), var(--c);
  box-shadow: inset 0 -3px 0 rgba(0,0,0,0.22), 0 2px 3px rgba(0,0,0,0.35);
}
.cb-peg i { font-style: normal; font-size: calc(var(--peg) * 0.4); line-height: 1; color: rgba(255,255,255,0.88); text-shadow: 0 1px 1px rgba(0,0,0,0.25); pointer-events: none; }
.cb-peg.c0 { --c: #E53935; } .cb-peg.c1 { --c: #1E88E5; } .cb-peg.c2 { --c: #FDD835; } .cb-peg.c3 { --c: #43A047; }
.cb-peg.c4 { --c: #F5F5F5; } .cb-peg.c5 { --c: #263238; } .cb-peg.c6 { --c: #8E24AA; } .cb-peg.c7 { --c: #FB8C00; }
.cb-peg.c2 i, .cb-peg.c4 i { color: rgba(0,0,0,0.55); text-shadow: none; }
.cb-peg.hole { background: #252C35; box-shadow: inset 0 3px 4px rgba(0,0,0,0.55), 0 1px 0 rgba(255,255,255,0.12); transform: scale(0.62); }
.cb-peg.hole.secret { transform: none; background: #2B323C; }
.cb-peg.hole.secret::after { content: '?'; font-size: calc(var(--peg) * 0.5); font-weight: 900; color: rgba(255,255,255,0.35); }
.cb-peg.slot { cursor: pointer; }
.cb-peg.hole.slot { transform: scale(0.8); }
.cb-peg.focus { outline: 3px solid #FFD54F; outline-offset: 1px; }
/* 결과 점 — 빨강 색·자리 맞음, 하양 색만 맞음 (2×2, 5칸은 3+2) */
.cb-fb { display: grid; grid-template-columns: repeat(2, 11px); gap: 3px; flex: none; }
.cb-fb.n5 { grid-template-columns: repeat(3, 10px); }
.cb-fb i { width: 11px; height: 11px; border-radius: 50%; background: #252C35; box-shadow: inset 0 1px 2px rgba(0,0,0,0.6); }
.cb-fb.n5 i { width: 10px; height: 10px; }
.cb-fb i.ex { background: #E53935; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }
.cb-fb i.nr { background: #FFFFFF; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }
/* 방금 공개된 줄만 톡 튀어나옴 (다시 그릴 때마다 튀지 않게) */
.pop .cb-fb i.ex, .pop .cb-fb i.nr { animation: cb-pop 0.3s ease-out backwards; }
.pop .cb-fb i:nth-child(2) { animation-delay: 0.06s; } .pop .cb-fb i:nth-child(3) { animation-delay: 0.12s; }
.pop .cb-fb i:nth-child(4) { animation-delay: 0.18s; } .pop .cb-fb i:nth-child(5) { animation-delay: 0.24s; }
.cb-fb.wait i { animation: cb-wait 0.8s ease-in-out infinite alternate; }
@keyframes cb-pop { from { transform: scale(0.2); } to { transform: none; } }
@keyframes cb-wait { from { opacity: 0.35; } to { opacity: 1; } }
.cb-dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; box-shadow: 0 0 0 1px rgba(0,0,0,0.35); }
.cb-dot.ex { background: #E53935; }
.cb-dot.nr { background: #FFFFFF; }
/* 색 고르기 */
.cb-input { display: flex; justify-content: center; margin-top: 10px; }
.cb-input:empty { display: none; }
.cb-palette { --peg: 36px; display: grid; grid-template-columns: repeat(var(--cols, 6), auto); justify-content: center; gap: 6px; padding: 6px; border-radius: 14px; background: var(--card); border: 1px solid var(--surface-variant); }
/* 8색은 좁은 화면에서 4+4 */
.cb-palette.n8 { --cols: 4; }
@media (min-width: 520px) { .cb-palette.n8 { --cols: 8; } }
.cb-palette.memo { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-container); }
.cb-pick { position: relative; padding: 3px; border: none; border-radius: 50%; background: none; cursor: pointer; }
.cb-pick:active { transform: scale(0.92); }
.cb-pick.used { opacity: 0.3; }
.cb-pick.crossed .cb-peg { opacity: 0.4; }
.cb-pick.crossed::after { content: '✕'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 26px; font-weight: 900; color: #E53935; text-shadow: 0 0 2px #fff, 0 0 2px #fff; pointer-events: none; }
.cb-msg { min-height: 20px; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--on-surface-variant); text-align: center; }
.cb-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 8px; margin-top: 6px; }
.cb-actions .text-btn:disabled { opacity: 0.4; cursor: default; }
.cb-actions .text-btn[hidden] { display: none; }
.cb-actions .text-btn.on { background: var(--primary-container); }
.cb-ok.ready { background: var(--primary); color: #fff; padding: 8px 20px; }
.cb-ok.ready:active { background: var(--primary); opacity: 0.85; }
.cb-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 440px; line-height: 1.6; }
.cb-levels button { min-width: 90px; }
.cb-side { display: flex; flex-direction: column; align-items: center; }
@media (max-width: 380px) { .cb-board { --peg: 28px; } .cb-palette { --peg: 32px; } }
@media (prefers-reduced-motion: reduce) { .pop .cb-fb i.ex, .pop .cb-fb i.nr, .cb-fb.wait i { animation: none; } }

/* 코드 대결 */
.cd-view { display: flex; flex-direction: column; min-height: 100dvh; }
.cd-seats { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 12px 0; }
.cd-seat {
  flex: 1 1 calc(50% - 6px); min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px;
  padding: 6px 10px; border-radius: 12px; border: 2px solid transparent; background: var(--surface-variant); box-sizing: border-box;
}
.cd-seat.me { border-color: var(--primary); }
.cd-seat.busy .cd-st { color: var(--primary); }
.cd-seat.win { background: rgba(255,214,0,0.28); }
.cd-seat .cb-fb { margin-left: auto; }
.cd-name { font-weight: 800; font-size: 14px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cd-st { font-size: 12px; font-weight: 700; color: var(--on-surface-variant); white-space: nowrap; }
.cd-target { flex-basis: 100%; font-size: 11px; color: var(--on-surface-variant); }
.cd-seat .cb-fb i { background: rgba(0,0,0,0.18); box-shadow: none; }
.cd-seat .cb-fb i.ex { background: #E53935; }
.cd-seat .cb-fb i.nr { background: #FFFFFF; box-shadow: 0 0 0 1px rgba(0,0,0,0.3); }
.cd-main { display: flex; flex-direction: column; align-items: center; padding: 8px 12px 16px; }
.cd-side { display: flex; flex-direction: column; align-items: center; width: 100%; }
.cd-tip { margin: 4px 6px; font-size: 12px; color: rgba(255,255,255,0.75); text-align: center; }
.cd-mine { margin-top: 12px; padding: 8px 10px; border-radius: 14px; background: #3A4350; }
.cd-mine[hidden] { display: none; }
.cd-mine-h { font-size: 12px; font-weight: 800; color: rgba(255,255,255,0.85); padding: 0 6px 4px; }
.cd-mine .cb-row.mine { --peg: 24px; gap: 6px; }
.cb-row.mine .cb-fb { visibility: hidden; }

/* ── 🔔 딱 다섯 ── 카드는 2:2.9 세로, --cw = 카드 폭 */
.bl-view { display: flex; flex-direction: column; min-height: 100dvh; }
.bl-bar { display: flex; align-items: center; gap: 8px; padding: 0 12px; }
.bl-bar .wg-turn { flex: 1; margin: 6px 0 0; }
.bl-clock { margin-top: 6px; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--on-surface-variant); white-space: nowrap; }
.bl-clock:empty { display: none; }
.bl-clock.low { color: #E53935; }
.bl-others { --cw: min(27vw, 104px); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 6px 12px 0; }
.bl-others[data-n="1"] { --cw: min(30vw, 112px); grid-template-columns: minmax(0, 240px); justify-content: center; }
.bl-others[data-n="3"], .bl-others[data-n="5"] { --cw: min(16vw, 72px); grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bl-others[data-n="4"] { --cw: min(22vw, 86px); }
.bl-seat { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 6px 8px 8px; border-radius: 14px; border: 2px solid transparent; background: var(--surface-variant); box-sizing: border-box; transition: border-color .2s, background .2s; }
.bl-seat.turn { border-color: var(--primary); }
.bl-seat.out { opacity: 0.45; }
.bl-seat.win, .bl-seat.champ { background: rgba(255, 214, 0, 0.32); }
.bl-seat.win { animation: bl-win .5s ease-out; }
.bl-seat.wrong { background: rgba(229, 57, 53, 0.22); animation: bl-shake .4s; }
.bl-seat.late { background: rgba(127, 127, 127, 0.25); }
@keyframes bl-win { 0% { transform: scale(1); } 40% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes bl-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.bl-head { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.bl-name { flex: 1; min-width: 0; font-weight: 800; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-count { font-size: 12px; font-weight: 700; color: var(--on-surface-variant); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bl-row { display: flex; align-items: flex-end; justify-content: center; gap: 6px; }
/* 엎은 더미 — 무늬 있는 카드 뒷면 */
.bl-deck {
  width: calc(var(--cw) * 0.45); aspect-ratio: 2 / 2.9; flex: none; display: grid; place-items: center; padding: 0; border: 2px solid #fff; border-radius: 8px;
  background: repeating-linear-gradient(45deg, #5C6BC0 0 5px, #3F51B5 5px 10px); box-shadow: 2px 2px 0 #283593, 3px 3px 4px rgba(0,0,0,0.25);
  color: #fff; font: inherit; font-weight: 900; font-size: calc(var(--cw) * 0.16);
}
.bl-deck span { padding: 1px 5px; border-radius: 8px; background: rgba(0,0,0,0.35); }
.bl-deck.none { background: none; border: 2px dashed rgba(127,127,127,0.5); box-shadow: none; color: var(--on-surface-variant); }
.bl-deck.none span { background: none; }
button.bl-deck { cursor: pointer; }
button.bl-deck:disabled { cursor: default; }
.bl-deck.go { animation: bl-go 1s ease-in-out infinite; }
@keyframes bl-go { 50% { transform: translateY(-4px); box-shadow: 2px 2px 0 #283593, 0 0 0 4px rgba(255, 193, 7, 0.75); } }
/* 펼친 카드 — 과일은 주사위 눈처럼 3×3 자리 */
.bl-card {
  width: var(--cw); aspect-ratio: 2 / 2.9; flex: none; box-sizing: border-box; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); place-items: center;
  padding: 8% 6%; border-radius: 10px; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.bl-card.stacked { box-shadow: 0 1px 3px rgba(0,0,0,0.3), 3px 3px 0 -1px #fff, 3px 3px 0 0 rgba(0,0,0,0.18); }
.bl-card.empty { background: none; border: 2px dashed rgba(127,127,127,0.45); box-shadow: none; }
.bl-card.fresh { animation: bl-flip .28s ease-out; }
/* 내가 방금 뒤집은 카드 — 남 쪽으로 넘어가는 중이라 나는 뒷면만 봄(관리자 설정 시간, 기본 0.3초 — 길이는 화면이 style 로 맞춤) */
.bl-card.back { border: 2px solid #fff; background: repeating-linear-gradient(45deg, #5C6BC0 0 5px, #3F51B5 5px 10px); box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.bl-card.turning { animation: bl-away .3s ease-in forwards; transform-origin: 50% 0; }
@keyframes bl-away { from { transform: perspective(400px) rotateX(0); } to { transform: perspective(400px) rotateX(-70deg); opacity: 0.7; } }
@keyframes bl-flip { from { transform: rotateY(90deg) scale(0.9); } to { transform: none; } }
.bl-pip { font-size: calc(var(--cw) * 0.24); line-height: 1; }
.bl-center { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 12px 4px; }
.bl-bell {
  width: 92px; height: 92px; border-radius: 50%; border: none; padding: 0; cursor: pointer; font-size: 46px; line-height: 1;
  background: radial-gradient(circle at 35% 30%, #FFF59D, #FBC02D 55%, #E65100); box-shadow: 0 6px 0 #BF360C, 0 10px 18px rgba(0,0,0,0.3);
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
}
.bl-bell:active:not(:disabled) { transform: translateY(5px); box-shadow: 0 1px 0 #BF360C, 0 3px 8px rgba(0,0,0,0.3); }
.bl-bell:disabled { filter: grayscale(0.7); opacity: 0.55; cursor: default; }
.bl-bell.hit { animation: bl-hit .35s ease-out; }
@keyframes bl-hit { 0% { box-shadow: 0 6px 0 #BF360C, 0 0 0 0 rgba(255, 193, 7, 0.8); } 100% { box-shadow: 0 6px 0 #BF360C, 0 0 0 26px rgba(255, 193, 7, 0); } }
.bl-toast { margin: 0; min-height: 1.4em; padding: 3px 12px; border-radius: 12px; font-size: 13px; font-weight: 700; text-align: center; background: var(--surface-variant); }
.bl-toast[hidden] { display: block; visibility: hidden; }
.bl-toast.good { background: rgba(67, 160, 71, 0.22); }
.bl-toast.bad { background: rgba(229, 57, 53, 0.2); }
.bl-mine { --cw: min(30vw, 124px); display: flex; justify-content: center; padding: 4px 12px 8px; }
.bl-mine .bl-seat { width: min(100%, 300px); }
.bl-mine .bl-deck { width: calc(var(--cw) * 0.7); font-size: calc(var(--cw) * 0.15); }
.bl-mine .bl-row { gap: 12px; }
@media (orientation: landscape) and (max-height: 540px) {
  .bl-view { max-width: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto auto 1fr auto; align-content: start; }
  .bl-view > .game-header { padding: 6px 4px; }
  .bl-view > .game-header, .bl-bar, .bl-view > .wg-actions { grid-column: 1 / -1; }
  .bl-others, .bl-others[data-n="3"], .bl-others[data-n="5"] { grid-column: 1; grid-row: 3 / 5; --cw: min(13vw, calc((100dvh - 170px) / 3.3)); align-content: start; }
  .bl-others[data-n="1"], .bl-others[data-n="2"] { --cw: min(18vw, calc((100dvh - 150px) / 1.7)); }
  .bl-others[data-n="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); --cw: min(11vw, calc((100dvh - 150px) / 1.7)); }
  .bl-mine { grid-column: 2; grid-row: 3; --cw: calc((100dvh - 150px) / 2.6); }
  .bl-mine .bl-seat { width: auto; }
  .bl-center { grid-column: 2; grid-row: 4; padding-top: 4px; }
  .bl-bell { width: 72px; height: 72px; font-size: 36px; }
}

/* ── 카드 짝 맞추기 ── */
.pr-chip { display: inline-flex; gap: 5px; align-items: baseline; padding: 6px 12px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.pr-chip b { font-size: 17px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.pr-grid { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; width: min(94vw, 420px, calc((100dvh - 260px) * 0.8)); min-width: 240px; }
.pr-card { aspect-ratio: 1; padding: 0; border: none; background: none; perspective: 600px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pr-inner { position: relative; display: block; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 0.3s ease; }
.pr-card.up .pr-inner { transform: rotateY(180deg); }
.pr-back, .pr-face { position: absolute; inset: 0; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: grid; place-items: center; }
.pr-back { background: linear-gradient(135deg, #4A5D7E, #6F86AE); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18); }
.pr-back::after { content: '?'; color: rgba(255, 255, 255, 0.55); font-size: clamp(18px, 7vw, 32px); font-weight: 900; }
.pr-face { transform: rotateY(180deg); background: var(--card); border: 2px solid var(--surface-variant); font-size: clamp(26px, 10vw, 46px); }
.pr-card.matched .pr-face { border-color: #30A46C; background: #E8F6EE; }
:root[data-theme=dark] .pr-card.matched .pr-face { background: #1F3A2B; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .pr-card.matched .pr-face { background: #1F3A2B; } }
.pr-card.hit .pr-face { animation: pr-hit 0.4s ease-out 0.15s; }
@keyframes pr-hit { 50% { scale: 1.12; } }
.pr-card.miss .pr-face { border-color: #E5484D; }
.pr-grid.won .pr-card { animation: pr-won 0.6s ease-out; }
@keyframes pr-won { 40% { translate: 0 -8px; } }
.pr-actions { display: flex; gap: 8px; margin-top: 12px; }
.pr-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 420px; }
@media (prefers-reduced-motion: reduce) { .pr-inner { transition: none; } .pr-card.hit .pr-face, .pr-grid.won .pr-card { animation: none; } }

/* ── 순서 기억 ── */
.sm-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.sm-chip b { font-size: 18px; color: var(--on-surface); }
.sm-msg { min-height: 24px; margin: 4px 0 10px; font-size: 16px; font-weight: 800; color: var(--primary); text-align: center; }
.sm-pads { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; width: min(86vw, 380px, calc(100dvh - 300px)); min-width: 220px; aspect-ratio: 1; padding: 14px; border-radius: 50%; background: var(--surface-variant); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.sm-pad { border: none; cursor: pointer; opacity: 0.5; filter: saturate(0.85); transition: opacity 0.08s, filter 0.08s, transform 0.08s; -webkit-tap-highlight-color: transparent; }
.sm-pads:not(.input) .sm-pad { cursor: default; }
.sm-pad.p0 { background: #E5484D; border-radius: 100% 12px 12px 12px; }
.sm-pad.p1 { background: #3E7BEA; border-radius: 12px 100% 12px 12px; }
.sm-pad.p2 { background: #F2B416; border-radius: 12px 12px 12px 100%; }
.sm-pad.p3 { background: #30A46C; border-radius: 12px 12px 100% 12px; }
.sm-pad.lit { opacity: 1; filter: saturate(1.2) brightness(1.25); box-shadow: 0 0 28px rgba(255, 255, 255, 0.55); transform: scale(1.02); }
.sm-pad.wrong { opacity: 1; filter: grayscale(0.6); animation: sm-nope 0.3s; }
@keyframes sm-nope { 25% { translate: -5px 0; } 75% { translate: 5px 0; } }
.sm-start { position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 34%; aspect-ratio: 1; border-radius: 50%; border: 6px solid var(--surface-variant); background: var(--card); color: var(--on-surface); font: inherit; font-size: clamp(15px, 4.6vw, 20px); font-weight: 900; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.sm-start[hidden] { display: none; }
.sm-pads.cheer { animation: sm-cheer 0.45s ease-out; }
@keyframes sm-cheer { 40% { scale: 1.03; } }
.sm-help { margin-top: 12px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 420px; }
@media (prefers-reduced-motion: reduce) { .sm-pad { transition: none; } .sm-pads.cheer, .sm-pad.wrong { animation: none; } }

/* ── 스네이크 ── */
.sn-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.sn-chip b { font-size: 18px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.sn-wrap { position: relative; width: min(94vw, 420px, calc((100dvh - 330px) * var(--cols) / var(--rows))); min-width: 220px; aspect-ratio: var(--cols) / var(--rows); }
.sn-board { display: block; width: 100%; height: 100%; border-radius: 12px; border: 3px solid #6B8E3A; box-sizing: border-box; touch-action: none; user-select: none; -webkit-user-select: none; }
.sn-overlay { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; padding: 14px 26px; border: none; border-radius: 16px; background: rgba(0, 0, 0, 0.72); color: #fff; font: inherit; font-size: 18px; font-weight: 900; cursor: pointer; }
.sn-overlay[hidden] { display: none; }
.sn-pad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 6px; margin-top: 10px; }
.sn-pad button { border: 1px solid var(--surface-variant); border-radius: 12px; background: var(--card); color: var(--on-surface); font-size: 20px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.sn-pad button:active { background: var(--primary-container); }
.sn-pad [data-dir=up] { grid-column: 2; grid-row: 1; }
.sn-pad [data-dir=left] { grid-column: 1; grid-row: 2; }
.sn-pad [data-dir=down] { grid-column: 2; grid-row: 2; }
.sn-pad [data-dir=right] { grid-column: 3; grid-row: 2; }
@media (hover: hover) and (pointer: fine) { .sn-pad { display: none; } } /* PC 는 방향키 */
.sn-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 420px; }

/* ── 블록 드롭 ── */
.bd-wrap { display: flex; gap: 10px; align-items: flex-start; }
.bd-boardbox { position: relative; width: min(64vw, 300px, calc((100dvh - 250px) / 2)); min-width: 160px; aspect-ratio: 1 / 2; }
.bd-board { display: block; width: 100%; height: 100%; border-radius: 10px; touch-action: none; user-select: none; -webkit-user-select: none; }
.bd-cover { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px; pointer-events: none; }
.bd-cover > * { pointer-events: auto; }
.bd-overlay { padding: 14px 22px; border: none; border-radius: 16px; background: rgba(0, 0, 0, 0.75); color: #fff; font: inherit; font-size: 17px; font-weight: 900; cursor: pointer; }
/* 시작 전 설정 — 🔄 돌리는 방향 · 👻 착지 미리보기 */
.bd-setup { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 230px; padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, 0.72); color: #fff; }
.bd-setup[hidden] { display: none; }
.bd-opt { display: flex; flex-direction: column; gap: 4px; }
.bd-opt > span { font-size: 12px; font-weight: 700; opacity: .9; }
.bd-seg { display: flex; gap: 4px; }
.bd-seg button { flex: 1; min-width: 0; padding: 6px 4px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 10px; background: transparent; color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.bd-seg button[aria-pressed=true] { background: #fff; color: #1B1E24; border-color: #fff; }
.bd-overlay[hidden] { display: none; }
.bd-side { display: flex; flex-direction: column; gap: 6px; width: min(26vw, 110px); }
.bd-stat { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 10px; background: var(--card); border: 1px solid var(--surface-variant); }
.bd-stat span { font-size: 11px; color: var(--on-surface-variant); }
.bd-stat b { font-size: 17px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.bd-next-label { margin-top: 4px; font-size: 12px; font-weight: 700; color: var(--on-surface-variant); }
.bd-next { width: 100%; aspect-ratio: 1 / 2; border-radius: 10px; background: #1B1E24; }
.bd-pause { margin-top: 2px; padding: 6px; border-radius: 10px; border: 1px solid var(--surface-variant); background: var(--card); font-size: 16px; cursor: pointer; }
.bd-pad { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; width: min(94vw, 420px); margin-top: 10px; }
.bd-pad button { height: 54px; border: 1px solid var(--surface-variant); border-radius: 12px; background: var(--card); color: var(--on-surface); font-size: 22px; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.bd-pad button:active { background: var(--primary-container); }
@media (hover: hover) and (pointer: fine) { .bd-pad { display: none; } } /* PC 는 키보드 */
.bd-help { margin-top: 8px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 420px; }

/* ── 원버튼 점프 ── */
.jp-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.jp-chip b { font-size: 18px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.jp-wrap { position: relative; width: min(94vw, 420px, calc((100dvh - 230px) * 3 / 4)); min-width: 220px; aspect-ratio: 3 / 4; }
.jp-board { display: block; width: 100%; height: 100%; border-radius: 14px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.jp-overlay { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; padding: 14px 26px; border: none; border-radius: 16px; background: rgba(0, 0, 0, 0.7); color: #fff; font: inherit; font-size: 18px; font-weight: 900; cursor: pointer; }
.jp-overlay[hidden] { display: none; }
.jp-help { margin-top: 10px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 420px; }

/* ── 미로 탈출 ── */
.mz-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.mz-chip b { font-size: 17px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.mz-wrap { width: min(94vw, 400px, calc((100dvh - 330px) * var(--cols) / var(--rows))); min-width: 220px; aspect-ratio: var(--cols) / var(--rows); }
.mz-board { display: block; width: 100%; height: 100%; border-radius: 10px; touch-action: none; user-select: none; -webkit-user-select: none; }
.mz-pad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 6px; margin-top: 10px; }
.mz-pad button { border: 1px solid var(--surface-variant); border-radius: 12px; background: var(--card); color: var(--on-surface); font-size: 20px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.mz-pad button:active { background: var(--primary-container); }
.mz-pad button.blocked { opacity: 0.4; color: var(--on-surface-variant); background: transparent; } /* 갈 수 없는 쪽 — 헛누름 줄이기 */
.mz-pad [data-dir=up] { grid-column: 2; grid-row: 1; }
.mz-pad [data-dir=left] { grid-column: 1; grid-row: 2; }
.mz-pad [data-dir=down] { grid-column: 2; grid-row: 2; }
.mz-pad [data-dir=right] { grid-column: 3; grid-row: 2; }
.mz-actions { display: flex; gap: 8px; margin-top: 8px; }
.mz-help { margin-top: 6px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 420px; }

/* ── 무한 러너 ── */
.rn-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.rn-chip b { font-size: 18px; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.rn-wrap { position: relative; width: min(96vw, 560px); min-width: 240px; aspect-ratio: 1 / var(--aspect); }
.rn-board { display: block; width: 100%; height: 100%; border-radius: 14px; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer; }
.rn-overlay { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; padding: 14px 26px; border: none; border-radius: 16px; background: rgba(0, 0, 0, 0.7); color: #fff; font: inherit; font-size: 18px; font-weight: 900; cursor: pointer; }
.rn-overlay[hidden] { display: none; }
.rn-pad { display: flex; gap: 10px; width: min(96vw, 560px); margin-top: 10px; }
.rn-pad button { flex: 1; height: 58px; border: 1px solid var(--surface-variant); border-radius: 14px; background: var(--card); color: var(--on-surface); font: inherit; font-size: 18px; font-weight: 800; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
.rn-pad button small { font-size: 12px; font-weight: 600; color: var(--on-surface-variant); }
.rn-pad button:active, .rn-pad button.on { background: var(--primary-container); }
@media (hover: hover) and (pointer: fine) { .rn-pad { display: none; } }
.rn-help { margin-top: 10px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 520px; }

/* 빛난 칸 기억 */
.tl-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.tl-chip b { font-size: 18px; color: var(--on-surface); }
.tl-hearts { font-size: 18px; color: #E5484D; letter-spacing: 2px; }
.tl-msg { min-height: 24px; margin: 4px 0 10px; font-size: 16px; font-weight: 800; color: var(--primary); text-align: center; }
.tl-wrap { position: relative; width: min(92vw, 420px, calc(100dvh - 290px)); min-width: 220px; aspect-ratio: 1; }
.tl-board { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); grid-template-rows: repeat(var(--n, 3), 1fr); gap: clamp(5px, 1.6vw, 9px); width: 100%; height: 100%; padding: clamp(8px, 2.4vw, 14px); border-radius: 18px; background: var(--surface-variant); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.tl-tile { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 0; overflow: hidden; border: none; border-radius: 12%; background: var(--card); cursor: default; transition: background 0.12s, transform 0.12s, box-shadow 0.12s; -webkit-tap-highlight-color: transparent; }
.tl-board.input .tl-tile { cursor: pointer; }
.tl-board.input .tl-tile:not(.found):active { transform: scale(0.94); }
.tl-tile.lit { background: #FFD43B; box-shadow: 0 0 12px rgba(255, 212, 59, 0.7); }
.tl-tile.found { background: #4DABF7; }
.tl-tile.wrong { background: #E5484D; animation: sm-nope 0.3s; }
.tl-tile.wrong::after { content: '✕'; color: #fff; font-size: 1.4em; font-weight: 900; }
.tl-tile.hint { outline: 3px dashed #FFB000; outline-offset: -5px; }
.tl-board.cheer { animation: sm-cheer 0.45s ease-out; }
.tl-start { position: absolute; left: 50%; top: 50%; translate: -50% -50%; padding: 16px 30px; border-radius: 18px; border: none; background: rgba(0, 0, 0, 0.72); color: #fff; font: inherit; font-size: 19px; font-weight: 900; cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18); }
.tl-start[hidden] { display: none; }
.tl-help { margin-top: 12px; font-size: 13px; color: var(--on-surface-variant); text-align: center; max-width: 420px; }
@media (prefers-reduced-motion: reduce) { .tl-tile { transition: none; } .tl-board.cheer, .tl-tile.wrong { animation: none; } }
/* 숫자 위치 기억 (칩·메시지·시작 버튼은 tl-* 같이 씀) */
.cp-wrap { position: relative; width: min(92vw, 400px, calc((100dvh - 300px) * var(--cols) / var(--rows))); min-width: 220px; aspect-ratio: var(--cols) / var(--rows); }
.cp-board { display: grid; grid-template-columns: repeat(var(--cols), 1fr); grid-template-rows: repeat(var(--rows), 1fr); gap: clamp(4px, 1.4vw, 8px); width: 100%; height: 100%; padding: clamp(8px, 2.4vw, 12px); border-radius: 18px; background: var(--surface-variant); user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.cp-cell { display: grid; place-items: center; min-width: 0; min-height: 0; padding: 0; overflow: hidden; border: none; border-radius: 12%; background: transparent; color: var(--on-surface); font: inherit; font-size: clamp(18px, 6vw, 28px); font-weight: 900; font-variant-numeric: tabular-nums; cursor: default; -webkit-tap-highlight-color: transparent; transition: transform 0.1s; }
.cp-cell.num { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12); }
.cp-cell.covered { background: #4DABF7; }
.cp-board.input .cp-cell.num { cursor: pointer; }
.cp-board.input .cp-cell.num:active { transform: scale(0.93); }
.cp-cell.wrong { background: #E5484D; color: #fff; animation: sm-nope 0.3s; }
.cp-cell.want { outline: 3px dashed #FFB000; outline-offset: -4px; background: #FFF3BF; color: #111; }
.cp-board.cheer { animation: sm-cheer 0.45s ease-out; }
.cp-wrap .tl-start { z-index: 1; }
@media (prefers-reduced-motion: reduce) { .cp-cell { transition: none; } .cp-board.cheer, .cp-cell.wrong { animation: none; } }
/* 사라진 그림 찾기 (칩·메시지·시작 버튼은 tl-* 같이 씀) */
.mg-wrap { position: relative; width: min(92vw, 400px); min-width: 220px; }
.mg-board { display: grid; grid-template-columns: repeat(var(--cols, 2), 1fr); gap: clamp(4px, 1.4vw, 8px); width: 100%; min-height: 180px; padding: clamp(8px, 2.4vw, 14px); border-radius: 18px; background: var(--surface-variant); user-select: none; -webkit-user-select: none; transition: opacity 0.2s; }
.mg-board.hide { opacity: 0; }
.mg-item { display: grid; place-items: center; min-width: 0; aspect-ratio: 1; border-radius: 14%; background: var(--card); font-size: calc(min(92vw, 400px) / var(--cols, 2) * 0.48); line-height: 1; animation: mg-pop 0.25s ease-out; }
.mg-item.empty { visibility: hidden; }
.mg-item.found { background: #D3F9D8; outline: 3px solid #37B24D; outline-offset: -3px; }
.mg-item.was { background: #FFF3BF; outline: 3px dashed #FFB000; outline-offset: -4px; }
@keyframes mg-pop { from { scale: 0.85; opacity: 0.4; } }
.mg-cover { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(56px, 20vw, 96px); }
.mg-cover[hidden] { display: none; }
.mg-wrap .tl-start { z-index: 1; }
.mg-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: min(92vw, 400px); margin-top: 14px; }
.mg-options[hidden] { display: none; }
.mg-opt { aspect-ratio: 1; border: 2px solid var(--surface-variant); border-radius: 16px; background: var(--card); font-size: clamp(30px, 10vw, 44px); line-height: 1; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.mg-opt:active { transform: scale(0.94); }
.mg-opt.right { background: #D3F9D8; border-color: #37B24D; }
.mg-opt.wrong { background: #FFE3E3; border-color: #E5484D; animation: sm-nope 0.3s; }
@media (prefers-reduced-motion: reduce) { .mg-item, .mg-opt.wrong { animation: none; } .mg-board { transition: none; } }
/* 숫자 외우기 (칩·메시지·시작 버튼은 tl-* 같이 씀) */
.dg-wrap { position: relative; width: min(92vw, 400px); }
.dg-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 130px; padding: 14px 10px; border-radius: 18px; background: var(--surface-variant); font-size: min(calc(min(92vw, 400px) / var(--n, 6) * 1.25), 52px); font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; color: var(--on-surface); user-select: none; -webkit-user-select: none; transition: background 0.15s; }
.dg-screen > span, .dg-row { display: inline-flex; }
.dg-screen:not(:has(.dg-row)) { flex-direction: row; flex-wrap: wrap; }
.dg-screen span { display: inline-block; min-width: 0.62em; text-align: center; }
.dg-screen .blank { color: var(--on-surface-variant); opacity: 0.45; }
.dg-screen.right { background: #D3F9D8; color: #2B8A3E; }
.dg-screen.wrong { background: #FFF5F5; }
.dg-row.ans { color: #2B8A3E; }
.dg-row.mine { font-size: 0.8em; color: var(--on-surface-variant); }
.dg-row .bad { color: #E5484D; text-decoration: underline; }
.dg-bar { height: 6px; margin: 8px 6px 0; border-radius: 3px; background: var(--surface-variant); overflow: hidden; }
.dg-bar[hidden] { display: none; }
.dg-bar i { display: block; height: 100%; background: var(--primary); transform-origin: left; }
.dg-pad .tl-start { z-index: 1; }
.dg-pad { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: min(92vw, 360px); margin-top: 16px; opacity: 0.45; transition: opacity 0.15s; }
.dg-pad.on { opacity: 1; }
.dg-pad:has(.tl-start:not([hidden])) { opacity: 1; }
.dg-pad:has(.tl-start:not([hidden])) button[data-k] { opacity: 0.45; }
.dg-pad button[data-k] { height: clamp(52px, 13vw, 64px); border: 1px solid var(--surface-variant); border-radius: 14px; background: var(--card); color: var(--on-surface); font: inherit; font-size: 24px; font-weight: 800; cursor: pointer; touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.dg-pad.on button[data-k]:active { background: var(--primary-container); transform: scale(0.96); }
.dg-pad [data-k=back] { font-size: 20px; }
.dg-pad [data-k="0"] { grid-column: 2; }
/* 혼자 게임 결과 창 */
.solo-result { text-align: center; min-width: 260px; }
.solo-result .sr-score { font-size: 34px; font-weight: 900; color: var(--primary); margin-bottom: 4px; }
.solo-result .sr-sub { font-size: 14px; color: var(--on-surface-variant); margin-bottom: 8px; }
.solo-result .sr-lines { display: flex; flex-direction: column; gap: 4px; margin: 8px 0 18px; font-size: 15px; }
.solo-result .sr-new { font-weight: 800; color: #E53935; }
.solo-result .dialog-actions { justify-content: center; }
/* 게임 카드 그리드 (로비) — 고른 카드는 테두리, 아래에 AI/사람 대전 버튼 */
.lobby-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.lobby-games .game-card { aspect-ratio: auto; justify-content: flex-start; padding: 26px 6px 12px; gap: 4px; font-size: 15px; border: 2px solid transparent; min-width: 0; }
.lobby-games .game-emoji { font-size: 36px; line-height: 1.15; }
.game-name { line-height: 1.25; text-align: center; word-break: keep-all; }
.game-sub { max-width: 100%; padding: 0 4px; font-size: 11px; font-weight: 600; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-sub.mine { font-weight: 500; opacity: 0.85; }
/* 같이 하는 게임 · 혼자 게임 구분 (오른쪽 위) */
.game-kind { position: absolute; top: 6px; right: 6px; padding: 1px 6px; border-radius: 8px; background: var(--surface-variant); color: var(--on-surface-variant); font-size: 10px; font-weight: 800; }
.game-kind.online { background: #E3F2E5; color: #2E7D32; }
.game-kind.solo { background: #FFF1DB; color: #B35C00; }
:root[data-theme=dark] .game-kind.online { background: #1F3A23; color: #8FD49A; }
:root[data-theme=dark] .game-kind.solo { background: #3D2A12; color: #F2B66D; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .game-kind.online { background: #1F3A23; color: #8FD49A; }
  :root:not([data-theme=light]) .game-kind.solo { background: #3D2A12; color: #F2B66D; }
}
.room-game-online { position: absolute; top: 3px; right: 5px; font-size: 11px; }
/* 게임 시작 팝업 — 로비 카드·방 만들기에서 게임을 누르면 뜸 */
dialog.game-actions { width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px 18px 18px; flex-direction: column; gap: 12px; background: var(--card); color: var(--on-surface); }
dialog.game-actions[open] { display: flex; }
.ga-close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border: none; border-radius: 50%; background: var(--surface-variant); color: var(--on-surface); font-size: 16px; cursor: pointer; }
.game-actions-title { font-weight: 800; font-size: 20px; padding-right: 150px; }
/* ⭐ 즐겨찾기 켜고 끄기 — ✕ 왼쪽 알약 */
.ga-fav { position: absolute; top: 10px; right: 54px; height: 36px; padding: 0 12px; border: 1.5px solid rgba(127, 127, 127, 0.35); border-radius: 18px; background: none; color: var(--on-surface-variant); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.ga-fav[aria-pressed="true"] { border-color: #F9A825; background: rgba(255, 213, 79, 0.18); color: var(--on-surface); }
.game-actions-sub { display: flex; flex-direction: column; gap: 2px; margin-top: -6px; font-size: 14px; color: var(--on-surface-variant); }
.game-actions-sub:empty { display: none; }
.game-actions-btns { display: flex; gap: 8px; }
.game-actions-btns[hidden] { display: none; }
/* 🤖 AI / 👥 사람 — 고른 쪽이 진하게 */
.game-actions-btn { flex: 1; height: 48px; margin: 0; border-radius: 12px; border: 2px solid var(--surface-variant); background: transparent; color: var(--on-surface); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.game-actions-btn.chosen { border-color: var(--primary); background: var(--primary-container); color: var(--on-primary-container, var(--on-surface)); }
.game-actions-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.game-actions-note { font-size: 13px; color: var(--on-surface-variant); }
.game-actions-note:empty { display: none; }
/* 대전 설정 — 게임별 AI 난이도·AI 인원·사람 인원 */
.game-actions-opts { display: flex; flex-direction: column; gap: 10px; }
.game-actions-opts[hidden] { display: none; }
.game-actions-go { margin: 4px 0 0; height: 52px; font-size: 17px; background: #2E7D32; }
.ga-seg { padding: 0; flex-wrap: wrap; gap: 6px; }
.ga-seg .seg-label { flex: 0 0 100%; font-weight: 700; }
.ga-seg .seg-btn { flex: 1 1 0; min-width: 0; height: 36px; padding: 0 4px; }
/* 방 만들기 펼침 */
.room-setup { margin-top: 10px; padding: 12px; border-radius: 16px; background: var(--surface-variant); display: flex; flex-direction: column; gap: 4px; }
.room-setup[hidden] { display: none; }
.room-setup-head { font-weight: 800; font-size: 15px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.room-setup-head span { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); }
.room-setup .game-cat-title { margin-top: 8px; }
.room-setup .room-games { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.room-game-btn { position: relative; color: var(--on-surface); font: inherit; font-size: 13px; }
.room-game-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.room-game-solo { font-size: 10px; font-weight: 700; color: var(--on-surface-variant); }
a.room-game-btn { text-decoration: none; }
.room-setup-opts { margin: 8px 0 4px; padding: 12px; border-radius: 14px; background: var(--card); border: 2px solid var(--primary); display: flex; flex-direction: column; gap: 8px; }
.room-setup-opts-head { font-weight: 800; font-size: 15px; }
.room-setup-opts-head .game-sub { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); margin-left: 4px; }
.room-setup-opts .game-actions-note:empty { display: none; }
.room-setup-sub { font-size: 11px; font-weight: 500; color: var(--on-surface-variant); }
.lobby-online-hint { font-size: 12px; color: var(--on-surface-variant); }
/* 로비 맨 위 거르기 — 👥 같이 하기 / 🙋 혼자 하기 (켜진 것만 색) */
.game-filter { display: flex; gap: 6px; }
.game-filter button { padding: 6px 12px; border: 1px solid var(--surface-variant); border-radius: 999px; background: var(--card); color: var(--on-surface-variant); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background 0.12s, color 0.12s, border-color 0.12s; }
.game-filter button[data-mode=versus][aria-pressed=true] { background: #E3F2E5; border-color: #2E7D32; color: #2E7D32; }
.game-filter button[data-mode=solo][aria-pressed=true] { background: #FFF1DB; border-color: #B35C00; color: #B35C00; }
:root[data-theme=dark] .game-filter button[data-mode=versus][aria-pressed=true] { background: #1F3A23; border-color: #8FD49A; color: #8FD49A; }
:root[data-theme=dark] .game-filter button[data-mode=solo][aria-pressed=true] { background: #3D2A12; border-color: #F2B66D; color: #F2B66D; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .game-filter button[data-mode=versus][aria-pressed=true] { background: #1F3A23; border-color: #8FD49A; color: #8FD49A; }
  :root:not([data-theme=light]) .game-filter button[data-mode=solo][aria-pressed=true] { background: #3D2A12; border-color: #F2B66D; color: #F2B66D; }
}
.game-filter-empty { margin: 16px 0; text-align: center; font-size: 14px; color: var(--on-surface-variant); }
/* 보기 방식 — 거르기 줄 오른쪽 끝 버튼(lobby.ts yeon.gameGridView): ▤ 자세히(기본) → ▥ 이름만(.view-name) → ▦ 아이콘만(.view-icon) */
.game-filter .game-view { margin-left: auto; }
.game-filter .game-view[aria-pressed=true] { background: var(--primary-container); border-color: var(--primary); color: var(--primary); }
.game-cats.view-name .lobby-games { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.game-cats.view-name .lobby-games .game-card { padding: 10px 4px 8px; gap: 2px; border-radius: 12px; font-size: 13px; }
.game-cats.view-name .lobby-games .game-emoji { font-size: 30px; line-height: 1.1; }
.game-cats.view-name .game-sub, .game-cats.view-name .game-kind, .game-cats.view-name .game-cat-desc { display: none; }
.game-cats.view-name .game-ribbon { padding: 1px 5px; font-size: 9px; border-radius: 10px 0 8px 0; }
.game-cats.view-icon .lobby-games { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); gap: 6px; }
.game-cats.view-icon .lobby-games .game-card { padding: 8px 2px; gap: 0; border-radius: 12px; }
.game-cats.view-icon .lobby-games .game-emoji { font-size: 30px; line-height: 1.1; }
.game-cats.view-icon .game-name, .game-cats.view-icon .game-sub, .game-cats.view-icon .game-kind, .game-cats.view-icon .game-cat-desc { display: none; }
.game-cats.view-icon .game-ribbon { padding: 1px 5px; font-size: 9px; border-radius: 10px 0 8px 0; }

.lobby-section {
  padding: 12px 16px;
}
.lobby-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.lobby-row h2 {
  font-size: 17px;
}
/* 아코디언 토글 버튼 (전적/랭킹) */
.lobby-acc {
  border: none;
  background: none;
  font-size: 17px;
  font-weight: 700;
  color: var(--on-surface, #222);
  cursor: pointer;
  padding: 4px 0;
}
.lobby-online {
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-variant);
}
/* 랭킹 패널 */
.ranking-panel {
  background: var(--card);
  border: 1px solid var(--surface-variant);
  border-radius: 12px;
  overflow: hidden;
}
.rank-game { padding: 8px 12px; border-bottom: 1px solid var(--surface-variant); }
.rank-game:last-child { border-bottom: none; }
.rank-game-title { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 2px 0;
}
.rank-medal { width: 22px; text-align: center; }
.rank-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-rec { color: var(--on-surface-variant); font-size: 12px; }
.rank-game-title { display: flex; align-items: center; gap: 6px; }
.rank-game-title .game-kind { position: static; }
.rank-mine { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 12px; border-bottom: 1px solid var(--surface-variant); font-size: 13px; color: var(--on-surface-variant); }
.rank-mine b { color: var(--on-surface); font-size: 14px; }
.rank-section { padding: 10px 12px 2px; font-size: 12px; font-weight: 800; color: var(--on-surface-variant); letter-spacing: 0.5px; }
.rank-hint { margin: -2px 0 4px; font-size: 11px; color: var(--on-surface-variant); }
.game-kind.app { background: #EDE7F6; color: #5E35B1; }
:root[data-theme=dark] .game-kind.app { background: #2E2443; color: #B39DDB; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .game-kind.app { background: #2E2443; color: #B39DDB; } }
.rank-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 8px 12px; border-bottom: 1px solid var(--surface-variant); }
.rank-rule { font-size: 11px; color: var(--on-surface-variant); }
/* 묶음 탭 — 👥 같이 하기 · 🙋 혼자 하기 · 🌐 퀴즈·한자 (하나만 보임) */
.rank-groups { display: flex; gap: 6px; padding: 10px 12px 0; }
.rank-groups button { flex: 1; padding: 7px 4px; border: 1px solid var(--surface-variant); border-radius: 12px; background: var(--card); color: var(--on-surface-variant); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.rank-groups button[aria-pressed=true] { background: var(--primary-container); border-color: var(--primary); color: var(--on-surface); }
/* 게임마다 한 줄 — 🥇 1등 + 내 순위, 누르면 상위 5명 */
.rank-item { border-bottom: 1px solid var(--surface-variant); }
.rank-item:last-child { border-bottom: none; }
.rank-line { width: 100%; display: grid; grid-template-columns: minmax(0, 8.5em) minmax(0, 1fr) auto 14px; align-items: center; gap: 8px; padding: 9px 12px; border: none; background: none; color: var(--on-surface); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.rank-line-game { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-line-top { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--on-surface-variant); font-size: 13px; }
.rank-line-top b { color: var(--primary); }
.rank-line-me { font-size: 12px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.rank-line-arrow { color: var(--on-surface-variant); text-align: center; }
.rank-item.open .rank-line { background: var(--surface-variant); }
.rank-open { padding: 4px 16px 10px; }
/* 순위 줄 (로비 랭킹 · 게임 화면 리더보드 공통 — shared/leaderboard.ts) */
.lb-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 6px; align-items: baseline; padding: 4px 0; font-size: 14px; }
.lb-row.me { background: var(--primary-container); border-radius: 8px; margin: 0 -6px; padding: 4px 6px; }
.lb-rank { grid-row: span 2; text-align: center; font-weight: 800; color: var(--on-surface-variant); }
.lb-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-name small { font-weight: 500; color: var(--on-surface-variant); }
.lb-val { font-weight: 800; color: var(--primary); text-align: right; font-variant-numeric: tabular-nums; }
.lb-detail { grid-column: 2 / 4; font-size: 11px; color: var(--on-surface-variant); }
.lb-gap { text-align: center; color: var(--on-surface-variant); line-height: 1; }
.lb-empty { padding: 6px 0; font-size: 13px; color: var(--on-surface-variant); }
/* 기록판을 나눈 게임(타이밍 스톱 7·10·15초) — 판 제목 */
.lb-sub { margin: 8px 0 2px; padding-top: 6px; border-top: 1px dashed var(--surface-variant); font-size: 13px; font-weight: 800; }
.lb-sub:first-child { margin-top: 0; padding-top: 0; border-top: none; }
.lb-tabs { display: inline-flex; gap: 4px; }
.lb-tabs button { padding: 3px 10px; border: 1px solid var(--surface-variant); border-radius: 999px; background: var(--card); color: var(--on-surface-variant); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.lb-tabs button[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: #fff; }
/* 게임 화면 리더보드 — 폰: 화면 맨 아래 카드 / 넓은 PC: 오른쪽에 고정 */
.lb-panel[hidden] { display: none; }
.lb-panel { box-sizing: border-box; width: min(92vw, 420px); margin: 16px auto 24px; padding: 12px 14px; border: 1px solid var(--surface-variant); border-radius: 16px; background: var(--card); color: var(--on-surface); align-self: center; }
.lb-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 15px; }
.lb-foot { margin-top: 6px; font-size: 11px; color: var(--on-surface-variant); }
@media (min-width: 1280px) {
  .lb-panel { position: fixed; top: 76px; right: 16px; width: 270px; max-height: calc(100dvh - 96px); overflow: auto; margin: 0; z-index: 5; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08); }
}
.lobby-btn {
  margin: 0;
  height: 40px;
  padding: 0 18px;
  width: auto;
}
.lobby-hint {
  font-size: 14px;
  color: var(--on-surface-variant);
  padding: 12px 4px;
}
.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.room-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--surface-variant);
  border-radius: 10px;
  background: var(--card);
  font-size: 15px;
  cursor: pointer;
  text-align: left;
}
.room-item:active { background: var(--primary-container); }
.room-host { font-weight: 600; }
.room-game-label { color: var(--on-surface-variant); font-size: 13px; }
.room-empty {
  padding: 18px 4px;
  text-align: center;
  font-size: 14px;
  color: var(--on-surface-variant);
}

/* ── 로비 액션 (회원관리/회원정보) ────────── */
.lobby-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── 회원정보 수정 ────────────────────────── */

.profile-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.profile-field, .profile-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--on-surface-variant);
}
.profile-readonly {
  padding: 12px 14px;
  background: var(--surface-variant);
  border-radius: 8px;
  font-size: 15px;
}
.profile-form input {
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--surface-variant);
  border-radius: 8px;
  font-size: 15px;
  background: var(--card);
}
.profile-form .primary-btn {
  margin: 4px 0 0;
  width: 100%;
}
.form-msg {
  font-size: 13px;
  min-height: 1.1em;
}
.form-msg.ok { color: #2E7D32; }
.form-msg.err { color: #C62828; }

/* ── 게임방 ───────────────────────────────── */

.room-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.room-info {
  padding: 12px 14px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  border-radius: 10px;
  font-size: 14px;
}
.room-h3 { font-size: 15px; }
.room-games {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.room-game-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 4px;
  border: 1px solid var(--surface-variant);
  border-radius: 10px;
  background: var(--card);
  font-size: 13px;
  cursor: pointer;
}
.room-game-btn.selected {
  border-color: var(--primary);
  background: var(--primary-container);
}
.room-game-emoji { font-size: 24px; }
.room-note {
  font-size: 13px;
  color: var(--on-surface-variant);
  text-align: center;
}

.room-status {
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  min-height: 1.2em;
}
/* 게임방 — 폰 한 화면에: 게임 버튼은 낮은 한 줄 칩, 기다리는 동안엔 게임 목록을 "🎮 게임 바꾸기 ▾"로 접음 */
#room-view .room-body { padding: 12px; gap: 10px; }
#room-view .room-info { padding: 10px 12px; }
#room-view .room-h3 { margin: 0; }
#room-view .game-cats { display: flex; flex-direction: column; gap: 6px; }
#room-view .game-cat-title { font-size: 12px; margin: 2px 0 -2px; }
#room-view .room-games { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
#room-view .room-game-btn { flex-direction: row; justify-content: flex-start; gap: 6px; min-height: 40px; padding: 6px 8px; text-align: left; line-height: 1.2; }
#room-view .room-game-emoji { flex: none; font-size: 20px; line-height: 1; }
#room-view .room-game-online { display: none; }
.room-pick-toggle { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: 10px; border: 1.5px dashed var(--surface-variant); background: var(--card); font-size: 14px; cursor: pointer; user-select: none; }
.room-pick-toggle:hover { border-color: var(--primary); }

/* ── 방 채팅 ───────────────────── */

.room-chat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}
.chat-log {
  height: 180px;
  overflow-y: auto;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--surface-variant);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-msg {
  font-size: 14px;
  line-height: 1.3;
  max-width: 85%;
  align-self: flex-start;
}
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-msg.sys {
  align-self: center;
  color: var(--on-surface-variant, #888);
  font-size: 12px;
  font-style: italic;
}
.chat-who {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--primary);
}
.chat-text {
  display: inline-block;
  padding: 6px 10px;
  background: var(--surface-variant);
  border-radius: 10px;
  word-break: break-word;
}
.chat-msg.mine .chat-text { background: var(--primary); color: #FFF; }
.chat-form { display: flex; gap: 8px; }
.chat-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--surface-variant);
  border-radius: 10px;
  font-size: 14px;
}
.chat-send {
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #FFF;
  font-weight: 600;
  cursor: pointer;
}

/* ── 공용 플로팅 채팅 위젯 ───────────────────── */
#chat-widget {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}
.chat-fab {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #FFF;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  align-self: flex-end;
}
.chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: #E53935;
  color: #FFF;
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}
.chat-box {
  width: min(78vw, 320px);
  background: var(--card);
  border: 1px solid var(--surface-variant);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chat-box-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  font-weight: 700;
  font-size: 14px;
  background: var(--surface-variant);
}
.chat-close {
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--on-surface-variant);
}
.chat-box .chat-log { height: 220px; border: none; border-radius: 0; }
.chat-box .chat-form { padding: 8px; }

/* ── 온라인 종료 다이얼로그 (비모달, 상단 고정) ── */
.oe-dialog {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  z-index: 40;
  border: 1px solid var(--surface-variant);
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.3);
  max-width: 90vw;
}
.oe-status {
  font-size: 13px;
  color: var(--primary);
  min-height: 1.1em;
  margin: 4px 0 0;
}

/* ── 선공 정하기 (홀짝) ───────────────────── */

.room-parity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--surface-variant);
  border-radius: 12px;
}
.parity-status {
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.parity-btns {
  display: flex;
  gap: 14px;
}
.parity-btn {
  width: 92px;
  height: 64px;
  border: 2px solid var(--primary);
  border-radius: 12px;
  background: var(--primary-container);
  color: var(--on-primary-container);
  font-size: 22px;
  font-weight: 800;
  cursor: pointer;
}
.parity-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.parity-result {
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
  min-height: 1.2em;
  text-align: center;
}

/* ── 연결 상태 배너 (재접속/상대 끊김) ───────── */
#net-status {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 92vw;
  padding: 9px 16px;
  border-radius: 20px;
  background: #B3261E;
  color: #FFF;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
#net-status[hidden] { display: none; }
.net-status-sec { font-variant-numeric: tabular-nums; }
.net-status-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #FFF;
  border-radius: 50%;
  animation: net-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes net-spin { to { transform: rotate(360deg); } }

/* ── 대기방 참가자 명단 (정원만큼 칸, 빈 칸은 점선) ── */
.room-roster {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.room-seat {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--surface-variant);
  border-radius: 10px;
  background: var(--card);
  font-size: 14px;
  font-weight: 600;
}
.room-seat.empty { border-style: dashed; color: var(--on-surface-variant); font-weight: 400; }
.room-seat.me { border-color: var(--primary); }
.room-seat .seat-no { font-size: 12px; color: var(--on-surface-variant); }
/* 방장: 빈자리를 누르면 🤖 AI 넣기, AI 자리를 누르면 빼기 */
button.room-seat { width: 100%; font: inherit; font-size: 14px; color: inherit; text-align: left; cursor: pointer; }
.room-seat.ai { font-weight: 600; color: var(--on-surface-variant); }
.room-seat.empty.tap { border-color: var(--primary); color: var(--primary); }
.room-seat .seat-act { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--primary); }
.room-seat.ai .seat-act { color: var(--on-surface-variant); }
/* AI 자리 난이도 — 방장은 쉬움·보통·어려움 버튼, 다른 사람은 글자 */
.room-seat .seat-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-seat .seat-level { font-size: 12px; font-weight: 700; color: var(--on-surface-variant); }
/* 방장 AI 자리 — 이름(+✕)은 윗줄, 난이도는 아랫줄 꽉 차게 (폰 2칸 배치에서 이름이 가려지지 않게) */
.room-seat:has(.seat-levels) { flex-wrap: wrap; row-gap: 6px; }
.room-seat .seat-levels { order: 1; display: flex; flex: 1 1 100%; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface-variant); }
.room-seat .seat-levels .seat-lv { flex: 1; min-width: 0; padding: 3px 2px; }
.room-seat .seat-lv { border: 0; background: transparent; color: var(--on-surface-variant); font: inherit; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; cursor: pointer; }
.room-seat .seat-lv.on { background: var(--primary); color: var(--on-primary, #fff); }
.room-seat .seat-del { flex: none; border: 0; background: transparent; color: var(--on-surface-variant); font-size: 15px; padding: 4px 6px; cursor: pointer; }

/* ── 다빈치코드 추리 이력 ── */

/* ⏱️ 타이밍 스톱 (games/timing) — 목표 카드 · 시계(20% 뒤 스르륵 사라짐) · 멈춤 버튼 · 결과 선 그래프 */
.tm-body { gap: 12px; width: 100%; max-width: 440px; margin: 0 auto; }
.tm-body > * { width: 100%; }
.tm-lead { margin: 0; font-size: 14px; line-height: 1.55; color: var(--on-surface-variant); }
.tm-modes { display: grid; gap: 10px; }
.tm-mode { display: grid; grid-template-columns: 76px 1fr; align-items: center; gap: 12px; padding: 14px; text-align: left; border-radius: 16px; border: 2px solid transparent; background: var(--card); color: var(--on-surface); font: inherit; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tm-mode:hover, .tm-mode:focus-visible { border-color: var(--primary); outline: none; }
.tm-sec { font-size: 32px; font-weight: 900; color: var(--primary); font-variant-numeric: tabular-nums; }
.tm-sec small { font-size: 14px; font-weight: 700; }
.tm-meta { display: grid; gap: 3px; min-width: 0; font-size: 12.5px; color: var(--on-surface-variant); }
.tm-meta b { color: var(--on-surface); font-variant-numeric: tabular-nums; }
.tm-goal { text-align: center; font-size: 16px; font-weight: 800; margin-top: 12px; }
.tm-goal b { font-size: 22px; color: var(--primary); font-variant-numeric: tabular-nums; }
.tm-clock { text-align: center; font-size: clamp(52px, 17vw, 76px); font-weight: 900; line-height: 1; padding: 22px 0; font-variant-numeric: tabular-nums; letter-spacing: -.02em; transition: opacity var(--fade, .7s) ease, filter var(--fade, .7s) ease; }
.tm-clock small { font-size: .4em; font-weight: 700; }
.tm-clock.gone { opacity: .22; filter: blur(7px); }
.tm-hint { text-align: center; min-height: 20px; font-size: 14px; color: var(--on-surface-variant); }
.tm-stop { align-self: center; width: min(210px, 60vw) !important; aspect-ratio: 1; max-width: 100%; margin: 18px auto 0; border-radius: 50%; border: none; cursor: pointer; background: #E8590C; color: #fff; font: inherit; font-size: 32px; font-weight: 900; box-shadow: 0 8px 0 #9C3B07, 0 12px 24px rgba(0, 0, 0, .2); touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.tm-stop:active { transform: translateY(6px); box-shadow: 0 2px 0 #9C3B07; }
.tm-res { display: grid; gap: 4px; text-align: center; }
.tm-verdict { font-size: 20px; font-weight: 900; }
.tm-mine { font-size: 42px; font-weight: 900; color: #E8590C; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tm-mine small { font-size: 18px; }
.tm-diff { font-size: 14px; color: var(--on-surface-variant); }
.tm-diff b { color: var(--on-surface); font-variant-numeric: tabular-nums; }
.tm-note { min-height: 20px; font-size: 13.5px; font-weight: 700; color: var(--on-surface-variant); }
.tm-note.new { color: var(--primary); }
.tm-chart-box { background: var(--card); border-radius: 16px; padding: 12px 10px 8px; box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.tm-chart-title { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin: 0 4px 6px; font-size: 13px; font-weight: 800; }
.tm-chart-sub { font-weight: 400; color: var(--on-surface-variant); }
.tm-svg { display: block; width: 100%; height: auto; }
.tm-svg .grid { stroke: var(--surface-variant); stroke-width: 1; stroke-dasharray: 2 4; }
.tm-svg .axis { stroke: var(--surface-variant); stroke-width: 1; }
.tm-svg .area { fill: var(--primary); fill-opacity: .14; }
.tm-svg .curve { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; }
.tm-svg .curve-me { fill: none; stroke: #E8590C; stroke-width: 2; stroke-dasharray: 5 3; stroke-linejoin: round; }
.tm-svg .area-me { fill: #E8590C; fill-opacity: .1; }
.tm-svg .tick { fill: var(--on-surface-variant); font-size: 10px; }
.tm-svg .l-target { stroke: #3FA34D; stroke-width: 2; stroke-dasharray: 4 3; }
.tm-svg .l-me { stroke: #E8590C; stroke-width: 3; }
.tm-svg .l-avg { stroke: #2F86DD; stroke-width: 2.5; }
.tm-svg .lbl { font-size: 10.5px; font-weight: 800; paint-order: stroke; stroke: var(--card); stroke-width: 3px; }
.tm-svg .t-target { fill: #3FA34D; }
.tm-svg .t-me { fill: #E8590C; }
.tm-svg .t-avg { fill: #2F86DD; }
.tm-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 6px 4px 0; font-size: 11.5px; color: var(--on-surface-variant); }
.tm-legend i { display: inline-block; width: 14px; border-top: 3px solid; vertical-align: middle; margin-right: 4px; }
.tm-legend .k-target { border-color: #3FA34D; border-top-style: dashed; }
.tm-legend .k-me { border-color: #E8590C; }
.tm-legend .k-avg { border-color: #2F86DD; }
.tm-legend .k-curve { border-color: var(--primary); }
.tm-legend .k-mycurve { border-color: #E8590C; border-top-style: dashed; }
.tm-rank-h { margin: 4px 0 0; font-size: 13px; font-weight: 800; }
.tm-rank-h span { font-weight: 400; color: var(--on-surface-variant); }
.tm-rank { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; }
.tm-rank li { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 8px; align-items: center; padding: 7px 10px; border-radius: 10px; background: var(--card); font-size: 13px; }
.tm-rank li.me { outline: 2px solid #E8590C; }
.tm-rank .n { font-weight: 800; color: var(--on-surface-variant); }
.tm-rank .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tm-rank .e { font-variant-numeric: tabular-nums; font-weight: 700; }
.tm-rank .p { font-size: 12px; color: var(--on-surface-variant); }
.tm-rank li.tm-rank-empty { display: block; color: var(--on-surface-variant); text-align: center; }
.tm-btns { display: flex; gap: 8px; margin-top: 4px; }
.tm-btn { flex: 1; height: 46px; border-radius: 23px; border: none; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; background: var(--surface-variant); color: var(--on-surface); }
.tm-btn.primary { background: var(--primary); color: var(--surface); }
@media (prefers-reduced-motion: reduce) { .tm-clock { transition: none; } }

/* 🔊/🔇 효과음 버튼 — 게임 화면 머리줄 오른쪽 끝 (shared/sfx.ts attachSfxToggle) */
.game-header .sfx-toggle { margin-left: auto; font-size: 20px; flex: none; }
.game-header .sfx-toggle.off { opacity: 0.55; }
/* ⚙️ 게임 설정(⏩ AI 진행 속도) — 🔊 오른쪽 (shared/speed-button.ts, AI 대전만) */
.game-header .game-speed-btn { font-size: 20px; flex: none; }
.game-header .game-speed-btn[hidden] { display: none; }
/* 💬 로비 채팅이 넓은 화면 오른쪽 칸(shared-web/lobby-chat)에 있을 때 — 🏆 리더보드는 그 칸 위쪽에 */
.ylc-dock .lb-panel { position: static; width: auto; max-height: none; margin: 0; box-shadow: none; }
/* 게임 머리줄: 💬(좁은 화면만) · 🔊 — 오른쪽 끝에 붙여 */
.game-header .ylc-icon { margin-left: auto; flex: none; }
.game-header .ylc-icon:not([hidden]) + .sfx-toggle { margin-left: 0; }
/* 바둑 계가 단계 — 점수 내역 + 하는 법 */
.go-score-box { margin: 0 16px 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-variant); font-size: 13px; line-height: 1.5; }
.go-score-box[hidden] { display: none; }
.go-score-rows { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.go-score-row { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.go-score-row > span:first-of-type { color: var(--on-surface-variant); min-width: 2.5em; }
.go-score-row > span:last-child { margin-left: auto; }
.go-score-row.lead > span:last-child b { color: #2E7D32; }
.go-score-lead { font-weight: 800; text-align: right; }
.go-score-how { margin: 0; padding-top: 8px; border-top: 1px solid var(--outline, rgba(127,127,127,0.3)); }
.go-score-more { margin-top: 6px; }
.go-score-more summary { cursor: pointer; font-weight: 700; color: var(--primary); }
.go-score-more ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* 넓은 화면(PC) — 대기방 채팅은 로비 채팅처럼 오른쪽에 고정된 세로 칸 (본문은 그만큼 왼쪽) */
@media (min-width: 1200px) {
  body:has(#room-view:not([hidden]) #room-chat:not([hidden])) { padding-right: 320px; box-sizing: border-box; }
  #room-view .room-chat {
    position: fixed; top: 0; right: 0; bottom: 0; width: 320px; box-sizing: border-box; margin: 0; z-index: 20;
    padding: calc(env(safe-area-inset-top) + 12px) 12px 12px;
    background: var(--surface); border-left: 1px solid var(--surface-variant);
  }
  #room-view .room-chat::before { content: '💬 방 채팅'; font-weight: 800; font-size: 15px; padding: 2px 4px 4px; }
  #room-view .chat-log { flex: 1; height: auto; min-height: 0; }
}

/* ── 🧺 과일 장터 ── */
.mk-body { box-sizing: border-box; width: 100%; min-width: 0; max-width: 720px; margin: 0 auto; padding: 4px 10px 24px; display: flex; flex-direction: column; gap: 8px; }
.mk-view.mk-has-act .mk-body { padding-bottom: 110px; }
.mk-players { display: flex; gap: 6px; overflow-x: auto; padding: 2px; }
.mk-pl {
  position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px;
  padding: 6px 6px; border-radius: 12px; background: var(--card); border: 2px solid transparent;
  border-top: 4px solid var(--sc); box-shadow: 0 1px 4px rgba(0,0,0,.08); transition: transform .2s;
}
.mk-pl.on { border-color: var(--sc); transform: translateY(-2px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 22%, transparent); }
.mk-pl { flex-direction: column; align-items: stretch; gap: 4px; }
.mk-pl-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mk-pl-face { position: relative; flex: none; display: grid; }
.mk-pl-top b { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
/* ⭐·🧺·🌳 — 좁은 칸(폰 4인)에서도 다 보이게: 붙여 쓰고, 그래도 모자라면 다음 줄로 */
.mk-pl-stat { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 5px; font-size: 11px; letter-spacing: -.3px; color: var(--on-surface-variant); }
.mk-pl-stat > * { white-space: nowrap; }
.mk-pl-stat b { font-size: 13px; color: #F57F17; }
.mk-pl-turn { position: absolute; top: -9px; right: 6px; font-style: normal; font-size: 10px; font-weight: 800; color: #fff; background: var(--sc); padding: 1px 6px; border-radius: 999px; }
.mk-ava {
  width: 28px; height: 28px; flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--sc) 15%, var(--card)); box-shadow: 0 0 0 2px var(--sc); font-weight: 800; color: var(--sc);
}
.mk-ava.letter { background: var(--sc); color: #fff; }
.mk-ava-emoji { font-size: 18px; line-height: 1; }
.mk-msg { display: flex; flex-wrap: wrap; justify-content: center; gap: 1px 10px; text-align: center; font-size: 12px; line-height: 1.35; min-height: 2.7em; align-content: center; }
.mk-msg > b, .mk-msg > .mk-last { flex-basis: 100%; }
.mk-msg b { color: var(--primary); font-size: 14px; }
.mk-note { color: var(--on-surface-variant); }
.mk-prod { color: #2E7D32; font-weight: 600; }
.mk-last { color: #E65100; font-weight: 800; }
.mk-sec h3 { font-size: 13px; margin: 0 0 4px; }
.mk-sec h3 small { font-size: 11px; font-weight: 500; color: var(--on-surface-variant); margin-left: 4px; }
.mk-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.mk-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0;
  padding: 8px 4px 7px; border-radius: 12px; border: 2px solid var(--surface-variant); background: var(--card);
  font: inherit; color: inherit; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s;
}
.mk-card.empty { color: var(--on-surface-variant); font-size: 12px; justify-content: center; border-style: dashed; cursor: default; min-height: 92px; }
.mk-card.can { border-color: #43A047; box-shadow: 0 0 0 2px color-mix(in srgb, #43A047 25%, transparent); }
.mk-card.sel, .mk-basket.sel { border-color: var(--primary); background: var(--primary-container); transform: translateY(-2px); }
.mk-card.flash, .mk-basket.flash { border-color: #FB8C00; box-shadow: 0 0 0 4px color-mix(in srgb, #FB8C00 35%, transparent); animation: mk-pulse .5s ease-in-out infinite alternate; }
.mk-card.idle, .mk-basket.idle { cursor: default; }
@keyframes mk-pulse { to { transform: scale(1.05); } }
.mk-face { font-size: 30px; line-height: 1.1; }
.mk-star { position: absolute; top: 4px; right: 5px; font-size: 12px; font-weight: 800; color: #F57F17; }
.mk-tree-ico { position: relative; font-size: 30px; line-height: 1.1; }
.mk-tree-ico i { position: absolute; right: -10px; bottom: -2px; font-style: normal; font-size: 16px; white-space: nowrap; }
.mk-tree-ico em { font-style: normal; font-size: 11px; font-weight: 900; color: #2E7D32; margin-left: -1px; }
.mk-tree.lv2 { background: color-mix(in srgb, #43A047 7%, var(--card)); }
.mk-yield { font-size: 10px; color: var(--on-surface-variant); }
.mk-cost { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 4px; font-size: 13px; font-weight: 700; }
.mk-c { color: #C62828; white-space: nowrap; }
.mk-c.ok { color: #2E7D32; }
.mk-baskets { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.mk-basket {
  display: flex; flex-direction: column; align-items: center; gap: 0; padding: 6px 2px 4px; border-radius: 14px;
  border: 2px solid var(--surface-variant); background: color-mix(in srgb, #8D6E63 10%, var(--card)); font: inherit; cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.mk-basket-fruits { font-size: 18px; letter-spacing: -2px; min-height: 1.3em; }
.mk-basket-ico { font-size: 26px; line-height: 1; }
.mk-me { background: var(--card); border-radius: 14px; padding: 8px 10px; border: 1px solid var(--surface-variant); }
.mk-me h3 + div { margin-bottom: 6px; }
.mk-limit.full { color: #C62828; font-weight: 800; }
.mk-hand { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.mk-fruit { display: flex; align-items: center; justify-content: center; gap: 3px; font-size: 19px; padding: 3px 0; border-radius: 10px; background: var(--surface-variant); }
.mk-fruit b { font-size: 15px; }
.mk-fruit.none { opacity: .4; }
.mk-mytrees { display: flex; flex-wrap: wrap; gap: 6px; }
.mk-mytree { font-size: 16px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, #43A047 12%, var(--card)); border: 1px solid color-mix(in srgb, #43A047 35%, transparent); }
.mk-empty { font-size: 12px; color: var(--on-surface-variant); }
/* 맨 아래 버튼(새 판·나가기) — 잘못 누르지 않게 채팅·내 과일에서 멀찍이 */
.mk-foot { text-align: center; margin-top: 22px; }
/* 💬 온라인 대국 중 방 채팅 (대기방 칸을 게임 화면으로 옮겨 씀 — shared/game-chat.ts) */
.room-chat.in-game { margin-top: 2px; gap: 6px; }
.room-chat.in-game::before { content: '💬 방 채팅'; font-weight: 800; font-size: 13px; }
.room-chat.in-game .chat-log { height: 130px; padding: 8px; }
.tv-view .room-chat.in-game { margin-top: 8px; }
.mk-market { display: contents; } /* 장터 줄들 — 가로 화면에서만 오른쪽 칸으로 묶임 */
/* 장터 카드 — 그림은 왼쪽, ⭐·값은 오른쪽 (낮게 — 폰 한 화면에 다 보이게) */
.mk-row .mk-card { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "ico star" "ico cost"; align-items: center; align-content: center; column-gap: 8px; row-gap: 1px; min-height: 52px; padding: 5px 6px 5px 8px; }
.mk-row .mk-face, .mk-row .mk-tree-ico { grid-area: ico; font-size: 28px; }
.mk-row .mk-tree-ico { margin-right: 10px; }
.mk-row .mk-star { grid-area: star; position: static; justify-self: start; }
.mk-row .mk-cost { grid-area: cost; justify-content: flex-start; }
.mk-row .mk-card.empty { display: flex; min-height: 52px; }
.mk-baskets .mk-basket { flex-direction: row; justify-content: center; min-height: 40px; padding: 4px 2px; }
.mk-baskets .mk-basket-ico { display: none; }
.mk-baskets .mk-basket-fruits { font-size: 20px; letter-spacing: -3px; }
.mk-actbar {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 10px); transform: translateX(-50%); z-index: 30;
  width: min(696px, calc(100vw - 20px)); box-sizing: border-box; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 16px; background: var(--card); box-shadow: 0 6px 24px rgba(0,0,0,.25); border: 1px solid var(--surface-variant);
}
.mk-act-text { flex: 1 1 100%; font-size: 14px; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.mk-act-text small { font-weight: 500; color: var(--on-surface-variant); }
.mk-act-text .mk-short { color: #C62828; font-weight: 700; }
.mk-actbar .primary-btn { flex: 1; margin: 0; }
@media (min-width: 600px) { .mk-face, .mk-tree-ico, .mk-row .mk-face, .mk-row .mk-tree-ico { font-size: 34px; } .mk-cost { font-size: 14px; } }
/* 🧺 과일 장터 — ❓ 게임 방법 */
.mk-view .game-header h2 { flex: 1; }
.mk-view .game-header .sfx-toggle { margin-left: 0; }
.mk-help-btn { flex: none; border: 1.5px solid var(--primary); background: none; color: var(--primary); font: inherit; font-size: 13px; font-weight: 800; padding: 5px 10px; border-radius: 999px; cursor: pointer; }
dialog.mk-help { width: min(400px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow-y: auto; box-sizing: border-box; padding: 22px 18px 16px; border: none; border-radius: 20px; background: var(--card); color: var(--on-surface); }
dialog.mk-help[open] { display: flex; flex-direction: column; gap: 12px; }
.mk-help-page { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; min-height: 300px; }
.mk-help-page h3 { font-size: 19px; margin: 6px 0 2px; }
.mk-help-page p { margin: 0; font-size: 15px; line-height: 1.5; }
.mk-help-page b.ok { color: #2E7D32; }
.mk-help-page b.no { color: #C62828; }
.mk-help-page b.flash { color: #EF6C00; }
.mk-help-art { min-height: 120px; display: grid; place-items: center; width: 100%; }
.mk-help-art .mk-card, .mk-help-art .mk-basket { width: 118px; cursor: default; }
.mk-help-big { font-size: 34px; letter-spacing: 2px; }
.mk-help-three { display: flex; gap: 10px; }
.mk-help-three span { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 38px; padding: 8px 10px; border-radius: 14px; background: var(--surface-variant); }
.mk-help-three small { font-size: 12px; font-weight: 700; line-height: 1.25; }
.mk-help-steps { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; }
.mk-help-tap { padding: 14px 16px; border-radius: 12px; border: 2px solid var(--primary); background: var(--primary-container); }
.mk-help-go { padding: 12px 18px; border-radius: 999px; background: var(--primary); color: #fff; }
.mk-help-again { margin-top: 6px !important; font-size: 13px !important; color: var(--on-surface-variant); }
.mk-help-dots { display: flex; justify-content: center; gap: 6px; }
.mk-help-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-variant); }
.mk-help-dots i.on { background: var(--primary); width: 20px; border-radius: 4px; }
.mk-help-nav { display: flex; align-items: center; gap: 10px; }
.mk-help-nav .primary-btn { flex: 1; margin: 0; }
@media (max-width: 480px) { .mk-view .mk-help-btn span { display: none; } .mk-view .mk-help-btn { padding: 5px 8px; } .mk-view .game-header h2 { font-size: 18px; white-space: nowrap; } }
/* 🧺 과일 장터 — 차례 순서 번호 · 🎲 순서 뽑기 · 📜 기록 */
/* 차례 순서 — 얼굴 오른쪽 아래 작은 번호 (이름 자리를 넉넉히) */
.mk-pl-ord { position: absolute; right: -5px; bottom: -4px; min-width: 15px; height: 15px; box-sizing: border-box; padding: 0 3px; display: grid; place-items: center; font-style: normal; font-size: 10px; font-weight: 900; line-height: 1; color: #fff; background: var(--sc); border-radius: 999px; box-shadow: 0 0 0 1.5px var(--card); }
.mk-note[data-log] { cursor: pointer; }
.mk-note u { text-decoration: none; font-size: 12px; }
.od-draw { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.45); cursor: pointer; animation: od-draw-in .2s ease-out; }
.od-draw[hidden] { display: none; }
@keyframes od-draw-in { from { opacity: 0; } }
.od-draw-box { width: min(340px, 100%); box-sizing: border-box; display: flex; flex-direction: column; gap: 8px; padding: 18px 16px 12px; border-radius: 20px; background: var(--card); color: var(--on-surface); box-shadow: 0 10px 30px rgba(0,0,0,.3); text-align: center; }
.od-draw-box h3 { margin: 0 0 4px; font-size: 19px; }
.od-draw-box > small { font-size: 11px; color: var(--on-surface-variant); }
.od-draw-list { display: flex; flex-direction: column; gap: 6px; }
.od-draw-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: var(--surface-variant); border: 2px solid transparent; transition: border-color .2s, background .2s; }
.od-draw-row > b { flex: 1; min-width: 0; text-align: left; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.od-draw-row.first { border-color: var(--sc); background: color-mix(in srgb, var(--sc) 14%, var(--card)); }
.od-draw-card { flex: none; min-width: 66px; height: 38px; box-sizing: border-box; display: grid; place-items: center; padding: 0 8px; border-radius: 10px; background: var(--card); border: 2px dashed var(--on-surface-variant); font-size: 22px; animation: od-draw-shake .18s ease-in-out infinite alternate; }
.od-draw-card.open { animation: od-draw-flip .3s ease-out; border: none; background: var(--sc); color: #fff; font-size: 15px; font-weight: 800; }
@keyframes od-draw-shake { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
@keyframes od-draw-flip { from { transform: rotateY(90deg) scale(.8); } }
.od-draw-msg { margin: 4px 0 0; font-size: 16px; font-weight: 800; color: var(--primary); min-height: 1.4em; }
dialog.mk-logdlg { width: min(420px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); box-sizing: border-box; padding: 18px 14px 12px; border: none; border-radius: 20px; background: var(--card); color: var(--on-surface); }
dialog.mk-logdlg[open] { display: flex; flex-direction: column; gap: 6px; }
.mk-logdlg > h3 { margin: 0 44px 0 2px; font-size: 18px; }
.mk-logdlg > h3 small { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); margin-left: 4px; }
.mk-log-list { overflow-y: auto; min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.mk-log-list h4 { margin: 6px 0 2px; font-size: 12px; color: var(--on-surface-variant); position: sticky; top: 0; background: var(--card); padding: 2px 0; z-index: 1; }
.mk-log-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.mk-log-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 10px; border-left: 4px solid var(--sc); background: color-mix(in srgb, var(--sc) 7%, var(--card)); font-size: 13px; line-height: 1.4; }
.mk-log-row .mk-ava { width: 24px; height: 24px; }
.mk-log-row .mk-ava-emoji { font-size: 15px; }
.mk-log-row > div { min-width: 0; display: flex; flex-direction: column; }
.mk-log-row b { color: var(--on-surface); }
.mk-log-row small { font-size: 11px; }
.mk-log-prod { color: #2E7D32; }
.mk-log-drop { color: var(--on-surface-variant); }
.mk-log-draw { margin: 8px 0 2px; font-size: 12px; color: var(--on-surface-variant); text-align: center; }

/* ── ✈️ 세계 여행 ── */
.tv-view .game-header h2 { flex: 1; }
.tv-view .game-header .sfx-toggle { margin-left: 0; }
.tv-body { box-sizing: border-box; width: 100%; min-width: 0; max-width: 640px; margin: 0 auto; padding: 8px 10px 24px; display: flex; flex-direction: column; gap: 10px; }
.tv-players { display: flex; gap: 6px; padding: 2px; }
.tv-money { color: #F57F17 !important; }
.tv-board {
  display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(7, 1fr); gap: 3px;
  aspect-ratio: 1; width: 100%; padding: 4px; box-sizing: border-box; border-radius: 16px;
  background: linear-gradient(135deg, color-mix(in srgb, #4FC3F7 25%, var(--card)), color-mix(in srgb, #81C784 25%, var(--card)));
}
.tv-cell {
  position: relative; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  padding: 2px 1px 1px; border-radius: 7px; background: var(--card); border: 1.5px solid var(--surface-variant); cursor: pointer;
  box-shadow: inset 0 4px 0 var(--rc, transparent);
}
.tv-cell.corner { background: color-mix(in srgb, #FFD54F 30%, var(--card)); }
.tv-cell.k-card { background: color-mix(in srgb, #F48FB1 22%, var(--card)); }
.tv-cell.owned { border-color: var(--oc); border-width: 2.5px; background: color-mix(in srgb, var(--oc) 12%, var(--card)); }
.tv-ico { font-size: clamp(14px, 4.6vw, 26px); line-height: 1.15; margin-top: 2px; }
.tv-name { font-size: clamp(7.5px, 2.15vw, 11px); font-weight: 700; line-height: 1.1; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tv-price { font-size: clamp(7.5px, 2.15vw, 11px); font-weight: 800; color: var(--on-surface-variant); line-height: 1.1; }
.tv-cell.owned .tv-price { color: var(--oc); }
/* 가게 주인 얼굴(오른쪽 위) · 내 가게는 더 진하게 · 선수 카드를 누르면 그 사람 가게만 밝게 */
.tv-own {
  position: absolute; top: 1px; right: 1px; width: clamp(12px, 3.6vw, 18px); height: clamp(12px, 3.6vw, 18px); border-radius: 50%;
  display: grid; place-items: center; overflow: hidden; background: var(--card); box-shadow: 0 0 0 1.5px var(--sc);
  font-size: clamp(7px, 2.2vw, 11px); font-weight: 800; color: var(--sc); line-height: 1; pointer-events: none;
}
.tv-own.letter { background: var(--sc); color: #fff; }
.tv-own .mk-ava-emoji { font-size: 1em; }
.tv-own .ava-photo { width: 100%; height: 100%; object-fit: cover; }
.tv-cell.mine { border-width: 3.5px; background: color-mix(in srgb, var(--oc) 26%, var(--card)); box-shadow: inset 0 4px 0 var(--rc, transparent), 0 0 0 2px color-mix(in srgb, var(--oc) 35%, transparent); }
.tv-board.tv-hl .tv-cell:not(.hl):not(.corner) { opacity: .35; }
.tv-board.tv-hl .tv-cell.hl { box-shadow: inset 0 4px 0 var(--rc, transparent), 0 0 0 3px var(--oc); }
.tv-players .mk-pl { cursor: pointer; }
.tv-players .mk-pl.hl { outline: 3px solid var(--sc); outline-offset: 1px; }
/* 🏪 내 가게 목록 */
.tv-mine { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; }
.tv-mine-head { font-weight: 800; font-size: 14px; }
.tv-mine-head small { font-weight: 600; font-size: 11px; color: var(--on-surface-variant); margin-left: 4px; }
.tv-mine-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding-left: 8px; border-left: 4px solid var(--rc); }
.tv-mine-reg { font-size: 11px; font-weight: 800; color: var(--rc); margin-right: 2px; }
.tv-shop { border: 1px solid color-mix(in srgb, var(--rc) 45%, var(--surface-variant)); background: color-mix(in srgb, var(--rc) 10%, var(--card)); color: inherit; font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 999px; cursor: pointer; }
.tv-shop b { font-weight: 800; }
.tv-toks { position: absolute; inset: 3px 0 auto 0; display: flex; justify-content: center; flex-wrap: wrap; gap: 0; pointer-events: none; }
.tv-tok {
  width: clamp(14px, 4.4vw, 22px); height: clamp(14px, 4.4vw, 22px); margin: 0 -2px; border-radius: 50%; display: grid; place-items: center; overflow: hidden;
  background: var(--card); box-shadow: 0 0 0 2px var(--sc), 0 2px 4px rgba(0,0,0,.3); font-size: clamp(9px, 2.8vw, 14px); font-weight: 800; color: var(--sc);
  transition: transform .15s; z-index: 1;
}
.tv-tok.letter { background: var(--sc); color: #fff; }
.tv-tok .mk-ava-emoji { font-size: inherit; }
.tv-center {
  grid-row: 2 / 7; grid-column: 2 / 7; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  padding: 6px; text-align: center; min-width: 0; min-height: 0; overflow: hidden;
}
.tv-round { font-size: 12px; font-weight: 800; color: var(--on-surface-variant); }
.tv-dice { font-size: clamp(40px, 13vw, 64px); line-height: 1; }
.tv-event { font-size: clamp(11px, 3.2vw, 13px); line-height: 1.35; min-height: 1.3em; }
.tv-card { font-weight: 700; color: #AD1457; }
.tv-plus { font-weight: 700; color: #2E7D32; }
.tv-minus { font-weight: 700; color: #C62828; }
.tv-prompt { font-size: clamp(12px, 3.5vw, 14px); line-height: 1.35; }
.tv-prompt small { color: var(--on-surface-variant); }
.tv-btns { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; }
.tv-btns .primary-btn { margin: 0; padding: 10px 18px; min-width: 0; }
.tv-roll { font-size: 17px; animation: tv-bounce 1s ease-in-out infinite; }
@keyframes tv-bounce { 50% { transform: translateY(-3px); } }
.tv-info { font-size: 11.5px; line-height: 1.35; color: var(--on-surface); background: color-mix(in srgb, var(--card) 85%, transparent); border-radius: 8px; padding: 0 6px; }
.tv-info:empty { display: none; }
.tv-info small { color: var(--on-surface-variant); }
.tv-help-dice { font-size: 54px; line-height: 1; }
.tv-help-cell { width: 84px; height: 84px; cursor: default; }
.tv-help-cell .tv-ico { font-size: 30px; }
.tv-help-cell .tv-name, .tv-help-cell .tv-price { font-size: 12px; }
.mk-help-three span:nth-child(4) { display: flex; }

/* ── 🖍️ 이어 그리기 ── */
.rl-view .game-header h2 { flex: 1; }
.rl-view .game-header .sfx-toggle { margin-left: 0; }
.rl-body { box-sizing: border-box; width: 100%; min-width: 0; max-width: 520px; margin: 0 auto; padding: 4px 12px 28px; display: flex; flex-direction: column; gap: 10px; }
.rl-top { display: flex; flex-direction: column; gap: 6px; }
.rl-step { font-weight: 800; font-size: 15px; text-align: center; }
.rl-step small { font-weight: 600; color: var(--on-surface-variant); }
.rl-timer { position: relative; height: 16px; border-radius: 999px; background: var(--surface-variant); overflow: hidden; }
.rl-timer[hidden] { display: none; }
.rl-sec { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--on-surface); }
.rl-timer i { display: block; height: 100%; width: 0; background: #43A047; border-radius: 999px; transition: width .2s linear; }
.rl-timer.low i { background: #E53935; }
.rl-people { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 2px 3px; }
.rl-arrow { color: var(--on-surface-variant); font-weight: 900; font-size: 13px; }
.rl-person.me .mk-ava { box-shadow: 0 0 0 2px var(--primary); }
.rl-person { position: relative; }
.rl-person.gone { opacity: .35; }
.rl-person i { position: absolute; right: -4px; bottom: -4px; font-style: normal; font-size: 11px; font-weight: 900; background: #43A047; color: #fff; border-radius: 50%; width: 15px; height: 15px; display: grid; place-items: center; }
.rl-person.gone i { background: none; }
.rl-main { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
.rl-ask { text-align: center; font-weight: 800; font-size: 16px; }
.rl-ask small { font-weight: 500; font-size: 12px; color: var(--on-surface-variant); }
.rl-prompt { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.rl-prompt small { font-size: 12px; color: var(--on-surface-variant); }
.rl-quote { text-align: center; font-size: 19px; font-weight: 800; padding: 8px 12px; border-radius: 14px; background: color-mix(in srgb, #FDD835 22%, var(--card)); }
.rl-blank { font-size: 14px; color: var(--on-surface-variant); font-weight: 600; }
.rl-pad { width: 100%; aspect-ratio: 1; border-radius: 14px; background: #fff; border: 2px solid var(--surface-variant); touch-action: none; display: block; box-sizing: border-box; }
.rl-pad.view { pointer-events: none; }
/* 폰 세로 — 그림판이 화면 높이에 맞게 (도구·버튼까지 한 화면에) */
.rl-main > .rl-pad { width: min(100%, max(240px, calc(100dvh - 390px))); align-self: center; }
.rl-page .rl-pad { width: min(100%, max(220px, calc(100dvh - 300px))); align-self: center; }
.rl-tools { display: flex; flex-direction: column; gap: 6px; }
.rl-colors, .rl-widths { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; align-items: center; }
.rl-widths .rl-done { flex: 1 1 120px; min-height: 36px; padding: 0 10px; font-size: 15px; margin: 0; }
.rl-color { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--card); background: var(--c); box-shadow: 0 0 0 1.5px var(--surface-variant); cursor: pointer; padding: 0; font-size: 16px; }
.rl-color.on { box-shadow: 0 0 0 3px var(--primary); transform: scale(1.1); }
.rl-eraser { background: #fff; }
.rl-width, .rl-tool { width: 36px; height: 34px; border-radius: 10px; border: 1.5px solid var(--surface-variant); background: var(--card); cursor: pointer; display: grid; place-items: center; font-size: 17px; padding: 0; }
.rl-width.on { border-color: var(--primary); background: var(--primary-container); }
.rl-width i { display: block; width: var(--s); height: var(--s); border-radius: 50%; background: var(--on-surface); }
.rl-write { display: flex; gap: 6px; }
.rl-text { flex: 1; min-width: 0; font: inherit; font-size: 17px; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--surface-variant); background: var(--card); color: var(--on-surface); }
.rl-text:focus { outline: none; border-color: var(--primary); }
.rl-idea { width: 50px; border-radius: 12px; border: 2px solid var(--surface-variant); background: var(--card); font-size: 22px; cursor: pointer; }
.rl-main .primary-btn { margin: 0; }
.rl-wait, .rl-lonely { text-align: center; padding: 30px 10px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.rl-wait-ico, .rl-lonely-ico { font-size: 54px; }
.rl-wait p, .rl-lonely p { margin: 0; font-size: 15px; line-height: 1.6; }
.rl-wait-n { font-weight: 800; color: var(--primary); }
.rl-album-head { text-align: center; font-size: 17px; }
.rl-album-head small { color: var(--on-surface-variant); margin-left: 4px; }
.rl-pages { display: flex; flex-direction: column; gap: 10px; }
.rl-page { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--surface-variant); }
.rl-page.new { animation: rl-pop .45s ease-out; border-color: var(--primary); }
@keyframes rl-pop { from { transform: scale(.92); opacity: 0; } }
.rl-page-who { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.rl-page-who small { color: var(--on-surface-variant); }
.rl-bubble { font-size: 19px; font-weight: 800; text-align: center; padding: 12px; border-radius: 14px; background: color-mix(in srgb, #FDD835 22%, var(--card)); }
.rl-bubble.blank { color: var(--on-surface-variant); font-weight: 600; font-size: 14px; background: var(--surface-variant); }
.rl-album-nav { display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding-bottom: 8px; }
.rl-end { text-align: center; font-weight: 800; font-size: 16px; }
.rl-hint { text-align: center; font-size: 13px; color: var(--on-surface-variant); padding: 8px; border-radius: 12px; background: var(--card); }
.mk-help-art .rl-bubble { font-size: 16px; }
/* ⚙️ 준비 — 순서·시간·점수 */
.rl-setup { display: flex; flex-direction: column; gap: 10px; }
.rl-card { background: var(--card); border: 1px solid var(--surface-variant); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.rl-card h3 { margin: 0; font-size: 15px; }
.rl-sub { margin: 0; font-size: 12px; color: var(--on-surface-variant); }
.rl-order, .rl-rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rl-order li, .rl-rank li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 12px; background: color-mix(in srgb, var(--surface-variant) 55%, var(--card)); }
.rl-order li.gone { opacity: .45; }
.rl-order li.me, .rl-rank li.me { box-shadow: inset 0 0 0 2px var(--primary); }
.rl-no { flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--on-primary, #fff); display: grid; place-items: center; font-size: 13px; }
.rl-oname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.rl-mv { flex: none; width: 38px; height: 32px; border-radius: 10px; border: 1.5px solid var(--surface-variant); background: var(--card); color: var(--on-surface); cursor: pointer; font-size: 14px; padding: 0; }
.rl-mv:disabled { opacity: .3; cursor: default; }
.rl-shuffle { align-self: center; }
.rl-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.rl-seg-btn { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; text-align: left; border-radius: 12px; border: 2px solid var(--surface-variant); background: var(--card); color: var(--on-surface); cursor: pointer; font: inherit; font-size: 14px; }
.rl-seg-btn small { font-size: 11px; color: var(--on-surface-variant); line-height: 1.3; }
.rl-seg-btn.on { border-color: var(--primary); background: var(--primary-container); }
.rl-seg-btn:disabled { cursor: default; }
.rl-seg-btn:disabled:not(.on) { opacity: .5; }
.rl-setup-go .primary-btn { width: 100%; margin: 0; }
/* 3·2·1 */
.rl-count { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 40px 10px; text-align: center; }
.rl-count-n { font-size: 96px; font-weight: 900; color: var(--primary); line-height: 1; }
.rl-count-n.pop { animation: rl-count .9s ease-out; }
@keyframes rl-count { from { transform: scale(1.8); opacity: 0; } 30% { opacity: 1; } to { transform: scale(1); } }
.rl-count p { margin: 0; font-size: 15px; line-height: 1.6; }
.rl-count small { color: var(--on-surface-variant); }
/* ⭐ 점수 주기 (누가 했는지 모르게) */
.rl-anon { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-variant); font-size: 16px; }
.rl-vote { display: flex; gap: 5px; align-items: center; }
.rl-vote-btn { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 6px 2px; border-radius: 12px; border: 2px solid var(--surface-variant); background: var(--card); color: var(--on-surface); font: inherit; font-size: 12px; line-height: 1.15; cursor: pointer; white-space: nowrap; }
.rl-vote-btn small { font-size: 11px; color: var(--on-surface-variant); }
.rl-vote-btn.on { border-color: #FB8C00; background: color-mix(in srgb, #FDD835 32%, var(--card)); }
.rl-vote-btn:disabled { opacity: .5; cursor: default; }
.rl-vote-n { flex: none; min-width: 30px; text-align: right; font-size: 11px; color: var(--on-surface-variant); white-space: nowrap; }
.rl-vote.mine { justify-content: space-between; font-size: 12px; color: var(--on-surface-variant); padding: 4px 2px; }
/* 🏆 결과 */
.rl-result { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.rl-trophy { font-size: 56px; line-height: 1; animation: rl-pop .5s ease-out; }
.rl-result h3 { margin: 0; font-size: 20px; }
.rl-rank { text-align: left; }
.rl-rank li { padding: 8px 10px; }
.rl-rank li.win { background: color-mix(in srgb, #FDD835 28%, var(--card)); box-shadow: inset 0 0 0 2px #FB8C00; }
.rl-rank li.win .rl-no { background: none; font-size: 18px; }
.rl-pts { font-size: 15px; white-space: nowrap; }
.rl-best { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--surface-variant); text-align: left; }
.rl-best .rl-pad { width: min(100%, 280px); align-self: center; }
.rl-end-row { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
/* 세계 여행 — 천천히 보여 주기: 차례 안내·주사위·걷는 말·내린 칸·지난 일 */
.tv-board { position: relative; }
.tv-banner {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 5;
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 18px 26px; border-radius: 20px;
  background: var(--card); border: 3px solid var(--sc); box-shadow: 0 10px 30px rgba(0,0,0,.25); animation: tv-banner-in .35s ease-out;
}
.tv-banner b { font-size: 20px; color: var(--sc); white-space: nowrap; }
.tv-banner[hidden] { display: none; }
@keyframes tv-banner-in { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.tv-banner-ava { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; overflow: hidden; background: var(--card); box-shadow: 0 0 0 3px var(--sc); font-size: 26px; font-weight: 800; color: var(--sc); }
.tv-banner-ava.letter { background: var(--sc); color: #fff; }
.tv-banner-ava .mk-ava-emoji { font-size: 34px; }
.tv-dice.spin { animation: tv-spin .25s linear infinite; }
@keyframes tv-spin { to { transform: rotate(360deg); } }
.tv-dice.pop { animation: tv-pop .45s ease-out; }
@keyframes tv-pop { 40% { transform: scale(1.45); } }
.tv-steps { font-size: 15px; color: var(--primary); }
.tv-event.big { font-size: clamp(13px, 3.8vw, 16px); font-weight: 700; padding: 6px 8px; border-radius: 12px; background: color-mix(in srgb, var(--card) 88%, transparent); box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.tv-tok.moving { transform: scale(1.45); z-index: 3; box-shadow: 0 0 0 3px var(--sc), 0 4px 10px rgba(0,0,0,.35); }
.tv-cell.land { animation: tv-land 1.5s ease-out; }
@keyframes tv-land { 0%, 60% { box-shadow: inset 0 4px 0 var(--rc, transparent), 0 0 0 4px #FFB300; transform: scale(1.08); z-index: 2; } }
.tv-log { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--surface-variant); font-size: 13px; line-height: 1.4; }
.tv-log:empty { display: none; }
.tv-log-head { font-weight: 800; font-size: 13px; color: var(--on-surface-variant); }
.tv-log-row { padding: 3px 0; border-top: 1px dashed var(--surface-variant); color: var(--on-surface-variant); }
.tv-log-row.new { color: var(--on-surface); font-weight: 600; }

/* ── ♠️ 포커 ── */
.pk-view .game-header h2 { flex: 1; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.pk-view .game-header .sfx-toggle { margin-left: 0; }
.pk-title { flex: none; white-space: nowrap; }
.pk-variant { min-width: 0; font-size: 12px; font-weight: 800; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-view { max-width: 640px; }
.pk-body { box-sizing: border-box; width: 100%; min-width: 0; margin: 0 auto; padding: 8px 10px 24px; display: flex; flex-direction: column; gap: 10px; }
/* 세로: 두 칸 묶음은 풀어서 상대 → 테이블 → 나 → 버튼 → 지난 일 → 아래 순 / 가로: 왼쪽 칸(상대·지난 일) · 오른쪽 칸 */
.pk-side, .pk-main { display: contents; }
.pk-opps { order: 1; } .pk-table { order: 2; } .pk-me { order: 3; } .pk-acts { order: 4; } .pk-log { order: 5; } .pk-foot { order: 6; }
/* 카드 — 폭(--cw)만 정하면 글자·무늬가 따라 커짐 */
.pk-card {
  --cw: 40px; position: relative; display: inline-block; flex: none; width: var(--cw); aspect-ratio: 5 / 7; box-sizing: border-box;
  border-radius: calc(var(--cw) * 0.13); background: #FFFFFF; color: #212121; border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22); user-select: none; -webkit-user-select: none; transition: transform 0.18s, box-shadow 0.18s;
}
.pk-card.red { color: #D32F2F; }
.pk-card b { position: absolute; left: 9%; top: 4%; font-size: calc(var(--cw) * 0.32); line-height: 1; font-weight: 900; letter-spacing: -0.04em; }
.pk-card i { position: absolute; left: 10%; top: 36%; font-style: normal; font-size: calc(var(--cw) * 0.24); line-height: 1; }
.pk-card em { position: absolute; right: 8%; bottom: 5%; font-style: normal; font-size: calc(var(--cw) * 0.52); line-height: 1; }
.pk-card.back {
  border: calc(var(--cw) * 0.07) solid #FFFFFF;
  background: repeating-linear-gradient(45deg, #3949AB 0 4px, #5C6BC0 4px 8px);
}
.pk-card.back::after { content: '♠'; position: absolute; inset: 0; display: grid; place-items: center; color: rgba(255, 255, 255, 0.55); font-size: calc(var(--cw) * 0.45); }
.pk-card.slot { background: rgba(255, 255, 255, 0.08); border: 2px dashed rgba(255, 255, 255, 0.35); box-shadow: none; }
.pk-card.fresh { animation: pk-deal 0.38s cubic-bezier(.2, .8, .3, 1.2) both; }
@keyframes pk-deal { from { transform: translateY(-34px) rotate(-8deg) scale(0.6); opacity: 0; } }
.pk-card.best { box-shadow: 0 0 0 3px #FFC107, 0 4px 10px rgba(255, 193, 7, 0.5); transform: translateY(-3px); }
.pk-cards { display: flex; justify-content: center; gap: 6px; flex-wrap: nowrap; min-height: 0; }
.pk-cards.sm { gap: 0; }
.pk-cards.sm .pk-card { --cw: 24px; }
.pk-cards.sm .pk-card + .pk-card { margin-left: -7px; }
.pk-cards.sm .pk-card i { display: none; }
.pk-cards.sm .pk-card b { font-size: calc(var(--cw) * 0.4); }
.pk-cards.lg .pk-card { --cw: clamp(50px, 15.5vw, 74px); }
.pk-view[data-variant=stud] .pk-cards.lg { gap: 4px; }
.pk-view[data-variant=stud] .pk-cards.lg .pk-card { --cw: clamp(38px, 11.6vw, 62px); }
.pk-cards.lg .pk-card.down { background: #EEF1FA; }
.pk-cards.lg .pk-card.down::before { content: '🔒'; position: absolute; right: 6%; top: 4%; font-size: calc(var(--cw) * 0.2); opacity: 0.6; }
.pk-cards.lg .pk-card.up::before { content: '👀'; position: absolute; right: 6%; top: 4%; font-size: calc(var(--cw) * 0.2); }
.pk-cards.pick .pk-card { cursor: pointer; }
.pk-cards.pick .pk-card:active { transform: scale(0.96); }
.pk-cards .pk-card.sel { transform: translateY(-8px); box-shadow: 0 0 0 3px #E53935, 0 6px 12px rgba(229, 57, 53, 0.35); }
.pk-cards .pk-card.sel::after { content: '바꿈'; position: absolute; left: 50%; bottom: -9px; translate: -50% 0; font-size: 10px; font-weight: 800; color: #fff; background: #E53935; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.pk-cards.folded .pk-card { opacity: 0.4; filter: grayscale(0.6); }
.pk-cards.help { gap: 3px; }
.pk-cards.help .pk-card { --cw: 34px; }
/* 상대 자리 */
.pk-opps { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 8px 6px; padding-top: 8px; }
.pk-opps[data-n="1"] { grid-template-columns: minmax(150px, 220px); justify-content: center; }
.pk-seat {
  position: relative; display: flex; flex-direction: column; align-items: stretch; gap: 4px; min-width: 0; padding: 6px 6px 5px;
  border-radius: 12px; background: var(--card); border: 2px solid transparent; border-top: 4px solid var(--sc); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s, opacity 0.2s;
}
.pk-seat.on { border-color: var(--sc); transform: translateY(-2px); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 22%, transparent); }
.pk-seat.fold { opacity: 0.55; }
.pk-seat.out { opacity: 0.45; }
.pk-seat.win, .pk-me.win { box-shadow: 0 0 0 3px #FFC107, 0 4px 14px rgba(255, 193, 7, 0.4); }
.pk-seat-top, .pk-me-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pk-seat-top b { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pk-seat-chips { display: flex; align-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
.pk-seat-chips b, .pk-me-chips b { color: #F57F17; font-size: 14px; }
.pk-seat .pk-cards { min-height: 34px; align-items: center; }
.pk-tag { min-height: 15px; text-align: center; font-size: 11.5px; font-weight: 700; color: var(--on-surface-variant); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pk-seat.on .pk-tag { color: var(--sc); }
.pk-d { flex: none; margin-left: auto; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 50%; background: #FFFFFF; color: #212121; border: 2px solid #212121; font-style: normal; font-size: 10px; font-weight: 900; }
.pk-bet { font-size: 11px; font-weight: 800; color: #E65100; background: #FFE0B2; padding: 0 6px; border-radius: 999px; }
.pk-bet::before { content: '베팅 '; font-weight: 600; }
.pk-won { color: #2E7D32; font-weight: 900; }
:root[data-theme=dark] .pk-won { color: #81C784; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .pk-won { color: #81C784; } }
/* 테이블 */
.pk-table {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 10px 12px; border-radius: 22px; color: #FFFFFF; text-align: center;
  background: radial-gradient(ellipse at 50% 35%, #388E3C, #1B5E20 75%); border: 6px solid #6D4C41; box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.35), 0 2px 6px rgba(0, 0, 0, 0.2);
}
.pk-info { font-size: 12px; font-weight: 700; opacity: 0.85; }
.pk-pot { display: flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 700; }
.pk-pot b { color: #FFD54F; font-size: 19px; }
.pk-chip { width: 16px; height: 16px; border-radius: 50%; background: #E53935; border: 3px dashed #FFFFFF; box-sizing: border-box; }
.pk-board { display: flex; justify-content: center; gap: 5px; }
.pk-board[hidden] { display: none; }
.pk-board .pk-card { --cw: clamp(44px, 14vw, 64px); }
.pk-msg { min-height: 1.4em; font-size: 14px; line-height: 1.45; }
.pk-msg small { opacity: 0.85; }
.pk-msg b[style] { filter: brightness(1.6) saturate(0.8); }
/* 나 */
.pk-me {
  display: flex; flex-direction: column; gap: 8px; padding: 8px 10px 10px; border-radius: 14px; background: var(--card);
  border: 2px solid transparent; border-top: 4px solid var(--sc); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}
.pk-me.on { border-color: var(--sc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc) 22%, transparent); }
.pk-me-top b { font-size: 14px; }
.pk-me-top .pk-d { margin-left: 0; }
.pk-me-chips { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 13px; }
.pk-me .pk-cards { padding-top: 4px; }
.pk-hand { text-align: center; font-size: 14px; color: var(--on-surface-variant); min-height: 1.3em; }
.pk-hand b { color: var(--on-surface); }
.pk-out { text-align: center; padding: 14px 0; font-size: 14px; color: var(--on-surface-variant); }
/* 행동 */
.pk-acts { display: flex; flex-direction: column; gap: 6px; }
.pk-acts:empty { display: none; }
.pk-acts .primary-btn { margin: 0; height: auto; }
.pk-acts > .primary-btn { width: 100%; padding: 13px; font-size: 16px; }
.pk-btns { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 8px; }
.pk-btns button { padding: 13px 4px; font: inherit; font-size: 15px; font-weight: 800; border-radius: 14px; cursor: pointer; }
.pk-fold { border: 2px solid #E57373; background: var(--card); color: #C62828; }
.pk-raise-btn { border: none; background: #FB8C00; color: #FFFFFF; }
.pk-btns .pk-call { margin: 0; }
.pk-raise { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 14px; background: var(--card); border: 2px solid #FB8C00; }
.pk-raise-row { display: flex; align-items: center; justify-content: center; gap: 10px; }
.pk-raise-row .primary-btn { flex: 1; padding: 12px; font-size: 16px; }
.pk-step { width: 46px; height: 46px; border-radius: 50%; border: 2px solid var(--surface-variant); background: var(--surface); color: var(--on-surface); font: inherit; font-size: 24px; font-weight: 900; cursor: pointer; }
.pk-step:disabled { opacity: 0.35; }
.pk-raise-amt { min-width: 120px; display: flex; flex-direction: column; align-items: center; font-size: 24px; font-weight: 900; color: #E65100; }
.pk-raise-amt small { font-size: 12px; font-weight: 700; color: var(--on-surface-variant); }
.pk-quick { display: flex; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pk-quick button { padding: 6px 12px; border-radius: 999px; border: 1.5px solid var(--surface-variant); background: var(--surface); color: var(--on-surface); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.pk-timer { text-align: center; font-size: 13px; font-weight: 800; color: #E53935; min-height: 1em; }
.pk-timer:empty { display: none; }
/* 지난 일 · 아래 */
.pk-log { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; border-radius: 12px; background: var(--surface-variant); font-size: 12.5px; line-height: 1.45; }
.pk-log:empty { display: none; }
.pk-log-row { color: var(--on-surface-variant); }
.pk-log-row.new { color: var(--on-surface); font-weight: 700; }
.pk-log-hand { color: var(--on-surface); }
.pk-foot { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 10px; }
.pk-vars { display: flex; gap: 4px; padding: 3px; border-radius: 999px; background: var(--surface-variant); }
.pk-vars[hidden] { display: none; }
.pk-var { border: none; background: none; color: var(--on-surface-variant); font: inherit; font-size: 12.5px; font-weight: 800; padding: 6px 10px; border-radius: 999px; cursor: pointer; white-space: nowrap; }
.pk-var.on { background: var(--card); color: var(--primary); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
/* 도움말 */
.pk-ranks-list { display: flex; flex-direction: column; gap: 3px; width: 100%; padding-top: 26px; }
.pk-rank-row { display: grid; grid-template-columns: 7.4em auto 1fr; align-items: center; gap: 6px; text-align: left; font-size: 11.5px; }
.pk-rank-row b { font-size: 11.5px; line-height: 1.15; }
.pk-rank-row small { font-size: 10.5px; color: var(--on-surface-variant); line-height: 1.2; }
.pk-rank-row .pk-cards { gap: 1px; justify-content: flex-start; }
.pk-rank-row .pk-cards.help .pk-card { --cw: 22px; }
.pk-rank-row .pk-card i { display: none; }
.pk-rank-row .pk-card b { font-size: calc(var(--cw) * 0.42); }
.pk-help-holdem { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; font-size: 20px; font-weight: 900; }
.pk-help-holdem .pk-card { --cw: 30px; }

/* ── 폰 가로 화면 (높이가 낮음) ─────────────────
   판 게임은 판을 오른쪽에 화면 높이만큼, 머리줄·정보·버튼은 왼쪽 칸에 (index.html .land-split / .land-board).
   판이 아래로 밀려 스크롤해야 보이던 문제. */
@media (orientation: landscape) and (max-height: 540px) {
  main.land-split {
    --land-h: calc(100dvh - 8px);
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: repeat(30, auto) 1fr; /* 판이 왼쪽 줄들을 늘리지 않게 — 남는 높이는 마지막 1fr 줄로 */
    align-content: start;
    column-gap: 8px;
    min-height: 100dvh;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    box-sizing: border-box;
  }
  main.land-split > * { grid-column: 1; min-width: 0; }
  main.land-split > .land-board {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: start;
    position: sticky;
    top: 0;
    width: min(var(--land-h), 62vw);
    padding: 4px;
    box-sizing: border-box;
  }
  main.land-split > .primary-btn { margin: 8px 8px 12px; }
  main.land-split .game-header { padding: 6px 4px; }
  main.land-split .hud { padding-top: 0; }
  /* 판 모양이 정사각형이 아닌 것 */
  #janggi-view > .land-board { width: min(calc(var(--land-h) * 0.9), 62vw); }
  #tictactoe-view > .land-board { width: min(calc(var(--land-h) - 24px), 62vw); margin: 12px; padding: 0; }
  #yut-view > .land-board { padding: 4px; }

  /* 혼자 게임 — 머리줄·점수는 왼쪽 위, 판은 오른쪽 */
  .solo-view {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(0, 2.2fr);
    grid-template-rows: auto 1fr;
    align-items: start;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    box-sizing: border-box;
  }
  .solo-view > .game-header { grid-column: 1; grid-row: 1; padding: 6px 4px; flex-wrap: wrap; }
  .solo-view > .solo-hud { grid-column: 1; grid-row: 2; align-self: start; flex-direction: column; align-items: stretch; padding: 4px 8px; }
  .solo-view > .solo-body { grid-column: 2; grid-row: 1 / span 2; padding: 8px 4px; }
  .solo-view .game-header h2 { font-size: 17px; word-break: keep-all; }
  /* 판 크기 — 세로 화면은 위 머리줄·점수 줄 높이를 빼지만 가로는 판 아래 버튼·설명만 */
  .g2048-board { width: min(92vw, 440px, calc(100dvh - 110px)); }
  .sg-board { width: min(94vw, 460px, calc((100dvh - 110px) * var(--cols) / var(--rows))); }
  .sl-board { width: min(92vw, 420px, calc(100dvh - 110px)); }
  .mn-board { width: min(94vw, 440px, calc((100dvh - 100px) * var(--cols) / var(--rows))); }
  .fl-board { width: min(94vw, 440px, calc(100dvh - 120px)); }
  .fc-board { width: min(94vw, 480px, calc(100dvh - 120px)); }
  .fc-sizes { flex-wrap: wrap; }
  /* 비밀 코드 · 코드 대결 — 판 높이에 맞춰 말을 작게 */
  .solo-view .cb-board, .cd-view .cb-board { --peg: min(28px, calc((100dvh - 110px) / 12)); gap: 1px; }
  .solo-body:has(> .cb-board) { flex-direction: row; justify-content: center; align-items: flex-start; gap: 14px; }
  .cb-side .cb-msg { margin-top: 0; }
  .cd-main { flex-direction: row; align-items: flex-start; justify-content: center; gap: 16px; }
  .cd-side { width: auto; max-width: 360px; }
  .pr-grid { width: min(94vw, 420px, calc((100dvh - 100px) * 0.8)); }
  .sm-pads { width: min(86vw, 380px, calc(100dvh - 130px)); }
  .sn-wrap { width: min(94vw, 420px, calc((100dvh - 90px) * var(--cols) / var(--rows))); }
  .bd-boardbox { width: min(64vw, 300px, calc((100dvh - 60px) / 2)); }
  .jp-wrap { width: min(94vw, 420px, calc((100dvh - 90px) * 3 / 4)); }
  .mz-wrap { width: min(94vw, 400px, calc((100dvh - 90px) * var(--cols) / var(--rows))); }
  /* 방향 버튼은 판 옆에 (스네이크·미로) */
  .solo-body:has(> .sn-pad), .solo-body:has(> .mz-pad) { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 16px; }
  .solo-body > .sn-pad, .solo-body > .mz-pad { margin-top: 0; }
  .solo-body:has(> .sn-pad) > p, .solo-body:has(> .mz-pad) > p { flex-basis: 100%; }
  .rn-wrap, .rn-pad { width: min(100%, 560px, calc((100dvh - 96px) / 0.62)); }
  .tl-wrap { width: min(92vw, 420px, calc(100dvh - 130px)); }
  .cp-wrap { width: min(92vw, 400px, calc((100dvh - 140px) * var(--cols) / var(--rows))); }
  /* 게임 방법 창 — 낮은 화면에 맞게 줄임 */
  dialog.mk-help { max-height: calc(100dvh - 16px); padding: 14px 16px 12px; gap: 8px; }
  .mk-help-page { min-height: 0; }
  .mk-help-art { min-height: 0; }

  /* ✈️ 세계 여행 — 판은 오른쪽에 화면 높이만큼, 머리줄·선수·지난 일은 왼쪽 */
  .tv-view {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: repeat(8, auto) 1fr;
    align-content: start;
    column-gap: 10px;
    min-height: 100dvh;
    padding-left: max(8px, env(safe-area-inset-left));
    padding-right: max(4px, env(safe-area-inset-right));
    box-sizing: border-box;
  }
  .tv-view > .tv-body { display: contents; }
  .tv-view > .game-header, .tv-view .tv-players, .tv-view .tv-mine, .tv-view .tv-log, .tv-view .room-chat, .tv-view .mk-foot { grid-column: 1; min-width: 0; }
  .tv-view .tv-mine { margin-top: 8px; }
  .tv-own { width: clamp(12px, 3.6dvh, 18px); height: clamp(12px, 3.6dvh, 18px); font-size: clamp(7px, 2.2dvh, 11px); }
  .tv-view > .game-header { padding: 6px 4px; }
  .tv-view .tv-players { flex-wrap: wrap; }
  .tv-view .tv-players > * { flex: 1 1 calc(50% - 6px); }
  .tv-view .tv-log { margin-top: 8px; }
  .tv-view .tv-board {
    grid-column: 2; grid-row: 1 / -1; align-self: start; position: sticky; top: 4px;
    width: min(calc(100dvh - 8px), 64vw); margin: 4px 0;
  }
  .tv-ico { font-size: clamp(14px, 5.2dvh, 24px); }
  .tv-name, .tv-price { font-size: clamp(7.5px, 2.4dvh, 11px); }
  .tv-tok { width: clamp(14px, 4.8dvh, 22px); height: clamp(14px, 4.8dvh, 22px); font-size: clamp(9px, 3dvh, 14px); }
  .tv-dice { font-size: clamp(36px, 12dvh, 56px); }

  /* 🧺 과일 장터 — 장터 줄들은 오른쪽에 화면 높이만큼, 머리줄·선수·내 과일은 왼쪽 */
  .mk-view {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
    grid-template-rows: repeat(6, auto) 1fr;
    align-content: start;
    column-gap: 12px;
    row-gap: 6px;
    min-height: 100dvh;
    padding: 0 max(4px, env(safe-area-inset-right)) 10px max(8px, env(safe-area-inset-left));
    box-sizing: border-box;
  }
  .mk-view.mk-has-act { padding-bottom: 110px; }
  .mk-view > .game-header { grid-column: 1; grid-row: 1; padding: 4px 2px; min-width: 0; }
  .mk-view > .mk-body { display: contents; }
  .mk-body > * { grid-column: 1; min-width: 0; }
  .mk-body > .mk-market { grid-column: 2; grid-row: 1 / -1; align-self: start; position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; padding-top: 4px; }
  .mk-view .mk-help-btn span { display: none; }
  .mk-view .mk-help-btn { padding: 4px 8px; }
  .mk-view .game-header h2 { font-size: 17px; white-space: nowrap; }
  .mk-players { flex-wrap: wrap; }
  .mk-players > * { flex: 1 1 calc(50% - 6px); }
  .mk-pl { padding: 4px 8px; }
  .mk-msg { min-height: 0; }
  .mk-market .mk-sec h3 { font-size: 12px; margin: 0 0 2px; }
  .mk-market .mk-sec h3 small { font-size: 10px; }
  .mk-row .mk-card, .mk-row .mk-card.empty { min-height: 0; padding: 3px 6px; }
  .mk-row .mk-face, .mk-row .mk-tree-ico { font-size: clamp(20px, 6.5dvh, 28px); }
  .mk-row .mk-cost { font-size: 13px; }
  .mk-baskets .mk-basket { min-height: 0; padding: 3px 2px; }
  .mk-baskets .mk-basket-fruits { font-size: clamp(15px, 5dvh, 20px); }
  .mk-fruit { font-size: 17px; padding: 2px 0; }
  .mk-actbar { left: max(10px, env(safe-area-inset-left)); transform: none; width: calc(40vw - 16px); }

  /* 🖍️ 이어 그리기 — 그림판(그리기·맞히기)은 오른쪽에 화면 높이만큼, 안내·도구·버튼은 왼쪽 */
  .rl-view { max-width: none; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(4px, env(safe-area-inset-right)); box-sizing: border-box; }
  .rl-body { max-width: 900px; }
  .rl-body:has(> .rl-main > .rl-pad) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: repeat(8, auto) 1fr;
    align-content: start;
    column-gap: 14px;
    row-gap: 8px;
  }
  .rl-body:has(> .rl-main > .rl-pad) > .rl-main { display: contents; }
  .rl-body:has(> .rl-main > .rl-pad) > .rl-top, .rl-main > * { grid-column: 1; min-width: 0; }
  .rl-main > .rl-pad { grid-column: 2; grid-row: 1 / -1; align-self: start; width: min(calc(100dvh - 76px), 56vw); }
  .rl-page .rl-pad { width: min(100%, calc(100dvh - 120px)); align-self: center; }
  .rl-pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .rl-page .rl-pad { width: min(100%, calc(100dvh - 170px)); }
  .rl-setup { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .rl-setup-go { grid-column: 1 / -1; }
  .rl-card { padding: 10px; gap: 6px; }
  .rl-order li { padding: 3px 8px; }
  .rl-mv { height: 28px; }
  .rl-count { padding: 12px 10px; }
  .rl-count-n { font-size: 72px; }
  .rl-result { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; column-gap: 14px; }
  .rl-result > * { grid-column: 1; }
  .rl-result > .rl-best { grid-column: 2; grid-row: 1 / span 4; }
  .rl-best .rl-pad { width: min(100%, calc(100dvh - 130px)); }
  .rl-trophy { font-size: 40px; }
  /* 포커 — 왼쪽: 상대 자리·지난 일 / 오른쪽: 테이블·내 카드·버튼 */
  .pk-view { max-width: none; }
  .pk-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); align-items: start; gap: 10px 12px; padding: 4px 12px 12px; }
  .pk-side, .pk-main { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
  .pk-opps { grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); padding-top: 4px; }
  .pk-table { padding: 6px 8px 8px; gap: 3px; border-width: 5px; }
  .pk-me { padding: 6px 10px 8px; gap: 4px; }
  .pk-board .pk-card { --cw: min(44px, 10.5dvh); }
  .pk-cards.lg .pk-card { --cw: min(56px, 13dvh); }
  .pk-view[data-variant=stud] .pk-cards.lg .pk-card { --cw: min(48px, 11.5dvh); }
  .pk-btns button, .pk-acts > .primary-btn { padding: 9px 4px; }
  .pk-msg { font-size: 13px; }
}
.od-draw-row .dv-ava { width: 30px; height: 30px; flex: none; font-size: 13px; }
