/* Shared Base Styles - Common styles for all games */

:root {
    /* Design tokens */
    --bg-color: #0b0c15;
    --surface: #0f1117;
    --card-bg: rgba(255, 255, 255, 0.04);
    --glass: rgba(255, 255, 255, 0.03);
    --primary: #00f3ff;
    --secondary: #bd00ff;
    --accent: #7ef3c7;
    --muted: #9aa3b2;
    --text: #e6eef6;
    --text-dim: #9aa3b2;
    --radius: 12px;
    --radius-sm: 8px;
    --gap: 16px;
    --shadow-elev: 0 8px 24px rgba(2, 6, 23, 0.6);
    --focus-ring: 0 0 0 4px rgba(0, 243, 255, 0.12);
}

/* Retro utilities */
.retro-bg {
    background-image: radial-gradient(circle at 10% 10%, rgba(0, 243, 255, 0.03), transparent 10%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent 40%);
}

/* Subtle scanlines overlay for retro feel */
.scanlines::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 3px;
    mix-blend-mode: overlay;
    opacity: 0.06;
    z-index: 2000;
}

/* Retro title style */
.retro-title {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.6rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--primary);
    text-shadow: 0 0 10px rgba(0, 243, 255, 0.6), 0 0 30px rgba(189, 0, 255, 0.25);
}

body {
    margin: 0;
    font-family: Inter, 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background-color: var(--bg-color);
    color: var(--text);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px 0;
    overflow-y: auto;
    line-height: 1.4;
    font-size: 16px;
}

.container {
    margin: auto;
    width: 100%;
    max-width: 980px;
    padding: 24px;
    text-align: center;
    box-sizing: border-box;
}

.screen {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.hidden {
    display: none;
    opacity: 0;
}

/* Home Link */
.home-link {
    position: absolute;
    top: 18px;
    left: 18px;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.95rem;
    z-index: 1000;
    transition: color 0.18s ease, transform 0.12s;
    padding: 6px 10px;
    border-radius: 8px;
}

.home-link:hover {
    color: var(--primary);
    transform: translateY(-1px);
}

/* Neon Text */
.neon-text {
    font-size: 2.5rem;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 28px;
}

.neon-title {
    font-size: 3.5rem;
    margin-bottom: 40px;
}

/* Buttons */
.neon-btn {
    padding: 12px 18px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.02), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
    box-shadow: var(--shadow-elev);
}

.neon-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 40px rgba(2, 6, 23, 0.55);
}

.neon-btn.primary {
    background: linear-gradient(90deg, rgba(0, 243, 255, 0.12), rgba(189, 0, 255, 0.06));
    border-color: rgba(0, 243, 255, 0.18);
}

.neon-btn.secondary {
    border-color: var(--secondary);
    color: var(--secondary);
    box-shadow: 0 0 10px rgba(189, 0, 255, 0.2);
}

.neon-btn.secondary:hover {
    background: var(--secondary);
    color: #fff;
    box-shadow: 0 0 20px rgba(189, 0, 255, 0.6);
}

.neon-btn.danger {
    border-color: #ff0055;
    color: #ff0055;
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.2);
}

.neon-btn.danger:hover {
    background: #ff0055;
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.6);
}

/* Forms */
.form-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

input,
select {
    padding: 15px;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}

input:focus,
select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 243, 255, 0.3);
}

/* Banner Notifications */
.banner {
    position: fixed;
    top: 80px;
    /* clear the 80px header padding */
    left: 0;
    width: 100%;
    padding: 15px;
    text-align: center;
    font-weight: bold;
    color: #fff;
    z-index: 10000;
    transform: translateY(-10px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease-in-out;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}

.banner.visible {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.banner.error {
    background: rgba(255, 0, 85, 0.9);
    border-bottom: 2px solid #ff0055;
}

.banner.info {
    background: rgba(0, 243, 255, 0.9);
    border-bottom: 2px solid var(--primary);
    color: #000;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: #1a1b26;
    margin: 10% auto;
    padding: 20px;
    border: 1px solid var(--primary);
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.2);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #fff;
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
}

.tab-btn {
    background: transparent;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 10px 20px;
    color: var(--text-dim);
    font-size: 1rem;
    transition: 0.3s;
}

.tab-btn:hover {
    color: #fff;
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Game Header */
.game-header {
    display: flex;
    justify-content: space-between;
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-dim);
}

/* Animations */
@keyframes flicker {

    0%,
    19%,
    21%,
    23%,
    25%,
    54%,
    56%,
    100% {
        text-shadow:
            0 0 5px #fff,
            0 0 10px #fff,
            0 0 20px var(--primary),
            0 0 40px var(--primary),
            0 0 80px var(--primary);
        opacity: 1;
    }

    20%,
    24%,
    55% {
        text-shadow: none;
        opacity: 0.8;
    }
}

.flicker-slow {
    color: #fff;
    animation: flicker 3s infinite alternate;
}

.flicker-fast {
    color: var(--primary);
    animation: flicker 1.5s infinite alternate-reverse;
}

/* Game Result Banner */
.game-msg {
    font-size: 2rem;
    font-weight: bold;
    padding: 20px;
    margin: 20px 0;
    border-radius: 12px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: bannerPulse 0.5s ease-in-out;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

@keyframes bannerPulse {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.game-msg.win {
    background: linear-gradient(135deg, rgba(0, 243, 255, 0.3) 0%, rgba(0, 255, 136, 0.3) 100%);
    border: 2px solid var(--primary);
    color: var(--primary);
    text-shadow: 0 0 20px var(--primary);
}

.game-msg.loss {
    background: linear-gradient(135deg, rgba(255, 0, 85, 0.3) 0%, rgba(255, 68, 0, 0.3) 100%);
    border: 2px solid #ff0055;
    color: #ff0055;
    text-shadow: 0 0 20px #ff0055;
}

.game-msg.draw {
    background: linear-gradient(135deg, rgba(189, 0, 255, 0.3) 0%, rgba(138, 43, 226, 0.3) 100%);
    border: 2px solid var(--secondary);
    color: var(--secondary);
    text-shadow: 0 0 20px var(--secondary);
}

/* Responsive */
@media (max-width: 600px) {
    .neon-text {
        font-size: 2.5rem;
    }

    .game-msg {
        font-size: 1.5rem;
        padding: 15px;
    }

    .neon-btn {
        padding: 12px;
    }

    input,
    select {
        padding: 12px;
        font-size: 16px;
    }
}

/* Player Turn Neon Border (full viewport)
   Add the class `player-turn` to `body` to show an animated full-screen neon border.
   This is preferred for small screens / mobile where the game container is too small.
*/
body.player-turn {
    position: relative;
}

body.player-turn::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1500;
    /* above most UI but below modals */
    pointer-events: none;
    border-radius: 0;
    /* layered soft gradients for a larger, more immersive glow */
    background:
        radial-gradient(40% 40% at 10% 20%, rgba(0, 243, 255, 0.18), transparent 18%),
        radial-gradient(50% 50% at 90% 80%, rgba(189, 0, 255, 0.14), transparent 18%),
        linear-gradient(180deg, rgba(0, 243, 255, 0.02), rgba(189, 0, 255, 0.02));
    filter: blur(28px) saturate(1.25);
    opacity: 1;
    mix-blend-mode: screen;
    animation: neon-pulse 2.6s ease-in-out infinite;
}

@keyframes neon-pulse {
    0% {
        transform: scale(0.995);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.01);
        opacity: 1;
    }

    100% {
        transform: scale(0.998);
        opacity: 0.95;
    }

    100% {
        transform: scale(0.998);
        opacity: 0.95;
    }
}

/* Empty Lobby Modal Specifics */
.empty-lobby-content {
    text-align: center;
    border-color: var(--secondary);
    box-shadow: 0 0 20px rgba(189, 0, 255, 0.3);
}

.empty-lobby-content h2 {
    color: var(--secondary);
    margin-top: 0;
}