@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --neon-cyan: #00f5ff;
    --neon-purple: #bf00ff;
    --neon-orange: #ff6b00;
    --neon-green: #39ff14;
    --bg-dark: #02040f;
    --card-bg: #080d1f;
    --text-main: #e8f4ff;
    --text-muted: #5a7fa8;
    --glass: rgba(8, 13, 31, 0.7);
    --glass-border: rgba(0, 245, 255, 0.12);
    --grad-primary: linear-gradient(135deg, #00f5ff 0%, #bf00ff 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    background: var(--bg-dark);
    line-height: 1.5;
    padding-top: 60px !important;
    overflow-x: hidden;
}

/* ── Game Container ── */
.game-container {
    width: 98% !important;
    max-width: 520px !important;
    margin: 0 auto;
    background: var(--glass) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 28px;
    padding: 20px !important;
    box-shadow: 0 0 60px rgba(0, 245, 255, 0.08), 0 40px 80px rgba(0, 0, 0, 0.6);
    display: block !important;
    animation: slideUp 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ── */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header h1 {
    font-family: 'Orbitron', monospace;
    font-size: 1.3rem;
    font-weight: 900;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: none;
    letter-spacing: 1px;
}

.game-title-icon {
    font-size: 1.5rem;
    -webkit-text-fill-color: initial;
    filter: drop-shadow(0 0 8px var(--neon-cyan));
}

.back-btn {
    background: rgba(0, 245, 255, 0.08);
    color: var(--neon-cyan);
    border: 1px solid rgba(0, 245, 255, 0.25);
    border-radius: 12px;
    padding: 8px 16px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.back-btn:hover {
    background: rgba(0, 245, 255, 0.15);
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.2);
}

/* ── Info Bar ── */
.game-info {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.info-item {
    flex: 1;
    background: rgba(0, 245, 255, 0.05);
    border: 1px solid rgba(0, 245, 255, 0.1);
    border-radius: 14px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.info-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.info-value {
    font-family: 'Orbitron', monospace;
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ── Canvas Wrapper ── */
.game-screen-wrapper {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.game-screen {
    width: 100%;
    max-width: 480px;
    aspect-ratio: 480 / 640;
    position: relative;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(0, 245, 255, 0.15);
    box-shadow:
        0 0 30px rgba(0, 245, 255, 0.08),
        inset 0 0 60px rgba(0, 0, 0, 0.4);
}

.game-screen canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ── Ads ── */
.bottom-ad {
    margin-top: 12px;
}

.ad-mobile-banner {
    margin-top: 8px;
}

/* ── Modals ── */
.modal {
    display: none !important;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(2, 4, 15, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: linear-gradient(135deg, rgba(8, 13, 31, 0.95) 0%, rgba(15, 5, 30, 0.95) 100%);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 24px;
    padding: 32px 28px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 0 60px rgba(0, 245, 255, 0.12), 0 30px 60px rgba(0, 0, 0, 0.5);
    animation: modalPop 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.85) translateY(20px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-ship-anim {
    font-size: 4rem;
    margin-bottom: 8px;
    animation: floatShip 2s ease-in-out infinite;
    filter: drop-shadow(0 0 20px var(--neon-cyan));
    display: block;
}

@keyframes floatShip {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50%       { transform: translateY(-10px) rotate(5deg); }
}

.modal-title {
    font-family: 'Orbitron', monospace;
    font-size: 1.8rem;
    font-weight: 900;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 6px;
    letter-spacing: 2px;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* ── Instructions ── */
.instructions {
    background: rgba(0, 245, 255, 0.04);
    border: 1px solid rgba(0, 245, 255, 0.1);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: left;
}

.instr-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.83rem;
    color: var(--text-main);
}

.instr-icon {
    font-size: 1.1rem;
    width: 24px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Inputs & Buttons ── */
.player-input {
    width: 100%;
    background: rgba(0, 245, 255, 0.05);
    border: 1px solid rgba(0, 245, 255, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 0.95rem;
    margin-bottom: 16px;
    transition: border-color 0.2s;
    outline: none;
}

.player-input:focus {
    border-color: var(--neon-cyan);
    box-shadow: 0 0 12px rgba(0, 245, 255, 0.15);
}

.player-input::placeholder {
    color: var(--text-muted);
}

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #00f5ff 0%, #bf00ff 100%);
    color: #02040f;
    border: none;
    border-radius: 14px;
    font-family: 'Orbitron', monospace;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    letter-spacing: 1.5px;
    transition: all 0.2s;
    margin-bottom: 10px;
    box-shadow: 0 0 20px rgba(0, 245, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 30px rgba(0, 245, 255, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    width: 100%;
    padding: 12px 24px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn-secondary:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.25);
}

/* ── Game Over screen extras ── */
.gameover-icon {
    font-size: 3.5rem;
    margin-bottom: 8px;
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-8px) rotate(-5deg); }
    40%       { transform: translateX(8px) rotate(5deg); }
    60%       { transform: translateX(-5px); }
    80%       { transform: translateX(5px); }
}

.gameover-title {
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.final-score {
    font-family: 'Orbitron', monospace;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--neon-cyan);
    text-shadow: 0 0 20px rgba(0, 245, 255, 0.5);
    margin-bottom: 6px;
}

.record-info {
    font-size: 0.85rem;
    color: var(--neon-green);
    text-shadow: 0 0 10px rgba(57, 255, 20, 0.4);
    margin-bottom: 20px;
    min-height: 20px;
}

.rank-world {
    margin-top: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--gold, #fbbf24);
    text-shadow: 0 0 12px rgba(251, 191, 36, 0.5);
    letter-spacing: 0.03em;
    animation: rankPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes rankPop {
    from { opacity: 0; transform: scale(0.7); }
    to   { opacity: 1; transform: scale(1); }
}

/* ── Mobile touch helper ── */
@media (max-width: 480px) {
    .modal-content {
        padding: 24px 18px;
    }
    .modal-title {
        font-size: 1.4rem;
    }
    .header h1 {
        font-size: 1.1rem;
    }
}
