:root {
    --bg-top: #f7efe2;
    --bg-bottom: #e9f1e2;
    --surface: #ffffff;
    --surface-soft: #f6f7f2;
    --ink-strong: #1c2618;
    --ink-soft: #4b5942;
    --primary: #3f5634;
    --primary-strong: #2f4327;
    --danger: #c0392b;
    --accent: #d9893f;
    --border: #dbe3d2;
    --shadow-soft: 0 20px 55px rgba(39, 52, 28, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    background: linear-gradient(165deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
    color: var(--ink-strong);
    font-family: "Sora", sans-serif;
    padding: 18px 14px 28px;
    position: relative;
}

.ambient {
    background:
        radial-gradient(circle at 10% 5%, rgba(217, 137, 63, 0.25), transparent 35%),
        radial-gradient(circle at 90% 0%, rgba(63, 86, 52, 0.22), transparent 45%),
        radial-gradient(circle at 50% 100%, rgba(72, 120, 84, 0.16), transparent 40%);
    inset: 0;
    pointer-events: none;
    position: fixed;
}

.app-shell {
    margin: 0 auto;
    max-width: 780px;
    position: relative;
    z-index: 1;
}

.hero {
    margin-bottom: 16px;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin: 0 0 8px;
    text-transform: uppercase;
}

h1 {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    line-height: 1.08;
    margin: 0;
}

.subtitle {
    color: var(--ink-soft);
    font-size: 0.95rem;
    line-height: 1.45;
    margin: 10px 0 0;
    max-width: 640px;
}

.scanner-panel,
.result-panel {
    backdrop-filter: blur(4px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid var(--border);
    border-radius: 22px;
    box-shadow: var(--shadow-soft);
    padding: 14px;
}

.result-panel {
    margin-top: 14px;
}

.scanner-frame {
    background:
        repeating-linear-gradient(
            -45deg,
            rgba(47, 67, 39, 0.06),
            rgba(47, 67, 39, 0.06) 12px,
            rgba(255, 255, 255, 0.3) 12px,
            rgba(255, 255, 255, 0.3) 24px
        );
    border: 2px dashed rgba(63, 86, 52, 0.4);
    border-radius: 18px;
    min-height: 230px;
    overflow: hidden;
    width: 100%;
}

#scanner video {
    border-radius: 16px;
}

.status-text {
    color: var(--ink-soft);
    font-size: 0.9rem;
    margin: 10px 0 12px;
}

.status-text[data-state="error"] {
    color: var(--danger);
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.btn {
    border: 0;
    border-radius: 12px;
    color: #ffffff;
    cursor: pointer;
    flex: 1 1 132px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.96rem;
    font-weight: 700;
    min-height: 44px;
    transition: transform 0.16s ease, filter 0.16s ease;
}

.btn:active {
    transform: translateY(1px);
}

.btn-start {
    background: linear-gradient(140deg, #6e945d 0%, #3f5634 100%);
}

.btn-stop {
    background: linear-gradient(140deg, #de7868 0%, #c0392b 100%);
}

.btn-reset {
    background: linear-gradient(140deg, #e2a15f 0%, #d9893f 100%);
}

.btn:hover {
    filter: brightness(1.03);
}

.manual-label {
    color: var(--ink-soft);
    display: block;
    font-size: 0.82rem;
    margin-top: 12px;
}

.manual-input {
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--ink-strong);
    font-family: inherit;
    font-size: 1rem;
    margin-top: 6px;
    min-height: 42px;
    outline: none;
    padding: 0 12px;
    width: 100%;
}

.manual-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(63, 86, 52, 0.16);
}

.result-head {
    align-items: center;
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.result-label {
    color: var(--ink-soft);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.09em;
}

.barcode-pill {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    font-family: "Space Grotesk", sans-serif;
    font-size: 0.86rem;
    font-weight: 700;
    max-width: 65%;
    overflow: hidden;
    padding: 6px 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.product-card {
    border: 1px solid var(--border);
    border-radius: 18px;
    display: grid;
    gap: 14px;
    overflow: hidden;
    padding: 10px;
}

.product-image-wrap {
    background: #edf3e7;
    border-radius: 13px;
    max-height: 280px;
    overflow: hidden;
}

.product-image-wrap img {
    display: block;
    height: 100%;
    object-fit: cover;
    width: 100%;
}

.product-body h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.15rem;
    line-height: 1.25;
    margin: 0 0 5px;
}

.product-code {
    color: var(--ink-soft);
    font-size: 0.9rem;
    margin: 0 0 10px;
}

.price-line {
    align-items: baseline;
    background: linear-gradient(145deg, rgba(63, 86, 52, 0.08), rgba(217, 137, 63, 0.12));
    border: 1px solid var(--border);
    border-radius: 12px;
    display: inline-flex;
    gap: 8px;
    margin-bottom: 12px;
    padding: 7px 10px;
}

.price-value {
    color: var(--primary-strong);
    font-family: "Space Grotesk", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
}

.price-unit {
    color: var(--ink-soft);
    font-size: 0.86rem;
}

.char-list {
    display: grid;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.char-item {
    background: var(--surface-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
}

.char-key {
    color: var(--ink-soft);
    display: block;
    font-size: 0.8rem;
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.char-value {
    color: var(--ink-strong);
    font-size: 0.9rem;
    line-height: 1.35;
    white-space: pre-wrap;
}

.error-text {
    color: var(--danger);
    font-size: 0.9rem;
    margin: 10px 0 0;
    min-height: 1.2em;
}

@media (min-width: 860px) {
    body {
        padding-top: 28px;
    }

    .app-shell {
        display: grid;
        gap: 16px;
        grid-template-columns: 1fr 1fr;
    }

    .hero {
        grid-column: 1 / -1;
    }

    .scanner-panel,
    .result-panel {
        height: 100%;
    }

    .scanner-frame {
        min-height: 320px;
    }
}
