/* Orbital Drift — Retro Minigame Styles */

.minigame-body {
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--bg-primary);
}

.minigame-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.minigame-header {
    text-align: center;
    margin-bottom: 1rem;
}

.minigame-header h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(1rem, 4vw, 1.5rem);
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-color);
    letter-spacing: 0.2em;
}

.minigame-header .tagline {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.crt-bezel {
    width: 100%;
    min-width: 680px;
    max-width: 1150px;
    background: #1a1a1a;
    padding: 16px 20px 14px;
    border-radius: 8px;
    box-shadow:
        inset 0 0 0 2px #0a0a0a,
        inset 0 2px 4px rgba(255, 255, 255, 0.05),
        0 4px 12px rgba(0, 0, 0, 0.4);
}

.crt-screen {
    position: relative;
    width: 100%;
    min-width: 640px;
    max-width: 1024px;
    aspect-ratio: 1024 / 768;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        inset 0 0 60px rgba(0, 0, 0, 0.9),
        inset 0 0 0 3px #111,
        0 0 0 1px #333;
}

.game-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><rect x="10" y="0" width="4" height="24" fill="%2300ff88"/><rect x="0" y="10" width="24" height="4" fill="%2300ff88"/><rect x="11" y="11" width="2" height="2" fill="%2300ff88"/></svg>') 12 12, crosshair;
}

[data-theme="dark"] .game-wrapper {
    /* Screen glow handled by crt-screen */
}

.crt-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(0, 0, 0, 0.06) 2px,
            rgba(0, 0, 0, 0.06) 4px
        );
    opacity: 0.6;
}

/* Curved CRT glass effect + edge vignette */
.crt-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 6px;
    background: radial-gradient(
        ellipse 80% 80% at 50% 50%,
        transparent 40%,
        rgba(0, 0, 0, 0.15) 100%
    );
}

/* Subtle screen reflection (CRT glass sheen) */
.crt-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 35%;
    pointer-events: none;
    background: linear-gradient(
        180deg,
        rgba(255, 255, 255, 0.05) 0%,
        transparent 100%
    );
}


#gameCanvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    background: radial-gradient(circle at center, #0a0a1a 0%, #000 70%);
}

[data-theme="light"] #gameCanvas {
    background: radial-gradient(circle at center, #1a1a2e 0%, #0d0d1a 70%);
}

.overlay-screen {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
}

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

.retro-box {
    background: var(--bg-secondary);
    border: 4px solid var(--accent-color);
    padding: 2rem;
    text-align: center;
    max-width: 320px;
}

.retro-box h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.retro-box p {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

.guidance-box {
    max-width: 420px;
}

.game-over-box {
    position: relative;
}

.game-over-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 32px;
    height: 32px;
    padding: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.game-over-close:hover {
    color: var(--accent-color);
}

.guidance-message {
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

.guidance-controls {
    font-size: 1rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.orb-dot, .rock-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    vertical-align: middle;
}

.orb-dot {
    background: #00ff88;
    box-shadow: 0 0 8px #00ff88;
}

.rock-dot {
    background: #ff4444;
}

.retro-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    padding: 0.8rem 1.5rem;
    margin-top: 1rem;
    background: var(--accent-color);
    color: var(--bg-primary);
    border: none;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><rect x="10" y="0" width="4" height="24" fill="%2300ff88"/><rect x="0" y="10" width="24" height="4" fill="%2300ff88"/><rect x="11" y="11" width="2" height="2" fill="%2300ff88"/></svg>') 12 12, crosshair;
    transition: transform 0.1s, box-shadow 0.1s;
}

.retro-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px var(--accent-color);
}

.retro-btn.secondary {
    background: transparent;
    color: var(--text-primary);
    border: 2px solid var(--accent-color);
    margin-left: 0.5rem;
}

.initials-form {
    margin: 1rem 0;
}

.initials-form label {
    display: block;
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.initials-form input {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.8rem;
    padding: 0.5rem;
    width: 80px;
    text-align: center;
    margin: 0.5rem 0;
}

/* Arcade intro — Retro CRT effect (dark green, scanlines, glow) */
.arcade-intro {
    align-items: center;
    justify-content: center;
    background: #0a1f10;
    /* position: relative; */
    /* Edge vignette for CRT depth */
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.5);
}

/* Scanlines overlay */
.arcade-intro::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.35) 2px,
        rgba(0, 0, 0, 0.35) 4px
    );
    opacity: 0.8;
}

/* Noise / grain overlay */
.arcade-intro::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.06;
}

.arcade-intro-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 1;
    margin-top: 4vh;
}

.arcade-title {
    margin: 0;
    margin-top: -6.5rem;
    line-height: 0;
}

.arcade-logo {
    display: block;
    max-width: 100%;
    width: 488px;
    height: auto;
    filter: drop-shadow(0 0 8px rgba(76, 175, 80, 0.6));
}

.arcade-intro-content {
    background: rgba(10, 31, 16, 0.95);
    border: 4px solid #4caf50;
    padding: 1.5rem 2rem;
    max-width: 520px;
    text-align: center;
    box-shadow:
        0 0 20px rgba(76, 175, 80, 0.3),
        inset 0 0 20px rgba(0, 0, 0, 0.4);
    /* Warped corners — subtle CRT tube curvature */
    border-radius: 18px 18px 28px 28px;
}

.arcade-tagline {
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    margin: 0 0 1rem 0;
    color: #81c784;
}

.arcade-scores {
    min-width: 140px;
}

.arcade-scores h3 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    margin: 0 0 0.5rem 0;
    color: #4caf50;
    text-shadow: 0 0 6px rgba(76, 175, 80, 0.5);
}

.arcade-scores ol {
    list-style: none;
    counter-reset: rank;
    margin: 0;
    padding: 0;
}

.arcade-scores li {
    font-family: 'VT323', monospace;
    font-size: 1.1rem;
    padding: 0.2rem 0;
    counter-increment: rank;
    display: grid;
    grid-template-columns: 3ch 3ch 1fr;
    gap: 0.5rem 1rem;
    align-items: center;
}

.arcade-scores li::before {
    content: counter(rank) ".";
    color: #4caf50;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
}

.arcade-scores .lb-initials {
    min-width: 3ch;
}

.arcade-scores .lb-score {
    text-align: right;
    color: #4caf50;
    text-shadow: 0 0 4px rgba(76, 175, 80, 0.4);
}

.arcade-scores li.empty {
    color: #5a8a5d;
    opacity: 0.6;
}

.arcade-start {
    margin-top: 1rem;
    font-size: 0.9rem;
    padding: 1rem 2rem;
    animation: arcade-pulse 1.5s ease-in-out infinite;
    background: #4caf50;
    color: #0a1f10;
    box-shadow: 0 0 12px rgba(76, 175, 80, 0.6);
}

.arcade-start:hover {
    box-shadow: 0 0 20px #4caf50;
}

@keyframes arcade-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Info button under screen */
.info-btn {
    display: block;
    width: 36px;
    height: 36px;
    margin: 0.5rem auto 0;
    font-family: 'Press Start 2P', monospace;
    font-size: 1rem;
    font-weight: bold;
    color: var(--accent-color);
    background: transparent;
    border: 2px solid var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    transition: box-shadow 0.2s, transform 0.1s;
}

.info-btn:hover {
    box-shadow: 0 0 10px var(--accent-color);
    transform: scale(1.05);
}

/* Info modal overlay */
.info-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
}

.info-box {
    max-width: 380px;
    text-align: left;
}

.info-tagline {
    font-family: 'VT323', monospace;
    font-size: 1.2rem;
    margin: 0.5rem 0 1rem;
    color: var(--text-secondary);
}

.info-controls h3 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    margin: 0 0 0.5rem 0;
    color: var(--accent-color);
}

.info-controls p {
    font-family: 'VT323', monospace;
    font-size: 1rem;
    margin: 0.3rem 0;
}

.minigame-footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
}

.minigame-footer .back-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: var(--accent-color);
}

.minigame-footer .back-link:hover {
    text-decoration: underline;
}
