@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

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

:root {
  --gold: #d4a017;
  --gold-light: #f0c040;
  --gold-dark: #a07010;
  --bg-0: #080514;
  --bg-1: #110d22;
  --bg-2: #1a1535;
  --bg-3: #261e4a;
  --border-dim: #2a1e45;
  --border-mid: #4a3570;
  --border-bright: #7a5fb0;
  --text-bright: #f0e8d8;
  --text-mid: #c0aeda;
  --text-dim: #7a6a9a;
  --red: #e05050;
  --green: #3aaa60;
  --blue-accent: #5a9eff;
  --gem: #7fd8ff;
  --gem-dark: #2a8fc0;
}

body {
  font-family: 'Vazirmatn', system-ui, sans-serif;
  background: var(--bg-0);
  background-image:
    radial-gradient(ellipse 70% 50% at 10% 10%, rgba(80,30,160,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 90%, rgba(160,80,10,0.10) 0%, transparent 60%);
  color: var(--text-mid);
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
}

body:has(.game-layout) {
  overflow: hidden;
}

/* ══════════════════════════ REDESIGNED HOME ═══════════════════════════ */
.home-screen { min-height:100vh; position:relative; overflow:hidden; padding:24px clamp(24px,5vw,80px) 20px; background:radial-gradient(circle at 18% 32%,rgba(160,91,26,.14),transparent 24%),radial-gradient(circle at 82% 72%,rgba(61,96,110,.15),transparent 28%),linear-gradient(115deg,#080b0d 0%,#111113 48%,#080a0b 100%); isolation:isolate; }
.home-screen::before { content:''; position:absolute; inset:0; z-index:-2; opacity:.14; background-image:linear-gradient(rgba(255,255,255,.025) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.025) 1px,transparent 1px); background-size:48px 48px; mask-image:linear-gradient(to bottom,black,transparent 85%); }
.home-screen::after { content:'VII'; position:absolute; left:-2vw; bottom:-18vh; z-index:-1; font:900 min(48vw,640px)/1 Georgia,serif; color:transparent; -webkit-text-stroke:1px rgba(196,146,67,.07); transform:skew(-7deg); }
.home-orb { position:absolute; border-radius:50%; filter:blur(1px); z-index:-1; pointer-events:none; }
.home-orb-one { width:320px;height:320px;right:-190px;top:18%;border:1px solid rgba(198,153,79,.13);box-shadow:0 0 100px rgba(198,153,79,.05),inset 0 0 80px rgba(198,153,79,.04); }
.home-orb-two { width:170px;height:170px;left:42%;bottom:-110px;border:1px solid rgba(120,154,161,.11); }
.home-header { max-width:1400px;margin:auto;display:flex;align-items:center;justify-content:space-between;min-height:58px;position:relative;z-index:4; }
.home-brand { display:flex;align-items:center;gap:12px;color:var(--text-bright);text-decoration:none; }
.brand-mark { width:46px;height:46px;display:grid;place-items:center;border:1px solid #a87834;color:#d8ab63;transform:rotate(45deg);font:700 .85rem Georgia,serif; }
.brand-mark::first-line { transform:rotate(-45deg); }
.home-brand>span:last-child { display:flex;flex-direction:column;line-height:1.15; }
.home-brand b { font-size:.96rem;letter-spacing:-.3px; }.home-brand small { color:#aa8248;font:700 .65rem Vazirmatn,sans-serif;letter-spacing:2px;direction:rtl; }
.home-header .user-bar { margin:0;background:rgba(8,9,10,.62);border:1px solid rgba(255,255,255,.07);border-radius:28px;padding:5px 7px 5px 5px;backdrop-filter:blur(12px);gap:14px; }
.home-header .user-badge { border:0;background:transparent;padding:0 5px; }.home-header .btn-sm { border:0;padding:7px 10px; }
.home-guest { color:#817b70;border:1px solid rgba(255,255,255,.08);border-radius:20px;padding:7px 14px;font-size:.78rem; }
.home-hero { max-width:1260px;margin:clamp(60px,10vh,118px) auto 0;display:grid;grid-template-columns:minmax(0,1fr) minmax(390px,500px);gap:clamp(60px,9vw,140px);align-items:center; }
.hero-copy { padding-bottom:20px; }.hero-eyebrow { color:#b38a4b;font-size:.76rem;font-weight:700;letter-spacing:.5px;display:flex;align-items:center;gap:10px;margin-bottom:25px; }.hero-eyebrow span { width:32px;height:1px;background:#b38a4b; }
.hero-copy h1 { color:#eee9df;font-size:clamp(3.3rem,6vw,6.4rem);line-height:.94;letter-spacing:-5px;font-weight:800;margin:0 0 30px; }.hero-copy h1 em { color:#c29551;font-style:normal;font-weight:300; }
.hero-copy>p { max-width:570px;color:#8f8b83;font-size:1rem;line-height:2.05;margin-bottom:34px; }
.hero-features { display:flex;align-items:center;gap:22px;color:#77736c;font-size:.75rem; }.hero-features span { display:flex;align-items:center;gap:7px; }.hero-features b { color:#c8bda9;font:500 1.1rem Georgia,serif; }.hero-features i { width:3px;height:3px;border-radius:50%;background:#8e6934; }
.play-panel { background:linear-gradient(145deg,rgba(28,27,25,.94),rgba(14,15,16,.98));border:1px solid rgba(203,164,99,.18);padding:27px;border-radius:4px;box-shadow:0 35px 100px rgba(0,0,0,.48),inset 0 1px rgba(255,255,255,.025);position:relative; }
.play-panel::before,.play-panel::after { content:'';position:absolute;width:20px;height:20px;border-color:#9a7139;opacity:.55; }.play-panel::before { right:-1px;top:-1px;border-right:2px solid;border-top:2px solid; }.play-panel::after { left:-1px;bottom:-1px;border-left:2px solid;border-bottom:2px solid; }
.play-panel-head { display:flex;justify-content:space-between;align-items:flex-start;margin-bottom:20px; }.play-panel-head span { color:#837b70;font-size:.69rem; }.play-panel-head h2 { color:#e9e2d7;font-size:1.08rem;margin-top:5px; }.panel-age { direction:rtl;letter-spacing:0!important;color:#705a3b!important;font:600 .65rem Vazirmatn,sans-serif!important; }
.mode-card { width:100%;display:grid;grid-template-columns:46px 1fr auto 22px;align-items:center;gap:13px;text-align:right;padding:15px 16px;border-radius:3px; }
.mode-online { background:linear-gradient(110deg,#9b6c2f,#bf9150);border:1px solid #c69b5b;color:#15120d;box-shadow:0 10px 30px rgba(155,108,47,.15); }.mode-online:hover { transform:translateY(-2px);filter:brightness(1.08); }
.mode-icon { width:43px;height:43px;border:1px solid currentColor;display:grid;place-items:center;font:1.2rem Georgia,serif;opacity:.8; }.mode-copy { display:flex;flex-direction:column;gap:3px; }.mode-copy b,.local-title b { font-size:.92rem; }.mode-copy small,.local-title small { opacity:.65;font-size:.68rem; }.mode-meta { font-size:.66rem;white-space:nowrap; }.mode-meta i { display:inline-block;width:5px;height:5px;background:#164b30;border-radius:50%;margin-left:4px;box-shadow:0 0 0 3px rgba(22,75,48,.15); }.mode-arrow { font-size:1.1rem; }
.local-game-box { margin-top:12px;border:1px solid rgba(255,255,255,.09);background:rgba(4,5,6,.36);padding:16px; }.local-title { display:flex;align-items:center;gap:12px;color:#d4cdc0;margin-bottom:15px; }.local-title>span:last-child { display:flex;flex-direction:column;gap:2px; }.local-title .mode-icon { width:37px;height:37px;color:#9b7b4e;font-size:1rem; }
.player-inputs { display:grid;grid-template-columns:1fr 28px 1fr;gap:8px;align-items:end; }.player-inputs label { display:flex;flex-direction:column;gap:6px; }.player-inputs label span { color:#6f6b64;font-size:.63rem; }.player-inputs input { width:100%;background:#0a0b0c;border:1px solid #34312c;color:#ded7cb;border-radius:2px;padding:10px 11px;font:500 .77rem Vazirmatn,sans-serif;outline:none; }.player-inputs input:focus { border-color:#a4783b;box-shadow:0 0 0 2px rgba(164,120,59,.1); }.versus { color:#6e5534;font:700 .64rem Georgia,serif;padding-bottom:11px;text-align:center; }
.start-local-btn { width:100%;margin-top:12px;border:1px solid #765a34;background:transparent;color:#c9a66c;padding:11px 14px;display:flex;justify-content:space-between;font-weight:700; }.start-local-btn:hover { background:rgba(166,124,61,.1);border-color:#ae8243; }.play-hint { color:#5e5b56;text-align:center;font-size:.62rem;margin-top:13px; }
.home-footer { max-width:1400px;margin:clamp(65px,9vh,110px) auto 0;border-top:1px solid rgba(255,255,255,.055);padding-top:17px;display:flex;justify-content:space-between;color:#55524d;font-size:.65rem; }.home-footer div { display:flex;gap:25px;color:#75654e; }
@media(max-width:900px){.home-screen{padding:20px}.home-hero{grid-template-columns:1fr;margin-top:60px;gap:45px}.hero-copy{text-align:center}.hero-eyebrow,.hero-features{justify-content:center}.hero-copy>p{margin-left:auto;margin-right:auto}.hero-copy h1{letter-spacing:-3px}.home-footer{margin-top:55px}.home-header .user-badge span:not(.user-initials){display:none}}
@media(max-width:540px){.home-screen{padding:16px 12px}.home-header{align-items:flex-start}.home-header .user-bar{max-width:210px;flex-wrap:wrap;justify-content:flex-end;gap:3px}.home-header .user-bar-actions{gap:3px}.home-header .btn-icon{width:29px;height:29px}.home-header .gem-badge{padding:4px 7px}.home-brand b{display:none}.home-hero{margin-top:50px}.hero-copy h1{font-size:3.35rem}.hero-copy>p{font-size:.88rem}.hero-features{gap:10px;flex-wrap:wrap}.play-panel{padding:18px 14px}.mode-card{grid-template-columns:40px 1fr 20px}.mode-meta{display:none}.player-inputs{grid-template-columns:1fr}.versus{padding:0}.home-footer{flex-direction:column;align-items:center;gap:10px}.mode-copy small{font-size:.61rem}}

/* ══════════════════════════ TABLETOP GAME BOARD ═══════════════════════ */
.game-layout { grid-template-columns:minmax(190px,230px) minmax(650px,1fr) minmax(190px,230px);gap:0;padding:0;background:#b89565;background-image:radial-gradient(ellipse at center,rgba(255,246,216,.42),transparent 55%),repeating-linear-gradient(90deg,transparent 0 72px,rgba(83,52,28,.055) 73px,rgba(255,255,255,.07) 75px,transparent 77px),linear-gradient(90deg,#aa7e4d,#d0ad78 48%,#a97949); }
.game-layout::after { content:'';position:fixed;inset:0;pointer-events:none;box-shadow:inset 0 0 120px rgba(67,35,17,.32);z-index:1; }
.center-column { position:relative;overflow:auto;padding:18px 88px 80px 18px;gap:12px;z-index:2; }
.player-area { max-height:100vh;border-radius:0;padding:14px 12px;background:linear-gradient(180deg,rgba(247,239,218,.94),rgba(222,203,169,.94));border:0;border-left:1px solid rgba(83,55,30,.28);border-right:1px solid rgba(83,55,30,.28);box-shadow:0 0 28px rgba(66,40,20,.18);color:#4e3a29;z-index:2; }
.player-area.active { border-color:#986c31;box-shadow:inset 0 0 0 2px #b3833d,0 0 30px rgba(81,49,23,.28); }
.player-name { color:#50361f;font-size:1.05rem; }.player-header { background:rgba(255,255,255,.36);border:1px solid rgba(89,58,33,.18);padding:10px;border-radius:8px; }
.stat { background:rgba(255,255,255,.47);text-shadow:none; }.stat.coin{color:#805c1f}.stat.shield{color:#a63228}.stat.science{color:#267341}.stat.score{color:#246781}
.wonder-slot { min-height:72px;background:linear-gradient(105deg,rgba(255,255,255,.38),rgba(161,117,67,.12));border-color:rgba(89,58,33,.25);box-shadow:0 2px 5px rgba(69,40,20,.1); }.wonder-slot:hover:not(.built){background:rgba(255,247,222,.74);border-color:#9b6b2e}.wonder-name{color:#5b3b20}.wonder-cost{color:#75634e}.wonder-art{width:47px;height:47px;background:radial-gradient(circle,rgba(191,142,60,.28),rgba(125,87,43,.12))}.wonder-art .wa-fill{fill:#9b6c2e}.wonder-art .wa-line{stroke:#60411f}.wonder-art .wa-accent{fill:#b13d2d}
.mini-card { color:#3c3025;background:rgba(255,255,255,.46);border-top:1px solid rgba(60,45,30,.12);border-bottom:1px solid rgba(60,45,30,.12);min-width:92px; }.token-badge{background:#e7dcc6;color:#544536;border-color:#9f8b6d}.sci-sym{filter:grayscale(.7);}.sci-sym.have{filter:none}
.board-container { flex:0 0 auto;background:rgba(255,248,226,.16);background-image:radial-gradient(circle at center,rgba(255,255,255,.24),transparent 63%);border:0;box-shadow:none;padding:0!important; }
.board-card { border-radius:5px;border:2px solid rgba(48,34,22,.75);border-top-width:18px;padding:4px 5px;background:#eee1c7;box-shadow:0 4px 8px rgba(55,32,18,.35);color:#30261f; }
.board-card::before { content:'';position:absolute;top:-15px;right:5px;width:7px;height:7px;border-radius:50%;background:rgba(255,255,255,.6);box-shadow:0 0 0 2px rgba(0,0,0,.16); }
.board-card.face-down { border:3px solid #31261d;background:linear-gradient(135deg,#9f531c,#c9742b 50%,#8c4216);box-shadow:inset 0 0 0 4px #e29a4d,inset 0 0 0 6px #623014,0 5px 9px rgba(53,29,13,.4); }
.board-card.face-down::after { inset:9px;border:1px solid rgba(91,42,13,.65);background:radial-gradient(circle,#743816 0 4px,transparent 5px),repeating-linear-gradient(45deg,transparent 0 8px,rgba(95,43,13,.16) 9px 11px); }.board-card.face-down .bc-back{color:rgba(85,40,15,.8)}
.board-card.color-brown{background:linear-gradient(#efe2c9,#d6b68a);border-color:#7b4928}.board-card.color-grey{background:linear-gradient(#edf0ed,#c4ccc8);border-color:#657477}.board-card.color-blue{background:linear-gradient(#e5f0f4,#b7d7df);border-color:#28728e}.board-card.color-red{background:linear-gradient(#f2ddd2,#d4a18c);border-color:#9c352d}.board-card.color-yellow{background:linear-gradient(#f5ecc9,#d9c277);border-color:#a27b12}.board-card.color-green{background:linear-gradient(#e4ecd7,#b8ce9d);border-color:#3d7939}.board-card.color-purple{background:linear-gradient(#e9dfed,#c4a9ca);border-color:#744b80}
.bc-name{color:#35291f;text-shadow:none;font-size:.7rem}.bc-cost{position:absolute;right:-7px;top:8px;background:#167ba0;color:#fff;border:2px solid #e9f2ef;border-radius:9px;padding:2px 4px;box-shadow:0 2px 4px rgba(0,0,0,.3);z-index:3;white-space:nowrap;transform:scale(.8);transform-origin:right top}.bc-effect{color:#40382f;font-weight:700}.bc-emblem{color:rgba(255,255,255,.8)!important;top:-16px;left:5px}.board-card.accessible:hover{transform:translateY(-9px) scale(1.08);box-shadow:0 13px 22px rgba(55,31,16,.42)}
.military-track { position:absolute;right:12px;top:105px;width:61px;height:545px;flex-direction:column;border-radius:22px;padding:10px 8px;background:linear-gradient(90deg,#392827,#815144 48%,#352526);border:3px solid #6d492f;box-shadow:0 7px 18px rgba(55,31,16,.4);z-index:10; }.mil-track-inner{flex-direction:column;gap:1px;align-items:center}.mil-pos{width:25px;height:22px;background:rgba(245,216,167,.2);border-color:rgba(248,219,167,.2);color:#f0c77d}.mil-pawn{width:35px;height:26px;border-radius:50%;background:#cf3325;color:#fff;box-shadow:0 0 12px #ffb13a}.mil-label{color:#f2d69f;font-size:.58rem;max-width:50px;overflow:hidden;text-overflow:ellipsis}
.tokens-area { position:absolute;right:6px;top:665px;width:74px;padding:8px 6px;background:rgba(24,108,74,.94);border:3px solid #376647;border-radius:25px;z-index:10;box-shadow:0 5px 12px rgba(47,31,18,.3) }.tokens-label{font-size:0;margin:0}.tokens-label::after{content:'🏅';font-size:1rem}.tokens-row{flex-direction:column;align-items:center;gap:5px}.token{min-width:48px;width:48px;height:48px;border-radius:50%;padding:5px;overflow:hidden;background:radial-gradient(circle,#efe2aa,#b9903d);border:2px solid #e9d793;color:#4d3920}.token-name{font-size:.54rem;color:#4d3920;line-height:1.1}.token div:last-child{display:none}
.phase-banner { max-width:720px;background:rgba(250,244,228,.88);border-color:rgba(91,61,34,.28);color:#513b28;box-shadow:0 3px 10px rgba(64,40,22,.12) }.phase-banner.warning{background:#f3dfbd;border-color:#ae7635}.online-badge{background:#f4ead5;border-color:#8c7659;color:#315c73}
@media(max-width:1050px){.game-layout{grid-template-columns:190px minmax(600px,1fr) 190px}.center-column{padding-right:75px}.mini-card{min-width:78px;font-size:.61rem}}
@media(max-width:900px){.game-layout{display:flex;flex-direction:column;background:#bf9866}.center-column{order:2;width:100%;padding:18px 75px 65px 12px;overflow:auto}.player-area{max-height:none;overflow:visible;border-radius:0}.player-area.top{order:1}.player-area.bottom{order:3}.player-wonders{display:grid;grid-template-columns:repeat(4,1fr)}.wonder-slot{min-width:150px}.military-track{position:absolute}.log-panel{position:relative;z-index:4}}

button { cursor: pointer; font-family: inherit; transition: all .15s; }
button.disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ══════════════════════════ SETUP SCREEN ══════════════════════════════ */
.setup-screen {
  max-width: 540px;
  margin: 48px auto;
  padding: 44px 40px;
  background: linear-gradient(155deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border-radius: 22px;
  border: 1px solid var(--border-mid);
  box-shadow: 0 0 80px rgba(80,30,160,0.18), 0 0 0 1px rgba(255,255,255,0.03);
  text-align: center;
}
.setup-screen h1 {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 6px;
  text-shadow: 0 0 40px rgba(212,160,23,0.45);
  letter-spacing: -0.5px;
}
.subtitle { color: var(--text-dim); font-size: .92rem; margin-bottom: 34px; }

.setup-form { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.field { display: flex; flex-direction: column; gap: 7px; width: 100%; max-width: 310px; text-align: right; }
.field label { font-size: .83rem; color: var(--text-dim); font-weight: 600; letter-spacing: 0.2px; }
.field input {
  padding: 12px 16px;
  background: var(--bg-0);
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  color: var(--text-bright);
  font-size: .97rem;
  font-family: inherit;
  direction: rtl;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212,160,23,0.13); }

.setup-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 4px; }

.rules-quick {
  margin-top: 28px;
  text-align: right;
  background: rgba(0,0,0,0.25);
  border-radius: 12px;
  padding: 18px 22px;
  border: 1px solid var(--border-dim);
}
.rules-quick h3 { color: var(--gold); margin-bottom: 10px; font-size: .95rem; font-weight: 700; }
.rules-quick li {
  margin: 7px 0;
  padding-right: 14px;
  font-size: .85rem;
  color: var(--text-mid);
  line-height: 1.55;
  list-style: none;
  position: relative;
}
.rules-quick li::before {
  content: '◆';
  color: var(--gold);
  font-size: .52rem;
  position: absolute;
  right: 0;
  top: 6px;
}

/* ══════════════════════════ BUTTONS ═══════════════════════════════════ */
.btn-primary {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #180f00;
  border: none;
  padding: 13px 30px;
  border-radius: 10px;
  font-size: .97rem;
  font-weight: 800;
  font-family: inherit;
  letter-spacing: 0.3px;
  box-shadow: 0 4px 16px rgba(212,160,23,0.25);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(212,160,23,0.38); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(212,160,23,0.2); }

.btn-secondary {
  background: var(--bg-3);
  color: var(--text-bright);
  border: 1px solid var(--border-mid);
  padding: 11px 22px;
  border-radius: 10px;
  font-size: .9rem;
  font-family: inherit;
}
.btn-secondary:hover { background: #332558; border-color: var(--border-bright); }

.btn-online {
  background: linear-gradient(135deg, #1a3a6e 0%, #0d1e40 100%);
  color: #70b0ff;
  border: 1px solid #2a4a8e;
  padding: 13px 30px;
  border-radius: 10px;
  font-size: .97rem;
  font-weight: 700;
  font-family: inherit;
  box-shadow: 0 4px 16px rgba(30,80,200,0.2);
}
.btn-online:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(30,80,200,0.3); border-color: #4a6abe; }

.btn-sm {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-mid);
  padding: 7px 15px;
  border-radius: 8px;
  font-size: .8rem;
  font-family: inherit;
}
.btn-sm:hover { color: var(--text-mid); border-color: var(--border-bright); background: rgba(255,255,255,0.03); }

.btn-destroy {
  background: linear-gradient(135deg, #4a0e0e, #300808);
  color: #ffaaaa;
  border: 1px solid #802020;
  padding: 7px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: .8rem;
  margin: 3px;
}
.btn-destroy:hover { background: linear-gradient(135deg, #5e1414, #3e0a0a); border-color: var(--red); }

.btn-discard {
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  margin: 3px;
  color: var(--text-bright);
  font-size: .8rem;
  font-family: inherit;
  background: var(--bg-2);
}
.btn-discard:hover { border-color: var(--border-bright); background: var(--bg-3); }

.music-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 1200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(23,18,34,0.82);
  color: var(--gold-light);
  font: 800 1.28rem/1 Georgia, serif;
  box-shadow: 0 10px 26px rgba(0,0,0,0.28);
  backdrop-filter: blur(10px);
}
.music-toggle:hover {
  border-color: var(--gold);
  background: rgba(45,34,58,0.92);
  transform: translateY(-1px);
}
.music-toggle.muted {
  color: var(--text-dim);
  border-color: rgba(255,255,255,0.1);
}

/* ══════════════════════════ GAME LAYOUT ════════════════════════════════ */
.game-layout {
  display: grid;
  grid-template-columns: 230px 1fr 230px;
  min-height: 100vh;
  gap: 6px;
  padding: 6px;
}

/* ══════════════════════════ PLAYER AREA ════════════════════════════════ */
.player-area {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border-radius: 16px;
  border: 1px solid var(--border-dim);
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 100vh;
  transition: border-color .3s, box-shadow .3s;
}
.player-area.active {
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(212,160,23,0.12), inset 0 0 40px rgba(212,160,23,0.02);
}

.player-header { display: flex; flex-direction: column; gap: 6px; }
.player-name {
  font-size: 1rem;
  font-weight: 800;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 6px;
}
.turn-arrow { color: var(--gold-light); animation: blink 1s infinite; }
@keyframes blink { 0%,100% { opacity:1; } 50% { opacity:.3; } }

.player-stats { display: flex; gap: 6px; flex-wrap: wrap; }
.stat {
  display: flex;
  align-items: center;
  gap: 4px;
  border-radius: 20px;
  padding: 4px 10px;
  font-size: .8rem;
  font-weight: 700;
  border: 1px solid;
  background: rgba(0,0,0,0.25);
}
.stat.coin   { color: var(--gold-light); border-color: rgba(212,160,23,0.35); }
.stat.shield { color: #ff8070; border-color: rgba(224,80,80,0.35); }
.stat.science{ color: #70ee90; border-color: rgba(58,170,96,0.35); }
.stat.score  { color: var(--gem); border-color: rgba(127,216,255,0.35); }

/* Wonders */
.player-wonders { display: flex; flex-direction: column; gap: 5px; }
.wonder-slot {
  background: rgba(0,0,0,0.2);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  padding: 8px 11px;
  cursor: pointer;
  transition: all .2s;
  font-size: .78rem;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 9px;
}
.wonder-slot:hover:not(.built) {
  border-color: var(--gold);
  background: rgba(212,160,23,0.06);
  transform: translateX(-2px);
}
.wonder-slot.can-afford { border-color: rgba(58,170,96,0.5); }
.wonder-slot.can-afford:hover { border-color: var(--green); box-shadow: 0 0 12px rgba(58,170,96,0.2); }
.wonder-slot.built { opacity: .55; cursor: default; }
.wonder-body { flex: 1; min-width: 0; }
.wonder-name { font-weight: 700; color: var(--gold); font-size: .82rem; margin-bottom: 2px; }
.wonder-cost { color: var(--text-dim); font-size: .72rem; }
.wonder-built { color: var(--green); font-size: .75rem; margin-top: 2px; }

.wonder-art {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: radial-gradient(circle at 35% 30%, rgba(212,160,23,0.16), rgba(0,0,0,0.3));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}
.wonder-art svg { width: 100%; height: 100%; }
.wonder-art .wa-fill { fill: var(--gold-dark); opacity: .55; }
.wonder-art .wa-line { stroke: var(--gold-light); stroke-width: 1.6; }
.wonder-art .wa-accent { fill: var(--gold-light); stroke: none; }
.wonder-slot.can-afford .wonder-art { background: radial-gradient(circle at 35% 30%, rgba(58,170,96,0.22), rgba(0,0,0,0.3)); }

/* Progress tokens */
.player-tokens { display: flex; flex-wrap: wrap; gap: 4px; }
.token-badge {
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border-mid);
  border-radius: 20px;
  padding: 3px 9px;
  font-size: .72rem;
  color: var(--text-mid);
}

/* Built cards */
.player-cards { display: flex; flex-wrap: wrap; gap: 4px; }
.card-column { display: flex; flex-direction: column; gap: 2px; }
.mini-card {
  border-right: 3px solid;
  background: rgba(0,0,0,0.3);
  padding: 3px 7px 3px 5px;
  border-radius: 4px 0 0 4px;
  font-size: .68rem;
  display: flex;
  justify-content: space-between;
  gap: 5px;
  min-width: 88px;
}

/* Science symbols */
.science-display { display: flex; flex-wrap: wrap; gap: 4px; }
.sci-sym {
  font-size: 1.05rem;
  opacity: .18;
  filter: grayscale(1);
  transition: all .3s;
  position: relative;
}
.sci-sym.have { opacity: 1; filter: none; }
.sci-sym sup { font-size: .58rem; }

/* ══════════════════════════ CENTER COLUMN ══════════════════════════════ */
.center-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  overflow-y: auto;
}

/* ══════════════════════════ MILITARY TRACK ═════════════════════════════ */
.military-track {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
  border-radius: 12px;
  border: 1px solid var(--border-dim);
  padding: 10px 14px;
  width: 100%;
}
.mil-label { font-size: .77rem; color: var(--text-dim); white-space: nowrap; flex: 0 0 auto; font-weight: 700; }
.mil-track-inner { display: flex; gap: 2px; flex: 1; justify-content: center; }
.mil-pos {
  width: 21px; height: 21px;
  border-radius: 4px;
  background: var(--bg-1);
  border: 1px solid var(--border-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .58rem;
  color: var(--text-dim);
}
.mil-center { background: var(--bg-0); border-color: var(--text-dim); }
.mil-marker { border-color: var(--red); color: var(--red); }
.mil-pawn {
  background: var(--red);
  border-color: #ff7060;
  color: #fff;
  font-size: .9rem;
  width: 25px; height: 25px;
  border-radius: 50%;
  z-index: 2;
  box-shadow: 0 0 12px rgba(224,80,80,0.55);
}

/* ══════════════════════════ PROGRESS TOKENS ════════════════════════════ */
.tokens-area {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
  border-radius: 12px;
  border: 1px solid var(--border-dim);
  padding: 12px 15px;
  width: 100%;
}
.tokens-label { font-size: .78rem; color: var(--text-dim); margin-bottom: 10px; font-weight: 700; }
.tokens-row { display: flex; gap: 7px; flex-wrap: wrap; }
.token {
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: .76rem;
  min-width: 76px;
  text-align: center;
  transition: all .2s;
}
.token.selectable {
  cursor: pointer;
  border-color: var(--gold);
  animation: pulse-gold 1.6s ease-in-out infinite;
}
.token.selectable:hover {
  background: linear-gradient(135deg, #3a2a60, var(--bg-3));
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(212,160,23,0.28);
}
@keyframes pulse-gold {
  0%,100% { box-shadow: 0 0 0 0 rgba(212,160,23,0); }
  50%      { box-shadow: 0 0 0 4px rgba(212,160,23,0.22); }
}
.token-name { font-weight: 700; color: var(--gold); font-size: .8rem; }

/* ══════════════════════════ WONDER DRAFT ═══════════════════════════════ */
.draft-area {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
  border-radius: 16px;
  border: 1px solid var(--border-mid);
  padding: 28px 20px;
  width: 100%;
  text-align: center;
}
.draft-header {
  font-size: 1rem;
  color: var(--text-mid);
  margin-bottom: 22px;
}
.draft-header strong { color: var(--gold); }
.draft-pool {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.draft-tile {
  width: 130px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--border-mid);
  border-radius: 14px;
  padding: 14px 10px;
  cursor: pointer;
  transition: all .2s;
}
.draft-tile:hover {
  border-color: var(--gold);
  background: rgba(212,160,23,0.08);
  transform: translateY(-4px);
  box-shadow: 0 10px 26px rgba(212,160,23,0.2);
}
.draft-tile .wonder-art { width: 60px; height: 60px; margin: 0 auto 10px; }
.draft-tile .wonder-name { font-size: .82rem; }

/* ══════════════════════════ BOARD CARDS ════════════════════════════════ */
.board-container {
  position: relative;
  overflow: visible;
  padding: 22px;
  border-radius: 20px;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,0.10) 0 2px, transparent 2px 26px),
    linear-gradient(155deg, #241a38 0%, #150f24 60%, #1c1430 100%);
  border: 1px solid var(--border-dim);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.4);
}

.board-card {
  position: absolute;
  border-radius: 9px;
  border: 1px solid var(--border-mid);
  border-top-width: 4px;
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  font-size: .68rem;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
  overflow: hidden;
  user-select: none;
  direction: rtl;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
}

/* Face-down cards */
.board-card.face-down {
  cursor: not-allowed;
  background: linear-gradient(135deg, #0a0618 0%, #14103a 50%, #0a0618 100%);
  border-color: #322560;
}
.board-card.face-down::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(100,70,180,0.2);
  border-radius: 6px;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 5px, rgba(80,50,140,0.06) 5px, rgba(80,50,140,0.06) 10px),
    repeating-linear-gradient(-45deg, transparent, transparent 5px, rgba(80,50,140,0.04) 5px, rgba(80,50,140,0.04) 10px);
}
.board-card.face-down .bc-back {
  font-size: 1.6rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(120,90,200,0.4);
  position: relative;
  z-index: 1;
}

/* Accessible */
.board-card.accessible { cursor: pointer; }
.board-card.accessible:hover {
  transform: translateY(-6px) scale(1.06);
  box-shadow: 0 12px 36px rgba(0,0,0,0.6);
  z-index: 20;
}
.board-card.can-afford:hover {
  border-color: rgba(58,170,96,0.75);
  box-shadow: 0 12px 30px rgba(58,170,96,0.25);
}

/* Card color themes */
.board-card.color-brown  { background: linear-gradient(155deg, #281205 0%, #160900 100%); border-color: #6b4020; }
.board-card.color-grey   { background: linear-gradient(155deg, #101820 0%, #080e14 100%); border-color: #506070; }
.board-card.color-blue   { background: linear-gradient(155deg, #071228 0%, #040a18 100%); border-color: #1e3a70; }
.board-card.color-red    { background: linear-gradient(155deg, #200606 0%, #130303 100%); border-color: #802018; }
.board-card.color-yellow { background: linear-gradient(155deg, #181000 0%, #0e0900 100%); border-color: #907010; }
.board-card.color-green  { background: linear-gradient(155deg, #061008 0%, #030804 100%); border-color: #1a5018; }
.board-card.color-purple { background: linear-gradient(155deg, #100420 0%, #080212 100%); border-color: #502880; }

/* Color glows on hover */
.board-card.accessible.color-brown:hover  { border-color: #8B5E3C; box-shadow: 0 12px 32px rgba(107,64,32,0.4); }
.board-card.accessible.color-grey:hover   { border-color: #7A8C99; box-shadow: 0 12px 32px rgba(80,96,112,0.35); }
.board-card.accessible.color-blue:hover   { border-color: #2E5C9E; box-shadow: 0 12px 32px rgba(30,58,160,0.4); }
.board-card.accessible.color-red:hover    { border-color: #C0392B; box-shadow: 0 12px 32px rgba(192,57,43,0.4); }
.board-card.accessible.color-yellow:hover { border-color: #D4A017; box-shadow: 0 12px 32px rgba(212,160,23,0.38); }
.board-card.accessible.color-green:hover  { border-color: #276221; box-shadow: 0 12px 32px rgba(39,98,33,0.4); }
.board-card.accessible.color-purple:hover { border-color: #6B3FA0; box-shadow: 0 12px 32px rgba(107,63,160,0.4); }

/* Card content */
.bc-name {
  font-weight: 700;
  font-size: .7rem;
  line-height: 1.3;
  color: #f0e8d8;
  text-shadow: 0 1px 3px rgba(0,0,0,0.6);
}
.bc-cost { color: var(--gold-light); font-size: .65rem; margin-top: 1px; }
.bc-effect { font-size: .72rem; color: #c0d0e0; margin-top: 2px; }
.chain-icon { color: #d8e030; }
.free-badge {
  background: linear-gradient(135deg, #1e5018, #123010);
  color: #80ee80;
  border-radius: 3px;
  padding: 1px 5px;
  font-size: .62rem;
  font-weight: 700;
  margin-right: 3px;
}
.cost-icon { margin-left: 2px; }

/* ══════════════════════════ PHASE BANNER ════════════════════════════════ */
.phase-banner {
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border-mid);
  border-radius: 13px;
  padding: 13px 16px;
  font-size: .86rem;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.phase-banner.warning {
  border-color: rgba(212,160,23,0.6);
  background: linear-gradient(135deg, #160e00, var(--bg-1));
}
.turn-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.destroy-options, .discard-options { display: flex; flex-wrap: wrap; gap: 4px; }

/* ══════════════════════════ CARD DIALOG ════════════════════════════════ */
.card-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  backdrop-filter: blur(5px);
}
.dialog-box {
  position: relative;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-1));
  border-radius: 18px;
  border: 1px solid var(--border-mid);
  width: 340px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,0.85), 0 0 0 1px rgba(255,255,255,0.04);
  direction: rtl;
}
.dialog-header {
  padding: 16px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.color-badge { font-size: .76rem; opacity: .85; font-weight: 500; }
.dialog-body {
  padding: 15px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: .86rem;
  color: var(--text-mid);
  border-top: 1px solid rgba(255,255,255,0.05);
}
.dialog-body > div { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.dialog-actions {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

/* ══════════════════════════ IN-ROOM CHAT ═══════════════════════════════ */
.chat-toggle {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 60;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #180f00;
  border: none;
  border-radius: 24px;
  padding: 10px 18px;
  font-weight: 800;
  font-size: .85rem;
  font-family: inherit;
  box-shadow: 0 6px 20px rgba(212,160,23,0.3);
}
.chat-panel {
  position: fixed;
  bottom: 0;
  right: -320px;
  width: 300px;
  height: 60vh;
  max-height: 480px;
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
  border: 1px solid var(--border-mid);
  border-bottom: none;
  border-radius: 16px 0 0 0;
  z-index: 59;
  display: flex;
  flex-direction: column;
  transition: right .25s ease;
  direction: rtl;
  box-shadow: -10px 0 40px rgba(0,0,0,0.4);
}
.chat-panel.open { right: 0; }
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-weight: 800;
  color: var(--gold);
  border-bottom: 1px solid var(--border-dim);
}
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.chat-msg {
  background: var(--bg-0);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  padding: 7px 11px;
  font-size: .83rem;
  color: var(--text-mid);
  align-self: flex-start;
  max-width: 85%;
}
.chat-msg.mine {
  align-self: flex-end;
  background: rgba(212,160,23,0.12);
  border-color: rgba(212,160,23,0.35);
  color: var(--text-bright);
}
.chat-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--border-dim);
}
.chat-preset-btn {
  background: var(--bg-0);
  border: 1px solid var(--border-mid);
  color: var(--text-mid);
  border-radius: 16px;
  padding: 6px 11px;
  font-size: .76rem;
  font-family: inherit;
}
.chat-preset-btn:hover { border-color: var(--gold); color: var(--gold-light); }

.leaderboard-row.live-game-row { grid-template-columns: 1fr auto auto auto; }

/* ══════════════════════════ LOG PANEL ═══════════════════════════════════ */
.log-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 260px;
  background: linear-gradient(180deg, rgba(8,5,20,0) 0%, rgba(8,5,20,0.95) 30%);
  border-top: 1px solid var(--border-dim);
  border-right: 1px solid var(--border-dim);
  border-radius: 0 14px 0 0;
  padding: 12px 14px 10px;
  max-height: 150px;
  overflow-y: auto;
  font-size: .74rem;
  z-index: 50;
  direction: rtl;
}
.log-entry {
  padding: 3px 0;
  color: var(--text-dim);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  line-height: 1.45;
}
.log-entry:first-child { color: var(--text-mid); }

/* ══════════════════════════ GAME OVER ═══════════════════════════════════ */
.game-over {
  max-width: 620px;
  margin: 70px auto;
  padding: 50px 44px;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-1));
  border-radius: 24px;
  border: 1px solid rgba(212,160,23,0.5);
  text-align: center;
  box-shadow: 0 0 80px rgba(212,160,23,0.1);
  direction: rtl;
}
.game-over h1 { font-size: 2.1rem; color: var(--gold); margin-bottom: 14px; font-weight: 800; }
.game-over p  { font-size: 1rem; color: var(--text-mid); margin-bottom: 30px; }
.score-breakdown {
  display: flex;
  gap: 18px;
  justify-content: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
}
.score-player {
  background: var(--bg-0);
  border-radius: 14px;
  padding: 20px;
  text-align: right;
  min-width: 190px;
  border: 1px solid var(--border-dim);
}
.score-player h3 { color: var(--gold); margin-bottom: 12px; font-size: 1rem; font-weight: 800; }
.score-player div { font-size: .83rem; color: var(--text-mid); margin: 5px 0; }

/* ══════════════════════════ ONLINE SCREEN ═══════════════════════════════ */
.online-screen {
  max-width: 460px;
  margin: 50px auto;
  padding: 44px 36px;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-1));
  border-radius: 22px;
  border: 1px solid var(--border-mid);
  text-align: center;
  direction: rtl;
  box-shadow: 0 0 60px rgba(30,80,200,0.1);
}
.online-screen h2 {
  color: #70b0ff;
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 28px;
}
.online-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 28px;
  background: var(--bg-0);
  border-radius: 12px;
  padding: 5px;
}
.online-tab {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
}
.online-tab.active {
  background: var(--bg-3);
  color: #70b0ff;
  border: 1px solid #2a4a8e;
}
.room-code-display {
  font-size: 2.8rem;
  font-weight: 800;
  color: var(--gold);
  letter-spacing: 8px;
  padding: 20px;
  background: var(--bg-0);
  border-radius: 12px;
  border: 1px solid var(--border-mid);
  margin: 16px 0;
  direction: ltr;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.online-status {
  padding: 12px 16px;
  border-radius: 10px;
  font-size: .88rem;
  margin: 12px 0;
  font-weight: 600;
}
.online-status.waiting  { background: rgba(212,160,23,0.1);  border: 1px solid rgba(212,160,23,0.3);  color: var(--gold); }
.online-status.success  { background: rgba(58,170,96,0.1);   border: 1px solid rgba(58,170,96,0.3);   color: var(--green); }
.online-status.error    { background: rgba(224,80,80,0.1);   border: 1px solid rgba(224,80,80,0.3);   color: var(--red); }
.online-status.info     { background: rgba(70,120,220,0.1);  border: 1px solid rgba(70,120,220,0.3);  color: #70b0ff; }

.online-input-row {
  display: flex;
  gap: 8px;
  margin: 14px 0;
}
.online-input-row input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-0);
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  color: var(--text-bright);
  font-size: 1.1rem;
  font-family: inherit;
  direction: ltr;
  text-align: center;
  letter-spacing: 4px;
  font-weight: 700;
}
.online-input-row input:focus { outline: none; border-color: #4a7abe; }
.online-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-dim);
  font-size: .82rem;
}
.online-divider::before, .online-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-dim);
}

/* ══════════════════════════ ONLINE BADGE ════════════════════════════════ */
.online-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(30,80,200,0.15);
  border: 1px solid rgba(70,120,220,0.3);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: .74rem;
  color: #70b0ff;
  font-weight: 600;
}
.online-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity:1; transform:scale(1); }
  50%      { opacity:.5; transform:scale(1.3); }
}

/* ══════════════════════════ AUTH SCREEN ════════════════════════════════ */
.auth-screen {
  max-width: 420px;
  margin: 60px auto;
  padding: 44px 36px;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-1));
  border-radius: 22px;
  border: 1px solid var(--border-mid);
  text-align: center;
  direction: rtl;
  box-shadow: 0 0 80px rgba(80,30,160,0.18), 0 0 0 1px rgba(255,255,255,0.03);
}
.auth-logo {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 6px;
  text-shadow: 0 0 40px rgba(212,160,23,0.45);
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0;
  color: var(--text-dim);
  font-size: .82rem;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-dim);
}

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 14px 20px;
  background: #fff;
  color: #3c3c3c;
  border: none;
  border-radius: 10px;
  font-size: .97rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
}
.btn-google:hover {
  background: #f5f5f5;
  box-shadow: 0 4px 20px rgba(0,0,0,0.35);
  transform: translateY(-2px);
}

.phone-input-group {
  display: flex;
  border: 1px solid var(--border-mid);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-0);
  margin-bottom: 12px;
  transition: border-color .2s;
}
.phone-input-group:focus-within { border-color: var(--gold); }
.phone-prefix {
  padding: 12px 14px;
  color: var(--text-dim);
  font-size: .88rem;
  border-left: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  white-space: nowrap;
  flex-shrink: 0;
}
.phone-input-group input {
  flex: 1;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text-bright);
  font-size: 1rem;
  font-family: inherit;
}
.phone-input-group input:focus { outline: none; }

/* ══════════════════════════ USER BAR ═══════════════════════════════════ */
.user-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-0);
  border: 1px solid var(--border-dim);
  border-radius: 20px;
  padding: 5px 14px 5px 8px;
  font-size: .82rem;
  color: var(--text-mid);
}
.user-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
}
.user-initials {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gold);
  color: #180f00;
  font-size: .72rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ══════════════════════════ LOADING SCREEN ═════════════════════════════ */
.loading-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  font-size: 1.1rem;
  color: var(--text-dim);
}

/* ══════════════════════════ SCROLLBARS ══════════════════════════════════ */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-mid); border-radius: 2px; }

/* ══════════════════════════ RESPONSIVE ══════════════════════════════════ */
@media (max-width: 900px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
  .player-area.top    { order: 1; max-height: none; }
  .center-column      { order: 2; }
  .player-area.bottom { order: 3; max-height: none; }
  .log-panel { width: 100%; border-radius: 0; left: 0; right: 0; }
}

/* ══════════════════════════ CARD / EMBLEM ART ═══════════════════════════ */
.mini-card { align-items: center; }
.mini-card-emblem { flex: 0 0 auto; width: 13px; height: 13px; opacity: .85; }
.mini-card-emblem svg { width: 100%; height: 100%; display: block; }

.bc-emblem {
  position: absolute;
  top: 4px;
  left: 5px;
  width: 13px;
  height: 13px;
  opacity: .9;
  z-index: 1;
}
.bc-emblem svg { width: 100%; height: 100%; display: block; }

.dialog-title { display: flex; align-items: center; gap: 8px; }
.dialog-emblem { width: 18px; height: 18px; flex: 0 0 auto; }
.dialog-emblem svg { width: 100%; height: 100%; display: block; }

/* ══════════════════════════ USER BAR ACTIONS / GEMS ═════════════════════ */
.user-bar-actions { display: flex; align-items: center; gap: 6px; }
.gem-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: linear-gradient(135deg, rgba(127,216,255,0.16), rgba(42,143,192,0.1));
  border: 1px solid rgba(127,216,255,0.35);
  color: var(--gem);
  border-radius: 20px;
  padding: 5px 11px;
  font-size: .8rem;
  font-weight: 800;
}
.btn-icon {
  background: var(--bg-0);
  border: 1px solid var(--border-mid);
  color: var(--text-mid);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: .95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.btn-icon:hover { border-color: var(--gold); background: rgba(212,160,23,0.08); transform: translateY(-1px); }

/* ══════════════════════════ TOASTS ═══════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 50%;
  transform: translate(50%, 20px);
  opacity: 0;
  transition: all .3s ease;
  background: linear-gradient(135deg, var(--bg-3), var(--bg-2));
  border: 1px solid var(--border-bright);
  color: var(--text-bright);
  padding: 13px 22px;
  border-radius: 12px;
  font-size: .86rem;
  font-weight: 600;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  z-index: 200;
  direction: rtl;
}
.toast.show { opacity: 1; transform: translate(50%, 0); }
.toast-success { border-color: rgba(58,170,96,0.6); }
.toast-error   { border-color: rgba(224,80,80,0.6); }
.toast-info    { border-color: rgba(90,158,255,0.5); }

/* ══════════════════════════ SHOP SCREEN ══════════════════════════════════ */
.shop-screen {
  max-width: 480px;
  margin: 50px auto;
  padding: 44px 36px;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-1));
  border-radius: 22px;
  border: 1px solid var(--border-mid);
  text-align: center;
  direction: rtl;
  box-shadow: 0 0 60px rgba(127,216,255,0.08);
}
.shop-screen h2 { color: var(--gem); font-size: 1.4rem; font-weight: 800; margin-bottom: 8px; }
.shop-note {
  background: rgba(212,160,23,0.08);
  border: 1px solid rgba(212,160,23,0.25);
  color: var(--text-mid);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .78rem;
  margin: 16px 0 22px;
}
.gem-packs { display: flex; flex-direction: column; gap: 10px; }
.gem-pack {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-0);
  border: 1px solid var(--border-mid);
  border-radius: 12px;
  padding: 14px 18px;
}
.gem-pack-amount { color: var(--gem); font-weight: 800; font-size: 1rem; }

/* ══════════════════════════ LEADERBOARD SCREEN ═══════════════════════════ */
.leaderboard-screen {
  max-width: 560px;
  margin: 50px auto;
  padding: 44px 36px;
  background: linear-gradient(145deg, var(--bg-2), var(--bg-1));
  border-radius: 22px;
  border: 1px solid var(--border-mid);
  text-align: center;
  direction: rtl;
  box-shadow: 0 0 60px rgba(212,160,23,0.08);
}
.leaderboard-screen h2 { color: var(--gold); font-size: 1.4rem; font-weight: 800; margin-bottom: 22px; }
.leaderboard-list { display: flex; flex-direction: column; gap: 6px; }
.leaderboard-row {
  display: grid;
  grid-template-columns: 30px 1fr auto auto auto;
  align-items: center;
  gap: 10px;
  background: var(--bg-0);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: .85rem;
}
.leaderboard-row.me { border-color: var(--gold); background: rgba(212,160,23,0.06); }
.lb-rank { color: var(--gold); font-weight: 800; }
.lb-name { text-align: right; color: var(--text-bright); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-stat { color: var(--text-dim); font-size: .78rem; white-space: nowrap; }

/* Final tabletop overrides: keep these last so legacy rules cannot break layout. */
@media (min-width: 901px) {
  .game-layout {
    grid-template-columns: clamp(170px, 18vw, 240px) minmax(0, 1fr) clamp(170px, 18vw, 240px);
    gap: 0;
    padding: 0;
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    overflow: hidden;
  }
  .game-layout .player-area {
    max-height: 100dvh;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
    padding: 10px 9px;
  }
  .game-layout .center-column {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-width: 0;
    height: 100dvh;
    padding: clamp(8px, 1.4vh, 18px) clamp(72px, 7vw, 92px) clamp(52px, 6vh, 80px) clamp(8px, 1.4vh, 18px);
    overflow: hidden;
  }
  .game-layout .board-container {
    flex: 0 0 auto;
    padding: 0;
    border: 0;
    background: rgba(255,248,226,.14);
    box-shadow: none;
    transform-origin: top center;
    transform: scale(var(--board-scale, 1));
  }
  .game-layout .military-track {
    position: absolute;
    top: clamp(68px, 9vh, 90px);
    right: 14px;
    width: 62px;
    height: min(520px, calc(100dvh - 190px));
    padding: 9px 7px;
    flex-direction: column;
    gap: 5px;
    z-index: 20;
  }
  .game-layout .mil-track-inner {
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 1px;
  }
  .game-layout .mil-pos { width: 25px; height: 21px; flex: 0 0 auto; }
  .game-layout .tokens-area {
    position: absolute;
    top: min(625px, calc(100dvh - 138px));
    right: 8px;
    width: 74px;
    padding: 8px 6px;
    z-index: 20;
    border-radius: 22px;
  }
  .game-layout .tokens-label { margin: 0 0 5px; font-size: 0; text-align: center; }
  .game-layout .tokens-label::after { content: '🏅'; font-size: 1rem; }
  .game-layout .tokens-row { flex-direction: column; align-items: center; gap: 5px; }
  .game-layout .token {
    width: 48px;
    height: 48px;
    min-width: 48px;
    padding: 5px;
    border-radius: 50%;
    overflow: hidden;
  }
  .game-layout .token-name { font-size: .54rem; line-height: 1.15; }
  .game-layout .token-name + div { display: none; }
}

/* Stable physical-card appearance. */
.game-layout .board-card {
  border-radius: 6px;
  border-width: 2px;
  border-top-width: 18px;
  padding: 5px;
  box-shadow: 0 4px 9px rgba(55,32,18,.35);
}
.game-layout .board-card.face-down {
  border: 3px solid #3a281b;
  background: linear-gradient(135deg,#914615,#ca7429 50%,#813b12);
  box-shadow: inset 0 0 0 4px #df9143, inset 0 0 0 6px #5b2b11, 0 5px 9px rgba(53,29,13,.4);
}
.game-layout .board-card.color-brown  { background:linear-gradient(#efe2c9,#d6b68a);border-color:#7b4928; }
.game-layout .board-card.color-grey   { background:linear-gradient(#edf0ed,#c4ccc8);border-color:#657477; }
.game-layout .board-card.color-blue   { background:linear-gradient(#e5f0f4,#b7d7df);border-color:#28728e; }
.game-layout .board-card.color-red    { background:linear-gradient(#f2ddd2,#d4a18c);border-color:#9c352d; }
.game-layout .board-card.color-yellow { background:linear-gradient(#f5ecc9,#d9c277);border-color:#a27b12; }
.game-layout .board-card.color-green  { background:linear-gradient(#e4ecd7,#b8ce9d);border-color:#3d7939; }
.game-layout .board-card.color-purple { background:linear-gradient(#e9dfed,#c4a9ca);border-color:#744b80; }
.game-layout .board-card .bc-name { color:#35291f;text-shadow:none; }
.game-layout .board-card .bc-effect { color:#40382f;font-weight:700; }

@media (max-width: 900px) {
  .game-layout .tokens-area,
  .game-layout .military-track { position: static; width: 100%; height: auto; }
  .game-layout .military-track { flex-direction: row; }
  .game-layout .mil-track-inner { flex-direction: row; }
  .game-layout .tokens-row { flex-direction: row; }
}

/* ═══════════════ TABLETOP REDESIGN (BGA-inspired, keep last) ═══════════════ */
/* Inline SVG icon sizing — moderate, readable */
.ic { width: 1.15em; height: 1.15em; display: inline-block; vertical-align: -0.22em; flex: 0 0 auto; }

@media (min-width: 901px) {
  .game-layout { grid-template-columns: clamp(190px, 20vw, 300px) minmax(0, 1fr) clamp(190px, 20vw, 300px); }
}

/* Parchment player dashboards on the wooden table */
.game-layout .player-area {
  background:
    radial-gradient(circle at 30% 10%, rgba(255,255,255,.5), transparent 55%),
    linear-gradient(180deg, #f4e8cd 0%, #e9d6b0 60%, #e2cba0 100%);
  color: #3a2b1a;
  border: 0;
  box-shadow: inset -4px 0 12px rgba(90,55,20,.18), inset 4px 0 12px rgba(90,55,20,.18);
  gap: 12px;
  padding: 14px 13px;
}
.game-layout .player-area.active {
  box-shadow: inset 0 0 0 3px #d4a017, inset 0 0 26px rgba(212,160,23,.18);
}
.game-layout .player-name { color: #6b4a1f; font-size: 1.12rem; }
.game-layout .turn-arrow { color: #b3372b; }

.game-layout .stat {
  background: #fdf6e3;
  border: 1px solid #c9b489;
  color: #3a2b1a;
  font-size: .9rem;
  padding: 5px 11px;
  box-shadow: 0 1px 3px rgba(90,55,20,.25);
}
.game-layout .stat.coin   { border-color: #c9a13e; }
.game-layout .stat.shield { border-color: #c07b6d; }
.game-layout .stat.science{ border-color: #7fa86b; }
.game-layout .stat.score  { border-color: #6d94b8; }
.game-layout .stat .ic { width: 1.35em; height: 1.35em; }

/* Per-turn resource production bar */
.resource-bar {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  background: rgba(122,79,35,.14);
  border: 1px solid rgba(122,79,35,.38);
  border-radius: 12px;
  padding: 7px;
}
.res-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #fdf6e3;
  border: 1px solid #c9b489;
  border-radius: 9px;
  padding: 4px 7px;
  font-size: .92rem;
  font-weight: 800;
  color: #3a2b1a;
  box-shadow: 0 1px 2px rgba(90,55,20,.25);
}
.res-chip .ic { width: 1.5em; height: 1.5em; }
.res-chip.zero { opacity: .35; }
.res-chip.wild { background: #f7ecc9; border-color: #a5820f; }

.btn-discard-for-coins {
  background: linear-gradient(180deg, #a03524, #7c2317);
  color: #ffe9dd;
  border: 1px solid #5e1811;
  border-radius: 9px;
  padding: 7px 10px;
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  font-family: inherit;
}
.btn-discard-for-coins:hover { filter: brightness(1.15); }

/* Wonder cards in the dashboard */
.game-layout .wonder-slot {
  background: #fdf6e3;
  border: 1px solid #c9b489;
  box-shadow: 0 2px 5px rgba(90,55,20,.25);
  padding: 9px 11px;
}
.game-layout .wonder-slot:hover:not(.built):not(.locked) {
  border-color: #a5820f;
  background: #fffbef;
}
.game-layout .wonder-slot.can-afford { border-color: #2b6a3f; box-shadow: 0 0 0 1px #2b6a3f, 0 2px 6px rgba(43,106,63,.3); }
.game-layout .wonder-name { color: #7a4f23; font-size: .88rem; }
.game-layout .wonder-cost { color: #7c6a4d; }
.game-layout .wonder-built { color: #2b6a3f; font-weight: 700; }
.game-layout .wonder-art {
  width: 46px; height: 46px;
  background: radial-gradient(circle at 35% 30%, #f2e3bd, #d9c08a);
  border: 1px solid #c9b489;
}
.game-layout .wonder-art .wa-fill { fill: #a5820f; opacity: .5; }
.game-layout .wonder-art .wa-line { stroke: #6b4a1f; }
.game-layout .wonder-art .wa-accent { fill: #8a6a10; }
.wonder-slot.locked { opacity: .45; filter: grayscale(.7); cursor: not-allowed; }
.wonder-locked-label { color: #8c2b1e; font-size: .72rem; font-weight: 800; margin-top: 2px; }

/* Wonder effect icon row */
.wonder-fx { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.fx {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(43,106,63,.1);
  border: 1px solid rgba(43,106,63,.35);
  color: #1d4a2c;
  border-radius: 8px;
  padding: 2px 6px;
  font-size: .76rem;
  font-weight: 700;
}
.fx.bad  { background: rgba(140,43,30,.08); border-color: rgba(140,43,30,.4);  color: #7c2317; }
.fx.gold { background: rgba(212,160,23,.16); border-color: rgba(160,120,20,.45); color: #8a6a10; }
.fx .ic { width: 1.25em; height: 1.25em; }
.fx-color { width: 11px; height: 11px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.35); }
.draft-tile .wonder-fx { justify-content: center; }

/* Progress-token badges + built cards on parchment */
.game-layout .token-badge {
  background: #f7ecc9;
  border: 1px solid #c9a13e;
  color: #6b4a1f;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.game-layout .mini-card {
  background: #fdf6e3;
  color: #3a2b1a;
  border-right-width: 4px;
  box-shadow: 0 1px 2px rgba(90,55,20,.2);
  font-size: .72rem;
  min-width: 96px;
}
.mini-card-fx { display: inline-flex; align-items: center; gap: 2px; }

/* Science shelf */
.game-layout .science-display {
  background: rgba(43,106,63,.12);
  border: 1px solid rgba(43,106,63,.35);
  border-radius: 12px;
  padding: 7px 8px;
  gap: 6px;
}
.game-layout .sci-sym { opacity: .25; filter: grayscale(.9); }
.game-layout .sci-sym.have { opacity: 1; filter: none; }
.game-layout .sci-sym .ic { width: 25px; height: 25px; }
.game-layout .sci-sym sup { font-size: .68rem; font-weight: 800; color: #1d4a2c; position: absolute; top: -4px; right: -6px; }

/* Military panel — crimson */
.game-layout .military-track {
  background: linear-gradient(180deg, #6d1a14, #a03524 50%, #5a130e);
  border: 3px solid #c76a4a;
  box-shadow: 0 7px 18px rgba(55,15,10,.45);
}
.game-layout .mil-label { color: #ffe2b8; }
.game-layout .mil-pos {
  background: rgba(255,230,200,.16);
  border-color: rgba(255,220,190,.25);
  color: #ffd9a8;
  font-weight: 800;
}
.game-layout .mil-center { background: rgba(0,0,0,.35); border-color: #ffd28a; }
.game-layout .mil-marker { border-color: #ffd28a; color: #ffe9c4; }
.game-layout .mil-pawn {
  background: #2d1408;
  border: 2px solid #ffd28a;
  box-shadow: 0 0 14px rgba(255,200,120,.75);
}
.game-layout .mil-pawn .ic { width: 1.2em; height: 1.2em; }
@keyframes milBump {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.55) rotate(-14deg); }
  55%  { transform: scale(.85) rotate(10deg); }
  80%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.mil-pawn.bump { animation: milBump .9s cubic-bezier(.3,1.4,.5,1); }

/* Science / progress-token panel — emerald */
.game-layout .tokens-area {
  background: linear-gradient(180deg, #14512f, #1d7a49 50%, #0f3f24);
  border: 3px solid #57a877;
  box-shadow: 0 7px 18px rgba(10,45,25,.45);
}
.tokens-label::after { content: none; }
.game-layout .tokens-label::after { content: none; }
.game-layout .tokens-label .ic { width: 19px; height: 19px; }

/* Card backs per age */
.game-layout .board-card.face-down.age-1 {
  border-color: #3a281b;
  background: linear-gradient(135deg, #914615, #ca7429 50%, #813b12);
  box-shadow: inset 0 0 0 4px #df9143, inset 0 0 0 6px #5b2b11, 0 5px 9px rgba(53,29,13,.4);
}
.game-layout .board-card.face-down.age-2 {
  border-color: #10373a;
  background: linear-gradient(135deg, #0c5457, #14868b 50%, #09453f);
  box-shadow: inset 0 0 0 4px #2fb6bd, inset 0 0 0 6px #073336, 0 5px 9px rgba(8,45,47,.45);
}
.game-layout .board-card.face-down.age-3 {
  border-color: #2a1743;
  background: linear-gradient(135deg, #472a6e, #6a41a0 50%, #38205c);
  box-shadow: inset 0 0 0 4px #a077d6, inset 0 0 0 6px #241238, 0 5px 9px rgba(30,15,55,.45);
}

/* Keep the card pyramid dead-centred despite the side military track */
@media (min-width: 901px) {
  .game-layout .center-column { padding: clamp(8px, 1.4vh, 18px) clamp(72px, 7vw, 92px) clamp(48px, 5vh, 80px) clamp(72px, 7vw, 92px); }
}

@media (min-width: 901px) and (max-height: 820px) {
  .game-layout { --board-scale: .86; }
  .game-layout .center-column { justify-content: center; padding-top: 6px; padding-bottom: 6px; }
  .game-layout .player-area { gap: 7px; padding: 8px; }
  .game-layout .player-header { gap: 4px; }
  .game-layout .resource-bar,
  .game-layout .science-display { padding: 5px; gap: 4px; }
  .game-layout .wonder-slot { min-height: 58px; padding: 6px 8px; }
  .game-layout .wonder-art { width: 36px; height: 36px; }
  .game-layout .wonder-name { font-size: .75rem; }
  .wonder-fx { gap: 2px; margin-top: 3px; }
  .fx { padding: 1px 4px; font-size: .66rem; }
  .game-layout .mini-card { min-width: 76px; font-size: .61rem; padding: 2px 5px; }
  .game-layout .military-track { height: calc(100dvh - 130px); top: 64px; }
  .game-layout .tokens-area { top: auto; bottom: 12px; }
  .log-panel { display: none; }
}

@media (min-width: 901px) and (max-height: 700px) {
  .game-layout { --board-scale: .76; }
  .game-layout .player-area { gap: 5px; }
  .game-layout .player-wonders { gap: 3px; }
  .game-layout .wonder-slot { min-height: 48px; }
  .game-layout .wonder-cost,
  .game-layout .wonder-fx { display: none; }
  .game-layout .player-tokens,
  .game-layout .science-display { display: none; }
  .game-layout .military-track { height: calc(100dvh - 96px); top: 48px; }
  .game-layout .tokens-area { display: none; }
}

@media (min-width: 901px) and (max-width: 1180px) {
  .game-layout { --board-scale: .82; }
}

@media (min-width: 901px) and (max-width: 1020px) {
  .game-layout {
    grid-template-columns: 160px minmax(0, 1fr) 160px;
    --board-scale: .72;
  }
  .game-layout .center-column {
    padding-left: 58px;
    padding-right: 58px;
  }
}

/* Golden progress-token discs on the emerald panel */
.game-layout .token {
  background: radial-gradient(circle, #efe2aa, #b9903d);
  border: 2px solid #e9d793;
  color: #4d3920;
}
.game-layout .token-name { color: #4d3920; }
.game-layout .token.selectable { box-shadow: 0 0 0 3px #ffe9a8, 0 0 16px rgba(255,225,150,.8); cursor: pointer; }
.game-layout .sci-sym { opacity: .42; }

/* Duel-style structure cards: color cap, painted scene, icon band, name plaque. */
.game-layout .board-card {
  border: 2px solid #23170e;
  border-radius: 7px;
  padding: 0;
  background: #ead9b8;
  box-shadow:
    0 5px 9px rgba(54, 31, 15, .42),
    inset 0 0 0 1px rgba(255, 249, 230, .55);
  color: #30251b;
  display: block;
}
.game-layout .board-card::before {
  content: '';
  position: absolute;
  inset: 2px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, .34);
  pointer-events: none;
  z-index: 4;
}
.game-layout .board-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 5px;
  background:
    linear-gradient(110deg, rgba(255,255,255,.28), transparent 28%, transparent 70%, rgba(0,0,0,.16)),
    radial-gradient(circle at 50% 78%, rgba(255,255,255,.18), transparent 34%);
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: 5;
}
.game-layout .board-card.color-brown  { --card-main:#8a4e25; --card-dark:#4f2812; --card-light:#c3834c; border-color:#4f2812; }
.game-layout .board-card.color-grey   { --card-main:#84919a; --card-dark:#4c575d; --card-light:#d9dedb; border-color:#4c575d; }
.game-layout .board-card.color-blue   { --card-main:#2b80a0; --card-dark:#174e69; --card-light:#9ed0dc; border-color:#174e69; }
.game-layout .board-card.color-red    { --card-main:#b8382e; --card-dark:#681c18; --card-light:#df8c78; border-color:#681c18; }
.game-layout .board-card.color-yellow { --card-main:#d3a420; --card-dark:#8a6410; --card-light:#f0d36b; border-color:#8a6410; }
.game-layout .board-card.color-green  { --card-main:#28733d; --card-dark:#164522; --card-light:#8abf75; border-color:#164522; }
.game-layout .board-card.color-purple { --card-main:#71468e; --card-dark:#402457; --card-light:#b993c6; border-color:#402457; }

.game-layout .board-card .bc-top {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 24px;
  z-index: 7;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2px;
  padding: 2px 4px 4px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.22), transparent 44%),
    linear-gradient(90deg, var(--card-dark), var(--card-main) 52%, var(--card-dark));
  border-bottom: 1px solid rgba(60, 35, 18, .45);
}
.game-layout .board-card .bc-emblem {
  position: static;
  width: 18px;
  height: 18px;
  color: rgba(255,255,255,.88) !important;
  opacity: .95;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.45));
}
.game-layout .board-card .bc-emblem svg,
.game-layout .board-card .bc-art-building svg {
  width: 100%;
  height: 100%;
}
.game-layout .board-card .bc-cost {
  position: static;
  transform: none;
  transform-origin: center;
  min-height: 19px;
  max-width: 53px;
  padding: 1px 3px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 10px;
  background: rgba(250,244,224,.95);
  color: #352617;
  box-shadow: 0 1px 2px rgba(0,0,0,.32);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  overflow: hidden;
  white-space: nowrap;
}
.game-layout .board-card .bc-cost:empty { display: none; }
.game-layout .board-card .cost-icon {
  display: inline-flex;
  align-items: center;
  gap: 0;
  margin: 0 -1px;
  font-size: .57rem;
  font-weight: 900;
}
.game-layout .board-card .bc-cost .ic { width: 14px; height: 14px; }
.game-layout .board-card .bc-free-cost {
  color: #6b4a1f;
  font-size: .54rem;
  font-weight: 900;
}
.game-layout .board-card .free-badge {
  margin: 0;
  padding: 0 3px;
  border-radius: 8px;
  background: #1f6a34;
  color: #f4ffe8;
  font-size: .48rem;
  line-height: 1.35;
}

.game-layout .board-card .bc-art {
  position: absolute;
  top: 24px;
  right: 4px;
  left: 4px;
  height: 55px;
  overflow: hidden;
  border: 1px solid rgba(82, 51, 26, .42);
  border-radius: 2px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--card-light) 62%, #fff 38%) 0%, #f1dcae 52%, color-mix(in srgb, var(--card-main) 58%, #4d2b16 42%) 100%);
}
.game-layout .board-card .bc-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(120deg, rgba(255,255,255,.38), transparent 32%),
    repeating-linear-gradient(90deg, rgba(65,39,20,.12) 0 1px, transparent 1px 13px);
  opacity: .72;
}
.game-layout .board-card .bc-art-sun {
  position: absolute;
  top: 8px;
  left: 9px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(255, 232, 152, .82);
  box-shadow: 0 0 18px rgba(255, 228, 130, .78);
}
.game-layout .board-card .bc-art-horizon {
  position: absolute;
  right: -7px;
  left: -7px;
  bottom: 0;
  height: 20px;
  background:
    radial-gradient(ellipse at 28% 100%, rgba(70,43,23,.45) 0 30%, transparent 31%),
    radial-gradient(ellipse at 70% 100%, rgba(70,43,23,.35) 0 34%, transparent 35%),
    linear-gradient(180deg, transparent, rgba(68,39,19,.48));
}
.game-layout .board-card .bc-art-building {
  position: absolute;
  right: 22px;
  bottom: 7px;
  width: 34px;
  height: 34px;
  color: rgba(51, 31, 18, .72);
  filter: drop-shadow(0 2px 1px rgba(255,255,255,.28));
}
.game-layout .board-card .bc-art-red .bc-art-building,
.game-layout .board-card .bc-art-purple .bc-art-building {
  color: rgba(255, 235, 205, .78);
}

.game-layout .board-card .bc-effect {
  position: absolute;
  right: 4px;
  left: 4px;
  top: 80px;
  height: 15px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1px;
  color: #352617;
  font-size: .58rem;
  font-weight: 900;
  overflow: hidden;
}
.game-layout .board-card .bc-fx {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: #f5ecd6;
  border: 1px solid rgba(65, 42, 24, .42);
  box-shadow: 0 1px 1px rgba(0,0,0,.18);
  flex: 0 0 auto;
}
.game-layout .board-card .bc-fx .ic {
  width: 13px;
  height: 13px;
}
.game-layout .board-card .bc-fx b {
  position: absolute;
  left: -2px;
  bottom: -3px;
  min-width: 8px;
  height: 8px;
  border-radius: 6px;
  background: #2b241a;
  color: #fff6dc;
  font-size: .43rem;
  line-height: 8px;
  text-align: center;
}
.game-layout .board-card .bc-fx-vp { background: #e8d38d; }
.game-layout .board-card .bc-fx-shield { background: #e6b1a5; }
.game-layout .board-card .bc-fx-science { background: #dcead2; }
.game-layout .board-card .bc-fx-coin,
.game-layout .board-card .bc-fx-commerce { background: #f0d36b; }
.game-layout .board-card .bc-fx-chain { color: #654209; background: #f7e79e; }

.game-layout .board-card .bc-name {
  position: absolute;
  right: 7px;
  left: 7px;
  bottom: 5px;
  z-index: 8;
  min-height: 13px;
  padding: 1px 3px 2px;
  border-radius: 7px;
  background: rgba(252, 246, 229, .96);
  border: 1px solid rgba(76, 52, 31, .36);
  box-shadow: inset 0 1px rgba(255,255,255,.72), 0 1px 2px rgba(0,0,0,.18);
  color: #33261a;
  text-shadow: none;
  text-align: center;
  font-size: .55rem;
  line-height: 1.15;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.game-layout .board-card.accessible:hover {
  transform: translateY(-9px) scale(1.08);
  box-shadow: 0 14px 24px rgba(55,31,16,.44);
  z-index: 30;
}
.game-layout .board-card.can-afford {
  outline: 2px solid rgba(55, 128, 59, .72);
  outline-offset: 1px;
}
.game-layout .board-card.can-afford:hover {
  box-shadow: 0 15px 25px rgba(42, 100, 45, .42);
}

.game-layout .board-card.face-down,
.game-layout .board-card.face-down.age-1,
.game-layout .board-card.face-down.age-2,
.game-layout .board-card.face-down.age-3 {
  padding: 0;
  border-width: 3px;
}
.game-layout .board-card.face-down::before {
  inset: 7px;
  border: 2px solid rgba(255,255,255,.28);
  border-radius: 5px;
}
.game-layout .board-card.face-down::after {
  content: '';
  position: absolute;
  inset: 13px;
  border-radius: 4px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255,240,180,.18) 0 5px, transparent 6px),
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(255,255,255,.11) 7px 8px),
    repeating-linear-gradient(-45deg, transparent 0 6px, rgba(0,0,0,.12) 7px 8px);
  border: 1px solid rgba(0,0,0,.3);
  mix-blend-mode: normal;
}
.game-layout .board-card.face-down .bc-back {
  position: relative;
  z-index: 6;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(255, 241, 195, .7);
  font: 900 1.7rem/1 Georgia, serif;
  text-shadow: 0 2px 2px rgba(0,0,0,.35);
}

.cards-stat {
  cursor: pointer;
  font-family: inherit;
}
.game-layout .cards-stat {
  border-color: #c9b489;
  color: #5d452b;
}
.game-layout .cards-stat:hover {
  border-color: #a5820f;
  background: #fff8e8;
  transform: translateY(-1px);
}

.built-cards-dialog {
  z-index: 130;
}
.built-cards-box {
  width: min(720px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #f4e8cd, #e3cca2);
  border-color: #9c7a47;
  color: #3a2b1a;
}
.built-cards-header {
  background: linear-gradient(90deg, #6b4a1f, #9a7439);
  color: #fff4d6;
  border-bottom: 2px solid #c9a13e;
}
.built-cards-body {
  padding: 14px;
  overflow: hidden;
  display: grid;
  gap: 10px;
}
.built-card-group {
  min-width: 0;
}
.built-card-group h4 {
  color: #4f3821;
  font-size: .82rem;
  line-height: 1;
  margin-bottom: 7px;
  padding-right: 8px;
  border-right: 4px solid;
}
.built-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.built-card-row .mini-card {
  min-width: 112px;
  max-width: 128px;
  min-height: 38px;
  background: rgba(253,246,227,.9);
  color: #3a2b1a;
  box-shadow: 0 2px 5px rgba(90,55,20,.2);
}
.empty-built-cards {
  padding: 22px 12px;
  text-align: center;
  color: #7c6a4d;
  border: 1px dashed #c9b489;
  border-radius: 12px;
}

/* Portrait mobile table: compact player rails + scaled pyramid board. */
@media (max-width: 600px) {
  .built-cards-box {
    width: calc(100vw - 18px);
    max-height: calc(100dvh - 18px);
  }
  .built-cards-body {
    padding: 10px;
    gap: 8px;
  }
  .built-card-row {
    gap: 5px;
  }
  .built-card-row .mini-card {
    min-width: 72px;
    max-width: 86px;
    min-height: 44px;
    font-size: .58rem;
  }

  html,
  body {
    min-height: 100%;
    overflow: hidden;
    background: #244f61;
  }

  body {
    background:
      linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px),
      linear-gradient(180deg, rgba(255,255,255,.07) 1px, transparent 1px),
      linear-gradient(180deg, #336f80 0 12%, #d0ad78 12% 76%, #2f7689 76% 100%);
    background-size: 28px 28px, 28px 28px, auto;
  }

  .game-layout {
    width: 100vw;
    height: 100dvh;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: 104px minmax(0, 1fr) 126px;
    grid-template-columns: 1fr;
    gap: 0;
    padding: 0;
    overflow: hidden;
    background:
      linear-gradient(90deg, rgba(31,67,72,.75) 0 10px, transparent 10px calc(100% - 10px), rgba(31,67,72,.75) calc(100% - 10px)),
      linear-gradient(180deg, rgba(37,96,111,.96) 0 96px, #caa574 96px calc(100% - 116px), rgba(41,113,130,.96) calc(100% - 116px));
    position: relative;
  }

  .game-layout::before,
  .game-layout::after {
    content: '';
    position: fixed;
    left: 0;
    right: 0;
    height: 24px;
    z-index: 40;
    pointer-events: none;
    background:
      repeating-linear-gradient(90deg, rgba(244,222,153,.9) 0 7px, rgba(26,76,82,.75) 7px 13px, rgba(244,222,153,.85) 13px 19px),
      linear-gradient(180deg, #234e59, #397987);
    border-top: 1px solid rgba(255,245,190,.45);
    border-bottom: 1px solid rgba(18,55,61,.6);
    box-shadow: 0 2px 7px rgba(0,0,0,.24);
  }
  .game-layout::before { top: 0; }
  .game-layout::after {
    top: auto;
    bottom: 0;
    box-shadow: 0 -2px 7px rgba(0,0,0,.24);
  }

  .game-layout .player-area {
    position: relative;
    z-index: 20;
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding: 28px 8px 6px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: grid;
    grid-template-columns: 54px 1fr 54px;
    grid-template-rows: 34px 36px;
    gap: 5px;
    align-items: center;
    color: #2f2318;
  }
  .game-layout .player-area.top {
    order: 1;
    grid-row: 1;
    background: linear-gradient(180deg, rgba(41,91,94,.62), rgba(202,165,116,.16));
  }
  .game-layout .player-area.bottom {
    order: 3;
    grid-row: 3;
    padding-top: 8px;
    padding-bottom: 28px;
    background:
      radial-gradient(ellipse at 50% 85%, rgba(15,52,63,.24), transparent 54%),
      linear-gradient(180deg, rgba(202,165,116,.2), rgba(41,104,122,.72));
  }
  .game-layout .player-area.active {
    box-shadow: inset 0 0 0 2px rgba(255, 217, 112, .65);
  }

  .game-layout .player-header {
    grid-column: 1 / 4;
    grid-row: 1;
    display: grid;
    grid-template-columns: 54px 1fr 54px;
    gap: 6px;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
  }
  .game-layout .player-name {
    grid-column: 2;
    justify-content: center;
    min-width: 0;
    height: 28px;
    padding: 3px 10px;
    border-radius: 16px;
    background: rgba(249, 236, 199, .82);
    border: 1px solid rgba(98, 67, 32, .32);
    color: #392719;
    font-size: .78rem;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: 0 2px 6px rgba(44,30,15,.18);
  }
  .game-layout .turn-arrow { font-size: .68rem; }

  .game-layout .player-stats {
    grid-column: 1 / 4;
    grid-row: 2;
    justify-content: center;
    gap: 4px;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .game-layout .stat {
    min-width: 0;
    height: 28px;
    padding: 3px 6px;
    border-radius: 14px;
    background: rgba(253, 246, 227, .9);
    font-size: .72rem;
    gap: 2px;
  }
  .game-layout .stat .ic {
    width: 17px;
    height: 17px;
  }

  .game-layout .resource-bar,
  .game-layout .player-wonders,
  .game-layout .player-tokens,
  .game-layout .science-display,
  .game-layout .btn-discard-for-coins {
    display: none;
  }

  .game-layout .player-cards {
    grid-column: 1 / 4;
    grid-row: 2;
    align-self: end;
    justify-content: center;
    max-width: calc(100vw - 18px);
    overflow: hidden;
    gap: 2px;
    opacity: .96;
    transform: translateY(34px);
    pointer-events: none;
  }
  .game-layout .player-area.bottom .player-cards {
    transform: translateY(-38px);
  }
  .game-layout .card-column {
    flex-direction: row;
    gap: 1px;
  }
  .game-layout .mini-card {
    min-width: 22px;
    width: 22px;
    height: 28px;
    padding: 2px;
    border-radius: 4px;
    border-right-width: 3px;
    font-size: 0;
    justify-content: center;
    overflow: hidden;
    background: rgba(253,246,227,.86);
  }
  .game-layout .mini-card > span:not(.mini-card-emblem):not(.mini-card-fx) {
    display: none;
  }
  .game-layout .mini-card-emblem {
    width: 16px;
    height: 16px;
  }
  .game-layout .mini-card-fx {
    display: none;
  }

  .game-layout .center-column {
    order: 2;
    grid-row: 2;
    position: relative;
    width: 100vw;
    min-width: 0;
    height: 100%;
    overflow: hidden;
    padding: 0;
    display: block;
    background:
      linear-gradient(90deg, rgba(90,57,28,.18) 1px, transparent 1px),
      linear-gradient(180deg, rgba(255,255,255,.18) 1px, transparent 1px),
      linear-gradient(90deg, #b38352, #d2b076 48%, #ad7b49);
    background-size: 54px 54px, 54px 54px, auto;
    box-shadow: inset 0 0 35px rgba(70,38,18,.32);
  }
  .game-layout .center-column::before {
    content: '';
    position: absolute;
    inset: 7px 20px;
    border-radius: 16px;
    background: rgba(255, 235, 184, .12);
    border: 1px solid rgba(89, 59, 29, .16);
    pointer-events: none;
  }

  .game-layout .online-badge {
    position: absolute;
    top: 7px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 50;
    max-width: calc(100vw - 96px);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    background: rgba(244,234,213,.9);
    color: #315c73;
  }

  .game-layout .board-container {
    position: absolute !important;
    left: 50%;
    top: 50%;
    margin: 0 !important;
    transform: translate(-50%, -50%) scale(.54);
    transform-origin: center center;
    padding: 0 !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .game-layout .board-card.accessible:hover {
    transform: translateY(-5px) scale(1.04);
  }

  .game-layout .military-track {
    position: absolute !important;
    left: 5px;
    right: auto;
    top: 22px;
    bottom: 22px;
    width: 38px;
    height: auto;
    padding: 5px 4px;
    border-radius: 20px;
    z-index: 30;
    flex-direction: column;
    gap: 3px;
    border-width: 2px;
  }
  .game-layout .mil-label {
    max-width: 28px;
    font-size: 0;
    line-height: 0;
  }
  .game-layout .mil-label::after {
    content: '⚔';
    font-size: .78rem;
    line-height: 1;
  }
  .game-layout .mil-track-inner {
    flex: 1;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    min-height: 0;
  }
  .game-layout .mil-pos {
    width: 22px;
    height: 15px;
    min-height: 0;
    border-radius: 9px;
    font-size: .48rem;
  }
  .game-layout .mil-pawn {
    width: 28px;
    height: 20px;
    border-radius: 14px;
  }

  .game-layout .tokens-area {
    position: absolute !important;
    right: 5px;
    top: 22px;
    bottom: 22px;
    width: 42px;
    height: auto;
    padding: 6px 4px;
    border-width: 2px;
    border-radius: 20px;
    z-index: 30;
  }
  .game-layout .tokens-label {
    height: 18px;
    margin: 0 0 5px;
    text-align: center;
    font-size: 0;
  }
  .game-layout .tokens-label .ic {
    width: 17px;
    height: 17px;
  }
  .game-layout .tokens-row {
    flex-direction: column;
    align-items: center;
    gap: 5px;
  }
  .game-layout .token {
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 2px;
    border-radius: 50%;
  }
  .game-layout .token-name {
    font-size: .42rem;
    line-height: 1;
  }
  .game-layout .token-name + div {
    display: none;
  }

  .phase-banner {
    position: absolute;
    right: 52px;
    left: 52px;
    bottom: 6px;
    z-index: 60;
    width: auto;
    max-width: none;
    padding: 7px 9px;
    border-radius: 13px;
    background: rgba(250, 244, 228, .92);
    color: #513b28;
    font-size: .64rem;
    line-height: 1.35;
    box-shadow: 0 3px 12px rgba(64,40,22,.22);
  }
  .phase-banner .turn-actions {
    justify-content: center;
    gap: 4px;
  }
  .phase-banner button {
    padding: 5px 8px;
    font-size: .62rem;
    border-radius: 8px;
  }

  .log-panel,
  .chat-toggle,
  .chat-panel {
    display: none !important;
  }

  .music-toggle {
    width: 36px;
    height: 36px;
    left: 10px;
    bottom: 32px;
    z-index: 80;
    background: rgba(20, 48, 58, .9);
  }

  .card-dialog {
    align-items: flex-end;
  }
  .dialog-box {
    width: min(360px, calc(100vw - 24px));
    margin-bottom: 12px;
  }
}

@media (max-width: 380px) {
  .game-layout {
    grid-template-rows: 96px minmax(0, 1fr) 116px;
  }
  .game-layout .board-container {
    transform: translate(-50%, -50%) scale(.49);
  }
  .game-layout .player-area {
    padding-left: 6px;
    padding-right: 6px;
  }
  .game-layout .stat {
    font-size: .66rem;
    padding: 3px 5px;
  }
}

@media (min-width: 431px) and (max-width: 600px) {
  .game-layout .board-container {
    transform: translate(-50%, -50%) scale(.6);
  }
}

/* Mobile split view: opponent cards / main board / own cards. */
@media (max-width: 600px) {
  .game-layout {
    grid-template-rows: 31dvh 38dvh 31dvh;
  }

  .game-layout .player-area {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 28px 10px 8px;
    overflow: hidden;
    background:
      linear-gradient(90deg, rgba(21,62,72,.7) 0 10px, transparent 10px calc(100% - 10px), rgba(21,62,72,.7) calc(100% - 10px)),
      radial-gradient(ellipse at 50% 22%, rgba(255,244,205,.14), transparent 60%),
      linear-gradient(180deg, rgba(40,101,116,.9), rgba(48,121,139,.72));
  }
  .game-layout .player-area.bottom {
    padding: 8px 10px 28px;
    background:
      linear-gradient(90deg, rgba(21,62,72,.7) 0 10px, transparent 10px calc(100% - 10px), rgba(21,62,72,.7) calc(100% - 10px)),
      radial-gradient(ellipse at 50% 78%, rgba(255,244,205,.14), transparent 60%),
      linear-gradient(180deg, rgba(48,121,139,.7), rgba(40,101,116,.94));
  }

  .game-layout .player-header {
    flex: 0 0 auto;
    width: min(320px, calc(100vw - 88px));
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
  }
  .game-layout .player-name {
    width: 100%;
    height: 28px;
  }
  .game-layout .player-stats {
    width: 100%;
    justify-content: center;
    gap: 4px;
  }

  .game-layout .player-cards {
    flex: 1 1 auto;
    width: min(360px, calc(100vw - 30px));
    max-width: min(360px, calc(100vw - 30px));
    min-height: 0;
    margin: 0 auto;
    padding: 4px 5px;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    overflow: hidden;
    justify-content: center;
    align-content: flex-start;
    gap: 4px;
    border-radius: 14px;
    background: rgba(14, 55, 66, .26);
    border: 1px solid rgba(233, 214, 151, .22);
  }
  .game-layout .player-area.bottom .player-cards {
    transform: none;
  }
  .game-layout .card-column {
    display: contents;
  }
  .game-layout .mini-card {
    width: clamp(32px, 10.2vw, 42px);
    min-width: clamp(32px, 10.2vw, 42px);
    height: clamp(46px, 7.1vh, 58px);
    padding: 3px;
    border-radius: 6px;
    border-right-width: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: clamp(.34rem, 1.45vw, .44rem);
    line-height: 1.05;
    text-align: center;
    color: #342719;
    box-shadow: 0 2px 5px rgba(16, 38, 44, .28);
  }
  .game-layout .mini-card > span:not(.mini-card-emblem):not(.mini-card-fx) {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .game-layout .mini-card-emblem {
    width: clamp(14px, 4.4vw, 18px);
    height: clamp(14px, 4.4vw, 18px);
  }
  .game-layout .mini-card-fx {
    display: inline-flex;
    max-width: 38px;
    overflow: hidden;
    gap: 0;
  }
  .game-layout .mini-card-fx .ic {
    width: clamp(9px, 3vw, 12px);
    height: clamp(9px, 3vw, 12px);
  }

  .game-layout .center-column {
    height: 100%;
    border-top: 2px solid rgba(70,45,21,.38);
    border-bottom: 2px solid rgba(70,45,21,.38);
  }
  .game-layout .center-column::before {
    inset: 7px 48px;
    border-radius: 13px;
  }
  .game-layout .board-container {
    transform: translate(-50%, -50%) scale(.43);
  }

  .game-layout .military-track {
    top: 10px;
    bottom: 10px;
    width: 34px;
  }
  .game-layout .tokens-area {
    top: 10px;
    bottom: 10px;
    width: 38px;
  }
  .phase-banner {
    right: 46px;
    left: 46px;
    bottom: 4px;
    padding: 5px 7px;
  }
}

@media (max-width: 380px) {
  .game-layout .board-container {
    transform: translate(-50%, -50%) scale(.39);
  }
  .game-layout .mini-card {
    width: 31px;
    min-width: 31px;
    height: 45px;
  }
  .game-layout .mini-card-fx {
    display: none;
  }
}

@media (max-width: 600px) and (max-height: 740px) {
  .game-layout {
    grid-template-rows: 29dvh 42dvh 29dvh;
  }
  .game-layout .player-area {
    padding-top: 26px;
    gap: 4px;
  }
  .game-layout .player-area.bottom {
    padding-bottom: 26px;
  }
  .game-layout .player-header {
    gap: 3px;
  }
  .game-layout .player-name {
    height: 24px;
    font-size: .7rem;
  }
  .game-layout .stat {
    height: 24px;
    font-size: .62rem;
  }
  .game-layout .stat .ic {
    width: 14px;
    height: 14px;
  }
  .game-layout .player-cards {
    padding: 3px;
    gap: 3px;
  }
  .game-layout .mini-card {
    width: 31px;
    min-width: 31px;
    height: 42px;
    font-size: .32rem;
  }
  .game-layout .mini-card-fx {
    display: none;
  }
  .game-layout .board-container {
    transform: translate(-50%, -50%) scale(.39);
  }
}

@media (max-width: 600px) and (max-height: 660px) {
  .game-layout .board-container {
    transform: translate(-50%, -50%) scale(.34);
  }
  .phase-banner {
    display: none;
  }
}

@media (min-width: 431px) and (max-width: 600px) {
  .game-layout .board-container {
    transform: translate(-50%, -50%) scale(.48);
  }
}
