/* The Gang — page furniture from the Lost Cities styles (heist night: deep purple and neon gold); the table at the end. */
:root {
  --felt-glow: #4a3a8a; /* the glow at the top of the home page */
  --sheet: #1a1530; /* pop-up window background */
  --felt: #241c44;
  --felt-dark: #0d0a1c;
  --gold: #f5b700;
  --gold-deep: #c98a00;
  --ink: #1d1d1f;
  --paper: #fffdf6;
  --panel: rgba(14, 10, 32, 0.86);
  --text: #f4f1e8;
  --muted: #bdb6d8;
  --cw: 70px;
  --ch: 100px;
  --pw: 64px;
  --ph: 92px;
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

input { -webkit-user-select: text; user-select: text; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- shared bits ---------- */
#home, #lobby {
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: radial-gradient(ellipse at 50% 20%, var(--felt-glow) 0%, var(--felt) 40%, var(--felt-dark) 100%);
}
.home-wrap { max-width: 560px; margin: 0 auto; padding: 24px 16px 48px; }
.brand { text-align: center; margin: 8px 0 20px; }
.brand h1 { font-family: Georgia, "Times New Roman", serif; font-size: 44px; margin: 8px 0 0; letter-spacing: 1px; text-shadow: 0 3px 0 rgba(0,0,0,.3); }

.panel { background: var(--panel); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 16px; margin: 14px 0; box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.panel h2 { margin: 0 0 8px; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.field { display: block; margin: 8px 0 4px; }
.field span { display: block; font-size: 14px; color: var(--muted); margin-bottom: 4px; }
.field input { width: 100%; font-size: 20px; padding: 12px 14px; border-radius: 12px; border: 2px solid rgba(255,255,255,.15); background: rgba(0,0,0,.3); color: var(--text); outline: none; }
.row { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }

.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-size: 17px; font-weight: 700; background: rgba(255,255,255,.12); }
.btn.gold:disabled { filter: grayscale(.8); opacity: .6; }
.btn.ghost { background: transparent; border: 2px solid rgba(255,255,255,.25); }
.btn.danger { background: #a3242f; }
.btn.small { padding: 8px 12px; font-size: 15px; }
.linkish { display: block; margin: 16px auto 0; background: none; border: 0; color: var(--gold); text-decoration: underline; font-size: 15px; }

.count-picker { display: flex; gap: 8px; margin: 8px 0 14px; }
.count-picker button { flex: 1; font-size: 22px; font-weight: 700; padding: 10px 0; border-radius: 12px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.25); }
.count-picker button.on { border-color: var(--gold); background: rgba(245,183,0,.2); color: var(--gold); }

.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #4be08c; box-shadow: 0 0 8px #4be08c; animation: pulse 1.6s infinite; }
.game-list { display: flex; flex-direction: column; gap: 8px; }
.game-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.game-item .code { font-family: ui-monospace, Menlo, Consolas, monospace; background: rgba(0,0,0,.35); padding: 2px 6px; border-radius: 6px; font-size: 13px; margin-left: 6px; }

.code-row { display: flex; align-items: baseline; justify-content: space-between; }
.code-row strong { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 30px; color: var(--gold); letter-spacing: 4px; }
.seat-list { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-direction: column; gap: 8px; }
.seat-list li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,.06); }
.seat-list li.empty { opacity: .5; border: 2px dashed rgba(255,255,255,.2); background: transparent; }
.seat-list .tag { font-size: 12px; color: var(--muted); }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 18px; border: 2px solid rgba(255,255,255,.9); box-shadow: 0 2px 6px rgba(0,0,0,.4); flex: none; text-shadow: 0 1px 2px rgba(0,0,0,.4); }

/* ---------- table ---------- */
#table { overflow: hidden; touch-action: none; }
.felt {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.10), transparent 60%),
    repeating-radial-gradient(circle at 30% 30%, rgba(0,0,0,.025) 0 2px, transparent 2px 4px),
    radial-gradient(ellipse at 50% 40%, #3a2c6a 0%, var(--felt) 45%, var(--felt-dark) 100%);
}
.topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 6px calc(10px + var(--safe-r)) 0 calc(10px + var(--safe-l)); z-index: 5; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.round-info { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; text-shadow: 0 1px 2px rgba(0,0,0,.5); }
.top-buttons { display: flex; gap: 6px; }
.icon-btn { height: 34px; min-width: 34px; padding: 0 8px; border-radius: 10px; border: 0; background: rgba(0,0,0,.35); font-size: 16px; display: flex; align-items: center; gap: 4px; }
.icon-btn span { font-size: 13px; font-weight: 700; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* ---------- overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 12px; animation: fade .2s ease-out; }
.sheet.narrow { width: 420px; }
.sheet.wide { width: 900px; }
.sheet h2 { margin: 0 0 10px; font-family: Georgia, serif; }
.sheet .btn { margin-top: 8px; }
.sheet .btn.ghost, .sheet .btn.danger { width: 100%; }
.toggle { display: flex; gap: 10px; align-items: center; font-size: 15px; margin: 8px 0; }
.toggle input { width: 22px; height: 22px; }
.rules h3 { color: var(--text); margin: 0 0 4px; font-size: 15px; }
.rules p { margin: 4px 0; }
.claim-list { display: flex; flex-direction: column; gap: 8px; }
.claim-list button { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; border: 0; background: rgba(255,255,255,.08); font-size: 17px; font-weight: 700; text-align: left; }

.score-table-wrap { overflow-x: auto; }
table.scores { border-collapse: collapse; width: 100%; font-size: 14px; }
table.scores th, table.scores td { padding: 5px 8px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.08); white-space: nowrap; }
table.scores th { font-size: 13px; }
table.scores td.rd { color: var(--muted); text-align: left; }
table.scores tr.current td { background: rgba(245,183,0,.12); }
table.scores tr.total td { font-weight: 900; font-size: 16px; border-top: 2px solid rgba(255,255,255,.3); }
table.scores td.zero { color: #4be08c; font-weight: 800; }
table.scores td.leader { color: var(--gold); }
table.scores .th-name { display: inline-flex; align-items: center; gap: 4px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.result-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: rgba(255,255,255,.05); margin-bottom: 6px; }
.result-row.out { background: rgba(245,183,0,.15); border: 1px solid rgba(245,183,0,.5); }
.result-row .who { width: 110px; flex: none; display: flex; align-items: center; gap: 6px; font-weight: 700; }
.result-row .who .avatar { width: 28px; height: 28px; font-size: 13px; }
.result-row .cards { flex: 1; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.result-row .left { display: flex; gap: 3px; padding: 3px; border-radius: 6px; background: rgba(214,40,58,.25); outline: 1px dashed rgba(255,120,120,.6); }
.result-row .pts { width: 70px; text-align: right; font-weight: 900; font-size: 18px; }
.result-row .pts small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.winner-banner { text-align: center; font-size: 22px; margin: 4px 0 12px; }
.winner-banner .big { font-size: 48px; display: block; animation: float 1.4s ease-in-out infinite; }

/* go-out show */
.goout { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: radial-gradient(circle, rgba(245,183,0,.35), rgba(0,0,0,.85) 70%); animation: fade .25s ease-out; }
.goout canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.goout-inner { position: relative; text-align: center; }
.goout-crown { font-size: 22vh; line-height: 1; animation: crownDrop .9s cubic-bezier(.2,1.6,.4,1) both, float 1.6s ease-in-out .9s infinite; filter: drop-shadow(0 0 30px rgba(245,183,0,.9)); }
.goout-name { font-family: Georgia, serif; font-size: 11vh; font-weight: 900; color: #fff; text-shadow: 0 0 20px var(--gold), 0 4px 0 #8a5d00; animation: zoomIn .6s .3s cubic-bezier(.2,1.6,.4,1) both; }
.goout-sub { font-size: 7vh; font-weight: 900; letter-spacing: 6px; color: var(--gold); text-shadow: 0 3px 0 #5a3d00; animation: zoomIn .6s .55s cubic-bezier(.2,1.6,.4,1) both; }
.goout-note { margin-top: 10px; font-size: 3.2vh; color: #fff; opacity: .9; animation: fade .6s 1s both; }
.goout.shake { animation: shake .5s ease-in-out; }

.rotate { display: none; }
@media (orientation: portrait) {
  body.in-game .rotate { display: flex; position: fixed; inset: 0; z-index: 100; flex-direction: column; align-items: center; justify-content: center; background: var(--felt-dark); font-size: 20px; text-align: center; padding: 24px; }
  .rotate-phone { font-size: 80px; animation: turn 2s ease-in-out infinite; }
}

.toast { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 90; background: #222; color: #fff; padding: 10px 16px; border-radius: 12px; font-weight: 700; box-shadow: 0 8px 20px rgba(0,0,0,.5); animation: rise .2s ease-out; max-width: 90vw; }

.your-turn-flash { position: absolute; inset: 0; z-index: 25; pointer-events: none; box-shadow: inset 0 0 60px 10px rgba(245,183,0,.7); animation: fadeOut 1.2s ease-out forwards; }

@keyframes glow { 0%,100% { box-shadow: 0 0 0 3px var(--gold), 0 0 10px 3px rgba(245,183,0,.6); } 50% { box-shadow: 0 0 0 3px var(--gold), 0 0 22px 8px rgba(245,183,0,.95); } }
@keyframes bob { 0%,100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, -4px); } }

.back-link { display: inline-block; text-decoration: none; font-weight: 700; font-size: 15px; padding: 4px 0; }
.back-link:active { color: var(--gold); }
.linkbtn { display: block; text-align: center; text-decoration: none; box-sizing: border-box; margin-top: 8px; }

/* Shell pieces copied from ud.css: the history list, its delete button (🗑), the lobby's bot rows, confetti */
.celebrate { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 70; pointer-events: none; }
/* game history */
#historyBtn { margin-top: 4px; }
.win-tally { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.win-chip b { color: var(--gold); margin-left: 4px; }
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { background: rgba(255,255,255,.06); border-radius: 12px; overflow: hidden; }
.history-item.open { background: rgba(255,255,255,.1); }
.history-item.incomplete .hi-title { color: var(--muted); }
.hi-head { display: flex; align-items: center; gap: 10px; padding: 10px 12px; cursor: pointer; }
.hi-main { flex: 1; min-width: 0; }
.hi-date { font-size: 12px; color: var(--muted); }
.hi-title { font-size: 16px; margin: 2px 0; }
.hi-sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hi-del { border: 0; background: rgba(0,0,0,.25); border-radius: 10px; width: 36px; height: 36px; font-size: 16px; flex: none; }
.hi-detail { padding: 0 12px 12px; overflow-x: auto; }
.seat-list li.can-bot { flex-wrap: wrap; }
.bot-tag { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 4px; }


/* ================= The Gang ================= */
.lc-title { font-family: Georgia, "Times New Roman", serif; }
.lc-title em { display: block; font-style: normal; font-size: .42em; color: var(--gold); letter-spacing: 3px; text-transform: uppercase; }
.brand-chips { display: flex; justify-content: center; gap: 8px; }
.brand-chips .chip { --sz: 46px; }
.count-picker.variant button { font-size: 17px; }

/* chips: a coloured disc with a dashed rim and its stars, readable at a glance */
.chip { --sz: 30px; --ring: #555; --bg: #eee; --ink: #222; position: relative; flex: none; width: var(--sz); height: var(--sz); border-radius: 50%; display: inline-grid; place-items: center; font-weight: 900; font-size: calc(var(--sz) * .44); line-height: 1; color: var(--ink);
  background: radial-gradient(circle, var(--bg) 0 54%, transparent 55%), repeating-conic-gradient(var(--bg) 0 15deg, var(--ring) 15deg 30deg); box-shadow: 0 2px 4px rgba(0,0,0,.5), inset 0 0 0 2px rgba(0,0,0,.25); border: 0; padding: 0; }
.chip i { font-style: normal; font-size: .62em; position: absolute; transform: translate(.9em, -.75em); color: var(--ink); opacity: .85; }
.chip.c-white { --bg: #f4f2ea; --ring: #8a8678; --ink: #222; }
.chip.c-yellow { --bg: #ffd23f; --ring: #9a7a00; --ink: #3a2c00; }
.chip.c-orange { --bg: #ff9a3c; --ring: #9a4a00; --ink: #3a1600; }
.chip.c-red { --bg: #e5383b; --ring: #7a0d10; --ink: #fff; }
.chip.empty, .chip.slot { background: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.25); }
.chip.empty.cur { box-shadow: inset 0 0 0 2px var(--bg), 0 0 8px var(--bg); animation: ghostPulse 1.2s ease-in-out infinite; }
.chip.slot { opacity: .35; }
.chip.take, .chip.steal, .chip.own { cursor: pointer; }
.chip.take:hover, .chip.steal:hover { transform: scale(1.08); }
.chip.fresh { animation: chipPop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes chipPop { from { transform: scale(1.8); opacity: .3; } }
@keyframes ghostPulse { 50% { opacity: .45; } }
.rname { padding: 1px 8px; border-radius: 999px; font-weight: 900; }
.rname.c-white { background: #f4f2ea; color: #222; } .rname.c-yellow { background: #ffd23f; color: #3a2c00; }
.rname.c-orange { background: #ff9a3c; color: #3a1600; } .rname.c-red { background: #e5383b; color: #fff; }
.track { display: inline-flex; gap: 2px; margin-left: 8px; font-size: 15px; }
.track span { opacity: .25; filter: grayscale(1); }
.track span.on { opacity: 1; filter: none; }

/* cards */
#table { --card: 70px; --side: 170px; }
.pc { --w: var(--card); position: relative; flex: none; width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * .1); background: #fffdf8; color: #1b1b1f; display: grid; place-items: center; box-shadow: 0 3px 8px rgba(0,0,0,.5); border: 2px solid transparent; }
.pc b { position: absolute; left: 8%; top: 4%; font-size: calc(var(--w) * .34); font-family: Georgia, serif; line-height: 1; }
.pc i { font-style: normal; font-size: calc(var(--w) * .62); line-height: 1; margin-top: 18%; }
.pc.red { color: #d0202c; }
.pc.back { background: repeating-linear-gradient(45deg, #2b2058 0 6px, #3b2c78 6px 12px); border: 2px solid #cfc4ff55; }
.pc.slot { background: none; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.pc.used { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(245,183,0,.6); }
.pc.unused { opacity: .55; }
.pc.mini { --w: calc(var(--card) * .45); }
.pc.flip { animation: cardFlip .45s ease-out both; }
@keyframes cardFlip { from { transform: rotateY(90deg) scale(.85); } to { transform: none; } }

/* the gang down the edges */
.seats { position: absolute; top: 42px; bottom: calc(4px + var(--safe-b)); width: var(--side); display: flex; flex-direction: column; justify-content: space-evenly; gap: 4px; z-index: 3; overflow-y: auto; touch-action: pan-y; }
.seats.left { left: 0; padding-left: calc(4px + var(--safe-l)); justify-content: flex-end; }
.seats.right { right: 0; padding-right: calc(4px + var(--safe-r)); }
.seat { background: rgba(0,0,0,.36); border: 2px solid transparent; border-radius: 12px; padding: 4px 6px; display: flex; flex-direction: column; gap: 3px; flex: none; }
.seat.me { border-color: rgba(255,255,255,.25); background: rgba(0,0,0,.5); }
.seat.ready { border-color: rgba(75,224,140,.55); }
.st-top { display: flex; align-items: center; gap: 5px; min-width: 0; }
.st-top .avatar { width: 22px; height: 22px; font-size: 11px; border-width: 1.5px; }
.st-top b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.st-top .rdy { color: #6ff0a4; font-size: 12px; font-weight: 800; }
.st-top .wait { color: var(--muted); font-size: 11px; }
/* the chip row: earlier rounds stay visible, the current round's chip is the largest */
.st-chips { display: flex; align-items: center; gap: 4px; }
.st-chips .chip { --sz: calc(var(--side) * .18); }
.st-chips .chip.cur { --sz: calc(var(--side) * .24); }
.st-chips .chip.steal { box-shadow: 0 0 0 2px #fff6, 0 2px 4px rgba(0,0,0,.5); }
.st-cards { display: flex; gap: 3px; }

/* the middle: table cards, free chips, your cards */
.middle { position: absolute; left: var(--side); right: var(--side); top: 40px; bottom: calc(4px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 6px; z-index: 2; padding: 0 8px; }
.board { display: flex; gap: 6px; padding: 6px 10px; border-radius: 14px; background: rgba(0,0,0,.25); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.pool { display: flex; gap: 10px; align-items: center; justify-content: center; min-height: calc(var(--card) * .7); flex-wrap: wrap; }
.pool .chip.big { --sz: calc(var(--card) * .66); }
.pool-empty { color: var(--muted); font-size: 13px; }
.mine { display: flex; align-items: center; gap: 12px; }
.my-cards { display: flex; gap: 6px; }
.my-cards .pc { --w: calc(var(--card) * 1.1); }
.my-cards.four .pc { --w: calc(var(--card) * .95); }
.my-side { display: flex; flex-direction: column; gap: 5px; align-items: flex-start; max-width: 240px; }
.my-hand { font-size: 14px; }
.my-hand b { color: var(--gold); }
.tip { font-size: 13px; color: var(--muted); line-height: 1.25; }
.tip.small { font-size: 12px; }
.ready-btn, .show-btn { padding: 9px 16px; font-size: 16px; }

/* heist banner */
.heist-banner { position: fixed; inset: 0; margin: auto; width: max-content; height: max-content; z-index: 75; text-align: center; padding: 14px 34px; border-radius: 18px; background: rgba(10,6,24,.82); box-shadow: 0 0 50px rgba(245,183,0,.35); pointer-events: none; animation: zoomIn .45s cubic-bezier(.2,1.6,.4,1) both, fadeOut .4s 1.3s forwards; }
.hb-title { font-family: Georgia, serif; font-size: 40px; font-weight: 900; color: var(--gold); }
.hb-sub { font-size: 16px; font-weight: 700; }

/* the showdown window */
#showWin .sheet { max-height: 94vh; overflow: auto; touch-action: pan-y; }
.show-board { display: flex; gap: 5px; justify-content: center; margin-bottom: 8px; }
.show-board .pc { --w: 46px; }
.show-body { display: flex; flex-direction: column; gap: 5px; }
.show-row { display: flex; align-items: center; gap: 10px; padding: 5px 8px; border-radius: 12px; background: rgba(255,255,255,.06); }
.show-row .chip.big { --sz: 38px; }
.show-row.hidden { visibility: hidden; }
.show-row.reveal { animation: rowIn .45s ease-out; }
@keyframes rowIn { from { transform: translateX(-30px); opacity: 0; } }
.show-row.bad { background: rgba(229,56,59,.25); box-shadow: inset 0 0 0 2px #e5383b; }
.sw-name { display: flex; align-items: center; gap: 6px; width: 110px; flex: none; }
.sw-name .avatar { width: 24px; height: 24px; font-size: 11px; }
.sw-cards { display: flex; gap: 4px; }
.sw-cards .pc { --w: 40px; }
.sw-hand { flex: 1; font-weight: 800; font-size: 15px; }
.sw-mark { font-weight: 900; font-size: 15px; color: #6ff0a4; white-space: nowrap; }
.show-row.bad .sw-mark { color: #ff8f8f; }
.verdict { text-align: center; margin: 8px 0 0; }
.verdict .v-ok, .verdict .v-bad { font-family: Georgia, serif; font-size: 30px; font-weight: 900; }
.verdict .v-ok { color: var(--gold); } .verdict .v-bad { color: #ff5a5f; }
.verdict .pop { animation: zoomIn .5s cubic-bezier(.2,1.6,.4,1); }
.verdict .v-game { margin-top: 4px; font-size: 18px; font-weight: 800; }

@media (max-height: 360px) {
  .seats, .middle { top: 36px; }
  .st-top b { font-size: 13px; }
  .my-hand, .tip { font-size: 12px; }
  .ready-btn, .show-btn { padding: 6px 12px; font-size: 14px; }
  .show-row { padding: 3px 6px; }
  .sw-cards .pc { --w: 32px; }
  .show-board .pc { --w: 36px; }
}
