:root { --navy: #263681; --navy-d: #1A2660; --bg: #F4F5F9; --ink: #161A2E; --mute: #5B6178; --line: #E6E8F0; --ok: #14613A; --okbg: #DDF2E5; --warn: #7A4A00; --warnbg: #FCEFD6; --bad: #A3211B; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--navy); }
h1 { margin: 0; font-size: 22px; line-height: 1.2; }
h2 { margin: 8px 0 0; font-size: 13px; color: var(--mute); font-weight: 600; }
code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }

.top { background: var(--navy); color: #fff; padding: calc(16px + env(safe-area-inset-top)) 20px 16px; display: flex; flex-direction: column; gap: 4px; }
.top .back, .top .brand { color: #D5DAF2; font-size: 14px; font-weight: 500; text-decoration: none; padding: 8px 0; align-self: flex-start; min-height: 44px; display: flex; align-items: center; }
.top .sub { margin: 0; color: #D5DAF2; font-size: 13px; word-break: break-all; }

main { padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px; flex: 1; }
.card { background: #fff; border-radius: 12px; overflow: hidden; }
.card.pad { padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; }
.card.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; min-height: 56px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); width: 100%; background: transparent; border-left: 0; border-right: 0; border-top: 0; font: inherit; text-align: left; }
.card > .row:last-child, .block:last-child > .row:only-child { border-bottom: 0; }
.row span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row small, small.right { color: var(--mute); font-size: 13px; font-weight: 400; }
small.right { text-align: right; flex-shrink: 0; max-width: 55%; }
.block { border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.block .row { border-bottom: 0; }
.empty { margin: 0; padding: 16px; color: var(--mute); font-size: 14px; }

.chip, .pill { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; flex-direction: row !important; }
.chip.ok { color: var(--ok); background: var(--okbg); } .chip.info { color: var(--navy); background: #E3E7F8; } .chip.warn { color: var(--warn); background: var(--warnbg); } .chip.mute { color: var(--mute); background: var(--line); }
.pill { background: var(--line); color: var(--ink); padding: 6px 14px; font-size: 13px; } .pill.on { background: var(--navy); color: #fff; }
.toggle { cursor: pointer; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .q { font-size: 14px; font-weight: 600; margin: 0; }
input, select { font: inherit; font-size: 16px; min-height: 48px; padding: 10px 12px; border: 1.5px solid #8A90A6; border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid #8FA0E8; outline-offset: 2px; }
.help { margin: 0; font-size: 13px; color: var(--mute); } .help.bad { color: var(--bad); font-weight: 600; }
.note { margin: 0; font-size: 13px; color: var(--mute); line-height: 1.45; }

button { font: inherit; cursor: pointer; }
.primary, .ghost { display: block; width: 100%; text-align: center; text-decoration: none; font-size: 16px; font-weight: 600; padding: 15px; border-radius: 12px; min-height: 52px; }
.primary { background: var(--navy); color: #fff; border: 0; margin-top: auto; }
.primary:disabled { opacity: .6; }
.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.ghost.danger, .link.danger { color: var(--bad); border-color: var(--bad); }
.small { font-size: 14px; font-weight: 600; color: var(--navy); background: #fff; border: 1.5px solid var(--navy); border-radius: 8px; padding: 10px 14px; min-height: 44px; flex-shrink: 0; }
.link { background: none; border: 0; padding: 12px 16px; font-size: 14px; font-weight: 600; min-height: 44px; }

.check { display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 52px; background: transparent; border: 0; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; font-weight: 500; color: var(--ink); }
.box { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #8A90A6; flex-shrink: 0; } .box.on { background: var(--navy); border-color: var(--navy); }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.seg button { min-height: 48px; border-radius: 8px; border: 1.5px solid var(--navy); background: #fff; color: var(--navy); font-size: 14px; font-weight: 600; padding: 8px; }
.seg button[aria-pressed="true"] { background: var(--navy); color: #fff; }

.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 0 16px 12px; }
.thumbs:empty { display: none; }
figure { margin: 0; display: flex; flex-direction: column; gap: 4px; }
figure img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; background: var(--line); }
figcaption { font-size: 10px; color: var(--mute); word-break: break-all; font-family: ui-monospace, Menlo, monospace; }
.x { background: none; border: 0; color: var(--bad); font-size: 13px; font-weight: 600; min-height: 44px; padding: 4px 0; text-align: left; }

.calc { background: var(--navy); color: #fff; border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 15px; }
.line.dim { font-size: 13px; color: #D5DAF2; } .line strong { font-size: 18px; } .line.big strong { font-size: 26px; }
.warnbox, .okbox { border-radius: 12px; padding: 12px 14px; font-size: 14px; line-height: 1.45; }
.warnbox { background: var(--warnbg); color: #5C3800; } .okbox { background: var(--okbg); color: var(--ok); font-weight: 600; }
dl { margin: 0; display: grid; grid-template-columns: 40% 1fr; gap: 6px 12px; font-size: 14px; } dt { color: var(--mute); } dd { margin: 0; font-weight: 500; word-break: break-word; }
.todo { margin: 0; padding-left: 20px; font-size: 14px; display: flex; flex-direction: column; gap: 6px; }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 12px; font-size: 14px; z-index: 50; text-align: center; }
#toast[hidden] { display: none; }

.cam { position: fixed; inset: 0; background: #000; z-index: 40; display: flex; flex-direction: column; }
.cam video { flex: 1; width: 100%; min-height: 0; object-fit: contain; }
.camtop { position: absolute; top: env(safe-area-inset-top); left: 0; right: 0; padding: 12px 16px; color: #fff; display: flex; flex-direction: column; gap: 2px; font-size: 13px; background: rgba(0, 0, 0, .55); }
.cambar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); background: #000; }
.cambar .ghost { width: auto; background: transparent; color: #fff; border-color: #fff; justify-self: start; padding: 12px 16px; }
.shutter { width: 72px; height: 72px; border-radius: 50%; background: #fff; border: 5px solid #8A90A6; }
.guide { position: absolute; left: 50%; top: 45%; transform: translate(-50%, -50%); border: 2px dashed #fff; pointer-events: none; box-shadow: 0 0 0 2000px rgba(0, 0, 0, .25); }
.guide.car { width: 86%; aspect-ratio: 16 / 9; border-radius: 16px; }
.guide.wheel { width: 62%; aspect-ratio: 1; border-radius: 50%; }
.guide.wide { width: 92%; aspect-ratio: 3 / 2; border-radius: 12px; }
.guide.screen { width: 80%; aspect-ratio: 4 / 3; border-radius: 12px; }
