/* 카탄 — 화면 */
/* 라이트가 기본. data-theme="dark" 를 붙이면 어두워진다 */
:root {
  --bg0: #f6efe0; --bg1: #e7dcc4;
  --panel: #fdfaf2; --panel2: #f3ecdb; --line: #d8c9a3;
  --ink: #2b2419; --dim: #6b5f49; --faint: #94886f;
  --gold: #b4761f; --good: #4f8c46; --bad: #c0342b;
  --sea: #7fa8c9; --sea2: #6d97b9; --seaLine: #5b83a4;
  --r-b: #c96f45; --r-l: #4d8a5c; --r-w: #a7c96a; --r-g: #e0b64f; --r-o: #98a4b8;
  --btnInk: #fff6ee;
  --shadow: 0 2px 10px rgba(80,60,25,0.10);
  --wood0: #c9a06a; --wood1: #9c7040;
  --paper: #f7efdc; --paper2: #efe4c9; --paperLine: #cdb98d;
  --display: "Hahmlet", "Nanum Myeongjo", "Apple Myungjo", Georgia, serif;      /* 옛 활자 — 표제와 버튼 */
  --serif: "Song Myung", "Nanum Myeongjo", "Apple Myungjo", Georgia, serif;     /* 옛 활자 — 부제와 설명 */
}
:root[data-theme="dark"] {
  --bg0: #1e242f; --bg1: #0d1017;
  --panel: #1a1f2a; --panel2: #222836; --line: #323a4a;
  --ink: #e8ebf2; --dim: #9aa3b5; --faint: #6b7386;
  --gold: #e8c06a; --good: #7fb069; --bad: #d95f4a;
  --sea: #223046; --sea2: #1c2839; --seaLine: #1a2436;
  --btnInk: #221a08;
  --shadow: 0 2px 12px rgba(0,0,0,0.35);
  --wood0: #4a3423; --wood1: #22170f;
  --paper: #232833; --paper2: #1b202a; --paperLine: #3a4152;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,255,255,0.18), transparent 60%),
    radial-gradient(100% 80% at 50% 100%, rgba(0,0,0,0.18), transparent 60%),
    repeating-linear-gradient(92deg, rgba(0,0,0,0.028) 0 2px, transparent 2px 9px),
    repeating-linear-gradient(88deg, rgba(255,255,255,0.05) 0 1px, transparent 1px 13px),
    linear-gradient(180deg, var(--wood0), var(--wood1));
  background-attachment: fixed;
  color: var(--ink);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  line-height: 1.5; letter-spacing: -0.01em;
  overscroll-behavior: none;
}
button {
  font: inherit; color: var(--ink);
  background: linear-gradient(180deg, rgba(255,255,255,0.45), rgba(0,0,0,0.04)), var(--paper2);
  border: 1px solid var(--paperLine); border-radius: 10px; padding: 10px 14px;
  cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.08s, box-shadow 0.08s, filter 0.12s;
}
button:hover:not(:disabled) { filter: brightness(1.04); }
button:active { transform: translateY(2px); box-shadow: 0 0 0 rgba(0,0,0,0.12), inset 0 1px 0 rgba(255,255,255,0.5); }
button.primary {
  background: linear-gradient(180deg, #d69a3c, #b4761f 60%, #9d651a);
  border-color: #7a4f14; color: var(--btnInk); font-weight: 700;
  box-shadow: 0 3px 0 #6d4410, inset 0 1px 0 rgba(255,255,255,0.35);
  text-shadow: 0 1px 0 rgba(0,0,0,0.25);
}
button.primary:active { box-shadow: 0 0 0 #6d4410, inset 0 1px 0 rgba(255,255,255,0.35); transform: translateY(3px); }
button.ghost { background: transparent; border: none; color: var(--dim); text-decoration: underline; }
button.mini { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
button:disabled { opacity: 0.4; cursor: default; }
input, select {
  font: inherit; color: var(--ink); background: var(--bg1);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.hidden { display: none !important; }
.row { display: flex; gap: 10px; }
.grow { flex: 1; }

/* ---------- 타이틀 ---------- */
#title { display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 100dvh; position: relative; }
.kicker {
  position: fixed; top: 18px; left: 18px; z-index: 10;
  font-family: var(--serif); font-size: 12px; letter-spacing: 0.18em; color: var(--dim);
}
.twrap {
  max-width: 440px; width: 100%; text-align: center;
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
/* 섬 — 바다 원반 위에 떠 있다 */
.hero { position: relative; width: min(340px, 84vw); aspect-ratio: 260 / 175; margin-bottom: 4px; }
.seaDisc {
  position: absolute; left: 6%; right: 6%; top: 12%; bottom: 4%; border-radius: 50%;
  background:
    radial-gradient(60% 55% at 50% 45%, rgba(255,255,255,0.22), transparent 70%),
    repeating-radial-gradient(circle at 50% 50%, rgba(255,255,255,0.10) 0 2px, transparent 2px 11px),
    radial-gradient(circle at 50% 50%, #8fb6d4, #5f8db0 70%, #4a7597);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,0.18), inset 0 -14px 30px rgba(0,0,0,0.25), 0 16px 34px rgba(0,0,0,0.35);
  animation: seaSpin 40s linear infinite;
}
@keyframes seaSpin { to { background-position: 0 0, 40px 40px, 0 0; } }
.tisle {
  position: absolute; left: 50%; top: 2%; width: 88%; transform: translateX(-50%);
  filter: drop-shadow(0 10px 18px rgba(0,0,0,0.35));
  animation: isleFloat 5s ease-in-out infinite;
}
@keyframes isleFloat { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-6px); } }
.tboat { animation: bob 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.tboat.b2 { animation-delay: -1.3s; }
/* 주사위 두 개 */
.tdice { position: absolute; right: 2%; bottom: -6%; display: flex; gap: 8px; }
.tdie {
  width: 34px; height: 34px; border-radius: 8px; padding: 5px;
  background: linear-gradient(160deg, #fffdf6, #efe6d2); border: 1.5px solid #2b2419;
  box-shadow: 0 6px 12px rgba(0,0,0,0.4), inset 0 -3px 0 rgba(0,0,0,0.1);
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
}
.tdie i { width: 6px; height: 6px; border-radius: 50%; background: #2b2419; place-self: center; }
.tdie.d1 { transform: rotate(-12deg); }
.tdie.d1 i:nth-child(1) { grid-area: 1/1; } .tdie.d1 i:nth-child(2) { grid-area: 1/3; }
.tdie.d1 i:nth-child(3) { grid-area: 3/1; } .tdie.d1 i:nth-child(4) { grid-area: 3/3; }
.tdie.d2 { transform: rotate(10deg) translateY(4px); }
.tdie.d2 i:nth-child(1) { grid-area: 1/1; } .tdie.d2 i:nth-child(2) { grid-area: 1/3; }
.tdie.d2 i:nth-child(3) { grid-area: 2/1; } .tdie.d2 i:nth-child(4) { grid-area: 2/3; }
.tdie.d2 i:nth-child(5) { grid-area: 3/1; } .tdie.d2 i:nth-child(6) { grid-area: 3/3; }

/* 로고 — 나무 간판에 새긴 금박 글씨 */
.logo {
  margin: 6px 0 0; font-family: var(--display); font-weight: 700;
  font-size: clamp(62px, 16vw, 88px); line-height: 1.12; letter-spacing: 0.10em; padding-left: 0.10em;
}
.logo span {
  background: linear-gradient(180deg, #fff1c4 0%, #e6b64a 45%, #b4761f 60%, #f2d38a 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #5c3b20) drop-shadow(0 4px 0 #3b2412) drop-shadow(0 8px 14px rgba(0,0,0,0.35));
}
.sublogo {
  margin: -2px 0 0; font-family: var(--serif); font-size: 15px; letter-spacing: 0.42em; color: var(--dim);
  padding-left: 0.42em;
}
.sublogo::before, .sublogo::after { content: '—'; margin: 0 0.6em; opacity: 0.5; }

/* 자원 카드 부채 */
.tfan { display: flex; align-items: flex-end; justify-content: center; margin: 4px 0 10px; padding-left: 22px; }
.tfan .resCard {
  margin-left: -22px; cursor: default;
  transform: rotate(calc((var(--i) - var(--mid, 2)) * 7deg)) translateY(calc(var(--i) * var(--i) * 1px - var(--i) * 4px + 4px));
}
.tfan .resCard:nth-child(1), .tfan .resCard:nth-child(5) { transform: rotate(calc((var(--i) - 2) * 7deg)) translateY(6px); }
.tfan .resCard:nth-child(2), .tfan .resCard:nth-child(4) { transform: rotate(calc((var(--i) - 2) * 7deg)) translateY(1px); }
.tfan .resCard:nth-child(3) { transform: translateY(-1px); }
.tfan .resCard:not(:last-child) .resFace, .tfan .resCard:not(:last-child) .resName { visibility: visible; }

.tfoot { margin: 2px 0 0; font-family: var(--serif); font-size: 12px; letter-spacing: 0.06em; color: var(--faint); }
button.big { width: 100%; max-width: 300px; padding: 14px; font-size: 17px; border-radius: 12px; font-family: var(--display); font-weight: 600; letter-spacing: 0.14em; }
button.ghost2 { background: transparent; color: var(--dim); box-shadow: none; }
button.ghost2:hover { color: var(--ink); }
.back { align-self: flex-start; padding: 0; margin-bottom: -4px; }

@media (max-width: 480px) {
  .hero { width: 78vw; }
  .tdice { display: none; }
}

/* 테마 슬라이드 토글 */
.tswitch {
  position: fixed; top: 14px; right: 14px; z-index: 10;
  display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
}
.tswitch input { position: absolute; opacity: 0; pointer-events: none; }
.tswitch .track {
  width: 46px; height: 26px; border-radius: 999px; background: var(--panel2);
  border: 1px solid var(--line); position: relative; transition: 0.2s;
}
.tswitch .knob {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--gold); transition: transform 0.2s;
}
.tswitch input:checked + .track .knob { transform: translateX(20px); }
.tlabel { font-size: 12.5px; color: var(--dim); min-width: 2.6em; text-align: left; }

/* ---------- 홈/대기실 ---------- */
.screen { min-height: 100dvh; }
#home .wrap, #lobby .wrap {
  max-width: 420px; margin: 0 auto; padding: 40px 20px 60px;
  display: flex; flex-direction: column; gap: 14px;
}
h1 { margin: 10px 0 0; font-size: 40px; letter-spacing: 0.02em; }
.tag { margin: 0 0 8px; color: var(--dim); font-size: 14px; }
.block { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); }
.block h2 { margin: 0; font-size: 15px; color: var(--gold); }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--dim); }
.field input, .field select { width: 100%; }
.fine { font-size: 12px; color: var(--faint); margin: 0; }
.code-in { text-transform: uppercase; letter-spacing: 0.3em; text-align: center; font-weight: 700; }
.sub { margin: 20px 0 0; font-size: 14px; color: var(--dim); text-align: center; }
.code { font-size: 44px; font-weight: 800; letter-spacing: 0.22em; text-align: center; color: var(--gold); }
.seats { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.seat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.seat .dot { width: 12px; height: 12px; border-radius: 50%; }
.seat .bot { color: var(--faint); font-size: 12px; margin-left: auto; }

/* ---------- 게임 ---------- */
#game { display: flex; flex-direction: column; height: 100dvh; }
.top { display: flex; align-items: flex-start; justify-content: space-between; padding: 8px 10px 0; gap: 8px; }
.topRight { display: flex; align-items: center; gap: 8px; }
.players { display: flex; gap: 6px; flex-wrap: wrap; }
.pl {
  background: linear-gradient(180deg, rgba(255,255,255,0.35), rgba(0,0,0,0.04)), var(--paper);
  border: 1px solid var(--paperLine); border-radius: 10px;
  padding: 5px 9px; font-size: 12px; display: flex; align-items: center; gap: 6px;
  border-left: 5px solid transparent;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.5);
}
.pl.turn { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.pl.turnMine { background: var(--panel2); box-shadow: 0 0 0 2px var(--gold); }
.pl.turnOther { opacity: 1; }
.pl:not(.turn) { opacity: 0.62; }
.turnMark { font-size: 10px; line-height: 1; animation: turnBlink 1.4s ease-in-out infinite; }
@keyframes turnBlink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.turnTag {
  font-size: 10px; font-weight: 800; letter-spacing: 0.02em;
  border-radius: 5px; padding: 1px 5px; white-space: nowrap;
  background: var(--gold); color: var(--btnInk);
}
.boardBox {
  transition: box-shadow 0.3s; border-radius: 14px;
  background:
    radial-gradient(80% 70% at 50% 45%, rgba(255,255,255,0.10), transparent 70%),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.05) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.16));
  border: 3px solid rgba(50,30,10,0.55);
  box-shadow: inset 0 0 0 2px rgba(255,220,160,0.25), inset 0 0 40px rgba(0,0,0,0.25), 0 8px 22px rgba(0,0,0,0.28);
}
.pl .nm { font-weight: 700; max-width: 9em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl .vp { font-weight: 800; color: var(--gold); }
.pl .st { color: var(--dim); }
.cardIc {
  display: inline-block; width: 8px; height: 11px; border-radius: 2px;
  background: #f2ead6; border: 1px solid #0008; vertical-align: -1.5px; margin-right: 2px;
}
.meTag {
  font-size: 10px; font-weight: 800; color: var(--btnInk); background: var(--gold);
  border-radius: 5px; padding: 0 4px; letter-spacing: 0.05em;
}
.pl .left { color: var(--faint); font-size: 10.5px; letter-spacing: 0.02em; }
.pl .badge { font-size: 10px; border: 1px solid var(--line); border-radius: 6px; padding: 0 4px; color: var(--gold); }
.pl.out { opacity: 0.45; }
.dice { display: flex; gap: 5px; }
.die {
  width: 30px; height: 30px; border-radius: 7px; background: #fffdf7; color: #222;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  font-weight: 800; font-size: 17px; display: flex; align-items: center; justify-content: center;
}
.dsum { font-weight: 800; font-size: 16px; color: var(--gold); align-self: center; }

/* 주사위 굴리기 연출 */
.diceOverlay {
  position: fixed; inset: 0; z-index: 45; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: radial-gradient(60% 50% at 50% 50%, #000a, #0004);
  opacity: 1; transition: opacity 0.28s;
}
.diceOverlay.out { opacity: 0; }
.diceWho { font-size: 15px; font-weight: 700; color: #fff; text-shadow: 0 2px 8px #000; min-height: 20px; }
.bigDice { display: flex; gap: 18px; }
.bigDie {
  width: 74px; height: 74px; border-radius: 15px; background: #f2ead6; padding: 10px;
  display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  box-shadow: 0 8px 24px #000a, inset 0 -3px 0 #0002;
}
.bigDie span { display: flex; align-items: center; justify-content: center; }
.bigDie i { width: 13px; height: 13px; border-radius: 50%; background: #2b2419; }
.bigDie.rolling { animation: tumble 0.34s linear infinite; }
.bigDie.rolling:last-child { animation-delay: 0.12s; }
@keyframes tumble {
  0% { transform: rotate(-10deg) translateY(-5px); }
  50% { transform: rotate(11deg) translateY(5px); }
  100% { transform: rotate(-10deg) translateY(-5px); }
}
.diceSum { font-size: 34px; font-weight: 800; color: #fff; text-shadow: 0 2px 10px #000; min-height: 42px; }
.diceNote { font-size: 15px; color: #e8c06a; min-height: 22px; font-weight: 600; }

.boardBox { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 2px 4px; position: relative; overflow: hidden; touch-action: none; }
#board { width: 100%; height: 100%; max-height: 66dvh; transform-origin: center center; will-change: transform; }

/* 판 */
.hex { stroke: #0b0e14; stroke-width: 1.5; }
.seaRing { fill: var(--sea); stroke: var(--seaLine); stroke-width: 2; }
.hex.t-forest { fill: #2e5d3f; }
.hex.t-pasture { fill: #79a352; }
.hex.t-fields { fill: #d9a441; }
.hex.t-hills { fill: #b06a3f; }
.hex.t-mountains { fill: #7a8494; }
.hex.t-desert { fill: #c9b48a; }
/* 방금 남이 지은 것 — 잠깐 반짝인다 */
.justBuilt {
  fill: none; stroke-width: 3; pointer-events: none;
  animation: justPulse 1.1s ease-in-out infinite;
}
.justBuiltRoad {
  stroke-width: 13; stroke-linecap: round; fill: none; pointer-events: none;
  opacity: 0.5; animation: justPulse 1.1s ease-in-out infinite;
}
@keyframes justPulse {
  0%   { opacity: 0.15; stroke-width: 3; }
  50%  { opacity: 0.9;  stroke-width: 5; }
  100% { opacity: 0.15; stroke-width: 3; }
}

/* 도둑이 앉은 칸 — 빗금으로 확실히 */
.hex.robbed { filter: saturate(0.45) brightness(0.72); }
.robHatch { pointer-events: none; }
.robRing { fill: none; stroke: #14171f; stroke-width: 3; opacity: 0.85; pointer-events: none; }

/* 생산한 칸 — 카드가 나오기 직전에 밝아진다 */
.hex.lit { animation: hexLit 0.85s ease-in-out infinite alternate; }
@keyframes hexLit {
  from { filter: brightness(1.06); stroke: var(--gold); stroke-width: 2.5; }
  to   { filter: brightness(1.5) saturate(1.2); stroke: var(--gold); stroke-width: 5; }
}
.hex.litRob { animation: hexRob 0.8s ease-in-out infinite alternate; }
@keyframes hexRob {
  from { stroke: #c0342b; stroke-width: 3; }
  to   { stroke: #ff6b52; stroke-width: 6; }
}
.hex.robTarget { cursor: pointer; }
.hex.robTarget:hover { filter: brightness(1.2); }
.chipC { fill: #f2ead6; stroke: #5a4630; stroke-width: 1.2; filter: drop-shadow(0 1.5px 1px rgba(0,0,0,0.45)); }
.tileLight { pointer-events: none; }
.chipC, .chipT, .terrEmo, .robber { pointer-events: none; }
.terrEmo { opacity: 0.95; }
.chipT { font-weight: 800; fill: #2b2419; text-anchor: middle; }
.chipT.hot { fill: #c0342b; }
.robber { fill: #14171f; stroke: #e8ebf2; stroke-width: 1; opacity: 0.95; }
.spotDot { fill: #ffb43d; stroke: #4a2c0a; stroke-width: 1.8; cursor: pointer; }
.spotDot:hover { fill: #ffcf70; }
.edgeHit {
  stroke: #ffb43d; stroke-opacity: 0.95; stroke-linecap: round; cursor: pointer;
  stroke-dasharray: 7 5; animation: edgeMarch 1.1s linear infinite;
}
@keyframes edgeMarch { to { stroke-dashoffset: -12; } }
.edgeHit:hover { stroke-opacity: 1; stroke-dasharray: none; }
.bld { stroke: #0b0e14; stroke-width: 1.2; }
.bld.pick { cursor: pointer; }
/* 항구 — 나무 부두와 선착장 다리 */
.port { pointer-events: none; }
.dock { fill: #d8b483; stroke: #6b4a2a; stroke-width: 1.8; }
.dockGrain { stroke: #6b4a2a; stroke-width: 0.9; opacity: 0.45; }
.pierBase { stroke: #6b4a2a; stroke-width: 7; stroke-linecap: round; }
.pierTop { stroke: #a9784b; stroke-width: 4.5; stroke-linecap: round; }
.plank { stroke: #6b4a2a; stroke-width: 1.2; opacity: 0.75; }
.portT { font-weight: 800; fill: #3a2713; }
.portDot { fill: #e8d9b8; stroke: #6b4a2a; stroke-width: 1.4; }

/* 로그 */
.log {
  max-height: 72px; overflow-y: auto; font-size: 12px; color: var(--dim);
  padding: 2px 14px; scrollbar-width: thin;
}
.log .mine { color: var(--gold); }

/* 아래 패널 */
.bottom { padding: 6px 10px calc(10px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; }
.rc {
  display: inline-flex; align-items: center; justify-content: center;
  width: 19px; height: 19px; border-radius: 5px; font-size: 12px; line-height: 1;
  font-style: normal; border: 1px solid rgba(0,0,0,0.4); vertical-align: -4px;
}
.r-b { background: var(--r-b); } .r-l { background: var(--r-l); } .r-w { background: var(--r-w); }
.r-g { background: var(--r-g); } .r-o { background: var(--r-o); }
.devchip {
  background: var(--panel2); border: 1px solid var(--gold); color: var(--gold);
  border-radius: 9px; padding: 4px 8px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.devchip.fresh { opacity: 0.45; cursor: default; }
.panel { display: flex; flex-direction: column; gap: 9px; }
.panelMsg { font-size: 14px; margin: 0; min-height: 21px; }
.buildRow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.buildRow.five { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 560px) { .buildRow.five { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* 짓기 버튼 — 이름·점수·재료가 한 몸이다. 모자란 재료는 흐리게 */
.bcard {
  display: flex; flex-direction: column; gap: 5px; align-items: center;
  padding: 8px 6px; min-width: 0;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 11px;
}
.bcard .bhead { display: flex; align-items: baseline; gap: 5px; justify-content: center; }
.bcard .bname { font-size: 13px; font-weight: 700; white-space: nowrap; }
.bcard .bpts { font-size: 11px; font-weight: 700; color: var(--gold); }
.bcard .bcost { display: flex; gap: 3px; justify-content: center; flex-wrap: wrap; }
.bcard .bcost .rc { width: 17px; height: 17px; font-size: 11px; }
.bcard.off { background: transparent; }
.bcard.off .bname { color: var(--dim); }
.bcard.off .bpts { color: var(--faint); }
.bcard.can { border-color: var(--good); box-shadow: 0 0 0 1px var(--good); }
.bcard.on { outline: 2px solid var(--gold); border-color: var(--gold); box-shadow: none; }
.rc.miss { opacity: 0.28; filter: grayscale(0.6); }
.panelFoot { font-size: 11px; color: var(--faint); margin: 0; }

/* 날아오는 카드 */
.flyCard {
  position: fixed; z-index: 60; pointer-events: none;
  width: 30px; height: 40px; border-radius: 6px;
  background: #f2ead6; border: 1.5px solid #0b0e14;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
  box-shadow: 0 4px 12px #0008;
  transition: transform 0.95s cubic-bezier(0.25, 0.9, 0.3, 1), opacity 0.3s;
}
/* 카드가 도착한 곳을 잠깐 밝힌다 */
.gotIt {
  animation: gotPulse 0.5s ease-out;
}
@keyframes gotPulse {
  0%   { box-shadow: 0 0 0 0 rgba(217,164,65,0.9); }
  100% { box-shadow: 0 0 0 12px rgba(217,164,65,0); }
}
.panelMsg b { color: var(--gold); }

/* 조작 블록 */
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; box-shadow: var(--shadow);
}

.acts { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.acts button { font-size: 13.5px; padding: 9px 15px; }
.acts button.push { margin-left: auto; }
.acts button.on { outline: 2px solid var(--gold); }

.toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%) translateY(10px);
  background: #000c; color: #fff; border-radius: 10px; padding: 9px 16px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: 0.2s; max-width: 88vw; z-index: 50;
}
.toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- 모달 ---------- */
.modal {
  position: fixed; inset: 0; background: #000a; z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.sheet {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 20px; max-width: 420px; width: 100%; max-height: 88dvh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px;
}
.sheet h3 { margin: 0; }
.sheet.tall { max-width: 460px; }
.rulesBody { font-size: 13.5px; color: var(--dim); }
.rulesBody h4 { margin: 12px 0 4px; color: var(--ink); }
.rulesBody p { margin: 0 0 6px; }
.costT { border-collapse: collapse; margin: 4px 0 8px; width: 100%; }
.costT td { padding: 4px 10px 4px 0; vertical-align: middle; }
.costT td:first-child { white-space: nowrap; font-weight: 600; color: var(--ink); }
.costT .ptd { color: var(--gold); font-weight: 700; white-space: nowrap; }
.costT .rtd { color: var(--dim); font-size: 12.5px; font-weight: 400; }
.rulesBody .hint { font-size: 12.5px; color: var(--faint); margin: -4px 0 8px; }
.tradeGrid { display: flex; gap: 14px; }
.tCol { flex: 1; }
.tCol h4 { margin: 0 0 6px; font-size: 13px; color: var(--dim); }
.tRow { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; }
.tRow .cnt { min-width: 20px; text-align: center; font-weight: 700; }
.tRow button { padding: 2px 9px; font-size: 15px; border-radius: 7px; }
.pickList { display: flex; flex-direction: column; gap: 8px; }
.pickList button { display: flex; align-items: center; gap: 8px; justify-content: flex-start; }

/* 첫 안내 */
.tstep { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.tstep p { margin: 0; font-size: 14px; color: var(--dim); text-align: left; }
.tpic { width: 100%; max-height: 130px; }
.tres { display: flex; justify-content: center; gap: 12px; font-size: 13px; }
.tres span { display: flex; align-items: center; gap: 4px; }
.tourNav { display: flex; align-items: center; justify-content: space-between; }
.dots { display: flex; gap: 5px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--gold); }

@media (max-width: 560px) {
  /* 좁으면 자원 이름은 접고 이모지와 숫자만 */
        .bcard { padding: 7px 3px; }
  .bcard .bname { font-size: 12px; }
  .bcard .bpts { font-size: 10px; }
  .bcard .bhead { gap: 3px; white-space: nowrap; }
  .bcard .bcost .rc { width: 15px; height: 15px; font-size: 10px; }
  .acts button { padding: 9px 12px; font-size: 13px; }
}
@media (max-width: 480px) {
  .pl { font-size: 11px; padding: 4px 7px; }
  .log { max-height: 74px; }
  #board { max-height: 48dvh; }
}


/* ---------------- 도시와 기사 ---------------- */

.ckBar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 7px 10px; margin-bottom: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 11px;
}
.barb { display: flex; align-items: center; gap: 7px; }
.barbLabel { font-size: 12px; font-weight: 700; color: var(--dim); white-space: nowrap; }
.barbTrack { display: flex; gap: 3px; }
.barbTrack i {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid var(--line); background: transparent;
}
.barbTrack i.on { background: #c0342b; border-color: #c0342b; }
.barbInfo { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.barbInfo.danger { color: #c0342b; font-weight: 700; }

.tracks { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.trk {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 7px; border: 1px solid var(--line); border-radius: 9px;
}
.trk-trade { border-color: #d9a441; }
.trk-politics { border-color: #5a8fd9; }
.trk-science { border-color: #5aa96b; }
.trkName { font-size: 11.5px; font-weight: 700; display: flex; align-items: center; gap: 3px; }
.trkName .rc { width: 15px; height: 15px; font-size: 10px; }
.trkPips { display: flex; gap: 2px; }
.trkPips i { width: 7px; height: 12px; border-radius: 2px; border: 1px solid var(--line); }
.trk-trade .trkPips i.on { background: #d9a441; border-color: #d9a441; }
.trk-politics .trkPips i.on { background: #5a8fd9; border-color: #5a8fd9; }
.trk-science .trkPips i.on { background: #5aa96b; border-color: #5aa96b; }
.metro { font-size: 10.5px; font-weight: 800; color: var(--gold); }
.trkBtn { font-size: 11px; padding: 3px 7px; border-radius: 7px; }
.trkBtn.can { border-color: var(--good); color: var(--ink); }

.devchip.trk-trade { border-color: #d9a441; }
.devchip.trk-politics { border-color: #5a8fd9; }
.devchip.trk-science { border-color: #5aa96b; }
.devchip.vp { border-color: var(--gold); color: var(--gold); cursor: default; }

.knight.mine { cursor: pointer; }
.knight.act circle { filter: brightness(1.15); }
.knightSel { fill: none; stroke: var(--gold); stroke-width: 2.5; stroke-dasharray: 3 3; }
.wallMark { pointer-events: none; opacity: 0.9; }
.merchantMark { fill: #e8d9b8; stroke: #6b4a2a; stroke-width: 1.5; pointer-events: none; }

@media (max-width: 560px) {
  .ckBar { gap: 6px; padding: 6px 8px; }
  .tracks { margin-left: 0; width: 100%; justify-content: space-between; }
  .trk { padding: 2px 5px; gap: 4px; }
  .trkName { font-size: 10.5px; }
  .barbInfo { font-size: 10.5px; }
}


/* ---------------- 중계 — 지금 무슨 일이 벌어지는가 ---------------- */

.nowBar {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 13px; margin-bottom: 6px; min-height: 40px;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255,255,255,0.35), transparent 55%),
    var(--paper);
  border: 1px solid var(--paperLine); border-radius: 11px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35), 0 3px 10px rgba(0,0,0,0.16);
  font-size: 14.5px; font-weight: 600; color: var(--ink);
  transition: background 0.25s, border-color 0.25s;
}
.nowDot {
  width: 11px; height: 11px; border-radius: 50%; flex: 0 0 auto;
  background: var(--faint); border: 1px solid rgba(0,0,0,0.25);
  transition: background 0.25s;
}
.nowText { flex: 1; min-width: 0; }
.nowText b { color: var(--gold); }
.nowBar.mine { border-color: var(--gold); background: var(--goldSoft, var(--panel2)); }
/* 내가 지금 해야 하는 일 — 놓치지 않게 */
.nowBar.urgent {
  border-color: #c0342b; color: #b3402f;
  animation: urgentPulse 1.1s ease-in-out infinite;
}
.nowBar.urgent .nowDot { background: #c0342b !important; }
@keyframes urgentPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,52,43,0.0); }
  50%      { box-shadow: 0 0 0 3px rgba(192,52,43,0.18); }
}
.bnSub { white-space: pre-line; }
.bnPair {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-top: 10px;
}
.bnName {
  font-size: 14px; font-weight: 800; padding: 3px 10px;
  border: 2px solid var(--line); border-radius: 9px;
}
.bnArrow { font-size: 18px; color: var(--dim); font-weight: 800; }
.nowBar.step .nowText { animation: nowIn 0.3s ease-out; }
@keyframes nowIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.nowWait {
  width: 26px; height: 6px; flex: 0 0 auto; display: flex; gap: 3px; align-items: center;
}
.nowWait i {
  width: 5px; height: 5px; border-radius: 50%; background: var(--faint);
  animation: nowPulse 1s infinite;
}
.nowWait i:nth-child(2) { animation-delay: 0.15s; }
.nowWait i:nth-child(3) { animation-delay: 0.3s; }
@keyframes nowPulse { 0%,60%,100% { opacity: 0.25; } 30% { opacity: 1; } }

/* 큰 소식 — 차례 넘어감, 최장 교역로, 기사단, 야만족 */
.bigNews {
  position: fixed; inset: 0; z-index: 55; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
}
.bigNewsInner {
  background: var(--panel); border: 2px solid var(--line);
  border-radius: 18px; padding: 20px 34px; text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  animation: bnPop 0.4s cubic-bezier(0.2, 1.3, 0.5, 1);
}
.bigNews.out .bigNewsInner { animation: bnOut 0.3s ease-in forwards; }
@keyframes bnPop {
  from { opacity: 0; transform: scale(0.85) translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes bnOut { to { opacity: 0; transform: scale(0.96); } }
.bigNewsInner.award {
  border-color: var(--gold);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 0 4px rgba(217,164,65,0.18);
}
.bigNewsInner.award .bnIcon { animation: awardSpin 0.7s cubic-bezier(0.2, 1.3, 0.4, 1); }
@keyframes awardSpin {
  from { transform: scale(0.4) rotate(-25deg); }
  to   { transform: none; }
}
.bnIcon { font-size: 34px; line-height: 1; margin-bottom: 6px; }
.bnTitle { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.bnSub { font-size: 13.5px; color: var(--dim); margin-top: 4px; }

@media (max-width: 560px) {
  .nowBar { font-size: 13px; padding: 8px 10px; min-height: 36px; }
  .bnTitle { font-size: 18px; }
  .bigNewsInner { padding: 16px 24px; }
}


/* 도둑이 옮겨 가는 모습 */
.robberGhost {
  position: fixed; z-index: 58; pointer-events: none;
  width: 32px; height: 32px; font-size: 24px; line-height: 32px; text-align: center;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.5));
  transition: transform 0.75s cubic-bezier(0.4, 0, 0.3, 1), opacity 0.26s;
}
/* 도둑에 막힌 타일 */
.blockMark {
  position: fixed; z-index: 58; pointer-events: none;
  width: 40px; height: 40px; font-size: 32px; line-height: 40px; text-align: center;
  opacity: 0.95; transition: opacity 0.3s;
  animation: blockPop 0.35s cubic-bezier(0.2, 1.4, 0.5, 1);
}
@keyframes blockPop { from { transform: scale(0.5); opacity: 0; } to { transform: none; opacity: 0.95; } }
/* 뒷면 카드 — 무엇을 빼앗겼는지 모른다 */
.flyCard.back { background: #6b5f49; color: #f2ead6; font-weight: 800; }


/* 도로 — 갓돌·포장·차선 */
.roadG { pointer-events: none; }
.roadEdge { stroke: #14171f; stroke-width: 11.5; stroke-linecap: round; opacity: 0.5; }
.roadBed { stroke-width: 9.5; stroke-linecap: round; }
.roadTop { stroke-width: 7; stroke-linecap: round; }
.roadShine { stroke-width: 2.2; stroke-linecap: round; opacity: 0.4; transform: translateY(-1.6px); }
.roadLane {
  stroke: #fff8e8; stroke-width: 1.3; stroke-linecap: butt;
  stroke-dasharray: 5 5; opacity: 0.72;
}


/* 로그 — 누구 이야기인지 색으로 */
.logRow { display: flex; align-items: baseline; gap: 6px; }
.log { padding: 4px 8px; border-radius: 8px; background: rgba(255,255,255,0.22); }
.logDot {
  width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto;
  transform: translateY(-1px);
}
.logTxt { flex: 1; min-width: 0; }
.logRow.last .logTxt { color: var(--ink); font-weight: 600; }


.pl .st.road { color: var(--faint); }


/* ---------------- 손패 — 부채처럼 펼친 카드 ---------------- */

.hand { display: flex; flex-direction: column; align-items: center; padding: 6px 0 2px; }
.handCards {
  position: relative; display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap;
  justify-content: center; max-width: 100%;
}
/* 경고 — 묶음 오른쪽에 매달린 느낌표. 정렬에는 영향을 주지 않는다 */
.handWarn {
  position: absolute; right: -34px; top: 50%; transform: translateY(-60%);
  width: 26px; height: 26px; padding: 0; border-radius: 50%;
  background: linear-gradient(180deg, #e0563f, #b3402f); border: 1.5px solid #fff3e6; color: #fff;
  font-size: 16px; font-weight: 900; line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35), 0 0 0 0 rgba(192,52,43,0.5);
  animation: warnPulse 1.6s ease-out infinite; cursor: help;
}
@keyframes warnPulse {
  0%   { box-shadow: 0 2px 6px rgba(0,0,0,0.35), 0 0 0 0 rgba(192,52,43,0.55); }
  100% { box-shadow: 0 2px 6px rgba(0,0,0,0.35), 0 0 0 12px rgba(192,52,43,0); }
}
.handWarn::after {
  content: attr(data-tip); white-space: pre-line;
  position: absolute; right: 0; bottom: calc(100% + 8px);
  min-width: 220px; max-width: 70vw; padding: 8px 11px; border-radius: 9px;
  background: #2b2419; color: #fdf8ec; font-size: 12.5px; font-weight: 600; line-height: 1.4; text-align: left;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
  opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity 0.15s, transform 0.15s;
}
.handWarn::before {
  content: ''; position: absolute; right: 8px; bottom: calc(100% + 2px);
  border: 6px solid transparent; border-top-color: #2b2419; opacity: 0; transition: opacity 0.15s;
}
.handWarn:hover::after, .handWarn:focus::after, .handWarn:hover::before, .handWarn:focus::before { opacity: 1; transform: none; }
@media (max-width: 560px) { .handWarn { right: -28px; width: 22px; height: 22px; font-size: 13px; } }
.cardSlot {
  position: relative; display: flex; flex-direction: column; align-items: center;
  padding-top: 4px;
}
/* 가진 장수만큼 실제로 펼쳐 놓는다 */
.fan { position: relative; display: flex; align-items: flex-end; height: 88px; }
.resCard {
  position: relative; flex: 0 0 auto;
  width: 62px; height: 84px; border-radius: 8px;
  background: var(--cardFace, #f7f1e2);
  border: 1.6px solid rgba(0,0,0,0.45);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  margin-left: -38px;                      /* 겹치는 정도 */
  transform-origin: bottom center;
  transform: rotate(calc((var(--i) - var(--mid, 2)) * 4deg));
  transition: transform 0.16s, filter 0.16s;
}
.resCard:first-child { margin-left: 0; }
.resCard { background-image: repeating-linear-gradient(0deg, rgba(0,0,0,0.02) 0 1px, transparent 1px 3px), radial-gradient(120% 100% at 20% 0%, rgba(255,255,255,0.7), transparent 60%); }
@media (hover:hover){.cardSlot:hover .resCard:last-child { transform: rotate(calc((var(--i) - var(--mid, 2)) * 4deg)) translateY(-8px); box-shadow: 0 8px 14px rgba(0,0,0,0.3); }}
.resCard .resFace { font-size: 30px; line-height: 1; }
.resCard .resName { font-size: 11px; font-weight: 700; color: #3a3227; letter-spacing: -0.02em; }
/* 뒤에 깔린 카드는 색띠만 — 글자가 삐져나오지 않게 */
.resCard:not(:last-child) .resFace,
.resCard:not(:last-child) .resName { visibility: hidden; }
.resCard::before {
  content: ''; position: absolute; left: 5px; right: 5px; top: 5px; height: 5px; border-radius: 3px;
  background: var(--tone, #bbb);
}
.resCard.r-b { --tone: #b5623f; }
.resCard.r-l { --tone: #2f6b46; }
.resCard.r-w { --tone: #8cc06a; }
.resCard.r-g { --tone: #d9a441; }
.resCard.r-o { --tone: #7b8794; }
.resCard.r-c { --tone: #c46b9a; }
.resCard.r-p { --tone: #6f9ec9; }
.resCard.r-n { --tone: #c9a227; }
.resCard.ghost {
  background: transparent; border-style: dashed; border-color: var(--line);
  box-shadow: none; opacity: 0.5; transform: none;
}
.resCard.ghost .resFace { filter: grayscale(1); opacity: 0.5; }
.resCard.ghost .resName { color: var(--faint); }
.resCard.taken { filter: grayscale(0.85) brightness(0.85); }

/* 몇 장인지 — 카드 아래 가운데 */
.cardCount {
  position: absolute; right: 4px; bottom: -11px; z-index: 3;
  min-width: 30px; height: 24px; padding: 0 8px; border-radius: 12px;
  background: #2b2419; color: #fdf8ec; border: 1.5px solid #fdf8ec;
  font-size: 15px; font-weight: 800; line-height: 21px; text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}
.cardCount.zero { background: var(--line); color: var(--dim); border-color: var(--panel); }
.cardSlot.selectable { cursor: pointer; }
@media (hover:hover){.cardSlot.selectable:hover .resCard { transform: rotate(calc((var(--i) - var(--mid, 2)) * 4deg)) translateY(-5px); }}
.cardSlot.sel .cardCount { background: var(--gold); color: var(--btnInk); }
.cardSlot.com .resCard { border-style: dashed; }

@media (prefers-color-scheme: dark) { :root { --cardFace: #efe6d2; } }
:root[data-theme="dark"] { --cardFace: #efe6d2; }

@media (max-width: 560px) {
  .hand { gap: 6px; }
  .fan { height: 62px; }
  .resCard { width: 40px; height: 58px; margin-left: -29px; border-radius: 6px; gap: 1px; }
  .resCard .resFace { font-size: 19px; }
  .resCard .resName { font-size: 8.5px; }
  .resCard::before { left: 3px; right: 3px; top: 3px; height: 3.5px; }
  .resCard:nth-last-child(n+4) { display: none; }   /* 좁으면 세 장까지만 — 맨 앞 카드는 남긴다 */
  .cardCount { min-width: 22px; height: 19px; line-height: 16px; font-size: 12px; bottom: -8px; right: 1px; padding: 0 5px; }
  .cardSlot { padding-top: 2px; }
}
@media (max-width: 400px) {
  .hand { gap: 4px; }
  .resCard { width: 36px; height: 52px; margin-left: -26px; }
  .resCard .resFace { font-size: 17px; }
  .resCard:nth-last-child(n+3) { display: none; }
}


/* ---------------- 판이 깔리는 연출 ---------------- */

.hex.tileIn {
  opacity: 0; transform-box: fill-box; transform-origin: center;
  animation: tileDrop 0.42s cubic-bezier(0.2, 1.2, 0.4, 1) forwards;
}
@keyframes tileDrop {
  0%   { opacity: 0; transform: scale(0.55) translateY(-14px); }
  70%  { opacity: 1; transform: scale(1.05); }
  100% { opacity: 1; transform: none; }
}
.chipIn {
  opacity: 0; transform-box: fill-box; transform-origin: center;
  animation: chipDrop 0.34s cubic-bezier(0.2, 1.3, 0.4, 1) forwards;
}
@keyframes chipDrop {
  0%   { opacity: 0; transform: scale(0.3); }
  70%  { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: none; }
}


/* 순서 정하기 */
.orderList { display: flex; gap: 10px; flex-wrap: wrap; }
.orderRow {
  display: flex; align-items: center; gap: 6px; font-size: 13px;
  background: var(--panel2); border: 1px solid var(--line); border-radius: 9px; padding: 5px 10px;
}
.orderRow.tie { border-color: var(--gold); }
.orderDot { width: 9px; height: 9px; border-radius: 50%; }
.orderVal { color: var(--dim); font-weight: 700; }


/* ==================== 분위기 — 연출 모음 ==================== */

/* 7 — 도둑이야! 흙먼지를 일으키며 화면을 가로지른다 */
.robberSweep {
  position: fixed; inset: 0; z-index: 70; pointer-events: none; overflow: hidden;
}
.sweepFig {
  position: absolute; top: 38%; left: -14vw; width: 98px; height: auto;
  filter: drop-shadow(0 8px 10px rgba(0,0,0,0.45));
  animation: sweepRun 1.5s cubic-bezier(0.3, 0.05, 0.6, 1) forwards;
}
@keyframes sweepRun {
  0%   { transform: translateX(0) scaleX(1) rotate(-6deg); }
  20%  { transform: translateX(22vw) translateY(-14px) scaleX(1) rotate(4deg); }
  40%  { transform: translateX(46vw) translateY(0)     scaleX(1) rotate(-5deg); }
  60%  { transform: translateX(70vw) translateY(-14px) scaleX(1) rotate(4deg); }
  100% { transform: translateX(130vw) translateY(0)    scaleX(1) rotate(-3deg); }
}
.sweepText {
  position: absolute; left: 50%; top: 22%; transform: translateX(-50%) scale(0.4);
  font-size: clamp(34px, 7vw, 64px); font-weight: 900; letter-spacing: -0.03em;
  color: #fff; -webkit-text-stroke: 2px #4a1d13;
  text-shadow: 0 6px 0 #4a1d13, 0 10px 24px rgba(0,0,0,0.5);
  opacity: 0; animation: sweepTextPop 1.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
@keyframes sweepTextPop {
  0%   { opacity: 0; transform: translateX(-50%) scale(0.4) rotate(-8deg); }
  18%  { opacity: 1; transform: translateX(-50%) scale(1.15) rotate(3deg); }
  30%  { transform: translateX(-50%) scale(1) rotate(-1deg); }
  85%  { opacity: 1; transform: translateX(-50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translateX(-50%) scale(1.1); }
}
.puff {
  position: absolute; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 40% 40%, #d9c39a, #a88b5c 60%, transparent 72%);
  opacity: 0.85; pointer-events: none;
  animation: puffOut 0.9s ease-out forwards;
}
@keyframes puffOut {
  0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0.9; }
  100% { transform: translate(-50%, -80%) scale(2.6); opacity: 0; }
}

/* 화면이 흔들린다 — 7, 야만족 상륙 */
.shake { animation: shakeIt 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both; }
@keyframes shakeIt {
  10%, 90% { transform: translate3d(-2px, 0, 0); }
  20%, 80% { transform: translate3d(3px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-5px, 1px, 0); }
  40%, 60% { transform: translate3d(5px, -1px, 0); }
}

/* 새 건물이 판에 툭 떨어진다 */
.bldDrop {
  transform-box: fill-box; transform-origin: center bottom;
  animation: bldDrop 0.55s cubic-bezier(0.2, 1.3, 0.35, 1) both;
}
@keyframes bldDrop {
  0%   { transform: translateY(-26px) scale(1.7); opacity: 0; }
  55%  { transform: translateY(2px) scale(0.92); opacity: 1; }
  75%  { transform: translateY(-3px) scale(1.04); }
  100% { transform: none; }
}
.dust { fill: #c9b48c; opacity: 0.7; pointer-events: none; animation: dustRing 0.7s ease-out forwards; }
@keyframes dustRing {
  0%   { r: 3; opacity: 0.75; }
  100% { r: 22; opacity: 0; }
}

/* 새 도로가 그어진다 */
.roadDraw line { stroke-dasharray: 1; stroke-dashoffset: 1; animation: roadDraw 0.55s ease-out forwards; }
.roadDraw line:nth-child(2) { animation-delay: 0.05s; }
.roadDraw line:nth-child(3) { animation-delay: 0.1s; }
.roadDraw line:nth-child(4) { animation-delay: 0.15s; }
.roadDraw line:nth-child(5) { animation-delay: 0.25s; }
@keyframes roadDraw { to { stroke-dashoffset: 0; } }

/* 놓을 수 있는 자리가 숨 쉬듯 깜빡인다 */
.spotDot { animation: spotBreathe 1.2s ease-in-out infinite; }
@keyframes spotBreathe { 0%,100% { opacity: 0.72; } 50% { opacity: 1; } }
/* 놓을 수 있는 자리에서 퍼져 나가는 고리 */
.spotHalo {
  fill: none; stroke: #ffb43d; stroke-width: 2.4; pointer-events: none;
  transform-box: fill-box; transform-origin: center;
  animation: spotRing 1.7s ease-out infinite;
}
@keyframes spotRing {
  0%   { transform: scale(0.7); opacity: 0.75; }
  70%  { transform: scale(2.0); opacity: 0; }
  100% { transform: scale(2.0); opacity: 0; }
}

/* 바다가 천천히 일렁인다, 6·8은 은은히 빛난다, 도둑은 숨을 쉰다 */
.seaRing { animation: seaBreathe 6s ease-in-out infinite; }
@keyframes seaBreathe { 0%,100% { filter: brightness(1); } 50% { filter: brightness(1.07) saturate(1.08); } }
.chipT.hot { animation: hotGlow 2.2s ease-in-out infinite; }
@keyframes hotGlow { 0%,100% { filter: drop-shadow(0 0 0 rgba(192,52,43,0)); } 50% { filter: drop-shadow(0 0 3px rgba(192,52,43,0.8)); } }
.robber { transform-box: fill-box; transform-origin: center bottom; animation: robberBob 2.4s ease-in-out infinite; }
@keyframes robberBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

/* 거래 성사 — 악수 */
.handshake {
  position: fixed; z-index: 62; pointer-events: none; font-size: 34px; line-height: 1;
  transform: translate(-50%, -50%) scale(0.3); opacity: 0;
  animation: shakePop 1.1s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}
@keyframes shakePop {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.3); }
  25%  { opacity: 1; transform: translate(-50%, -60%) scale(1.25); }
  40%  { transform: translate(-50%, -58%) scale(1); }
  80%  { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -80%) scale(1); }
}

/* 승리 — 색종이 */
.confetti { position: fixed; inset: 0; z-index: 80; pointer-events: none; overflow: hidden; }
.confetti i {
  position: absolute; top: -12px; width: 9px; height: 14px; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(105vh) rotate(720deg); opacity: 0.85; }
}

/* 야만족 트랙 — 함대가 한 칸 다가올 때 */
.barbTrack i.pop { animation: barbPop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes barbPop { 0% { transform: scale(0.3); } 60% { transform: scale(1.6); } 100% { transform: none; } }

/* 활동 상태가 된 기사 — 번쩍 */
.knight.flash circle { animation: knightFlash 0.7s ease-out; }
@keyframes knightFlash { 0% { filter: brightness(2.2); } 100% { filter: brightness(1); } }

@media (prefers-reduced-motion: reduce) {
  .sweepFig, .sweepText, .bldDrop, .roadDraw line, .confetti i, .shake { animation: none !important; }
}


/* ==================== 더 꾸미기 — 풍경·물결·배·트레이·명패 ==================== */

/* 타일 풍경 — 은은하게, 이모지와 숫자를 방해하지 않는다 */
.scene { pointer-events: none; opacity: 0.55; }
.scene .trunk { fill: #5a3b22; }
.scene .leaf  { fill: #1f5a34; }
.scene .leaf2 { fill: #2e7a48; }
.scene .grass { fill: none; stroke: #3f7a2f; stroke-width: 1.3; stroke-linecap: round; }
.scene .wool  { fill: #f4f1e6; stroke: #7a7160; stroke-width: 0.7; }
.scene .head  { fill: #4b3f33; }
.scene .legs  { stroke: #4b3f33; stroke-width: 1; }
.scene .furrow { fill: none; stroke: #a9791f; stroke-width: 1.4; opacity: 0.8; }
.scene .ear    { fill: none; stroke: #6f4f12; stroke-width: 1.1; stroke-linecap: round; }
.scene .mound  { fill: none; stroke: #7a4a2b; stroke-width: 1.6; opacity: 0.8; }
.scene .mound2 { fill: none; stroke: #7a4a2b; stroke-width: 1.2; opacity: 0.6; }
.scene .kiln   { fill: #b0603c; stroke: #5a2f1a; stroke-width: 0.9; }
.scene .brickLine { stroke: #5a2f1a; stroke-width: 0.7; fill: none; }
.scene .peak { fill: #6f7b8c; stroke: #3d4653; stroke-width: 0.8; }
.scene .snow { fill: #f3f5f8; }
.scene .dune { fill: none; stroke: #b9974f; stroke-width: 1.6; opacity: 0.7; }
.scene .cactus { fill: none; stroke: #3f7a3a; stroke-width: 2.4; stroke-linecap: round; }
/* 나무는 바람에 살랑인다 */
.sway { animation: sway 3.2s ease-in-out infinite; }
.tree:nth-child(2) { animation-delay: -0.8s; }
.tree:nth-child(3) { animation-delay: -1.6s; }
.tree:nth-child(4) { animation-delay: -2.2s; }
.tree:nth-child(5) { animation-delay: -1.1s; }
@keyframes sway { 0%,100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
/* 양이 천천히 풀을 뜯는다 */
.sheep { animation: graze 4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.sheep:nth-of-type(2) { animation-delay: -2s; }
@keyframes graze { 0%,100% { transform: translateX(0); } 50% { transform: translateX(2px); } }

/* 물결 */
.wave { fill: none; stroke: #fff; stroke-width: 1.1; opacity: 0.32; stroke-linecap: round;
  stroke-dasharray: 6 94; animation: waveFlow 7s linear infinite; }
@keyframes waveFlow { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
/* 항구의 배가 흔들린다 */
.boat { pointer-events: none; animation: bob 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-2px) rotate(3deg); } }

/* 주사위 트레이 — 가죽 바닥에 나무 테두리 */
.diceTray {
  padding: 18px 26px; border-radius: 22px;
  background:
    radial-gradient(90% 80% at 50% 40%, rgba(255,255,255,0.06), transparent 70%),
    repeating-linear-gradient(45deg, rgba(0,0,0,0.05) 0 2px, transparent 2px 6px),
    #3b2a22;
  border: 7px solid #8a5a33;
  box-shadow: inset 0 0 0 2px #5c3b20, inset 0 10px 24px rgba(0,0,0,0.55), 0 14px 30px rgba(0,0,0,0.5);
}
.bigDie {
  background: linear-gradient(160deg, #fffdf6, #efe6d2);
  box-shadow: inset 0 -4px 0 rgba(0,0,0,0.12), inset 0 2px 0 rgba(255,255,255,0.8), 0 8px 18px rgba(0,0,0,0.55);
}
.bigDie i { background: radial-gradient(circle at 35% 35%, #4a3b2c, #1d150e); box-shadow: inset 0 1px 1px rgba(255,255,255,0.15); }
/* 멈출 때 트레이에 툭 떨어진다 */
.bigDie.land { animation: dieLand 0.32s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes dieLand { 0% { transform: translateY(-14px) scale(1.08); } 60% { transform: translateY(2px) scale(0.97); } 100% { transform: none; } }

/* 큰 알림 — 나무 명패에 놋쇠 못 */
.bigNewsInner {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255,255,255,0.35), transparent 55%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.018) 0 1px, transparent 1px 4px),
    var(--paper);
  border: 3px solid #8a5a33;
  box-shadow: inset 0 0 0 2px #d9b98a, inset 0 0 0 3px #5c3b20, 0 14px 40px rgba(0,0,0,0.4);
  position: relative;
}
.bigNewsInner::before, .bigNewsInner::after {
  content: ''; position: absolute; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffe7a8, #b0782e 60%, #6b4416);
  box-shadow: 0 1px 2px rgba(0,0,0,0.5);
  top: 8px;
}
.bigNewsInner::before { left: 8px; } .bigNewsInner::after { right: 8px; }
.bigNewsInner.award { border-color: #b4761f; }

/* 뒷면 카드 — 짜임 무늬와 나침반 */
.flyCard.back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.08) 0 3px, transparent 3px 7px),
    repeating-linear-gradient(-45deg, rgba(0,0,0,0.12) 0 3px, transparent 3px 7px),
    #5a3b2a;
  color: #f2d9a8; border-color: #2b1a10;
}


@media (prefers-reduced-motion: reduce) {
  .sway, .sheep, .wave, .boat, .tisle, .tboat, .seaDisc, .bigDie.land { animation: none !important; }
}


/* ==================== 더 더 꾸미기 — 연기·발자국·말풍선·명패 ==================== */

/* 굴뚝 연기 — 위로 올라가며 커지고 흐려진다 */
.smoke {
  fill: #fff; opacity: 0; pointer-events: none;
  transform-box: fill-box; transform-origin: center;
  animation: smokeUp 3.3s ease-out infinite;
}
@keyframes smokeUp {
  0%   { opacity: 0;   transform: translate(0, 0) scale(0.6); }
  15%  { opacity: 0.6; }
  100% { opacity: 0;   transform: translate(4px, -18px) scale(2.2); }
}

/* 도둑 발자국 */
.footprint {
  position: fixed; z-index: 57; pointer-events: none; font-size: 15px; line-height: 1;
  opacity: 0; animation: stepFade 2.6s ease-out forwards; filter: sepia(1) saturate(0.6) brightness(0.55);
}
@keyframes stepFade { 0% { opacity: 0; } 12% { opacity: 0.75; } 60% { opacity: 0.55; } 100% { opacity: 0; } }

/* 이름표 말 */
.pawn { width: 14px; height: 14px; flex: 0 0 auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.35)); }

/* 봇 말풍선 — 지금 뭘 하는지 */
.pl { position: relative; overflow: visible; }
.think {
  position: absolute; left: 12px; top: calc(100% + 6px); z-index: 5;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 10px; white-space: nowrap;
  background: #fffdf5; color: #3a3227; font-size: 11px; font-weight: 700;
  border: 1px solid #cdb98d; box-shadow: 0 3px 8px rgba(0,0,0,0.22);
  animation: thinkIn 0.25s ease-out;
}
.think::before {
  content: ''; position: absolute; left: 12px; top: -6px;
  border: 5px solid transparent; border-bottom-color: #fffdf5; border-top: 0;
}
.think i { display: inline-flex; gap: 2px; }
.think b { width: 4px; height: 4px; border-radius: 50%; background: #8a7a5a; animation: thinkDot 1.1s infinite; }
.think b:nth-child(2) { animation-delay: 0.18s; } .think b:nth-child(3) { animation-delay: 0.36s; }
@keyframes thinkDot { 0%,60%,100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-2px); } }
@keyframes thinkIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
:root[data-theme="dark"] .think { background: #2a3140; color: #e8ebf2; border-color: #3a4152; }
:root[data-theme="dark"] .think::before { border-bottom-color: #2a3140; }
/* 말풍선이 아래 줄을 가리지 않게 이름표 줄에 여유 */
#players { padding-bottom: 22px; }

/* 생산된 숫자 칩이 튀어오른다 */
.chipG.chipPop { transform-box: fill-box; transform-origin: center; animation: chipPop 0.6s cubic-bezier(0.2, 1.4, 0.4, 1); }
@keyframes chipPop { 0% { transform: scale(1); } 40% { transform: scale(1.35) translateY(-3px); } 100% { transform: none; } }

/* 승리 — 트로피 명패 */
.sheet.trophy {
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255,255,255,0.35), transparent 55%),
    repeating-linear-gradient(0deg, rgba(0,0,0,0.018) 0 1px, transparent 1px 4px),
    var(--paper);
  border: 3px solid #8a5a33;
  box-shadow: inset 0 0 0 2px #d9b98a, inset 0 0 0 3px #5c3b20, 0 18px 50px rgba(0,0,0,0.45);
  position: relative;
}
.sheet.trophy::before {
  content: '\1F3C6'; display: block; text-align: center; font-size: 54px; line-height: 1;
  margin: -6px 0 6px; filter: drop-shadow(0 6px 8px rgba(0,0,0,0.3));
  animation: trophyIn 0.7s cubic-bezier(0.2, 1.4, 0.4, 1);
}
@keyframes trophyIn { from { transform: scale(0.3) rotate(-15deg); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet.trophy h3 { text-align: center; font-size: 24px; letter-spacing: -0.02em; margin: 0 0 12px; }
.overRow {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; margin: 5px 0;
  border-left: 5px solid transparent; border-radius: 8px;
  background: rgba(255,255,255,0.35);
}
.overRow.win { background: rgba(217,164,65,0.18); box-shadow: inset 0 0 0 1px rgba(180,118,31,0.45); }
.overRow .medal { font-size: 18px; width: 26px; text-align: center; }
.overRow .oname { flex: 1; font-size: 15px; }
.overRow .opts { font-weight: 800; color: var(--gold); font-size: 16px; }
.overRow .oextra { flex-basis: 100%; font-size: 12px; color: var(--dim); padding-left: 34px; }
.overRow { flex-wrap: wrap; }
:root[data-theme="dark"] .overRow { background: rgba(255,255,255,0.06); }

@media (prefers-reduced-motion: reduce) { .smoke, .footprint, .think b, .chipG.chipPop { animation: none !important; } }


/* 표제 서체 — 큰 글씨 여기저기 */
.bnTitle, .sweepText, .diceSum, #overTitle, .modal h3, .sheet h3, .tourStep h3 {
  font-family: var(--display); font-weight: 600; letter-spacing: 0.04em;
}
.bnTitle { font-size: 24px; }
.diceSum { font-size: 38px; font-weight: 700; }
.sweepText { font-weight: 700; }
.bnSub, .diceNote, .panelFoot { font-family: var(--serif); }


/* 타이틀 카드 부채는 손패 접기 규칙에서 제외 — 항상 다섯 장 */
.tfan .resCard { display: flex !important; }
@media (max-width: 560px) {
  .tfan { padding-left: 16px; margin: 2px 0 8px; }
  .tfan .resCard { width: 46px; height: 64px; margin-left: -16px; }
  .tfan .resCard .resFace { font-size: 22px; }
  .tfan .resCard .resName { font-size: 9px; }
  .tfan .resCard:not(:last-child) .resFace, .tfan .resCard:not(:last-child) .resName { visibility: visible; }
  .logo { font-size: clamp(56px, 19vw, 72px); }
  .kicker { top: 14px; left: 14px; font-size: 11px; }
}
#title, .twrap, .hero { max-width: 100%; }
#title { overflow: hidden; }


/* ==================== 타이틀 등장 — 판이 깔리듯 하나씩 ==================== */
/* #title.curtain 을 뗐다 붙이면 처음부터 다시 돈다 (app.js show) */

@keyframes tFadeUp   { from { opacity: 0; translate: 0 14px; } }
@keyframes tFadeIn   { from { opacity: 0; } }
@keyframes tDiscIn   { 0% { opacity: 0; transform: scale(0.5); } 70% { opacity: 1; transform: scale(1.05); } 100% { opacity: 1; transform: none; } }
@keyframes tTileIn   { 0% { opacity: 0; transform: scale(0.45) translateY(-16px); } 70% { opacity: 1; transform: scale(1.07); } 100% { opacity: 1; transform: none; } }
@keyframes tPopIn    { 0% { opacity: 0; transform: scale(0.2); } 70% { opacity: 1; transform: scale(1.15); } 100% { opacity: 1; transform: none; } }
@keyframes tSailL    { from { opacity: 0; transform: translateX(-26px); } }
@keyframes tSailR    { from { opacity: 0; transform: translateX(26px); } }
@keyframes tRollIn   { 0% { opacity: 0; transform: translateX(54px) rotate(150deg); } 70% { opacity: 1; transform: translateX(-4px) rotate(-8deg); } 100% { opacity: 1; transform: none; } }
@keyframes tStamp    { 0% { opacity: 0; transform: scale(1.4); } 55% { opacity: 1; transform: scale(0.96); } 100% { opacity: 1; transform: none; } }
@keyframes tSpread   { from { opacity: 0; letter-spacing: 0.08em; } }
@keyframes tCardIn   { from { opacity: 0; translate: 0 26px; } }

#title.curtain .kicker,
#title.curtain .tswitch      { animation: tFadeIn 0.5s ease 0.02s backwards; }
#title.curtain .seaDisc      { animation: tDiscIn 0.5s cubic-bezier(0.2,1.1,0.4,1) 0.1s backwards, seaSpin 40s linear infinite; }
/* 섬 육각형 일곱 장이 시계 방향으로 톡톡 */
#title.curtain .tisle g:first-of-type > polygon {
  transform-box: fill-box; transform-origin: center;
  animation: tTileIn 0.4s cubic-bezier(0.2,1.2,0.4,1) var(--d) backwards;
}
#title.curtain .tisle g:first-of-type > polygon:nth-child(1) { --d: 0.30s; }
#title.curtain .tisle g:first-of-type > polygon:nth-child(2) { --d: 0.36s; }
#title.curtain .tisle g:first-of-type > polygon:nth-child(3) { --d: 0.42s; }
#title.curtain .tisle g:first-of-type > polygon:nth-child(4) { --d: 0.48s; }
#title.curtain .tisle g:first-of-type > polygon:nth-child(5) { --d: 0.54s; }
#title.curtain .tisle g:first-of-type > polygon:nth-child(6) { --d: 0.60s; }
#title.curtain .tisle g:first-of-type > polygon:nth-child(7) { --d: 0.66s; }
/* 숫자 칩과 지형 그림이 뒤이어 */
#title.curtain .tisle > circle,
#title.curtain .tisle > text:not(.tboat) {
  transform-box: fill-box; transform-origin: center;
  animation: tPopIn 0.32s cubic-bezier(0.2,1.3,0.4,1) 0.7s backwards;
}
/* 도로와 마을 */
#title.curtain .tisle > line,
#title.curtain .tisle > g:nth-of-type(2) { animation: tFadeIn 0.34s ease 0.86s backwards; }
/* 배는 양옆에서 미끄러져 들어온다 */
#title.curtain .tboat    { animation: tSailL 0.6s ease 0.44s backwards, bob 2.6s ease-in-out 1.04s infinite; }
#title.curtain .tboat.b2 { animation: tSailR 0.6s ease 0.5s backwards, bob 2.6s ease-in-out -1.3s infinite; }
/* 주사위가 굴러 들어온다 */
#title.curtain .tdice    { animation: tRollIn 0.55s cubic-bezier(0.25,1.1,0.35,1) 0.84s backwards; }
/* 로고는 도장처럼 찍힌다 */
#title.curtain .logo     { animation: tStamp 0.48s cubic-bezier(0.2,1.3,0.4,1) 0.96s backwards; }
#title.curtain .sublogo  { animation: tSpread 0.5s ease 1.16s backwards; }
/* 자원 카드가 한 장씩 펼쳐진다 */
#title.curtain .tfan .resCard { animation: tCardIn 0.42s cubic-bezier(0.2,0.9,0.3,1.2) var(--cd) backwards; }
#title.curtain .tfan .resCard:nth-child(1) { --cd: 1.22s; }
#title.curtain .tfan .resCard:nth-child(2) { --cd: 1.28s; }
#title.curtain .tfan .resCard:nth-child(3) { --cd: 1.34s; }
#title.curtain .tfan .resCard:nth-child(4) { --cd: 1.40s; }
#title.curtain .tfan .resCard:nth-child(5) { --cd: 1.46s; }
#title.curtain #btnPlay  { animation: tFadeUp 0.4s ease 1.5s backwards; }
#title.curtain #btnRules { animation: tFadeUp 0.4s ease 1.58s backwards; }
#title.curtain .tfoot    { animation: tFadeUp 0.4s ease 1.66s backwards; }

@media (prefers-reduced-motion: reduce) {
  #title.curtain .kicker, #title.curtain .tswitch, #title.curtain .seaDisc,
  #title.curtain .tisle g:first-of-type > polygon, #title.curtain .tisle > circle,
  #title.curtain .tisle > text, #title.curtain .tisle > line, #title.curtain .tisle > g,
  #title.curtain .tboat, #title.curtain .tboat.b2, #title.curtain .tdice,
  #title.curtain .logo, #title.curtain .sublogo, #title.curtain .tfan .resCard,
  #title.curtain #btnPlay, #title.curtain #btnRules, #title.curtain .tfoot {
    animation: none !important;
  }
}


/* ==================== 뽑은 카드 펼쳐 보이기 ==================== */
.cardReveal {
  position: fixed; inset: 0; z-index: 78; display: flex; align-items: center; justify-content: center;
  background: rgba(24, 16, 6, 0.5); cursor: pointer;
  animation: tFadeIn 0.22s ease;
}
.crWrap {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  animation: crPop 0.4s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
@keyframes crPop { from { opacity: 0; transform: scale(0.86); } }
/* 뒷면으로 나타나 앞면으로 뒤집힌다.
   투명도를 여기서 건드리면 3D 가 납작해져 뒤집기가 안 보인다 — 페이드는 .crWrap 이 맡는다 */
.crFlip {
  position: relative; width: min(330px, 82vw); aspect-ratio: 460 / 825;
  transform-style: preserve-3d;
  animation: crTurn 0.62s cubic-bezier(0.45, 0.05, 0.25, 1) 0.45s both;
}
@keyframes crTurn {
  from { transform: perspective(1100px) rotateY(0deg); }
  to   { transform: perspective(1100px) rotateY(180deg); }
}
.crSide {
  position: absolute; inset: 0; border-radius: 15px; overflow: hidden;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  box-shadow: 0 24px 46px rgba(0, 0, 0, 0.55);
}
.crBack img { width: 100%; height: 100%; object-fit: cover; display: block; }
.crCard {
  transform: rotateY(180deg);
  padding: 22px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px;
  background: linear-gradient(170deg, var(--paper), var(--paper2));
  border: 2px solid var(--paperLine);
}
/* 어느 더미에서 나온 카드인지 — 띠 색으로 */
.crCard::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 8px; background: var(--crBand, #8a6a3c);
}
.crCard.k-dev { --crBand: #6b5f49; }
.crCard.k-sci { --crBand: #4f8c46; }
.crCard.k-pol { --crBand: #4a72a8; }
.crCard.k-tra { --crBand: #d9a441; }
.crKind {
  font-family: var(--serif); font-size: 12.5px; letter-spacing: 0.14em; color: var(--dim);
  border-bottom: 1px solid var(--paperLine); padding: 2px 12px 7px;
}
.crEmoji { font-size: 72px; line-height: 1.1; filter: drop-shadow(0 4px 6px rgba(0,0,0,0.25)); }
.crName { font-family: var(--display); font-weight: 700; font-size: 28px; color: var(--ink); letter-spacing: 0.03em; }
.crDesc { font-size: 14px; line-height: 1.7; color: var(--dim); }
.crHint { font-size: 11.5px; color: rgba(255,255,255,0.72); text-shadow: 0 1px 3px rgba(0,0,0,0.6); letter-spacing: 0.04em; }
/* 그림이 있는 카드는 그림이 카드 그 자체 */
.crCard.art { padding: 0; border: none; background: none; }
.crCard.art::before { display: none; }
.crImg { width: 100%; height: 100%; object-fit: cover; display: block; }
.crImg[hidden] { display: none; }   /* display:block 이 hidden 을 덮어써 빈 자리가 생기던 것 */
/* 최장 교역로 · 최강 기사단 — 실제 카드를 띄운다 */
.bnCard {
  display: block; max-width: min(340px, 76vw); max-height: 40vh; width: auto; height: auto;
  margin: 8px auto 0; border-radius: 10px; box-shadow: 0 12px 26px rgba(0,0,0,0.45);
}
/* 손패 칩에 붙는 카드 그림 조각 */
.chipArt {
  width: 20px; height: 20px; border-radius: 5px; margin-right: 6px; vertical-align: -5px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
/* 남이 쥔 카드 — 뒷면을 겹쳐 장수만 */
.stCards { display: inline-flex; align-items: center; gap: 3px; vertical-align: -3px; }
.stCards .miniBack {
  width: 13px; height: 19px; border-radius: 2.5px; display: inline-block; position: relative;
  background: url('img/back-s.webp') center/cover, #6b4a2f;
  border: 0.5px solid rgba(0,0,0,0.5); box-shadow: 0 1px 2px rgba(0,0,0,0.32);
}
.stCards .miniBack:nth-child(1) { transform: rotate(-6deg); }
.stCards .miniBack:nth-child(3) { transform: rotate(6deg); }
.stCards .stIcon { font-style: normal; font-size: 11px; opacity: 0.75; }
.stCards .stNum { margin-left: 3px; font-weight: 800; font-size: 11.5px; }
/* 도움말의 발전 카드 목록 — 그림을 함께 */
.gArt { width: 34px; height: 34px; border-radius: 7px; margin-right: 8px; vertical-align: -11px; box-shadow: 0 1px 4px rgba(0,0,0,0.28); }

@media (prefers-reduced-motion: reduce) {
  .cardReveal { animation: none !important; }
  .crWrap { animation: none !important; }
  .crFlip { animation: none !important; transform: perspective(1100px) rotateY(180deg) !important; }
}

/* 아직 다듬는 중인 판이라는 표시 */
.fine.warn {
  display: flex; align-items: flex-start; gap: 7px;
  margin-top: 6px; padding: 8px 11px; border-radius: 9px;
  background: rgba(217, 164, 65, 0.16); border: 1px solid rgba(180, 118, 31, 0.45);
  color: var(--ink);
}
.fine.warn::before { content: '\26A0\FE0F'; font-size: 13px; line-height: 1.5; }
/* 도움말의 확장판 진보카드 더미 이름표 */
.ckDeck { margin: 12px 0 4px; font-weight: 800; font-size: 13px; padding-left: 9px; border-left: 4px solid var(--line); }
.ckDeck.d-sci { border-left-color: #4f8c46; }
.ckDeck.d-pol { border-left-color: #4a72a8; }
.ckDeck.d-tra { border-left-color: #d9a441; }


/* ==================== 단계 표시줄 ==================== */
.phaseBar {
  display: flex; gap: 6px; align-items: center; justify-content: center;
  padding: 6px 10px 0; flex-wrap: wrap;
}
.phStep {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700; color: var(--faint);
  background: var(--panel2); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 10px 3px 4px;
}
.phStep i {
  width: 17px; height: 17px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-style: normal; font-size: 10.5px;
  background: var(--line); color: var(--panel); font-weight: 800;
}
.phStep.done { color: var(--dim); }
.phStep.done i { background: var(--good); color: #fff; }
.phStep.on {
  color: var(--ink); background: var(--panel); border-color: var(--gold);
  box-shadow: 0 0 0 1.5px var(--gold);
}
.phStep.on i { background: var(--gold); color: var(--btnInk); }

/* ==================== 단계 관문 ==================== */
.gate {
  position: fixed; inset: 0; z-index: 82; display: flex; align-items: center; justify-content: center;
  background: rgba(22, 14, 5, 0.55); padding: 20px; animation: tFadeIn 0.2s ease;
}
.gateInner {
  width: min(360px, 92vw); max-height: 86vh; overflow: auto; text-align: center;
  background: linear-gradient(170deg, var(--paper), var(--paper2));
  border: 2px solid var(--paperLine); border-radius: 16px; padding: 20px 18px 16px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5), inset 0 0 0 4px rgba(255,255,255,0.3);
  animation: crPop 0.34s cubic-bezier(0.2, 1.2, 0.4, 1) both;
}
.gateIcon { font-size: 40px; line-height: 1; }
.gateTitle {
  font-family: var(--display); font-weight: 700; font-size: 23px; color: var(--ink);
  margin-top: 6px; letter-spacing: 0.02em;
}
.gateSub { font-size: 13.5px; line-height: 1.65; color: var(--dim); margin-top: 6px; }
.gateList { display: flex; flex-direction: column; gap: 5px; margin: 12px 0 4px; }
.gateRow {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: rgba(0,0,0,0.05); border-left: 4px solid var(--line);
  border-radius: 8px; padding: 7px 10px; font-size: 13.5px;
}
.gateRow .grName { font-weight: 700; }
.gateRow .grVal { color: var(--dim); font-variant-numeric: tabular-nums; }
.gateBtn { width: 100%; margin-top: 12px; padding: 12px; font-size: 16px; }

/* 판 위에서 누를 자리 — 보이는 점보다 넓은 과녁 */
.spotHit { fill: transparent; cursor: pointer; }
.spotDot { pointer-events: none; }

/* ==================== 좁은 화면에서 판을 크게 ==================== */
@media (max-width: 760px) {
  /* 내 차례가 아니면 조작판을 접어 판에 자리를 준다 */
  #game:not(.mine) .buildRow,
  #game:not(.mine) .panelFoot,
  #game:not(.mine) .acts { display: none; }
  #game:not(.mine) .panel { padding: 8px 12px; }
  #game:not(.mine) .handCards { transform: scale(0.82); transform-origin: center bottom; }
  /* 판 위에 놓는 중에는 손패까지 접는다 */
  #game.placing .hand { display: none; }
  #game.placing .buildRow,
  #game.placing .panelFoot { display: none; }
  #game.placing .boardBox { box-shadow: inset 0 0 0 2px rgba(255,220,160,0.4), 0 0 0 2px var(--gold), 0 8px 22px rgba(0,0,0,0.3); }
  .phStep { font-size: 10.5px; padding: 2px 8px 2px 3px; }
  .phStep i { width: 15px; height: 15px; font-size: 9.5px; }
}

/* ==================== 좁은 화면 — 위아래를 줄여 판을 키운다 ==================== */
@media (max-width: 560px) {
  /* 이름표는 한 줄로, 옆으로 밀어 본다 */
  .players {
    flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 2px;
  }
  .players::-webkit-scrollbar { display: none; }
  .pl { flex: 0 0 auto; padding: 4px 7px; font-size: 11px; gap: 4px; }
  .pl .left { display: none; }            /* 남은 말 수는 도움말에서 */
  .pl .nm { max-width: 5.2em; }
  .think { display: none; }                /* 누가 뭘 하는지는 위 안내줄이 말해 준다 */
  .top { padding: 6px 8px 0; }
  /* 순서를 정하는 동안은 짓기 칸·손패가 필요 없다 */
  #game.ordering .buildRow,
  #game.ordering .panelFoot,
  #game.ordering .hand { display: none; }
  /* 판을 우선으로 */
  #board { max-height: none; }
  .boardBox { padding: 2px; }
  .log { max-height: 56px; }
  .panelMsg { font-size: 13.5px; }
}
@media (max-width: 560px) {
  .topRight { flex: 0 0 auto; }
  #btnHelp { white-space: nowrap; padding: 5px 8px; font-size: 12px; align-self: flex-start; }
}


/* ==================== 조작판 새 단장 ==================== */
.panel { gap: 0; }
.pHead {
  display: flex; align-items: center; gap: 7px; margin-bottom: 8px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.pDot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 2px rgba(0,0,0,0.12); }
.pWho { font-size: 13px; font-weight: 800; color: var(--ink); }
.pHead.mine .pWho { color: var(--gold); }
.pPhase {
  margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--dim); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 9px;
}
.pDo { margin: 0; font-size: 16px; line-height: 1.5; font-weight: 700; color: var(--ink); }
.pDo b { color: var(--gold); }
.pWhy { margin: 4px 0 0; font-size: 12.5px; line-height: 1.6; color: var(--dim); }
.pWhy b { color: var(--ink); font-weight: 700; }

/* 지을 것 구역 머리 */
.pSec {
  display: flex; align-items: center; gap: 8px; margin: 12px 0 6px;
  font-size: 11.5px; font-weight: 800; color: var(--faint); letter-spacing: 0.04em;
}
.pSec::after { content: ''; flex: 1; height: 1px; background: var(--line); order: 3; }
.pSecNum { order: 4; color: var(--dim); font-variant-numeric: tabular-nums; }

/* 거래 줄 */
.pTrade { display: flex; gap: 7px; margin-top: 10px; }
.pGhost {
  flex: 1; background: var(--panel2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 10px; padding: 10px 8px; font-size: 13px; font-weight: 700; box-shadow: none;
}
.pGhost:hover { border-color: var(--gold); }

/* 주 버튼 — 화면에 하나만, 크게 */
.pMain { display: flex; gap: 8px; margin-top: 12px; }
.pBig { flex: 1; padding: 13px; font-size: 16px; font-weight: 800; border-radius: 12px; letter-spacing: 0.02em; }
.pBig:disabled { opacity: 0.45; }
.pBig.warn { background: linear-gradient(180deg, #d98a3e, #b4671f); }
.pMain .pGhost { flex: 0 0 auto; padding: 13px 18px; }

@media (max-width: 560px) {
  .pDo { font-size: 15px; }
  .pWhy { font-size: 12px; }
  .pBig { padding: 14px; font-size: 16px; }
}

.panel { overflow: hidden; }
.bcard { overflow: hidden; }
.bcard .bcost { flex-wrap: wrap; }

/* 이름표 줄이 화면을 밀어내지 않게 — 넘치면 그 안에서만 옆으로 스크롤 */
.top .players { flex: 1 1 auto; min-width: 0; }
html, body { overflow-x: hidden; }


/* ==================== 좁은 화면 — 판이 눌려 사라지지 않게 ==================== */
@media (max-width: 560px) {
  /* 판과 조작판이 서로 자리를 뺏지 않게 — 놓는 중엔 판, 고르는 중엔 조작판 */
  .boardBox { min-height: 26dvh; }
  #game.placing .boardBox { min-height: 50dvh; }
  #game:not(.mine) .boardBox { min-height: 44dvh; }

  /* 손패 — 0장인 자원 칸은 접는다. 한 줄로 옆으로 밀어 본다 */
  .hand { overflow-x: auto; scrollbar-width: none; }
  .hand::-webkit-scrollbar { display: none; }
  .handCards { flex-wrap: nowrap; }
  #game .cardSlot.empty { display: none; }

  /* 도시와 기사 표시줄 — 두 줄 안에 들어오게 */
  .ckBar { gap: 5px 8px; padding: 5px 8px; margin-bottom: 4px; }
  .barbLabel { font-size: 11px; }
  .barbTrack i { width: 8px; height: 8px; }
  .trk { padding: 2px 4px; gap: 3px; }
  .trkPips i { width: 5px; height: 10px; }
  .trkBtn { font-size: 10px; padding: 2px 5px; }
  .metro { font-size: 9.5px; }
}


/* 조작판이 길어지면 그 안에서 스크롤하고, 주 버튼은 바닥에 붙여 둔다 */
@media (max-width: 560px) {
  /* 조작판은 남는 만큼만 차지하고 그 안에서 스크롤한다 */
  #game { overflow: hidden; }
  .bottom { min-height: 0; flex: 0 1 auto; overflow: hidden; }
  .hand { flex: 0 0 auto; }
  .panel { flex: 0 1 auto; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  #game:not(.mine) .panel { overflow: visible; }
  .pMain {
    position: sticky; bottom: -1px; z-index: 2;
    margin-top: 12px; padding: 9px 0 2px; background: var(--panel);
    box-shadow: 0 -10px 12px -8px rgba(0,0,0,0.22);
  }
}


/* 도시와 기사 표시줄 — 좁은 화면에서 두 줄 안에 */
@media (max-width: 560px) {
  .ckBar { padding: 4px 7px; gap: 4px 6px; }
  .barb { width: 100%; gap: 5px; }
  .tracks { width: 100%; gap: 4px; flex-wrap: nowrap; }
  .trk { flex: 1 1 0; min-width: 0; justify-content: space-between; padding: 2px 4px; gap: 2px; }
  .trkName { font-size: 10px; gap: 2px; }
  .trkName .rc { width: 12px; height: 12px; font-size: 8px; }
  .trkPips { gap: 1px; }
  .trkPips i { width: 4px; height: 9px; }
  .trkBtn { font-size: 9.5px; padding: 2px 4px; white-space: nowrap; }
}

/* 거래 제안 — 가진 수와 한도를 눈에 보이게 */
.tRow .tHave { font-size: 11px; color: var(--faint); min-width: 2.4em; }
.tRow.none { opacity: 0.45; }
.tRow button:disabled { opacity: 0.3; }
.tGive.wide .tRow, .tWant.wide .tRow { padding: 2px 0; }
@media (max-width: 560px) {
  .tRow .tHave { display: none; }
  .tGive.wide .tRow, .tWant.wide .tRow { gap: 3px; }
}

/* 버리려고 고른 카드 — 한눈에 보이게 */
.cardSlot.sel .cardCount { background: var(--bad); color: #fff; box-shadow: 0 0 0 2px rgba(192,52,43,0.28); }
.cardSlot.sel .resCard { outline: 2.5px solid var(--bad); outline-offset: -1px; filter: brightness(0.94) saturate(0.9); }
.cardSlot.sel::after {
  content: '🗑'; position: absolute; top: -8px; left: 50%; transform: translateX(-50%);
  font-size: 13px; background: var(--bad); color: #fff; border-radius: 999px;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.35); z-index: 3;
}
.cardSlot { position: relative; }

/* 작은 버튼은 보이는 크기는 그대로 두고 누르는 범위만 넓힌다 */
.trkBtn { position: relative; }
.trkBtn::after { content: ''; position: absolute; inset: -9px -7px; }
.devchip { position: relative; }
.devchip::after { content: ''; position: absolute; inset: -6px -4px; }

/* 긴 시트(규칙 등)에서 닫기 버튼을 바닥에 붙여 둔다 — 끝까지 스크롤하지 않아도 닫을 수 있게 */
.sheet.tall > .row:last-child {
  position: sticky; bottom: 0; z-index: 2;
  background: var(--panel); padding: 10px 0 2px; margin-top: 6px;
  box-shadow: 0 -10px 12px -8px rgba(0,0,0,0.22);
}
@media (max-width: 560px) { .sheet.tall > .row:last-child button { font-size: 14px; padding: 12px 6px; } }

/* 발전·진보카드 칩은 글자가 접히지 않게 제 폭을 지킨다 */
.handCards .devchip { flex: 0 0 auto; white-space: nowrap; }

/* 발전·진보카드 칩 줄 — 자원 카드 아래 */
.handChips { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-top: 6px; }
.handChips:empty { display: none; }
@media (max-width: 560px) {
  .handChips { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding: 0 10px 2px; scrollbar-width: none; }
  .handChips::-webkit-scrollbar { display: none; }
}


/* ==================== 판 확대 조작 ==================== */
.zoomCtl {
  position: absolute; right: 8px; bottom: 8px; z-index: 5;
  display: flex; flex-direction: column; gap: 5px;
}
.zoomBtn {
  width: 36px; height: 36px; padding: 0; border-radius: 10px;
  font-size: 17px; font-weight: 800; line-height: 1;
  background: rgba(255,247,232,0.92); color: #2b2419; border: 1px solid rgba(60,40,15,0.35);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.zoomBtn:hover { background: #fff; }
.zoomBtn.fit { display: none; }
.boardBox.zoomed .zoomBtn.fit { display: block; }
.boardBox.zoomed { cursor: grab; }
:root[data-theme="dark"] .zoomBtn { background: rgba(30,36,47,0.92); color: #e8ebf2; border-color: #3a4152; }


/* 판 위 안내 — 지금 판에서 무엇을 눌러야 하는지 */
.boardHint {
  position: absolute; left: 50%; top: 8px; transform: translateX(-50%); z-index: 4;
  max-width: 92%; text-align: center; pointer-events: none;
  background: rgba(43, 36, 25, 0.86); color: #ffe6b0;
  border: 1px solid rgba(255,220,150,0.35); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.01em;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  animation: hintIn 0.3s ease both;
}
@keyframes hintIn { from { opacity: 0; transform: translateX(-50%) translateY(-6px); } }
@media (max-width: 560px) { .boardHint { font-size: 12px; padding: 5px 11px; top: 6px; } }
@media (prefers-reduced-motion: reduce) { .spotHalo, .edgeHit { animation: none !important; } }


/* ==================== 판을 더 보기 위한 접기 ==================== */
.pFold {
  margin-left: 6px; width: 28px; height: 28px; padding: 0; border-radius: 8px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim);
  font-size: 13px; line-height: 1; box-shadow: none; flex: 0 0 auto;
}
.pFold:hover { color: var(--ink); border-color: var(--gold); }
.panel.folded .pWhy,
.panel.folded .pSec,
.panel.folded .buildRow,
.panel.folded .pTrade,
.panel.folded .orderList { display: none; }
.panel.folded .pDo { font-size: 14.5px; }
.panel.folded .pMain { margin-top: 9px; }

/* 기록은 접어 두고, 안내줄의 단추로 편다 */
.logFold {
  margin-left: auto; flex: 0 0 auto; font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--panel2); border: 1px solid var(--line); color: var(--faint); box-shadow: none;
}
.logFold.on { color: var(--gold); border-color: var(--gold); }
#game .log { display: none; }
#game.logOpen .log { display: block; }

/* ==================== 가로로 눕히면 판과 조작판을 좌우로 ==================== */
@media (orientation: landscape) and (max-height: 560px) {
  #game {
    display: grid; overflow: hidden;
    grid-template-columns: minmax(0, 1fr) minmax(262px, 37vw);
    grid-template-rows: auto auto auto auto minmax(0, 1fr);
    gap: 0 8px; padding-right: 8px;
  }
  .top { grid-column: 1 / -1; grid-row: 1; }
  .phaseBar { grid-column: 1 / -1; grid-row: 2; padding: 2px 10px 0; }
  .nowBar { grid-column: 1 / -1; grid-row: 3; }
  .ckBar { grid-column: 1 / -1; grid-row: 4; }
  .boardBox { grid-column: 1; grid-row: 5; min-height: 0; }
  .log { display: none !important; }
  .bottom {
    grid-column: 2; grid-row: 5; min-height: 0; overflow: hidden;
    padding: 4px 0 6px; display: flex; flex-direction: column;
  }
  .hand { flex: 0 0 auto; }
  .panel { flex: 0 1 auto; min-height: 0; max-height: none; overflow-y: auto; }
  .pMain { position: sticky; bottom: -1px; z-index: 2; background: var(--panel); padding: 8px 0 2px; box-shadow: 0 -10px 12px -8px rgba(0,0,0,0.22); }
  .hand { padding: 2px 0; }
  .handCards { gap: 8px; }
  .resCard { width: 42px; height: 58px; }
  .resCard .resFace { font-size: 17px; }
  .resCard .resName { font-size: 8.5px; }
  .buildRow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .buildRow.five { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pDo { font-size: 14px; }
  .pWhy { font-size: 11.5px; }
}


/* ==================== 넓은 화면 — 판을 왼쪽에 크게, 조작은 오른쪽에 ==================== */
@media (min-width: 900px) {
  #game {
    display: grid; height: 100dvh; overflow: hidden;
    grid-template-columns: minmax(0, 1fr) clamp(320px, 25vw, 400px);
    grid-template-rows: auto auto auto auto minmax(0, 1fr) auto;
    column-gap: 12px; padding: 0 12px 10px;
  }
  .top      { grid-column: 1 / -1; grid-row: 1; padding: 8px 0 0; }
  .phaseBar { grid-column: 1 / -1; grid-row: 2; }
  .nowBar   { grid-column: 1 / -1; grid-row: 3; }
  .ckBar    { grid-column: 1 / -1; grid-row: 4; }

  .boardBox { grid-column: 1; grid-row: 5; min-height: 0; }
  #board    { max-height: none; }

  /* 손패와 조작판을 따로 놓기 위해 감싼 틀을 없앤 것처럼 다룬다 */
  .bottom { display: contents; }
  .hand   { grid-column: 1; grid-row: 6; padding: 8px 0 2px; }
  .panel  { grid-column: 2; grid-row: 5; min-height: 0; overflow-y: auto; align-self: stretch; }
  .log    { grid-column: 2; grid-row: 6; margin-top: 8px; max-height: 92px; }

  /* 좁은 칸에 맞춰 짓기 칸은 두 줄로 */
  .buildRow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .buildRow.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pMain { position: sticky; bottom: -1px; z-index: 2; background: var(--panel); padding: 10px 0 2px; box-shadow: 0 -10px 12px -8px rgba(0,0,0,0.2); }
  .bcard { padding: 9px 7px; }
  .zoomBtn { width: 34px; height: 34px; }
}

/* 아주 넓은 화면에서는 조작판을 조금 더 넉넉히 */
@media (min-width: 1500px) {
  #game { grid-template-columns: minmax(0, 1fr) 420px; }
  .buildRow, .buildRow.five { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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

/* ── 확장판 · 진보카드 대상 고르기 ──
   기사·성벽 자리, 기사가 갈 곳, 주교·상인·발명가가 고를 땅, 외교관이 걷어낼 도로.
   과녁이 없으면 판에서 누를 곳이 없어서 카드를 쓸 수 없었다. */
.hexPick {
  fill: rgba(255, 206, 90, .30); stroke: #ffcf5a; stroke-width: 3.4; stroke-dasharray: 6 4;
  cursor: pointer; animation: hexPickPulse 1.4s ease-in-out infinite;
}
.hexPick:hover { fill: rgba(255, 206, 90, .48); }
.hexPick.on { fill: rgba(255, 206, 90, .55); stroke-dasharray: none; }
@keyframes hexPickPulse { 50% { stroke-opacity: .55; } }
.edgePick { stroke: #ff6a5c; }
.pickDot { fill: #ffd36b; }
@media (prefers-reduced-motion: reduce) { .hexPick { animation: none; } }
