/* Catan · BoardBazi. Phone first; body.desktop and body.phone-landscape adjust the layout. */
:root {
  --bg: #0c1a28;
  --bg2: #12263a;
  --panel: #172f47;
  --panel2: #1e3a56;
  --line: rgba(255, 255, 255, .1);
  --text: #f5ecd7;
  --muted: #a9b6c4;
  --gold: #f2b33d;
  --gold2: #d9901a;
  --blue: #2f7fd6;
  --danger: #d6463b;
  --ok: #4caf6a;
  --radius: 14px;
  --c-red: #d63b2f;
  --c-blue: #2f6fd6;
  --c-orange: #f08a24;
  --c-white: #f2f2f2;
  --c-green: #3a9a4a;
  --c-brown: #8a5a2b;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --vh: 1vh;
  font-family: "Vazirmatn", "Vazir", "IRANSans", Tahoma, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(120% 80% at 50% 0%, #17344f 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }

/* ---------- color helpers ---------- */
.c-red { --pc: var(--c-red); } .c-blue { --pc: var(--c-blue); } .c-orange { --pc: var(--c-orange); }
.c-white { --pc: var(--c-white); } .c-green { --pc: var(--c-green); } .c-brown { --pc: var(--c-brown); }
.c-text-red { color: #ff7b6e; } .c-text-blue { color: #7fb0ff; } .c-text-orange { color: #ffae5c; }
.c-text-white { color: #ffffff; } .c-text-green { color: #7fd38d; } .c-text-brown { color: #d9a46c; }
.dot { display: inline-block; width: 14px; height: 14px; border-radius: 50%; background: var(--pc, #888); box-shadow: 0 0 0 2px rgba(0,0,0,.35); flex: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 700; text-decoration: none; cursor: pointer; user-select: none;
  transition: transform .08s ease, filter .15s ease, opacity .15s;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-gold { background: linear-gradient(180deg, #ffd06b, var(--gold) 45%, var(--gold2)); color: #2b1a00; box-shadow: 0 3px 0 #9c6410, 0 6px 16px rgba(242, 179, 61, .25); }
.btn-blue { background: linear-gradient(180deg, #4b97ea, var(--blue)); color: #fff; box-shadow: 0 3px 0 #1d4f8a; }
.btn-ghost { background: rgba(255,255,255,.07); border-color: var(--line); color: var(--text); }
.btn-danger { background: rgba(214, 70, 59, .15); border-color: rgba(214,70,59,.5); color: #ff9c93; }
.btn-lg { min-height: 54px; font-size: 17px; }
.wide { width: 100%; }
.link-btn { background: none; border: 0; color: var(--muted); padding: 8px; cursor: pointer; font-weight: 600; }
.link-btn.danger { color: #ff8b80; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 22, 36, .75); color: var(--text); font-size: 18px; cursor: pointer; display: grid; place-items: center; flex: none; }
.row-btns { display: flex; gap: 10px; margin-top: 14px; }
.row-btns .btn { flex: 1; }

/* ---------- splash ---------- */
.splash { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; background: var(--bg); z-index: 100; }
.splash-icon { width: 72px; animation: bob 1.6s ease-in-out infinite; }
.splash-title { font-size: 34px; font-weight: 900; color: var(--gold); letter-spacing: .02em; }
.splash-bar { width: 180px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.1); overflow: hidden; }
.splash-fill { height: 100%; width: 0; background: var(--gold); transition: width .2s; }
@keyframes bob { 50% { transform: translateY(-8px); } }

/* ---------- generic screen bits ---------- */
.screen { min-height: 100%; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.panel h2, .panel h3 { margin: 0 0 10px; }
.panel h3 { font-size: 15px; color: var(--muted); font-weight: 700; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: calc(8px + var(--safe-t)) 12px 8px; background: rgba(12, 26, 40, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 900; color: var(--gold); font-size: 18px; }
.topbar-brand img { width: 26px; }
.topbar-actions { display: flex; gap: 4px; }
.topbar-title { font-weight: 700; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); margin: 14px 0; font-size: 13px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* ---------- intro ---------- */
#introScreen { display: flex; flex-direction: column; min-height: 100dvh; }
.intro-hero { position: relative; height: 46dvh; min-height: 260px; overflow: hidden; }
.intro-img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.intro-hero picture { display: block; height: 100%; }
.intro-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(12,26,40,0) 40%, var(--bg) 100%); }
.intro-body { position: relative; margin-top: -60px; padding: 0 20px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; max-width: 520px; width: 100%; margin-inline: auto; }
.brand { margin: 0; font-size: 46px; font-weight: 900; color: var(--gold); text-shadow: 0 4px 18px rgba(0,0,0,.6); line-height: 1.1; }
.tagline { margin: 0; font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 5px 12px; border-radius: 999px; background: rgba(255,255,255,.08); border: 1px solid var(--line); font-size: 13px; }
.cta { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.note { margin: 0; color: var(--muted); font-size: 13px; text-align: center; }
.dev-login { display: flex; gap: 8px; }
.dev-login input, .join-form input { flex: 1; min-width: 0; min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0,0,0,.25); }
.rules-box { border-radius: 12px; }
.rules-box summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.rules-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; color: #dfe6ee; font-size: 14px; }
.reference-img { display: block; width: 100%; max-width: 380px; margin: 12px auto 0; border-radius: 10px; }
.lang-btn { align-self: center; }

/* ---------- home ---------- */
.home-body, .lobby-body { max-width: 520px; margin: 0 auto; padding: 16px 16px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 14px; }
.home-hero { display: grid; place-items: center; }
.home-hero img { width: 170px; filter: drop-shadow(0 14px 24px rgba(0,0,0,.5)); }
.join-form { display: flex; gap: 8px; }
.join-form input { text-transform: uppercase; letter-spacing: .2em; font-weight: 800; text-align: center; }

/* ---------- lobby ---------- */
.code-panel { text-align: center; }
.big-code { font-size: 44px; font-weight: 900; letter-spacing: .25em; color: var(--gold); margin-bottom: 10px; }
.member-list { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.member { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.2); }
.member-name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.1); }
.tag.gold { background: rgba(242,179,61,.2); color: var(--gold); }
.tag.dim { opacity: .7; }
.color-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.swatch { aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent; background: rgba(0,0,0,.25); cursor: pointer; display: grid; place-items: center; padding: 4px; }
.swatch img { width: 80%; }
.swatch.on { border-color: var(--pc); box-shadow: 0 0 0 3px rgba(255,255,255,.08), 0 0 16px var(--pc); }
.swatch:disabled { opacity: .25; cursor: not-allowed; }
.seg { display: flex; gap: 6px; background: rgba(0,0,0,.25); border-radius: 12px; padding: 4px; }
.seg-btn { flex: 1; min-height: 40px; border-radius: 9px; border: 0; background: transparent; font-weight: 800; cursor: pointer; }
.seg-btn.on { background: var(--gold); color: #2b1a00; }
.seg-btn:disabled:not(.on) { opacity: .5; }
.sticky-cta { position: sticky; bottom: calc(12px + var(--safe-b)); }

/* ============================================================
   GAME (phone portrait by default)
   ============================================================ */
#gameScreen { height: 100dvh; overflow: hidden; }
.game {
  height: 100dvh;
  width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top" "board" "bottom";
}
.g-top { grid-area: top; display: flex; gap: 6px; align-items: stretch; padding: calc(6px + var(--safe-t)) 6px 6px; background: linear-gradient(180deg, rgba(8,18,30,.95), rgba(8,18,30,.6)); z-index: 3; }
.g-board { grid-area: board; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 50%, #2d7fb8 0%, #1b5d8f 45%, #103f66 100%); }
.g-side { grid-area: side; display: none; }
.g-bottom { grid-area: bottom; background: linear-gradient(0deg, rgba(8,18,30,.98), rgba(8,18,30,.9)); border-top: 1px solid var(--line); padding: 6px 8px calc(8px + var(--safe-b)); z-index: 3; position: relative; }

/* players strip */
.players-strip { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 5px; min-width: 0; }
.pchip { position: relative; min-width: 0; padding: 5px 6px 5px; border-radius: 11px; background: rgba(255,255,255,.06); border: 1px solid var(--line); border-top: 4px solid var(--pc); transition: background .2s, box-shadow .2s; }
.pchip.turn { background: rgba(242,179,61,.16); box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(242,179,61,.35); }
.pchip.waiting { box-shadow: 0 0 0 1px var(--pc); }
.pchip.me .pc-name::after { content: " •"; color: var(--gold); }
.pc-top { display: flex; align-items: center; gap: 3px; }
.pc-name { font-weight: 800; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.pc-state { font-size: 11px; }
.pc-stats { display: flex; flex-wrap: wrap; gap: 0 6px; font-size: 11.5px; color: #dbe4ee; direction: ltr; justify-content: flex-start; }
.pc-vp { color: var(--gold); font-weight: 900; }
.pc-badges { position: absolute; top: -6px; inset-inline-end: 2px; display: flex; gap: 2px; }
.pc-badges img { width: 18px; border-radius: 3px; box-shadow: 0 2px 4px rgba(0,0,0,.5); }
.pc-flag { position: absolute; bottom: 2px; inset-inline-end: 4px; font-size: 11px; color: #ff9c93; font-weight: 800; }
.pc-timer { font-size: 11px; color: var(--gold); font-weight: 800; height: 0; overflow: visible; }
.pc-timer:empty { display: none; }

/* board */
.board-svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; user-select: none; -webkit-user-select: none; }
.board-svg image { pointer-events: none; }
.hex-hit { fill: transparent; pointer-events: all; }
.token { pointer-events: none; }
.pier { stroke: #6b4a22; stroke-width: 9; stroke-linecap: round; stroke-dasharray: 3 5; filter: drop-shadow(0 2px 1px rgba(0,0,0,.4)); }
.harbor-badge circle { fill: #fbf3df; stroke: #6b4a22; stroke-width: 3; filter: drop-shadow(0 3px 3px rgba(0,0,0,.45)); }
.harbor-badge text { font-family: Georgia, serif; font-weight: 900; fill: #3b2a12; }
.hb-rate { font-size: 17px; }
.hb-q { font-size: 30px; fill: #1f5f9a !important; }
.token circle { stroke: #6b4f25; stroke-width: 2; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.token text { font-size: 28px; font-weight: 900; fill: #2a1d0b; font-family: Georgia, "Times New Roman", serif; }
.token .pips circle { fill: #2a1d0b; stroke: none; filter: none; }
.token.red text, .token.red .pips circle { fill: #c0271c; }
.token.hot > circle:first-child { stroke: var(--gold); stroke-width: 6; }
.token.robbed { opacity: .55; }
.token.pulse { animation: tokenPulse 1.2s ease-out 2; transform-box: fill-box; transform-origin: center; }
@keyframes tokenPulse { 30% { transform: scale(1.35); } }
.piece.fresh { animation: drop .45s cubic-bezier(.2, 1.6, .4, 1); transform-box: fill-box; transform-origin: center bottom; }
.road.fresh { animation: fadeIn .4s ease; }
@keyframes drop { from { opacity: 0; transform: translateY(-30px) scale(1.3); } }
@keyframes fadeIn { from { opacity: 0; } }
.spot-vertex .hit { fill: transparent; cursor: pointer; }
.spot-vertex .mark { fill: rgba(255,255,255,.85); stroke: var(--gold); stroke-width: 5; animation: spot 1.1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.spot-edge .hit { stroke: transparent; stroke-width: 44; stroke-linecap: round; cursor: pointer; }
.spot-edge .mark { stroke: rgba(255,255,255,.9); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 2 14; animation: dash .9s linear infinite; pointer-events: none; filter: drop-shadow(0 0 4px var(--gold)); }
.spot-hex { fill: rgba(242,179,61,.18); stroke: var(--gold); stroke-width: 5; stroke-dasharray: 14 10; cursor: pointer; animation: dash 1.2s linear infinite; }
.ghost { opacity: .85; animation: spot 1s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes spot { 50% { transform: scale(1.18); } }
@keyframes dash { to { stroke-dashoffset: -32; } }
.float-text { font-size: 30px; font-weight: 900; fill: #fff; stroke: #000; stroke-width: 1.5; paint-order: stroke; animation: floatUp 1.8s ease-out forwards; }
@keyframes floatUp { to { transform: translateY(-50px); opacity: 0; } }

.status-banner { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); z-index: 2; max-width: calc(100% - 110px); display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: rgba(8, 18, 30, .82); border: 1px solid var(--line); font-weight: 700; font-size: 14px; backdrop-filter: blur(6px); box-shadow: 0 6px 18px rgba(0,0,0,.35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-banner.mine { background: linear-gradient(180deg, rgba(60,40,5,.92), rgba(40,26,2,.92)); border-color: var(--gold); color: #ffe2a3; }
.sb-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--pc); flex: none; }
.sb-timer { color: var(--gold); font-variant-numeric: tabular-nums; }
.sb-timer:empty { display: none; }
.dice-box { position: absolute; top: 52px; inset-inline-start: 8px; z-index: 2; display: flex; align-items: center; gap: 4px; }
.dice-box img { width: 38px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
.dice-sum { font-weight: 900; font-size: 18px; color: #fff; text-shadow: 0 2px 4px #000; margin-inline-start: 2px; }
.dice-box.rolling img { animation: roll .7s cubic-bezier(.3,1.4,.5,1); }
.dice-box.rolling img:nth-child(2) { animation-delay: .08s; }
@keyframes roll { 0% { transform: rotate(-200deg) scale(.4) translateY(-30px); opacity: 0; } }
.zoom-ctrls { position: absolute; bottom: 10px; inset-inline-end: 8px; z-index: 2; display: flex; flex-direction: column; gap: 6px; }
.confirm-bar { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 4; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 16px; background: rgba(8,18,30,.92); border: 1px solid var(--gold); box-shadow: 0 10px 28px rgba(0,0,0,.5); white-space: nowrap; }
[dir="rtl"] .confirm-bar { padding: 6px 14px 6px 6px; }
.confirm-bar .btn { min-height: 40px; padding: 6px 14px; }
.confirm-bar.only-cancel > span { display: none; }
.toast-stack { position: absolute; top: 50px; left: 50%; transform: translateX(-50%); z-index: 5; display: grid; gap: 6px; width: min(92%, 420px); pointer-events: none; }
.toast { padding: 8px 14px; border-radius: 12px; background: rgba(8,18,30,.9); border: 1px solid var(--line); font-size: 13.5px; text-align: center; box-shadow: 0 6px 18px rgba(0,0,0,.4); animation: toastIn .25s ease; transition: opacity .4s, transform .4s; }
.toast.gain { border-color: var(--ok); color: #c9f2d3; font-weight: 800; }
.toast.error { border-color: var(--danger); color: #ffc2bd; }
.toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } }

/* bottom: timer, hand, actions */
.timer-bar { position: absolute; top: -3px; left: 0; right: 0; height: 3px; background: transparent; opacity: 0; }
.timer-bar.on { opacity: 1; }
.timer-fill { height: 100%; background: var(--gold); transition: width .25s linear; margin-inline-start: 0; }
.timer-bar.urgent .timer-fill { background: var(--danger); }
.hand { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; margin-bottom: 6px; }
.rcard { position: relative; border-radius: 8px; overflow: visible; background: none; border: 0; padding: 0; cursor: default; }
.rcard img { display: block; width: 100%; aspect-ratio: 270 / 420; object-fit: cover; border-radius: 7px; box-shadow: 0 3px 8px rgba(0,0,0,.5); max-height: 74px; }
.rcard.empty img { filter: grayscale(.9) brightness(.45); }
.rcard.devstack { cursor: pointer; }
.rcount { position: absolute; bottom: -4px; inset-inline-end: -3px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px; background: #0b1622; border: 2px solid var(--gold); color: #fff; font-weight: 900; font-size: 13px; display: grid; place-items: center; }
.rcard.empty .rcount { border-color: #3a4a5a; color: var(--muted); }
.actions { display: flex; gap: 6px; }
.actions .btn { flex: 1 1 0; min-width: 0; padding: 8px 4px; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.actions .btn-roll { flex: 3; font-size: 17px; }
.actions .mobile-only { flex: 0 0 48px; }

/* side panel (desktop) */
.side-section { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.side-section h4 { margin: 0 0 8px; color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .05em; }
.bank-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.bank-card { position: relative; }
.bank-card img { width: 100%; aspect-ratio: 270/420; object-fit: cover; border-radius: 5px; display: block; }
.bank-card span { position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); background: rgba(0,0,0,.75); border-radius: 6px; padding: 0 5px; font-size: 12px; font-weight: 800; }
.side-log { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13.5px; overflow-y: auto; align-content: start; }
.log-list li { padding: 6px 10px; border-radius: 9px; background: rgba(255,255,255,.04); }
.log-list li.log-roll { background: rgba(242,179,61,.08); }
.log-list li.log-award, .log-list li.log-game_over { background: rgba(76,175,106,.14); }
.who { font-weight: 800; }

/* ---------- sheets ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40; animation: fadeIn .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 86dvh; display: flex; flex-direction: column; background: var(--bg2); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; box-shadow: 0 -16px 40px rgba(0,0,0,.5); padding: 0 14px calc(14px + var(--safe-b)); transform: translateY(100%); transition: transform .25s cubic-bezier(.2,.9,.3,1); }
.sheet.open { transform: none; }
.sheet-grip { width: 42px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.2); margin: 8px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0 10px; }
.sheet-head h3 { margin: 0; font-size: 17px; }
.sheet-body { overflow-y: auto; padding-bottom: 4px; }
.sheet-body > .log-list { max-height: 60dvh; }

.build-list { display: grid; gap: 8px; }
.build-row { display: grid; grid-template-columns: 52px 1fr auto; grid-template-areas: "icon name cost" "icon why why"; align-items: center; gap: 2px 12px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; text-align: start; }
.build-row:disabled { opacity: .5; cursor: not-allowed; }
.build-row:not(:disabled):hover { border-color: var(--gold); }
.build-icon { grid-area: icon; width: 46px; height: 46px; object-fit: contain; }
.build-icon.road { transform: rotate(60deg); }
.build-name { grid-area: name; font-weight: 800; display: flex; flex-direction: column; }
.build-name small { color: var(--muted); font-weight: 600; }
.build-cost { grid-area: cost; display: flex; gap: 2px; }
.build-why { grid-area: why; font-size: 12px; color: #ff9c93; }
.mini-res { width: 20px; height: 30px; object-fit: cover; border-radius: 3px; box-shadow: 0 1px 3px rgba(0,0,0,.5); vertical-align: middle; }

.tabs { display: flex; gap: 6px; background: rgba(0,0,0,.25); padding: 4px; border-radius: 12px; margin-bottom: 12px; }
.tab { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: transparent; font-weight: 800; cursor: pointer; }
.tab.on { background: var(--panel2); box-shadow: inset 0 0 0 1px var(--line); }
.res-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
.res-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; border: 2px solid transparent; background: rgba(255,255,255,.05); cursor: pointer; font-size: 12px; font-weight: 700; }
.res-pick img { width: 100%; max-width: 46px; aspect-ratio: 270/420; object-fit: cover; border-radius: 5px; }
.res-pick small { color: var(--muted); font-weight: 600; font-size: 11px; }
.res-pick.on { border-color: var(--gold); background: rgba(242,179,61,.12); }
.res-pick:disabled { opacity: .35; cursor: not-allowed; }
.counter-block { margin-bottom: 10px; }
.counter-label { font-weight: 800; color: var(--muted); margin: 4px 0 6px; font-size: 13px; }
.counters { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.counter { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 2px; border-radius: 12px; background: rgba(255,255,255,.04); border: 2px solid transparent; }
.counter.on { border-color: var(--gold); }
.counter img { width: 100%; max-width: 42px; aspect-ratio: 270/420; object-fit: cover; border-radius: 5px; }
.counter-ctrl { display: flex; align-items: center; gap: 1px; direction: ltr; }
.counter-ctrl button { width: 24px; height: 28px; padding: 0; flex: none; border-radius: 8px; border: 0; background: rgba(255,255,255,.1); font-weight: 900; cursor: pointer; }
.counter-ctrl button:disabled { opacity: .3; }
.counter-ctrl span { min-width: 12px; text-align: center; font-weight: 900; }

.dev-list { display: grid; gap: 10px; margin-bottom: 12px; }
.dev-card { position: relative; display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 8px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); }
.dev-card > img { width: 64px; border-radius: 6px; box-shadow: 0 3px 8px rgba(0,0,0,.4); }
.dev-info { display: flex; flex-direction: column; }
.dev-info small { color: var(--muted); }
.dev-count { position: absolute; top: 4px; inset-inline-start: 50px; background: var(--gold); color: #2b1a00; font-weight: 900; font-size: 12px; border-radius: 8px; padding: 0 6px; }
.dev-new { position: absolute; bottom: 6px; inset-inline-start: 6px; background: var(--blue); font-size: 10px; border-radius: 6px; padding: 0 5px; font-weight: 800; }

.victims { display: grid; gap: 8px; }
.victim { display: flex; align-items: center; gap: 10px; min-height: 54px; padding: 8px 14px; border-radius: 14px; border: 2px solid var(--pc); background: var(--panel); cursor: pointer; font-size: 16px; }
.victim b { flex: 1; text-align: start; }

.offer { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; margin: 4px 0 12px; }
.offer-arrow { font-size: 24px; color: var(--gold); }
.offer-side { background: var(--panel); border-radius: 14px; padding: 8px; border: 1px solid var(--line); }
.offer-cards { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.offer-card { position: relative; width: 44px; }
.offer-card img { width: 100%; border-radius: 5px; display: block; }
.offer-card span { position: absolute; bottom: -4px; inset-inline-end: -4px; background: #0b1622; border: 2px solid var(--gold); border-radius: 9px; padding: 0 4px; font-size: 12px; font-weight: 900; }
.resp-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.resp { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--panel); flex-wrap: wrap; }
.resp b { flex: 1; }
.resp-accept { box-shadow: inset 0 0 0 2px var(--ok); }
.resp-reject { opacity: .6; }
.menu-list { display: grid; gap: 10px; }

/* ---------- game over ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(4,10,18,.7); backdrop-filter: blur(4px); animation: fadeIn .3s; }
.overlay-card { width: min(440px, 100%); background: var(--bg2); border: 1px solid var(--gold); border-radius: 20px; padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.6); text-align: center; animation: drop .5s cubic-bezier(.2, 1.4, .4, 1); }
.overlay-card h2 { margin: 0 0 6px; color: var(--gold); font-size: 26px; }
.final-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; text-align: start; }
.final-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--panel); }
.final-list li.win { box-shadow: inset 0 0 0 2px var(--gold); background: rgba(242,179,61,.12); }
.final-list b { flex: 1; }
.rank { width: 24px; height: 24px; border-radius: 50%; background: rgba(255,255,255,.1); display: grid; place-items: center; font-weight: 900; font-size: 13px; }
.final-vp { font-weight: 900; color: var(--gold); }
.final-badges { font-size: 13px; }

.conn-badge { position: fixed; bottom: calc(150px + var(--safe-b)); left: 50%; transform: translateX(-50%); z-index: 60; padding: 6px 14px; border-radius: 999px; background: var(--danger); font-weight: 700; font-size: 13px; }

/* ============================================================
   PHONE LANDSCAPE: board on one side, controls on the other
   ============================================================ */
body.phone-landscape .game {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 38%);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas: "board top" "board bottom";
}
body.phone-landscape .g-top { padding: 6px; }
body.phone-landscape .players-strip { grid-auto-flow: row; grid-template-columns: 1fr 1fr; grid-auto-columns: auto; }
body.phone-landscape .g-bottom { border-top: 0; display: flex; flex-direction: column; justify-content: flex-end; }
body.phone-landscape .hand { grid-template-columns: repeat(6, minmax(0, 1fr)); }
body.phone-landscape .actions { flex-wrap: wrap; }
body.phone-landscape .actions .btn { flex: 1 1 40%; }
body.phone-landscape .sheet { left: auto; width: min(460px, 60vw); right: 0; }

/* ============================================================
   DESKTOP: big board in the middle, info and log on the side
   ============================================================ */
body.desktop .home-body, body.desktop .lobby-body { max-width: 560px; padding-top: 32px; }
body.desktop .intro-hero { height: 58vh; }
body.desktop .game {
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas: "top side" "board side" "bottom side";
  max-width: 1600px;
  margin: 0 auto;
}
body.desktop .g-top { padding: 10px 12px; }
body.desktop .players-strip { gap: 10px; }
body.desktop .pchip { padding: 8px 10px; }
body.desktop .pc-name { font-size: 15px; }
body.desktop .pc-stats { font-size: 13px; gap: 0 10px; }
body.desktop .pc-badges img { width: 24px; }
body.desktop .g-board { border-radius: 18px; margin: 0 12px; }
body.desktop .g-side { display: flex; flex-direction: column; gap: 12px; padding: 12px 12px 12px 0; min-height: 0; }
[dir="rtl"] body.desktop .g-side, body.desktop[dir="rtl"] .g-side { padding: 12px 0 12px 12px; }
body.desktop .g-bottom { display: grid; grid-template-columns: minmax(0, 420px) 1fr; gap: 14px; align-items: center; padding: 10px 16px 14px; background: none; border-top: 0; }
body.desktop .hand { margin: 0; }
body.desktop .rcard img { max-height: 96px; }
body.desktop .actions .btn { min-height: 50px; font-size: 15px; }
body.desktop .mobile-only { display: none; }
body.desktop .sheet { left: 50%; right: auto; bottom: 50%; width: 480px; max-height: 80vh; border-radius: 20px; border: 1px solid var(--line); transform: translate(-50%, 60%); opacity: 0; transition: transform .2s, opacity .2s; padding-bottom: 16px; }
body.desktop .sheet.open { transform: translate(-50%, 50%); opacity: 1; }
body.desktop .sheet-grip { display: none; }
body.desktop .status-banner { font-size: 16px; top: 14px; }
body.desktop .dice-box img { width: 52px; }
body.desktop .dice-box { top: 16px; inset-inline-start: 16px; }
body.desktop .conn-badge { bottom: 30px; }
body:not(.desktop) .side-bank .reference-img { display: none; }

@media (max-width: 360px) {
  .pc-stats span:nth-child(n+4) { display: none; }
  .actions .btn { font-size: 12.5px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
