/* 휠헌터 컴포넌트·레이아웃 (PLAN.md 17.1, 17.2). 프레임워크 없음. 토큰(tokens.css)만 쓴다.
 * 모바일 우선. 중단점 360(기본)·600·900·1200. 터치 타깃 44px 이상, 주요 버튼 48px, 타깃 간격 8px 이상.
 */

/* ---------- 기본 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--c-bg); color: var(--c-ink);
  font-family: var(--font); font-size: var(--f-16); line-height: var(--lh);
  word-break: keep-all; overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  padding-top: var(--safe-t);
}
img, svg, video, canvas { display: block; max-width: 100%; }
img { height: auto; }
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: 700; text-wrap: balance; }
h1 { font-size: var(--f-28); }
h2 { font-size: var(--f-22); }
h3 { font-size: var(--f-18); }
p { margin: 0; }
a { color: var(--c-accent); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--c-accent-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-1); }
::selection { background: var(--c-accent-soft); }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: var(--s-2); top: var(--s-2); z-index: 100; padding: var(--s-3) var(--s-4); background: var(--c-surface); color: var(--c-ink); border-radius: var(--r-2); box-shadow: var(--sh-2); transform: translateY(-200%); }
.skip:focus { transform: none; }
.icon { display: inline-block; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--c-ink-2); }
.hint-text { color: var(--c-ink-3); font-size: var(--f-14); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.t-14 { font-size: var(--f-14); }
.t-12 { font-size: var(--f-12); }
.t-18 { font-size: var(--f-18); }
.b-600 { font-weight: 600; }
.stack > * + * { margin-top: var(--s-4); }
.stack-2 > * + * { margin-top: var(--s-2); }
.stack-6 > * + * { margin-top: var(--s-6); }
.row { display: flex; gap: var(--s-2); align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: var(--s-2); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.mt-2 { margin-top: var(--s-2); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); }
.mb-4 { margin-bottom: var(--s-4); }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* ---------- 헤더(상단 내비) ---------- */
.hdr { position: sticky; top: 0; z-index: 30; background: var(--c-surface); border-bottom: 1px solid var(--c-line); }
.hdr-inner { display: flex; align-items: center; gap: var(--s-3); height: var(--header-h); padding: 0 var(--s-4); max-width: 1440px; margin: 0 auto; }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--c-ink); text-decoration: none; font-weight: 700; font-size: var(--f-18); min-height: var(--tap); }
.brand-mark { width: 28px; height: 28px; }
.nav { display: none; }
.nav a { display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 var(--s-3); border-radius: var(--r-2); color: var(--c-ink-2); text-decoration: none; font-weight: 600; }
.nav a:hover { background: var(--c-surface-2); color: var(--c-ink); }
.nav a[aria-current="page"] { color: var(--c-accent); background: var(--c-accent-soft); }
.hdr-actions { margin-left: auto; display: flex; gap: var(--s-2); align-items: center; }
.btn-back[hidden] { display: none; }

/* ---------- 하단 탭바(모바일) ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: var(--c-surface); border-top: 1px solid var(--c-line); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--c-ink-2); text-decoration: none; font-size: var(--f-12); font-weight: 600; min-height: var(--tabbar-h); }
.tab[aria-current="page"] { color: var(--c-accent); }
.tab .icon { width: 24px; height: 24px; }
body { padding-bottom: calc(var(--tabbar-h) + var(--safe-b)); }

/* ---------- 112 고정 배너 ---------- */
.banner-112 { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b)); z-index: 29; display: flex; align-items: center; justify-content: center; gap: var(--s-3); min-height: var(--tap); padding: var(--s-1) var(--s-3); background: var(--c-stolen); color: #fff; font-weight: 700; }
.banner-112 .btn-112 { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--s-3); border-radius: 999px; background: #fff; color: var(--c-stolen); text-decoration: none; font-weight: 700; font-size: var(--f-14); }
body.has-banner { padding-bottom: calc(var(--tabbar-h) + var(--tap) + var(--safe-b)); }

/* ---------- 버튼 ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); min-height: var(--btn-h); padding: 0 var(--s-6); border: 1px solid transparent; border-radius: var(--r-2); font-weight: 600; font-size: var(--f-16); line-height: 1.2; text-decoration: none; transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease); white-space: nowrap; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--c-accent); color: var(--c-accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--c-accent-hover); }
.btn-secondary { background: var(--c-surface); color: var(--c-ink); border-color: var(--c-line-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--c-surface-2); }
.btn-danger { background: var(--c-stolen); color: #fff; }
.btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-ghost { background: transparent; color: var(--c-ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--c-surface-2); color: var(--c-ink); }
.btn-sm { min-height: var(--tap); padding: 0 var(--s-4); font-size: var(--f-14); }
.btn-lg { min-height: 56px; font-size: var(--f-18); }
.btn-block { display: flex; width: 100%; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); padding: 0; border: 0; border-radius: var(--r-2); background: transparent; color: var(--c-ink-2); }
.btn-icon:hover { background: var(--c-surface-2); color: var(--c-ink); }
.btn-kakao { background: #FEE500; color: #191919; }
.btn-kakao:hover:not(:disabled) { background: #F2DA00; }
.btn[aria-busy="true"] { position: relative; color: transparent !important; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; width: 20px; height: 20px; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; color: var(--c-ink-3); animation: spin .8s linear infinite; }
.btn-primary[aria-busy="true"]::after { color: var(--c-accent-ink); }
@keyframes spin { to { transform: rotate(360deg); } }
.btn-group { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.btn-group > .btn { flex: 1 1 auto; }

/* ---------- 입력 ---------- */
.form { display: flex; flex-direction: column; gap: var(--s-6); }
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset > legend { font-weight: 700; font-size: var(--f-18); padding: 0; margin-bottom: var(--s-3); }
.field { display: flex; flex-direction: column; gap: var(--s-2); }
.label { font-weight: 600; font-size: var(--f-14); color: var(--c-ink); }
.label .req { color: var(--c-stolen); margin-left: 4px; }
.label .opt { color: var(--c-ink-3); font-weight: 400; margin-left: 6px; }
.input, .select, .textarea { width: 100%; min-height: var(--input-h); padding: var(--s-3) var(--s-4); border: 1px solid var(--c-line-strong); border-radius: var(--r-2); background: var(--c-surface); color: var(--c-ink); font-size: var(--f-16); }
.input::placeholder, .textarea::placeholder { color: var(--c-ink-3); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--c-accent); outline: 2px solid var(--c-accent); outline-offset: 0; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"], .select[aria-invalid="true"] { border-color: var(--c-stolen); }
.textarea { min-height: 112px; resize: vertical; line-height: var(--lh); }
.select { appearance: none; -webkit-appearance: none; padding-right: 44px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%2361708A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>"); background-repeat: no-repeat; background-position: right 14px center; }
.hint { color: var(--c-ink-3); font-size: var(--f-14); }
.error-text { display: flex; align-items: flex-start; gap: 6px; color: var(--c-stolen); font-size: var(--f-14); font-weight: 600; }
.error-text:empty { display: none; }
.check { display: flex; align-items: flex-start; gap: var(--s-3); min-height: var(--tap); padding: var(--s-2) 0; cursor: pointer; }
.check input { flex: none; width: 24px; height: 24px; margin: 2px 0 0; accent-color: var(--c-accent); cursor: pointer; }
.check span { flex: 1; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: var(--tap); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .knob { flex: none; width: 52px; height: 32px; border-radius: 999px; background: var(--c-line-strong); position: relative; transition: background var(--t-fast) var(--ease); }
.toggle .knob::after { content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform var(--t-fast) var(--ease); }
.toggle input:checked + .knob { background: var(--c-accent); }
.toggle input:checked + .knob::after { transform: translateX(20px); }
.toggle input:focus-visible + .knob { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-2); }
.radio-card { position: relative; display: flex; align-items: center; justify-content: center; min-height: var(--btn-h); padding: var(--s-2) var(--s-3); border: 1px solid var(--c-line-strong); border-radius: var(--r-2); background: var(--c-surface); cursor: pointer; text-align: center; font-weight: 600; }
.radio-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-card:has(input:checked) { border-color: var(--c-accent); background: var(--c-accent-soft); color: var(--c-accent); }
.radio-card:has(input:focus-visible) { outline: 3px solid var(--c-focus); outline-offset: 2px; }
.file-btn { position: relative; display: inline-flex; overflow: hidden; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: var(--s-2); }
.photo-tile { position: relative; aspect-ratio: 1; border-radius: var(--r-2); overflow: hidden; background: var(--c-surface-2); }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; }
.photo-tile .btn-icon { position: absolute; top: 2px; right: 2px; background: var(--c-overlay); color: #fff; }
.photo-tile .size { position: absolute; left: 4px; bottom: 4px; padding: 1px 6px; border-radius: 4px; background: var(--c-overlay); color: #fff; font-size: 11px; }
.serial-preview { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); padding: var(--s-3) var(--s-4); border-radius: var(--r-2); background: var(--c-surface-2); font-size: var(--f-14); }
.serial-preview b { font-family: var(--font-mono); letter-spacing: .08em; }
.inline-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

/* ---------- 단계 표시기 ---------- */
.stepper { display: flex; gap: var(--s-2); list-style: none; margin: 0; padding: 0; counter-reset: step; }
.stepper li { flex: 1; display: flex; align-items: center; gap: var(--s-2); min-height: var(--tap); padding: 0 var(--s-2); border-radius: var(--r-2); color: var(--c-ink-3); font-size: var(--f-14); font-weight: 600; }
.stepper li::before { counter-increment: step; content: counter(step); display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--c-surface-2); color: var(--c-ink-2); font-size: var(--f-14); }
.stepper li[aria-current="step"] { color: var(--c-accent); background: var(--c-accent-soft); }
.stepper li[aria-current="step"]::before { background: var(--c-accent); color: var(--c-accent-ink); }
.stepper li.is-done::before { background: var(--c-registered); color: #fff; }

/* ---------- 카드·배지 ---------- */
.card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-3); box-shadow: var(--sh-1); padding: var(--s-4); }
.card-title { font-size: var(--f-18); }
.badge { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 var(--s-2); border-radius: 999px; font-size: var(--f-12); font-weight: 700; white-space: nowrap; }
.badge-registered { background: var(--c-registered-soft); color: var(--c-registered); }
.badge-stolen { background: var(--c-stolen-soft); color: var(--c-stolen); }
.badge-recovered { background: var(--c-recovered-soft); color: var(--c-recovered); }
.badge-closed { background: var(--c-closed-soft); color: var(--c-closed); }
.badge-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.badge-info { background: var(--c-info-soft); color: var(--c-info); }
.bike-card { display: grid; grid-template-columns: 96px 1fr; gap: var(--s-3); padding: var(--s-3); text-decoration: none; color: inherit; }
.bike-card:hover { border-color: var(--c-line-strong); }
.bike-card .thumb { width: 96px; height: 96px; border-radius: var(--r-2); overflow: hidden; background: var(--c-surface-2); }
.bike-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.bike-card .meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.bike-card .name { font-weight: 700; font-size: var(--f-16); }
.bike-card .sub { color: var(--c-ink-2); font-size: var(--f-14); }
.bike-card .counts { display: flex; gap: var(--s-3); color: var(--c-ink-3); font-size: var(--f-12); }
.list { display: flex; flex-direction: column; gap: var(--s-3); list-style: none; margin: 0; padding: 0; }
.kv { display: grid; grid-template-columns: minmax(96px, 30%) 1fr; gap: var(--s-2) var(--s-4); margin: 0; }
.kv dt { color: var(--c-ink-2); font-size: var(--f-14); }
.kv dd { margin: 0; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--s-2); }
.gallery img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r-2); background: var(--c-surface-2); }
.gallery-main img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: var(--r-3); background: var(--c-surface-2); }
.notice { display: flex; gap: var(--s-3); align-items: flex-start; padding: var(--s-3) var(--s-4); border-radius: var(--r-2); font-size: var(--f-14); }
.notice-stolen { background: var(--c-stolen-soft); color: var(--c-stolen); font-weight: 600; }
.notice-ok { background: var(--c-ok-soft); color: var(--c-ok); }
.notice-info { background: var(--c-info-soft); color: var(--c-ink); }
.notice-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.notice .icon { flex: none; margin-top: 2px; }

/* ---------- 상태(빈·로딩·오류) ---------- */
.state { display: flex; flex-direction: column; align-items: center; gap: var(--s-3); padding: var(--s-8) var(--s-4); text-align: center; color: var(--c-ink-2); }
.state .icon { color: var(--c-ink-3); }
.state-title { font-weight: 700; color: var(--c-ink); font-size: var(--f-18); }
.skeleton { position: relative; overflow: hidden; background: var(--c-surface-2); border-radius: var(--r-2); min-height: 16px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); animation: shimmer 1.4s infinite; }
@media (prefers-reduced-motion: reduce) { .skeleton::after { animation: none; } }
@keyframes shimmer { to { transform: translateX(100%); } }
.skeleton-card { height: 120px; }

/* ---------- 다이얼로그 ---------- */
.dialog { border: 0; padding: 0; width: min(100% - 32px, 480px); border-radius: var(--r-3); background: var(--c-surface); color: var(--c-ink); box-shadow: var(--sh-2); }
.dialog::backdrop { background: var(--c-overlay); }
.dialog-body { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); margin: 0; }
.dialog-title { font-size: var(--f-22); }
.dialog-text { color: var(--c-ink-2); }
.dialog-actions { display: flex; gap: var(--s-2); justify-content: flex-end; flex-wrap: wrap; }
.dialog-actions .btn { flex: 1 1 auto; }

/* ---------- 토스트 ---------- */
#toast-region { position: fixed; left: var(--s-4); right: var(--s-4); bottom: calc(var(--tabbar-h) + var(--safe-b) + var(--s-4)); z-index: 60; display: flex; flex-direction: column; gap: var(--s-2); align-items: center; pointer-events: none; }
body.has-banner #toast-region { bottom: calc(var(--tabbar-h) + var(--tap) + var(--safe-b) + var(--s-4)); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: var(--s-2); max-width: 560px; width: 100%; padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); border-radius: var(--r-2); background: var(--c-ink); color: var(--c-bg); box-shadow: var(--sh-2); border-left: 4px solid var(--c-accent); animation: toast-in var(--t-base) var(--ease); }
.toast-msg { flex: 1; font-size: var(--f-14); font-weight: 600; }
.toast .toast-close { color: inherit; width: 36px; height: 36px; }
.toast-ok { border-left-color: var(--c-registered); }
.toast-warn { border-left-color: var(--c-warn); }
.toast-danger { border-left-color: var(--c-stolen); }
.toast.is-leaving { opacity: 0; transition: opacity var(--t-base); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- 콘텐츠 폭 ---------- */
.content { width: 100%; max-width: var(--content-w); margin: 0 auto; padding: var(--s-6) var(--s-4) var(--s-12); }
.content-wide { max-width: 1120px; }
.page-head { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-6); }
.page-head .lead { color: var(--c-ink-2); }
.section { display: flex; flex-direction: column; gap: var(--s-4); }
.section + .section { margin-top: var(--s-8); }
.divider { border: 0; border-top: 1px solid var(--c-line); margin: var(--s-6) 0; }
.footer { padding: var(--s-6) var(--s-4); color: var(--c-ink-3); font-size: var(--f-12); text-align: center; }
.footer a { color: inherit; }
.footer-links { display: flex; gap: var(--s-4); justify-content: center; flex-wrap: wrap; margin-bottom: var(--s-2); }

/* ---------- 지도·목록 레이아웃 ---------- */
.map-layout { position: relative; height: calc(100dvh - var(--header-h) - var(--tabbar-h) - var(--safe-b) - var(--safe-t)); overflow: hidden; }
.map-pane { position: absolute; inset: 0; }
#map { width: 100%; height: 100%; background: var(--c-surface-2); }
.map-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: var(--s-6); text-align: center; background: repeating-linear-gradient(45deg, var(--c-surface-2) 0 12px, var(--c-bg) 12px 24px); }
.map-fallback .state { background: var(--c-surface); border-radius: var(--r-3); box-shadow: var(--sh-1); max-width: 360px; }
.map-ctl { position: absolute; right: var(--s-3); top: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); z-index: 5; }
.map-ctl .btn-icon { background: var(--c-surface); color: var(--c-ink); box-shadow: var(--sh-1); border: 1px solid var(--c-line); }
.map-region { position: absolute; left: var(--s-3); top: var(--s-3); z-index: 5; }
.map-region .select { min-height: var(--tap); padding: 0 40px 0 var(--s-3); width: auto; box-shadow: var(--sh-1); font-weight: 600; }

/* 하단 시트(모바일) */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; flex-direction: column; background: var(--c-surface); border-radius: var(--r-3) var(--r-3) 0 0; box-shadow: var(--sh-2); transition: height var(--t-base) var(--ease); height: 128px; }
.sheet[data-state="half"] { height: 52%; }
.sheet[data-state="full"] { height: calc(100% - var(--s-3)); }
.sheet-handle { display: flex; align-items: center; justify-content: center; width: 100%; min-height: var(--tap); border: 0; background: transparent; color: var(--c-ink-3); touch-action: none; }
.sheet-handle::before { content: ""; width: 44px; height: 5px; border-radius: 999px; background: var(--c-line-strong); }
.sheet-head { display: flex; flex-direction: column; gap: var(--s-2); padding: 0 var(--s-4) var(--s-3); }
.sheet-body { flex: 1; overflow: auto; padding: 0 var(--s-4) var(--s-4); -webkit-overflow-scrolling: touch; }
.list-title { display: flex; align-items: baseline; gap: var(--s-2); font-size: var(--f-16); }
.list-title .count { color: var(--c-ink-3); font-size: var(--f-14); font-weight: 400; }
.filters { display: flex; gap: var(--s-2); overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .select { min-height: var(--tap); width: auto; padding: 0 36px 0 var(--s-3); font-size: var(--f-14); flex: none; }
.search { display: flex; gap: var(--s-2); }
.search .input { min-height: var(--tap); }
.search .btn { min-height: var(--tap); }

/* 대문(준비 중) */
.hero { padding: var(--s-12) var(--s-4); max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-4); }
.hero h1 { font-size: var(--f-36); }
.hero .lead { font-size: var(--f-18); color: var(--c-ink-2); }
.hero ul { margin: 0; padding-left: 1.2em; color: var(--c-ink-2); }
.hero .mark { width: 72px; height: 72px; }

/* ---------- 추적 ---------- */
.track-layout { position: relative; height: calc(100dvh - var(--header-h) - var(--tabbar-h) - var(--tap) - var(--safe-b) - var(--safe-t)); overflow: hidden; }
.track-map { position: absolute; inset: 0 0 40% 0; }
.track-map #map { height: 100%; }
.track-panel { top: 60%; height: auto; border-radius: var(--r-3) var(--r-3) 0 0; }
.track-panel[data-state="peek"] { top: auto; height: 128px; }
.track-panel[data-state="half"] { top: 60%; }
.track-panel[data-state="full"] { top: var(--s-3); }
.clocks { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); }
.clock { display: flex; flex-direction: column; gap: 2px; padding: var(--s-3); border-radius: var(--r-2); background: var(--c-surface-2); }
.clock .lbl { font-size: var(--f-12); color: var(--c-ink-2); font-weight: 600; }
.clock .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: var(--f-22); font-weight: 700; line-height: 1.2; }
.clock[data-tone="fresh"] .num { color: var(--c-stolen); }
.clock[data-tone="warn"] .num { color: var(--c-warn); }
.clock[data-tone="stale"] .num { color: var(--c-ink-3); }
.evt-banner { position: absolute; left: var(--s-3); right: var(--s-3); top: var(--s-3); z-index: 6; display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-2); background: var(--c-stolen); color: #fff; font-weight: 700; box-shadow: var(--sh-2); transform: translateY(-140%); transition: transform var(--t-base) var(--ease); }
.evt-banner.is-on { transform: none; }
.track-status { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; font-size: var(--f-14); color: var(--c-ink-2); }
.track-status .badge { min-height: 28px; }
.relation { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3); border-radius: var(--r-2); border: 1px solid var(--c-line); }
.relation .arrow { flex: none; width: 40px; height: 40px; color: var(--c-accent); transform: rotate(var(--deg, 0deg)); transition: transform var(--t-base) var(--ease); }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li { display: grid; grid-template-columns: 64px 1fr; gap: var(--s-3); padding: var(--s-2) 0; border-top: 1px solid var(--c-line); font-size: var(--f-14); }
.feed li:first-child { border-top: 0; }
.feed .time { color: var(--c-ink-3); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.feed .type { font-weight: 700; margin-right: 6px; }
.track-actions { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--tap) + var(--safe-b)); z-index: 28; display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); padding: var(--s-2) var(--s-3); background: linear-gradient(to top, var(--c-surface) 70%, transparent); }
.track-actions .btn { min-height: 56px; font-size: var(--f-18); }
body.page-track { padding-bottom: calc(var(--tabbar-h) + var(--tap) + var(--safe-b) + 72px); }
.track-idle .clock[data-tone="stale"] .num { color: var(--c-ink-3); }
.map-label { padding: 2px 8px; border-radius: 999px; background: var(--c-ink); color: var(--c-bg); font-size: 12px; font-weight: 700; font-family: var(--font-mono); white-space: nowrap; box-shadow: var(--sh-1); }
.map-label.is-latest { background: var(--c-stolen); color: #fff; font-size: 13px; }

/* ---------- 조회 결과 ---------- */
.result { padding: var(--s-6); border-radius: var(--r-3); border: 2px solid var(--c-line); background: var(--c-surface); display: flex; flex-direction: column; gap: var(--s-3); }
.result[data-kind="stolen"] { border-color: var(--c-stolen); background: var(--c-stolen-soft); }
.result[data-kind="none"] { border-color: var(--c-registered); background: var(--c-registered-soft); }
.result .headline { display: flex; align-items: center; gap: var(--s-3); font-size: var(--f-22); font-weight: 700; }
.result[data-kind="stolen"] .headline { color: var(--c-stolen); }
.result[data-kind="none"] .headline { color: var(--c-registered); }
.big-input { font-family: var(--font-mono); font-size: var(--f-22); letter-spacing: .1em; text-transform: uppercase; min-height: 56px; text-align: center; }

/* ---------- 인쇄(등록증·요약 PDF) ---------- */
.doc { display: none; }
@media print {
  body { background: #fff; color: #000; padding: 0; }
  .hdr, .tabbar, .banner-112, #toast-region, .no-print, .map-ctl { display: none !important; }
  .doc { display: block; }
  .doc-page { page-break-after: always; padding: 0; font-size: 12pt; }
  .doc h1 { font-size: 20pt; margin-bottom: 8pt; }
  .doc table { width: 100%; border-collapse: collapse; margin: 8pt 0; }
  .doc th, .doc td { border: 1px solid #999; padding: 4pt 6pt; text-align: left; vertical-align: top; font-size: 11pt; }
  .doc .photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6pt; }
  .doc .photos img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
  .doc .qr { width: 160px; height: 160px; }
  .doc .foot { margin-top: 12pt; font-size: 10pt; color: #444; }
  .print-hide { display: none !important; }
  a { color: #000; text-decoration: none; }
}

/* ---------- 반응형 ---------- */
@media (min-width: 600px) {
  .content { padding: var(--s-8) var(--s-6) var(--s-12); }
  .clocks { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  body.has-banner { padding-bottom: var(--tap); }
  .tabbar { display: none; }
  .nav { display: flex; gap: var(--s-1); margin-left: var(--s-4); }
  .banner-112 { bottom: 0; }
  #toast-region { left: auto; right: var(--s-6); bottom: var(--s-6); align-items: flex-end; }
  body.has-banner #toast-region { bottom: calc(var(--tap) + var(--s-6)); }
  .map-layout { display: grid; grid-template-columns: var(--list-w) 1fr; height: calc(100dvh - var(--header-h) - var(--safe-t)); }
  body.has-banner .map-layout { height: calc(100dvh - var(--header-h) - var(--tap) - var(--safe-t)); }
  .map-pane { position: relative; grid-column: 2; }
  .sheet { position: relative; grid-column: 1; grid-row: 1; height: auto !important; border-radius: 0; box-shadow: none; border-right: 1px solid var(--c-line); }
  .sheet-handle { display: none; }
  .sheet-head { padding-top: var(--s-4); }
  .track-layout { display: grid; grid-template-columns: 1fr var(--panel-w); height: calc(100dvh - var(--header-h) - var(--tap) - var(--safe-t)); }
  .track-map { position: relative; inset: auto; grid-column: 1; }
  .track-panel { position: relative; grid-column: 2; top: auto !important; height: auto !important; border-left: 1px solid var(--c-line); border-right: 0; }
  .track-actions { position: static; grid-column: 2; padding: var(--s-3) var(--s-4) var(--s-4); background: var(--c-surface); border-left: 1px solid var(--c-line); grid-template-columns: 1fr 1fr; }
  .track-layout .track-panel { display: flex; flex-direction: column; }
  .track-wrap { display: grid; grid-template-columns: 1fr var(--panel-w); grid-template-rows: 1fr auto; height: calc(100dvh - var(--header-h) - var(--tap) - var(--safe-t)); }
  .track-wrap .track-map { grid-column: 1; grid-row: 1 / span 2; }
  .track-wrap .track-panel { grid-column: 2; grid-row: 1; overflow: auto; }
  .track-wrap .track-actions { grid-column: 2; grid-row: 2; }
  body.page-track { padding-bottom: var(--tap); }
  .hero { padding: var(--s-12) var(--s-6); }
}
@media (min-width: 1200px) {
  .hdr-inner { padding: 0 var(--s-6); }
  .content { padding-left: 0; padding-right: 0; }
  .map-layout { grid-template-columns: 440px 1fr; }
}
