:root {
    --bg: #0f172a;
    --surface: #111827;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --primary: #7c3aed;
    --primary-600: #6d28d9;
    --danger: #ef4444;
    --success: #10b981;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji"; }

.container { width: 100%; max-width: 900px; margin: 0 auto; padding: 1rem; }

.row { display: flex; align-items: center; gap: 0.75rem; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

.site-header { background: var(--surface); border-bottom: 1px solid #1f2937; position: sticky; top: 0; z-index: 10; }
.site-header .brand a { color: var(--text); text-decoration: none; font-weight: 700; }
.site-header nav a { color: var(--text); text-decoration: underline; margin-left: 1rem; }
.site-header nav a:hover { color: var(--primary); }

.site-footer { border-top: 1px solid #1f2937; padding: 2rem 0; color: var(--muted); }
.footer-nav a { color: var(--text); text-decoration: underline; margin-left: 1rem; }
.footer-nav a:hover { color: var(--primary); }

h1, h2, h3 { margin: 0.5rem 0 1rem; }
p { color: var(--text); line-height: 1.5; }
small { color: var(--muted); }

input[type="text"], input[type="email"], input[type="password"], select {
    width: 100%; background: #0b1220; color: var(--text); border: 1px solid #1f2937; border-radius: 8px; padding: 0.75rem 0.9rem; outline: none; transition: border-color .2s;
}
input:focus { border-color: var(--primary); }

button, .btn { display: inline-block; border: none; border-radius: 8px; padding: 0.6rem 0.9rem; background: var(--primary); color: white; cursor: pointer; text-decoration: none; }
button:hover, .btn:hover { background: var(--primary-600); }
.btn-secondary { background: #374151; }
.btn-danger { background: var(--danger); }
.btn-success { background: var(--success); }

.card { background: var(--surface); border: 1px solid #1f2937; border-radius: 12px; padding: 1rem; }
.grid { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 640px) { .grid.cols-2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .grid.cols-3 { grid-template-columns: repeat(3, 1fr); } }

.book { display: flex; gap: 0.75rem; }
.book img { width: 72px; height: 108px; object-fit: cover; border-radius: 8px; border: 1px solid #1f2937; background: #0b1220; }
.book .meta { flex: 1; }
.actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.form { display: grid; gap: 0.75rem; }
.error { color: var(--danger); }
.success { color: var(--success); }

/* Collapsible sections */
details.card > summary { list-style: none; cursor: pointer; display: flex; align-items: center; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: '\25B6'; display: inline-block; margin-right: 8px; transition: transform .2s; }
details[open].card > summary::before { transform: rotate(90deg); }
details.card > summary h2 { display: inline; margin: 0; }

/* Scanner sizing */
#scanner { width: 100%; max-width: 720px; aspect-ratio: 16 / 9; height: auto; display: block; margin: 0 auto; background: #0b1220; border: 1px solid #1f2937; border-radius: 8px; position: relative; overflow: hidden; }
#scanner video, #scanner canvas { width: 100% !important; height: auto !important; display: block; }
/* Aiming overlay */
#scanner .aim { position: absolute; top: 25%; bottom: 25%; left: 10%; right: 10%; border: 2px solid rgba(124,58,237,0.85); border-radius: 10px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,0.25) inset; }


