/* Vazirmatn, served locally */
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/vazirmatn-arabic.woff2) format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FEFC;
}
@font-face {
  font-family: 'Vazirmatn';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/fonts/vazirmatn-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Iron & Canal: soot, brass and canal water */
:root {
  --bg: #15120f;
  --bg2: #1d1915;
  --panel: #231e19;
  --panel2: #2d2620;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f3ece2;
  --muted: #a99d8f;
  --accent: #e0894a;
  --accent2: #f2a766;
  --gold: #f2c45a;
  --green: #5bb974;
  --red: #e0574a;
  --water: #7cc4ef;
  --top-h: 34px;
  --side-w: 300px;
  --app-height: 100dvh;
  font-family: 'Vazirmatn', Tahoma, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
body { background: radial-gradient(1200px 600px at 80% -10%, rgba(224, 137, 74, 0.10), transparent 60%), linear-gradient(180deg, #1a1612, var(--bg)); background-attachment: fixed; }
button, input { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---------------- buttons ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(180deg, var(--accent2), var(--accent)); border-color: transparent; color: #241004; }
.btn-ghost { background: rgba(255, 255, 255, 0.05); }
.btn-danger { background: rgba(224, 87, 74, 0.18); border-color: rgba(224, 87, 74, 0.5); color: #ffc9c2; }
.link-btn { background: none; border: 0; color: var(--accent2); font: inherit; font-size: 12px; cursor: pointer; padding: 2px 4px; text-decoration: underline; }

/* ---------------- splash & BoardBazi bar ---------------- */
.ic-splash-logo { width: 96px; height: 96px; border-radius: 18px; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.ic-splash-title { font-size: 26px; font-weight: 900; color: var(--bh-game); }
.bb-bar { display: flex; align-items: center; gap: 10px; height: 44px; padding: env(safe-area-inset-top) max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left)); box-sizing: content-box; background: rgba(14, 18, 29, 0.92); border-bottom: 1px solid rgba(255, 255, 255, 0.08); color: #f8fafc; font-size: 14px; position: sticky; top: 0; z-index: 20; }
.bb-brand, .bb-chip { display: flex; align-items: center; gap: 8px; color: inherit; text-decoration: none; min-width: 0; }
.bb-mark { width: 24px; height: 24px; border-radius: 6px; background: linear-gradient(135deg, #6366f1, #06b6d4); display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.bb-spacer { flex: 1; }
.bb-avatar { width: 24px; height: 24px; border-radius: 50%; background: #334155; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.bb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.bb-level { font-size: 12px; color: #94a3b8; white-space: nowrap; }
.bb-xp { width: 48px; height: 4px; border-radius: 2px; background: rgba(255,255,255,.15); overflow: hidden; flex-shrink: 0; }
.bb-xp-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #6366f1, #06b6d4); }
.bb-logout { background: none; border: 1px solid rgba(255,255,255,.15); color: #94a3b8; border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
@media (max-width: 420px) { .bb-word { display: none; } .bb-name { max-width: 90px; } }

/* ---------------- lobby extras (game prefix ic-, shared bh- variables) ---------------- */
.ic-center { flex: 1; justify-content: center; }
.ic-auth-card { width: 100%; }
.ic-wait { text-align: center; margin: 10px 0 0; }
.ic-results { display: flex; flex-direction: column; gap: 16px; }
.ic-results-sheet { max-height: calc(var(--app-height) * 0.92); overflow-y: auto; }

/* The table lives inside .bh-root; its page background, line height and focus ring do not apply here */
body.in-game #bh-root { background: transparent; }
#game-root { font-family: 'Vazirmatn', Tahoma, sans-serif; line-height: 1.45; color: var(--text); }
#game-root *::before, #game-root *::after { box-sizing: content-box; }
#game-root :focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }

/* ================= GAME TABLE ================= */
body.in-game { overflow: hidden; }
.app-root { position: relative; min-height: 100dvh; }
body.in-game .app-root { height: var(--app-height); min-height: 0; overflow: hidden; }
.main { padding: 0; }

.g-screen {
  direction: ltr; /* the map stays left to right in both languages */
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--side-w);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
  height: var(--app-height);
  width: 100%;
  gap: 0 6px;
  padding: 0 max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left));
}
[dir="rtl"] .g-top, [dir="rtl"] .g-side { direction: rtl; }

.g-top { grid-row: 1; grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.g-icon { flex-shrink: 0; width: 30px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); cursor: pointer; font-size: 14px; display: grid; place-items: center; padding: 0; }
.g-conn { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
.g-conn.lost { background: var(--red); animation: blink 1s infinite; }
.g-era { color: var(--gold); flex-shrink: 0; font-weight: 700; }
.g-turn { font-weight: 700; flex-shrink: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-turn.mine { color: var(--accent2); }
.g-timebar { width: 60px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; flex-shrink: 0; }
.g-timebar-fill { height: 100%; background: var(--muted); transition: width 1s linear; }
.g-timebar-fill.mine { background: var(--accent); }
.g-timebar-fill.urgent { background: var(--red); }
.g-timer { font-variant-numeric: tabular-nums; flex-shrink: 0; color: var(--muted); }
.g-timer.urgent { color: var(--red); font-weight: 700; }
.g-last { flex: 1; min-width: 0; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.g-away { color: #ffb4a8; font-size: 12px; white-space: nowrap; }
@keyframes blink { 50% { opacity: 0.3; } }

/* ---------------- board ---------------- */
.g-boardwrap { grid-row: 2; grid-column: 1; min-height: 0; min-width: 0; padding-top: 4px; }
.g-board { position: relative; width: 100%; height: 100%; border-radius: 12px; overflow: hidden; background: #0d1c27; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
.board-svg { display: block; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; cursor: default; }
.board-svg.zoomed { cursor: grab; }
.board-svg.zoomed:active { cursor: grabbing; }
.g-zoom { position: absolute; bottom: 8px; left: 8px; display: flex; flex-direction: column; gap: 6px; }
.g-zoom .g-icon { width: 34px; height: 34px; font-size: 17px; background: rgba(21,18,15,.82); }
.g-paused { position: absolute; inset: auto 0 40% 0; text-align: center; font-weight: 700; color: var(--gold); }

.board-svg .lbl { font-size: 12.5px; font-weight: 800; fill: #f7efdd; paint-order: stroke; stroke: #120e0b; stroke-width: 3.5px; stroke-linejoin: round; pointer-events: none; }
.lk-hit { stroke: transparent; stroke-width: 24; stroke-linecap: round; fill: none; cursor: pointer; }
.lk-line { stroke-linecap: round; fill: none; pointer-events: none; }
.lk-built .lk-line { stroke-width: 6; stroke-opacity: 0.72; }
.lk-built.lk-canal .lk-line { filter: drop-shadow(0 0 2px rgba(124,196,239,.85)); }
.lk.lk-target .lk-line { stroke: #ffd36b; stroke-width: 6; stroke-dasharray: 10 6; animation: march 0.9s linear infinite; }
.lk.lk-target.lk-chosen .lk-line { stroke: #fff; stroke-width: 8; stroke-dasharray: none; animation: none; }
.lk-pin { fill: rgba(255, 211, 107, 0.88); stroke: #1a120a; stroke-width: 2.5; cursor: pointer; }
.lk.lk-chosen .lk-pin { fill: #fff; stroke: #e0894a; }
.lk-token-wrap { pointer-events: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.85)); }
@keyframes march { to { stroke-dashoffset: -32; } }

.sl { cursor: pointer; }
.sl-empty .sl-box { fill: transparent; stroke: transparent; stroke-width: 1.5; transition: stroke 0.15s, fill 0.15s; }
.sl-empty:hover .sl-box { stroke: rgba(255,255,255,.45); fill: rgba(255,255,255,.06); }
.sl-frame { fill: transparent; stroke: rgba(0,0,0,.65); stroke-width: 1.4; pointer-events: none; }
.sl-img, .pt-img, .pt-beer, .mk-cube { pointer-events: none; }
.sl-tile.sl-flipped .sl-img { filter: drop-shadow(0 1px 3px rgba(0,0,0,.85)); }
.sl-target .sl-box, .sl-target .sl-frame { stroke: #ffd36b; stroke-width: 3; fill: rgba(255,211,107,.16); }
.sl-chosen .sl-box, .sl-chosen .sl-frame { stroke: #fff; stroke-width: 3.4; fill: rgba(255,255,255,.22); }
.sl-cubes { pointer-events: none; }
.sl-cubes rect { fill: rgba(12,10,8,.88); stroke: rgba(255,255,255,.45); stroke-width: .7; }
.sl-cubes text { font-size: 8.5px; font-weight: 800; fill: #fff; }
.pt-hit { fill: transparent; cursor: pointer; }
.pt-off { opacity: .45; }

.pile { cursor: pointer; }
.pile-hit { fill: transparent; }
.pile-layer { fill: #2a241e; stroke: rgba(235, 220, 192, .38); stroke-width: 1.1; pointer-events: none; }
.pile-wild .pile-layer { fill: #332a1e; stroke: rgba(242, 196, 90, .48); }
.pile-top { pointer-events: none; filter: drop-shadow(0 3px 5px rgba(0,0,0,.72)); }
.pile-img { pointer-events: none; }
.pile-frame { fill: none; stroke: rgba(230, 224, 212, .52); stroke-width: 1.6; pointer-events: none; transition: stroke 0.15s; }
.pile-wild .pile-frame { stroke: rgba(242, 196, 90, .78); }
.pile:hover .pile-frame { stroke: #ffd36b; stroke-width: 2.2; }
.pile-empty-box { fill: rgba(0, 0, 0, .2); stroke: rgba(255, 255, 255, .18); stroke-width: 1.3; stroke-dasharray: 6 4; pointer-events: none; }
.pile-badge { pointer-events: none; }
.pile-badge rect { fill: rgba(14, 11, 9, .9); stroke: rgba(242, 196, 90, .78); stroke-width: 1.5; }
.pile-badge text { font-size: 13px; font-weight: 900; fill: #ffe69a; font-variant-numeric: tabular-nums; }
.pile-empty .pile-badge rect { stroke: rgba(255, 255, 255, .28); }
.pile-empty .pile-badge text { fill: rgba(255, 255, 255, .55); }

/* ---------------- side panel ---------------- */
.g-side { grid-row: 2; grid-column: 2; display: flex; flex-direction: column; gap: 5px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 0 8px; scrollbar-width: thin; }
.ic { width: 1.05em; height: 1.05em; vertical-align: -0.16em; flex-shrink: 0; }
.ic-lg { width: 26px; height: 26px; }
.ic-tok { width: 18px; height: 22px; object-fit: contain; vertical-align: middle; flex-shrink: 0; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; }

.g-players { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pl { display: flex; flex-direction: column; align-items: stretch; gap: 2px; min-width: 0; padding: 3px 6px; border-radius: 9px; border: 1px solid var(--line); border-inline-start: 4px solid var(--pc); background: var(--panel); color: var(--text); font: inherit; font-size: 11.5px; text-align: start; cursor: pointer; }
.pl-active { background: color-mix(in srgb, var(--pc) 22%, var(--panel)); border-color: var(--pc); }
.pl-me .pl-name { text-decoration: underline; text-decoration-color: var(--pc); }
.pl-head { display: flex; align-items: center; gap: 5px; min-width: 0; }
.pl-char { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1.5px solid var(--pc, rgba(255,255,255,.3)); background: #1c1713; }
.bh-avatar .pl-char { width: 100%; height: 100%; border: 0; }
.sheet-title .pl-char { width: 28px; height: 28px; border-width: 2px; }
.pl-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-stats { display: flex; gap: 6px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.pl-stats span { display: inline-flex; align-items: center; gap: 2px; }
.pl-stats .neg { color: #ff9a8f; }
.pl-badge { font-size: 10px; color: var(--muted); }
.pl-badge.warn { color: #ffb4a8; }

.g-markets { display: flex; flex-direction: column; gap: 3px; padding: 4px 6px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); font-size: 11px; }
.mk { display: flex; align-items: center; gap: 5px; }
.mk-cells { display: flex; gap: 2px; flex: 1; direction: ltr; }
.mk-cells i { flex: 1; height: 8px; border-radius: 2px; background: rgba(255,255,255,.08); }
.mk-coal .mk-cells i.on { background: #6b7079; }
.mk-iron .mk-cells i.on { background: #d06a35; }
.mk-price { white-space: nowrap; color: var(--muted); min-width: 46px; }
.mk-info { display: flex; align-items: center; justify-content: space-between; gap: 6px; color: var(--muted); }

.g-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; min-height: 40px; padding: 2px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; }
.act .act-ic { font-size: 15px; line-height: 1.1; }
.act:disabled { opacity: .4; cursor: default; }
.act.on { background: linear-gradient(180deg, var(--accent2), var(--accent)); color: #241004; border-color: transparent; }

.g-hand { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; }
.hc { position: relative; display: block; width: 100%; aspect-ratio: 403 / 551; padding: 0; overflow: hidden; border-radius: 8px; border: 2px solid rgba(255,255,255,.16); background: #1f1a16; color: var(--text); font: inherit; cursor: pointer; transition: transform 0.12s, outline-color 0.12s; }
.hc:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.38); }
.hc .hc-img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.hc .hc-name { position: absolute; inset: auto 0 0 0; padding: 10px 3px 3px; background: linear-gradient(180deg, transparent, rgba(10,8,6,.92) 45%); font-size: 9.5px; font-weight: 800; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 2px #000; pointer-events: none; }
.hc.wild { border-color: var(--gold); }
.hc.on { outline: 2.5px solid #ffd36b; border-color: #ffd36b; transform: translateY(-3px); box-shadow: 0 4px 14px rgba(255,211,107,.35); }
.hc.dim { opacity: .35; filter: grayscale(.35); }
.insp-tile { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; flex-shrink: 0; border: 1px solid rgba(255,255,255,.16); }
.insp-tile.dim { opacity: .32; filter: grayscale(.7); }
.opt-tile { width: 34px; height: 34px; border-radius: 5px; object-fit: cover; flex-shrink: 0; border: 1px solid rgba(255,255,255,.2); }
.card-preview { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.card-preview-img { width: min(190px, 46vw); aspect-ratio: 403 / 551; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.6); }

.g-flow { font-size: 12.5px; }
.flow-hint { margin: 2px 0; text-align: center; }
.flow { display: flex; flex-direction: column; gap: 5px; padding: 6px 8px; border-radius: 10px; border: 1px solid rgba(242,167,102,.5); background: rgba(224,137,74,.1); }
.flow-head { display: flex; justify-content: space-between; gap: 6px; flex-wrap: wrap; }
.flow-card { color: var(--gold); }
.flow-step { margin: 0; color: var(--muted); }
.flow-preview { padding: 5px 7px; border-radius: 8px; background: rgba(0,0,0,.25); }
.flow-preview.bad { color: #ffb4a8; }
.flow-btns { display: flex; gap: 6px; }
.flow-btns .btn { flex: 1; min-height: 38px; padding: 4px 8px; }
.opt-list { display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow-y: auto; }
.opt { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font: inherit; font-size: 12px; text-align: start; cursor: pointer; min-height: 40px; }
.opt.on { border-color: #ffd36b; background: rgba(255,211,107,.14); }
.opt small { color: var(--muted); }

/* ---------------- sheets, toasts ---------------- */
.sheet-backdrop { position: absolute; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(0,0,0,.55); }
.sheet { position: relative; width: min(640px, 100%); max-height: 86%; overflow-y: auto; padding: 14px 16px 16px; border-radius: 16px 16px 0 0; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 14px; }
.sheet-sm { width: min(420px, 94%); border-radius: 16px; margin-bottom: auto; margin-top: auto; }
.sheet-close { position: absolute; top: 8px; inset-inline-end: 10px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); color: var(--text); font-size: 20px; cursor: pointer; }
.sheet-title { margin: 0 0 10px; font-size: 17px; padding-inline-end: 40px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sheet-sub { margin: 12px 0 6px; font-size: 14px; color: var(--gold); }
.sheet p { margin: 6px 0; }
.row-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; }
.insp-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.insp-slot { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; background: var(--panel2); }
.insp-slot small { color: var(--muted); }
.insp-icons { display: flex; gap: 2px; padding: 4px; border-radius: 8px; background: rgba(255,255,255,.06); }
.insp-links { margin: 0; padding-inline-start: 18px; }
.log-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.log-list li { padding: 4px 6px; border-radius: 6px; background: rgba(255,255,255,.04); }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.toasts { position: absolute; top: calc(var(--top-h) + 6px); left: 50%; transform: translateX(-50%); z-index: 50; display: flex; flex-direction: column; gap: 6px; width: min(520px, 92%); pointer-events: none; }
.toast { pointer-events: auto; padding: 7px 12px; border-radius: 10px; background: rgba(36, 30, 25, 0.95); border: 1px solid var(--line); font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.5); cursor: pointer; text-align: center; }
.toast.warn { border-color: rgba(224,87,74,.7); color: #ffd2cc; }

/* ---------------- phone held upright during a game: the table turned 90° ---------------- */
body.g-rotated .app-root {
  position: fixed; top: 0; left: 0;
  width: var(--rot-w, 100vh);
  height: var(--rot-h, 100vw);
  transform-origin: top left;
  transform: translateX(var(--rot-h, 100vw)) rotate(90deg);
}
body.g-phone.in-game .app-root { zoom: var(--app-zoom, 1); }

/* ---------------- small landscape phones ---------------- */
body.g-tight { --top-h: 28px; }
body.g-tight .g-top { font-size: 11.5px; gap: 6px; }
body.g-tight .act { min-height: 34px; font-size: 10px; }
body.g-tight .act .act-ic { font-size: 13px; }
body.g-tight .hc .hc-name { font-size: 8.5px; padding-bottom: 2px; }
body.g-tight .pl { font-size: 10.5px; padding: 2px 5px; }
body.g-tight .sheet { padding: 10px 12px 12px; }
body.g-narrow .g-last, body.g-narrow .g-timebar { display: none; }
body.g-narrow .g-players { grid-template-columns: 1fr; }

/* ---------------- desktop and laptop windows ---------------- */
body.g-desktop { --top-h: 48px; }
body.g-desktop .g-screen { max-width: 1800px; margin: 0 auto; gap: 0 14px; padding: 0 14px 14px; }
body.g-desktop .g-top { font-size: 15px; gap: 12px; }
body.g-desktop .g-icon { width: 38px; height: 34px; font-size: 17px; }
body.g-desktop .g-timebar { width: 120px; }
body.g-desktop .g-boardwrap { padding-top: 10px; }
body.g-desktop .g-side { gap: 10px; padding-top: 10px; }
body.g-desktop .pl { font-size: 13.5px; padding: 6px 10px; }
body.g-desktop .g-markets { font-size: 13px; padding: 8px 10px; }
body.g-desktop .mk-cells i { height: 11px; }
body.g-desktop .act { min-height: 54px; font-size: 13px; }
body.g-desktop .act .act-ic { font-size: 20px; }
body.g-desktop .hc .hc-name { font-size: 11px; }
body.g-desktop .g-flow { font-size: 14px; }
body.g-desktop .opt-list { max-height: 300px; }
body.g-desktop .sheet-backdrop { align-items: center; }
body.g-desktop .sheet { border-radius: 16px; width: min(720px, 96%); }

/* ---------------- player mat & wide desktop side panel ---------------- */
.g-mat { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #14100d; cursor: pointer; flex-shrink: 0; }
.mat-svg { display: block; width: 100%; height: auto; user-select: none; }
.mat-tile, .mat-cnt { pointer-events: none; }
.mat-box { fill: transparent; stroke: rgba(0,0,0,.55); stroke-width: 2; }
.mat-box.mat-empty { fill: rgba(10, 8, 6, 0.56); stroke: rgba(255,255,255,.08); }
.mat-box.mat-next { stroke: #ffd36b; stroke-width: 4; }
.mat-box.mat-picked { stroke: #fff; stroke-width: 5; fill: rgba(255,211,107,.24); }
.mat-cnt rect { fill: rgba(12,10,8,.88); stroke: rgba(255,211,107,.75); stroke-width: 1.5; }
.mat-cnt text { font-size: 13px; font-weight: 900; fill: #ffe69a; }
.sheet-mat { margin: 8px 0 12px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }

body.g-wide-side .g-side { gap: 7px; }
body.g-wide-side .g-actions { grid-template-columns: repeat(7, 1fr); }
body.g-wide-side .act { min-height: 44px; font-size: 11.5px; }
body.g-wide-side .act .act-ic { font-size: 17px; }
body.g-wide-side .g-hand { grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; overflow: visible; }
body.g-wide-side .hc { transition: transform 0.14s, z-index 0s; }
body.g-wide-side .hc:hover { transform: translateY(-6px) scale(1.16); z-index: 6; }
body.g-wide-side .hc .hc-name { font-size: 9.5px; }

/* ---------------- flying & flipping card animations ---------------- */
.card-fx { position: absolute; inset: 0; pointer-events: none; z-index: 35; overflow: hidden; }
.fly-card { position: absolute; top: 0; left: 0; transform-origin: center center; perspective: 900px; will-change: transform, opacity; }
.fly-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; will-change: transform; }
.fly-face { position: absolute; inset: 0; border-radius: 8px; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 2px solid rgba(255,255,255,.32); box-shadow: 0 12px 28px rgba(0,0,0,.72); background: #1c1713; }
.fly-face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fly-back { transform: rotateY(0deg) translateZ(1px); }
.fly-front { transform: rotateY(180deg) translateZ(1px); }
.fly-card.wild .fly-face { border-color: var(--gold); box-shadow: 0 12px 30px rgba(242,196,90,.42), 0 8px 20px rgba(0,0,0,.68); }
.hc.hc-incoming { opacity: 0; pointer-events: none; }
.hc.hc-landed { animation: hc-land 240ms cubic-bezier(.22, 1, .36, 1); }
@keyframes hc-land { 0% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .card-fx { display: none; }
  .hc.hc-incoming { opacity: 1; pointer-events: auto; }
  .hc.hc-landed { animation: none; }
}
