/* 로보77 — 화면
   색은 전부 아래 토큰으로만 쓴다. 라이트/다크는 토큰 값만 갈아끼운다. */

:root, [data-theme="light"] {
  color-scheme: light;

  --bg: #e6ecea;
  --bg-glow: #f7faf9;
  --surface: #f7faf9;      /* 패널 */
  --surface-2: #edf2f0;    /* 입력창 · 좌석처럼 오목한 것 */
  --surface-3: #f7faf9;    /* 버튼 */
  --surface-4: #dde5e2;    /* 버튼 hover · 배지 */
  --line: #c9d4d0;

  --ink: #1b2320;
  --dim: #5d6b66;
  --faint: #8a9893;

  --gold: #c2681c;
  --gold-2: #e0862f;
  --gold-ink: #fff7ef;
  --gold-soft: rgba(194, 104, 28, .12);
  --gold-line: rgba(194, 104, 28, .3);

  --heart: #d93b57;
  --heart-off: #c3cfca;
  --ok: #2f9e63;
  --safe: #8fa39c;
  --danger-ink: #b03047;
  --danger-line: #e4cfd2;

  /* 상판 — 펠트가 아니라 금속판. 로봇이 카드를 돌리는 작업대에 가깝다 */
  --table: #dfe3ea;
  --table-2: #ccd2dd;
  --table-3: #b9c1cf;
  --table-line: #c1c8d5;

  --back-a: #9fb0aa;        /* 카드 뒷면 줄무늬 */
  --back-b: #91a29c;
  --back-line: #83958e;
  --back-ink: rgba(20, 35, 30, .32);

  --mini-a: #aebdb7;
  --mini-b: #9fafa9;
  --mini-line: #8c9d96;

  --scrim: rgba(30, 45, 40, .55);
  --shadow: 0 1px 0 #fff inset, 0 6px 24px rgba(30, 50, 45, .13);
  --card-shadow: 0 3px 10px rgba(30, 50, 45, .22);
  --card-inset: inset 0 -3px 0 rgba(0, 0, 0, .08);
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: #0e1116;
  --bg-glow: #1c2531;
  --surface: #151a22;
  --surface-2: #0d1117;
  --surface-3: #1c222c;
  --surface-4: #232b37;
  --line: #262e3a;

  --ink: #e8edf4;
  --dim: #8d99ab;
  --faint: #6f7c8f;

  --gold: #f0b429;
  --gold-2: #ffd257;
  --gold-ink: #21170a;
  --gold-soft: rgba(240, 180, 41, .13);
  --gold-line: rgba(240, 180, 41, .25);

  --heart: #ff4d6d;
  --heart-off: #39414f;
  --ok: #35d07f;
  --safe: #7d8ea8;
  --danger-ink: #ff8b9a;
  --danger-line: #3a2530;

  --table: #1e242f;
  --table-2: #141922;
  --table-3: #0d1017;
  --table-line: #2b3442;

  --back-a: #1b2a3a;
  --back-b: #16232f;
  --back-line: #23354a;
  --back-ink: rgba(255, 255, 255, .22);

  --mini-a: #2c3f54;
  --mini-b: #243445;
  --mini-line: #35485f;

  --scrim: rgba(8, 11, 15, .74);
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --card-shadow: 0 4px 12px rgba(0, 0, 0, .45);
  --card-inset: inset 0 -3px 0 rgba(0, 0, 0, .12);
}

/* 카드 앞면 색 — 두 테마 공통 */
:root {
  --c-plain: #ffffff;
  --c-zero: #d7dde8;
  --c-big: #6f7dff;
  --c-minus: #ff5a5f;
  --c-s76: #b45cff;
  --c-x2: #ffc531;
  --c-rev: #24d3c4;
  --c-ink: #14181f;

  --r: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Pretendard',
        'Noto Sans KR', 'Segoe UI', sans-serif;
  overscroll-behavior: none;
}
body {
  background: radial-gradient(900px 600px at 50% -10%, var(--bg-glow) 0%, transparent 60%), var(--bg);
  transition: background-color .2s, color .2s;
}

button, input { font: inherit; color: inherit; }
b { font-weight: 700; }
.hidden { display: none !important; }
.muted { color: var(--dim); }
.small { font-size: 13px; }
.center { text-align: center; }
.spacer { flex: 1; }

/* ───────── 화면 전환 ───────── */
.screen { display: none; min-height: 100dvh; }
.screen.on { display: flex; flex-direction: column; }

/* ───────── 버튼 ───────── */
.btn {
  border: 1px solid var(--line);
  background: var(--surface-3);
  border-radius: 11px;
  padding: 10px 16px;
  cursor: pointer;
  transition: transform .08s, background .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--surface-4); }
.btn:active { transform: translateY(1px); }
.btn.big {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: var(--gold-ink);
  border: none;
  box-shadow: 0 6px 18px var(--gold-soft);
}
.btn.big:hover { filter: brightness(1.06); }
.btn.big:disabled { background: var(--surface-4); color: var(--faint); box-shadow: none; cursor: not-allowed; filter: none; }
.btn.wide { width: 100%; padding: 12px; }
.btn.ghost { background: transparent; color: var(--dim); }
.btn.ghost:hover { background: var(--surface-4); color: var(--ink); }
.btn.ghost.small { padding: 6px 11px; font-size: 13px; }
.btn.ghost.icon { padding: 6px 9px; }
.btn.danger { color: var(--danger-ink); border-color: var(--danger-line); }
.btn.link {
  background: none; border: none; color: var(--dim);
  text-decoration: underline; text-underline-offset: 3px; padding: 8px;
}
.btn.link:hover { color: var(--ink); background: none; }

/* ───────── 토글 ───────── */
.toggle {
  flex: none; width: 50px; height: 29px; border-radius: 999px;
  background: var(--surface-4); border: 1px solid var(--line);
  cursor: pointer; position: relative; transition: background .18s;
}
.toggle span {
  position: absolute; top: 2px; left: 2px; width: 23px; height: 23px;
  border-radius: 50%; background: var(--surface); transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.toggle[aria-checked="true"] { background: var(--ok); border-color: transparent; }
.toggle[aria-checked="true"] span { transform: translateX(21px); background: #fff; }
.toggle.sm { width: 42px; height: 24px; }
.toggle.sm span { width: 19px; height: 19px; }
.toggle.sm[aria-checked="true"] { background: var(--gold); }
.toggle.sm[aria-checked="true"] span { transform: translateX(18px); }

.theme-switch {
  position: fixed; top: 16px; right: 16px; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; box-shadow: var(--shadow);
}
.ts-ico { font-size: 13px; color: var(--faint); line-height: 1; }

/* ───────── 타이틀 ───────── */
#title { align-items: center; justify-content: center; padding: 24px; }
.hero { width: 100%; max-width: 380px; text-align: center; }

/* 카드 부채 — 실제 게임 카드를 펼쳐 놓은 모양 */
.fan {
  display: flex; justify-content: center; align-items: flex-end;
  height: 108px; margin-bottom: 22px;
}
/* 겹쳐도 값이 읽히게 숫자를 카드 위쪽에 둔다 */
.fc {
  position: relative;
  width: 62px; height: 88px; margin: 0 -7px;
  border-radius: 10px;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 11px;
  font-size: 21px; font-weight: 800;
  background: var(--c-plain); color: var(--c-ink);
  box-shadow: var(--card-shadow), var(--card-inset);
  /* 다섯 장이 맨 왼쪽 카드 자리·각도에 포개져 있다가, 맨 왼쪽 카드를 위에 둔 채
     그 밑에서 오른쪽으로 부채처럼 빠져나온다. 왼쪽 카드일수록 z-index 가 높아 늘 위.
     translate/rotate 는 개별 속성이라 transform(자기 자리)과 겹치지 않고 그 위에 얹힌다.
     --sx/--sy 는 첫 카드 자리까지의 거리(카드 폭 62 - 겹침 14 = 48px 간격) */
  transform: rotate(var(--r)) translateY(var(--dy));
  animation: gather .6s cubic-bezier(.3,.7,.3,1) var(--d, 0s) backwards, bob 4.6s ease-in-out calc(var(--d, 0s) + .7s) infinite;
  transform-origin: 50% 120%;
}
@keyframes gather { from { translate: var(--sx) var(--sy); rotate: calc(-17deg - var(--r)); } 60% { rotate: calc((-17deg - var(--r)) * .25); } }
.fc.minus { background: var(--c-minus); color: #fff; --r: -17deg; --dy: 12px; --d: 0s;   --sx: 0px;    --sy: 0px;  z-index: 5; }
.fc.x2    { background: var(--c-x2);              --r: -8deg;  --dy: 3px;  --d: 0s;   --sx: -48px;  --sy: 9px;  z-index: 4; }
.fc.s76   { background: var(--c-s76);  color: #fff; --r: 0deg;   --dy: -4px; --d: .08s; --sx: -96px;  --sy: 16px; z-index: 3; }
.fc.rev   { background: var(--c-rev);             --r: 8deg;   --dy: 3px;  --d: .16s; --sx: -144px; --sy: 9px;  z-index: 2; font-size: 28px; }
.fc.big   { background: var(--c-big);  color: #fff; --r: 17deg;  --dy: 12px; --d: .24s; --sx: -192px; --sy: 0px;  z-index: 1; }
@keyframes bob { 0%, 100% { margin-top: 0; } 50% { margin-top: -9px; } }
@media (prefers-reduced-motion: reduce) { .fc { animation: none; } }

.logo { font-size: 52px; letter-spacing: -2px; font-weight: 800; line-height: 1; }
.logo .seventy {
  color: var(--gold);
  text-shadow: 0 3px 0 var(--gold-soft);
}
.tag { color: var(--dim); font-size: 14px; margin-top: 10px; }
.hero-hearts { margin-top: 14px; letter-spacing: 5px; font-size: 17px; color: var(--heart); }
.hero-hearts span { display: inline-block; animation: beat 2.4s ease-in-out infinite; }
.hero-hearts span:nth-child(2) { animation-delay: .2s; }
.hero-hearts span:nth-child(3) { animation-delay: .4s; }
@keyframes beat { 0%, 88%, 100% { transform: scale(1); } 94% { transform: scale(1.22); } }
@media (prefers-reduced-motion: reduce) { .hero-hearts span { animation: none; } }

.title-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 30px; }
.hero-foot { margin-top: 18px; font-size: 12.5px; color: var(--faint); }

/* ───────── 방 고르기 · 종료 ───────── */
#setup, #over { align-items: center; justify-content: center; padding: 24px; }
.gate-card {
  position: relative;
  width: 100%; max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 26px 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.back {
  position: absolute; top: 14px; left: 14px;
  width: 32px; height: 32px; border-radius: 9px;
  background: none; border: none; color: var(--dim);
  font-size: 17px; cursor: pointer;
}
.back:hover { background: var(--surface-4); color: var(--ink); }
.setup-title { font-size: 20px; margin-bottom: 24px; }

.field { display: block; text-align: left; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--dim); margin-bottom: 6px; }
input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 12px 14px;
  outline: none;
}
input:focus { border-color: var(--gold); }

.gate-buttons { display: flex; flex-direction: column; gap: 14px; }
.or { position: relative; text-align: center; color: var(--faint); font-size: 12px; }
.or::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--line); }
.or span { position: relative; background: var(--surface); padding: 0 10px; }
.join-row { display: flex; gap: 8px; }
.join-row input { text-transform: uppercase; letter-spacing: 5px; text-align: center; font-weight: 700; }
.join-row .btn { flex: none; padding: 12px 20px; }

.crown { font-size: 52px; }
#oWinner { font-size: 28px; margin: 8px 0 4px; }
#over .btn.big { margin-top: 22px; }

/* ───────── 대기실 ───────── */
#lobby { align-items: center; justify-content: center; padding: 24px 16px; }
.panel {
  width: 100%; max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.head-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.code { font-size: 34px; font-weight: 800; letter-spacing: 7px; color: var(--gold); }

.seat-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.seat-list li {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
}
.seat-list .nm { flex: 1; font-weight: 600; }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--surface-4); color: var(--dim); }
.badge.off { background: transparent; border: 1px dashed var(--danger-line); color: var(--danger-ink); }
.badge.host { background: var(--gold-soft); color: var(--gold); }
.seat-list .x { background: none; border: none; color: var(--faint); cursor: pointer; padding: 2px 6px; }
.seat-list .x:hover { color: var(--heart); }

.host-box { display: flex; flex-direction: column; gap: 6px; }
.opt { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); }
.opt-text { flex: 1; }
.opt-title { font-weight: 600; }
.opt-desc { font-size: 12.5px; color: var(--dim); }

.seg { display: flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button {
  border: none; background: none; color: var(--dim);
  padding: 6px 10px; border-radius: 7px; cursor: pointer; font-size: 13px;
}
.seg button.on { background: var(--surface-4); color: var(--ink); font-weight: 600; }

.lobby-actions { display: flex; gap: 10px; margin-top: 12px; }
.lobby-actions .btn.ghost { flex: none; }

/* ───────── 게임 ───────── */
#game { padding: 10px 12px 16px; gap: 10px; }
.bar { display: flex; align-items: center; gap: 6px; }
.pill {
  font-size: 12.5px; color: var(--dim);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 4px 11px;
}

/* 상대들 */
.seats { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.seat {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 8px 12px;
  min-width: 132px;
  transition: border-color .2s, background .2s, transform .2s;
}
.seat.turn {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-soft), transparent);
  transform: translateY(-2px);
  box-shadow: 0 0 0 1px var(--gold-line), 0 6px 20px var(--gold-soft);
}
.seat.out { opacity: .38; }
.seat.me .nm { color: var(--gold); }
.seat .av {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
  background: var(--surface-4); color: var(--ink);
}
.seat .col { min-width: 0; }
.seat .nm { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 92px; }
.hearts { font-size: 12px; letter-spacing: 1px; line-height: 1.2; }
.hearts .on { color: var(--heart); }
.hearts .off { color: var(--heart-off); }
.seat .dc { font-size: 11px; color: var(--danger-ink); }

/* 상대 손패 — 숫자 대신 카드 뒷면을 장수만큼 깔아서 눈으로 세게 한다 */
.mini-hand { display: flex; gap: 3px; margin-top: 5px; min-height: 19px; }
.mini-hand i {
  width: 13px; height: 19px; border-radius: 3px;
  background: repeating-linear-gradient(45deg, var(--mini-a) 0 3px, var(--mini-b) 3px 6px);
  border: 1px solid var(--mini-line);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
}
.seat.out .mini-hand { display: none; }

/* 테이블 */
.table {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 34px;
  background: radial-gradient(62% 72% at 50% 42%, var(--table) 0%, var(--table-2) 68%, var(--table-3) 100%);
  border: 1px solid var(--table-line);
  border-radius: 22px;
  padding: 22px;
  min-height: 210px;
  max-height: 380px;
  box-shadow: inset 0 2px 40px rgba(0, 0, 0, .22);
}

.sum-wrap { position: relative; width: 150px; height: 150px; flex: none; }
.ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; stroke-linecap: round; }
.ring-bg { stroke: rgba(128, 128, 128, .22); }
.ring-fg {
  stroke: var(--safe);
  stroke-dasharray: 339.3;
  stroke-dashoffset: 0;
  transition: stroke .3s;
}
.ring-fg.warn { stroke: var(--gold); }
.ring-fg.hot { stroke: var(--heart); }
.sum-inner { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.sum-label { font-size: 11px; color: var(--dim); letter-spacing: 3px; }
.sum { font-size: 52px; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.sum.hide { color: var(--faint); }
.sum.danger { color: var(--heart); }
.sum.pop { animation: pop .3s; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.22); } 100% { transform: scale(1); } }

.last { text-align: center; }
.last .muted { margin-bottom: 8px; }
.top-slot { display: grid; place-items: center; min-height: 104px; }

/* 카드 — 기본 크기는 테이블에 놓인 카드. 내 손패는 아래에서 더 크게 키운다 */
.card {
  width: 74px; height: 104px;
  border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800;
  background: var(--c-plain); color: var(--c-ink);
  border: none;
  box-shadow: var(--card-shadow), var(--card-inset);
  position: relative;
  flex: none;
}
.card .v { font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.card .n { font-size: 10.5px; font-weight: 700; opacity: .62; margin-top: 5px; letter-spacing: .3px; }
.card.zero  { background: var(--c-zero); }
.card.big   { background: var(--c-big);   color: #fff; }
.card.minus { background: var(--c-minus); color: #fff; }
.card.s76   { background: var(--c-s76);   color: #fff; }
.card.x2    { background: var(--c-x2); }
.card.rev   { background: var(--c-rev); }
.card.rev .v { font-size: 38px; }

.card-back {
  width: 74px; height: 104px; border-radius: 12px;
  display: grid; place-items: center;
  font-size: 22px; font-weight: 800; color: var(--back-ink);
  background: repeating-linear-gradient(45deg, var(--back-a) 0 8px, var(--back-b) 8px 16px);
  border: 1px solid var(--back-line);
}
.top-slot .card { animation: land .28s cubic-bezier(.2, .8, .3, 1.2); }
@keyframes land {
  0%   { transform: translateY(-26px) rotate(-8deg) scale(.9); opacity: 0; }
  100% { transform: none; opacity: 1; }
}

/* 손패 — 판에서 제일 크다 */
.hint { text-align: center; font-size: 13.5px; color: var(--dim); min-height: 21px; }
.hint b { color: var(--gold); }
.hand-wrap { display: flex; justify-content: safe center; overflow-x: auto; padding: 2px 0 6px; }
.hand { display: flex; gap: 10px; }
.hand .card {
  width: 96px; height: 136px;
  cursor: pointer;
  transition: transform .14s, box-shadow .14s, filter .14s;
}
.hand .card .v { font-size: 40px; }
.hand .card.rev .v { font-size: 46px; }
.hand .card .n { font-size: 11.5px; margin-top: 7px; }
/* 손가락으로 만지는 기기에서는 :hover 가 탭 뒤에도 남는다.
   손패 요소는 판이 이어지는 동안 재사용되므로, 한 장이 들린 채로 굳어 버린다. */
@media (hover: hover) {
  .hand .card:hover { transform: translateY(-9px); box-shadow: 0 14px 24px rgba(0, 0, 0, .3); }
}
.hand .card:disabled,
.hand .card.cant { cursor: not-allowed; filter: grayscale(.85) brightness(.78); }
.hand .card:disabled:hover,
.hand .card.cant:hover { transform: none; }
.hand.off .card { cursor: default; filter: grayscale(.5) brightness(.88); }
.hand.off .card:hover { transform: none; }

/* 라운드 결과 */
.note {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: var(--scrim); backdrop-filter: blur(3px); z-index: 40;
  animation: fade .2s;
}
@keyframes fade { from { opacity: 0; } }
.note-in {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 26px 34px; text-align: center; box-shadow: var(--shadow);
}
.note-title { font-size: 22px; font-weight: 800; }
.note-sub { color: var(--dim); margin-top: 6px; }

/* ───────── 가이드 ───────── */
.modal {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center; padding: 16px;
  background: var(--scrim); backdrop-filter: blur(4px);
  animation: fade .18s;
}
.sheet {
  width: 100%; max-width: 560px; max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); overflow: hidden;
}
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 12px; }
.sheet-head h2 { font-size: 19px; }
.x { background: none; border: none; color: var(--dim); font-size: 17px; cursor: pointer; padding: 4px 8px; }
.x:hover { color: var(--ink); }

.tabs { display: flex; gap: 4px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.tabs button {
  background: none; border: none; color: var(--dim); cursor: pointer;
  padding: 9px 13px; border-bottom: 2px solid transparent; font-size: 14px;
}
.tabs button.on { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }

.sheet-body { overflow-y: auto; padding: 18px 20px 26px; }
.tabpage { display: none; }
.tabpage.on { display: block; }
.lead { margin-bottom: 14px; }
.steps { padding-left: 20px; display: flex; flex-direction: column; gap: 9px; }
.steps li::marker { color: var(--gold); font-weight: 700; }
.callout {
  margin-top: 16px; padding: 13px 15px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-line);
  border-radius: 12px; font-size: 13.5px;
}

.cardlist { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.cardlist li { display: flex; gap: 13px; align-items: flex-start; font-size: 13.5px; }
.chip {
  flex: none; width: 54px; min-height: 40px; padding: 6px 4px;
  border-radius: 8px; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; text-align: center; line-height: 1.25;
  background: var(--c-plain); color: var(--c-ink);
  box-shadow: var(--card-shadow);
}
.chip.zero { background: var(--c-zero); }
.chip.big { background: var(--c-big); color: #fff; }
.chip.minus { background: var(--c-minus); color: #fff; }
.chip.s76 { background: var(--c-s76); color: #fff; }
.chip.x2 { background: var(--c-x2); }
.chip.rev { background: var(--c-rev); font-size: 20px; }

.tips { list-style: none; display: flex; flex-direction: column; gap: 12px; font-size: 13.5px; }
.tips li { padding-left: 15px; position: relative; }
.tips li::before { content: '·'; position: absolute; left: 3px; color: var(--gold); font-weight: 900; }

/* ───────── 토스트 ───────── */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 16px);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  padding: 10px 18px; border-radius: 999px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 80; font-size: 14px; max-width: 88vw; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ───────── 좁은 화면 ───────── */
@media (max-width: 560px) {
  /* 좌석을 줄여 6인이 두 줄에 들어오게 한다 (세로로 넘치지 않도록) */
  .seats { gap: 6px; }
  .seat { padding: 6px 8px; gap: 6px; border-radius: 11px; min-width: 0; }
  .seat .av { width: 24px; height: 24px; font-size: 12px; }
  .seat .nm { max-width: 60px; font-size: 12px; }
  .hearts { font-size: 11px; }
  .mini-hand { gap: 2px; margin-top: 3px; min-height: 15px; }
  .mini-hand i { width: 9px; height: 14px; border-radius: 2px; }

  /* 덱 · 합 · 마지막 카드를 한 줄로. 세로로 쌓으면 6인일 때 손패가 화면 밖으로 밀린다. */
  .table { flex-direction: row; gap: 14px; padding: 12px 10px; min-height: 0; max-height: none; flex: none; }
  .last { text-align: center; }
  .last .muted { margin-bottom: 4px; font-size: 10.5px; line-height: 1.3; max-width: 76px; margin-left: auto; margin-right: auto; word-break: keep-all; }
  .sum-wrap { width: 112px; height: 112px; }
  .sum { font-size: 40px; }

  .card, .card-back { width: 58px; height: 82px; }
  .card .v { font-size: 24px; }
  .card .n { font-size: 9px; }
  .card.rev .v { font-size: 28px; }
  /* 좁은 화면에서도 내 패가 가장 크되 5장이 가로로 딱 들어가게 */
  .hand { gap: 5px; }
  /* 360px 아래에서는 5장이 안 들어가 마지막 카드가 잘렸다 — 폭에 맞춰 줄인다 */
  .hand .card { width: min(64px, calc((100vw - 44px) / 5)); height: auto; aspect-ratio: 64 / 91; }
  .pill { white-space: nowrap; }
  .hand .card .v { font-size: 27px; }
  .hand .card.rev .v { font-size: 31px; }
  .hand .card .n { font-size: 9.5px; margin-top: 5px; }

  .logo { font-size: 44px; }
  .fan { height: 96px; margin-bottom: 18px; }
  .fc { width: 56px; height: 79px; font-size: 20px; margin: 0 -4px; padding-top: 9px; }
  .theme-switch { top: 12px; right: 12px; padding: 5px 10px; }
}

/* 저작권 고지 — 타이틀 아래, 자세히 봐야 보일 만큼만 */
.legal{margin:26px auto 0;max-width:36em;font-size:10.5px;line-height:1.75;color:var(--faint);opacity:.7;text-align:center;word-break:keep-all}

/* ══════════ 덱 ══════════
   카드가 어디서 오는지 보이지 않으면 손패에 그냥 생겨나는 것처럼 느껴진다. */
.draw { text-align: center; }
.draw .muted { margin-bottom: 8px; }
.deck {
  position: relative;
  width: 74px; height: 104px; border-radius: 12px;
  display: grid; place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,.06) 0 6px, transparent 6px 12px),
    linear-gradient(160deg, #3b4356, #232a38);
  box-shadow: var(--card-shadow), inset 0 0 0 1px rgba(255,255,255,.10);
  color: #cdd5e4; font-weight: 800; font-size: 15px;
}
/* 여러 장 쌓여 있는 두께 */
.deck::before, .deck::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: linear-gradient(160deg, #333b4c, #1e2530);
  box-shadow: 0 1px 0 rgba(255,255,255,.06);
}
.deck::before { transform: translate(3px, 3px); }
.deck::after  { transform: translate(6px, 6px); opacity: .75; }
.deck.empty { opacity: .35; }
.deck .deck-n { font-variant-numeric: tabular-nums; }

/* ══════════ 카드가 오가는 모습 ══════════ */
/* 낸 카드 — 손에서 더미로 날아간다 */
.card.flying {
  z-index: 60; pointer-events: none;
  transition: transform .38s cubic-bezier(.34, .8, .3, 1);
  box-shadow: 0 22px 40px rgba(0,0,0,.42);
}
/* 뽑은 카드 — 덱 쪽에서 미끄러져 들어오며 펴진다 */
@keyframes dealin {
  from { opacity: 0; transform: translate(-42px, -34px) rotate(-12deg) scale(.82); }
  60%  { opacity: 1; }
  to   { opacity: 1; transform: none; }
}
.hand .card.dealt { animation: dealin .34s cubic-bezier(.2, .9, .3, 1.05) var(--dl, 0ms) backwards; }
@media (prefers-reduced-motion: reduce) {
  .card.flying { transition: none; }
  .hand .card.dealt { animation: none; }
}
@media (max-width: 560px) {
  .deck { width: 58px; height: 82px; font-size: 13px; }
}

/* ══════════ 상판 — 금속 작업대 ══════════
   결과 리벳을 얹어 카드가 놓인 자리에 무게를 준다. 카드와 숫자를 방해하지 않는 세기로. */
.table { position: relative; overflow: hidden; }
.table::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; border-radius: inherit;
  background:
    repeating-linear-gradient(102deg,
      rgba(255,255,255,.05) 0 2px, transparent 2px 5px),
    radial-gradient(circle at 18px 18px, rgba(0,0,0,.16) 0 2px, transparent 2.6px),
    radial-gradient(circle at calc(100% - 18px) 18px, rgba(0,0,0,.16) 0 2px, transparent 2.6px),
    radial-gradient(circle at 18px calc(100% - 18px), rgba(0,0,0,.16) 0 2px, transparent 2.6px),
    radial-gradient(circle at calc(100% - 18px) calc(100% - 18px), rgba(0,0,0,.16) 0 2px, transparent 2.6px);
  opacity: .8;
}
.table > * { position: relative; z-index: 1; }

/* 아직 아무도 내지 않은 더미 — 덱과 구분되도록 빈 자리로 */
.slot-empty {
  width: 74px; height: 104px; border-radius: 12px;
  display: grid; place-items: center; text-align: center;
  border: 2px dashed var(--line);
  color: var(--dim); font-size: 11px; font-weight: 700; opacity: .7;
}
@media (max-width: 560px) { .slot-empty { width: 58px; height: 82px; font-size: 10px; } }

/* ══════════ 아래 여백 ══════════
   상판 높이가 묶여 있어 화면이 길면 손패 아래가 통째로 비었다.
   남는 자리를 손패 위아래로 나눠 갖게 해서 여백이 의도한 것처럼 보이게 한다. */
@media (min-width: 561px) { .table { max-height: min(46vh, 420px); } }
.hand-wrap { flex: 1; align-items: center; }

/* ══════════ 관전 판 ══════════
   탈락했거나 라운드 사이라 손패가 없을 때. 빈 자리 대신 남은 사람들의 패를 뒷면으로. */
.watch { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; align-items: flex-end; }
.watch-p { text-align: center; opacity: .62; transition: opacity .18s; }
.watch-p.now { opacity: 1; }
.watch-n { font-size: 12px; font-weight: 700; color: var(--dim); margin-bottom: 7px; }
.watch-p.now .watch-n { color: var(--gold); }
.watch-c { display: flex; gap: 3px; justify-content: center; }
.watch-c i {
  width: 15px; height: 22px; border-radius: 3px; display: block;
  background: linear-gradient(160deg, #3b4356, #232a38);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.10);
}
.watch-p.now .watch-c i { box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), 0 0 0 1px var(--gold); }

/* ×2 로 생긴 의무 — 차례가 넘어가도 사라지지 않고 남아 있어야 한다 */
.pill.due {
  color: var(--onaccent, #1a1409);
  background: var(--gold);
  border-color: var(--gold);
  font-weight: 800;
  animation: duepulse 1.8s ease-in-out infinite;
}
@keyframes duepulse { 50% { filter: brightness(1.12); } }
@media (prefers-reduced-motion: reduce) { .pill.due { animation: none; } }

/* ══════════ 넓은 화면에서의 판 ══════════
   상판이 화면 폭을 다 차지하는데 안에는 덱·합·더미 셋뿐이라 좌우가 휑했다.
   폭을 묶어 가운데로 모으고, 대신 높이를 조금 키워 손패와의 사이가 벌어지지 않게 한다. */
/* 좁은 화면 규칙(max-width:560px) 뒤에 조건 없이 두면 폰에서도 이게 이겨서, 상판이 내용 폭만큼 쪼그라들고
   높이도 화면의 절반을 차지해 손패가 화면 밖으로 밀렸다. 넓은 화면에서만 쓴다. */
@media (min-width: 561px) {
  .table { max-width: 940px; margin-left: auto; margin-right: auto; max-height: min(52vh, 470px); }
}
.seats { max-width: 940px; margin-left: auto; margin-right: auto; }
/* 안내 한 줄은 상판 바로 아래에 붙는다 */
.hint { margin-top: 2px; }

/* ══════════ 채팅 ══════════
   같은 방 사람끼리 하는 잡담. 판을 가리지 않도록 구석에 접어 두고,
   열었을 때만 자리를 차지한다. 봇만 있는 방에서는 버튼조차 뜨지 않는다. */
.chat-btn {
  position: fixed; right: 16px; bottom: 16px; z-index: 45;
  width: 48px; height: 48px; border-radius: 50%;
  font-size: 20px; line-height: 1; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface-3); color: var(--text);
  box-shadow: 0 10px 24px -10px rgba(0,0,0,.5);
}
.chat-btn:hover { filter: brightness(1.06); }
.chat-n {
  position: absolute; top: -3px; right: -3px;
  min-width: 18px; height: 18px; border-radius: 999px; padding: 0 5px;
  font-size: 11px; font-weight: 800; line-height: 18px;
  background: var(--heart); color: #fff;
}
/* hidden 속성은 브라우저 기본 display:none 이라, 아래처럼 display 를 선언한 요소에서는
   밀려서 무시된다. 그래서 채팅창이 첫 화면부터 떠 있고 ✕로도 닫히지 않았다. */
.chat[hidden], .chat-peek[hidden] { display: none; }
.chat-n.pop { animation: chatPop .5s cubic-bezier(.3,1.7,.5,1); }
@keyframes chatPop { from { transform: scale(.3); } }
/* 접힌 채팅에 새 말이 오면 버튼 옆에 잠깐 띄우는 말풍선. 누르면 채팅이 열린다. */
.chat-peek {
  position: fixed; right: 74px; bottom: 21px; z-index: 45;
  max-width: min(260px, calc(100vw - 96px));
  padding: 8px 12px; border-radius: 13px 13px 4px 13px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 12px 26px -12px rgba(0,0,0,.5);
  font-size: 13px; line-height: 1.45; cursor: pointer; word-break: break-word;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  animation: chatPeekIn .2s ease-out; transition: opacity .25s, transform .25s;
}
.chat-peek b { color: var(--dim); font-weight: 700; margin-right: 6px; }
.chat-peek.bye { opacity: 0; transform: translateX(6px); }
@keyframes chatPeekIn { from { opacity: 0; transform: translateX(8px); } }
/* 폰에서는 아래에 두면 손패·조작 판 위를 덮는다. 채팅창이 열리는 위쪽 자리에 띄운다. */
@media (max-width: 560px) {
  .chat-peek { top: 56px; bottom: auto; left: 12px; right: 12px; max-width: none; border-radius: 13px; animation-name: chatPeekDown; }
  .chat-peek.bye { transform: translateY(-6px); }
}
@keyframes chatPeekDown { from { opacity: 0; transform: translateY(-8px); } }
@media (prefers-reduced-motion: reduce) { .chat-peek, .chat-n.pop { animation: none; transition: none; } }
.chat {
  position: fixed; right: 16px; bottom: 16px; z-index: 46;
  width: min(320px, calc(100vw - 32px)); height: min(380px, 60vh);
  display: flex; flex-direction: column;
  border-radius: 14px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: 0 22px 50px -18px rgba(0,0,0,.6);
}
.chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.chat-sub { color: var(--dim); font-size: 11.5px; }
.chat-x {
  margin-left: auto; border: 0; background: none; cursor: pointer;
  color: var(--dim); font-size: 15px; line-height: 1; padding: 2px 4px;
}
.chat-log { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { font-size: 13px; line-height: 1.5; color: var(--text); word-break: break-word; margin: 0; }
.chat-msg b { color: var(--dim); font-weight: 700; margin-right: 5px; }
.chat-msg.mine b { color: var(--gold); }
.chat-log:empty::before {
  content: '아직 아무 말도 없습니다'; color: var(--dim); font-size: 12px; opacity: .7;
}
.chat-in { display: flex; gap: 6px; padding: 9px 10px; border-top: 1px solid var(--line); }
.chat-in input {
  flex: 1; min-width: 0; font: inherit; font-size: 13px;
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px;
  background: var(--surface-3); color: var(--text);
}
/* 좁은 화면에서는 아래에 두면 손패를 통째로 덮는다.
   차례 제한시간이 도는 게임이라 카드가 안 보이면 그대로 손해다. 위쪽으로 올린다. */
@media (max-width: 560px) {
  .chat { top: 56px; bottom: auto; height: min(46vh, 330px); left: 12px; right: 12px; width: auto; }
}

/* 남은 시간 — 손패 바로 위. 판 가운데 링만으로는 눈에 안 들어온다 */
.clock {
  text-align: center; margin: 2px 0 0;
  font-size: 13px; font-weight: 800; letter-spacing: .02em;
  color: var(--dim); font-variant-numeric: tabular-nums;
}
.clock.warn { color: var(--gold); }
.clock.hot { color: var(--heart); animation: clockbeat .6s ease-in-out infinite; }
@keyframes clockbeat { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) { .clock.hot { animation: none; } }
