:root {
    --bg: #080a0d;
    --panel: rgba(8, 11, 15, 0.68);
    --panel-strong: rgba(8, 11, 15, 0.88);
    --line: rgba(255, 255, 255, 0.16);
    --text: #f4f1e8;
    --muted: rgba(244, 241, 232, 0.78);
    --accent: #e5b64f;
    --accent-strong: #ffcf66;
    --ok: #5fe0a6;
    --warn: #ff8e72;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at top, rgba(229, 182, 79, 0.16), transparent 32%),
        linear-gradient(180deg, #0f151c 0%, #050608 100%);
    color: var(--text);
    font-family: "Gill Sans", "Trebuchet MS", sans-serif;
}

body {
    min-height: 100dvh;
}

.scanner-app {
    width: 100%;
    height: 100dvh;
    padding: clamp(10px, 2vw, 22px);
}

.camera-stage {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(5, 7, 10, 0.22), rgba(5, 7, 10, 0.8)),
        #000;
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.38),
        inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

#video,
#overlay {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

#video {
    object-fit: cover;
    background: #000;
}

#overlay {
    pointer-events: none;
}

.top-hud,
.bottom-hud {
    position: absolute;
    left: clamp(14px, 2vw, 24px);
    right: clamp(14px, 2vw, 24px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    z-index: 2;
}

.top-hud {
    top: clamp(14px, 2vw, 24px);
}

.bottom-hud {
    bottom: clamp(14px, 2vw, 24px);
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    font-size: clamp(14px, 1.6vw, 16px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.side-pill {
    font-weight: 700;
    color: var(--accent-strong);
}

.status-panel {
    position: absolute;
    left: 50%;
    bottom: clamp(92px, 14vh, 150px);
    width: min(92vw, 860px);
    transform: translateX(-50%);
    z-index: 2;
    padding: clamp(18px, 2.5vw, 28px);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(8, 11, 15, 0.78), rgba(8, 11, 15, 0.9));
    border: 1px solid var(--line);
    backdrop-filter: blur(12px);
    text-align: center;
}

.status-big {
    font-size: clamp(24px, 4vw, 44px);
    line-height: 1.02;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.status-small {
    margin-top: 10px;
    font-size: clamp(14px, 2vw, 19px);
    color: var(--muted);
}

.last-result {
    flex: 1 1 auto;
    min-height: 56px;
    padding: 14px 16px;
    border-radius: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    backdrop-filter: blur(10px);
    font-size: clamp(13px, 1.7vw, 16px);
    color: var(--muted);
}

.mini-controls {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;
}

.mini-button,
.start-camera {
    border: 0;
    cursor: pointer;
    color: #121212;
    font-weight: 700;
    font-family: inherit;
}

.mini-button {
    min-height: 52px;
    padding: 0 18px;
    border-radius: 18px;
    background: var(--accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.24);
}

.mini-button.secondary {
    background: rgba(255, 255, 255, 0.86);
}

.mini-button[disabled] {
    opacity: 0.52;
    cursor: default;
}

.start-camera {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    z-index: 4;
    min-width: min(78vw, 360px);
    min-height: 88px;
    padding: 18px 30px;
    border-radius: 26px;
    background: linear-gradient(180deg, #ffd27b 0%, #e5b64f 100%);
    box-shadow:
        0 24px 60px rgba(0, 0, 0, 0.34),
        inset 0 0 0 1px rgba(255, 255, 255, 0.45);
    font-size: clamp(24px, 3.8vw, 34px);
}

.start-camera.hidden {
    display: none;
}

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

.tone-warn .status-big {
    color: var(--warn);
}

.tone-info .status-big {
    color: var(--text);
}

@media (max-width: 900px) {
    .scanner-app {
        padding: 0;
    }

    .camera-stage {
        border-radius: 0;
    }

    .top-hud,
    .bottom-hud {
        left: 12px;
        right: 12px;
        gap: 10px;
    }

    .bottom-hud {
        flex-direction: column;
        align-items: stretch;
    }

    .mini-controls {
        width: 100%;
    }

    .mini-button {
        flex: 1 1 50%;
    }

    .status-panel {
        bottom: 124px;
        width: calc(100vw - 24px);
    }
}
