:root {
  --bg: #f2f4f5;
  --surface: #ffffff;
  --surface-2: #e3e8ec;
  --surface-3: #0f1f2e;
  --ink: #111b24;
  --muted: #4a5a68;
  --accent: #b45309;
  --accent-hover: #92400e;
  --accent-ink: #ffffff;
  --link: #92400e;
  --ok-bg: #e2f3ea;
  --ok-ink: #0b4a2f;
  --warn-bg: #fdf0e3;
  --warn-ink: #7a3410;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-head: "Space Grotesk", "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --step-small: clamp(0.85rem, 0.83rem + 0.1vw, 0.92rem);
  --step-body: clamp(1.02rem, 0.99rem + 0.18vw, 1.1rem);
  --step-lead: clamp(1.14rem, 1.08rem + 0.22vw, 1.24rem);
  --step-h2: clamp(1.45rem, 1.2rem + 1.2vw, 2.05rem);
  --step-head: clamp(2.2rem, 1.5rem + 3.2vw, 3.9rem);
  --gap: 8px;
  --pad: 20px;
  --max-w: 1392px;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); font-family: var(--font-sans); font-size: 16px; line-height: 1.5; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: var(--step-body); overflow-x: clip; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--accent-hover); }
a:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, h4 { margin: 0 0 0.44em; font-family: var(--font-head); font-weight: 600; color: inherit; }
h1 { font-size: var(--step-head); line-height: 0.98; letter-spacing: -0.04em; }
h2 { font-size: var(--step-h2); line-height: 1.06; letter-spacing: -0.03em; }
h3, h4 { font-size: var(--step-lead); line-height: 1.2; }
p, ul, ol, dl, table, pre, blockquote { margin: 0 0 0.95rem; }
p, li { max-width: 66ch; overflow-wrap: anywhere; }
p:last-child, ul:last-child, ol:last-child { margin-bottom: 0; }
code, pre { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--step-small); }
p code, li code, td code, summary code { background: var(--surface-2); color: var(--ink); padding: 0.12em 0.38em; }
pre { max-width: 100%; background: var(--surface-2); color: var(--ink); padding: 0.95rem 1.1rem; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.48; }

.board-shell { width: 100%; max-width: var(--max-w); margin: 0 auto; padding: 14px 20px; }
.top-bar { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--gap); margin-bottom: var(--gap); }
.brand-tile { background: var(--surface-3); color: #ffffff; padding: 12px 18px; min-height: 46px; display: inline-flex; align-items: center; font-weight: 700; font-size: var(--step-body); text-decoration: none; letter-spacing: -0.02em; }
.brand-tile:hover { background: var(--accent); color: #ffffff; }
.nav-tile { background: var(--surface); padding: 8px 18px; min-height: 46px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.nav-tile a { color: var(--ink); text-decoration: none; font-size: var(--step-small); font-weight: 500; }
.nav-tile a:hover, .nav-tile a[aria-current="page"] { color: var(--accent); text-decoration: underline; }
.cta-tile { background: var(--accent); color: #ffffff; padding: 12px 20px; min-height: 46px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: var(--step-small); text-decoration: none; }
.cta-tile:hover { background: var(--accent-hover); color: #ffffff; }

.board-section { margin-top: clamp(44px, 5vw, 76px); }
.board-section--first { margin-top: 0; }
.tile-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.tile { background: var(--surface); color: var(--ink); padding: 22px; display: flex; flex-direction: column; justify-content: space-between; min-width: 0; }
.tile--top { justify-content: flex-start; }
.tile-elev { background: var(--surface-2); color: var(--ink); }
.tile-accent { background: var(--accent); color: #ffffff; }
.tile-photo { padding: 0; position: relative; overflow: hidden; background: var(--surface); min-height: 240px; }
.tile-photo img { width: 100%; height: 100%; min-height: 240px; max-height: 265px; object-fit: cover; display: block; }
.photo-strip { background: #101b27; color: #ffffff; padding: 8px 14px; font-size: var(--step-small); line-height: 1.35; }

.c-12 { grid-column: span 12; }
.c-8  { grid-column: span 8; }
.c-7  { grid-column: span 7; }
.c-6  { grid-column: span 6; }
.c-5  { grid-column: span 5; }
.c-4  { grid-column: span 4; }
.c-3  { grid-column: span 3; }
.c-2  { grid-column: span 2; }

.hero-lead { font-size: clamp(1.02rem, 0.98rem + 0.18vw, 1.12rem); line-height: 1.46; color: var(--ink); margin: 0.55rem 0 0.75rem; max-width: 62ch; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.btn-primary { background: var(--accent); color: #ffffff; padding: 11px 20px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: var(--step-small); text-decoration: none; border: 0; cursor: pointer; font-family: var(--font-sans); }
.btn-primary:hover { background: var(--accent-hover); color: #ffffff; }
.btn-ghost { background: var(--surface-2); color: var(--ink); padding: 11px 16px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; font-weight: 500; font-size: var(--step-small); text-decoration: none; border: 1px solid rgba(16, 27, 39, 0.14); cursor: pointer; font-family: var(--font-sans); }
.btn-ghost:hover { background: var(--surface-3); color: #ffffff; }
.stat-note { font-size: var(--step-small); color: var(--muted); margin: 0; }
.stat-bar { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 8px; margin-top: 12px; }
.stat-pill { background: var(--surface-2); padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; }
.stat-pill span { font-size: var(--step-small); color: var(--muted); }
.stat-pill strong { font-size: 0.98rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* Interactive UI Split & SUS Matrix */
[data-ui].ui-split { display: grid; grid-template-columns: minmax(0, 56fr) minmax(0, 44fr); background: var(--surface); color: var(--ink); border: 1px solid rgba(16, 27, 39, 0.14); }
[data-ui] .ui-controls { padding: 18px; background: var(--surface-2); display: flex; flex-direction: column; gap: 12px; }
[data-ui] .ui-output { padding: 20px; background: var(--surface); display: flex; flex-direction: column; justify-content: flex-start; gap: 14px; }
[data-ui] .ctrl-field { display: flex; flex-direction: column; gap: 5px; }
[data-ui] .ctrl-field label { font-size: var(--step-small); font-weight: 600; color: var(--ink); }
[data-ui] select, [data-ui] input[type="number"], [data-ui] input[type="text"], [data-ui] textarea {
  width: 100%; min-height: 42px; padding: 8px 12px; background: #ffffff; color: var(--ink);
  border: 1px solid rgba(16, 27, 39, 0.22); font-family: var(--font-sans); font-size: var(--step-small); font-variant-numeric: tabular-nums;
}
[data-ui] textarea { min-height: 150px; font-family: var(--font-mono); line-height: 1.4; resize: vertical; }
[data-ui] .ui-kpi-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
[data-ui] .ui-kpi { background: var(--surface-2); padding: 12px 14px; }
[data-ui] .ui-kpi span { display: block; font-size: var(--step-small); color: var(--muted); margin-bottom: 3px; }
[data-ui] .ui-kpi strong { display: block; font-size: 1.32rem; font-weight: 700; font-variant-numeric: tabular-nums; }
[data-ui] .ui-verdict { background: var(--surface-2); padding: 14px 16px; border-left: 4px solid var(--accent); }
[data-ui] .ui-verdict.is-warn { background: var(--warn-bg); color: var(--warn-ink); border-left-color: #c2410c; }
[data-ui] .ui-verdict.is-ok { background: var(--ok-bg); color: var(--ok-ink); border-left-color: #0f766e; }
[data-ui] .ui-verdict strong { display: block; font-size: var(--step-body); margin-bottom: 4px; }
[data-ui] .ui-verdict p { font-size: var(--step-small); margin: 0; max-width: none; }


.meter-bar { width: 100%; height: 18px; background: var(--surface-2); position: relative; overflow: hidden; }
.meter-fill { height: 100%; background: var(--accent); transition: width 180ms ease-out; }

.next-row-title { font-size: var(--step-lead); margin-bottom: 10px; }
.next-card { text-decoration: none; gap: 8px; border: 1px solid rgba(16, 27, 39, 0.08); }
.next-card:hover { border-color: var(--accent); }
.next-q { font-weight: 600; color: var(--ink); font-size: 0.96rem; }
.next-a { font-size: var(--step-small); color: var(--muted); }
.next-go { font-size: var(--step-small); font-weight: 600; color: var(--accent); margin-top: auto; }

.table-wrap { width: 100%; overflow-x: auto; background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: var(--step-small); font-variant-numeric: tabular-nums; margin: 0; }
th, td { text-align: start; padding: 11px 13px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
th { background: var(--surface-2); font-weight: 600; color: var(--ink); }

.faq-layout { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--gap); align-items: start; }
.faq-sticky { position: sticky; top: 24px; padding-right: 12px; }
.faq-sticky p { color: var(--muted); margin-top: 8px; font-size: var(--step-small); }
.faq-stack { display: flex; flex-direction: column; gap: var(--gap); }
.faq-tile { background: var(--surface); color: var(--ink); }
.faq-tile summary { list-style: none; padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; gap: 14px; font-weight: 600; cursor: pointer; }
.faq-tile summary::-webkit-details-marker { display: none; }
.faq-plus { width: 14px; height: 14px; position: relative; flex-shrink: 0; }
.faq-plus::before, .faq-plus::after { content: ""; position: absolute; background: currentColor; }
.faq-plus::before { top: 6px; left: 0; width: 14px; height: 2px; }
.faq-plus::after { top: 0; left: 6px; width: 2px; height: 14px; }
.faq-tile[open] { background: var(--surface-3); color: #ffffff; }
.faq-tile[open] .faq-plus::after { display: none; }
.faq-ans { padding: 0 20px 18px; font-size: var(--step-small); line-height: 1.5; }

.ad-slot { margin: 12px 0; background: var(--surface); padding: 6px 10px; overflow: hidden; }
.ad-leader, .ad-300 { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 68px; }
.ad-n, .ad-native { display: block; width: 100%; text-align: center; }
.ad-slot-label { display: block; font-size: 0.78rem; color: var(--muted); margin-bottom: 4px; }
.ad-slot-pending { display: none; }

.footer-board { margin-top: clamp(56px, 7vw, 104px); display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--gap); }
.footer-wordmark { background: var(--surface-3); color: #ffffff; padding: 24px; display: flex; align-items: flex-end; min-height: 176px; }
.footer-wordmark span { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: clamp(1.8rem, 4.6vw, 4rem); font-weight: 700; line-height: 0.9; letter-spacing: -0.04em; }
.footer-cta-tile { background: var(--accent); color: #ffffff; padding: 22px; min-height: 176px; text-decoration: none; display: flex; flex-direction: column; justify-content: space-between; }
.footer-cta-tile:hover { background: var(--accent-hover); color: #ffffff; }
.footer-cta-tile strong { font-size: var(--step-lead); line-height: 1.18; }
.footer-cta-arrow { align-self: flex-end; }
.footer-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 7px; }
.footer-list a { text-decoration: none; color: var(--ink); font-size: var(--step-small); }
.footer-list a:hover { color: var(--accent); text-decoration: underline; }

.board-section--first h1 { font-size: clamp(1.9rem, 1.35rem + 2.1vw, 2.75rem); margin-bottom: 0.3em; }
.board-section--first .tile { padding: 16px 20px; }

/* Brand, kicker, numerals */
.brand-tile { gap: 10px; font-family: var(--font-head); }
.brand-mark { font-family: var(--font-mono); font-size: 0.78rem; background: var(--accent); color: #ffffff; padding: 3px 6px; letter-spacing: 0.06em; font-variant-numeric: tabular-nums; }
.kicker { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-hover); margin: 0 0 0.6rem; }
.num, .stat-pill strong, td code, .code-cell { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.footer-brand { font-family: var(--font-head); font-size: var(--step-lead); font-weight: 600; margin-bottom: 8px; }
.footer-head { margin-bottom: 10px; display: block; font-family: var(--font-head); }
.tool-sub { font-size: var(--step-body); margin: 0; text-transform: uppercase; letter-spacing: 0.06em; font-family: var(--font-mono); color: var(--muted); }

/* Chips, badges */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-family: var(--font-sans); font-size: 0.84rem; font-weight: 600; padding: 8px 12px; min-height: 38px; background: #ffffff; color: var(--ink); border: 1px solid rgba(17, 27, 36, 0.2); cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip.is-on { background: var(--surface-3); color: #ffffff; border-color: var(--surface-3); }
.badge { display: inline-block; font-family: var(--font-mono); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 7px; white-space: nowrap; }
.badge-fixed { background: var(--surface-3); color: #ffffff; }
.badge-random { background: #fde7cf; color: var(--accent-hover); }
.btn-mini { font-size: 0.74rem; font-weight: 600; padding: 3px 8px; margin-left: 6px; background: #ffffff; border: 1px solid rgba(17, 27, 36, 0.24); cursor: pointer; font-family: var(--font-sans); }
.btn-mini:hover { background: var(--accent); color: #ffffff; border-color: var(--accent); }

/* Safe finder cards */
.loc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.loc-card { background: #ffffff; border: 1px solid rgba(17, 27, 36, 0.14); border-top: 4px solid var(--surface-3); padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.loc-card[data-type="random"] { border-top-color: var(--accent); }
.loc-card:hover, .loc-card.is-active { outline: 2px solid var(--accent); outline-offset: -2px; }
.loc-card.is-done { background: var(--ok-bg); }
.loc-card[hidden] { display: none; }
.loc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.loc-head h3 { font-size: 1rem; margin: 0; }
.code-big { font-family: var(--font-mono); font-weight: 700; font-size: 1.9rem; letter-spacing: 0.14em; font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.1; }
.code-random { color: var(--accent); }
.loc-where, .loc-tip { font-size: 0.82rem; line-height: 1.4; margin: 0; }
.loc-check { font-size: 0.82rem; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* Keypad */
.keypad-wrap { background: var(--surface-3); color: #ffffff; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.keypad-target span { display: block; font-size: 0.78rem; color: #b8c4cf; }
.keypad-target strong { font-family: var(--font-head); }
.keypad-display { font-family: var(--font-mono); font-weight: 700; font-size: 2.4rem; letter-spacing: 0.4em; text-align: center; background: #07121c; color: #fbbf24; padding: 10px 0 10px 0.4em; font-variant-numeric: tabular-nums; border: 1px solid #1f3446; }
.keypad-display.is-good { color: #4ade80; }
.keypad-display.is-bad { color: #f87171; }
.keypad { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.key { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; min-height: 48px; background: #1b2f42; color: #ffffff; border: 1px solid #2c4459; cursor: pointer; }
.key:hover { background: #24405a; }
.key:active { transform: translateY(1px); }
.key-fn { font-size: 0.82rem; color: #fbbf24; }
.keypad-enter { width: 100%; }
.progress-box { display: flex; flex-direction: column; gap: 8px; }
.progress-label { display: flex; justify-content: space-between; font-size: var(--step-small); }
.progress-label strong { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.attempt-log { list-style: none; padding: 0; margin: 0; font-family: var(--font-mono); font-size: 0.78rem; max-height: 120px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.attempt-log li { background: var(--surface-2); padding: 4px 8px; max-width: none; }

/* Schematics */
.plan-wrap { background: #ffffff; border: 1px solid rgba(17, 27, 36, 0.14); padding: 8px; }
.plan { width: 100%; height: auto; display: block; background: #f8fafb; }
.plan-note { font-size: 0.78rem; color: var(--muted); margin: 6px 0 0; }
.plan-wall { fill: none; stroke: var(--surface-3); stroke-width: 3; }
.plan text { font-family: var(--font-sans); font-size: 11px; fill: var(--ink); text-anchor: middle; pointer-events: none; }
.plan .room-label { font-size: 10px; fill: var(--muted); }
.plan .furn { fill: var(--surface-2); stroke: #9aa8b4; stroke-width: 1; }
.plan .safe-box { fill: var(--surface-3); }
.plan .safe-txt { fill: #ffffff; font-size: 9px; font-family: var(--font-mono); }
.spot { cursor: pointer; }
.spot circle { fill: #ffffff; stroke: var(--accent); stroke-width: 3; }
.spot text { font-family: var(--font-mono); font-weight: 700; font-size: 12px; fill: var(--accent-hover); }
.spot.is-active circle { fill: var(--accent); }
.spot.is-active text { fill: #ffffff; }
.spot.is-checked circle { fill: #0f766e; stroke: #0f766e; }
.spot.is-checked text { fill: #ffffff; }
.zone { cursor: pointer; }
.zone rect { fill: var(--surface-2); stroke: #7d8d9a; stroke-width: 1.5; }
.zone:hover rect, .zone:focus rect { fill: #fde7cf; }
.zone.is-visited rect { fill: #d7ecdf; stroke: #0f766e; }
.zone-key rect { stroke: var(--accent); stroke-width: 2.5; }
.zone-key.is-visited rect { fill: var(--accent); }
.zone-key.is-visited text { fill: #ffffff; }
.spot-list { margin: 0; padding-left: 1.3em; font-size: 0.86rem; display: flex; flex-direction: column; gap: 6px; }
.spot-list li { max-width: none; }
.spot-list label { display: inline-flex; gap: 6px; align-items: flex-start; cursor: pointer; }
.path-track { display: flex; flex-wrap: wrap; gap: 4px; font-family: var(--font-mono); font-size: 0.76rem; }
.path-track span { background: var(--surface-3); color: #ffffff; padding: 3px 7px; }

/* Check grids & route */
.check-grid { display: flex; flex-direction: column; gap: 6px; }
.check-grid label { display: flex; gap: 8px; align-items: flex-start; font-size: 0.88rem; background: #ffffff; padding: 8px 10px; border: 1px solid rgba(17, 27, 36, 0.1); cursor: pointer; }
.check-grid input { margin-top: 3px; accent-color: var(--accent); }
.route-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; counter-reset: stop; }
.route-list li { background: #ffffff; border: 1px solid rgba(17, 27, 36, 0.14); padding: 10px 12px; display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; max-width: none; }
.route-list li.is-current { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.route-list li.is-done { background: var(--ok-bg); }
.route-num { font-family: var(--font-mono); font-weight: 700; background: var(--surface-3); color: #ffffff; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; }
.route-code { font-family: var(--font-mono); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.1em; }
.cash-input { width: 110px !important; min-height: 34px !important; padding: 4px 8px !important; }

/* Code filter */
[data-ui].ui-stack { background: var(--surface); border: 1px solid rgba(17, 27, 36, 0.14); padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.filter-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; }
tr[hidden] { display: none; }
tr.is-match td { background: #fde7cf; }
.code-random-txt { color: var(--accent-hover); font-weight: 600; font-size: 0.84rem; }

@media (max-width: 980px) {
  .filter-bar { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .loc-grid { grid-template-columns: 1fr; }
  .keypad-display { font-size: 2rem; }
}

@media (max-width: 980px) {
  .top-bar { grid-template-columns: 1fr auto; }
  .nav-tile { grid-column: 1 / -1; order: 3; }
  .c-3, .c-2 { grid-column: span 6; }
  [data-ui].ui-split, .faq-layout { grid-template-columns: 1fr; }
  .faq-sticky { position: static; }
}
@media (max-width: 680px) {
  .board-shell { padding: 10px 14px; }
  .tile-grid, .footer-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .c-12, .c-8, .c-7, .c-6, .c-5, .c-4 { grid-column: span 2; }
  .c-3, .c-2 { grid-column: span 1; }
    .board-section--first .tile-photo img { max-height: 165px; }
}
@media print {
  .top-bar, .ad-slot, .next-row, .footer-board, [data-no-print] { display: none !important; }
  body, .board-shell, .tile { background: #ffffff !important; padding: 0 !important; }
  [data-ui].ui-split { grid-template-columns: 1fr !important; border: 1px solid #000 !important; }
}
