/* =========================================
   SPACEGAME SECTION - APPLE STYLE
   Cinematic Game Interface
========================================= */

/* Variables */
:root {
    --game-font-display: 'Outfit', sans-serif;
    --game-font-body: 'Inter', sans-serif;
    --game-text: #ffffff;
    --game-text-muted: rgba(255, 255, 255, 0.7);
    --game-accent: #8a2be2;
    --game-accent-light: rgba(138, 43, 226, 0.2);
    --game-border: rgba(255, 255, 255, 0.1);
    --game-card-bg: rgba(20, 15, 30, 0.85);
    --game-transition: 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* =========================================
   Section Container
========================================= */
.spacegame-section {
    position: relative;
    min-height: 100vh;
    padding: 120px 40px;

    /* Transparent - shows starry background */
    background: transparent;
}

.spacegame-container {
    max-width: 1100px;
    margin: 0 auto;
}

/* =========================================
   Section Header
========================================= */
.spacegame-header {
    text-align: center;
    margin-bottom: 48px;
}

.spacegame-title {
    font-family: var(--game-font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 100;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--game-text);
    margin: 0 0 16px;

    text-shadow: 0 0 40px rgba(138, 43, 226, 0.3);
}

.spacegame-subtitle {
    font-family: var(--game-font-body);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--game-text-muted);
    margin: 0;
}

/* =========================================
   Game Wrapper
========================================= */
.spacegame-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.canvas-container {
    position: relative;
    width: 100%;
    border-radius: 24px;
    overflow: hidden;

    /* Glassmorphism frame */
    background: var(--game-card-bg);
    border: 1px solid var(--game-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.4);
}

#gameCanvas {
    display: block;
    width: 100%;
    height: 500px;
    background: #000;
}

/* =========================================
   Game Overlay
========================================= */
.game-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.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 32px;
    padding: 40px;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* =========================================
   Instructions
========================================= */
.game-instructions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 16px;
}

.instruction-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;

    background: linear-gradient(135deg, var(--game-accent) 0%, #6a1fb8 100%);
    border-radius: 50%;

    font-family: var(--game-font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;

    box-shadow: 0 4px 20px rgba(138, 43, 226, 0.4);
}

.instruction-text {
    font-family: var(--game-font-body);
    font-size: 1rem;
    font-weight: 400;
    color: var(--game-text);
}

/* =========================================
   Game Buttons
========================================= */
.game-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
}

.game-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    font-family: var(--game-font-display);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--game-text);

    padding: 14px 28px;
    background: transparent;
    border: 1px solid var(--game-border);
    border-radius: 50px;
    cursor: pointer;

    transition: all var(--game-transition);
}

.game-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.03);
}

.game-btn i {
    font-size: 0.9rem;
}

/* Primary Button */
.game-btn-primary {
    background: linear-gradient(135deg, var(--game-accent) 0%, #6a1fb8 100%);
    border: none;
    box-shadow: 0 8px 30px rgba(138, 43, 226, 0.3);
}

.game-btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(138, 43, 226, 0.4);
}

/* Accent Button */
.game-btn-accent {
    background: rgba(138, 43, 226, 0.2);
    border-color: rgba(138, 43, 226, 0.4);
}

.game-btn-accent:hover {
    background: rgba(138, 43, 226, 0.3);
    border-color: rgba(138, 43, 226, 0.6);
}

/* Secondary Button (Route) */
.game-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 10px;

    font-family: var(--game-font-display);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--game-text-muted);

    padding: 12px 24px;
    background: var(--game-card-bg);
    border: 1px solid var(--game-border);
    border-radius: 50px;
    cursor: pointer;

    transition: all var(--game-transition);
}

.game-btn-secondary:hover {
    color: var(--game-text);
    border-color: rgba(138, 43, 226, 0.4);
}

.game-btn-secondary i {
    font-size: 0.85rem;
}

/* =========================================
   Win/Lose Messages
========================================= */
.lose-title {
    display: block;
    font-family: var(--game-font-display);
    font-size: 2.5rem;
    font-weight: 300;
    color: #ff6b6b;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.win-title {
    display: block;
    font-family: var(--game-font-display);
    font-size: 2.5rem;
    font-weight: 300;
    color: #69db7c;
    margin-bottom: 16px;
    text-shadow: 0 0 20px rgba(105, 219, 124, 0.5);
}

.reward-text {
    display: block;
    font-family: var(--game-font-body);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--game-text);
    margin-top: 12px;
}

.footnote {
    display: block;
    font-family: var(--game-font-body);
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--game-text-muted);
    margin-top: 8px;
    font-style: italic;
}

#endMessage {
    text-align: center;
    line-height: 1.6;
}

/* =========================================
   Mobile Styles
========================================= */
@media (max-width: 768px) {
    .spacegame-section {
        padding: 80px 20px;
    }

    .spacegame-header {
        margin-bottom: 32px;
    }

    .spacegame-title {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
        letter-spacing: 0.08em;
    }

    .canvas-container {
        border-radius: 16px;
    }

    #gameCanvas {
        height: 400px;
    }

    .overlay-content {
        padding: 24px;
        gap: 24px;
    }

    .instruction-item {
        gap: 12px;
    }

    .instruction-number {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
    }

    .instruction-text {
        font-size: 0.9rem;
    }

    .game-buttons {
        gap: 12px;
    }

    .game-btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }

    .game-btn-secondary {
        padding: 10px 20px;
        font-size: 0.85rem;
    }
}

/* Extra small mobile - more elongated canvas */
@media (max-width: 480px) {
    #gameCanvas {
        height: 500px;
        /* Taller on small screens */
    }
}

/* Touch lock - only when game is actively running */
.canvas-container.game-running {
    touch-action: none;
}

/* Desktop/Mobile instruction visibility */
.mobile-only {
    display: none;
}

.desktop-only {
    display: flex;
}

@media (max-width: 768px) {
    .mobile-only {
        display: flex;
    }

    .desktop-only {
        display: none;
    }
}

/* Mobile hint styling */
.mobile-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    margin-top: 12px;
    text-align: center;
}