:root {
  color-scheme: light dark;
  --orange: #ff6400;
  --orange-pressed: #d95400;
  --carbon: #0b0d10;
  --graphite: #1f2329;
  --ink: #15171b;
  --muted: #666d78;
  --line: #d7d9de;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --page: #e9eaed;
  --success: #18864b;
  --danger: #c53434;
  --info: #2673d9;
  --radius: 8px;
  --shadow: 0 14px 40px rgba(11, 13, 16, 0.11);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--page); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--page); }
button, input, textarea { font: inherit; }
button { letter-spacing: 0; }
a { color: inherit; }

.app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 58px;
  padding: 9px max(16px, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: white;
  background: rgba(11, 13, 16, 0.96);
  border-bottom: 1px solid rgba(255,255,255,.1);
  backdrop-filter: blur(14px);
}

.brand { display: inline-flex; align-items: center; gap: 10px; color: white; text-decoration: none; font-weight: 800; }
.brand-mark { width: 32px; height: 32px; display: grid; place-items: center; border: 2px solid var(--orange); border-radius: 50%; position: relative; }
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: var(--orange); }
.brand-mark::before { width: 2px; height: 38px; }
.brand-mark::after { width: 38px; height: 2px; }
.brand-mark span { width: 10px; height: 6px; border-left: 3px solid white; border-bottom: 3px solid white; transform: rotate(-45deg) translateY(-1px); }
.app-actions { display: flex; gap: 8px; }

main { width: 100%; }
main:focus { outline: none; }
.screen { width: min(760px, 100%); margin: 0 auto; padding: 28px 22px 48px; }
.home { min-height: calc(100vh - 58px); display: grid; align-content: center; gap: 30px; }
.home-intro { text-align: center; }
.home-logo { width: 150px; height: 150px; margin: 0 auto 24px; border-radius: 50%; background: var(--carbon); display: grid; place-items: center; box-shadow: var(--shadow); }
.home-logo .brand-mark { width: 78px; height: 78px; border-width: 5px; }
.home-logo .brand-mark::before { height: 98px; width: 4px; }
.home-logo .brand-mark::after { width: 98px; height: 4px; }
.home-logo .brand-mark span { width: 27px; height: 17px; border-width: 0 0 7px 7px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(2rem, 7vw, 3rem); line-height: 1; }
h2 { margin-bottom: 8px; font-size: clamp(1.45rem, 4vw, 2rem); line-height: 1.18; }
h3 { margin-bottom: 6px; font-size: 1rem; }
.tagline { margin-bottom: 5px; color: var(--muted); font-weight: 600; }
.brand-copy { color: var(--orange); font-weight: 700; }
.feature-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: start; padding-top: 16px; border-top: 1px solid var(--line); }
.feature-icon { color: var(--orange); font-size: 1.35rem; text-align: center; }
.feature p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }

.eyebrow { margin-bottom: 12px; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.question-copy { margin-bottom: 22px; }
.instruction { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.5; }
.diagram { width: 100%; min-height: 215px; margin: 0 0 22px; display: grid; place-items: center; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.diagram svg { display: block; width: 100%; height: 215px; }
.answer-list { display: grid; gap: 12px; }

.btn { min-height: 52px; width: 100%; border: 0; border-radius: var(--radius); padding: 13px 17px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; cursor: pointer; font-weight: 750; transition: transform .08s ease, background .15s ease, border-color .15s ease; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--orange) 35%, transparent); outline-offset: 2px; }
.btn-primary { color: white; background: var(--orange); }
.btn-primary:hover { background: var(--orange-pressed); }
.btn-secondary { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--surface-2); border-color: #b7bbc3; }
.btn-link { min-height: 40px; width: auto; padding: 8px 10px; color: var(--orange); background: transparent; }
.btn-link:disabled { color: var(--muted); opacity: .45; cursor: default; }
.btn-row { margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn .lead-icon { width: 24px; text-align: center; font-size: 1.08rem; }
.drill { justify-content: space-between; }
.drill > span:first-child { display: inline-flex; gap: 10px; align-items: center; }

.progress { height: 3px; width: 100%; background: var(--line); }
.progress span { display: block; height: 100%; width: var(--progress, 12%); background: var(--orange); transition: width .25s ease; }

.choice-card { min-height: 98px; padding: 18px; justify-content: flex-start; text-align: left; }
.choice-card strong, .choice-card small { display: block; }
.choice-card small { margin-top: 6px; color: var(--muted); font-weight: 500; line-height: 1.45; }

.result-screen { width: min(860px, 100%); }
.verdict { padding: 20px 0 22px; border-bottom: 1px solid var(--line); }
.verdict-badge { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: .82rem; font-weight: 800; text-transform: uppercase; }
.verdict.valid .verdict-badge, .verdict.valid h1 { color: var(--success); }
.verdict.invalid .verdict-badge, .verdict.invalid h1 { color: var(--danger); }
.verdict h1 { font-size: clamp(2rem, 7vw, 3.4rem); }
.verdict p { margin-bottom: 0; color: var(--muted); font-size: 1.04rem; }
.result-section { padding: 24px 0; border-bottom: 1px solid var(--line); }
.section-label { margin-bottom: 14px; color: var(--muted); font-size: .78rem; font-weight: 800; text-transform: uppercase; }
.instruction-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.instruction-card { padding: 17px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.instruction-card h3 { color: var(--orange); text-transform: uppercase; }
.instruction-card ul, .reason-list, .verify-list { margin: 0; padding: 0; list-style: none; }
.instruction-card li, .reason-list li, .verify-list li { position: relative; padding-left: 25px; line-height: 1.5; }
.instruction-card li + li, .reason-list li + li, .verify-list li + li { margin-top: 10px; }
.instruction-card li::before { content: "→"; position: absolute; left: 0; color: var(--orange); font-weight: 800; }
.reason-list li::before { content: "•"; position: absolute; left: 7px; color: var(--orange); }
.verify-list li::before { content: "✓"; position: absolute; left: 2px; color: var(--success); font-weight: 800; }
.result-actions { padding-top: 24px; display: grid; gap: 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; padding: 20px; display: grid; place-items: center; background: rgba(11,13,16,.66); backdrop-filter: blur(5px); }
.modal { width: min(620px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.modal-close { width: 40px; min-height: 40px; padding: 6px; }
.modal .diagram { min-height: 180px; }
.modal .diagram svg { height: 180px; }

.offline-status { position: fixed; z-index: 80; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 10px 14px; color: white; background: var(--graphite); border-radius: 6px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s ease; }
.offline-status.show { opacity: 1; }

@media (max-width: 640px) {
  .screen { padding: 22px 16px 38px; }
  .home { align-content: start; padding-top: 35px; }
  .home-logo { width: 124px; height: 124px; }
  .feature-list { grid-template-columns: 1fr; }
  .feature { padding-top: 12px; }
  .instruction-grid { grid-template-columns: 1fr; }
  .app-bar { min-height: 54px; }
  .app-actions .button-text { display: none; }
}

@media (prefers-color-scheme: dark) {
  :root { --ink: #f4f4f1; --muted: #a9afb8; --line: #383d45; --surface: #171a1f; --surface-2: #20242a; --page: #101216; --shadow: 0 16px 46px rgba(0,0,0,.35); }
}

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