:root {
    --bg: #f4efe6;
    --paper: rgba(255, 251, 245, 0.93);
    --ink: #1f2430;
    --muted: #5c6773;
    --line: rgba(31, 36, 48, 0.12);
    --accent: #1f6b57;
    --accent-soft: #dfeee7;
    --danger: #8a2f3b;
    --warning: #8b5c16;
    --shadow: 0 24px 60px rgba(18, 24, 38, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    color: var(--ink);
    font-family: Georgia, "Times New Roman", serif;
    background:
        radial-gradient(circle at top left, rgba(31, 107, 87, 0.16), transparent 30%),
        linear-gradient(180deg, #fbf8f2 0%, var(--bg) 100%);
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

button,
input,
textarea {
    font: inherit;
}

.shell {
    width: min(1180px, calc(100% - 28px));
    margin: 24px auto 40px;
}

.hero,
.panel,
.flash,
.result-card {
    border: 1px solid var(--line);
    background: var(--paper);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: 1.7fr 0.9fr;
    gap: 24px;
    padding: 32px;
}

.hero-copy {
    align-self: center;
}

.eyebrow,
.hero-label {
    margin: 0 0 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font: 600 0.74rem/1.4 Arial, sans-serif;
    color: var(--muted);
}

h1,
h2,
h3,
.book-title {
    margin: 0;
    line-height: 1.05;
}

h1 {
    font-size: clamp(2.8rem, 7vw, 5rem);
    max-width: 10ch;
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.1rem);
}

h3 {
    font-size: clamp(1.3rem, 2.5vw, 1.7rem);
}

.lead,
.muted,
.book-detail,
.book-authors,
.status,
.stat,
.badge,
label,
input,
textarea,
button {
    font-family: Arial, sans-serif;
}

.lead,
.muted,
.book-detail,
.book-authors,
.status {
    color: var(--muted);
}

.lead {
    max-width: 56ch;
    font-size: 1.08rem;
    line-height: 1.7;
}

.hero-actions,
.row,
.scan-actions,
.section-links {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.85fr);
    gap: 20px;
    margin-top: 20px;
}

.panel,
.hero-card,
.result-card {
    padding: 24px;
}

.panel {
    margin-top: 20px;
}

.grid .panel,
.grid .admin-panel {
    margin-top: 0;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin-bottom: 18px;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.row {
    align-items: center;
}

input[type="text"],
input[type="password"],
input[type="search"],
textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(31, 36, 48, 0.18);
    background: rgba(255, 255, 255, 0.95);
}

textarea {
    resize: vertical;
}

button,
.button {
    border: 0;
    border-radius: 999px;
    padding: 13px 18px;
    font-weight: 700;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

button,
.button.primary {
    color: #fff;
    background: var(--accent);
}

.button.secondary {
    color: var(--ink);
    background: var(--accent-soft);
}

.button.danger,
.danger {
    color: #fff;
    background: var(--danger);
}

.file-button {
    position: relative;
    overflow: hidden;
}

.file-button input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.flash {
    margin-top: 16px;
    padding: 16px 18px;
}

.flash.info {
    border-color: rgba(31, 107, 87, 0.26);
}

.flash.success {
    border-color: rgba(31, 107, 87, 0.3);
    color: var(--accent);
}

.flash.warning {
    border-color: rgba(139, 92, 22, 0.28);
    color: var(--warning);
}

.flash.error {
    border-color: rgba(138, 47, 59, 0.35);
    color: var(--danger);
}

.result-card {
    display: grid;
    grid-template-columns: 130px 1fr;
    gap: 18px;
    margin-top: 16px;
}

.duplicate-banner {
    margin-top: 16px;
    padding: 22px;
    border: 1px solid rgba(31, 107, 87, 0.24);
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(223, 238, 231, 0.92), rgba(255, 255, 255, 0.86));
}

.duplicate-meta {
    margin: 10px 0 0;
    color: var(--muted);
    font: 600 0.98rem/1.5 Arial, sans-serif;
}

.result-media img,
.book-cover {
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 18px;
    background: #eee7db;
}

.placeholder {
    display: grid;
    place-items: center;
    color: var(--muted);
    font: 700 0.9rem/1.4 Arial, sans-serif;
}

.badge {
    display: inline-flex;
    width: fit-content;
    margin: 0 0 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(31, 107, 87, 0.08);
}

.badge.success {
    color: var(--accent);
    background: rgba(31, 107, 87, 0.12);
}

.badge.pending {
    color: var(--warning);
    background: rgba(139, 92, 22, 0.12);
}

.camera-shell {
    margin-top: 16px;
}

#scanner-video {
    width: 100%;
    border-radius: 20px;
    background: #16191f;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px;
}

.book-card,
.tip-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.72);
}

.book-card {
    overflow: hidden;
}

.book-copy,
.tip-card {
    padding: 14px;
}

.book-title {
    font-size: 1.08rem;
}

.book-authors,
.book-detail {
    margin: 8px 0 0;
    line-height: 1.5;
}

.hero-card .stat {
    margin: 0 0 10px;
    font-size: 1.05rem;
}

.status.ok {
    color: var(--accent);
}

.hidden {
    display: none !important;
}

@media (max-width: 920px) {
    .hero,
    .grid,
    .result-card {
        grid-template-columns: 1fr;
    }

    .panel-head {
        align-items: start;
        flex-direction: column;
    }
}
