:root {
  --bg: #f4f6fa; --card: #ffffff; --ink: #1c2230; --muted: #667085; --line: #dde3ec;
  --accent: #1f3864; --accent-ink: #ffffff; --ok: #1b7f4b; --warn: #b54708; --error: #b42318;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.1);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0f141c; --card: #171e29; --ink: #e8edf5; --muted: #98a2b3; --line: #2a3443; --accent: #8fb0ff; --accent-ink: #0f141c; --warn: #f0a24b; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.45; }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.05rem; margin: 1.5rem 0 0.5rem; }
.muted { color: var(--muted); }
.error { color: var(--error); margin: 0.25rem 0; }
button { font: inherit; cursor: pointer; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; text-decoration: underline; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 1rem; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.brand { display: flex; align-items: baseline; gap: 0.6rem; }
.user { display: flex; gap: 0.75rem; align-items: center; }
main { max-width: 1100px; margin: 0 auto; padding: 1rem; }
.search form { display: flex; gap: 0.5rem; }
.search input { flex: 1; min-width: 0; font: inherit; font-size: 1.15rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); color: var(--ink); }
.search button, .login-card button[type=submit] { background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius); padding: 0.6rem 1.1rem; font-weight: 600; }
.search p { margin: 0.5rem 0 0; font-size: 0.9rem; }
.reads { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0.9rem; }
.read { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.read .frame { display: block; aspect-ratio: 16 / 9; background: #000; }
.read .full { width: 100%; height: 100%; object-fit: cover; display: block; }
.read .info { padding: 0.6rem 0.75rem 0.75rem; display: grid; grid-template-columns: auto 1fr; gap: 0.15rem 0.75rem; align-items: center; }
.read .crop { grid-row: span 3; height: 44px; max-width: 150px; object-fit: contain; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.read .plate { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.06em; }
.diff { color: var(--warn); text-decoration: underline; }
.read .time { font-variant-numeric: tabular-nums; }
.read .meta { font-size: 0.85rem; color: var(--muted); }
.similar details { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 0.6rem; }
.similar summary { cursor: pointer; padding: 0.6rem 0.9rem; display: flex; gap: 0.75rem; align-items: baseline; flex-wrap: wrap; }
.similar summary .plate { font-weight: 700; letter-spacing: 0.06em; font-size: 1.05rem; }
.similar summary .why { color: var(--muted); font-size: 0.9rem; }
.similar .reads { padding: 0 0.9rem 0.9rem; }
.lightbox { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9); display: flex; align-items: center; justify-content: center; z-index: 10; }
.lightbox[hidden] { display: none; }
.lightbox figure { margin: 0; max-width: 96vw; max-height: 96vh; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.lightbox img { max-width: 96vw; max-height: 88vh; object-fit: contain; }
.lightbox figcaption { color: #fff; font-variant-numeric: tabular-nums; }
.lightbox .close { position: absolute; top: 0.75rem; right: 1rem; background: none; border: 0; color: #fff; font-size: 2rem; line-height: 1; }
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.5rem; width: min(100%, 360px); }
.login-card h1 { margin-bottom: 0.25rem; }
.login-card label { display: block; margin: 0.8rem 0 0; font-size: 0.9rem; color: var(--muted); }
.login-card input { display: block; width: 100%; margin-top: 0.25rem; font: inherit; padding: 0.55rem 0.7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.login-card button[type=submit] { width: 100%; margin-top: 1rem; }
@media (max-width: 480px) { .reads { grid-template-columns: 1fr; } .topbar { flex-wrap: wrap; } }
