/* NetCrawl Modern Roguelike Styling */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
    --bg-main: #030712;
    --border-glow: #06b6d4;
}

* {
    box-sizing: border-box;
}

button:focus-visible,
input:focus-visible,
canvas:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #67e8f9;
    outline-offset: 3px;
}

html, body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--bg-main);
    color: #f8fafc;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    user-select: none;
}

.game-font {
    font-family: 'Press Start 2P', monospace;
}

.font-code {
    font-family: 'JetBrains Mono', monospace;
}

/* Canvas Styling - Maximizes full vertical real estate */
#canvas-container {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    min-height: 0;
}

#gameCanvas {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    max-height: calc(100vh - 140px);
    max-width: calc(100vw - 32px);
    width: auto;
    height: auto;
    aspect-ratio: 960 / 624;
    border-radius: 10px;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.9), 0 0 12px rgba(6, 182, 212, 0.25);
    border: 1px solid rgba(30, 41, 59, 0.7);
    display: block;
}

.game-wrapper {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    overflow: hidden;
    z-index: 10;
    background-color: #020617;
}

/* Left-Side Floating Message Log Overlay */
#floating-log-panel {
    position: absolute;
    left: 16px;
    top: 68px;
    width: 330px;
    max-height: calc(100vh - 170px);
    z-index: 30;
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#floating-log-panel.collapsed {
    transform: translateX(-350px);
    opacity: 0;
    pointer-events: none;
}

.glass-panel {
    background: rgba(3, 7, 18, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(56, 189, 248, 0.22);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
}

/* Title Screen Styling with Atmospheric Cyber Gladiator Arena */
.splash-bg {
    background: radial-gradient(ellipse at 50% 30%, #0f172a 0%, #030712 60%, #020617 100%);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Character Selection Cards */
.char-card {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.char-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(6, 182, 212, 0.35);
}

.boss-rush-launch button {
    display: grid;
    width: 100%;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 11px 14px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 12px;
    background: rgba(2, 6, 23, 0.82);
    color: #cbd5e1;
    text-align: left;
    transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.boss-rush-launch button:hover {
    border-color: rgba(52, 211, 153, 0.72);
    background: rgba(6, 78, 59, 0.18);
}

.boss-rush-launch button:focus-visible {
    outline: 3px solid rgba(103, 232, 249, 0.92);
    outline-offset: 3px;
}

.boss-rush-launch button[aria-pressed="true"] {
    border-color: #34d399;
    background: linear-gradient(90deg, rgba(6, 78, 59, 0.42), rgba(8, 47, 73, 0.38));
    box-shadow: 0 0 22px rgba(52, 211, 153, 0.18);
}

.boss-rush-signal {
    padding: 4px 7px;
    border: 1px solid rgba(245, 158, 11, 0.65);
    border-radius: 5px;
    color: #fcd34d;
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.08em;
}

.boss-rush-copy {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    font-family: 'JetBrains Mono', monospace;
}

.boss-rush-copy strong {
    color: #f8fafc;
    font-size: 12px;
}

.boss-rush-copy > span {
    color: #94a3b8;
    font-size: 10px;
    line-height: 1.4;
}

.boss-rush-switch {
    position: relative;
    width: 40px;
    height: 22px;
    border: 1px solid #475569;
    border-radius: 999px;
    background: #0f172a;
}

.boss-rush-switch span {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #94a3b8;
    transition: transform 160ms ease, background 160ms ease;
}

.boss-rush-launch button[aria-pressed="true"] .boss-rush-switch span {
    transform: translateX(18px);
    background: #34d399;
}

/* Button hover & glow effects */
.menu-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 18px rgba(6, 182, 212, 0.5);
}

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

/* Scrollbars */
::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.6);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #06b6d4;
}

/* Glow Animation */
@keyframes neonGlow {
    0%, 100% { filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.7)); }
    50% { filter: drop-shadow(0 0 25px rgba(6, 182, 212, 0.95)); }
}

.neon-glow {
    animation: neonGlow 3s infinite ease-in-out;
}

#mobile-gate {
    display: none;
}

#first-run-brief {
    position: fixed;
    right: 24px;
    bottom: 82px;
    z-index: 35;
    width: min(390px, calc(100vw - 48px));
    padding: 16px 44px 16px 16px;
    border: 1px solid rgba(34, 211, 238, 0.65);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.96);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
    color: #cbd5e1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    line-height: 1.6;
}

#first-run-brief[hidden] {
    display: none;
}

#first-run-brief strong {
    display: block;
    margin-bottom: 6px;
    color: #67e8f9;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    line-height: 1.5;
}

#first-run-brief button {
    position: absolute;
    top: 8px;
    right: 10px;
    min-width: 32px;
    min-height: 32px;
    color: #94a3b8;
    font-size: 22px;
    cursor: pointer;
}

@media (max-width: 767px) {
    html,
    body {
        max-width: 100%;
        overflow-x: hidden;
        overflow-y: auto;
    }

    #splash-overlay {
        justify-content: flex-start;
        gap: 28px;
        overflow-y: auto;
        overflow-x: hidden;
        padding: 24px 16px 32px;
    }

    #splash-overlay > div:first-child {
        width: 100%;
    }

    #splash-overlay h1 {
        max-width: 100%;
        font-size: clamp(2.6rem, 14vw, 4.2rem);
        line-height: 1;
        letter-spacing: -0.03em;
    }

    #splash-overlay > div:first-child > div:first-child {
        align-items: flex-start;
        gap: 10px;
    }

    #splash-overlay > div:first-child > div:first-child img {
        width: 44px;
        height: 44px;
    }

    .desktop-launch {
        display: none !important;
    }

    #mobile-gate {
        display: flex;
        width: 100%;
        max-width: 430px;
        flex-direction: column;
        gap: 14px;
        padding: 22px;
        border: 1px solid rgba(34, 211, 238, 0.55);
        border-radius: 16px;
        background: rgba(2, 6, 23, 0.92);
        box-shadow: 0 22px 60px rgba(0, 0, 0, 0.7);
    }

    .mobile-gate-signal {
        color: #fbbf24;
        font-family: 'JetBrains Mono', monospace;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: 0.12em;
    }

    #mobile-gate h2 {
        margin: 0;
        color: #67e8f9;
        font-size: 17px;
        line-height: 1.45;
    }

    #mobile-gate p {
        margin: 0;
        color: #e2e8f0;
        font-size: 16px;
        line-height: 1.65;
    }

    #mobile-gate .mobile-gate-note {
        color: #94a3b8;
        font-family: 'JetBrains Mono', monospace;
        font-size: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
