/*
  프레지던트 · 다빈치코드 화면.
  patch.css 토큰만 씁니다. 카드·타일·자리·안내는 모두 솔기로 이어 붙인 조각입니다.
  치자 = 지금 차례 / 쪽 = 고른 것·주요 행동 / 홍화 = 위험·오답 / 쑥 = 정답·완료.
*/
:root {
  --suit-red: #a82835;          /* 홍화 계열 카드 무늬 (♥ ♦ · 빨강 조커) */
  --table-gutter: 24px;
}

.muted { color: var(--ink-soft); }

/* ---------- 머리줄 ---------- */
.arcade-main {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--table-gutter) 40px;
}
.arcade-page:not(.in-game) .arcade-main {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.game-heading {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}
.game-identity {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.game-identity h1 {
  font-size: var(--text-lg);
  font-weight: 800;
  white-space: nowrap;
}
.game-home,
.icon-button {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
}
.game-home:hover,
.icon-button:hover:not(:disabled) {
  border-color: var(--seam);
  background: var(--sheet);
}
.game-home svg { width: 22px; height: 22px; }
.game-heading-meta {
  display: flex;
  align-items: center;
  gap: 4px;
}
.game-heading-meta > * { flex: none; }
.game-heading-meta .btn { padding: 0 12px; white-space: nowrap; }
.game-heading-meta svg { width: 20px; height: 20px; }
.turn-banner { display: none; }

/* 알림: 화면 아래 한 줄 */
#notice {
  position: fixed;
  z-index: 220;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100vw - 32px);
  transform: translateX(-50%);
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-dye);
}

/* ---------- 시작 화면 ---------- */
.setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 1fr);
  gap: var(--seam-width);
  margin: auto 0;
  border: var(--seam-width) solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--seam);
  overflow: hidden;
}
.game-intro {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--seam-width);
  min-width: 0;
  background: var(--seam);
}
.intro-art {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  min-height: 360px;
  padding: 36px 36px 32px;
  background: var(--cloth-deep);
}
.intro-object {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.art-caption {
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.2;
}
.intro-bottom {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 36px;
  background: var(--sheet);
  color: var(--ink-soft);
  font-size: var(--text-sm);
}
.intro-bottom span:first-child { color: var(--ink); font-weight: 650; }

.demo-card {
  position: relative;
  width: 112px;
  aspect-ratio: 2 / 3;
  margin-left: -30px;
  padding: 10px 12px;
  border: var(--seam-width) solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
}
.demo-card:first-child { margin-left: 0; transform: rotate(-7deg) translateY(8px); }
.demo-card:last-child { transform: rotate(7deg) translateY(8px); }
.demo-card.red { color: var(--suit-red); }
.demo-card b { font-size: 28px; font-weight: 800; line-height: 1; }
.demo-card i {
  position: absolute;
  inset: 34% 0 0;
  text-align: center;
  font-size: 56px;
  font-style: normal;
  line-height: 1;
  font-variant-emoji: text;
}
.demo-code {
  position: relative;
  display: grid;
  place-items: center;
  width: 72px;
  aspect-ratio: 2 / 3;
  margin: 0 5px;
  border: var(--seam-width) solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  font-size: 44px;
  font-weight: 800;
}
.demo-code.black { border-color: var(--ink); background: var(--ink); color: var(--on-dye); }
.demo-code.secret::before {
  content: '';
  position: absolute;
  inset: 14%;
  border: 1.5px dashed currentColor;
  border-radius: var(--radius-small);
  opacity: .6;
}

.setup-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 28px 32px 32px;
  background: var(--sheet);
}
.setup-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--seam-width);
  margin-bottom: 8px;
  border: var(--seam-width) solid var(--seam);
  border-radius: var(--radius);
  background: var(--seam);
  overflow: hidden;
}
.setup-tabs button {
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: var(--cloth);
  color: var(--ink-soft);
}
.setup-tabs button:hover:not(:disabled) { background: var(--sheet-hover); color: var(--ink); }
.setup-tabs [aria-selected="true"],
.setup-tabs [aria-selected="true"]:hover:not(:disabled) {
  background: var(--sheet);
  color: var(--ink);
  box-shadow: inset 0 -3px 0 var(--ink);
}
.field-label { display: block; margin: 16px 0 6px; }
.setup-pane h2 { margin: 24px 0 4px; font-size: var(--text-lg); }
.setup-pane p { margin-bottom: 16px; color: var(--ink-soft); }
.form-divider {
  margin: 20px 0 8px;
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--ink-soft);
}
.join-form { display: flex; gap: 8px; }
.join-form input { flex: 1; min-width: 0; }
.join-form button { flex: none; min-height: 44px; }
.form-error {
  min-height: 1.5em;
  margin-top: 12px;
  color: var(--safflower);
  font-size: var(--text-sm);
  font-weight: 650;
}
.recovery-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: var(--seam-width) solid var(--seam);
}
.recovery-panel p { flex-basis: 100%; font-size: var(--text-sm); }

/* ---------- 대기실 ---------- */
.waiting-room {
  display: grid;
  gap: var(--seam-width);
  margin: auto 0;
  border: var(--seam-width) solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--seam);
  overflow: hidden;
}
.waiting-room > * { background: var(--sheet); }
.waiting-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 32px;
}
.waiting-head h2 { font-size: var(--text-xl); }
.waiting-head p { margin-top: 6px; color: var(--ink-soft); }
.room-code {
  flex: none;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 220px;
  padding: 12px 20px 14px;
  border: var(--seam-width) solid var(--seam-strong);
  background: var(--cloth);
}
.room-code span { font-size: var(--text-xs); font-weight: 650; color: var(--ink-soft); }
.room-code b {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: .08em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.waiting-room > .waiting-seats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--seam-width);
  background: var(--seam);
}
.waiting-seat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 12px;
  background: var(--sheet);
  text-align: center;
}
.waiting-seat b { font-size: var(--text-md); overflow-wrap: anywhere; }
.waiting-seat p { font-size: var(--text-sm); color: var(--ink-soft); }
.waiting-seat.empty { background: var(--cloth); }
.waiting-seat.empty b { color: var(--ink-soft); }
.waiting-seat.empty .avatar { border-style: dashed; background: transparent; color: var(--ink-soft); }
.waiting-seat .avatar { width: 44px; height: 44px; font-size: var(--text-lg); }
.waiting-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 18px 32px;
}
.waiting-actions p { flex: 1 1 240px; color: var(--ink-soft); font-size: var(--text-sm); }
.waiting-room > .arcade-chat { padding: 20px 32px 16px; }

.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border: 1.5px solid var(--seam-strong);
  border-radius: var(--radius-small);
  background: var(--cloth);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 760;
}

/* ---------- 게임 화면 틀 ---------- */
.arcade-page.in-game { height: 100dvh; min-height: 0; overflow: hidden; }
html:has(.arcade-page.in-game) { overflow: hidden; }
.in-game .arcade-main {
  height: 100%;
  max-width: none;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
}
.in-game .game-heading {
  min-height: 0;
  height: calc(64px + env(safe-area-inset-top));
  gap: var(--seam-width);
  padding-top: env(safe-area-inset-top);
  border-bottom: var(--seam-width) solid var(--seam-strong);
  background: var(--seam);
}
.in-game .game-heading > * { align-self: stretch; background: var(--sheet); }
.in-game .game-identity { padding: 0 16px 0 8px; }
.in-game .game-heading-meta { padding: 0 8px; }
.in-game .turn-banner {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 20px;
}
.turn-copy { min-width: 0; }
.turn-banner h2 {
  font-size: var(--text-md);
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.turn-banner p {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.round-badge {
  flex: none;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.in-game[data-my-turn="true"] .turn-banner { background: var(--gardenia); }
.in-game[data-my-turn="true"] .turn-banner p,
.in-game[data-my-turn="true"] .round-badge { color: var(--ink); }

.play-layout { height: 100%; min-height: 0; min-width: 0; }
.table-column {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: var(--seam-width);
  background: var(--seam-strong);
}
.game-table { position: relative; min-width: 0; min-height: 0; }

/* 공통 차례 표시 */
.seat-turn-label {
  flex: none;
  padding: 2px 8px;
  border-radius: var(--radius-small);
  background: var(--gardenia);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 780;
  line-height: 1.5;
  white-space: nowrap;
}

/* ---------- 내 패 ---------- */
.my-panel {
  height: clamp(208px, 30dvh, 268px);
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 4px;
  padding: 10px 24px max(10px, env(safe-area-inset-bottom));
  background: var(--sheet);
}
.in-game[data-my-turn="true"] .my-panel { background: var(--gardenia-tint); }
.hand-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.hand-heading h3 { font-size: var(--text-md); font-weight: 780; white-space: nowrap; }
.hand-heading h3 > span { margin-left: 6px; color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.hand-heading > span:last-child {
  margin-left: auto;
  min-width: 0;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
}
.action-hint { min-width: 0; color: var(--ink-soft); font-size: var(--text-sm); font-weight: 600; line-height: 1.35; }
.in-game[data-my-turn="true"] .action-hint { color: var(--ink); }
.action-hint.foul-warning { color: var(--safflower); font-weight: 760; }
.action-buttons { flex: none; display: flex; gap: 8px; }
.action-buttons .btn { min-height: 44px; min-width: 96px; font-size: var(--text-md); }

/* ---------- 카드 ---------- */
.playing-card {
  --card-ink: var(--ink);
  position: relative;
  display: block;
  flex: none;
  width: var(--card-w, 72px);
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 1.5px solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--card-ink);
  container-type: inline-size;
  text-align: left;
  font-weight: 760;
}
.playing-card.red { --card-ink: var(--suit-red); }
.playing-card:disabled,
.playing-card:hover:not(:disabled) {
  border-color: var(--seam-strong);
  background: var(--sheet);
  color: var(--card-ink);
  cursor: default;
}
.playing-card.selectable:not(:disabled) { cursor: pointer; }
.playing-card.selectable:hover:not(:disabled) { border-color: var(--indigo); }
.playing-card.selected,
.playing-card.selected:hover:not(:disabled),
.playing-card.selected:disabled {
  border-color: var(--indigo);
  background: var(--indigo-tint);
  box-shadow: inset 0 0 0 2px var(--indigo);
  transform: translateY(-14px);
}
.card-face { position: absolute; inset: 0; line-height: 1; pointer-events: none; }
.card-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2cqw;
  min-width: 26%;
}
.card-corner.top { top: 7%; left: 5%; }
.card-corner.bottom { right: 5%; bottom: 7%; transform: rotate(180deg); }
.card-rank { font-size: 25cqw; font-weight: 800; letter-spacing: -.08em; white-space: nowrap; }
.card-suit,
.card-center { font-variant-emoji: text; }
.card-suit { font-size: 20cqw; }
.card-center {
  position: absolute;
  inset: 24% 20%;
  display: grid;
  place-items: center;
  font-size: 48cqw;
}
/* 조커: 먹(검정) 또는 홍화(빨강)로 통째로 물들인 조각 */
.playing-card.is-joker,
.playing-card.is-joker:disabled,
.playing-card.is-joker:hover:not(:disabled) {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-dye);
}
.playing-card.is-joker.red,
.playing-card.is-joker.red:disabled,
.playing-card.is-joker.red:hover:not(:disabled) {
  border-color: var(--suit-red);
  background: var(--suit-red);
}
.playing-card.is-joker.selected { border-color: var(--indigo); box-shadow: inset 0 0 0 3px var(--indigo); }
.is-joker .card-corner { display: none; }
.card-joker-symbol { inset: 20% 28% 38%; }
.card-joker-symbol::before {
  content: '';
  width: 62%;
  aspect-ratio: 1;
  border: 2px dashed currentColor;
  background: rgb(251 252 250 / .16);
  transform: rotate(45deg);
}
.card-joker-word {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 13%;
  text-align: center;
  font-size: 13cqw;
  font-weight: 800;
  letter-spacing: .06em;
}

/* ---------- 프레지던트 테이블 ---------- */
.president-table {
  --card-w: clamp(56px, 6.4vw, 92px);
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 3fr) minmax(150px, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "left top right"
    "left center right"
    "event event event";
  gap: var(--seam-width);
  height: 100%;
  background: var(--seam);
}
.table-opponents { display: contents; }
.opponent {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 10px;
  background: var(--sheet);
  text-align: center;
}
.opponent[data-position="left"] { grid-area: left; }
.opponent[data-position="top"] { grid-area: top; flex-direction: row; flex-wrap: wrap; gap: 6px 14px; }
.opponent[data-position="right"] { grid-area: right; }
.opponent.active { background: var(--gardenia-tint); }
.opponent-name {
  max-width: 100%;
  font-size: var(--text-md);
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.opponent small { color: var(--ink-soft); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.opponent.active small { color: var(--ink); }
.mini-hand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding-left: 16px;
}
.mini-back {
  position: relative;
  flex: none;
  width: 30px;
  height: 45px;
  margin-left: -16px;
  border: 1.5px solid var(--sheet);
  border-radius: 3px;
  background: var(--seam-strong);
}
.mini-back::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px dashed var(--seam);
  border-radius: 1px;
}

.trick-zone {
  grid-area: center;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: var(--cloth);
  text-align: center;
}
.trick-state { font-size: var(--text-sm); font-weight: 760; color: var(--ink-soft); }
.revolution-table .trick-zone { background: var(--safflower-tint); }
.revolution-table .trick-state { color: var(--safflower); }
.trick-stack {
  position: relative;
  width: 100%;
  height: calc(var(--card-w) * 1.5 + 20px);
}
.trick-layer {
  position: absolute;
  inset: 0;
  transform: translate(calc(var(--stack-depth) * -3px), calc(var(--stack-depth) * -3px)) rotate(calc(var(--stack-angle) * .6));
}
.trick-layer.under-play .playing-card { filter: saturate(.3) brightness(.94); }
.cards-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.cards-row:has(> :nth-child(5)) .playing-card { --card-w: clamp(40px, 4.8vw, 72px); }
.trick-label { color: var(--ink-soft); font-size: var(--text-sm); font-weight: 650; font-variant-numeric: tabular-nums; }
.trick-label span { margin-left: 8px; font-weight: 500; }
.table-empty {
  width: var(--card-w);
  aspect-ratio: 2 / 3;
  border: var(--seam-width) dashed var(--seam);
  border-radius: var(--radius);
}
.collected-pile {
  grid-area: center;
  align-self: end;
  justify-self: end;
  position: relative;
  width: 30px;
  height: 45px;
  margin: 0 16px 16px 0;
}
.collected-pile i {
  position: absolute;
  inset: 0;
  border: 1.5px solid var(--cloth);
  border-radius: 3px;
  background: var(--seam-strong);
}
.collected-pile i:nth-child(2) { transform: translate(-3px, -3px); }
.collected-pile i:nth-child(3) { transform: translate(-6px, -6px); }
.president-table .table-event { grid-area: event; }
.table-event {
  min-height: 40px;
  padding: 9px 16px;
  background: var(--sheet);
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-event:empty::before { content: '첫 수를 기다립니다.'; }
.my-cards {
  --card-w: clamp(52px, 9.4dvh, 88px);
  display: flex;
  align-items: flex-end;
  justify-content: safe center;
  min-width: 0;
  min-height: 0;
  padding: 18px 2px 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.my-cards .playing-card + .playing-card {
  margin-left: min(6px, calc((100% - var(--hand-count, 14) * var(--card-w)) / max(1, var(--hand-count, 14) - 1)));
}
.my-cards > .muted { align-self: center; }

/* ---------- 다빈치코드 테이블 ---------- */
.davinci-table {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--seam-width);
  height: 100%;
  background: var(--seam);
}
.code-opponents {
  display: grid;
  grid-template-columns: repeat(var(--opponents, 3), minmax(0, 1fr));
  gap: var(--seam-width);
  min-height: 0;
  background: var(--seam);
}
.code-rack {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: 10px 14px 4px;
  background: var(--sheet);
}
.code-rack.active { background: var(--gardenia-tint); }
.code-rack.guess-open { background: var(--indigo-tint); }
.rack-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.rack-identity { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; }
.rack-identity > b,
.rack-label > b {
  min-width: 0;
  font-weight: 780;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rack-tag { flex: none; color: var(--ink-soft); font-size: var(--text-xs); font-weight: 650; font-variant-numeric: tabular-nums; }
.rack-tiles { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 0; }
.rack-tiles .tiles-row { flex: 1; }
.code-rack:has(.eliminated-label) .rack-tag { visibility: hidden; }
.eliminated-label {
  position: absolute;
  top: 10px;
  right: 14px;
  padding: 1px 6px;
  border-radius: var(--radius-small);
  background: var(--safflower-tint);
  font-size: var(--text-xs);
  font-weight: 700;
}
.rack-deal-empty { color: var(--ink-soft); font-size: var(--text-sm); text-align: center; }

.tiles-row {
  --tile-gap: 8px;
  display: flex;
  align-items: center;
  justify-content: safe center;
  gap: var(--tile-gap);
  min-width: 0;
  min-height: 0;
  padding: 20px 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

/* 타일: 검정 = 먹 조각, 흰색 = 밝은 조각. 점선 박음질 = 아직 숨긴 타일. */
.code-tile {
  --tile-bg: var(--sheet);
  --tile-ink: var(--ink);
  --tile-edge: var(--seam-strong);
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: clamp(30px, calc((100% - (var(--tile-count) - 1) * var(--tile-gap, 8px)) / var(--tile-count)), 54px);
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--tile-ink);
  container-type: inline-size;
  perspective: 600px;
}
.code-tile.black { --tile-bg: var(--ink); --tile-ink: var(--on-dye); --tile-edge: var(--ink); }
.code-tile:disabled,
.code-tile:hover:not(:disabled) { border: 0; background: transparent; color: var(--tile-ink); cursor: default; }
.tile-solid {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}
.tile-face,
.tile-back {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: var(--seam-width) solid var(--tile-edge);
  border-radius: var(--radius);
  background: var(--tile-bg);
  color: var(--tile-ink);
  font-size: 54cqw;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.tile-back { transform: rotateY(180deg); }
.code-tile.hidden-number .tile-solid { transform: rotateY(180deg); }
.tile-back-pattern,
.code-tile:not(.revealed):not(.hidden-number) .tile-face::before {
  content: '';
  position: absolute;
  inset: 12%;
  border: 1.5px dashed currentColor;
  border-radius: var(--radius-small);
  opacity: .55;
  pointer-events: none;
}
.tile-back-pattern i { display: none; }
.joker-tile .tile-face { font-size: 80cqw; font-weight: 900; }
.tile-slot {
  position: absolute;
  top: -17px;
  left: 0;
  right: 0;
  color: var(--ink-soft);
  font-size: var(--text-xs);
  font-weight: 650;
  line-height: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.code-tile.revealed::after {
  content: '공개';
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: -17px;
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 760;
  line-height: 1;
  text-align: center;
  pointer-events: none;
}
/* 내 타일이 공개되면 홍화 테두리: 지킬 수 없게 된 조각 */
.my-code .code-tile.revealed .tile-face { border-color: var(--safflower); }
.my-code .code-tile.revealed::after { color: var(--safflower); }
/* 고를 수 있는 타일의 테두리 색은 arcade-3d.css가 타일 면과 두께에 칠합니다(타일과 함께 기울도록). */
.code-tile.targetable,
.code-tile[data-reveal] { cursor: pointer; }
.code-tile.targetable:disabled { cursor: default; }
.code-tile.targetable:hover:not(:disabled),
.code-tile[data-reveal]:hover:not(:disabled) { cursor: pointer; }

/* 가운데 더미 */
.pool-zone {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 16px;
  background: var(--cloth);
}
.pool-zone:has(.pool-tile:enabled) { background: var(--gardenia-tint); }
.pool-head {
  display: flex;
  gap: 12px;
  color: var(--ink-soft);
  font-size: var(--text-sm);
  font-weight: 650;
}
.pool-zone:has(.pool-tile:enabled) .pool-head { color: var(--ink); font-weight: 760; }
.pool-head span:last-child { font-variant-numeric: tabular-nums; }
.pool-scatter { position: relative; width: min(100%, 820px); flex: 1; min-height: 0; }
.pool-tile {
  position: absolute;
  top: var(--pool-y, 50%);
  left: var(--pool-x, 50%);
  display: block;
  width: clamp(28px, 5.4dvh, 48px);
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 3;
  padding: 0;
  border: var(--seam-width) solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  transform: translate(-50%, -50%) rotate(var(--pool-r, 0deg));
}
.pool-tile.black { border-color: var(--ink); background: var(--ink); color: var(--on-dye); }
.pool-tile:disabled,
.pool-tile:hover:not(:disabled) { border-color: var(--seam-strong); background: var(--sheet); color: var(--ink); cursor: default; }
.pool-tile.black:disabled,
.pool-tile.black:hover:not(:disabled) { border-color: var(--ink); background: var(--ink); color: var(--on-dye); }
.pool-tile:enabled { cursor: pointer; }
.pool-tile:enabled:hover,
.pool-tile:focus-visible { z-index: 2; outline: 3px solid var(--indigo); outline-offset: 2px; }
.pool-tile .tile-back-pattern { inset: 16%; }
.pool-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-soft); font-size: var(--text-sm); }
.pool-fallback { display: flex; gap: 8px; margin: auto; }
.pool-button { min-height: 48px; }
.davinci-table .table-event { min-height: 40px; }
.guess-feedback b { margin-right: 6px; }
.table-event.guess-feedback.correct { background: var(--mugwort); color: var(--on-dye); }
.table-event.guess-feedback.wrong { background: var(--safflower); color: var(--on-dye); }

/* 내 코드 */
.my-code {
  --hand-tile-w: 54px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 0;
  min-height: 0;
}
.my-code > .tiles-row { flex: 1; max-width: 100%; height: 100%; }
.my-code .code-tile { width: var(--hand-tile-w); }
.drawn-group {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-left: 14px;
  border-left: var(--seam-width) solid var(--seam);
}
.drawn-group .code-tile { width: 48px; }
.rack-tiles .drawn-group { gap: 4px; padding-left: 8px; }
.rack-tiles .drawn-group .code-tile { width: 34px; }
.drawn-caption { color: var(--ink-soft); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; }
.in-game[data-my-turn="true"] .my-panel .drawn-caption { color: var(--ink); }

/* 넣을 자리: 지금 할 일이므로 치자 */
.tile-placement-slots { --slot-w: 46px; }
.tile-placement-slots .code-tile {
  width: clamp(30px, calc((100% - var(--placement-count) * var(--slot-w) - (var(--tile-count) + var(--placement-count) - 1) * var(--tile-gap)) / var(--tile-count)), 54px);
}
.my-code .tile-placement-slots .code-tile { width: var(--hand-tile-w); }
.tile-placement-slot {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: var(--slot-w);
  height: auto;
  min-height: 0;
  aspect-ratio: 2 / 3;
  padding: 0;
  border: var(--seam-width) dashed var(--ink);
  border-radius: var(--radius);
  background: var(--gardenia);
  color: var(--ink);
  font-size: var(--text-xs);
  font-weight: 780;
}
.tile-placement-slot svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.tile-placement-slot:hover:not(:disabled),
.tile-placement-slot:focus-visible {
  border-style: solid;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--gardenia);
}

/* 숫자 고르기 */
.rack-guess {
  position: fixed;
  z-index: 160;
  top: 50%;
  left: 50%;
  width: min(360px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: 16px 18px 18px;
  border: var(--seam-width) solid var(--seam-strong);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--ink);
  text-align: left;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 100vmax rgb(27 33 30 / .5);
}
.guess-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  font-size: var(--text-md);
}
.guess-close {
  width: 40px;
  min-height: 40px;
  padding: 0;
  border-color: transparent;
  background: transparent;
  font-size: 24px;
  font-weight: 400;
}
.number-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--seam-width);
  border: var(--seam-width) solid var(--seam);
  border-radius: var(--radius);
  background: var(--seam);
  overflow: hidden;
}
.number-choice {
  min-height: 48px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--sheet);
  font-size: var(--text-lg);
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}
.number-choice.joker-choice { grid-column: 1 / -1; }
.number-choice[aria-pressed="true"],
.number-choice[aria-pressed="true"]:hover:not(:disabled) { background: var(--indigo); color: var(--on-dye); }
.number-choice:disabled { background: var(--safflower-tint); color: var(--safflower); text-decoration: line-through; }
.guess-submit {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
}
.guess-note { color: var(--ink-soft); font-size: var(--text-sm); }
.guess-submit .btn { min-width: 112px; min-height: 44px; }

/* 추측 결과 꼬리표: 이름 옆에 붙는 작은 조각. 누가 누구를 지목했는지는 아래 기록 줄이 보여 줍니다. */
.guess-speech {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 1px 8px 2px;
  border: var(--seam-width) solid var(--ink);
  border-radius: var(--radius-small);
  background: var(--sheet);
  color: var(--ink);
  white-space: nowrap;
  pointer-events: none;
}
.guess-speech-target {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.guess-speech-number { font-size: var(--text-md); font-weight: 800; line-height: 1.3; }
.guess-speech-number > span { margin-left: 2px; font-size: var(--text-xs); font-weight: 650; }
.guess-speech-result { font-size: var(--text-xs); font-weight: 800; }
.guess-speech.pending .guess-speech-result { opacity: 0; }
.guess-speech.correct { border-color: var(--mugwort); background: var(--mugwort); color: var(--on-dye); }
.guess-speech.wrong { border-color: var(--safflower); background: var(--safflower); color: var(--on-dye); }

/* ---------- 서랍 (테이블 메뉴·채팅) ---------- */
.table-drawer {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(380px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: max(16px, env(safe-area-inset-top)) 20px max(20px, env(safe-area-inset-bottom));
  border: 0;
  border-left: var(--seam-width) solid var(--seam-strong);
  border-radius: 0;
}
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-heading h2 { font-size: var(--text-lg); }
.drawer-connection {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 16px;
  color: var(--ink-soft);
  font-size: var(--text-sm);
}
#roomBadge { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.side-section,
.table-tools,
.table-drawer > .arcade-chat {
  margin-top: 16px;
  padding-top: 16px;
  border-top: var(--seam-width) solid var(--seam);
}
.side-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.side-heading h2 { font-size: var(--text-md); }
.side-heading > span { color: var(--ink-soft); font-size: var(--text-sm); }
.player-list {
  display: grid;
  gap: var(--seam-width);
  border: var(--seam-width) solid var(--seam);
  border-radius: var(--radius);
  background: var(--seam);
  overflow: hidden;
}
.player-row { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 10px; background: var(--sheet); }
.player-row.active { background: var(--gardenia-tint); }
.player-name { flex: 1; min-width: 0; font-size: var(--text-sm); font-weight: 650; overflow-wrap: anywhere; }
.player-state { flex: none; color: var(--ink-soft); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.player-row.active .player-state { color: var(--ink); font-weight: 700; }
.event-log {
  max-height: 180px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}
.event-log li { padding: 4px 0; color: var(--ink-soft); font-size: var(--text-sm); line-height: 1.45; }
.event-log li:first-child { color: var(--ink); font-weight: 700; }
.table-tools { display: flex; justify-content: space-between; gap: 8px; }
.table-tools .btn { padding: 0 10px; }
.table-tools .leave-button { color: var(--safflower); }
.table-drawer.chat-only[open] { display: flex; flex-direction: column; overflow: hidden; }
.table-drawer.chat-only .side-section,
.table-drawer.chat-only .table-tools,
.table-drawer.chat-only .chat-heading { display: none; }
.table-drawer.chat-only > .arcade-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 0; border-top: 0; }
.table-drawer.chat-only .arcade-chat-list { flex: 1; min-height: 0; max-height: none; }
.table-drawer.chat-only .drawer-heading,
.table-drawer.chat-only .drawer-connection { flex: none; }

/* ---------- 결과·규칙·확인 대화상자 ---------- */
.result-panel {
  width: min(560px, calc(100vw - 24px));
  padding: 28px 24px 24px;
  text-align: center;
}
.result-close { position: absolute; top: 8px; right: 8px; }
.result-panel h2 { margin: 4px 40px 20px; font-size: var(--text-xl); }
.result-scores {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: var(--seam-width);
  margin-bottom: 16px;
  border: var(--seam-width) solid var(--seam);
  border-radius: var(--radius);
  background: var(--seam);
  overflow: hidden;
}
.result-score { display: flex; flex-direction: column; gap: 2px; padding: 14px 8px; background: var(--sheet); }
.result-score:first-child { background: var(--mugwort-tint); }
.result-score .rank { font-size: var(--text-xl); font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.result-score:first-child .rank { color: var(--mugwort); }
.result-score b { font-size: var(--text-md); overflow-wrap: anywhere; }
.result-score small { color: var(--ink-soft); font-size: var(--text-sm); }
.result-panel > p { color: var(--ink-soft); font-size: var(--text-sm); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 20px; }

.club-dialog { width: min(640px, calc(100vw - 24px)); max-width: none; padding: 20px 24px 24px; }
.club-dialog.compact { width: min(440px, calc(100vw - 24px)); }
.club-dialog.compact h2 { font-size: var(--text-lg); }
.club-dialog.compact p { margin-top: 10px; color: var(--ink-soft); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.dialog-heading h2 { font-size: var(--text-lg); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.rules-content { font-size: var(--text-sm); line-height: 1.75; }
.rules-content h3 { margin: 20px 0 6px; font-size: var(--text-md); }
.rules-content ol { margin: 0; padding-left: 20px; }
.rules-content li { margin: 6px 0; }
.rules-content p + p { margin-top: 8px; }
.rules-content .rule-note {
  padding: 12px 14px;
  border: var(--seam-width) solid var(--seam);
  border-radius: var(--radius);
  background: var(--cloth);
}

/* ---------- 넓은 화면보다 좁을 때 ---------- */
@media (max-width: 1100px) {
  .president-table { grid-template-columns: minmax(128px, 1fr) minmax(0, 2.6fr) minmax(128px, 1fr); }
  .rack-tag { display: none; }
}
@media (max-width: 900px) {
  .in-game .game-identity h1,
  .round-badge { display: none; }
  .in-game .game-identity { padding-right: 4px; }
}

/* 휴대폰 */
@media (max-width: 680px) {
  :root { --table-gutter: 16px; }
  .game-heading { min-height: 60px; gap: 8px; }
  .setup-layout { grid-template-columns: minmax(0, 1fr); }
  .intro-art { min-height: 0; gap: 16px; padding: 24px 20px 20px; }
  .intro-object { min-height: 120px; }
  .demo-card { width: 72px; margin-left: -20px; padding: 6px 8px; }
  .demo-card b { font-size: 20px; }
  .demo-card i { font-size: 36px; }
  .demo-code { width: 48px; margin: 0 3px; font-size: 28px; }
  .art-caption { font-size: var(--text-lg); }
  .intro-bottom { padding: 12px 20px; }
  .setup-card { padding: 20px 20px 24px; }
  .waiting-head { flex-direction: column; align-items: stretch; padding: 20px; }
  .waiting-head h2 { font-size: var(--text-lg); }
  .room-code { min-width: 0; }
  .waiting-room > .waiting-seats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .waiting-seat { padding: 16px 8px; }
  .waiting-actions { padding: 16px 20px; }
  /* 안내 문장은 한 줄을 다 쓰고, 버튼 둘은 그 아래 반씩 나눕니다(같은 줄에 끼면 '방 나가기'가 세로로 눌립니다). */
  .waiting-actions p { flex-basis: 100%; }
  .waiting-actions p:empty { display: none; }
  .waiting-actions .btn { flex: 1 1 0; white-space: nowrap; }
  .waiting-room > .arcade-chat { padding: 16px 20px; }

  .in-game .game-heading { height: calc(60px + env(safe-area-inset-top)); }
  .in-game .game-identity { padding: 0 2px; }
  .in-game .game-heading-meta { gap: 0; padding: 0 2px; }
  .in-game .game-heading-meta .btn { padding: 0 8px; }
  .game-heading-meta .menu-button { width: 44px; padding: 0; }
  .game-heading-meta .menu-button > span { display: none; }
  .game-identity h1 { overflow: hidden; text-overflow: ellipsis; }
  .in-game .turn-banner { padding: 0 10px; }
  .turn-banner h2 { font-size: var(--text-sm); }
  .turn-banner p {
    font-size: var(--text-xs);
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .my-panel { height: clamp(188px, 26dvh, 220px); padding: 8px 12px max(8px, env(safe-area-inset-bottom)); }
  .hand-heading h3 { font-size: var(--text-sm); }
  .hand-heading > span:last-child { font-size: var(--text-xs); }
  .action-hint { font-size: var(--text-xs); }
  .action-buttons .btn { min-width: 76px; padding: 0 12px; }
  .my-cards { --card-w: clamp(46px, 8.4dvh, 64px); padding-top: 16px; }

  .president-table {
    --card-w: clamp(44px, 13vw, 60px);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "left top right"
      "center center center"
      "event event event";
  }
  .opponent,
  .opponent[data-position="top"] { flex-direction: column; flex-wrap: nowrap; gap: 4px; padding: 8px 4px; }
  .opponent-name { font-size: var(--text-sm); }
  .opponent small { font-size: var(--text-xs); }
  .mini-hand { min-height: 34px; padding-left: 12px; }
  .mini-back { width: 22px; height: 33px; margin-left: -12px; }
  .opponent .seat-turn-label { padding: 0 6px; }
  .trick-zone { gap: 8px; padding: 12px 8px; }
  .cards-row { gap: 4px; }
  .cards-row:has(> :nth-child(5)) .playing-card { --card-w: 11vw; }
  .collected-pile { width: 22px; height: 33px; margin: 0 12px 12px 0; }
  .table-event { min-height: 36px; padding: 8px 12px; font-size: var(--text-xs); }

  .code-opponents { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .code-opponents:has(> :nth-child(3)) > :first-child { grid-column: 1 / -1; }
  .code-opponents:has(> :only-child) { grid-template-columns: minmax(0, 1fr); }
  .davinci-table.dealing .code-opponents { grid-template-columns: repeat(var(--opponents), minmax(0, 1fr)); }
  .davinci-table.dealing .code-opponents > :first-child { grid-column: auto; }
  .code-rack { padding: 6px 8px 2px; }
  .rack-label { font-size: var(--text-sm); }
  .tiles-row { --tile-gap: 5px; padding: 18px 6px; }
  .code-tile { width: clamp(26px, calc((100% - (var(--tile-count) - 1) * var(--tile-gap)) / var(--tile-count)), 40px); }
  .pool-zone { padding: 8px; }
  .pool-tile { width: clamp(24px, 4.2dvh, 34px); }
  .my-code { --hand-tile-w: 42px; gap: 10px; }
  .code-opponents:has(> :only-child) .code-tile { max-width: 48px; }
  .drawn-group { padding-left: 10px; }
  .drawn-group .code-tile { width: 40px; }
  .rack-tiles .drawn-group .code-tile { width: 26px; }
  .rack-tiles .drawn-caption { display: none; }
  .tile-placement-slots { --slot-w: 38px; }

  .result-panel { padding: 24px 16px 20px; }
  .result-score { padding: 12px 4px; }
  .result-score b,
  .result-score small { font-size: var(--text-xs); }
  .club-dialog { padding: 16px 18px 20px; }
}
@media (max-width: 680px) and (max-height: 670px) {
  .my-panel { height: 172px; }
  .my-cards { --card-w: 46px; }
  .my-code { --hand-tile-w: 38px; }
  .code-tile { max-width: 32px; }
  .tiles-row { padding: 16px 6px 17px; }
  .president-table { --card-w: 46px; }
  .mini-hand { min-height: 28px; }
  .mini-back { width: 18px; height: 27px; }
}
@media (max-width: 420px) {
  /* 대기실·게임 중에는 메뉴 버튼이 더해져 머리줄이 넘치므로 접속 인원 배지를 뺍니다. */
  .game-heading-meta:has(.menu-button:not([hidden])) .presence-inline,
  .game-heading-meta:has(.chat-shortcut:not([hidden])) .presence-inline { display: none; }
}
@media (max-width: 359px) {
  /* 접속 인원은 아래 공개 대기방에도 나오므로, 아주 좁은 머리줄에서는 빼서 제목·규칙 버튼 자리를 지킵니다. */
  .game-heading-meta .presence-inline { display: none; }
}
@media (max-width: 360px) {
  .in-game .game-heading-meta .btn { padding: 0 6px; }
  .action-buttons .btn { min-width: 64px; }
  .my-code { --hand-tile-w: 38px; }
}

/* 낮은 가로 화면: 내 패를 오른쪽 기둥으로 */
@media (max-height: 500px) and (min-width: 681px) {
  .in-game .game-heading { height: calc(52px + env(safe-area-inset-top)); }
  .turn-banner p { display: none; }
  .table-column { grid-template-columns: minmax(0, 1fr) minmax(260px, 34%); grid-template-rows: minmax(0, 1fr); }
  .my-panel { height: 100%; padding: 10px 14px max(10px, env(safe-area-inset-bottom)); }
  .my-cards { --card-w: 46px; align-content: flex-start; align-items: flex-start; flex-wrap: wrap; gap: 18px 4px; overflow-y: auto; }
  .my-cards .playing-card + .playing-card { margin-left: 0; }
  .action-bar { flex-wrap: wrap; gap: 4px; }
  .action-hint:empty { display: none; }
  .action-buttons { margin-left: auto; }
  .president-table { --card-w: 52px; }
  .opponent { padding: 6px; gap: 4px; }
  .mini-hand { min-height: 32px; }
  .mini-back { width: 20px; height: 30px; margin-left: -12px; }
  .davinci-table { grid-template-columns: minmax(170px, .9fr) minmax(0, 1.1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .code-opponents { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(0, 1fr); }
  .davinci-table.dealing .code-opponents { grid-template-columns: minmax(0, 1fr); }
  .davinci-table .table-event { grid-column: 1 / -1; }
  .code-rack { padding: 4px 8px 0; }
  .tiles-row { padding: 16px 6px; }
  .code-tile { max-width: 32px; }
  .my-code { --hand-tile-w: 40px; flex-direction: column; gap: 4px; }
  .my-code > .tiles-row { width: 100%; flex: none; height: auto; flex-wrap: wrap; overflow: visible; }
  .my-code .drawn-group { flex-direction: row; padding-left: 0; border-left: 0; }
  .pool-tile { width: 28px; }
  .rack-tiles .drawn-caption { display: none; }
}

/* ---------- 한 수 제한 시간 (다빈치코드) ---------- */
/* 배지·붉은 가장자리·알림은 /turn-timer.css. 여기서는 자리와 설정 칸만. */
.turn-timer-slot { display: contents; }
.turn-limit-field[hidden], .waiting-limit[hidden] { display: none; }
.field-hint { margin-top: 6px; font-size: var(--text-xs); line-height: 1.5; color: var(--ink-soft); }
.waiting-limit {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 32px;
}
.waiting-limit label { font-size: var(--text-sm); font-weight: 700; }
.waiting-limit select { width: auto; min-width: 136px; }
.waiting-limit select:disabled { opacity: 1; color: var(--ink); background: var(--cloth); }
.waiting-limit .field-hint { flex: 1 1 220px; margin: 0; }
@media (max-width: 680px) {
  .waiting-limit { padding: 12px 20px; }
  .waiting-limit select { flex: 1 1 auto; }
}
