:root {
  color-scheme: dark;
  --bg: #101316;
  --panel: #1a1f23;
  --panel-2: #232a2f;
  --line: #374148;
  --muted: #a7b0b5;
  --ink: #f4f6f7;
  --amber: #f6b71c;
  --teal: #63d3c1;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--ink); }
body { min-height: 100dvh; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.app-shell { width: min(100%, 720px); min-height: 100dvh; margin: 0 auto; display: flex; flex-direction: column; padding: 0 16px calc(10px + var(--safe-bottom)); }
.topbar { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; }
.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; flex: none; }
.brand-mark { width: 27px; height: 27px; position: relative; border: 2px solid var(--amber); border-radius: 7px; }
.brand-mark::before, .brand-mark::after, .brand-mark i::before, .brand-mark i::after { content: ""; position: absolute; background: var(--amber); border-radius: 2px; }
.brand-mark::before, .brand-mark::after { width: 7px; height: 2px; left: 3px; }
.brand-mark::before { top: 6px; }
.brand-mark::after { bottom: 6px; }
.brand-mark i::before, .brand-mark i::after { height: 7px; width: 2px; left: 3px; }
.brand-mark i::before { top: 3px; }
.brand-mark i::after { bottom: 3px; }
.brand-name { font-size: 17px; font-weight: 760; letter-spacing: -.5px; }
.brand-name span { color: var(--amber); }
.page-nav { display: flex; align-items: center; justify-content: flex-end; gap: 5px; min-width: 0; }
.nav-tab { min-height: 34px; padding: 0 9px; border: 1px solid #384149; border-radius: 9px; background: #1b2024; color: #dfe4e6; font: inherit; font-size: 10px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.nav-tab:active { background: #30383d; border-color: var(--amber); }
.camera-stage { position: relative; flex: 1; min-height: 300px; height: clamp(300px, 57dvh, 660px); max-height: calc(100dvh - 270px); overflow: hidden; background: #20262b; border: 1px solid #343d43; border-radius: 20px; isolation: isolate; }
.camera-stage video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; background: #20262b; z-index: 0; }
.camera-placeholder { position: absolute; inset: 0; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 22px; text-align: center; color: var(--muted); background: radial-gradient(ellipse at 50% 44%, #30393f 0, #20262b 62%); }
.camera-placeholder strong { color: #e3e8eb; font-size: 15px; }
.camera-placeholder span { font-size: 12px; }
.placeholder-icon { width: 49px; height: 49px; border-radius: 15px; background: #ffffff0b; display: grid; place-items: center; margin-bottom: 5px; }
.placeholder-icon svg { width: 29px; fill: none; stroke: var(--amber); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.guide-dim { position: absolute; z-index: 2; inset: 0; background: linear-gradient(180deg, #0003, #0000 24%, #0000 75%, #0005); pointer-events: none; }
.guide-frame { position: absolute; z-index: 3; left: 7%; width: 86%; top: 50%; height: 20%; transform: translateY(-50%); border: 1px solid #f6b71c80; border-radius: 8px; box-shadow: 0 0 0 999px #05080925, 0 0 28px #f6b71c20; pointer-events: none; transition: height .18s ease, width .18s ease, left .18s ease; }
.guide-frame.frame-vin { height: 12%; width: 96%; left: 2%; }
.guide-frame.frame-serial { height: 15%; width: 96%; left: 2%; }
.guide-frame span { position: absolute; width: 24px; height: 24px; border-color: var(--amber); border-style: solid; }
.guide-frame span:nth-child(1) { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: 8px 0 0; }
.guide-frame span:nth-child(2) { top: -2px; right: -2px; border-width: 3px 3px 0 0; border-radius: 0 8px 0 0; }
.guide-frame span:nth-child(3) { bottom: -2px; left: -2px; border-width: 0 0 3px 3px; border-radius: 0 0 0 8px; }
.guide-frame span:nth-child(4) { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 8px; }
.guide-frame b { position: absolute; top: -25px; left: 0; color: white; font-size: 9px; font-weight: 800; letter-spacing: .14em; text-shadow: 0 1px 5px #000; }
.stage-badge { position: absolute; z-index: 4; left: 12px; top: 12px; display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 99px; background: #080b0dbd; color: #f2f4f4; font-size: 9px; font-weight: 750; letter-spacing: .1em; backdrop-filter: blur(8px); }
.rec-dot { width: 6px; height: 6px; border-radius: 50%; background: #788187; }
.stage-badge.is-live .rec-dot { background: #ff5353; box-shadow: 0 0 8px #ff5353; }
.switch-camera { position: absolute; z-index: 4; right: 11px; top: 10px; }
.icon-button { width: 36px; height: 36px; border: 1px solid #ffffff30; border-radius: 50%; background: #080b0dbd; color: #fff; display: grid; place-items: center; font-size: 20px; cursor: pointer; backdrop-filter: blur(8px); }
.icon-button svg, .secondary-button svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-button:disabled { opacity: .4; }
.focus-hint { position: absolute; z-index: 4; left: 50%; top: calc(50% + clamp(70px, 12vw, 110px)); transform: translateX(-50%); max-width: 88%; white-space: nowrap; padding: 7px 10px; border-radius: 99px; background: #050809a8; color: #fff; font-size: 10px; text-align: center; backdrop-filter: blur(6px); }
.live-stamp { position: absolute; z-index: 4; right: 10px; bottom: 11px; max-width: min(80%, 360px); padding: 9px 11px; background: #080a0de6; color: #fff; border: 1px solid #ffffff20; border-radius: 9px; font: 600 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; white-space: normal; overflow-wrap: anywhere; box-shadow: 0 5px 18px #0004; backdrop-filter: blur(5px); }
.ocr-live { position: absolute; z-index: 4; left: 50%; top: 44px; transform: translateX(-50%); max-width: 62%; padding: 8px 11px; border: 1px solid #ffffff24; border-radius: 99px; background: #080b0dcc; color: #e7ecee; font-size: 10px; font-weight: 750; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; backdrop-filter: blur(8px); }
.ocr-live.is-recognized { color: #101316; background: var(--teal); border-color: var(--teal); }
.controls { padding: 13px 2px 2px; flex: none; }
.type-selector { display: flex; padding: 4px; background: #1b2024; border: 1px solid #323a40; border-radius: 12px; gap: 4px; }
.type-option { height: 37px; flex: 1; border: 0; border-radius: 9px; background: transparent; color: #aab3b8; font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; }
.type-option.is-active { background: #30383d; color: #fff; box-shadow: inset 0 0 0 1px #4a535a; }
.type-option.is-active::before { content: ""; display: inline-block; width: 5px; height: 5px; margin: 0 6px 2px 0; border-radius: 50%; background: var(--amber); }
.action-row { display: grid; grid-template-columns: 1fr 68px 1fr; align-items: center; gap: 13px; margin-top: 14px; }
.secondary-button, .primary-button, .outline-button { height: 48px; border-radius: 12px; border: 1px solid #414b52; background: #252c31; color: #eef1f2; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 11px; font-weight: 700; cursor: pointer; }
.secondary-button svg { color: var(--amber); }
.secondary-button:disabled, .capture-button:disabled { opacity: .45; cursor: not-allowed; }
.capture-button { width: 66px; height: 66px; justify-self: center; border: 0; background: transparent; display: grid; place-items: center; cursor: pointer; }
.capture-ring { width: 63px; height: 63px; border-radius: 50%; border: 3px solid #f7f8f9; box-shadow: 0 0 0 4px #ffffff25; display: grid; place-items: center; }
.capture-ring span { width: 47px; height: 47px; border-radius: 50%; background: var(--amber); box-shadow: inset 0 0 0 2px #ffe08a; transition: transform .12s; }
.capture-button:active:not(:disabled) .capture-ring span { transform: scale(.86); }
.progress-line { height: 26px; display: flex; align-items: center; justify-content: center; gap: 7px; color: #aab2b6; font-size: 10px; }
.destination-status { min-height: 16px; padding: 2px 4px 0; color: #8f999e; font-size: 9px; text-align: center; overflow-wrap: anywhere; }
.progress-spinner { width: 12px; height: 12px; border: 2px solid #59636a; border-top-color: var(--amber); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.privacy-note { padding: 6px 0 2px; display: flex; justify-content: center; align-items: center; gap: 6px; color: #8c969b; font-size: 9px; letter-spacing: .02em; }
.privacy-lock { color: var(--teal); font-size: 12px; }
.result-panel { position: fixed; z-index: 5; inset: 0; background: #101316; overflow-y: auto; padding: calc(14px + env(safe-area-inset-top, 0px)) 16px calc(20px + var(--safe-bottom)); display: flex; flex-direction: column; }
.result-panel[hidden] { display: none; }
.result-heading { width: min(100%, 680px); margin: 0 auto 14px; display: flex; justify-content: space-between; align-items: center; }
.eyebrow { color: var(--amber); font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.result-heading h1 { font-size: 20px; margin: 4px 0 0; }
.close-result { font-size: 24px; }
.result-photo-wrap { width: min(100%, 680px); margin: 0 auto; background: #1a1f23; border-radius: 14px; overflow: hidden; }
.result-photo-wrap img { display: block; width: 100%; height: auto; max-height: 64dvh; object-fit: contain; background: #111; }
.result-photo-wrap figcaption { padding: 11px 13px; color: #dbe0e2; font-size: 12px; }
.result-actions { width: min(100%, 680px); margin: 12px auto 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.primary-button { background: var(--amber); border-color: var(--amber); color: #17191a; }
.outline-button { background: transparent; }
.info-dialog { display: none; position: fixed; inset: 0; width: min(calc(100% - 24px), 620px); max-width: 620px; max-height: min(88dvh, 760px); margin: auto; padding: 20px; flex-direction: column; overflow: auto; color: var(--ink); background: #171c20; border: 1px solid #414b52; border-radius: 18px; box-shadow: 0 24px 80px #0009; }
.info-dialog[open] { display: flex; }
.info-dialog::backdrop { background: #080a0dcc; backdrop-filter: blur(4px); }
.info-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 14px; border-bottom: 1px solid #ffffff20; }
.info-heading h2 { margin: 4px 0 0; font-size: 19px; }
.close-info { flex: none; font-size: 24px; }
.info-content { padding: 12px 2px 4px; color: #e1e6e8; font-size: 13px; line-height: 1.65; }
.info-content ol { padding-left: 22px; margin: 0; }
.info-content li { padding: 0 0 11px 3px; }
.info-content p { color: #bac3c7; }
.info-content h3 { margin: 15px 0 4px; color: #fff; font-size: 13px; }
.info-content h3:first-child { margin-top: 2px; }
.info-content h3 + p { margin: 4px 0 12px; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: calc(24px + var(--safe-bottom)); transform: translate(-50%, 12px); opacity: 0; pointer-events: none; padding: 11px 14px; max-width: calc(100% - 32px); border-radius: 12px; background: #f3f5f5; color: #101316; font-size: 12px; font-weight: 650; box-shadow: 0 12px 35px #0007; transition: opacity .18s, transform .18s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 360px) {
  .app-shell { padding-left: 11px; padding-right: 11px; }
  .topbar { gap: 5px; }
  .brand { gap: 6px; }
  .brand-name { font-size: 15px; }
  .page-nav { gap: 4px; }
  .nav-tab { min-height: 32px; padding: 0 7px; font-size: 9px; }
  .action-row { gap: 8px; }
  .secondary-button { font-size: 10px; }
}
@media (min-width: 650px) {
  .app-shell { padding-top: 12px; }
  .camera-stage { height: min(66vh, 700px); max-height: none; }
  .topbar { min-height: 62px; }
  .controls { padding-top: 16px; }
  .type-option { height: 40px; font-size: 13px; }
  .secondary-button { height: 52px; font-size: 12px; }
  .focus-hint { top: calc(50% + 120px); font-size: 12px; }
  .live-stamp { font-size: 13px; padding: 11px 13px; }
  .nav-tab { min-height: 38px; padding: 0 12px; font-size: 11px; }
}
@media (max-height: 650px) and (max-width: 649px) and (orientation: portrait) {
  .topbar { min-height: 48px; }
  .camera-stage { height: calc(100dvh - 250px); min-height: 250px; }
  .controls { padding-top: 8px; }
  .type-option { height: 33px; }
  .action-row { margin-top: 8px; }
  .capture-button, .capture-ring { width: 56px; height: 56px; }
  .capture-ring span { width: 42px; height: 42px; }
  .focus-hint { top: calc(50% + 70px); }
}
@media (orientation: landscape) and (max-height: 650px) {
  .app-shell { width: min(100%, 1100px); height: 100dvh; min-height: 0; padding: 0 12px calc(3px + var(--safe-bottom)); }
  .topbar { min-height: 43px; }
  .camera-stage { flex: 1 1 auto; width: 100%; height: auto; min-height: 150px; max-height: none; border-radius: 15px; }
  .controls { padding: 6px 2px 0; }
  .type-selector { padding: 3px; }
  .type-option { height: 29px; font-size: 11px; }
  .action-row { grid-template-columns: 1fr 54px 1fr; gap: 10px; margin-top: 5px; }
  .secondary-button { height: 38px; font-size: 10px; }
  .capture-button, .capture-ring { width: 49px; height: 49px; }
  .capture-ring span { width: 35px; height: 35px; }
  .progress-line { height: 17px; font-size: 9px; }
  .privacy-note { padding: 0; min-height: 14px; font-size: 8px; }
  .focus-hint { top: calc(50% + 38px); font-size: 9px; }
  .live-stamp { max-width: min(48%, 340px); bottom: 8px; font-size: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
