/* Poker Lab — original frontend, no dependencies. */
:root {
  color-scheme: dark;
  --bg: #080c12;
  --panel: #0f1622;
  --panel-2: #0b111b;
  --panel-3: #121b29;
  --line: #233149;
  --line-soft: #1a2537;
  --text: #e9eef7;
  --muted: #94a4ba;
  --faint: #6f8098;
  --gold: #f2b84b;
  --gold-soft: rgba(242, 184, 75, .12);
  --green: #25c28b;
  --green-soft: rgba(37, 194, 139, .14);
  --blue: #69b7ff;
  --blue-soft: rgba(105, 183, 255, .14);
  --red: #f07470;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  --max: 1180px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "PingFang TC", "Microsoft JhengHei", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(1100px 540px at 10% -10%, rgba(242, 184, 75, .09), transparent 62%),
    radial-gradient(900px 500px at 94% 2%, rgba(37, 194, 139, .07), transparent 58%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, h4 { letter-spacing: -.02em; }
a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: #ffd27a; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .86em;
  color: #cfe0f5;
  background: rgba(255, 255, 255, .05);
  padding: 1px 5px;
  border-radius: 5px;
  overflow-wrap: anywhere;
}
:focus-visible { outline: 3px solid rgba(242, 184, 75, .75); outline-offset: 2px; }

.skip-link {
  position: absolute;
  left: 12px;
  top: -56px;
  z-index: 100;
  background: var(--gold);
  color: #1a1305;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { top: 10px; }

.wrap { width: min(var(--max), calc(100% - 32px)); margin-inline: auto; }

/* ---------------------------------- header ---------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(8, 12, 18, .82);
  backdrop-filter: blur(14px);
}
.header-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 66px;
  padding-block: 8px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.brand img {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(242, 184, 75, .28);
  object-fit: cover;
  background: var(--panel-2);
}
.brand span { font-size: 1.02rem; }
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: auto;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
  font-size: .88rem;
  padding: 8px 9px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .045); }
.nav a[aria-current] { color: var(--gold); background: var(--gold-soft); }
.nav-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; flex: 0 0 auto; }
.nav-letter { color: var(--gold) !important; }
.lang {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  flex: 0 0 auto;
}
.lang a {
  color: var(--muted);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 800;
  padding: 5px 10px;
  white-space: nowrap;
}
.lang a[aria-current="true"] { background: var(--gold); color: #1a1305; }

/* ----------------------------------- hero ----------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  align-items: end;
  gap: 26px;
  padding: 23px 0 18px;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--gold);
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.eyebrow::before { content: ""; width: 22px; height: 2px; background: var(--gold); }
.hero h1 {
  margin: 0 0 10px;
  font-size: clamp(2.2rem, 4.4vw, 3rem);
  line-height: 1;
}
.hero-lede {
  margin: 0;
  max-width: 66ch;
  color: var(--muted);
  font-size: 1.04rem;
}
.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.hero-chips li {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .025);
  border-radius: 999px;
  padding: 5px 11px;
  color: #c3d0e2;
  font-size: .78rem;
  font-weight: 650;
}
.app-status {
  margin: 0;
  border: 1px solid var(--line);
  border-left: 3px solid var(--green);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: rgba(37, 194, 139, .06);
  padding: 12px 14px;
  color: #bfe9d8;
  font-size: .82rem;
  min-height: 56px;
}

/* ---------------------------------- panels ---------------------------------- */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .035), rgba(255, 255, 255, .008));
  box-shadow: var(--shadow);
  padding: 24px;
  margin: 0 0 22px;
  scroll-margin-top: 84px;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}
.kicker {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.section-head h2 { margin: 0 0 5px; font-size: clamp(1.35rem, 2.4vw, 1.8rem); }
.section-sub { margin: 0; max-width: 72ch; color: var(--muted); font-size: .92rem; }
.section-sub strong { color: var(--text); }

.stakes { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stakes button,
.segmented button {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  border-radius: 9px;
  padding: 8px 12px;
  font: inherit;
  font-size: .84rem;
  font-weight: 800;
  cursor: pointer;
  min-height: 38px;
  white-space: nowrap;
}
.stakes button:hover,
.segmented button:hover { color: var(--text); border-color: #354761; }
.stakes button[aria-pressed="true"],
.segmented button[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: #1a1305;
}
.preset-note {
  margin: 0 0 18px;
  color: var(--faint);
  font-size: .78rem;
}

.monitor-grid,
.bankroll-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  gap: 20px;
  align-items: start;
}
.inputs {
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(8, 13, 21, .45);
  padding: 16px;
}
.inputs fieldset {
  border: 0;
  padding: 0;
  margin: 0 0 16px;
}
.inputs fieldset:last-child { margin-bottom: 0; }
.inputs legend {
  padding: 0;
  margin: 0 0 9px;
  color: #cbd8e9;
  font-size: .76rem;
  font-weight: 900;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.fields { display: grid; gap: 10px 12px; }
.fields-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 10px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label,
.label-text {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-size: .94rem;
  font-variant-numeric: tabular-nums;
}
.field select { cursor: pointer; }
.field input:hover,
.field select:hover { border-color: #33445e; }
.field input:focus,
.field select:focus { border-color: var(--gold); outline: 3px solid rgba(242, 184, 75, .28); outline-offset: 1px; }
.field input:invalid { border-color: rgba(240, 116, 112, .7); }
.hint { margin: 6px 0 0; color: var(--faint); font-size: .75rem; line-height: 1.45; }

/* --------------------------------- readout ---------------------------------- */
.readout { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}
.stat {
  border: 1px solid var(--line-soft);
  border-radius: 11px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, .005));
  padding: 10px 12px;
  min-width: 0;
}
.stat-hero {
  grid-column: 1 / -1;
  border-color: rgba(242, 184, 75, .3);
  background:
    radial-gradient(420px 120px at 0% 0%, rgba(242, 184, 75, .14), transparent 70%),
    rgba(15, 22, 34, .82);
}
.stat-label {
  display: block;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.stat output {
  display: block;
  margin: 2px 0 1px;
  font-size: 1.32rem;
  font-weight: 900;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.stat-hero output { font-size: clamp(1.8rem, 3.4vw, 2.4rem); color: var(--gold); }
.stat output.pos { color: var(--green); }
.stat output.neg { color: var(--red); }
.stat-hero output.pos { color: var(--green); }
.stat-hero output.neg { color: var(--red); }
.stat-unit { display: block; color: var(--muted); font-size: .76rem; }
#table .stat:last-child { grid-column: 1 / -1; }
.cell.four-bet .cell-mark { color: var(--gold); }
.status-line {
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 10px;
  color: var(--muted);
  font-size: .78rem;
  min-height: 20px;
}
#table[data-invalid="true"] .status-line,
#bankroll[data-invalid="true"] .status-line { color: var(--red); border-left-color: var(--red); }
.mini-note {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, .018);
}
.mini-note summary { cursor: pointer; color: #c7d4e6; font-size: .78rem; font-weight: 800; }
.mini-note p { margin: 7px 0 0; color: var(--muted); font-size: .78rem; }

.ad-slot { display: block; }
.ad-slot[data-ad-hook] { height: 0; overflow: hidden; }

/* ---------------------------------- ranges ---------------------------------- */
.range-controls {
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(120px, .6fr) minmax(130px, .8fr) minmax(260px, 1.4fr);
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background: rgba(8, 13, 21, .45);
  margin-bottom: 12px;
}
.field-actions { gap: 6px; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.range-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 12px 0;
}
#range-context { margin: 0; color: var(--muted); font-size: .84rem; font-weight: 700; }
#range-count { margin: 0; color: var(--gold); font-size: .84rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.matrix-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(270px, 320px);
  gap: 18px;
  align-items: start;
}
.matrix-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #070b11;
  padding: 8px;
  -webkit-overflow-scrolling: touch;
}
.matrix-scroll:focus-visible { outline-offset: -3px; }
.matrix {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 630px;
}
.matrix-row {
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 3px;
}
.cell {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  min-height: 30px;
  padding: 0;
  border: 1px solid #1d293c;
  border-radius: 5px;
  background: #0d1420;
  color: #8495ac;
  font: inherit;
  font-size: clamp(9px, .32vw + 6px, 12px);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease, color .12s ease;
}
.cell:hover { border-color: #4a5f7e; color: #dbe7f6; }
.cell.in-range { color: #f4f8ff; }
.cell.alt { border-style: dashed; border-color: #5f718c; }
.cell.selected { outline: 2px solid #f6fbff; outline-offset: -1px; z-index: 2; }

/* Primary action palettes. Alternatives keep the dashed border. */
#grid[data-primary="open"] .cell.in-range {
  background: rgba(37, 194, 139, .24);
  border-color: rgba(37, 194, 139, .72);
}
#grid[data-primary="three"] .cell.in-range {
  background: rgba(242, 184, 75, .26);
  border-color: rgba(242, 184, 75, .8);
  color: #fff4dc;
}
#grid[data-primary="call"] .cell.in-range {
  background: rgba(105, 183, 255, .24);
  border-color: rgba(105, 183, 255, .75);
}
.cell-mark {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: .62em;
  font-weight: 950;
  opacity: .85;
  line-height: 1;
}
.cell-hand { pointer-events: none; }

.hand-panel {
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--panel-2);
  padding: 16px;
}
.hand-panel h3 { margin: 0; font-size: 1.5rem; letter-spacing: -.03em; }
.hand-type { margin: 2px 0 10px; color: var(--gold); font-size: .78rem; font-weight: 800; }
.hand-detail { margin: 0 0 10px; color: var(--muted); font-size: .82rem; min-height: 2.6em; }
.action-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 5px; }
.action-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 6px 9px;
  font-size: .8rem;
  color: var(--muted);
}
.action-list li.included { color: var(--text); border-color: #33455f; background: rgba(255, 255, 255, .03); }
.action-list li span:last-child { color: var(--faint); font-size: .74rem; }
.action-list li.included span:last-child { color: var(--gold); font-weight: 800; }
.action-list li.none { color: var(--faint); font-size: .76rem; }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: .72rem;
}
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
  border: 1px solid #3b4d68;
}
.swatch.primary { background: rgba(37, 194, 139, .55); border-color: rgba(37, 194, 139, .9); }
.swatch.alt { background: transparent; border-style: dashed; border-color: #93a4bd; }
.swatch.off { background: #0d1420; }
.range-list { margin-top: 12px; }
.range-list summary { cursor: pointer; color: #c9d6e7; font-size: .78rem; font-weight: 800; }
.range-list p {
  margin: 8px 0 0;
  max-height: 150px;
  overflow: auto;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.hand-panel .hint { font-size: .72rem; }
.method-link { margin: 12px 0 0; color: var(--faint); font-size: .78rem; }

/* --------------------------------- bankroll --------------------------------- */
.linked-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
}
.linked-strip div {
  flex: 1 1 150px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, .022);
  padding: 8px 11px;
}
.linked-strip dt { color: var(--faint); font-size: .66rem; font-weight: 850; letter-spacing: .07em; text-transform: uppercase; }
.linked-strip dd { margin: 1px 0 0; font-size: .94rem; font-weight: 850; font-variant-numeric: tabular-nums; }
.background-note { margin: 4px 0 0; color: var(--faint); font-size: .75rem; line-height: 1.55; }

/* -------------------------------- methodology -------------------------------- */
.jump-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 18px; }
.jump-links a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  color: var(--muted);
  text-decoration: none;
  font-size: .78rem;
  font-weight: 800;
}
.jump-links a:hover { color: var(--gold); border-color: rgba(242, 184, 75, .45); }
.method-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.method-grid article {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(8, 13, 21, .4);
  padding: 15px;
}
.method-grid h3 { margin: 0 0 7px; font-size: 1rem; color: var(--gold); }
.method-grid p { margin: 0 0 9px; color: var(--muted); font-size: .82rem; }
.method-grid p:last-child { margin-bottom: 0; }
.limits {
  margin-top: 16px;
  border: 1px solid rgba(240, 116, 112, .25);
  border-radius: 12px;
  background: rgba(240, 116, 112, .045);
  padding: 14px 16px;
}
.limits h3 { margin: 0 0 6px; font-size: .92rem; color: #ffb4b1; }
.limits ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: .8rem; }
.limits li { margin-bottom: 3px; }

/* ---------------------------------- footer ---------------------------------- */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 26px 0 40px;
  color: var(--muted);
  font-size: .82rem;
}
.footer-disclaimer { margin: 0 0 12px; max-width: 92ch; }
.footer-disclaimer strong { color: #ffb4b1; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 12px; }
.footer-nav a { color: var(--gold); text-decoration: none; font-weight: 700; font-size: .8rem; }
.footer-meta { margin: 0; color: var(--faint); font-size: .76rem; }
.offline-status { margin: 6px 0 0; color: var(--green); font-size: .76rem; }

/* --------------------------------- responsive -------------------------------- */
@media (max-width: 1040px) {
  .monitor-grid, .bankroll-grid { grid-template-columns: 1fr; }
  .method-grid { grid-template-columns: 1fr; }
  .matrix-layout { grid-template-columns: 1fr; }
  .range-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field-actions { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; align-items: start; padding-top: 30px; }
  .app-status { max-width: none; }
  .section-head { flex-direction: column; }
  .stakes { justify-content: flex-start; }
  .nav { order: 3; width: 100%; flex-basis: 100%; }
  .header-row { flex-wrap: wrap; }
  .brand { margin-right: auto; }
}
@media (max-width: 620px) {
  .wrap { width: min(var(--max), calc(100% - 22px)); }
  .panel { padding: 16px; border-radius: 14px; scroll-margin-top: 96px; }
  .hero { padding: 26px 0 18px; gap: 14px; }
  .hero h1 { font-size: clamp(2rem, 11vw, 2.7rem); }
  .hero-lede { font-size: .96rem; }
  .fields-3, .fields-2 { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat output { font-size: 1.16rem; }
  .range-controls { grid-template-columns: 1fr; }
  .segmented button { flex: 1 1 auto; }
  .range-summary { flex-direction: column; gap: 4px; }
  .matrix-scroll { padding: 6px; }
  .matrix { min-width: 600px; }
  .cell { font-size: 10px; }
  .nav a { padding: 7px 8px; font-size: .82rem; }
  .lang a { padding: 5px 8px; }
  .method-grid article { padding: 13px; }
  .limits { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
