:root {
    --bg-dark: #07090e;
    --card-bg: rgba(255, 255, 255, 0.04);
    --border-light: rgba(255, 255, 255, 0.12);
    --primary: #8b5cf6;
    --primary-glow: rgba(139, 92, 246, 0.5);
    --accent: #ec4899;
    --accent-glow: rgba(236, 72, 153, 0.5);
    --text-light: #f9fafb;
    --text-dim: #9ca3af;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(139, 92, 246, 0.18) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(236, 72, 153, 0.18) 0%, transparent 45%);
}

/* App Header & Timer */
.kiosk-header {
    height: 70px;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    z-index: 10;
}

.kiosk-brand {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    background: linear-gradient(135deg, #a855f7, #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-timer-container {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 20px;
    border-radius: 30px;
}

.timer-label {
    font-size: 13px;
    font-weight: 600;
    color: #fca5a5;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.timer-value {
    font-family: monospace;
    font-size: 22px;
    font-weight: 800;
    color: #ef4444;
}

/* Main View Container */
.kiosk-main {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.step-screen {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: scale(0.98);
}

.step-screen.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* Screen 1: Start */
.start-box {
    text-align: center;
    max-width: 600px;
}

.start-title {
    font-family: 'Outfit', sans-serif;
    font-size: 52px;
    font-weight: 800;
    margin-bottom: 16px;
    line-height: 1.1;
    background: linear-gradient(135deg, #ffffff 30%, #d8b4fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.start-subtitle {
    font-size: 18px;
    color: var(--text-dim);
    margin-bottom: 40px;
    line-height: 1.5;
}

.btn-start {
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    padding: 22px 64px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 10px 40px var(--primary-glow);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-start:hover {
    transform: translateY(-4px) scale(1.03);
    box-shadow: 0 16px 50px var(--accent-glow);
}

/* Screen 2: Camera Capture */
.capture-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
    max-width: 900px;
}

.camera-container {
    position: relative;
    width: 100%;
    max-width: 720px;
    aspect-ratio: 4 / 3;
    background: #000;
    border-radius: 24px;
    overflow: hidden;
    border: 2px solid var(--border-light);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}

#webcam {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera view */
}

/* Flash effect overlay */
.flash-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #fff;
    opacity: 0;
    pointer-events: none;
    z-index: 20;
}

.flash-overlay.snap {
    animation: flashAnim 0.3s ease-out;
}

@keyframes flashAnim {
    0% { opacity: 0.95; }
    100% { opacity: 0; }
}

/* Countdown Overlay */
.countdown-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
    z-index: 15;
}

.countdown-number {
    font-family: 'Outfit', sans-serif;
    font-size: 130px;
    font-weight: 800;
    color: #fff;
    text-shadow: 0 10px 30px rgba(0,0,0,0.8);
    animation: popNum 0.8s ease infinite;
}

@keyframes popNum {
    0% { transform: scale(0.6); opacity: 0.2; }
    50% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 0.9; }
}

.photo-counter-badge {
    position: absolute;
    top: 20px; left: 20px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 15px;
    font-weight: 700;
    z-index: 10;
}

/* Live captured photo thumbnails preview */
.thumbnails-strip {
    display: flex;
    gap: 16px;
    margin-top: 10px;
}

.thumb-slot {
    width: 100px;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: var(--text-dim);
}

.thumb-slot img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Screen 3: Preview & Frame Selector */
.editor-layout {
    display: flex;
    gap: 36px;
    width: 100%;
    max-width: 1100px;
    height: 85%;
    align-items: center;
}

.frame-preview-box {
    flex: 1;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 24px;
    padding: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
}

#canvas-preview {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.8);
}

.sidebar-controls {
    width: 380px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.control-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    padding: 24px;
}

.control-title {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.frames-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.frame-item {
    border: 2px solid var(--border-light);
    border-radius: 14px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.frame-item:hover, .frame-item.active {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.15);
    box-shadow: 0 0 15px var(--primary-glow);
}

.frame-item-name {
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-confirm {
    padding: 18px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 8px 25px var(--primary-glow);
    transition: all 0.2s ease;
}

.btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px var(--accent-glow);
}

.btn-retake {
    padding: 16px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-light);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-retake:hover {
    background: rgba(255, 255, 255, 0.15);
}

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

.btn-reset-session {
    padding: 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    font-weight: 700;
    font-size: 15px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-reset-session:hover {
    background: rgba(239, 68, 68, 0.3);
    color: #ffffff;
    border-color: rgba(239, 68, 68, 0.5);
    transform: translateY(-2px);
}

/* Screen 4: Ready to Print & QR Code */
.ready-box {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    backdrop-filter: blur(16px);
    border-radius: 28px;
    padding: 40px;
    max-width: 850px;
    width: 100%;
    display: flex;
    gap: 40px;
    align-items: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.7);
}

.ready-left {
    width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final-preview-img {
    width: 100%;
    max-height: 420px;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.ready-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ready-title {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 8px;
}

.ready-desc {
    font-size: 15px;
    color: var(--text-dim);
    margin-bottom: 24px;
    line-height: 1.5;
}

.qr-card {
    background: #fff;
    padding: 16px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-bottom: 24px;
}

#qrcode-container {
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#qrcode-container img, #qrcode-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.btn-finish {
    padding: 16px 36px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
}

.btn-finish:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(16, 185, 129, 0.6);
}
