/* ===========================================
   T3R - Synthwave Personal Page
   Author: Tiago Castro

   Cross-browser compatibility:
   - Chrome 60+
   - Firefox 55+
   - Safari 11+
   - Edge 79+
   =========================================== */

/* CSS Variables */
:root {
    --neon-pink: #ff2a6d;
    --neon-blue: #05d9e8;
    --neon-purple: #d300c5;
    --neon-orange: #ff6c11;
    --dark-bg: #0d0221;
    --grid-color: #ff2a6d;
    --sun-orange: #ff6c11;
    --sun-pink: #ff2a6d;

    --font-pixel: 'Press Start 2P', monospace;
    --font-terminal: 'VT323', monospace;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

html {
    width: 100%;
    height: 100%;
    /* iOS Safari viewport fix */
    height: -webkit-fill-available;
}

body {
    width: 100%;
    height: 100%;
    min-height: 100vh;
    /* iOS Safari viewport fix */
    min-height: -webkit-fill-available;
    overflow: hidden;
    background: var(--dark-bg);
    font-family: var(--font-terminal);
    color: white;
    /* Prevent text selection on mobile */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* Smooth scrolling */
    -webkit-overflow-scrolling: touch;
}

/* Canvas Layers */
#bg-canvas, #game-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* GPU acceleration */
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

#bg-canvas {
    z-index: 1;
}

#game-canvas {
    z-index: 2;
}

/* CRT Effects */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    background:
        -webkit-radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.3) 100%);
    background:
        -moz-radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.3) 100%);
    background:
        radial-gradient(ellipse at center, transparent 0%, rgba(0,0,0,0.3) 100%);
}

.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 101;
    background: -webkit-repeating-linear-gradient(
        top,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    background: -moz-repeating-linear-gradient(
        top,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    -webkit-animation: scanline-flicker 0.1s infinite;
    -moz-animation: scanline-flicker 0.1s infinite;
    animation: scanline-flicker 0.1s infinite;
}

@-webkit-keyframes scanline-flicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.85; }
}

@-moz-keyframes scanline-flicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.85; }
}

@keyframes scanline-flicker {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.85; }
}

/* Main Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100vh;
    /* Safari iOS fix for dynamic viewport */
    height: -webkit-fill-available;
    max-height: 100vh;
    max-height: -webkit-fill-available;
    z-index: 10;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -moz-box-pack: justify;
    -ms-flex-pack: justify;
    justify-content: space-between;
    padding: 2rem;
    /* Safe area for iPhone notch */
    padding-top: max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
    pointer-events: none;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

.overlay > * {
    pointer-events: auto;
}

/* Header */
.header {
    text-align: center;
    pointer-events: none;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
}

.header h1 {
    font-family: var(--font-pixel);
    /* clamp() fallback for older browsers */
    font-size: 2.5rem;
    font-size: clamp(1.8rem, 6vw, 4rem);
    color: #ffffff;
    text-shadow:
        0 0 10px var(--neon-blue),
        0 0 20px var(--neon-blue),
        0 0 40px var(--neon-blue),
        0 0 60px var(--neon-pink),
        2px 2px 0 var(--neon-pink),
        -2px -2px 0 var(--neon-blue);
    letter-spacing: 0.15em;
    -webkit-animation: glow-pulse 2s ease-in-out infinite alternate;
    -moz-animation: glow-pulse 2s ease-in-out infinite alternate;
    animation: glow-pulse 2s ease-in-out infinite alternate;
}

@-webkit-keyframes glow-pulse {
    from {
        text-shadow:
            0 0 10px var(--neon-blue),
            0 0 20px var(--neon-blue),
            0 0 40px var(--neon-blue),
            0 0 60px var(--neon-pink),
            2px 2px 0 var(--neon-pink),
            -2px -2px 0 var(--neon-blue);
    }
    to {
        text-shadow:
            0 0 15px var(--neon-blue),
            0 0 30px var(--neon-blue),
            0 0 50px var(--neon-blue),
            0 0 80px var(--neon-pink),
            2px 2px 0 var(--neon-pink),
            -2px -2px 0 var(--neon-blue);
    }
}

@-moz-keyframes glow-pulse {
    from {
        text-shadow:
            0 0 10px var(--neon-blue),
            0 0 20px var(--neon-blue),
            0 0 40px var(--neon-blue),
            0 0 60px var(--neon-pink),
            2px 2px 0 var(--neon-pink),
            -2px -2px 0 var(--neon-blue);
    }
    to {
        text-shadow:
            0 0 15px var(--neon-blue),
            0 0 30px var(--neon-blue),
            0 0 50px var(--neon-blue),
            0 0 80px var(--neon-pink),
            2px 2px 0 var(--neon-pink),
            -2px -2px 0 var(--neon-blue);
    }
}

@keyframes glow-pulse {
    from {
        text-shadow:
            0 0 10px var(--neon-blue),
            0 0 20px var(--neon-blue),
            0 0 40px var(--neon-blue),
            0 0 60px var(--neon-pink),
            2px 2px 0 var(--neon-pink),
            -2px -2px 0 var(--neon-blue);
    }
    to {
        text-shadow:
            0 0 15px var(--neon-blue),
            0 0 30px var(--neon-blue),
            0 0 50px var(--neon-blue),
            0 0 80px var(--neon-pink),
            2px 2px 0 var(--neon-pink),
            -2px -2px 0 var(--neon-blue);
    }
}

/* Glitch Effect */
.glitch {
    position: relative;
}

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

.glitch::before {
    color: var(--neon-pink);
    -webkit-animation: glitch-1 2s infinite linear alternate-reverse;
    -moz-animation: glitch-1 2s infinite linear alternate-reverse;
    animation: glitch-1 2s infinite linear alternate-reverse;
    -webkit-clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
    clip-path: polygon(0 0, 100% 0, 100% 35%, 0 35%);
}

.glitch::after {
    color: var(--neon-purple);
    -webkit-animation: glitch-2 3s infinite linear alternate-reverse;
    -moz-animation: glitch-2 3s infinite linear alternate-reverse;
    animation: glitch-2 3s infinite linear alternate-reverse;
    -webkit-clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
    clip-path: polygon(0 65%, 100% 65%, 100% 100%, 0 100%);
}

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

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

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

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

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

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

/* Profile Photo */
.profile-photo {
    width: 150px;
    height: 150px;
    margin: 0 auto 1.5rem;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--neon-blue);
    -webkit-box-shadow:
        0 0 30px var(--neon-blue),
        0 0 60px rgba(5, 217, 232, 0.4),
        inset 0 0 30px rgba(5, 217, 232, 0.2);
    -moz-box-shadow:
        0 0 30px var(--neon-blue),
        0 0 60px rgba(5, 217, 232, 0.4),
        inset 0 0 30px rgba(5, 217, 232, 0.2);
    box-shadow:
        0 0 30px var(--neon-blue),
        0 0 60px rgba(5, 217, 232, 0.4),
        inset 0 0 30px rgba(5, 217, 232, 0.2);
    -webkit-animation: photo-glow 3s ease-in-out infinite alternate;
    -moz-animation: photo-glow 3s ease-in-out infinite alternate;
    animation: photo-glow 3s ease-in-out infinite alternate;
}

.profile-photo img {
    width: 100%;
    height: 100%;
    -o-object-fit: cover;
    object-fit: cover;
    -o-object-position: center center;
    object-position: center center;
    -webkit-filter: saturate(1.1) contrast(1.05);
    filter: saturate(1.1) contrast(1.05);
    -webkit-transition: -webkit-transform 0.3s ease;
    -moz-transition: -moz-transform 0.3s ease;
    -o-transition: -o-transform 0.3s ease;
    transition: transform 0.3s ease;
}

.profile-photo:hover img {
    -webkit-transform: scale(1.1);
    -moz-transform: scale(1.1);
    -ms-transform: scale(1.1);
    -o-transform: scale(1.1);
    transform: scale(1.1);
}

@-webkit-keyframes photo-glow {
    from {
        -webkit-box-shadow:
            0 0 20px var(--neon-blue),
            0 0 40px rgba(5, 217, 232, 0.3);
        box-shadow:
            0 0 20px var(--neon-blue),
            0 0 40px rgba(5, 217, 232, 0.3);
    }
    to {
        -webkit-box-shadow:
            0 0 30px var(--neon-pink),
            0 0 60px rgba(255, 42, 109, 0.4);
        box-shadow:
            0 0 30px var(--neon-pink),
            0 0 60px rgba(255, 42, 109, 0.4);
        border-color: var(--neon-pink);
    }
}

@-moz-keyframes photo-glow {
    from {
        -moz-box-shadow:
            0 0 20px var(--neon-blue),
            0 0 40px rgba(5, 217, 232, 0.3);
        box-shadow:
            0 0 20px var(--neon-blue),
            0 0 40px rgba(5, 217, 232, 0.3);
    }
    to {
        -moz-box-shadow:
            0 0 30px var(--neon-pink),
            0 0 60px rgba(255, 42, 109, 0.4);
        box-shadow:
            0 0 30px var(--neon-pink),
            0 0 60px rgba(255, 42, 109, 0.4);
        border-color: var(--neon-pink);
    }
}

@keyframes photo-glow {
    from {
        box-shadow:
            0 0 20px var(--neon-blue),
            0 0 40px rgba(5, 217, 232, 0.3);
    }
    to {
        box-shadow:
            0 0 30px var(--neon-pink),
            0 0 60px rgba(255, 42, 109, 0.4);
        border-color: var(--neon-pink);
    }
}

.subtitle {
    font-family: var(--font-terminal);
    font-size: 1.2rem;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--neon-pink);
    margin-top: 0.5rem;
    opacity: 0.8;
    letter-spacing: 0.3em;
    text-transform: uppercase;
}

/* Game UI */
.game-ui {
    text-align: center;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -moz-box-flex: 1;
    -ms-flex: 1;
    flex: 1;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -moz-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 1rem;
    pointer-events: none;
}

.game-info {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    gap: 2rem;
    font-family: var(--font-pixel);
    font-size: 0.75rem;
    font-size: clamp(0.6rem, 1.5vw, 0.9rem);
}

.score {
    color: var(--neon-blue);
    text-shadow: 0 0 10px var(--neon-blue);
}

.highscore {
    color: var(--neon-orange);
    text-shadow: 0 0 10px var(--neon-orange);
}

.game-status {
    font-family: var(--font-pixel);
    font-size: 0.65rem;
    font-size: clamp(0.5rem, 1.2vw, 0.8rem);
    color: white;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.5);
    border: 2px solid var(--neon-pink);
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    -webkit-box-shadow:
        0 0 10px var(--neon-pink),
        inset 0 0 10px rgba(255, 42, 109, 0.2);
    -moz-box-shadow:
        0 0 10px var(--neon-pink),
        inset 0 0 10px rgba(255, 42, 109, 0.2);
    box-shadow:
        0 0 10px var(--neon-pink),
        inset 0 0 10px rgba(255, 42, 109, 0.2);
}

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

.blink {
    -webkit-animation: blink 1s step-end infinite;
    -moz-animation: blink 1s step-end infinite;
    animation: blink 1s step-end infinite;
}

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

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

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

.controls-hint {
    font-family: var(--font-terminal);
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.5rem;
}

.mobile-hint {
    display: none;
}

/* Footer */
.footer {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -moz-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 1.5rem;
    -webkit-flex-shrink: 0;
    -ms-flex-negative: 0;
    flex-shrink: 0;
    padding-bottom: 1rem;
}

/* Game Start Section */
.game-start-section {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -webkit-flex-direction: column;
    -moz-box-orient: vertical;
    -moz-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.footer .contact-links {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    gap: 2rem;
    -webkit-flex-wrap: wrap;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -moz-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
}

.contact-link {
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    gap: 0.5rem;
    color: white;
    text-decoration: none;
    font-family: var(--font-terminal);
    font-size: 1.15rem;
    font-size: clamp(1rem, 2vw, 1.3rem);
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    -webkit-border-radius: 4px;
    -moz-border-radius: 4px;
    border-radius: 4px;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
}

.contact-link:hover {
    color: var(--neon-blue);
    border-color: var(--neon-blue);
    -webkit-box-shadow:
        0 0 10px var(--neon-blue),
        inset 0 0 10px rgba(5, 217, 232, 0.1);
    -moz-box-shadow:
        0 0 10px var(--neon-blue),
        inset 0 0 10px rgba(5, 217, 232, 0.1);
    box-shadow:
        0 0 10px var(--neon-blue),
        inset 0 0 10px rgba(5, 217, 232, 0.1);
    text-shadow: 0 0 10px var(--neon-blue);
}

.contact-link .icon {
    font-size: 1.2em;
}

/* Mute Button */
.mute-btn {
    background: transparent;
    border: 2px solid var(--neon-pink);
    color: var(--neon-pink);
    font-size: 1.5rem;
    width: 50px;
    height: 50px;
    -webkit-border-radius: 50%;
    -moz-border-radius: 50%;
    border-radius: 50%;
    cursor: pointer;
    -webkit-transition: all 0.3s ease;
    -moz-transition: all 0.3s ease;
    -o-transition: all 0.3s ease;
    transition: all 0.3s ease;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -moz-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    /* Remove tap highlight on mobile */
    -webkit-tap-highlight-color: transparent;
}

.mute-btn:hover {
    background: var(--neon-pink);
    color: white;
    -webkit-box-shadow: 0 0 20px var(--neon-pink);
    -moz-box-shadow: 0 0 20px var(--neon-pink);
    box-shadow: 0 0 20px var(--neon-pink);
}

.mute-btn .sound-off {
    display: none;
}

.mute-btn.muted .sound-on {
    display: none;
}

.mute-btn.muted .sound-off {
    display: inline;
    color: rgba(255, 255, 255, 0.5);
}

.mute-btn.muted {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.5);
}

/* Game Over Screen */
.game-over {
    position: fixed;
    top: 50%;
    left: 50%;
    -webkit-transform: translate(-50%, -50%);
    -moz-transform: translate(-50%, -50%);
    -ms-transform: translate(-50%, -50%);
    -o-transform: translate(-50%, -50%);
    transform: translate(-50%, -50%);
    z-index: 50;
    text-align: center;
    background: rgba(0, 0, 0, 0.9);
    padding: 2rem 3rem;
    border: 3px solid var(--neon-pink);
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
    -webkit-box-shadow:
        0 0 30px var(--neon-pink),
        inset 0 0 30px rgba(255, 42, 109, 0.1);
    -moz-box-shadow:
        0 0 30px var(--neon-pink),
        inset 0 0 30px rgba(255, 42, 109, 0.1);
    box-shadow:
        0 0 30px var(--neon-pink),
        inset 0 0 30px rgba(255, 42, 109, 0.1);
    display: none;
}

.game-over.show {
    display: block;
    -webkit-animation: popup 0.3s ease-out;
    -moz-animation: popup 0.3s ease-out;
    animation: popup 0.3s ease-out;
}

@-webkit-keyframes popup {
    from {
        -webkit-transform: translate(-50%, -50%) scale(0.8);
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    to {
        -webkit-transform: translate(-50%, -50%) scale(1);
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@-moz-keyframes popup {
    from {
        -moz-transform: translate(-50%, -50%) scale(0.8);
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    to {
        -moz-transform: translate(-50%, -50%) scale(1);
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes popup {
    from {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

.game-over h2 {
    font-family: var(--font-pixel);
    font-size: 1.25rem;
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--neon-pink);
    margin-bottom: 1rem;
    text-shadow: 0 0 20px var(--neon-pink);
}

.game-over .final-score {
    font-family: var(--font-terminal);
    font-size: 1.5rem;
    color: var(--neon-blue);
    margin-bottom: 0.5rem;
}

.game-over .new-high {
    font-family: var(--font-pixel);
    font-size: 0.7rem;
    color: var(--neon-orange);
    margin-bottom: 1rem;
    -webkit-animation: blink 0.5s step-end infinite;
    -moz-animation: blink 0.5s step-end infinite;
    animation: blink 0.5s step-end infinite;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .overlay {
        padding: 1rem;
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .desktop-hint {
        display: none;
    }

    .mobile-hint {
        display: inline;
    }

    .contact-link .text {
        display: none;
    }

    .contact-link .icon {
        font-size: 1.5em;
    }

    .footer .contact-links {
        gap: 1rem;
    }

    .footer {
        gap: 1rem;
    }

    .game-info {
        gap: 1rem;
    }

    .profile-photo {
        width: 120px;
        height: 120px;
    }
}

/* Touch Controls (Mobile) */
.touch-controls {
    position: fixed;
    bottom: 100px;
    left: 50%;
    -webkit-transform: translateX(-50%);
    -moz-transform: translateX(-50%);
    -ms-transform: translateX(-50%);
    -o-transform: translateX(-50%);
    transform: translateX(-50%);
    z-index: 20;
    display: none;
    gap: 10px;
}

@media (max-width: 768px) {
    .touch-controls {
        display: -ms-grid;
        display: grid;
        -ms-grid-columns: 1fr 1fr 1fr;
        -ms-grid-rows: 1fr 1fr 1fr;
        grid-template-areas:
            ". up ."
            "left . right"
            ". down .";
        gap: 5px;
    }
}

.touch-btn {
    width: 60px;
    height: 60px;
    background: rgba(255, 42, 109, 0.3);
    border: 2px solid var(--neon-pink);
    -webkit-border-radius: 8px;
    -moz-border-radius: 8px;
    border-radius: 8px;
    color: white;
    font-size: 1.5rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -moz-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -moz-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    -webkit-box-pack: center;
    -webkit-justify-content: center;
    -moz-box-pack: center;
    -ms-flex-pack: center;
    justify-content: center;
    cursor: pointer;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.touch-btn:active {
    background: var(--neon-pink);
    -webkit-box-shadow: 0 0 20px var(--neon-pink);
    -moz-box-shadow: 0 0 20px var(--neon-pink);
    box-shadow: 0 0 20px var(--neon-pink);
}

.touch-btn.up { -ms-grid-row: 1; -ms-grid-column: 2; grid-area: up; }
.touch-btn.down { -ms-grid-row: 3; -ms-grid-column: 2; grid-area: down; }
.touch-btn.left { -ms-grid-row: 2; -ms-grid-column: 1; grid-area: left; }
.touch-btn.right { -ms-grid-row: 2; -ms-grid-column: 3; grid-area: right; }

/* Selection */
::-moz-selection {
    background: var(--neon-pink);
    color: white;
}

::selection {
    background: var(--neon-pink);
    color: white;
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    .overlay {
        height: 100vh;
    }
}

/* Safari-specific fixes */
@supports (-webkit-touch-callout: none) {
    body {
        /* Prevent iOS rubber-banding */
        position: fixed;
        width: 100%;
        height: 100%;
    }
}

/* ==========================================
   MOBILE-SPECIFIC ENHANCEMENTS
   iPhone & Android - Safari & Chrome
   ========================================== */

/* Small phones (iPhone SE, small Androids) */
@media (max-width: 375px) {
    .profile-photo {
        width: 100px;
        height: 100px;
        margin-bottom: 1rem;
    }

    .header h1 {
        font-size: 1.4rem;
        letter-spacing: 0.1em;
    }

    .subtitle {
        font-size: 0.9rem;
        letter-spacing: 0.2em;
    }

    .game-status {
        padding: 0.75rem 1rem;
        font-size: 0.45rem;
    }

    .game-info {
        font-size: 0.5rem;
    }

    .footer {
        gap: 0.75rem;
    }

    .mute-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .profile-photo {
        width: 80px;
        height: 80px;
        margin-bottom: 0.5rem;
    }

    .header h1 {
        font-size: 1.2rem;
    }

    .subtitle {
        font-size: 0.8rem;
        margin-top: 0.25rem;
    }

    .overlay {
        padding: 0.5rem 1rem;
    }

    .game-start-section {
        margin-bottom: 0.5rem;
    }

    .footer {
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .game-status {
        padding: 0.5rem 1rem;
    }
}

/* iOS Safari - Prevent zoom on double tap */
* {
    -ms-touch-action: manipulation;
    touch-action: manipulation;
}

/* iOS Safari - Better touch response */
a, button {
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: rgba(5, 217, 232, 0.3);
}

/* Android Chrome - Prevent pull-to-refresh */
body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* Improve touch targets for mobile (min 44x44px for accessibility) */
@media (pointer: coarse) {
    .contact-link {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }

    .mute-btn {
        min-width: 50px;
        min-height: 50px;
    }

    .game-status {
        min-height: 44px;
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
        -webkit-box-align: center;
        -webkit-align-items: center;
        align-items: center;
        -webkit-box-pack: center;
        -webkit-justify-content: center;
        justify-content: center;
    }
}

/* High DPI screens (Retina) - Sharper rendering */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .profile-photo {
        border-width: 3px;
    }

    .game-status {
        border-width: 1.5px;
    }

    .contact-link {
        border-width: 0.5px;
    }
}

/* Notch/Dynamic Island safe areas (iPhone X+) */
@supports (padding: max(0px)) {
    .overlay {
        padding-top: max(1.5rem, env(safe-area-inset-top, 0px));
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
        padding-left: max(1.5rem, env(safe-area-inset-left, 0px));
        padding-right: max(1.5rem, env(safe-area-inset-right, 0px));
    }
}

/* PWA standalone mode adjustments */
@media (display-mode: standalone) {
    .overlay {
        padding-top: max(2rem, env(safe-area-inset-top, 0px));
    }
}

/* Prevent text size adjustment on orientation change (iOS) */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
