/* NovaCraft Play — Card Games */
:root { --bg: #070a14; --panel: rgba(16,24,48,0.88); --line: rgba(120,170,255,0.22); --ink: #eaf1ff; --soft: #a3b3d6; --blue: #2b9bff; --cyan: #2fd3ff; --violet: #7b5cff; --gold: #f5c04a; --red: #ff6b7d;
  --head: 'Orbitron', 'Segoe UI', system-ui, sans-serif; --body: 'Exo 2', 'Segoe UI', system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--body); -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#table { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
h1 { font: 800 clamp(26px, 5vw, 40px) var(--head); letter-spacing: 0.03em; }
h2 { font: 800 24px var(--head); letter-spacing: 0.02em; }
.kicker { font: 600 12px var(--head); letter-spacing: 0.24em; text-transform: uppercase; color: var(--cyan); }

button, a.back { font: 700 17px var(--body); letter-spacing: 0.02em; color: #fff; background: linear-gradient(180deg, #2c9cff, #136ef0); border: 0; border-radius: 12px; padding: 13px 18px; cursor: pointer; text-decoration: none; text-align: center;
  box-shadow: 0 6px 18px rgba(19,110,240,0.3); outline: none; transition: transform .1s, filter .1s; }
button:hover { filter: brightness(1.08); }
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.55; cursor: default; filter: grayscale(0.4); }
button.ghost { background: rgba(255,255,255,0.08); color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
:focus-visible, .pad-focus { outline: 3px solid var(--cyan) !important; outline-offset: 3px; }

/* ---------- screens (lobby, how to, leaderboards) ---------- */
.screen { position: fixed; inset: 0; z-index: 10; overflow-y: auto; display: flex; justify-content: center; padding: calc(18px + var(--safe-t)) 16px calc(24px + var(--safe-b));
  background: radial-gradient(ellipse at 50% 30%, rgba(7,10,20,0.35), rgba(7,10,20,0.85)); }
.page { width: min(980px, 100%); display: flex; flex-direction: column; gap: 18px; }
.page.narrow { width: min(720px, 100%); }
.page-head { display: flex; align-items: center; gap: 14px; }
.page-head > div:nth-child(2) { flex: 1; }
.back { width: 50px; height: 50px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-size: 22px; background: rgba(255,255,255,0.08) !important; color: var(--ink) !important; box-shadow: inset 0 0 0 1.5px var(--line) !important; }
.lead { margin: 0; color: var(--soft); font-size: 18px; }
.note { margin: 0; color: var(--soft); font-size: 14px; text-align: center; }
.panel { background: var(--panel); border-radius: 18px; padding: 22px; box-shadow: inset 0 0 0 1px var(--line), 0 20px 50px rgba(0,0,0,0.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.game-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.game-tile { background: var(--panel); border-radius: 18px; padding: 20px; display: flex; flex-direction: column; gap: 10px; box-shadow: inset 0 0 0 1px var(--line); backdrop-filter: blur(8px); }
.game-tile .gt-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.game-tile h3 { font: 800 22px var(--head); }
.gt-stats { font-size: 13px; color: var(--gold); white-space: nowrap; }
.game-tile p { margin: 0; color: var(--soft); flex: 1; }
.gt-btns { display: flex; gap: 10px; }
.gt-btns button { flex: 1; }
.game-tile.soon { opacity: 0.8; background: rgba(16,24,48,0.6); }
.game-tile.soon h3 { font-size: 16px; color: var(--soft); }
.lobby-foot { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.lobby-foot button { min-width: 200px; }
.rules { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 10px; font-size: 17px; line-height: 1.5; }
.rules b { color: var(--cyan); }
#howto-play { align-self: center; min-width: 240px; }
.tabs { display: flex; gap: 8px; background: rgba(255,255,255,0.06); padding: 6px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); align-self: flex-start; }
.tabs button { background: transparent; box-shadow: none; padding: 10px 16px; font-size: 16px; }
.tabs button.on { background: linear-gradient(180deg, #2c9cff, #136ef0); }
.board-body { min-height: 200px; padding: 8px; }
.board-msg { text-align: center; padding: 34px 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; color: var(--soft); }
.board-msg b { color: var(--ink); font-size: 19px; }
.board-table { width: 100%; border-collapse: collapse; font-size: 16px; }
.board-table th { text-align: left; font: 600 12px var(--head); letter-spacing: 0.12em; text-transform: uppercase; color: var(--soft); padding: 10px 12px; }
.board-table td { padding: 10px 12px; border-top: 1px solid var(--line); }
.board-table .num { text-align: right; width: 90px; }
.board-table td.pl { width: 50px; font: 800 16px var(--head); color: var(--cyan); }
.board-table td.sc { font-weight: 700; color: var(--gold); }
.board-table tr.you td { background: rgba(43,155,255,0.14); }
.board-foot { padding: 12px; font-size: 14px; color: var(--soft); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }

/* ---------- in-game HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.hud-top { position: absolute; top: calc(10px + var(--safe-t)); left: 12px; right: 12px; display: flex; align-items: center; gap: 12px; pointer-events: auto; }
.icon-btn { width: 46px; height: 46px; padding: 0; border-radius: 50%; font-size: 18px; background: rgba(16,24,48,0.8); box-shadow: inset 0 0 0 1px var(--line); }
.hud-title { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; min-width: 0; }
.hud-title b { font: 800 16px var(--head); letter-spacing: 0.06em; text-shadow: 0 2px 8px rgba(0,0,0,0.6); }
#info { font-size: 14px; background: rgba(16,24,48,0.82); padding: 5px 12px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); }
#info .s-H, #info .s-D { color: var(--red); }
#info .s-S, #info .s-C { color: #fff; }
.hud-top [data-account-slot] { color: var(--ink); }
.seat { position: absolute; transform: translate(-50%, -50%); background: rgba(10,16,34,0.82); border-radius: 12px; padding: 6px 12px; text-align: center; box-shadow: inset 0 0 0 1px var(--line); min-width: 92px; transition: box-shadow .2s, background .2s; }
.seat b { display: block; font-size: 15px; }
.seat span { display: block; font-size: 12.5px; color: var(--soft); }
.seat.active { background: rgba(19,110,240,0.9); box-shadow: 0 0 0 2px var(--cyan), 0 0 22px rgba(47,211,255,0.55); }
.seat.active span { color: #e3f1ff; }
#seat-0 { left: 76px; bottom: calc(18px + var(--safe-b)); top: auto !important; transform: none; }
.hud-bottom { position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(560px, 92vw); }
#prompt { font: 700 17px var(--body); background: rgba(10,16,34,0.85); padding: 9px 18px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); text-align: center; }
#prompt.mine { background: rgba(19,110,240,0.92); box-shadow: 0 0 0 2px var(--cyan); }
#act-btn { pointer-events: auto; min-width: 220px; }
#act-hint { font-size: 12.5px; color: var(--soft); text-shadow: 0 1px 4px #000; text-align: center; }
.toast { position: fixed; left: 50%; top: calc(86px + var(--safe-t)); transform: translate(-50%, -10px); z-index: 30; background: linear-gradient(90deg, var(--violet), var(--blue)); color: #fff; font-weight: 600; padding: 10px 18px; border-radius: 999px; box-shadow: 0 10px 30px rgba(0,0,0,0.4); opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; max-width: 92vw; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4,7,16,0.55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.panel.small { width: min(420px, 100%); display: flex; flex-direction: column; gap: 10px; text-align: center; max-height: calc(100vh - 32px); overflow-y: auto; }
.panel.small h2 { margin-bottom: 6px; }
#rules-body .rules { text-align: left; font-size: 15px; }
.suits { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.suits button { display: flex; flex-direction: column; align-items: center; gap: 4px; background: #fbfaf6; color: #15192b; box-shadow: 0 6px 16px rgba(0,0,0,0.3); padding: 14px 10px; }
.suits button i { font-style: normal; font-size: 40px; line-height: 1; }
.suits button.red { color: #c8102e; }
#res-text { margin: 0; color: var(--soft); }
.res-rows { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.res-row { display: flex; justify-content: space-between; padding: 9px 12px; border-radius: 10px; background: rgba(255,255,255,0.05); }
.res-row.you { box-shadow: inset 0 0 0 1.5px var(--blue); }
.res-row.win b { color: var(--gold); }
.res-board { display: flex; flex-direction: column; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(123,92,255,0.16); font-size: 15px; }
.res-board button { padding: 9px 16px; font-size: 15px; }
#res-final { display: flex; flex-direction: column; gap: 10px; }

@media (max-width: 820px) {
  .game-list { grid-template-columns: 1fr; }
  .seat { min-width: 76px; padding: 5px 9px; }
  .seat b { font-size: 13px; } .seat span { font-size: 11.5px; }
  #seat-0 { left: 12px; bottom: auto !important; top: calc(66px + var(--safe-t)) !important; }
  .hud-title b { font-size: 13px; }
  #info { font-size: 12.5px; }
  .hud-top [data-account-slot] { display: none; }
  #prompt { font-size: 15px; }
}

/* ---------- v2: action buttons, choice window, teams ---------- */
#actions { display: flex; gap: 10px; pointer-events: auto; flex-wrap: wrap; justify-content: center; }
#actions:empty { display: none; }
#actions button { min-width: 150px; }
#choice-text { margin: 0; color: var(--soft); }
#choice-text b { color: var(--ink); }
.choice-opts { display: grid; gap: 8px; }
.choice-opts button { padding: 12px 8px; font-size: 16px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.choice-opts button small { font-size: 12px; font-weight: 400; opacity: 0.85; }
.choice-opts button.suit-btn { background: #fbfaf6; color: #15192b; font-size: 20px; }
.choice-opts button.suit-btn.red { color: #c8102e; }
.choice-opts button.wide { grid-column: 1 / -1; }
.seat.team-a { box-shadow: inset 0 0 0 1.5px #2b9bff; }
.seat.team-b { box-shadow: inset 0 0 0 1.5px #ff9f43; }
.seat.team-a.active, .seat.team-b.active { box-shadow: 0 0 0 2px var(--cyan), 0 0 22px rgba(47,211,255,0.55); }
.res-row.sub { background: transparent; padding: 3px 12px; font-size: 14px; color: var(--soft); }
.res-row.sub b { color: var(--soft); font-weight: 600; }
.peg-legend { display: inline-flex; gap: 6px; align-items: center; }
.peg-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.game-list { grid-template-columns: repeat(3, 1fr); }
.tabs { flex-wrap: wrap; }
@media (max-width: 820px) { .tabs button { padding: 8px 11px; font-size: 14px; } }
@media (max-width: 820px) { .game-list { grid-template-columns: 1fr; } }
@media (min-width: 821px) and (max-width: 1050px) { .game-list { grid-template-columns: repeat(2, 1fr); } }
