/* styles.css — Smoke's PurrTyper: Typing Escape */
/* Responsive, multi-orientation stylesheet with cyber-neon aesthetics */

:root {
    --bg-dark: #060214;
    --card-bg: rgba(10, 5, 25, 0.94);
    --border-color: rgba(155, 93, 229, 0.35);
    --neon-purple: #9b5de5;
    --neon-pink: #f72585;
    --neon-cyan: #00f3ff;
    --neon-green: #39ff14;
    --neon-gold: #ffd60a;
    --text-color: #f1e9ff;
    --text-muted: #9f8fc7;
    --font-pixel: 'Press Start 2P', monospace;
    --font-sans: 'Outfit', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-dark);
    font-family: var(--font-sans), sans-serif;
    color: var(--text-color);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* ─── Game Container ───────────────────────────────────────────────────────── */
#game-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #03010a;
    overflow: hidden;
}

#game-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #050210;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    transition: max-width 0.3s, max-height 0.3s;
}

/* Responsive aspect ratio caps for desktop readability */
@media (min-width: 768px) {
    /* Landscape desktop */
    @media (orientation: landscape) {
        #game-wrapper {
            max-width: 1100px;
            max-height: 700px;
            border: 2px solid rgba(155, 93, 229, 0.4);
            border-radius: 16px;
            box-shadow: 0 0 40px rgba(155,93,229,0.3), 0 0 100px rgba(0,243,255,0.1);
        }
    }
    /* Portrait desktop/tablet */
    @media (orientation: portrait) {
        #game-wrapper {
            max-width: 580px;
            max-height: 960px;
            border: 2px solid rgba(155, 93, 229, 0.4);
            border-radius: 16px;
            box-shadow: 0 0 40px rgba(155,93,229,0.3), 0 0 100px rgba(0,243,255,0.1);
        }
    }
}

/* ─── Canvas ───────────────────────────────────────────────────────────────── */
#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: default;
}

#game-canvas-container {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
}

/* ─── Loading Screen ───────────────────────────────────────────────────────── */
#loadingScreen {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #050012;
    z-index: 100;
    transition: opacity 0.5s ease;
}

#loadingScreen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-logo {
    font-family: var(--font-pixel);
    font-size: clamp(20px, 5vw, 32px);
    color: var(--neon-cyan);
    text-shadow: 0 0 20px rgba(0,243,255,0.6), 0 0 40px rgba(155,93,229,0.4);
    margin-bottom: 12px;
    letter-spacing: 0.15em;
}

.loading-sub {
    font-size: clamp(10px, 2.2vw, 13px);
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 32px;
    text-transform: uppercase;
}

.loading-bar-wrapper {
    width: 240px;
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    border: 1px solid rgba(155, 93, 229, 0.2);
    overflow: hidden;
}

.loading-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-cyan), var(--neon-purple), var(--neon-pink));
    border-radius: 4px;
    animation: loadingPulse 2s ease-in-out infinite;
    width: 60%;
}

@keyframes loadingPulse {
    0% { width: 10%; }
    50% { width: 95%; }
    100% { width: 10%; }
}

/* ─── HUD (Heads Up Display) ──────────────────────────────────────────────── */
#hud {
    position: relative;
    width: 100%;
    padding: 10px 14px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: space-between;
    align-items: center;
    pointer-events: auto;
    z-index: 55;
    background: rgba(6, 2, 20, 0.7);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(155, 93, 229, 0.25);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

#hud.hidden {
    display: none !important;
}

.hud-item {
    background: rgba(8, 2, 20, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 4px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(8px);
    pointer-events: auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.5), inset 0 0 5px rgba(155,93,229,0.1);
}

.hud-label {
    font-size: 8px;
    font-weight: bold;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hud-value {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: bold;
    color: #fff;
    margin-top: 1px;
    text-shadow: 0 0 5px rgba(255,255,255,0.2);
}

/* HUD Shields Health Bar */
#hud-shield-card {
    flex: 1;
    min-width: 140px;
    max-width: 250px;
    align-items: stretch;
}

.hud-shield-container {
    position: relative;
    height: 16px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 3px;
}

#shield-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--neon-pink), var(--neon-purple));
    box-shadow: 0 0 8px var(--neon-pink);
    transition: width 0.2s ease, background-color 0.2s;
}

.hud-value-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.9);
}

/* Colors for stats */
.text-cyan {
    color: var(--neon-cyan) !important;
    text-shadow: 0 0 8px rgba(0,243,255,0.6) !important;
}

.text-green {
    color: var(--neon-green) !important;
    text-shadow: 0 0 8px rgba(57,255,20,0.6) !important;
}

.text-gold {
    color: var(--neon-gold) !important;
    text-shadow: 0 0 8px rgba(255,214,10,0.6) !important;
}

/* Buttons in HUD */
.hud-btn {
    height: 36px;
    width: 36px;
    min-width: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--text-color);
    background: rgba(8, 2, 20, 0.85);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s;
}

.hud-btn:hover {
    background: rgba(155, 93, 229, 0.35);
    border-color: var(--neon-purple);
    box-shadow: 0 0 12px rgba(155,93,229,0.5);
    transform: scale(1.05);
}

.hud-btn:active {
    transform: scale(0.95);
}

/* ─── Wave / Objective Indicator ───────────────────────────────────────────── */
#objective-bar {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    background: rgba(8, 2, 20, 0.85);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    backdrop-filter: blur(8px);
    z-index: 25;
    pointer-events: none;
    font-family: var(--font-sans);
}

#objective-bar.hidden {
    display: none !important;
}

/* ─── Overlays & Cards ────────────────────────────────────────────────────── */
.overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(4, 2, 10, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.overlay.hidden {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

.card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.85), 0 0 30px rgba(155, 93, 229, 0.2);
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 85%;
    overflow-y: auto;
}

.border-gold {
    border-color: var(--neon-gold);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.85), 0 0 30px rgba(255, 214, 10, 0.25);
}

.border-red {
    border-color: var(--neon-pink);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.85), 0 0 30px rgba(247, 37, 133, 0.25);
}

.logo {
    font-family: var(--font-pixel);
    font-size: clamp(20px, 4.5vw, 26px);
    font-weight: 700;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 15px rgba(0,243,255,0.7), 0 0 30px rgba(155,93,229,0.4);
    margin-bottom: 6px;
}

.tagline {
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.smoke-portrait {
    display: flex;
    justify-content: center;
    margin: 4px 0;
}

#smoke-portrait-canvas {
    background: rgba(0,0,0,0.3);
    border-radius: 50%;
    border: 2px solid rgba(155, 93, 229, 0.4);
    box-shadow: 0 0 20px rgba(155, 93, 229, 0.3);
}

.story-box {
    background: rgba(0, 0, 0, 0.4);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.45;
    color: #d1c5ed;
    text-align: left;
    border-left: 3px solid var(--neon-cyan);
}

.controls-card {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    padding: 12px;
    text-align: left;
    font-size: 11px;
    line-height: 1.5;
    color: #bbb2d8;
    border: 1px solid rgba(155, 93, 229, 0.15);
}

.controls-title {
    font-weight: bold;
    color: var(--neon-purple);
    font-size: 11px;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.controls-card p {
    margin-bottom: 4px;
}

.controls-card strong {
    color: #fff;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--neon-purple) 0%, var(--neon-pink) 100%);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-sans);
    font-weight: bold;
    font-size: 14px;
    padding: 12px 24px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(155, 93, 229, 0.4);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 93, 229, 0.6), 0 0 10px rgba(247,37,133,0.3);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(1px);
}

.btn-restart {
    background: linear-gradient(135deg, #3d1566 0%, #100224 100%);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.btn-restart:hover {
    border-color: var(--neon-pink);
    box-shadow: 0 6px 15px rgba(155, 93, 229, 0.3);
}

.btn-back {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    box-shadow: none;
}

.btn-back:hover {
    border-color: var(--neon-cyan);
    color: #fff;
    box-shadow: 0 0 10px rgba(0,243,255,0.2);
}

.cookie-warn {
    font-size: 9px;
    color: var(--neon-pink);
    margin: 4px 0;
    line-height: 1.3;
}

.stats-footer {
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.8;
}

/* Scores display inside complete overlay */
.scores-row {
    display: flex;
    justify-content: space-around;
    gap: 12px;
    margin: 8px 0;
}

.score-card {
    background: rgba(0,0,0,0.35);
    border: 1px solid rgba(155, 93, 229, 0.2);
    border-radius: 8px;
    padding: 10px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-card span {
    font-size: 9px;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.score-card strong {
    font-family: var(--font-mono);
    font-size: 22px;
    color: #fff;
    margin-top: 4px;
}

.stars-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 26px;
    margin: 6px 0;
    color: var(--neon-gold);
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.gameover-title {
    font-family: var(--font-pixel);
    font-size: 16px;
    color: #fff;
    text-shadow: 0 0 15px rgba(255,255,255,0.2);
    letter-spacing: 1px;
}

.gameover-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Settings */
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.settings-row input[type="range"] {
    flex: 1;
    max-width: 155px;
    accent-color: var(--neon-purple);
}

.settings-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--neon-cyan);
}

/* ─── READY PRESS OVERLAY ──────────────────────────────────────────────────── */
#ready-overlay {
    background-color: rgba(4, 1, 12, 0.9);
}

.ready-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.ready-title {
    font-family: var(--font-pixel);
    font-size: 22px;
    letter-spacing: 2px;
    animation: textGlowPulse 1.5s ease-in-out infinite alternate;
}

.ready-sub {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.5;
}

.pulse-key-icon {
    font-size: 40px;
    margin-top: 10px;
    animation: bouncePulse 1.2s infinite ease-in-out;
}

@keyframes textGlowPulse {
    from {
        text-shadow: 0 0 10px rgba(0,243,255,0.6), 0 0 20px rgba(0,243,255,0.2);
    }
    to {
        text-shadow: 0 0 22px rgba(0,243,255,1), 0 0 35px rgba(155,93,229,0.7);
    }
}

@keyframes bouncePulse {
    0%, 100% {
        transform: scale(1) translateY(0);
        filter: drop-shadow(0 0 5px rgba(0,243,255,0.3));
    }
    50% {
        transform: scale(1.15) translateY(-8px);
        filter: drop-shadow(0 0 20px rgba(0,243,255,0.8));
    }
}

/* ─── VIRTUAL KEYBOARD ─────────────────────────────────────────────────────── */
#virtual-keyboard {
    background: rgba(10, 4, 25, 0.95);
    border-top: 2px solid var(--border-color);
    padding: 10px 6px calc(10px + env(safe-area-inset-bottom)) 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 60;
    backdrop-filter: blur(12px);
    box-shadow: 0 -10px 25px rgba(0,0,0,0.6);
    transition: transform 0.3s ease, opacity 0.3s;
}

#virtual-keyboard.hidden {
    display: none !important;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    width: 100%;
    gap: 4px;
}

#virtual-keyboard .key {
    background: linear-gradient(180deg, rgba(30, 20, 50, 0.8) 0%, rgba(15, 10, 30, 0.9) 100%);
    border: 1px solid rgba(155, 93, 229, 0.4);
    border-radius: 6px;
    color: #e0d5ff;
    font-family: var(--font-mono);
    font-size: clamp(14px, 4vw, 20px);
    font-weight: bold;
    flex: 1;
    max-width: 48px;
    height: clamp(40px, 10vw, 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-transform: uppercase;
    transition: all 0.1s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05);
}

#virtual-keyboard .key-spacer {
    flex: 0.5;
    max-width: 24px;
    visibility: hidden;
    pointer-events: none;
}

#virtual-keyboard .key:hover {
    border-color: var(--neon-cyan);
    color: #fff;
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.4);
}

#virtual-keyboard .key:active, #virtual-keyboard .key.pressed {
    background: var(--neon-purple);
    border-color: var(--neon-cyan);
    color: #fff;
    transform: translateY(2px);
    box-shadow: 0 0 15px var(--neon-cyan);
    text-shadow: 0 0 5px #fff;
}

/* ─── Scrollbar styling ─────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(5, 2, 15, 0.5);
}
::-webkit-scrollbar-thumb {
    background: var(--neon-purple);
    border-radius: 3px;
}
