/* VIPER Survival Lab — shell styles. Built on the site's Modernist tokens
   (public/css/site.css): light ground, ink text, red accent, square corners,
   Archivo. Tab-specific styles live in build.css / analyze.css /
   sessions.css / report.css; print rules for the report live in report.css. */

.lab-page {
  /* Semantic roles for the tool, mapped onto the site palette. Never rely on
     hue alone: every coloured value also carries a sign, label or icon. */
  --lab-panel: #fbfafa;
  --lab-panel-2: var(--color-surface);
  --lab-line: color-mix(in srgb, var(--color-text) 18%, transparent);
  --lab-line-strong: var(--color-divider);
  --lab-muted: color-mix(in srgb, var(--color-text) 66%, transparent);
  --lab-win: #1d6b45;          /* net-positive outcomes */
  --lab-win-bg: #e3f1e9;
  --lab-push: #4a5a70;         /* break-even pushes */
  --lab-push-bg: #e6eaf0;
  --lab-loss: var(--color-accent-700); /* net-negative outcomes */
  --lab-loss-bg: var(--color-accent-100);
  --lab-caution: #8a5a00;
  --lab-caution-bg: #fbf0d9;
  /* The felt keeps real table colours. */
  --felt: #0f5b3a;
  --felt-edge: #0a4129;
  --felt-line: rgba(255, 255, 255, 0.78);
  --pocket-red: #c0262d;
  --pocket-black: #1d1d1f;
  --pocket-green: #15803d;
  --chip-ink: #201e1d;
}

/* — skip link (first focus stop on the page) — */
.lab-skip {
  position: absolute; left: 12px; top: 8px; z-index: 50; padding: 10px 14px;
  background: var(--color-text); color: var(--color-bg); font-weight: 700; font-size: 14px; text-decoration: none;
  transform: translateY(-200%);
}
.lab-skip:focus { transform: none; outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* — hero — compact, so the workbench starts on the first screen, and on the
   same container as .lab-app so headline and workbench share a left edge. */
.lab-page .lab-hero-wrap { max-width: 1480px; padding: 0 clamp(12px, 2.4vw, 32px); }
.lab-hero { padding: 28px 0 20px; }
.lab-hero-eyebrow { margin-bottom: 10px; }
.lab-hero-title {
  font-size: clamp(30px, 3.6vw, 44px); line-height: 1.06; letter-spacing: -0.02em;
  margin: 0 0 0 -0.04em; max-width: 20ch;
}
.lab-hero-sub {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: clamp(17px, 1.7vw, 20px); line-height: 1.3; color: var(--color-accent-700); margin: 10px 0 0;
}
.lab-hero-body { font-size: 15.5px; line-height: 25px; max-width: 64ch; margin: 14px 0 0; color: color-mix(in srgb, var(--color-text) 82%, transparent); }
@media (min-width: 961px) {
  /* Two columns: headline left, the explanation and trust row right. */
  .lab-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 clamp(32px, 4vw, 64px); align-items: end; }
  .lab-hero-body { margin-top: 0; }
}
@media (max-width: 560px) {
  .lab-hero { padding: 20px 0 16px; }
  .lab-hero-body { font-size: 15px; line-height: 23px; }
}
.lab-trust { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 14px 0 0; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.lab-trust li { display: inline-flex; align-items: center; gap: 8px; }
.lab-trust li::before { content: ""; width: 7px; height: 7px; background: var(--color-accent); }

/* — app frame — wider than .page: the felt needs room on desktop. */
.lab-app { max-width: 1480px; margin: 0 auto; padding: 0 clamp(12px, 2.4vw, 32px) 56px; }
.lab-noscript { border: 2px solid var(--color-divider); padding: 18px; font-size: 15px; }
.lab-grid {
  display: grid; gap: 16px; align-items: start;
  grid-template-columns: 250px minmax(0, 1fr) 290px;
  grid-template-areas: "settings main slip";
}
.lab-col-settings { grid-area: settings; }
.lab-col-main { grid-area: main; min-width: 0; }
.lab-col-slip { grid-area: slip; }
@media (min-width: 1181px) {
  /* No inner scroller: main.js sets --lab-stick-top (negative for a column
     taller than the viewport) so the column scrolls with the page until its
     bottom is in view, then holds; its last button is always reachable. */
  .lab-col-settings, .lab-col-slip { position: sticky; top: var(--lab-stick-top, 12px); }
}
@media (max-width: 1180px) {
  /* Tablet: assumptions stay first on the left (as on desktop); the slip
     follows the workbench (as on phones) instead of a mostly empty column. */
  .lab-grid { grid-template-columns: 250px minmax(0, 1fr); grid-template-areas: "settings main" "settings slip"; }
}
@media (max-width: 860px) {
  .lab-grid { grid-template-columns: minmax(0, 1fr); grid-template-areas: "settings" "main" "slip"; }
}

/* — cards / panels — */
.lab-card { background: var(--lab-panel); border: 1px solid var(--lab-line); padding: 18px; }
.lab-card + .lab-card { margin-top: 16px; }
.lab-card-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 18px; line-height: 1.2; letter-spacing: -0.01em; margin: 0 0 6px;
}
.lab-card-sub { font-size: 13px; line-height: 19px; color: var(--lab-muted); margin: 0 0 12px; }
.lab-kicker { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lab-muted); margin: 0 0 4px; }
.lab-section-title {
  font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 20px; line-height: 1.2; margin: 0 0 4px;
}

/* — tabs — */
.lab-tabs {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--lab-line-strong); background: var(--lab-panel); margin-bottom: 16px;
  container: lab-tabs / inline-size;
}
.lab-tabs [role="tab"] {
  position: relative; /* contains the visually hidden long label on phones */
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-family: var(--font-heading); font-weight: var(--font-heading-weight);
  font-size: 14px; line-height: 1.2; color: var(--color-text);
  padding: 14px 10px; min-height: 48px; text-align: center;
}
.lab-tabs [role="tab"] + [role="tab"] { border-left: 1px solid var(--lab-line); }
.lab-tabs [role="tab"]:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.lab-tabs [role="tab"][aria-selected="true"] { background: var(--color-text); color: var(--color-bg); }
.lab-tabs [role="tab"]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -4px; }
.lab-tab-num { font-feature-settings: 'tnum' 1; opacity: 0.7; margin-right: 6px; }
.lab-tab-short { display: none; }
/* Live progress (main.js renderSteps): a status line under each label, a check
   on finished steps, and a "Next" marker on the recommended next tab. Static:
   no transition or animation. The words are also each tab's description. */
.lab-tab-label, .lab-tab-meta { display: block; }
.lab-tab-check { margin-left: 6px; color: var(--lab-win); font-weight: 700; }
.lab-tabs [role="tab"][aria-selected="true"] .lab-tab-check { color: inherit; }
/* The status and the Next marker share ONE fixed-height line, so the bar is the
   same height in every state: placing the first chip must never push the felt
   down under the cursor. A status that does not fit ends in an ellipsis. */
.lab-tab-meta {
  display: flex; justify-content: center; align-items: center; gap: 6px; height: 16px; white-space: nowrap;
  margin-top: 4px; font-family: var(--font-body, inherit); font-weight: 400; font-size: 12px; line-height: 16px;
  color: var(--lab-muted); font-feature-settings: 'tnum' 1;
}
.lab-tab-status { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* Four tabs under ~190px each: "97.3% of spins lose" + Next does not fit, so the
   Next tab shows "97.3% lose" (the full words stay in its description). */
@container lab-tabs (max-width: 780px) {
  .lab-tab-next .lab-tab-more { display: none; }
}
/* The label is one line too ("01 Build layout ✓" must not wrap when the check
   appears); below ~145px a tab drops its step number to keep the words. */
.lab-tab-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@container lab-tabs (max-width: 580px) {
  .lab-tab-num { display: none; }
}
.lab-tabs [role="tab"][aria-selected="true"] .lab-tab-meta { color: color-mix(in srgb, var(--color-bg) 82%, transparent); }
.lab-tab-nextmark {
  flex: none; display: inline-block; padding: 0 5px; border: 1px solid var(--color-accent-700);
  color: var(--color-accent-700); font-size: 10px; line-height: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.lab-tab-nextmark[hidden] { display: none; }
.lab-tabs [role="tab"].lab-tab-next { box-shadow: inset 0 -2px 0 var(--color-accent); }
@media (max-width: 560px) {
  /* One line per tab keeps the sticky bar about 48px tall. The short word is
     what sighted users see; the full label stays the accessible name. */
  .lab-tabs { position: sticky; top: 0; z-index: 5; }
  .lab-tabs [role="tab"] { font-size: 12.5px; padding: 8px 2px; min-height: 46px; white-space: nowrap; }
  .lab-tab-num { font-size: 11px; margin-right: 3px; }
  .lab-tab-full { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lab-tab-short { display: inline; }
  /* The status line lives on in each tab's description; on the sticky bar only
     the check and a one-word Next line under the label stay, so it stays compact. */
  .lab-tab-status { display: none; }
  .lab-tab-meta { margin-top: 2px; height: 13px; line-height: 12px; }
  .lab-tab-nextmark { padding: 0 3px; font-size: 9px; line-height: 11px; letter-spacing: 0.06em; }
  .lab-tab-check { margin-left: 3px; }
}
@media (max-width: 400px) {
  /* Four words in four 74px columns: the step numbers no longer fit beside them. */
  .lab-tab-num { display: none; }
}
.lab-panel:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }

/* — "Next step" bar at the foot of a tab: what to do next, one primary action. */
.lab-nextstep {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px;
  margin-top: 16px; padding: 16px 18px; border: 2px solid var(--color-text); background: var(--lab-panel);
}
.lab-nextstep-text { flex: 1 1 260px; min-width: 0; }
.lab-nextstep-text p { margin: 0; }
.lab-nextstep-kicker { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--lab-muted); margin-bottom: 4px !important; }
.lab-nextstep-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 17px; line-height: 1.25; }
.lab-nextstep-sub { font-size: 15px; line-height: 22px; }
.lab-nextstep-pending { border-width: 1px; border-color: var(--lab-line-strong); }
@media (max-width: 560px) {
  .lab-nextstep .btn { width: 100%; justify-content: center; }
}

/* — controls — */
.lab-field { display: block; margin: 0 0 12px; }
.lab-field > span, .lab-label { display: block; font-size: 12.5px; font-weight: 600; margin: 0 0 5px; }
.lab-field .input, .lab-field select { width: 100%; }
.lab-page .input, .lab-page select.input { background: #fff; }
.lab-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lab-help { font-size: 12.5px; line-height: 18px; color: var(--lab-muted); margin: 4px 0 0; }
.lab-error { font-size: 13px; line-height: 19px; color: var(--lab-loss); font-weight: 600; margin: 6px 0 0; }
.lab-error:empty { display: none; }
.btn-sm { font-size: 13px; padding: 6px 10px; min-height: 36px; }
.lab-btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lab-page .btn { min-height: 40px; }
.lab-danger { background: var(--color-accent-700); }
@media (max-width: 860px) {
  /* 16px inputs stop iOS zooming the page on focus; 44px touch targets. */
  .lab-page .input, .lab-page select, .lab-page textarea { font-size: 16px; min-height: 44px; }
  .lab-page .btn { min-height: 44px; }
  /* The same 44 x 44 floor for every text-style control the tabs render
     (tappable bet names, link and text buttons, segmented options, the
     settings disclosures). Prefixed so it outranks the tab sheets' base rules. */
  .lab-page .lab-slip-name, .lab-page .lab-betlist-name, .lab-page .lab-textbtn,
  .lab-page .lab-linkbtn, .lab-page .lab-an-seg-btn { min-height: 44px; min-width: 44px; }
  .lab-page .lab-slip-name, .lab-page .lab-betlist-name { padding-block: 4px; }
  .lab-page .lab-an-seg-btn { justify-content: center; }
  .lab-page .lab-col-settings summary { min-height: 44px; }
}

/* — status banners, toasts, stale marker — */
.lab-banner { border: 2px solid var(--lab-line-strong); background: var(--lab-panel); padding: 14px 16px; margin: 0 0 16px; }
.lab-banner p { margin: 0; font-size: 14px; line-height: 21px; }
.lab-banner-title { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 16px !important; margin-bottom: 4px !important; }
.lab-banner-warn { border-color: var(--lab-caution); background: var(--lab-caution-bg); }
.lab-banner-info { border-color: var(--color-text); }
.lab-load-notice { position: relative; padding-right: 108px; }
.lab-load-notice-close { position: absolute; top: 10px; right: 10px; }
@media (max-width: 560px) {
  .lab-load-notice { padding-right: 16px; }
  .lab-load-notice-close { position: static; margin-top: 10px; }
}
.lab-stale {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; color: var(--lab-caution);
  background: var(--lab-caution-bg); padding: 3px 8px;
}
.lab-note { font-size: 13px; line-height: 20px; color: var(--lab-muted); }
.lab-keypoint { border-left: 4px solid var(--lab-caution); background: var(--lab-caution-bg); padding: 10px 12px; font-size: 13.5px; line-height: 20px; }
.lab-keypoint strong { color: var(--color-text); }
.lab-copyfield { width: 100%; font: 13px/1.4 ui-monospace, Consolas, monospace; padding: 8px; border: 1px solid var(--lab-line-strong); background: #fff; resize: vertical; }

/* — metrics — */
.lab-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.lab-kpi { background: var(--lab-panel); border: 1px solid var(--lab-line); padding: 12px 14px; }
.lab-kpi-label { font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--lab-muted); margin: 0 0 6px; }
.lab-kpi-value { font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 24px; line-height: 1.1; font-feature-settings: 'tnum' 1; margin: 0; }
.lab-kpi-note { font-size: 12px; line-height: 17px; color: var(--lab-muted); margin: 6px 0 0; }
.lab-pos { color: var(--lab-win); }
.lab-neg { color: var(--lab-loss); }
.lab-zero { color: var(--lab-push); }
.lab-num { font-feature-settings: 'tnum' 1; }

/* — tables — */
/* position: relative makes the wrapper the containing block of anything
   absolutely positioned inside the table (e.g. a .lab-sr header label), so it
   scrolls inside the wrapper instead of widening the page. */
.lab-table-wrap { position: relative; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.lab-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-feature-settings: 'tnum' 1; }
.lab-table caption { text-align: left; font-size: 12.5px; color: var(--lab-muted); padding: 0 0 6px; caption-side: top; }
.lab-table th { text-align: left; font-size: 11.5px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600; padding: 8px; border-bottom: 2px solid var(--lab-line-strong); color: var(--lab-muted); }
.lab-table td { padding: 8px; border-bottom: 1px solid var(--lab-line); vertical-align: top; }
.lab-table .r, .lab-table th.r { text-align: right; }

/* — dialogs — */
.lab-dialog { border: 2px solid var(--color-text); padding: 22px; max-width: min(520px, calc(100vw - 32px)); background: var(--color-bg); color: var(--color-text); }
.lab-dialog::backdrop { background: rgba(32, 30, 29, 0.45); }
.lab-dialog-title { font-size: 20px; margin: 0 0 10px; }
.lab-dialog-body { font-size: 14px; line-height: 21px; }
.lab-dialog-body ul { margin: 8px 0; padding-left: 20px; }
.lab-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* — learn / SEO sections under the app — */
.lab-learn { padding: 28px 0 56px; border-top: 2px solid var(--color-divider); }
.lab-learn-title { font-size: clamp(24px, 3vw, 34px); line-height: 1.15; margin: 0 0 24px; max-width: 30ch; }
.lab-learn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 28px clamp(24px, 4vw, 56px); }
.lab-learn-item h3 { font-size: 19px; line-height: 1.25; margin: 0 0 8px; }
.lab-learn-item p { font-size: 15px; line-height: 26px; margin: 0; color: color-mix(in srgb, var(--color-text) 82%, transparent); }
.lab-faq-title { margin-top: 48px; }
.lab-faq details { border-top: 1px solid var(--lab-line-strong); padding: 14px 0; max-width: 80ch; }
.lab-faq details:last-child { border-bottom: 1px solid var(--lab-line-strong); }
.lab-faq summary { cursor: pointer; font-family: var(--font-heading); font-weight: var(--font-heading-weight); font-size: 16.5px; line-height: 1.35; min-height: 28px; }
.lab-learn-item p a, .lab-faq p a { color: var(--color-accent-700); text-underline-offset: 3px; }
.lab-faq p { font-size: 15px; line-height: 26px; margin: 10px 0 0; color: color-mix(in srgb, var(--color-text) 82%, transparent); }

/* — utilities — */
.lab-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.lab-page [hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  .lab-page *, .lab-page *::before, .lab-page *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
