/* ═══════════════════════════════════════════════
   GAMEVERSE ARCADE — Shared Design System
   ═══════════════════════════════════════════════ */

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

:root {
    /* Core Colors */
    --bg-primary: #020617;
    --bg-secondary: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.5);
    --bg-cell: rgba(15, 23, 42, 0.8);
    --bg-hover: rgba(51, 65, 85, 0.8);

    /* Accent Colors */
    --cyan: #06b6d4;
    --pink: #ec4899;
    --purple: #a855f7;
    --blue: #3b82f6;
    --green: #22c55e;
    --amber: #f59e0b;
    --red: #ef4444;

    /* Player Colors */
    --p1-color: #06b6d4;
    --p2-color: #ec4899;
    --p1-glow: 0 0 15px #06b6d4;
    --p2-glow: 0 0 15px #ec4899;

    /* Text */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Misc */
    --border-subtle: rgba(255,255,255,0.08);
    --border-light: rgba(255,255,255,0.15);
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow-lg: 0 25px 50px -12px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 30px rgba(6,182,212,0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    background-color: var(--bg-primary);
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    user-select: none;
    padding: 20px;
    position: relative;
}

/* ── Ambient Glow ── */
.ambient-glow {
    position: fixed;
    width: 50vw; height: 50vw;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(40px);
    opacity: 0.6;
}
.ambient-glow.cyan {
    background: radial-gradient(circle, rgba(6,182,212,0.12) 0%, transparent 70%);
    top: -20vh; left: -15vw;
    animation: float-slow 20s ease-in-out infinite;
}
.ambient-glow.pink {
    background: radial-gradient(circle, rgba(236,72,153,0.12) 0%, transparent 70%);
    bottom: -20vh; right: -15vw;
    animation: float-slow 25s ease-in-out infinite reverse;
}
.ambient-glow.purple {
    background: radial-gradient(circle, rgba(168,85,247,0.08) 0%, transparent 70%);
    top: 30vh; left: 50%;
    transform: translateX(-50%);
    animation: float-slow 30s ease-in-out infinite;
}
@keyframes float-slow {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(30px, -20px); }
    50% { transform: translate(-20px, 30px); }
    75% { transform: translate(20px, 20px); }
}

/* ── Page Title ── */
.page-title {
    font-family: 'Orbitron', sans-serif;
    font-size: clamp(1.8rem, 6vw, 3rem);
    font-weight: 800;
    text-align: center;
    background: linear-gradient(135deg, var(--cyan), var(--purple), var(--pink));
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 4s ease infinite;
    margin-bottom: 1.5rem;
    letter-spacing: 1px;
    position: relative;
    z-index: 10;
}
@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* ── Views ── */
.view {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 800px;
    z-index: 10;
    animation: view-enter 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.view.active { display: flex; }

@keyframes view-enter {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Buttons ── */
.btn-main {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 16px 40px;
    font-size: 1.1rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
    max-width: 320px;
    margin-bottom: 0.8rem;
    text-align: center;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}
.btn-main::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(168,85,247,0.08));
    opacity: 0;
    transition: opacity 0.3s;
}
.btn-main:hover::before { opacity: 1; }
.btn-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.3), 0 0 20px rgba(6,182,212,0.15);
    border-color: var(--cyan);
}
.btn-main:active { transform: translateY(-1px); }

.btn-action {
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    color: white;
    border: none;
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.btn-action::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}
.btn-action:hover {
    box-shadow: 0 0 20px var(--cyan);
    transform: translateY(-2px);
}
.btn-action:hover::after { opacity: 1; }

.btn-back {
    align-self: flex-start;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: 'Poppins', sans-serif;
    margin-bottom: 20px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    z-index: 10;
}
.btn-back:hover {
    color: white;
    border-color: var(--cyan);
    background: rgba(6,182,212,0.1);
}

.btn-icon {
    width: 42px; height: 42px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: rgba(30, 41, 59, 0.6);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
}
.btn-icon:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    box-shadow: 0 0 15px rgba(6,182,212,0.2);
}

/* ── Mode Selection ── */
.mode-select {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin-top: 1rem;
}

.mode-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 20px 24px;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(8px);
}
.mode-card:hover {
    border-color: var(--cyan);
    transform: translateX(8px);
    box-shadow: -4px 0 20px rgba(6,182,212,0.15);
    background: rgba(6,182,212,0.05);
}
.mode-card .mode-icon {
    font-size: 2rem;
    width: 50px;
    text-align: center;
    flex-shrink: 0;
}
.mode-card .mode-info h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.mode-card .mode-info p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Server Lobby ── */
.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
}
.server-header h2 {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
}

.server-list {
    width: 100%;
    background: rgba(15,23,42,0.6);
    border-radius: var(--radius-md);
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-subtle);
}

.server-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}
.server-item:last-child { border-bottom: none; }
.server-item:hover { background: rgba(6,182,212,0.04); }
.server-info h3 { margin-bottom: 4px; color: var(--cyan); font-size: 1rem; }
.server-info p { font-size: 0.85rem; color: var(--text-muted); }
.empty-state { text-align: center; color: var(--text-muted); padding: 30px 20px; font-style: italic; }

/* ── Input Groups ── */
.input-group { margin-bottom: 15px; width: 100%; text-align: left; }
.input-group label {
    display: block;
    margin-bottom: 6px;
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 500;
}
.input-group input {
    width: 100%;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: rgba(0,0,0,0.3);
    color: white;
    font-family: 'Poppins', sans-serif;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}
.input-group input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(6,182,212,0.15);
}

/* ── Status Bar ── */
.game-status {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1rem;
    z-index: 10;
    padding: 8px 20px;
    background: rgba(30, 41, 59, 0.4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
}
.game-status .player-indicator {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
}
.game-status .online-badge {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: normal;
    margin-left: 6px;
}

/* ── Modals ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2,6,23,0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
    background: rgba(30,41,59,0.95);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    text-align: center;
    transform: scale(0.85) translateY(20px);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-lg), 0 0 60px rgba(6,182,212,0.08);
    width: 90%;
    max-width: 420px;
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal h2 {
    margin-bottom: 1.5rem;
    font-family: 'Orbitron', sans-serif;
    color: white;
    font-size: 1.3rem;
}
.modal-actions {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 20px;
}
.modal-actions .btn-cancel {
    background: transparent;
    border: 1px solid var(--text-muted);
    color: var(--text-secondary);
    padding: 10px 22px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    transition: var(--transition);
}
.modal-actions .btn-cancel:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

/* ── Win Text ── */
.win-text {
    font-size: 2.2rem;
    font-family: 'Orbitron', sans-serif;
    font-weight: 800;
    background: linear-gradient(135deg, var(--cyan), var(--blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Helper Text ── */
.hint-text {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 12px;
    z-index: 10;
}

/* ── Loading Spinner ── */
.spinner {
    width: 28px; height: 28px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Animations ── */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.15); }
    70% { transform: scale(0.95); }
    100% { transform: scale(1); opacity: 1; }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ── Responsive ── */
@media (max-width: 600px) {
    body { padding: 12px; }
    .page-title { margin-bottom: 1rem; }
    .btn-main { padding: 12px 24px; font-size: 0.95rem; }
    .modal { padding: 1.5rem; }
    .mode-card { padding: 14px 16px; }
    .game-status { padding: 6px 14px; font-size: 0.95rem; }
}

@media (max-width: 400px) {
    body { padding: 8px; }
    .btn-main { padding: 10px 16px; font-size: 0.9rem; max-width: 280px; }
    .modal { padding: 1.2rem; border-radius: var(--radius-md); }
}
