/* ============================================
   HAWKINS ARCADE '91 - Main Styles
   90s Arcade Cabinet Aesthetic
   ============================================ */

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

:root {
    /* Normal Mode Colors */
    --bg-dark: #0a0a1a;
    --bg-purple: #1a0a2e;
    --neon-red: #ff0040;
    --neon-pink: #ff0080;
    --neon-blue: #00ffff;
    --neon-yellow: #ffff00;
    --neon-green: #00ff00;
    --arcade-gold: #ffd700;
    --text-white: #ffffff;
    --text-dim: #888899;

    /* Upside Down Colors */
    --ud-bg: #0a1015;
    --ud-accent: #2a3a4a;
    --ud-red: #8b0000;
    --ud-blue: #1a3a5a;

    /* Cabinet Colors */
    --cabinet-dark: #1a1a2e;
    --cabinet-accent: #2a2a4e;
    --cabinet-border: #3a3a5e;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    font-family: 'Press Start 2P', monospace;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #0a0a1a 0%, #1a0a2e 50%, #0a0a1a 100%);
}

/* ============================================
   ARCADE CABINET FRAME
   ============================================ */

.arcade-cabinet {
    width: 100%;
    max-width: 420px;
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--cabinet-dark);
    position: relative;
    overflow: hidden;
}

.cabinet-top {
    flex-shrink: 0;
    padding: 8px;
    background: linear-gradient(180deg, #2a2a4e 0%, #1a1a2e 100%);
    border-bottom: 3px solid var(--cabinet-border);
}

.cabinet-marquee {
    background: linear-gradient(180deg, #000 0%, #1a0020 50%, #000 100%);
    border: 2px solid var(--neon-red);
    border-radius: 4px;
    padding: 8px 12px;
    text-align: center;
    box-shadow:
        0 0 10px var(--neon-red),
        inset 0 0 20px rgba(255, 0, 64, 0.3);
    display: flex;
    justify-content: center;
    align-items: baseline;
    gap: 8px;
}

.marquee-text {
    font-size: 14px;
    color: var(--neon-red);
    text-shadow:
        0 0 5px var(--neon-red),
        0 0 10px var(--neon-red),
        0 0 20px var(--neon-red);
    animation: neonFlicker 3s infinite;
}

.marquee-year {
    font-size: 10px;
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

/* ============================================
   CABINET SCREEN AREA
   ============================================ */

.cabinet-screen {
    flex: 1;
    position: relative;
    background: #000;
    margin: 8px;
    border-radius: 8px;
    overflow: hidden;
    border: 4px solid var(--cabinet-border);
    box-shadow:
        inset 0 0 50px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(0, 255, 255, 0.1);
}

.game-container {
    width: 100%;
    height: 100%;
    position: relative;
    background: linear-gradient(180deg, #0a0520 0%, #150a30 50%, #0a0520 100%);
}

/* ============================================
   SCREENS
   ============================================ */

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.screen.active {
    display: flex;
    opacity: 1;
}

/* ============================================
   START SCREEN
   ============================================ */

.start-screen {
    gap: 16px;
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0520 70%);
}

.title-container {
    text-align: center;
    margin-bottom: 10px;
}

.game-title {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.title-hawkins {
    font-size: 24px;
    color: var(--neon-red);
    text-shadow:
        0 0 5px var(--neon-red),
        0 0 10px var(--neon-red),
        0 0 20px var(--neon-red),
        0 0 40px var(--neon-red);
    animation: neonFlicker 2s infinite;
    letter-spacing: 4px;
}

.title-arcade {
    font-size: 20px;
    color: var(--neon-blue);
    text-shadow:
        0 0 5px var(--neon-blue),
        0 0 10px var(--neon-blue),
        0 0 20px var(--neon-blue);
    letter-spacing: 6px;
}

.title-year {
    font-size: 14px;
    color: var(--arcade-gold);
    text-shadow: 0 0 10px var(--arcade-gold);
}

.title-subtitle {
    font-size: 8px;
    color: var(--text-dim);
    margin-top: 8px;
    letter-spacing: 3px;
}

.high-score-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--arcade-gold);
    border-radius: 4px;
}

.high-score-display .label {
    font-size: 8px;
    color: var(--arcade-gold);
}

.high-score-display .score {
    font-size: 18px;
    color: var(--neon-yellow);
    text-shadow: 0 0 10px var(--neon-yellow);
}

.name-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.input-label {
    font-size: 8px;
    color: var(--text-dim);
}

.name-input {
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    padding: 12px 16px;
    background: #000;
    border: 2px solid var(--neon-blue);
    color: var(--neon-blue);
    text-align: center;
    text-transform: uppercase;
    outline: none;
    border-radius: 4px;
    width: 200px;
}

.name-input:focus {
    border-color: var(--neon-pink);
    box-shadow: 0 0 15px var(--neon-pink);
}

.name-input::placeholder {
    color: #334;
}

/* ============================================
   ARCADE BUTTONS
   ============================================ */

.arcade-btn {
    font-family: 'Press Start 2P', monospace;
    font-size: 12px;
    padding: 14px 28px;
    background: linear-gradient(180deg, #2a2a4e 0%, #1a1a2e 100%);
    border: 3px solid var(--neon-red);
    color: var(--neon-red);
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.1s ease;
    text-transform: uppercase;
    min-width: 180px;
    position: relative;
    overflow: hidden;
}

.arcade-btn:hover, .arcade-btn:active {
    background: var(--neon-red);
    color: #000;
    box-shadow:
        0 0 20px var(--neon-red),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
    transform: scale(1.02);
}

.arcade-btn:active {
    transform: scale(0.98);
}

.leaderboard-btn {
    border-color: var(--neon-blue);
    color: var(--neon-blue);
}

.leaderboard-btn:hover, .leaderboard-btn:active {
    background: var(--neon-blue);
    box-shadow: 0 0 20px var(--neon-blue);
}

.insert-coin {
    font-size: 10px;
    color: var(--arcade-gold);
    animation: blink 1s infinite;
    margin-top: 10px;
}

.credits {
    position: absolute;
    bottom: 12px;
    font-size: 8px;
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.credits .production {
    font-size: 6px;
    color: var(--text-dim);
    text-shadow: none;
    letter-spacing: 2px;
}

/* ============================================
   GAME SCREEN
   ============================================ */

.game-screen {
    padding: 0;
}

.game-hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 8px;
    background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%);
    z-index: 10;
}

.hud-left, .hud-center, .hud-right {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hud-right {
    align-items: flex-end;
}

.hud-center {
    align-items: center;
}

.hud-label {
    font-size: 6px;
    color: var(--text-dim);
}

.hud-value {
    font-size: 12px;
    color: var(--neon-yellow);
    text-shadow: 0 0 5px var(--neon-yellow);
}

.score-container .hud-value {
    font-size: 14px;
}

.lives-container .lives {
    font-size: 14px;
}

.combo-container {
    background: rgba(255, 0, 128, 0.3);
    padding: 4px 8px;
    border-radius: 4px;
    border: 1px solid var(--neon-pink);
    opacity: 0;
    transition: opacity 0.2s;
}

.combo-container.active {
    opacity: 1;
}

.combo-text {
    font-size: 8px;
    color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink);
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================
   BREACH WARNING
   ============================================ */

.breach-warning {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(139, 0, 0, 0.3);
    z-index: 20;
    pointer-events: none;
}

.breach-warning.active {
    display: flex;
    animation: breachFlash 0.2s infinite;
}

.warning-text {
    font-size: 16px;
    color: var(--neon-red);
    text-shadow:
        0 0 10px var(--neon-red),
        0 0 20px var(--neon-red),
        0 0 40px var(--neon-red);
}

.glitch {
    position: relative;
    animation: glitch 0.5s infinite;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.glitch::before {
    animation: glitchTop 0.5s infinite;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
}

.glitch::after {
    animation: glitchBottom 0.5s infinite;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
    -webkit-clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
}

/* ============================================
   ELEVEN MODE
   ============================================ */

.eleven-mode {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 15;
    display: none;
}

.eleven-mode.active {
    display: block;
}

.eleven-glow {
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center,
        rgba(255, 0, 128, 0.2) 0%,
        rgba(128, 0, 255, 0.1) 50%,
        transparent 70%);
    animation: elevenPulse 0.5s infinite;
}

/* ============================================
   GAME OVER SCREEN
   ============================================ */

.gameover-screen {
    gap: 16px;
    background: radial-gradient(ellipse at center, #1a0020 0%, #0a0010 70%);
}

.gameover-title {
    font-size: 24px;
    color: var(--neon-red);
    text-shadow:
        0 0 10px var(--neon-red),
        0 0 20px var(--neon-red);
    animation: pulse 1s infinite;
}

.stranger-quote {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.4);
    border-left: 3px solid var(--neon-pink);
    border-right: 3px solid var(--neon-pink);
    max-width: 300px;
    text-align: center;
}

.stranger-quote .quote-text {
    font-size: 9px;
    color: var(--text-white);
    font-style: italic;
    line-height: 1.5;
}

.stranger-quote .quote-author {
    font-size: 7px;
    color: var(--neon-pink);
    text-shadow: 0 0 5px var(--neon-pink);
}

.final-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 32px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--arcade-gold);
    border-radius: 4px;
}

.final-score .label {
    font-size: 8px;
    color: var(--arcade-gold);
}

.final-score .score {
    font-size: 28px;
    color: var(--neon-yellow);
    text-shadow: 0 0 15px var(--neon-yellow);
    animation: scoreCount 0.5s ease-out;
}

.stats-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 280px;
}

.stat {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--cabinet-border);
    border-radius: 4px;
}

.stat-label {
    font-size: 7px;
    color: var(--text-dim);
}

.stat-value {
    font-size: 10px;
    color: var(--neon-blue);
}

.new-highscore {
    display: none;
    padding: 10px 20px;
    background: linear-gradient(90deg, var(--neon-red), var(--neon-pink), var(--arcade-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbow 1s infinite;
}

.new-highscore.show {
    display: block;
}

.highscore-text {
    font-size: 12px;
}

.gameover-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.gameover-buttons .arcade-btn {
    min-width: 140px;
    font-size: 10px;
    padding: 12px 20px;
}

.home-btn {
    border-color: var(--text-dim);
    color: var(--text-dim);
}

.home-btn:hover, .home-btn:active {
    background: var(--text-dim);
}

/* ============================================
   LEADERBOARD SCREEN
   ============================================ */

.leaderboard-screen {
    gap: 16px;
    background: radial-gradient(ellipse at center, #0a1a2e 0%, #050a15 70%);
}

.leaderboard-title {
    font-size: 18px;
    color: var(--arcade-gold);
    text-shadow: 0 0 10px var(--arcade-gold);
}

.leaderboard-table {
    width: 100%;
    max-width: 340px;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--arcade-gold);
    border-radius: 4px;
    overflow: hidden;
}

.leaderboard-header {
    display: flex;
    padding: 10px 8px;
    background: rgba(255, 215, 0, 0.2);
    border-bottom: 1px solid var(--arcade-gold);
}

.leaderboard-header span {
    font-size: 7px;
    color: var(--arcade-gold);
}

.col-rank { width: 15%; text-align: center; }
.col-name { width: 35%; }
.col-score { width: 30%; text-align: right; }
.col-breach { width: 20%; text-align: center; }

.leaderboard-entries {
    max-height: 280px;
    overflow-y: auto;
}

.leaderboard-entry {
    display: flex;
    padding: 10px 8px;
    border-bottom: 1px solid var(--cabinet-border);
    transition: background 0.2s;
}

.leaderboard-entry:last-child {
    border-bottom: none;
}

.leaderboard-entry.highlight {
    background: rgba(255, 0, 128, 0.2);
    border-color: var(--neon-pink);
}

.leaderboard-entry span {
    font-size: 8px;
    color: var(--text-white);
}

.leaderboard-entry .col-rank {
    color: var(--arcade-gold);
}

.leaderboard-entry .col-score {
    color: var(--neon-yellow);
}

.leaderboard-entry .col-breach {
    color: var(--neon-blue);
}

.back-btn {
    border-color: var(--text-dim);
    color: var(--text-dim);
    min-width: 120px;
}

/* ============================================
   HOW TO PLAY SCREEN
   ============================================ */

.howto-screen {
    gap: 12px;
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0520 70%);
    padding: 15px;
}

.howto-title {
    font-size: 16px;
    color: var(--neon-pink);
    text-shadow: 0 0 10px var(--neon-pink);
    margin-bottom: 5px;
}

.howto-content {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.howto-section {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--cabinet-border);
    border-radius: 4px;
    padding: 10px;
}

.howto-subtitle {
    font-size: 9px;
    color: var(--neon-blue);
    margin-bottom: 8px;
    text-shadow: 0 0 5px var(--neon-blue);
}

.howto-section p {
    font-size: 7px;
    color: var(--text-white);
    margin: 4px 0;
    line-height: 1.6;
}

.howto-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.howto-item {
    font-size: 7px;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
}

.howto-item.good {
    color: var(--neon-yellow);
    border: 1px solid var(--neon-yellow);
}

.howto-item.bad {
    color: var(--neon-red);
    border: 1px solid var(--neon-red);
}

.howto-btn {
    border-color: var(--neon-pink);
    color: var(--neon-pink);
}

.howto-btn:hover, .howto-btn:active {
    background: var(--neon-pink);
    box-shadow: 0 0 20px var(--neon-pink);
}

/* ============================================
   TOUCH CONTROLS
   ============================================ */

.touch-controls {
    display: none;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--cabinet-dark);
}

.touch-controls.active {
    display: flex;
}

.control-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(180deg, #3a3a5e 0%, #1a1a2e 100%);
    border: 4px solid var(--neon-red);
    color: var(--neon-red);
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.1s;
    box-shadow:
        0 4px 0 #0a0a1a,
        0 0 15px rgba(255, 0, 64, 0.3);
    -webkit-user-select: none;
    user-select: none;
}

.control-btn:active {
    transform: translateY(4px);
    box-shadow:
        0 0 0 #0a0a1a,
        0 0 25px rgba(255, 0, 64, 0.5);
    background: var(--neon-red);
    color: #000;
}

.control-arrow {
    text-shadow: 0 0 10px currentColor;
}

/* ============================================
   CABINET BOTTOM
   ============================================ */

.cabinet-bottom {
    flex-shrink: 0;
    padding: 8px;
    background: linear-gradient(180deg, #1a1a2e 0%, #2a2a4e 100%);
    border-top: 3px solid var(--cabinet-border);
    display: flex;
    justify-content: center;
}

.coin-slot {
    padding: 6px 20px;
    background: #000;
    border: 2px solid var(--cabinet-border);
    border-radius: 4px;
    font-size: 8px;
    color: var(--text-dim);
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes neonFlicker {
    0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
        opacity: 1;
        text-shadow:
            0 0 5px currentColor,
            0 0 10px currentColor,
            0 0 20px currentColor;
    }
    20%, 24%, 55% {
        opacity: 0.8;
        text-shadow: none;
    }
}

@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes breachFlash {
    0%, 100% { background: rgba(139, 0, 0, 0.2); }
    50% { background: rgba(139, 0, 0, 0.4); }
}

@keyframes glitch {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(-2px, -2px); }
    60% { transform: translate(2px, 2px); }
    80% { transform: translate(2px, -2px); }
    100% { transform: translate(0); }
}

@keyframes glitchTop {
    0% { transform: translate(0); }
    25% { transform: translate(-3px, 0); }
    50% { transform: translate(3px, 0); }
    75% { transform: translate(-3px, 0); }
    100% { transform: translate(0); }
}

@keyframes glitchBottom {
    0% { transform: translate(0); }
    25% { transform: translate(3px, 0); }
    50% { transform: translate(-3px, 0); }
    75% { transform: translate(3px, 0); }
    100% { transform: translate(0); }
}

@keyframes elevenPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

@keyframes scoreCount {
    from { transform: scale(1.5); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes rainbow {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake {
    animation: shake 0.5s ease-in-out;
}

/* ============================================
   UPSIDE DOWN MODE
   ============================================ */

.game-container.upside-down {
    filter: saturate(0.3) hue-rotate(180deg);
    background: var(--ud-bg);
}

.game-container.upside-down .game-hud {
    background: linear-gradient(180deg, rgba(10,16,21,0.9) 0%, transparent 100%);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (min-width: 768px) {
    .arcade-cabinet {
        max-width: 480px;
        height: 95vh;
        border-radius: 12px;
        box-shadow:
            0 0 50px rgba(255, 0, 64, 0.3),
            0 0 100px rgba(0, 255, 255, 0.2);
    }

    .cabinet-screen {
        margin: 12px;
    }

    .title-hawkins {
        font-size: 32px;
    }

    .title-arcade {
        font-size: 26px;
    }

    .control-btn {
        width: 100px;
        height: 100px;
        font-size: 32px;
    }
}

/* Landscape orientation warning */
@media (orientation: landscape) and (max-height: 500px) {
    .arcade-cabinet::before {
        content: 'ROTATE DEVICE';
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-dark);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        color: var(--neon-red);
        z-index: 9999;
    }
}
