/* ===========================================
   Motion GeoGuessr - Styles
   Modern dark theme with glassmorphism
   =========================================== */

:root {
    /* UniVerse Brand Colors - Light Theme */
    --primary: #1e3a5f;
    --primary-light: #3b82f6;
    --primary-dark: #0a192f;
    --secondary: #60a5fa;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;

    --bg-dark: #f5f8fc;
    --bg-darker: #ffffff;
    --surface: rgba(30, 58, 95, 0.05);
    --surface-light: rgba(30, 58, 95, 0.08);
    --glass: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(30, 58, 95, 0.15);

    --text-primary: #0a192f;
    --text-secondary: rgba(10, 25, 47, 0.7);
    --text-muted: rgba(10, 25, 47, 0.5);

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

    --shadow-sm: 0 2px 8px rgba(30, 58, 95, 0.08);
    --shadow-md: 0 4px 20px rgba(30, 58, 95, 0.1);
    --shadow-lg: 0 8px 40px rgba(30, 58, 95, 0.15);
    --shadow-glow: 0 0 30px rgba(59, 130, 246, 0.25);
}

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

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

.hidden {
    display: none !important;
}

/* ===========================================
   Loading Screen
   =========================================== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loader-content {
    text-align: center;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--surface-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 24px;
}

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

.loader-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loader-content p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===========================================
   Start Screen
   =========================================== */
.start-screen {
    position: fixed;
    inset: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
}

.start-content {
    text-align: center;
    padding: 48px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
}

.game-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 8px;
    line-height: 1.1;
}

.title-motion {
    display: block;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.title-geo {
    display: block;
    color: var(--text-primary);
}

.game-subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.start-instructions {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 32px;
    text-align: left;
}

.start-instructions h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--primary-light);
}

.start-instructions ul {
    list-style: none;
}

.start-instructions li {
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.start-instructions li strong {
    color: var(--text-primary);
}

.start-button {
    position: relative;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 16px 48px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.start-button:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.button-shine {
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shine 2s infinite;
}

@keyframes shine {
    to {
        left: 100%;
    }
}

.camera-notice {
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ===========================================
   Game Container
   =========================================== */
.game-container {
    position: fixed;
    inset: 0;
    background: var(--bg-dark);
}

.panorama-viewer {
    position: absolute;
    inset: 0;
    z-index: 1;
}

/* ===========================================
   Webcam Overlay
   =========================================== */
.webcam-container {
    position: absolute;
    bottom: 24px;
    left: 24px;
    width: 280px;
    height: 210px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-darker);
    border: 2px solid var(--glass-border);
    box-shadow: var(--shadow-lg);
    z-index: 100;
}

.webcam-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.gesture-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1);
}

.gesture-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.gesture-indicator.active {
    background: var(--primary);
    border-color: var(--primary-light);
}

/* ===========================================
   Game UI
   =========================================== */
.game-ui {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

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

/* Top Bar */
.top-bar {
    position: absolute;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 24px;
    background: var(--glass);
    backdrop-filter: blur(20px);
    padding: 12px 32px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-md);
}

.round-info,
.score-display {
    display: flex;
    align-items: center;
    gap: 8px;
}

.round-label,
.score-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.round-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.round-separator {
    color: var(--text-muted);
}

.round-total {
    font-size: 1rem;
    color: var(--text-secondary);
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

/* Controls Guide */
.controls-guide {
    position: absolute;
    top: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--glass);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 10px;
    border: 1px solid var(--glass-border);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.control-icon {
    font-size: 1.2rem;
}

/* Guess Button */
.guess-button {
    position: absolute;
    bottom: 24px;
    right: 24px;
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
    padding: 16px 32px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.guess-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.4);
}

/* Pause Button */
.pause-button {
    position: absolute;
    bottom: 24px;
    right: 220px;
    /* Positioned to the left of guess button */
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
    border: none;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-sm);
}

.pause-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.4);
}

.pause-button.paused {
    background: linear-gradient(135deg, var(--accent), #d97706);
    box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

.button-glow {
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    border-radius: inherit;
    z-index: -1;
}

/* Active Hand Cursor State */
.hand-cursor.active-hand {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.3);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
}

/* ===========================================
   Map Modal
   =========================================== */
.map-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.map-modal-content {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    padding: 32px;
    width: 90%;
    max-width: 800px;
    box-shadow: var(--shadow-lg);
}

.map-modal-content h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 1.5rem;
}

.guess-map {
    width: 100%;
    height: 400px;
    background: var(--surface);
    border-radius: 16px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    background-image: url('https://upload.wikimedia.org/wikipedia/commons/e/ea/Equirectangular-projection.jpg');
    background-size: cover;
    background-position: center;
    cursor: crosshair;
}

.map-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.confirm-btn {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.2s;
}

.confirm-btn:hover {
    transform: scale(1.05);
}

.cancel-btn {
    background: var(--surface-light);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}

.cancel-btn:hover {
    background: var(--surface);
}

/* ===========================================
   Results Modal
   =========================================== */
.results-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.results-content {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    padding: 48px;
    text-align: center;
    box-shadow: var(--shadow-lg);
    animation: popIn 0.3s ease-out;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.results-content h2 {
    font-size: 2rem;
    margin-bottom: 32px;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.results-stats {
    display: flex;
    gap: 48px;
    justify-content: center;
    margin-bottom: 32px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
}

.next-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    padding: 16px 48px;
    font-size: 1.1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.next-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* ===========================================
   Final Score Modal
   =========================================== */
.final-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
}

.final-content {
    text-align: center;
    animation: popIn 0.5s ease-out;
}

.final-content h1 {
    font-size: 3rem;
    margin-bottom: 32px;
}

.final-score {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    padding: 48px 64px;
    margin-bottom: 32px;
}

.final-label {
    display: block;
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.final-value {
    font-size: 5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.final-max {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.play-again-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 18px 56px;
    font-size: 1.2rem;
    font-weight: 600;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.play-again-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(139, 92, 246, 0.4);
}

/* ===========================================
   Map Marker
   =========================================== */
.map-marker {
    position: absolute;
    width: 20px;
    height: 20px;
    background: var(--danger);
    border: 3px solid white;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

.map-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    background: white;
    border-radius: 50%;
}

/* ===========================================
   Pannellum Overrides
   =========================================== */
.pnlm-container {
    background: var(--bg-darker) !important;
}

.pnlm-controls-container {
    display: none !important;
}

/* ===========================================
   Responsive Design
   =========================================== */
@media (max-width: 768px) {
    .webcam-container {
        width: 200px;
        height: 150px;
        bottom: 16px;
        left: 16px;
    }

    .controls-guide {
        display: none;
    }

    .top-bar {
        padding: 10px 20px;
        gap: 16px;
    }

    .game-title {
        font-size: 2rem;
    }

    .start-content {
        padding: 32px 24px;
        margin: 16px;
    }
}