/* ===================================
   Space Travel Game - PDP-7 Retro Style
   Authentic 1969 vector graphics aesthetic
   =================================== */

/* Inline Game Container */
.inline-game-container {
    margin: 24px 0;
    scroll-margin-top: calc(var(--header-height) + 24px);
}

/* PDP-7 Computer Frame */
.pdp7-frame {
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 50%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 8px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        inset 0 -1px 0 rgba(0, 0, 0, 0.3);
    border: 2px solid #444;
}

.pdp7-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
    border-radius: 6px 6px 0 0;
    border-bottom: 2px solid #222;
}

.pdp7-lights {
    display: flex;
    gap: 8px;
}

.pdp7-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #222;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.pdp7-light.on {
    background: #ff4444;
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.3),
        0 0 8px rgba(255, 68, 68, 0.6);
    animation: lightBlink 2s ease-in-out infinite;
}

.pdp7-light.on:nth-child(2) { animation-delay: 0.5s; }
.pdp7-light.on:nth-child(3) { animation-delay: 1s; }
.pdp7-light.on:nth-child(4) { animation-delay: 1.5s; }

@keyframes lightBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.pdp7-title {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: bold;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    text-shadow: 0 1px 0 #000;
}

.pdp7-screen {
    position: relative;
    background: #000000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow:
        inset 0 0 100px rgba(255, 255, 255, 0.03),
        inset 0 0 50px rgba(0, 0, 0, 0.5);
}

.pdp7-screen canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* CRT screen effect */
.pdp7-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.15) 0px,
            rgba(0, 0, 0, 0.15) 1px,
            transparent 1px,
            transparent 2px
        );
    pointer-events: none;
    z-index: 10;
}

/* Screen flicker */
.pdp7-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.02);
    pointer-events: none;
    z-index: 11;
    animation: screenFlicker 0.1s infinite;
}

@keyframes screenFlicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.98; }
}

.pdp7-controls {
    display: flex;
    justify-content: center;
    padding: 12px 16px;
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
    border-radius: 0 0 6px 6px;
    border-top: 2px solid #444;
}

.pdp7-label {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

/* Game Canvas */
#game-canvas {
    display: block;
    width: 100%;
    height: auto;
    background: #000000;
    image-rendering: pixelated;
}

/* Retro Game Overlay */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 8, 0, 0.95);
    text-align: center;
    z-index: 20;
}

.game-overlay.hidden {
    display: none;
}

.retro-title {
    font-family: 'Courier New', monospace;
    font-size: 3rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow:
        0 0 10px #ffffff,
        0 0 20px #ffffff,
        0 0 40px #cccccc;
    letter-spacing: 0.3em;
    margin-bottom: 8px;
    animation: textGlow 2s ease-in-out infinite;
}

@keyframes textGlow {
    0%, 100% { text-shadow: 0 0 10px #ffffff, 0 0 20px #ffffff, 0 0 40px #cccccc; }
    50% { text-shadow: 0 0 20px #ffffff, 0 0 40px #ffffff, 0 0 60px #cccccc; }
}

.retro-subtitle {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    color: #cccccc;
    letter-spacing: 0.2em;
    margin-bottom: 32px;
}

.retro-instructions {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #888888;
    margin-bottom: 24px;
}

.retro-btn {
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    color: #ffffff;
    background: transparent;
    border: 2px solid #ffffff;
    padding: 16px 48px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.retro-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow:
        0 0 20px rgba(255, 255, 255, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

/* Retro HUD */
.retro-hud {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 15;
}

.retro-hud .hud-item {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 12px;
    border-radius: 0;
}

.retro-hud .hud-label {
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    color: #cccccc;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.retro-hud .hud-value {
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 5px #ffffff;
}

/* Retro Fuel Bar */
.retro-fuel {
    width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 0;
    overflow: hidden;
    margin-top: 4px;
}

.retro-fuel .fuel-fill {
    height: 100%;
    background: #ffffff;
    box-shadow: 0 0 10px #ffffff;
    border-radius: 0;
    transition: width 0.3s ease;
}

.retro-fuel .fuel-fill.low {
    background: #ffff00;
    box-shadow: 0 0 10px #ffff00;
    animation: fuelWarning 0.3s ease infinite alternate;
}

@keyframes fuelWarning {
    from { opacity: 0.5; }
    to { opacity: 1; }
}

/* Game End Screen - Retro Style */
.game-end-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 8, 0, 0.95);
    text-align: center;
    z-index: 25;
}

.game-end-screen.hidden {
    display: none;
}

.game-end-screen h3 {
    font-family: 'Courier New', monospace;
    font-size: 2rem;
    color: #ffffff;
    text-shadow: 0 0 10px #ffffff;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.game-end-screen.lose h3 {
    color: #ff0000;
    text-shadow: 0 0 10px #ff0000;
}

.game-end-screen .final-score {
    font-family: 'Courier New', monospace;
    font-size: 4rem;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 0 20px #ffffff;
    margin-bottom: 8px;
}

.game-end-screen p {
    font-family: 'Courier New', monospace;
    color: #888888;
    margin-bottom: 24px;
}

/* Inline Terminal Styling */
.inline-terminal-section {
    margin: 32px 0;
    scroll-margin-top: calc(var(--header-height) + 24px);
}

.inline-terminal-section h3 {
    margin-bottom: 12px;
}

.inline-terminal-section > p {
    margin-bottom: 16px;
}

.inline-terminal-container {
    scroll-margin-top: calc(var(--header-height) + 24px);
}

.retro-terminal-frame {
    background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 50%, #1a1a1a 100%);
    border-radius: 12px;
    padding: 8px;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    border: 2px solid #444;
}

.retro-terminal-header {
    padding: 8px 16px;
    background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
    border-radius: 6px 6px 0 0;
    border-bottom: 2px solid #222;
}

.retro-terminal-title {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.retro-terminal-screen {
    background: #0a0a0a;
    min-height: 300px;
    border-radius: 0 0 6px 6px;
    position: relative;
    overflow: hidden;
}

/* CRT effect for terminal */
.retro-terminal-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(0, 0, 0, 0.1) 0px,
            rgba(0, 0, 0, 0.1) 1px,
            transparent 1px,
            transparent 2px
        );
    pointer-events: none;
    z-index: 10;
}

.retro-terminal-screen #terminal {
    height: 300px;
    padding: 12px;
    font-family: 'Courier New', monospace !important;
}

.inline-hints {
    background: #2a2a2a;
    padding: 12px 16px;
    border-top: 1px solid #444;
}

.hint-btn.retro-hint {
    background: #1a1a1a;
    border: 1px solid #cccccc;
    color: #ffffff;
    font-family: 'Courier New', monospace;
    padding: 6px 16px;
    border-radius: 0;
    transition: all 0.2s ease;
}

.hint-btn.retro-hint:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .retro-title {
        font-size: 2rem;
    }

    .pdp7-title {
        font-size: 0.7rem;
    }

    .retro-hud {
        flex-wrap: wrap;
        gap: 8px;
    }

    .retro-hud .hud-item {
        padding: 4px 8px;
    }

    .retro-fuel {
        width: 60px;
    }
}

/* Goal text styling */
.retro-goal {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #cccccc;
    margin-bottom: 16px;
    line-height: 1.6;
}

.retro-goal strong {
    color: #ffffff;
    text-shadow: 0 0 8px #ffffff;
}

/* Mobile Game Controls */
.mobile-game-controls {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #111;
    border-top: 1px solid #333;
}

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

.game-btn {
    width: 60px;
    height: 50px;
    background: #222;
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 1.2rem;
    font-family: 'Courier New', monospace;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.game-btn:active {
    background: #444;
    border-color: #fff;
}

.game-btn small {
    font-size: 0.5rem;
    display: block;
    margin-top: 2px;
}

.game-btn.land-btn {
    width: 70px;
    font-size: 0.8rem;
    background: #333;
}

/* Show mobile controls only on touch devices / small screens */
@media (max-width: 768px) {
    .mobile-game-controls {
        display: flex;
    }
}

@media (hover: none) and (pointer: coarse) {
    .mobile-game-controls {
        display: flex;
    }
}
