/* CQG PokerBots: tokens mirror app/globals.css on the main site. */
:root {
  --navy: #0B2F62;
  --navy-deep: #071F42;
  --navy-mid: #123B77;
  --navy-line: #26466E;
  --sky: #6FCBFF;
  --sky-deep: #2E9BE0;
  --lime: #E8FA0A;
  --lime-deep: #B8C400;
  --pink: #FF8FC0;
  --pink-deep: #E85A96;
  --paper: #F5F7FA;
  --paper-alt: #EAEEF4;
  --ink: #10182B;
  --ink-soft: #4B5568;
  --ink-faint: #7B879C;
  --line: #DBE1EB;
  --up: #2A9A55;
  --down: #D6455D;
  --felt: #0E5A3F;
  --felt-edge: #083826;

  --bg: var(--paper);
  --fg: var(--ink);
  --card: #ffffff;
  --muted: var(--ink-soft);
  --border: var(--line);

  --font-display: "Archivo", "Arial Black", sans-serif;
  --font-sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: var(--navy-deep);
    --fg: #EAF1FB;
    --card: #0D2850;
    --muted: #A9B8CF;
    --border: var(--navy-line);
    --up: #6EE39A;
    --down: #FF7A90;
  }
}
:root[data-theme="dark"] {
  --bg: var(--navy-deep);
  --fg: #EAF1FB;
  --card: #0D2850;
  --muted: #A9B8CF;
  --border: var(--navy-line);
  --up: #6EE39A;
  --down: #FF7A90;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.45;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.01em; }
a { color: var(--sky-deep); }
::selection { background: var(--lime); color: var(--navy); }
.mono, .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.up { color: var(--up); }
.down { color: var(--down); }
.hidden { display: none !important; }

/* ------------------------------------------------------------ app shell */
.shell { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 16px; background: var(--navy); color: #fff;
}
.topbar .brand { font-family: var(--font-display); font-size: 18px; display: flex; gap: 10px; align-items: center; }
.topbar .brand .chip { width: 22px; height: 22px; border-radius: 50%; background: var(--lime); box-shadow: inset 0 0 0 4px var(--navy), inset 0 0 0 6px var(--lime); }
.topbar .right { display: flex; gap: 12px; align-items: center; font-size: 14px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; margin-bottom: 16px;
}
.card h2 { font-size: 18px; margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.kpis { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.kpi { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.kpi .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-family: var(--font-mono); font-size: 22px; font-weight: 600; }

button, .btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 999px;
  padding: 8px 16px; border: 1px solid var(--navy); background: var(--navy); color: #fff;
}
button.secondary { background: transparent; color: var(--fg); border-color: var(--border); }
button.lime { background: var(--lime); border-color: var(--lime-deep); color: var(--navy); }
button.danger { background: transparent; color: var(--down); border-color: var(--down); }
button:disabled { opacity: .45; cursor: not-allowed; }
input[type=text], input[type=password], select {
  font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg); color: var(--fg); min-width: 0;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.pill {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); white-space: nowrap;
}
.pill.ok, .pill.active, .pill.playing, .pill.running { background: rgba(42,154,85,.15); color: var(--up); border-color: transparent; }
.pill.bad, .pill.failed, .pill.rejected, .pill.eliminated, .pill.disabled { background: rgba(214,69,93,.15); color: var(--down); border-color: transparent; }
.pill.testing, .pill.restarting, .pill.paused, .pill.waiting { background: rgba(111,203,255,.18); color: var(--sky-deep); border-color: transparent; }
.notice { padding: 10px 12px; border-radius: 10px; background: rgba(111,203,255,.15); margin: 8px 0; }
.notice.bad { background: rgba(214,69,93,.13); }
.error { color: var(--down); font-weight: 600; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
table.data td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data td.num, table.data th.num { text-align: right; }
table.data tr.clickable { cursor: pointer; }
table.data tr.clickable:hover td { background: rgba(111,203,255,.08); }
table.data tr.selected td { background: rgba(232,250,10,.14); }
.scroll-x { overflow-x: auto; }
pre.log {
  background: #061A38; color: #D8E6F7; border-radius: 10px; padding: 12px; max-height: 360px;
  overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 0;
}

/* --------------------------------------------------------------- cards */
.pcard {
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-mono);
  font-weight: 700; background: #fff; color: #111; border-radius: 5px; border: 1px solid #c9d1dc;
  min-width: 1.9em; padding: 0.1em 0.25em; margin-right: 0.15em; line-height: 1.2;
}
.pcard.red { color: #D2243C; }
.pcard.back { background: repeating-linear-gradient(45deg, var(--navy-mid) 0 4px, var(--navy) 4px 8px); color: transparent; border-color: var(--navy-line); }

/* ------------------------------------------------------------------- TV */
body.tv { background: var(--navy-deep); color: #EAF1FB; overflow: hidden; font-size: 1.05vw; }
.tv-wrap { height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.tv-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 1.1vh 1.6vw;
  background: var(--navy); border-bottom: 3px solid var(--lime);
}
.tv-head .brand { font-family: var(--font-display); font-size: 1.6vw; display: flex; gap: .7vw; align-items: center; }
.tv-head .brand .chip { width: 1.7vw; height: 1.7vw; border-radius: 50%; background: var(--lime); box-shadow: inset 0 0 0 .3vw var(--navy), inset 0 0 0 .45vw var(--lime); }
.tv-head .phase { text-align: center; }
.tv-head .phase .label { font-family: var(--font-display); font-size: 1.5vw; }
.tv-head .phase .status { font-size: .9vw; color: var(--sky); text-transform: uppercase; letter-spacing: .12em; }
.tv-head .clock { justify-self: end; font-family: var(--font-mono); font-size: 2.6vw; font-weight: 600; color: var(--lime); }
.tv-head .clock.low { color: var(--pink); }
.tv-main { display: grid; grid-template-columns: 38fr 62fr; gap: 1.2vw; padding: 1.2vw 1.6vw; min-height: 0; }
.tv-panel { background: rgba(13, 40, 80, .75); border: 1px solid var(--navy-line); border-radius: 1vw; padding: 1vw; min-height: 0; overflow: hidden; }
.tv-panel h2 { font-size: 1.2vw; color: var(--sky); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .6vw; }
.lb { width: 100%; border-collapse: collapse; font-size: 1vw; }
.lb th { font-size: .75vw; color: #A9B8CF; text-transform: uppercase; letter-spacing: .08em; text-align: left; padding: .25vw .4vw; font-weight: 600; }
.lb td { padding: .3vw .4vw; font-size: 1em; border-top: 1px solid rgba(38, 70, 110, .6); white-space: nowrap; }
.lb td.rank { font-family: var(--font-display); color: var(--sky); width: 2.2vw; }
.lb tr.top3 td.rank { color: var(--lime); }
.lb td.name { overflow: hidden; text-overflow: ellipsis; max-width: 12vw; font-weight: 600; }
.lb td.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.lb td.up { color: #6EE39A; } .lb td.down { color: #FF7A90; }
.lb td.out { color: #7B879C; }
.lb tr.dim td { opacity: .45; }
.lb tr.final-seat td.name::after { content: " ★"; color: var(--lime); }
.spark { width: 6vw; height: 1.4vw; display: block; }

.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(17vw, 1fr)); gap: .9vw; align-content: start; height: 100%; overflow: hidden; }
.ttable { background: linear-gradient(160deg, #0F6446, var(--felt-edge)); border-radius: .9vw; padding: .7vw .8vw; border: 1px solid #1c7a56; }
.ttable .thead { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: .4vw; }
.ttable .tname { font-family: var(--font-display); font-size: 1vw; }
.ttable .variant { font-size: .75vw; background: var(--lime); color: var(--navy); border-radius: 99px; padding: .05vw .55vw; font-weight: 700; }
.ttable .board { min-height: 1.6vw; font-size: .95vw; margin-bottom: .35vw; display: flex; align-items: center; gap: .2vw; }
.ttable .pot { margin-left: auto; font-family: var(--font-mono); font-size: .85vw; color: #CFEFE0; }
.ttable .seat { display: grid; grid-template-columns: 1fr auto; gap: .4vw; font-size: .9vw; padding: .14vw .3vw; border-radius: .35vw; }
.ttable .seat .sname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ttable .seat .chips { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.ttable .seat.folded { opacity: .45; }
.ttable .seat.to-act { background: rgba(232, 250, 10, .22); }
.ttable .seat .btn-dot { display: inline-block; width: .8vw; height: .8vw; border-radius: 50%; background: #fff; color: var(--navy); font-size: .55vw; text-align: center; line-height: .8vw; font-weight: 800; margin-right: .25vw; vertical-align: middle; }
.ttable .seat .bet { color: var(--lime); font-size: .75vw; margin-left: .3vw; }

.tv-foot { padding: .6vh 1.6vw; display: flex; justify-content: space-between; font-size: .85vw; color: #A9B8CF; }
.tv-idle { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; text-align: center; gap: 1.2vw; }
.tv-idle .big { font-family: var(--font-display); font-size: 3vw; }
.tv-idle .sub { font-size: 1.3vw; color: var(--sky); }
.tv-idle .url { font-family: var(--font-mono); font-size: 1.4vw; color: var(--lime); }

/* final table felt */
.felt-wrap { position: relative; height: 100%; display: flex; align-items: center; justify-content: center; }
.felt {
  position: relative; width: 92%; aspect-ratio: 2.1 / 1; border-radius: 50% / 50%;
  background: radial-gradient(ellipse at center, #13774f 0%, var(--felt) 55%, var(--felt-edge) 100%);
  border: 1.1vw solid #3b2a1a; box-shadow: 0 0 0 .3vw #5a4127, inset 0 0 4vw rgba(0,0,0,.45);
}
.felt .center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; }
.felt .center .board { font-size: 2vw; display: flex; gap: .3vw; justify-content: center; min-height: 3vw; }
.felt .center .pot { font-family: var(--font-mono); font-size: 1.4vw; margin-top: .5vw; color: var(--lime); }
.felt .center .act { font-size: 1.05vw; margin-top: .4vw; color: #E9FFF3; min-height: 1.5vw; }
.felt .center .vname { font-size: .9vw; text-transform: uppercase; letter-spacing: .12em; color: #BDE9D4; }
.fseat {
  position: absolute; transform: translate(-50%, -50%); width: 13vw; background: rgba(7, 31, 66, .92);
  border: 2px solid var(--navy-line); border-radius: .8vw; padding: .5vw .7vw; text-align: center;
}
.fseat.to-act { border-color: var(--lime); box-shadow: 0 0 1.2vw rgba(232,250,10,.45); }
.fseat.folded { opacity: .45; }
.fseat.out { opacity: .25; }
.fseat .n { font-family: var(--font-display); font-size: 1.05vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fseat .c { font-family: var(--font-mono); font-size: 1.1vw; color: var(--lime); }
.fseat .h { font-size: 1.3vw; margin-top: .25vw; min-height: 1.8vw; }
.fseat .b { font-size: .8vw; color: var(--sky); min-height: 1.1vw; }
.podium { display: flex; gap: 2vw; align-items: flex-end; justify-content: center; }
.podium .p { background: var(--navy); border: 2px solid var(--navy-line); border-radius: 1vw; padding: 1vw 1.6vw; text-align: center; min-width: 14vw; }
.podium .p.first { border-color: var(--lime); transform: translateY(-1.5vw); }
.podium .p .place { font-family: var(--font-display); font-size: 2.2vw; color: var(--lime); }
.podium .p .who { font-family: var(--font-display); font-size: 1.5vw; }

/* ----------------------------------------------------------- team page */
.login { max-width: 420px; margin: 10vh auto; }
.login input { width: 100%; font-family: var(--font-mono); letter-spacing: .06em; }
.dropzone {
  border: 2px dashed var(--border); border-radius: 12px; padding: 22px; text-align: center; cursor: pointer;
}
.dropzone.drag { border-color: var(--sky-deep); background: rgba(111,203,255,.08); }
.hand-row { border-bottom: 1px solid var(--border); padding: 8px 0; font-size: 14px; }
.hand-row .meta { color: var(--muted); font-size: 12px; }
.hand-row details summary { cursor: pointer; }
.hand-row ol { margin: 6px 0 0; padding-left: 20px; font-size: 13px; }

/* ---------------------------------------------------------- admin page */
.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 1000px) { .admin-layout { grid-template-columns: 1fr; } }
.phase-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.phase-list .ph { font-size: 12px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--border); }
.phase-list .ph.current { background: var(--lime); color: var(--navy); border-color: var(--lime-deep); font-weight: 700; }
.chart { width: 100%; height: 160px; }
.code-box { font-family: var(--font-mono); font-size: 20px; padding: 12px; background: var(--lime); color: var(--navy); border-radius: 10px; text-align: center; letter-spacing: .05em; user-select: all; }

@media (max-width: 640px) {
  .shell { padding: 16px 16px 48px; }
  .topbar { padding: 12px 16px; }
}
.lb.dense td { padding: .12vw .4vw; }
.topbar .brand .role { color: #A9B8CF; font-family: var(--font-sans); font-size: 14px; }
.lb.dense td { padding: .06vw .4vw; line-height: 1.3; }
.lb.dense .spark { height: 1.05vw; }
