:root {
  --ink: #101512;
  --paper: #f3f0e7;
  --paper-deep: #e8e3d5;
  --felt: #173f31;
  --felt-light: #225b46;
  --lime: #c8ef65;
  --coral: #f06b4f;
  --muted: #747a73;
  --line: rgba(16, 21, 18, 0.17);
  --white: #fffef9;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Manrope", sans-serif;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.topbar {
  height: 74px;
  padding: 0 clamp(20px, 5vw, 72px);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 800; letter-spacing: -.03em; }
.brand-mark {
  width: 35px; height: 35px; display: grid; place-items: center;
  border-radius: 50%; color: var(--paper); background: var(--ink); font-size: 17px;
}
.brand-mark span { color: var(--lime); font-size: 12px; }
nav { display: flex; align-items: center; gap: 34px; font-size: 13px; font-weight: 700; }
nav a { padding: 27px 0 23px; border-bottom: 3px solid transparent; }
nav a.active { border-color: var(--ink); }
.source { justify-self: end; font: 500 11px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

main { overflow: hidden; }
.hero {
  max-width: 1440px;
  margin: auto;
  padding: clamp(56px, 8vw, 110px) clamp(20px, 5vw, 72px) clamp(44px, 6vw, 76px);
  display: grid;
  grid-template-columns: 1.5fr .75fr;
  gap: 60px;
  align-items: end;
}
.eyebrow { margin: 0 0 13px; font: 500 11px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .16em; }
h1 { margin: 0; max-width: 900px; font-size: clamp(48px, 7vw, 100px); line-height: .92; letter-spacing: -.075em; }
h1 em { color: var(--felt-light); font-weight: 500; }
.hero-copy { margin: 0 0 5px; max-width: 430px; line-height: 1.7; color: #525852; font-size: 14px; }

.workspace {
  max-width: 1296px;
  margin: 0 auto clamp(80px, 10vw, 140px);
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(330px, .78fr);
  box-shadow: 0 24px 70px rgba(31, 40, 34, .15);
}
.decision-panel { padding: clamp(28px, 4vw, 56px); background: var(--white); }
.panel-heading { display: flex; align-items: center; gap: 18px; margin-bottom: 38px; }
.panel-heading > span { font: 500 11px "DM Mono", monospace; width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; }
.panel-heading p { margin-bottom: 3px; color: var(--muted); }
.panel-heading h2, .section-heading h2 { margin: 0; font-size: clamp(25px, 3vw, 38px); letter-spacing: -.045em; }
fieldset { border: 0; padding: 0; margin: 0 0 28px; }
legend, .field > span:first-child, .field-label { display: block; margin-bottom: 9px; font: 500 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .11em; color: var(--muted); }
.segmented { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { min-height: 48px; padding: 0 8px; display: grid; place-items: center; border-right: 1px solid var(--line); font-size: 12px; font-weight: 700; cursor: pointer; transition: .2s ease; }
.segmented label:last-child span { border-right: 0; }
.segmented input:checked + span { background: var(--ink); color: var(--paper); }
.field-grid { display: grid; grid-template-columns: 1fr .7fr; gap: 18px; }
.field { display: block; margin-bottom: 22px; }
select, input[type="number"] {
  width: 100%; height: 52px; padding: 0 15px; border: 1px solid var(--line); border-radius: 0;
  color: var(--ink); background: #faf9f4; outline: none;
}
select:focus, input:focus { border-color: var(--felt); box-shadow: inset 0 0 0 1px var(--felt); }
.number-input { position: relative; display: block; }
.number-input input { padding-right: 48px; }
.number-input b { position: absolute; right: 15px; top: 17px; font: 500 11px "DM Mono", monospace; color: var(--muted); }
.conditional.hidden { display: none; }
.table-setup { margin: 4px 0 28px; padding: 22px; background: var(--paper); border: 1px solid var(--line); }
.table-setup-head { display: flex; align-items: end; justify-content: space-between; gap: 15px; }
.table-setup-head .field-label { margin-bottom: 5px; }
.table-setup-head p, .table-hint { margin: 0; color: var(--muted); font-size: 10px; }
.table-setup-head strong { font: 500 10px "DM Mono", monospace; text-transform: uppercase; }
.table-tools { display: grid; grid-template-columns: repeat(3, 1fr); margin: 18px 0 26px; border: 1px solid var(--line); }
.table-tools label { position: relative; }
.table-tools input { position: absolute; opacity: 0; }
.table-tools span { min-height: 36px; display: grid; place-items: center; padding: 0 4px; border-right: 1px solid var(--line); cursor: pointer; font-size: 9px; font-weight: 700; }
.table-tools label:last-child span { border-right: 0; }
.table-tools input:checked + span { color: var(--paper); background: var(--felt); }
.poker-table { position: relative; width: min(100%, 520px); aspect-ratio: 2 / 1.16; margin: 0 auto 24px; border: 10px solid #242925; border-radius: 50%; background: var(--felt); box-shadow: inset 0 0 0 3px rgba(255,255,255,.12), 0 8px 18px rgba(16,21,18,.16); }
.poker-table::after { content: ""; position: absolute; inset: 11%; border: 1px solid rgba(255,255,255,.1); border-radius: 50%; }
.felt-label { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; color: rgba(255,255,255,.19); font-weight: 800; letter-spacing: .2em; }
.felt-label span { font-size: clamp(16px, 3vw, 27px); }
.felt-label small { font: 500 9px "DM Mono", monospace; letter-spacing: .55em; }
.table-seat { position: absolute; z-index: 3; width: 48px; height: 34px; transform: translate(-50%, -50%); padding: 0; border: 2px solid var(--paper); border-radius: 8px; color: var(--paper); background: #4c544e; cursor: pointer; font: 600 9px "DM Mono", monospace; box-shadow: 0 3px 8px rgba(0,0,0,.25); }
.table-seat:hover { transform: translate(-50%, -50%) scale(1.08); }
.table-seat.hero { color: var(--ink); background: var(--lime); }
.table-seat.empty { color: #7b817c; background: #d1cec4; border-style: dashed; box-shadow: none; }
.table-seat .dealer-chip { position: absolute; width: 18px; height: 18px; right: -11px; top: -11px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--coral); border: 2px solid var(--paper); font-size: 8px; }
.table-hint { text-align: center; min-height: 14px; }
.hand-picker { margin-top: 4px; padding-top: 26px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.hand-picker p { margin: 0; color: var(--muted); font-size: 11px; }
.card-selectors { display: grid; grid-template-columns: 64px 64px 130px; gap: 7px; }
.card-selectors select { height: 44px; padding: 0 9px; }

.result-panel { position: relative; padding: clamp(30px, 4vw, 55px); color: var(--paper); background: var(--felt); overflow: hidden; }
.result-panel::before {
  content: ""; position: absolute; width: 420px; height: 420px; right: -260px; top: -170px;
  border: 1px solid rgba(255,255,255,.12); border-radius: 50%; box-shadow: 0 0 0 45px rgba(255,255,255,.025), 0 0 0 90px rgba(255,255,255,.025);
}
.result-topline { display: flex; justify-content: space-between; gap: 15px; font: 500 10px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.65); }
.result-hand { margin: 42px 0 12px; font-size: clamp(56px, 7vw, 90px); font-weight: 800; letter-spacing: -.07em; }
.verdict { display: flex; gap: 16px; align-items: center; padding: 22px 0; border-top: 1px solid rgba(255,255,255,.2); border-bottom: 1px solid rgba(255,255,255,.2); }
.verdict-dot { width: 14px; height: 14px; border-radius: 50%; flex: none; background: var(--lime); box-shadow: 0 0 0 5px rgba(200,239,101,.13); }
.verdict[data-action="fold"] .verdict-dot { background: var(--coral); box-shadow: 0 0 0 5px rgba(240,107,79,.13); }
.verdict p { margin: 0 0 2px; font: 500 9px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .14em; opacity: .65; }
.verdict h2 { margin: 0; font-size: 27px; letter-spacing: .015em; }
.result-detail { min-height: 72px; margin: 21px 0 34px; color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.65; }
.threshold { display: flex; justify-content: space-between; align-items: end; gap: 20px; font-size: 11px; color: rgba(255,255,255,.55); }
.threshold strong { font-size: 12px; color: var(--white); }
.range-bar { height: 4px; margin-top: 10px; background: rgba(255,255,255,.13); }
.range-bar span { display: block; height: 100%; width: 0; background: var(--lime); transition: width .35s ease; }
.range-count { margin: 8px 0 0; font: 400 9px "DM Mono", monospace; color: rgba(255,255,255,.48); }
.caveat { position: absolute; bottom: 26px; left: clamp(30px, 4vw, 55px); right: clamp(30px, 4vw, 55px); margin: 0; font-size: 9px; line-height: 1.5; color: rgba(255,255,255,.36); }

.matrix-section, .reference { max-width: 1296px; margin: 0 auto clamp(95px, 11vw, 155px); padding: 0 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 32px; }
.legend { display: flex; gap: 20px; font: 500 9px "DM Mono", monospace; text-transform: uppercase; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; display: block; border: 1px solid var(--line); }
.legend .playable { background: var(--felt); }
.legend .outside { background: rgba(255,255,255,.4); }
.legend .selected { border: 2px solid var(--coral); }
.matrix-shell { width: 100%; max-width: 680px; margin: 0 auto; padding: clamp(8px, 1.3vw, 15px); background: var(--ink); }
.matrix { display: grid; grid-template-columns: repeat(13, 1fr); gap: 3px; }
.hand-cell {
  aspect-ratio: 1; min-width: 0; border: 0; padding: 0; cursor: pointer; position: relative;
  display: grid; place-items: center; color: rgba(255,255,255,.32); background: #272d29;
  font: 500 clamp(8px, 1vw, 13px) "DM Mono", monospace; transition: transform .12s ease, background .2s ease;
}
.hand-cell:hover { z-index: 2; transform: scale(1.08); }
.hand-cell.playable { color: white; background: var(--felt-light); }
.hand-cell.selected { z-index: 3; color: var(--ink); background: var(--lime); box-shadow: inset 0 0 0 3px var(--coral); font-weight: 700; }
.hand-cell.no-category::after { content: ""; position: absolute; inset: 4px; border: 1px solid rgba(255,255,255,.035); }
.category-list { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-top: 0; }
.category-item { min-height: 82px; padding: 17px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.category-item:nth-child(4n) { border-right: 0; }
.category-item:nth-child(n+5) { border-bottom: 0; }
.category-item strong { font: 500 10px "DM Mono", monospace; text-transform: uppercase; }
.category-item p { margin: 7px 0 0; color: var(--muted); font: 400 10px/1.5 "DM Mono", monospace; }
.category-item.current { color: var(--paper); background: var(--felt); }
.category-item.current p { color: rgba(255,255,255,.65); }

.reference-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--ink); }
.reference-grid article { padding: 30px 26px 5px 0; border-right: 1px solid var(--line); }
.reference-grid article:not(:first-child) { padding-left: 26px; }
.reference-grid article:last-child { border-right: 0; }
.reference-grid article > span { display: block; color: var(--felt-light); font: 500 23px "DM Mono", monospace; }
.reference-grid h3 { margin: 36px 0 9px; font-size: 14px; }
.reference-grid p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
footer { padding: 30px clamp(20px, 5vw, 72px); display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font: 400 9px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .08em; }

@media (max-width: 1360px) {
  .workspace, .matrix-section, .reference { margin-left: 5vw; margin-right: 5vw; }
}
@media (max-width: 850px) {
  .topbar { grid-template-columns: 1fr auto; }
  nav { display: none; }
  .hero { grid-template-columns: 1fr; gap: 26px; }
  .workspace { grid-template-columns: 1fr; }
  .result-panel { min-height: 560px; }
  .category-list, .reference-grid { grid-template-columns: repeat(2, 1fr); }
  .category-item:nth-child(2n) { border-right: 0; }
  .category-item:nth-child(n+5) { border-bottom: 1px solid var(--line); }
  .category-item:nth-child(n+7) { border-bottom: 0; }
  .reference-grid article:nth-child(2) { border-right: 0; }
}
@media (max-width: 560px) {
  .topbar { height: 62px; }
  .source { display: none; }
  .hero { padding-top: 52px; }
  h1 { font-size: 49px; }
  .workspace, .matrix-section, .reference { margin-left: 16px; margin-right: 16px; }
  .decision-panel { padding: 26px 20px; }
  .segmented { grid-template-columns: repeat(3, 1fr); }
  .segmented label:nth-child(3) span { border-right: 0; }
  .segmented label:nth-child(n+4) span { border-top: 1px solid var(--line); }
  .field-grid { grid-template-columns: 1fr; gap: 0; }
  .table-setup { padding: 17px 10px; }
  .table-setup-head { padding: 0 5px; }
  .poker-table { width: 94%; border-width: 7px; }
  .table-seat { width: 39px; height: 29px; font-size: 7px; }
  .table-tools span { font-size: 8px; }
  .hand-picker { align-items: stretch; flex-direction: column; }
  .card-selectors { grid-template-columns: 1fr 1fr 1.5fr; }
  .result-panel { min-height: 540px; }
  .section-heading { align-items: start; flex-direction: column; }
  .legend { gap: 12px; flex-wrap: wrap; }
  .matrix { gap: 2px; }
  .matrix-shell { margin: 0 -8px; padding: 6px; }
  .hand-cell { font-size: 7px; }
  .category-list { grid-template-columns: 1fr; }
  .category-item, .category-item:nth-child(4n), .category-item:nth-child(2n) { border-right: 0; border-bottom: 1px solid var(--line); }
  .category-item:last-child { border-bottom: 0; }
  .reference-grid { grid-template-columns: 1fr; }
  .reference-grid article, .reference-grid article:not(:first-child) { padding: 24px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .reference-grid h3 { margin-top: 18px; }
  footer { gap: 20px; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
