* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0f172a;
    --card: #1e293b;
    --card2: #334155;
    --primary: #22c55e;
    --danger: #ef4444;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: #475569;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;

    padding:
        env(safe-area-inset-top)
        0
        env(safe-area-inset-bottom);
}

.app {
    width: 100%;
    max-width: 500px;
    margin: auto;
    padding: 16px;
}

/* =========================
   TOPBAR
========================= */

.topbar {
    margin-bottom: 20px;
}

.topbar h1 {
    font-size: 26px;
    font-weight: bold;
    color: var(--primary);
}

.topbar p {
    color: var(--muted);
    font-size: 14px;
}

/* =========================
   CARD
========================= */

.scanner-section,
.result-section,
.form-section {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 16px;
    margin-bottom: 20px;
}

/* =========================
   SECTION TITLE
========================= */

.section-title {
    text-align: center;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 12px;
    letter-spacing: 1px;
}

/* =========================
   CAMERA
========================= */

.reader-container {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid var(--border);
}

/* VIDEO */

#reader {
    width: 100%;
}

#reader video {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* =========================
   CAMERA SELECT
========================= */

.camera-selector {
    margin-bottom: 15px;
}

.camera-selector select {
    width: 100%;
    background: var(--card2);
    color: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
}

/* =========================
   FLOATING INFO
========================= */

.floating-info {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    background: #1e293b;
    border: 2px solid var(--primary);
    border-radius: 16px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 12px 8px;
    z-index: 100;
    pointer-events: none;
    backdrop-filter: blur(6px);
}

.stat-item {
    text-align: center;
    flex: 1;
}

.stat-item small {
    display: block;
    color: var(--muted);
    font-size: 10px;
    text-transform: uppercase;
}

.stat-item span {
    display: block;
    color: var(--primary);
    font-size: 18px;
    font-weight: bold;
}

.stat-line {
    width: 1px;
    height: 25px;
    background: var(--border);
}

/* =========================
   BUTTONS
========================= */

.scanner-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

button {
    border: none;
    border-radius: 14px;
    padding: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

button:active {
    transform: scale(0.98);
}

/* START BUTTON */

#startScanBtn {
    background: var(--primary);
    color: white;
    flex: 2;
}

/* STOP BUTTON */

#stopScanBtn {
    background: var(--danger);
    color: white;
    flex: 1;
}

/* SUBMIT BUTTON */

#submitBtn {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 10px;
}

/* =========================
   SPIN REWARD BUTTON
========================= */

#spinRewardBtn {

    width: 100%;

    margin-top: 12px;

    padding: 14px;

    border: none;

    border-radius: 14px;

    background:
        linear-gradient(
            135deg,
            #fb923c,
            #ea580c
        );

    color: white;

    font-size: 16px;

    font-weight: bold;

    letter-spacing: 0.5px;

    cursor: pointer;

    transition: 0.25s;

    display: none;

    position: relative;

    overflow: hidden;

    box-shadow:
        0 6px 18px rgba(249, 115, 22, 0.35);
}

/* SHINE EFFECT */

#spinRewardBtn::before {

    content: "";

    position: absolute;

    top: 0;
    left: -120%;

    width: 80%;
    height: 100%;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(255,255,255,0.25),
            transparent
        );

    transform: skewX(-25deg);

    transition: 0.7s;
}

#spinRewardBtn:hover::before {

    left: 140%;
}

/* HOVER */

#spinRewardBtn:hover {

    filter: brightness(1.05);

    transform: translateY(-1px);
}

/* ACTIVE */

#spinRewardBtn:active {

    transform: scale(0.98);
}

/* SHOW */

#spinRewardBtn.show {

    display: block;

    animation:
        spinRewardPop 0.35s ease;
}

/* POP EFFECT */

@keyframes spinRewardPop {

    0% {

        opacity: 0;

        transform:
            translateY(10px)
            scale(0.92);
    }

    60% {

        opacity: 1;

        transform:
            translateY(-2px)
            scale(1.02);
    }

    100% {

        opacity: 1;

        transform:
            translateY(0)
            scale(1);
    }
}

/* =========================
   QR LIST
========================= */

.qr-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.qr-item {
    background: var(--card2);
    border-left: 4px solid var(--primary);
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
}

/* =========================
   FORM
========================= */

.input-group {
    margin-bottom: 15px;
}

/* LABEL */

.input-group label {
    display: block;
    text-align: left;
    font-size: 12px;
    margin-bottom: 6px;
    color: white;
}

/* INPUT + TEXTAREA + SELECT */

.input-group input,
.input-group textarea,
.input-group select {

    width: 100%;

    background: var(--card2);

    border: 1px solid var(--border);

    border-radius: 14px;

    padding: 14px;

    color: white;

    outline: none;

    font-size: 14px;

    transition: 0.2s;

    font-family: inherit;
}

/* PLACEHOLDER */

.input-group input::placeholder,
.input-group textarea::placeholder {
    color: #94a3b8;
}

/* FOCUS */

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {

    border-color: var(--primary);

    box-shadow:
        0 0 0 3px rgba(34, 197, 94, 0.12);
}

/* =========================
   SELECT STYLE
========================= */

.input-group select {

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    cursor: pointer;

    padding-right: 45px;

    background-color: var(--card2);

    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

    background-repeat: no-repeat;

    background-position: right 14px center;

    background-size: 16px;
}

/* OPTION */

.input-group select option {
    background: #1e293b;
    color: white;
}

/* =========================
   SCROLLBAR
========================= */

.qr-list::-webkit-scrollbar {
    width: 6px;
}

.qr-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* =========================
   MOBILE
========================= */

@media (max-width: 480px) {

    .topbar h1 {
        font-size: 22px;
    }

    .scanner-buttons {
        flex-direction: column;
    }

    #startScanBtn,
    #stopScanBtn {
        width: 100%;
    }
}