* {
    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;

    /* SAFE AREA FIX (HP modern) */
    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 CENTER FIX */
.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);
}

/* FIX VIDEO FULL COVER */
#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;
}

#startScanBtn {
    background: var(--primary);
    color: white;
    flex: 2;
}

#stopScanBtn {
    background: var(--danger);
    color: white;
    flex: 1;
}

#submitBtn {
    background: var(--primary);
    color: white;
    width: 100%;
    margin-top: 10px;
}

/* 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;
}

.input-group input,
.input-group textarea {
    width: 100%;
    background: var(--card2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    color: white;
    outline: none;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--primary);
}