* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #0f172a;
    color: #fff;
}

a {
    color: inherit;
}

.btn {
    font-family: inherit;
    border: none;
    cursor: pointer;
    border-radius: 12px;
    padding: 14px 28px;
    font-size: 1.05rem;
    font-weight: 700;
    transition: transform 0.15s, box-shadow 0.15s;
}

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

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.btn-primary {
    background: white;
    color: #FF9800;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.12);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

/* ============================================
   SETUP SCREEN
   ============================================ */
.setup-screen {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #FFD34D 0%, #8A4CF5 55%, #B97ADB 100%);
    padding: 20px;
}

.setup-card {
    max-width: 420px;
    width: 100%;
    background: white;
    color: #333;
    border-radius: 20px;
    padding: 40px 32px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.setup-card .back-link {
    display: inline-block;
    margin-bottom: 18px;
    font-size: 0.9rem;
    color: #8A4CF5;
    text-decoration: none;
    font-weight: 600;
}

.setup-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

.setup-card h1 {
    font-size: 1.7rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.setup-card p.setup-subtitle {
    color: #666;
    margin-bottom: 18px;
    line-height: 1.5;
}

.setup-trust {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    margin-bottom: 24px;
}

.setup-trust span {
    background: #f3effc;
    color: #6b3fb3;
    font-size: 0.78rem;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: 999px;
}

.setup-card .btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #FFCB2B 0%, #FFA500 100%);
    color: white;
}

.setup-status {
    margin-top: 16px;
    font-size: 0.88rem;
    color: #b91c1c;
    min-height: 18px;
}

/* ============================================
   CAMERA SCREEN
   ============================================ */
.camera-screen {
    position: fixed;
    inset: 0;
    display: none;
    background: #000;
}

.camera-screen.active {
    display: block;
}

.camera-screen video,
.camera-screen canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-screen canvas {
    pointer-events: none;
}

.top-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.65), transparent);
}

.detected-count {
    font-weight: 800;
    font-size: 1.1rem;
    background: rgba(15, 23, 42, 0.7);
    padding: 8px 16px;
    border-radius: 999px;
}

.exit-btn {
    font-family: inherit;
    background: rgba(15, 23, 42, 0.7);
    color: white;
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 700;
    cursor: pointer;
}

.bottom-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 5;
    padding: 16px 18px 22px;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.75), transparent);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.repeat-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    background: rgba(15, 23, 42, 0.6);
    padding: 14px 22px;
    border-radius: 999px;
    cursor: pointer;
    user-select: none;
}

.repeat-toggle input {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    accent-color: #8A4CF5;
}

.picked-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    max-width: 100%;
    font-size: 0.85rem;
}

.picked-chip {
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 10px;
    border-radius: 999px;
}

.controls-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.pick-status {
    font-size: 0.9rem;
    color: #fbbf24;
    text-align: center;
    min-height: 18px;
}

/* ============================================
   PICK RESULT MODAL
   ============================================ */
.pick-modal {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.82);
    padding: 20px;
}

.pick-modal.active {
    display: flex;
}

.pick-modal-card {
    background: white;
    color: #333;
    border-radius: 24px;
    padding: 48px 40px;
    text-align: center;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.pick-modal-label {
    font-size: 1rem;
    font-weight: 700;
    color: #8A4CF5;
    margin-bottom: 12px;
}

.pick-modal-number {
    font-size: 4rem;
    font-weight: 900;
    color: #333;
    margin-bottom: 28px;
    font-variant-numeric: tabular-nums;
}

.pick-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pick-modal-actions .btn-primary {
    background: linear-gradient(135deg, #FFCB2B 0%, #FFA500 100%);
    color: white;
}

.pick-modal-actions .btn-secondary {
    background: #f2f2f2;
    color: #555;
    border: none;
}

@media (max-width: 480px) {
    .setup-card {
        padding: 32px 22px;
    }

    .pick-modal-number {
        font-size: 3.2rem;
    }
}
