:root {
  color-scheme: light;
  --ink: #14221b;
  --muted: #5d6d63;
  --line: #d8e2dc;
  --paper: #fff;
  --wash: #f3f7f4;
  --green: #087443;
  --green-dark: #075834;
  --green-soft: #e7f4ec;
  --amber: #a86408;
  --amber-soft: #fff4d6;
  --red: #a52b2b;
  --red-soft: #fdeaea;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--wash);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% 0, #dceddf 0, transparent 32rem), var(--wash); }
button, input, select { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
a { color: var(--green-dark); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.network-status { padding: 9px 16px; background: #553908; color: #fff8df; text-align: center; font-size: .88rem; }
.site-header { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand img { border-radius: 11px; box-shadow: 0 5px 14px #07583425; }
.brand span { display: grid; line-height: 1.05; }
.brand strong { letter-spacing: .04em; font-size: 1.15rem; }
.brand small { margin-top: 4px; color: var(--muted); font-size: .74rem; }
.source-label { color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .06em; }

main { width: min(720px, calc(100% - 32px)); margin: 36px auto 64px; }
.hero { max-width: 650px; }
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: .76rem; font-weight: 800; letter-spacing: .12em; }
h1 { max-width: 620px; margin: 0; font-size: clamp(2.15rem, 7vw, 4rem); line-height: 1.03; letter-spacing: -.045em; }
.hero > p:last-child { max-width: 590px; margin: 20px 0 0; color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.13rem); line-height: 1.65; }

.install-card { margin-top: 24px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--green-soft); }
.install-card:not([hidden]) { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.install-card > div { flex: 1 1 220px; }
.install-card h2 { margin: 0; font-size: 1rem; }
.install-card p { margin: 6px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.install-card > p { flex-basis: 100%; }
.install-card button { min-height: 44px; padding: 10px 14px; border: 1px solid var(--green); border-radius: 10px; background: white; }
dialog { width: min(480px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow-y: auto; padding: 24px; border: 1px solid var(--line); border-radius: 20px; color: var(--ink); }
dialog::backdrop { background: #14221b99; }
dialog h2 { margin-top: 0; }
dialog p, dialog li { line-height: 1.6; }
dialog li + li { margin-top: 10px; }
dialog button:focus-visible, .install-card button:focus-visible { outline: 3px solid #e7a926; outline-offset: 3px; }

.lookup-card { margin-top: 34px; padding: clamp(20px, 5vw, 34px); border: 1px solid #cedbd2; border-radius: 24px; background: #ffffffee; box-shadow: 0 22px 55px #234f3420; backdrop-filter: blur(8px); }
.scan-button { width: 100%; min-height: 82px; display: flex; align-items: center; justify-content: center; gap: 16px; border: 0; border-radius: 16px; background: var(--green); color: white; cursor: pointer; box-shadow: 0 9px 22px #08744330; }
.scan-button:hover { background: var(--green-dark); }
.scan-button:focus-visible, .lookup-button:focus-visible, .text-button:focus-visible { outline: 3px solid #e7a926; outline-offset: 3px; }
.scan-button span:last-child { display: grid; text-align: left; }
.scan-button strong { font-size: 1.08rem; }
.scan-button small { margin-top: 3px; color: #dff4e7; }
.scan-mark { width: 34px; height: 29px; border: 3px solid white; border-top-color: transparent; border-bottom-color: transparent; position: relative; }
.scan-mark::before { content: ""; position: absolute; inset: 3px 6px; background: repeating-linear-gradient(90deg, white 0 2px, transparent 2px 5px); }
video { width: 100%; max-height: 360px; margin-top: 16px; border-radius: 14px; background: #101713; object-fit: cover; }
video:not([data-active="true"]) { display: none; }
.camera-panel { margin-top: 8px; align-items: center; justify-content: space-between; gap: 12px; }
.camera-panel:not([hidden]) { display: flex; }
.camera-panel p { margin: 0; color: var(--muted); }
#cancel-scan { flex-shrink: 0; min-height: 44px; padding: 10px 16px; border: 1px solid var(--red); border-radius: 10px; background: white; color: var(--ink); }
#cancel-scan:hover { background: var(--red-soft); }
.text-button { width: auto; padding: 7px 4px; border: 0; background: transparent; color: var(--green-dark); font-weight: 750; cursor: pointer; }

.separator { display: flex; align-items: center; gap: 12px; margin: 25px 0 20px; color: #718078; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.separator::before, .separator::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.field-grid { display: grid; grid-template-columns: 165px 1fr; gap: 14px; }
.field { min-width: 0; }
label { display: block; margin-bottom: 7px; font-size: .9rem; font-weight: 750; }
input, select { width: 100%; min-height: 48px; padding: 11px 12px; border: 1px solid #aebdb3; border-radius: 10px; background: white; color: var(--ink); }
input:focus, select:focus { border-color: var(--green); outline: 3px solid #0874431c; }
input[aria-invalid="true"] { border-color: var(--red); }
.optional-fields { margin-top: 17px; border-top: 1px solid var(--line); }
.optional-fields summary { padding: 16px 2px 2px; color: var(--green-dark); font-weight: 750; cursor: pointer; }
.optional-fields summary span { margin-left: 7px; color: var(--muted); font-size: .8rem; font-weight: 450; }
.optional-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 16px; }
.form-error { margin: 14px 0 0; color: var(--red); font-size: .9rem; }
.lookup-button { width: 100%; min-height: 52px; margin-top: 20px; border: 0; border-radius: 12px; background: var(--ink); color: white; font-weight: 800; cursor: pointer; }
.lookup-button:hover { background: #26382e; }
.lookup-button:disabled { cursor: wait; opacity: .72; }

.result { margin-top: 28px; scroll-margin-top: 16px; }
.result-hero { padding: clamp(22px, 5vw, 34px); border: 1px solid var(--line); border-radius: 22px; background: var(--paper); box-shadow: 0 18px 42px #1d422b16; }
.result-hero[data-tone="danger"] { border-top: 7px solid var(--red); }
.result-hero[data-tone="warning"] { border-top: 7px solid var(--amber); }
.result-hero[data-tone="calm"] { border-top: 7px solid var(--green); }
.result-kicker { margin: 0 0 9px; color: var(--muted); font-size: .77rem; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.result-title { margin: 0; font-size: clamp(1.55rem, 5vw, 2.35rem); line-height: 1.12; letter-spacing: -.025em; }
.result-summary { margin: 12px 0 0; color: var(--muted); line-height: 1.55; }
.product-card, .alert-card, .candidate-card, .coverage-card { margin-top: 14px; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); }
.section-label { margin: 0 0 10px; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.product-name, .alert-title { margin: 0; font-size: 1.12rem; line-height: 1.35; }
.meta-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 11px 0 0; padding: 0; list-style: none; }
.meta-list li { padding: 5px 9px; border-radius: 7px; background: var(--wash); color: #405047; font-size: .82rem; }
.alert-card[data-tone="danger"] { border-left: 5px solid var(--red); }
.alert-card[data-tone="warning"] { border-left: 5px solid var(--amber); }
.alert-card[data-tone="calm"] { border-left: 5px solid var(--green); }
.alert-date { margin: 7px 0 0; color: var(--muted); font-size: .86rem; }
.resolution { margin: 16px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--amber-soft); color: #624007; line-height: 1.5; }
.alert-card[data-tone="danger"] .resolution { background: var(--red-soft); color: #6d1e1e; }
.detail-block { margin-top: 17px; }
.detail-block h4 { margin: 0 0 7px; font-size: .88rem; }
.detail-block ul { margin: 0; padding-left: 20px; color: #405047; line-height: 1.55; }
.source-links { display: grid; gap: 8px; }
.source-link { display: block; padding: 11px 13px; border-radius: 9px; background: var(--green-soft); text-decoration: none; font-weight: 700; }
.source-link small { display: block; margin-top: 3px; color: var(--muted); font-weight: 450; }
.candidate-card button { margin-top: 12px; padding: 9px 13px; border: 1px solid var(--green); border-radius: 9px; background: white; color: var(--green-dark); font-weight: 750; cursor: pointer; }
.search-candidate mark { padding: 0 2px; border-radius: 3px; background: #ffe18a; color: inherit; }
.canonical-name { margin: 7px 0 0; color: var(--muted); font-size: .88rem; }
.recovery-copy { color: var(--muted); line-height: 1.55; }
.recovery-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.recovery-actions button { flex: 1 1 180px; margin-top: 0; }
.coverage-card details summary { color: var(--green-dark); font-weight: 750; cursor: pointer; }
.coverage-list { margin: 12px 0 0; padding: 0; list-style: none; }
.coverage-copy { margin: 0 0 14px; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.coverage-list li { display: grid; gap: 5px; padding: 12px 0; border-top: 1px solid var(--line); font-size: .88rem; }
.coverage-list li span { color: var(--muted); line-height: 1.5; }
.status-current { color: var(--green-dark); }
.status-delayed, .status-unavailable { color: var(--amber); }
.disclaimers { margin: 14px 0 0; padding: 16px 20px 16px 36px; border-radius: 14px; background: #edf1ee; color: #48574e; font-size: .85rem; line-height: 1.5; }

.safety-note { margin-top: 28px; padding: 18px 20px; border-left: 4px solid #d39b25; background: #fff9e9; color: #5b4515; }
.safety-note p { margin: 5px 0 0; line-height: 1.5; }
footer { width: min(920px, calc(100% - 32px)); margin: 0 auto; padding: 24px 0 32px; display: flex; justify-content: space-between; gap: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; }

@media (max-width: 600px) {
  .site-header { padding-top: 16px; }
  .source-label { display: none; }
  main { margin-top: 20px; }
  .field-grid, .optional-grid { grid-template-columns: 1fr; }
  .lookup-card { border-radius: 18px; }
  .optional-fields summary span { display: block; margin: 3px 0 0 17px; }
  footer { display: grid; }
}

@media (prefers-reduced-motion: no-preference) {
  .result:not([hidden]) { animation: reveal .28s ease-out; }
  @keyframes reveal { from { opacity: 0; transform: translateY(8px); } }
}

.offline-page { min-height: 100vh; display: grid; place-items: center; }
.offline-content { width: min(480px, calc(100% - 40px)); margin: 0; text-align: center; }
.offline-content img { width: 96px; height: 96px; border-radius: 22px; }
.offline-content h1 { margin: 24px 0 8px; }
.offline-content p { color: var(--muted); line-height: 1.5; }
.offline-retry { display: inline-grid; min-height: 44px; margin-top: 16px; padding: 10px 20px; place-items: center; border-radius: 9px; background: var(--green); color: white; font-weight: 700; text-decoration: none; }

.header-tools { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; justify-content: flex-end; }
.language-control select { color: var(--green-dark); background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 8px; min-height: 40px; max-width: 140px; }
.language-control select:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.source-language-note { color: var(--muted); font-size: .85rem; }
@media (max-width: 480px) { .header-tools { gap: 6px; flex-direction: column; align-items: flex-end; } }
