/* ===========================================================================
 * blackjacklabfa.com — analytical / lab design.
 * Dark instrument-panel surfaces, one teal signal colour, tabular numerals,
 * hairline grids and small CSS-only charts. No decorative casino imagery.
 * ======================================================================== */

:root {
  --bg: #0b1220;
  --bg-2: #0e1626;
  --panel: #111c2f;
  --panel-2: #16233a;
  --line: #22314c;
  --line-soft: #1a2740;
  --text: #e6edf7;
  --text-2: #b3c1d6;
  --muted: #8194ae;
  --teal: #33d6c0;
  --teal-dark: #1c9b8b;
  --teal-ink: #04211d;
  --amber: #e8b95c;
  --rose: #f2748a;
  --ok: #4ddc9c;
  --radius: 6px;
  --wrap: 74rem;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* table theme tokens consumed by game.css */
  --bjc-felt: #0e1626;
  --bjc-felt-edge: #22314c;
  --bjc-felt-text: #e6edf7;
  --bjc-surface: #111c2f;
  --bjc-border: #22314c;
  --bjc-text: #e6edf7;
  --bjc-muted: #8194ae;
  --bjc-accent: #33d6c0;
  --bjc-accent-ink: #04211d;
  --bjc-secondary: #3c6ea5;
  --bjc-win: #4ddc9c;
  --bjc-loss: #f2748a;
  --bjc-radius: 6px;
  --bjc-chip: #1c9b8b;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

body {
  margin: 0;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(51, 214, 192, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(51, 214, 192, .035) 1px, transparent 1px);
  background-size: 48px 48px;
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Naskh Arabic", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.9;
}
body.nav-locked { overflow: hidden; }

img { max-width: 100%; height: auto; }
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.wrap { width: min(var(--wrap), 100% - 2rem); margin-inline: auto; }

.skip { position: absolute; inset-inline-start: -9999px; top: 0; background: var(--teal); color: var(--teal-ink); padding: .6rem 1rem; z-index: 100; }
.skip:focus { inset-inline-start: 0; }

h1, h2, h3, h4 { line-height: 1.45; margin: 0 0 .55rem; font-weight: 700; }
h1 { font-size: clamp(1.45rem, 4vw, 2.1rem); letter-spacing: -.015em; }
h2 { font-size: clamp(1.15rem, 2.6vw, 1.45rem); margin-top: 2.1rem; }
h2::before { content: "// "; color: var(--teal); font-family: var(--mono); font-size: .85em; }
h3 { font-size: 1.02rem; margin-top: 1.4rem; }
p { margin: 0 0 .95rem; }
main ul, main ol { padding-inline-start: 1.25rem; margin: 0 0 1rem; }
main li { margin-bottom: .4rem; }
code { font-family: var(--mono); font-size: .88em; background: var(--panel-2); padding: .05rem .3rem; border-radius: 3px; }

.lead { font-size: 1.04rem; color: var(--text-2); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.tag { font-family: var(--mono); font-size: .72rem; letter-spacing: .08em; color: var(--teal); text-transform: uppercase; }

/* ------------------------------------------------------------------ header */

.site-head { position: sticky; top: 0; z-index: 60; background: rgba(11, 18, 32, .95); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.head-inner { display: flex; align-items: center; gap: 1rem; min-height: 60px; }
.brand img { display: block; }

.nav-btn { margin-inline-start: auto; width: 44px; height: 44px; display: grid; place-content: center; gap: 5px; background: transparent; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }
.nav-btn span { display: block; width: 20px; height: 2px; background: var(--text); }

.site-nav { display: none; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { color: var(--text); font-size: .9rem; font-weight: 600; }
.site-nav a[aria-current="page"] { color: var(--teal); }
.site-nav.is-open { display: block; position: absolute; inset-inline: 0; top: 100%; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: .5rem 1rem 1rem; max-height: 75vh; overflow-y: auto; }
.site-nav.is-open li { border-bottom: 1px solid var(--line-soft); }
.site-nav.is-open a { display: block; padding: .7rem .2rem; }

@media (min-width: 64rem) {
  .nav-btn { display: none; }
  .site-nav { display: flex; margin-inline-start: auto; position: static; padding: 0; border: 0; }
  .site-nav ul { display: flex; gap: 1.15rem; }
}

.toolrail { background: var(--bg-2); border-bottom: 1px solid var(--line); overflow-x: auto; }
.toolrail-inner { display: flex; align-items: center; gap: .8rem; min-height: 38px; white-space: nowrap; }
.toolrail-label { font-family: var(--mono); font-size: .7rem; color: var(--muted); letter-spacing: .1em; }
.toolrail ul { display: flex; gap: .8rem; list-style: none; margin: 0; padding: 0; }
.toolrail a { font-size: .82rem; color: var(--text-2); }
.toolrail a:hover { color: var(--teal); }

/* ----------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: .5rem 1rem; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--teal); }
.btn-accent { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.btn-accent:hover { background: var(--teal-dark); border-color: var(--teal-dark); color: #fff; }
.btn-sm { min-height: 40px; font-size: .82rem; padding: .25rem .7rem; }
.btn-lg { min-height: 50px; font-size: .98rem; padding-inline: 1.4rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* -------------------------------------------------------------------- hero */

.hero { border-bottom: 1px solid var(--line); padding: 2rem 0 1.7rem; background: linear-gradient(180deg, var(--bg-2), transparent); }
.hero h1 { max-width: 40rem; }
.hero p { max-width: 44rem; color: var(--text-2); }
.readout { display: grid; gap: .6rem; grid-template-columns: repeat(2, minmax(0,1fr)); margin-top: 1.3rem; }
@media (min-width: 52rem) { .readout { grid-template-columns: repeat(4, minmax(0,1fr)); } }
.readout div { border: 1px solid var(--line); background: var(--panel); padding: .65rem .8rem; border-radius: var(--radius); }
.readout b { display: block; font-family: var(--mono); font-size: 1.4rem; color: var(--teal); line-height: 1.3; }
.readout span { font-size: .76rem; color: var(--muted); }

/* ---------------------------------------------------------------- sections */

.section { padding: 2rem 0; }
.section-head { margin-bottom: 1rem; max-width: 46rem; }
.section-head h2 { margin-top: 0; }
.section-head p { color: var(--muted); margin: 0; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.05rem; }
.panel h2:first-child, .panel h3:first-child { margin-top: 0; }

.grid { display: grid; gap: .8rem; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
@media (min-width: 46rem) { .grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 64rem) { .grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem; min-width: 0; }
.card h3 { margin-top: 0; font-size: 1rem; }
.card p { font-size: .89rem; color: var(--text-2); margin-bottom: .5rem; }

.assump {
  border: 1px solid var(--line); border-inline-start: 3px solid var(--teal);
  background: var(--panel); border-radius: var(--radius);
  padding: .75rem .9rem; font-size: .86rem; color: var(--text-2); margin: 1.1rem 0;
}
.assump strong { color: var(--text); }
.assump p:last-child { margin-bottom: 0; }

.warn { border-inline-start-color: var(--amber); }

.data-note { border: 1px dashed var(--line); border-radius: var(--radius); padding: .7rem .9rem; font-size: .84rem; color: var(--muted); margin: 1rem 0; }

/* -------------------------------------------------------------- breadcrumb */

.crumbs { padding: .8rem 0 .1rem; font-size: .78rem; font-family: var(--mono); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .3rem; margin: 0; padding: 0; }
.crumbs li { color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-inline-end: .3rem; color: var(--line); }
.crumbs a { color: var(--muted); }

/* ------------------------------------------------------------------ tables */

.table-scroll { overflow-x: auto; margin: 1rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 40rem; font-size: .86rem; }
caption { text-align: start; font-size: .82rem; color: var(--muted); padding: .6rem .7rem 0; }
th, td { padding: .5rem .6rem; border-bottom: 1px solid var(--line-soft); text-align: start; }
thead th { background: var(--panel-2); font-size: .78rem; color: var(--text-2); white-space: nowrap; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.table-plain { min-width: 0; }
.table-plain th, .table-plain td { white-space: normal; }

th button.sortbtn { background: none; border: 0; font: inherit; font-size: .78rem; font-weight: 600; color: var(--text-2); cursor: pointer; padding: .5rem .35rem; min-height: 40px; }
th button.sortbtn::after { content: " ⇅"; opacity: .5; }
th button.sortbtn[data-sort-dir="desc"]::after { content: " ↓"; color: var(--teal); opacity: 1; }
th button.sortbtn[data-sort-dir="asc"]::after { content: " ↑"; color: var(--teal); opacity: 1; }

/* strategy matrix colouring */
.smx td { text-align: center; font-family: var(--mono); font-weight: 700; padding: .35rem .2rem; }
.smx th { text-align: center; font-size: .76rem; }
.act-H { background: rgba(242, 116, 138, .16); color: #ffb7c2; }
.act-S { background: rgba(77, 220, 156, .14); color: #8ff0c4; }
.act-D { background: rgba(232, 185, 92, .16); color: #f4d79c; }
.act-P { background: rgba(60, 110, 165, .22); color: #b6d3f2; }

.legend { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; padding: 0; margin: .6rem 0 0; font-size: .8rem; }
.legend li { display: flex; align-items: center; gap: .35rem; margin: 0; }
.legend i { width: .9rem; height: .9rem; display: inline-block; border-radius: 2px; }

/* ------------------------------------------------------------------- tools */

.tool { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 1rem; margin: 1.2rem 0; }
.tool h3 { margin-top: 0; }
.tool-grid { display: grid; gap: 1rem; }
@media (min-width: 52rem) { .tool-grid { grid-template-columns: 1fr 15rem; align-items: start; } }

.rank-pad { display: flex; flex-wrap: wrap; gap: .35rem; }
.rank-pad button {
  min-width: 2.6rem; min-height: 44px; padding: .3rem .55rem;
  font-family: var(--mono); font-size: .95rem; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
  border-radius: var(--radius); cursor: pointer;
}
.rank-pad button:hover { border-color: var(--teal); }

.hand-strip { display: flex; flex-wrap: wrap; gap: .3rem; min-height: 3rem; padding: .4rem; border: 1px dashed var(--line); border-radius: var(--radius); margin: .6rem 0; }
.hand-chip {
  display: inline-flex; align-items: center; gap: .3rem; padding: .25rem .55rem;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--mono); font-weight: 700; font-size: .9rem;
}
.hand-chip button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 .1rem; }
.hand-chip button:hover { color: var(--rose); }
.hand-empty { color: var(--muted); font-size: .85rem; align-self: center; }

.readout-box { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); padding: .8rem; display: grid; gap: .5rem; }
.readout-row { display: flex; justify-content: space-between; gap: .6rem; font-size: .86rem; border-bottom: 1px solid var(--line-soft); padding-bottom: .35rem; }
.readout-row:last-child { border-bottom: 0; padding-bottom: 0; }
.readout-row b { font-family: var(--mono); color: var(--teal); }
.readout-row b.is-bad { color: var(--rose); }
.readout-row b.is-good { color: var(--ok); }

.verdict { font-family: var(--mono); font-size: 1.25rem; font-weight: 700; padding: .55rem .8rem; border-radius: var(--radius); text-align: center; border: 1px solid var(--line); }
.verdict.v-H { background: rgba(242, 116, 138, .16); color: #ffb7c2; }
.verdict.v-S { background: rgba(77, 220, 156, .14); color: #8ff0c4; }
.verdict.v-D { background: rgba(232, 185, 92, .16); color: #f4d79c; }
.verdict.v-P { background: rgba(60, 110, 165, .22); color: #b6d3f2; }

.field { margin-bottom: .7rem; }
label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: .2rem; color: var(--text-2); }
input, select, textarea {
  width: 100%; font: inherit; font-size: .9rem; padding: .5rem .6rem; min-height: 44px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text); border-radius: var(--radius);
}
textarea { min-height: 6.5rem; resize: vertical; }
.form-grid { display: grid; gap: .6rem; max-width: 38rem; }
@media (min-width: 42rem) { .form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; } }
.form-status { font-size: .85rem; color: var(--teal); min-height: 1.3rem; }

.steps-log { font-family: var(--mono); font-size: .84rem; display: grid; gap: .25rem; margin-top: .6rem; }
.steps-log span { padding: .25rem .5rem; background: var(--bg-2); border-inline-start: 2px solid var(--line); }

/* ------------------------------------------------------------------ charts */

.bars { display: grid; gap: .35rem; margin: .8rem 0; }
.bar-row { display: grid; grid-template-columns: 4.5rem 1fr 3.2rem; gap: .5rem; align-items: center; font-size: .8rem; }
.bar-label { color: var(--muted); font-family: var(--mono); }
.bar-track { height: 10px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 2px; position: relative; overflow: hidden; }
.bar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; background: linear-gradient(90deg, var(--teal-dark), var(--teal)); }
.bar-fill.is-warm { background: linear-gradient(90deg, #b8722c, var(--amber)); }
.bar-value { font-family: var(--mono); text-align: end; color: var(--text); }

/* ------------------------------------------------------------------ brands */

.brand-logo { display: grid; place-items: center; background: #060b14; border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .55rem; width: 92px; height: 46px; flex: 0 0 auto; }
.brand-logo img { max-height: 32px; width: auto; object-fit: contain; }

.spec-row { display: flex; gap: .8rem; align-items: flex-start; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: .85rem; margin-bottom: .6rem; }
.spec-main { flex: 1 1 14rem; min-width: 0; }
.spec-main h3 { margin: 0 0 .15rem; font-size: 1rem; }
.spec-main p { margin: 0; font-size: .86rem; color: var(--text-2); }
.spec-side { display: grid; gap: .35rem; min-width: 9rem; }
.spec-list { display: flex; flex-wrap: wrap; gap: .3rem; list-style: none; padding: 0; margin: .45rem 0 0; }
.spec-list li { margin: 0; }
.spec { font-family: var(--mono); font-size: .74rem; padding: .12rem .45rem; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); }
.spec b { color: var(--teal); }
.pending { color: var(--muted); font-family: var(--mono); font-size: .8rem; }

/* -------------------------------------------------------------------- faq */

.faq details { border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; background: var(--panel); }
.faq summary { cursor: pointer; padding: .7rem .9rem; font-weight: 600; font-size: .92rem; list-style: none; display: flex; justify-content: space-between; gap: .5rem; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--teal); font-family: var(--mono); }
.faq details[open] summary::after { content: "−"; }
.faq .faq-a { padding: 0 .9rem .8rem; color: var(--text-2); font-size: .9rem; }
.faq .faq-a p:last-child { margin-bottom: 0; }

/* ---------------------------------------------------------------- related */

.related { margin: 1.9rem 0 1rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.related h2 { margin-top: 0; font-size: 1rem; }
.related-list { list-style: none; padding: 0; display: grid; gap: .45rem; }
@media (min-width: 46rem) { .related-list { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.related-list li { margin: 0; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.related-list a { font-weight: 600; font-size: .9rem; }
.related-list span { display: block; font-size: .79rem; color: var(--muted); }

/* --------------------------------------------------------------- comments */

.comment { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .85rem; background: var(--panel); margin-bottom: .5rem; }
.comment-head { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; margin-bottom: .25rem; }
.comment-name { font-weight: 700; font-size: .89rem; }
.comment p { margin: 0 0 .3rem; font-size: .89rem; }
.comment time { font-size: .76rem; color: var(--muted); font-family: var(--mono); }
.comment.is-pending { border-style: dashed; }
.comment-badge { font-size: .7rem; padding: .08rem .45rem; border: 1px solid var(--line); border-radius: 3px; color: var(--muted); }
.stars { font-size: .85rem; }
.stars-on { color: var(--amber); }
.stars-off { color: var(--line); }

/* ------------------------------------------------------------------- misc */

.article { max-width: 46rem; }
.byline { font-size: .79rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding-bottom: .8rem; border-bottom: 1px solid var(--line); font-family: var(--mono); }
.byline-team { font-weight: 700; color: var(--text-2); }
.byline-sep { opacity: .5; }

.toc { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem .9rem; margin: 1.1rem 0 1.5rem; background: var(--panel); }
.toc h2 { margin: 0 0 .35rem; font-size: .88rem; }
.toc h2::before { content: ""; }
.toc ol { margin: 0; padding-inline-start: 1.1rem; }
.toc a { color: var(--text); font-size: .87rem; }

.split-list { display: grid; gap: .7rem; }
@media (min-width: 46rem) { .split-list { grid-template-columns: 1fr 1fr; } }
.list-good li::marker { color: var(--ok); }
.list-bad li::marker { color: var(--rose); }

.steps { counter-reset: s; list-style: none; padding: 0; }
.steps li { counter-increment: s; position: relative; padding-inline-start: 2.2rem; margin-bottom: .8rem; }
.steps li::before { content: counter(s, decimal-leading-zero); position: absolute; inset-inline-start: 0; top: .3rem; font-family: var(--mono); font-size: .8rem; color: var(--teal); }

.game-shell { padding: 1rem 0; }

/* ----------------------------------------------------------------- footer */

.site-foot { margin-top: 2.5rem; background: var(--bg-2); border-top: 1px solid var(--line); padding: 1.9rem 0 1.4rem; }
.foot-grid { display: grid; gap: 1.3rem; grid-template-columns: 1fr; }
@media (min-width: 40rem) { .foot-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 62rem) { .foot-grid { grid-template-columns: repeat(4, 1fr); } }
.foot-col h2 { font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; margin: 0 0 .5rem; color: var(--teal); }
.foot-col h2::before { content: ""; }
.foot-col ul { list-style: none; padding: 0; margin: 0; }
.foot-col li { margin-bottom: .35rem; }
.foot-col a { color: var(--text-2); font-size: .85rem; }
.foot-bottom { margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--line); font-size: .81rem; color: var(--muted); }
.foot-copy { margin: .5rem 0 0; font-family: var(--mono); }

/* -------------------------------------------------------------------- 404 */

.err-wrap { text-align: center; padding: 3rem 0 1.5rem; }
.err-code { font-family: var(--mono); font-size: clamp(3rem, 12vw, 5rem); color: var(--teal); line-height: 1; margin: 0; }

[hidden] { display: none !important; }
