:root {
    --bg-dark: #0f1115;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent: #d4af37;
    /* Gold accent for premium feel */
    --accent-glow: rgba(212, 175, 55, 0.3);
    --glass-bg: rgba(20, 20, 30, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#app {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Canvas & Video Layer */
#canvas-wrapper {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #000;
}

#webcam,
#ar-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Force no mirroring */
    transform: none !important;
}

#ar-canvas {
    z-index: 2;
}

/* UI Overlay Layer */
.ui-layer {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    pointer-events: none;
    /* Let clicks pass through to canvas if needed */
}

.ui-layer>* {
    pointer-events: auto;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: var(--glass-bg);
    padding: 16px 24px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    animation: slideDown 0.6s ease-out;
}

.brand {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: var(--text-primary);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #555;
    transition: background 0.3s ease;
}

.status-indicator.ready .dot {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

/* Guide Wrapper */
.viewport-guide {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.viewport-guide.active {
    opacity: 1;
}

.guide-frame {
    width: 280px;
    height: 280px;
    border: 2px dashed rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    margin-bottom: 16px;
}

.guide-text {
    font-family: var(--font-heading);
    background: rgba(0, 0, 0, 0.6);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
}

/* Controls */
.controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding-bottom: 20px;
    animation: slideUp 0.6s ease-out;
}

.watch-selector {
    display: flex;
    gap: 12px;
    background: var(--glass-bg);
    padding: 8px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.selector-btn {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    border: 2px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    cursor: pointer;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.selector-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 4px;
}

.selector-btn.active {
    border-color: var(--accent);
    background: rgba(212, 175, 55, 0.1);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--text-primary);
    color: var(--bg-dark);
    border: none;
    padding: 12px 24px;
    border-radius: 30px;
    font-family: var(--font-heading);
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.action-btn:active {
    transform: scale(0.96);
}

/* Loader */
.loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    background: var(--bg-dark);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    transition: opacity 0.5s ease;
    opacity: 0;
    pointer-events: none;
}

.loader.active {
    opacity: 1;
    pointer-events: auto;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive */
@media (min-width: 768px) {
    .controls {
        flex-direction: row;
        justify-content: center;
    }

    .watch-selector {
        padding: 12px;
    }

    .selector-btn {
        width: 80px;
        height: 80px;
    }
}

/* --- Landing Page --- */
.landing-page {
    position: absolute;
    inset: 0;
    z-index: 50;
    background: radial-gradient(circle at center, #1a1d24 0%, var(--bg-dark) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.landing-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    animation: fadeIn 0.8s ease-out;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 3rem;
    letter-spacing: 4px;
    font-weight: 600;
    background: linear-gradient(135deg, #fff 40%, var(--accent) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.hero-watch {
    width: 220px;
    height: 220px;
    margin: 20px 0;
    position: relative;
}

.hero-watch img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 20px 30px rgba(0, 0, 0, 0.5));
    animation: float 6s ease-in-out infinite;
}

.primary-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--accent);
    color: #000;
    border: none;
    padding: 16px 40px;
    border-radius: 40px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px var(--accent-glow);
}

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

/* --- QR Modal --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(20, 20, 25, 0.95);
    padding: 40px;
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    text-align: center;
    position: relative;
    max-width: 90%;
    width: 360px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
}

.close-modal:hover {
    color: var(--text-primary);
}

.qr-frame {
    background: white;
    padding: 16px;
    border-radius: 16px;
    margin: 24px 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#qr-code {
    width: 100%;
    height: auto;
    display: block;
}

/* --- Animations --- */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Privacy Modal Specifics --- */
.privacy-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 24px 0;
    text-align: left;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
    width: 100%;
}

.secondary-btn {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 12px;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: underline;
    opacity: 0.7;
    transition: all 0.3s ease;
}

.secondary-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}