/* ============================================================
   CONQUEST OF WORLDS - Galactic Domination
   Space Strategy UI Theme
   ============================================================ */

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

/* ========== Reset & Base ========== */

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

:root {
    --bg-deep: #020508;
    --bg-dark: #060a14;
    --bg-mid: #0a0e1c;
    --bg-card: #0c1020;
    --bg-card-hover: #101428;
    --border: #152040;
    --border-glow: #253a6a;
    --accent: #4d9fff;
    --accent-bright: #70b8ff;
    --accent-dim: #2a5a9a;
    --gold: #ffb347;
    --gold-dim: #a07020;
    --green: #47ff8a;
    --green-dim: #1a4a2a;
    --red: #ff4757;
    --red-dim: #4a1a1a;
    --cyan: #00d4ff;
    --purple: #a855f7;
    --text: #c8d0e8;
    --text-dim: #6a7090;
    --text-bright: #e8ecf8;
    --font-display: 'Orbitron', 'Segoe UI', sans-serif;
    --font-body: 'Rajdhani', 'Segoe UI', sans-serif;
    --font-mono: 'Share Tech Mono', 'Consolas', monospace;
    --glow-blue: 0 0 20px rgba(77, 159, 255, 0.3), 0 0 40px rgba(77, 159, 255, 0.1);
    --glow-gold: 0 0 15px rgba(255, 179, 71, 0.3);
    --glow-red: 0 0 15px rgba(255, 71, 87, 0.4);
}

body {
    background: #020508;
    color: var(--text);
    font-family: var(--font-body);
    font-weight: 400;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    font-size: 18px;
}

/* Canvas starfield - behind everything */
#starfield-canvas {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Nebula and starfield are rendered on canvas - no CSS pseudo-elements needed */

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* ========== Scan-line overlay ========== */
#app::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 3px,
        rgba(0, 0, 0, 0.08) 3px,
        rgba(0, 0, 0, 0.08) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ========== Auth Screen ========== */

#auth-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
    position: relative;
}

/* Central glow behind auth */
#auth-screen::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -55%);
    width: 700px;
    height: 700px;
    background: radial-gradient(circle,
        rgba(77, 159, 255, 0.10) 0%,
        rgba(50, 100, 200, 0.05) 30%,
        transparent 65%);
    pointer-events: none;
    animation: centralPulse 8s ease-in-out infinite alternate;
}

@keyframes centralPulse {
    0% { opacity: 0.6; transform: translate(-50%, -55%) scale(0.95); }
    100% { opacity: 1; transform: translate(-50%, -55%) scale(1.05); }
}

/* Orbiting ring decoration */
#auth-screen::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    border: 1px solid rgba(77, 159, 255, 0.06);
    border-radius: 50%;
    pointer-events: none;
    animation: ringRotate 30s linear infinite;
    box-shadow:
        inset 0 0 30px rgba(77, 159, 255, 0.02),
        0 0 30px rgba(77, 159, 255, 0.02);
}

@keyframes ringRotate {
    0% { transform: translate(-50%, -50%) rotate(0deg); border-color: rgba(77,159,255,0.06); }
    50% { border-color: rgba(100,180,255,0.10); }
    100% { transform: translate(-50%, -50%) rotate(360deg); border-color: rgba(77,159,255,0.06); }
}

#auth-screen h1 {
    font-family: var(--font-display);
    font-size: 80px;
    font-weight: 900;
    letter-spacing: 24px;
    color: var(--accent-bright);
    text-shadow:
        0 0 40px rgba(77, 159, 255, 0.6),
        0 0 80px rgba(77, 159, 255, 0.3),
        0 0 120px rgba(77, 159, 255, 0.1);
    animation: titleGlow 4s ease-in-out infinite alternate;
    z-index: 2;
}

@keyframes titleGlow {
    0% {
        text-shadow:
            0 0 40px rgba(77,159,255,0.6),
            0 0 80px rgba(77,159,255,0.3);
        filter: brightness(1);
    }
    100% {
        text-shadow:
            0 0 60px rgba(77,159,255,0.8),
            0 0 100px rgba(77,159,255,0.4),
            0 0 150px rgba(77,159,255,0.15);
        filter: brightness(1.1);
    }
}

.subtitle {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 400;
    color: var(--text-dim);
    letter-spacing: 12px;
    text-transform: uppercase;
    z-index: 2;
}

#auth-box {
    background: linear-gradient(135deg, rgba(8, 12, 28, 0.92), rgba(6, 10, 22, 0.95));
    border: 1px solid rgba(77, 159, 255, 0.15);
    border-radius: 12px;
    padding: 28px;
    width: 360px;
    max-width: 90vw;
    backdrop-filter: blur(20px);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.6),
        0 0 60px rgba(77, 159, 255, 0.05),
        inset 0 1px 0 rgba(77, 159, 255, 0.1),
        inset 0 0 30px rgba(77, 159, 255, 0.02);
    position: relative;
    z-index: 2;
}

#auth-box::before {
    content: '';
    position: absolute;
    top: -1px; left: 15%; right: 15%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    border-radius: 1px;
    box-shadow: 0 0 15px rgba(77, 159, 255, 0.5);
}

/* Corner decorations on auth box */
#auth-box::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 15%; right: 15%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(77, 159, 255, 0.3), transparent);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    background: rgba(10, 15, 30, 0.8);
    color: var(--text-dim);
    border: 1px solid var(--border);
    padding: 10px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
}

.auth-tab:first-child { border-radius: 6px 0 0 6px; }
.auth-tab:last-child { border-radius: 0 6px 6px 0; }

.auth-tab.active {
    background: linear-gradient(135deg, rgba(42, 58, 106, 0.6), rgba(30, 45, 90, 0.8));
    color: var(--accent-bright);
    border-color: var(--accent-dim);
    box-shadow: inset 0 0 15px rgba(77, 159, 255, 0.1), 0 0 10px rgba(77, 159, 255, 0.05);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-form input {
    background: rgba(6, 10, 22, 0.8);
    border: 1px solid var(--border);
    color: var(--text-bright);
    padding: 12px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font-body);
    transition: all 0.3s;
}

.auth-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 15px rgba(77, 159, 255, 0.2), inset 0 0 10px rgba(77, 159, 255, 0.05);
    background: rgba(8, 14, 30, 0.9);
}

.auth-form input::placeholder {
    color: var(--text-dim);
    font-family: var(--font-body);
}

.error-msg {
    color: var(--red);
    font-size: 13px;
    text-align: center;
    min-height: 18px;
    margin-top: 8px;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.3);
}

/* ========== Dashboard Screen ========== */

#dashboard-screen {
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
}

#dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: linear-gradient(180deg, rgba(6, 10, 20, 0.95), rgba(8, 12, 24, 0.90));
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    backdrop-filter: blur(10px);
}

#dash-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-dim), var(--accent), var(--accent-dim), transparent);
}

#dash-header h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(77, 159, 255, 0.3);
}

#dash-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

#dash-gamertag {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--accent-bright);
    letter-spacing: 1px;
}

.user-tag {
    color: var(--text-dim);
    font-size: 14px;
    font-family: var(--font-mono);
    cursor: pointer;
    transition: all 0.2s;
    padding: 2px 6px;
    border-radius: 3px;
    background: rgba(77, 159, 255, 0.05);
}

.user-tag:hover {
    color: var(--accent-bright);
    background: rgba(77, 159, 255, 0.15);
    text-shadow: 0 0 8px rgba(77, 159, 255, 0.4);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border-glow);
    cursor: pointer;
    transition: all 0.3s;
    image-rendering: pixelated;
    box-shadow: 0 0 8px rgba(77, 159, 255, 0.1);
}

.avatar:hover {
    border-color: var(--accent);
    box-shadow: 0 0 16px rgba(77, 159, 255, 0.3);
}

#dash-content {
    padding: 24px;
    max-width: 820px;
    margin: 0 auto;
    width: 100%;
    background: rgba(4, 8, 16, 0.88);
    border-radius: 12px;
    border: 1px solid rgba(21, 32, 64, 0.4);
    margin-top: 8px;
    margin-bottom: 24px;
}

/* ========== Dashboard Tabs ========== */

.dash-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.dash-tab {
    flex: 0 0 auto;
    background: transparent;
    color: var(--text-dim);
    border: none;
    border-bottom: 2px solid transparent;
    padding: 14px 10px;
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
    white-space: nowrap;
}

.dash-tab:hover {
    color: var(--text);
    background: rgba(77, 159, 255, 0.03);
}

.dash-tab.active {
    color: var(--accent-bright);
    border-bottom-color: var(--accent);
    text-shadow: 0 0 10px rgba(77, 159, 255, 0.4);
}

.dash-tab-content h3 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(77, 159, 255, 0.15);
    position: relative;
}

.dash-tab-content h3::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px rgba(77, 159, 255, 0.5);
}

.dash-tab-content h4 {
    font-family: var(--font-display);
    color: var(--accent-bright);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

/* ========== Game Cards ========== */

.game-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.95), rgba(12, 18, 38, 0.92));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 10px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(5px);
}

/* Left accent line on cards */
.game-card::before {
    content: '';
    position: absolute;
    top: 20%; left: 0; bottom: 20%;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--accent-dim), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

/* Top shimmer line */
.game-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(77, 159, 255, 0.25), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.game-card:hover {
    border-color: var(--border-glow);
    background: linear-gradient(135deg, rgba(14, 20, 40, 0.9), rgba(18, 24, 50, 0.85));
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 25px rgba(77, 159, 255, 0.06),
        inset 0 0 30px rgba(77, 159, 255, 0.02);
    transform: translateY(-2px);
}

.game-card:hover::before,
.game-card:hover::after {
    opacity: 1;
}

.game-card-info strong {
    color: var(--text-bright);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
}

.game-card-meta {
    color: var(--text-dim);
    font-size: 14px;
    margin-top: 4px;
    font-family: var(--font-mono);
}

.game-card-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 6px;
    font-style: italic;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    padding: 8px 0;
}

.page-info {
    color: var(--text-dim);
    font-size: 14px;
    font-family: var(--font-mono);
}

/* Elo & Leaderboard */
.elo-badge {
    display: inline-block;
    background: rgba(74, 144, 217, 0.15);
    color: #6ab0ff;
    font-size: 13px;
    font-family: var(--font-mono);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(74, 144, 217, 0.3);
}

.ranked-badge {
    display: inline-block;
    background: rgba(255, 215, 0, 0.15);
    color: #ffd700;
    font-size: 13px;
    font-family: var(--font-mono);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 215, 0, 0.3);
    font-weight: bold;
}

.casual-badge {
    display: inline-block;
    background: rgba(100, 200, 100, 0.1);
    color: #7c7;
    font-size: 13px;
    font-family: var(--font-mono);
    padding: 1px 6px;
    border-radius: 4px;
    border: 1px solid rgba(100, 200, 100, 0.2);
}

.browse-filters {
    display: flex;
    gap: 4px;
}

/* Announcements */
.announcement {
    background: rgba(74, 144, 217, 0.08);
    border: 1px solid rgba(74, 144, 217, 0.2);
    border-radius: 6px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.announcement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    flex-wrap: wrap;
    gap: 8px;
}

.announcement-header strong {
    color: #8cf;
    font-size: 16px;
}

.announcement-meta {
    color: var(--text-dim);
    font-size: 13px;
    font-family: var(--font-mono);
}

.announcement-body {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
    white-space: pre-wrap;
}

.leaderboard-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    text-align: left;
    color: var(--text-dim);
    font-size: 12px;
    text-transform: uppercase;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
    padding: 8px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.leaderboard-table tr:hover {
    background: rgba(255,255,255,0.03);
}

.lb-rank {
    font-weight: bold;
    font-family: var(--font-mono);
    width: 40px;
}

.lb-rank.rank-1 { color: #ffd700; }
.lb-rank.rank-2 { color: #c0c0c0; }
.lb-rank.rank-3 { color: #cd7f32; }

.lb-player {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lb-rating {
    font-family: var(--font-mono);
    color: #6ab0ff;
    font-weight: bold;
}

.lb-record {
    font-family: var(--font-mono);
    color: var(--text-dim);
    font-size: 15px;
}

.game-card-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ========== Badges ========== */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: 8px;
    vertical-align: middle;
}

.badge-active {
    background: rgba(71, 255, 138, 0.1);
    color: var(--green);
    border: 1px solid rgba(71, 255, 138, 0.3);
    box-shadow: 0 0 10px rgba(71, 255, 138, 0.1);
}

.badge-completed {
    background: rgba(255, 179, 71, 0.1);
    color: var(--gold);
    border: 1px solid rgba(255, 179, 71, 0.3);
    box-shadow: 0 0 10px rgba(255, 179, 71, 0.1);
}

.badge-waiting {
    background: rgba(77, 159, 255, 0.1);
    color: var(--accent-bright);
    border: 1px solid rgba(77, 159, 255, 0.3);
    box-shadow: 0 0 10px rgba(77, 159, 255, 0.1);
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { box-shadow: 0 0 10px rgba(77, 159, 255, 0.1); }
    50% { box-shadow: 0 0 18px rgba(77, 159, 255, 0.3); }
}

/* ========== Invite Cards ========== */

.invite-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(14, 14, 40, 0.9), rgba(20, 18, 50, 0.8));
    border: 1px solid rgba(168, 85, 247, 0.25);
    border-radius: 8px;
    padding: 14px 18px;
    margin-bottom: 8px;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.05);
}

.invite-card-info strong {
    color: #d8d0ff;
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
}

.invite-card-actions {
    display: flex;
    gap: 6px;
}

/* ========== Create Game Form ========== */

.create-game-form h3 {
    margin-bottom: 16px;
}

.game-options {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 16px;
    align-items: center;
}

.game-options label {
    color: var(--text-dim);
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
}

.game-options input[type="text"],
.game-options input[type="number"] {
    width: 80px;
    background: rgba(6, 10, 22, 0.8);
    border: 1px solid var(--border);
    color: var(--text-bright);
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 14px;
    font-family: var(--font-mono);
    transition: all 0.3s;
}

.game-options input[type="text"] { width: 160px; }

.game-options input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(77, 159, 255, 0.15);
}

.radio-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.radio-label {
    color: var(--text-dim);
    font-size: 14px;
}

.radio-option {
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
}

.radio-option input[type="radio"] { accent-color: var(--accent); }

/* ========== Friends ========== */

.friend-add-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.friend-add-row input {
    flex: 1;
    background: rgba(6, 10, 22, 0.8);
    border: 1px solid var(--border);
    color: var(--text-bright);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 14px;
    font-family: var(--font-mono);
    transition: all 0.3s;
}

.friend-add-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(77, 159, 255, 0.15);
}

.friends-add {
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.92), rgba(12, 18, 38, 0.88));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 20px;
}

.friend-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.93), rgba(12, 18, 38, 0.90));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.friend-card:hover {
    border-color: var(--border-glow);
    background: linear-gradient(135deg, rgba(14, 20, 38, 0.95), rgba(18, 24, 48, 0.92));
}

.friend-card .friend-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.friend-card .friend-info .avatar { width: 28px; height: 28px; }
.friend-card .friend-name { color: var(--text); font-size: 16px; }
.friend-card .friend-tag { color: var(--text-dim); font-size: 13px; font-family: var(--font-mono); }
.friend-card .friend-status { color: var(--gold); font-size: 12px; text-transform: uppercase; font-family: var(--font-display); letter-spacing: 1px; }

.friend-invite-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(10, 14, 30, 0.92);
    border: 1px solid var(--border);
    border-radius: 4px;
    margin-bottom: 4px;
    color: var(--text);
    font-size: 15px;
}

.friend-invite-option input[type="checkbox"] { accent-color: var(--accent); }

/* ========== Notifications ========== */

#notifications-panel {
    position: absolute;
    top: 60px;
    right: 24px;
    width: 360px;
    max-height: 420px;
    background: linear-gradient(135deg, rgba(8, 12, 24, 0.97), rgba(10, 14, 28, 0.97));
    border: 1px solid var(--border-glow);
    border-radius: 10px;
    overflow-y: auto;
    z-index: 60;
    box-shadow:
        0 8px 40px rgba(0, 0, 0, 0.7),
        0 0 40px rgba(77, 159, 255, 0.06),
        inset 0 0 30px rgba(77, 159, 255, 0.02);
    backdrop-filter: blur(15px);
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.notif-header h3 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(10, 14, 28, 0.8);
    cursor: default;
    transition: background 0.2s;
}

.notif-item:hover { background: rgba(77, 159, 255, 0.03); }

.notif-item.notif-unread {
    background: rgba(77, 159, 255, 0.05);
    border-left: 3px solid var(--accent);
}

.notif-item .notif-title { color: var(--text-bright); font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.notif-item .notif-message { color: var(--text-dim); font-size: 14px; }
.notif-item .notif-time { color: rgba(100, 110, 140, 0.6); font-size: 12px; margin-top: 4px; font-family: var(--font-mono); }

.btn-notif {
    position: relative;
    font-size: 16px;
    padding: 4px 8px;
}

.notif-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: linear-gradient(135deg, #ff4757, #ff6b6b);
    color: #fff;
    font-family: var(--font-display);
    font-size: 10px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
    animation: notifPulse 2s ease-in-out infinite;
}

@keyframes notifPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(255, 71, 87, 0.5); }
    50% { box-shadow: 0 0 20px rgba(255, 71, 87, 0.8); }
}

.notif-icon { font-size: 16px; }

/* ========== Lobby Screen ========== */

#lobby-screen {
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

#lobby-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: linear-gradient(180deg, rgba(6, 10, 20, 0.95), rgba(8, 12, 24, 0.90));
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    position: relative;
    backdrop-filter: blur(10px);
}

#lobby-header::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-dim), var(--accent), var(--accent-dim), transparent);
}

#lobby-header h2 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 4px;
}

#lobby-content {
    padding: 24px;
    max-width: 620px;
    margin: 0 auto;
    width: 100%;
}

#lobby-content h3 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin: 20px 0 12px;
    position: relative;
    padding-bottom: 6px;
}

#lobby-content h3::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 30px;
    height: 2px;
    background: var(--accent-dim);
}

#lobby-info {
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.93), rgba(12, 18, 38, 0.90));
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    position: relative;
    overflow: hidden;
}

#lobby-info::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 2px; height: 100%;
    background: linear-gradient(180deg, var(--accent), transparent);
}

.lobby-detail {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 13px;
    font-family: var(--font-mono);
}

.lobby-detail span:first-child { color: var(--text-dim); }
.lobby-detail span:last-child { color: var(--text-bright); }

.lobby-player {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.93), rgba(12, 18, 38, 0.90));
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 6px;
    transition: all 0.2s;
}

.lobby-player:hover { border-color: var(--border-glow); }
.lobby-player .avatar { width: 32px; height: 32px; }
.lobby-player .player-name { color: var(--text); font-size: 16px; }
.lobby-player .player-slot { color: var(--text-dim); font-size: 14px; margin-left: auto; }
.lobby-player.empty-slot { border-style: dashed; border-color: var(--border); }
.lobby-player.empty-slot .player-name { color: rgba(100, 110, 140, 0.4); font-style: italic; }

/* ========== Chat ========== */

#lobby-chat-section { margin-top: 20px; }

#lobby-chat-messages {
    background: rgba(2, 5, 10, 0.8);
    border: 1px solid var(--border);
    border-radius: 8px;
    height: 280px;
    overflow-y: auto;
    padding: 12px;
    margin-bottom: 8px;
    position: relative;
}

/* Subtle inner glow at top of chat */
#lobby-chat-messages::before {
    content: '';
    position: sticky;
    top: 0; left: 0; right: 0;
    display: block;
    height: 20px;
    margin: -12px -12px 0 -12px;
    background: linear-gradient(180deg, rgba(4, 8, 16, 0.9), transparent);
    pointer-events: none;
    z-index: 1;
}

.chat-msg {
    margin-bottom: 6px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(10, 14, 28, 0.6);
}

.chat-msg:last-child { border-bottom: none; }

.chat-msg.chat-mine .chat-author { color: var(--accent-bright); }

.chat-author {
    color: var(--cyan);
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-right: 6px;
}

.chat-time {
    color: rgba(100, 110, 140, 0.4);
    font-size: 10px;
    font-family: var(--font-mono);
}

.chat-text {
    color: var(--text);
    font-size: 13px;
    margin-top: 2px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.chat-input-row {
    display: flex;
    gap: 6px;
}

.chat-input-row input {
    flex: 1;
    background: rgba(6, 10, 22, 0.8);
    border: 1px solid var(--border);
    color: var(--text-bright);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-family: var(--font-body);
    transition: all 0.3s;
}

.chat-input-row input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(77, 159, 255, 0.15);
}

/* ========== In-Game Chat Panel ========== */

#game-chat-panel {
    position: fixed;
    bottom: 0;
    right: 330px;
    width: 340px;
    height: 380px;
    background: linear-gradient(180deg, rgba(8, 12, 24, 0.97), rgba(6, 10, 20, 0.98));
    border: 1px solid var(--border-glow);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
    display: flex;
    flex-direction: column;
    z-index: 55;
    box-shadow:
        0 -4px 30px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(77, 159, 255, 0.05);
    backdrop-filter: blur(15px);
}

.game-chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.game-chat-header h3 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#game-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: rgba(2, 5, 10, 0.6);
}

#game-chat-panel .chat-input-row {
    padding: 8px;
    flex-shrink: 0;
}

/* ========== Turn Status ========== */

.turn-timer {
    font-family: var(--font-mono);
    color: var(--gold);
    font-size: 13px;
    font-weight: bold;
    text-shadow: var(--glow-gold);
}

.turn-timer.urgent {
    color: var(--red);
    text-shadow: var(--glow-red);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.turn-subs {
    color: var(--text-dim);
    font-size: 12px;
    font-family: var(--font-mono);
}

#btn-submit-turn {
    margin-left: auto;
    padding: 8px 24px;
    font-size: 12px;
}

#btn-submit-turn.submitted {
    background: linear-gradient(135deg, rgba(26, 58, 26, 0.8), rgba(42, 90, 42, 0.8));
    border: 1px solid rgba(71, 255, 138, 0.3);
    box-shadow: 0 0 15px rgba(71, 255, 138, 0.1);
    color: var(--green);
}

/* ========== Buttons ========== */

.btn-primary {
    background: linear-gradient(135deg, #1a3a7a, #2a5aaa, #3a6acc);
    color: #fff;
    border: 1px solid rgba(77, 159, 255, 0.3);
    padding: 12px 36px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    letter-spacing: 3px;
    text-transform: uppercase;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; right: 100%; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: all 0.5s;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2a4a8a, #3a6abb, #4a7add);
    box-shadow: 0 0 30px rgba(77, 159, 255, 0.3), inset 0 0 20px rgba(77, 159, 255, 0.1);
    border-color: rgba(77, 159, 255, 0.5);
    transform: translateY(-1px);
}

.btn-primary:hover::before {
    left: 100%;
    right: -100%;
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 0 15px rgba(77, 159, 255, 0.2);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-small {
    background: rgba(15, 22, 45, 0.8);
    color: var(--accent-bright);
    border: 1px solid var(--border-glow);
    padding: 5px 14px;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    margin: 2px;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: all 0.2s;
}

.btn-small:hover {
    background: rgba(25, 38, 70, 0.9);
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(77, 159, 255, 0.15);
}

.top-bar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.font-size-controls {
    display: flex;
    gap: 2px;
}
.btn-font {
    padding: 3px 8px !important;
    font-size: 12px !important;
    min-width: 30px;
    letter-spacing: 0;
}

.btn-small.btn-danger,
.btn-danger {
    background: rgba(60, 15, 15, 0.8);
    color: #ff6b6b;
    border-color: rgba(255, 71, 87, 0.3);
}

.btn-small.btn-danger:hover,
.btn-danger:hover {
    background: rgba(80, 20, 20, 0.9);
    border-color: rgba(255, 71, 87, 0.5);
    box-shadow: 0 0 12px rgba(255, 71, 87, 0.15);
}

.btn-small.btn-success {
    background: rgba(15, 50, 20, 0.8);
    color: var(--green);
    border-color: rgba(71, 255, 138, 0.3);
}

.btn-small.btn-success:hover {
    background: rgba(20, 70, 30, 0.9);
    box-shadow: 0 0 12px rgba(71, 255, 138, 0.15);
}

.btn-sm {
    padding: 7px 18px;
    font-size: 11px;
}

/* ========== Game Screen ========== */

#game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

#top-bar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 10px 16px;
    background: linear-gradient(180deg, rgba(6, 10, 20, 0.95), rgba(8, 12, 24, 0.90));
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    flex-wrap: wrap;
    position: relative;
    backdrop-filter: blur(10px);
}

#top-bar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-dim), var(--accent), var(--accent-dim), transparent);
}

#top-bar span {
    font-size: 13px;
    font-family: var(--font-mono);
}

#turn-display {
    font-family: var(--font-display);
    color: var(--accent-bright);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1px;
    text-shadow: 0 0 10px rgba(77, 159, 255, 0.3);
}

#credits-display {
    color: var(--gold);
    text-shadow: 0 0 8px rgba(255, 179, 71, 0.2);
}

#systems-display {
    color: var(--green);
    text-shadow: 0 0 8px rgba(71, 255, 138, 0.2);
}

#main-area {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

#star-map {
    flex: 1;
    min-width: 0;
    background: var(--bg-deep);
    cursor: default;
    display: block;
}

/* Side Panel */
#side-panel {
    width: 320px;
    background: linear-gradient(180deg, rgba(8, 12, 24, 0.95), rgba(6, 10, 20, 0.98));
    border-left: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    position: relative;
}

#side-panel::before {
    content: '';
    position: absolute;
    top: 0; left: -1px;
    width: 1px; height: 100%;
    background: linear-gradient(180deg, var(--accent-dim), transparent 30%, transparent 70%, var(--accent-dim));
    pointer-events: none;
}

#panel-resize-handle {
    position: absolute;
    top: 0; left: 0;
    width: 6px; height: 100%;
    cursor: col-resize;
    z-index: 10;
    background: transparent;
    transition: background 0.2s;
}
#panel-resize-handle:hover,
#panel-resize-handle.dragging {
    background: linear-gradient(180deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
}

.panel-hint {
    color: var(--text-dim);
    font-style: italic;
    text-align: center;
    padding: 40px 10px;
    font-size: 13px;
}

.panel-section {
    margin-bottom: 16px;
}

.panel-section h3 {
    font-family: var(--font-display);
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-bottom: 1px solid rgba(77, 159, 255, 0.15);
    padding-bottom: 6px;
    position: relative;
}

.panel-section h3::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0;
    width: 25px; height: 2px;
    background: var(--accent);
    box-shadow: 0 0 6px rgba(77, 159, 255, 0.4);
}

.panel-section p, .panel-section li {
    font-size: 13px;
    color: var(--text);
    line-height: 1.7;
}

.panel-section ul {
    list-style: none;
    padding: 0;
}

.panel-section li::before {
    content: "\25B8";
    color: var(--accent-dim);
    margin-right: 8px;
    font-size: 10px;
}

/* Fleet / Ship / Build UI */
.fleet-item {
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.93), rgba(12, 18, 38, 0.90));
    padding: 8px;
    margin: 4px 0;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
}

.fleet-item:hover {
    border-color: var(--border-glow);
    background: linear-gradient(135deg, rgba(14, 20, 38, 0.8), rgba(18, 24, 48, 0.6));
}

.fleet-item.selected {
    border-color: var(--accent);
    box-shadow: 0 0 10px rgba(77, 159, 255, 0.15);
}

.ship-tag {
    display: inline-block;
    padding: 2px 8px;
    margin: 1px;
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 11px;
    background: rgba(77, 159, 255, 0.1);
    color: var(--accent-bright);
    border: 1px solid rgba(77, 159, 255, 0.15);
}

.ship-row {
    padding: 4px 4px;
    font-size: 12px;
    color: var(--text);
    border-bottom: 1px solid rgba(4, 8, 16, 0.6);
}
.ship-cargo {
    margin: 4px 0 2px 16px;
    padding: 4px 6px;
    background: rgba(255,255,255,0.02);
    border-left: 2px solid rgba(77, 159, 255, 0.2);
    font-size: 11px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.ship-cargo-header {
    color: #888;
    font-family: var(--font-mono);
    font-size: 10px;
    margin-right: 6px;
}
.cargo-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
    padding: 3px 0;
    border-top: 1px solid rgba(255,255,255,0.04);
}
.cargo-row-label {
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 1px;
    width: 52px;
    flex-shrink: 0;
    font-weight: bold;
}
.deposit-label { color: #f84; }
.take-label { color: #4c8; }
.cargo-btn {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.1);
    cursor: pointer;
    color: var(--cargo-color, #aaa);
    background: rgba(255,255,255,0.04);
    transition: background 0.15s;
}
.cargo-btn:hover {
    background: rgba(255,255,255,0.12);
}
.cargo-btn.deposit {
    border-color: rgba(255, 136, 68, 0.25);
}
.cargo-btn.deposit:hover {
    background: rgba(255, 136, 68, 0.15);
}
.cargo-btn.take {
    border-color: rgba(68, 204, 136, 0.25);
}
.cargo-btn.take:hover {
    background: rgba(68, 204, 136, 0.15);
}
.cargo-btn.all {
    font-weight: bold;
}

.ship-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.ship-row label:hover { color: var(--text-bright); }
.ship-checkbox { accent-color: var(--accent); }

.build-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    margin: 4px 0;
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.93), rgba(12, 18, 38, 0.90));
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.build-option:hover {
    border-color: var(--border-glow);
}

.build-option .cost {
    color: var(--gold);
    font-size: 12px;
    font-family: var(--font-mono);
    text-shadow: 0 0 6px rgba(255, 179, 71, 0.2);
}

.build-option.cant-afford {
    opacity: 0.6;
    border-color: rgba(255, 80, 80, 0.25);
}

.build-option.cant-afford > span:first-child {
    color: #f66;
}

.build-option.cant-afford:hover {
    border-color: rgba(255, 80, 80, 0.4);
}

/* --- Minerals --- */

.mineral-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0;
}

.mineral-badge {
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 2px 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.mineral-prod {
    font-size: 0.85em;
    opacity: 0.7;
}

.btn-tiny {
    font-size: 9px;
    padding: 1px 5px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    color: inherit;
    border-radius: 3px;
    cursor: pointer;
    font-family: var(--font-mono);
}
.btn-tiny:hover {
    background: rgba(255,255,255,0.15);
}

/* --- Marketplace --- */

.market-order {
    padding: 4px 8px;
    margin: 3px 0;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    font-size: 12px;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.market-select {
    background: var(--bg-card);
    color: var(--text-bright);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 11px;
    font-family: var(--font-mono);
}

.market-input {
    background: var(--bg-card);
    color: var(--text-bright);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 2px 4px;
    font-size: 11px;
    font-family: var(--font-mono);
    width: 40px;
}

/* --- Alliance & Diplomacy --- */

.alliance-card {
    padding: 5px 8px;
    margin: 4px 0;
    background: rgba(255,255,255,0.03);
    border-radius: 4px;
    font-size: 12px;
    border-left: 3px solid var(--accent-dim);
}
.alliance-card.active {
    border-left-color: var(--green);
}
.alliance-card.pending {
    border-left-color: var(--gold-dim);
}
.alliance-meta {
    font-size: 10px;
    color: #888;
    font-family: var(--font-mono);
}

.message-list {
    max-height: 180px;
    overflow-y: auto;
    margin: 4px 0;
    padding-right: 4px;
}
.game-message {
    padding: 3px 6px;
    margin: 2px 0;
    border-radius: 4px;
    font-size: 11px;
}
.game-message.sent {
    background: rgba(77,159,255,0.08);
    border-left: 2px solid var(--accent-dim);
}
.game-message.received {
    background: rgba(255,179,71,0.08);
    border-left: 2px solid var(--gold-dim);
}
.msg-header {
    display: block;
    font-size: 10px;
    color: #888;
    font-family: var(--font-mono);
}
.msg-turn {
    color: #555;
    margin-left: 4px;
}
.msg-body {
    display: block;
    margin-top: 1px;
    color: var(--text-dim);
}
.game-message.msg-broken {
    background: rgba(255,60,60,0.1);
    border-left-color: #f44;
}
.game-message.msg-broken .msg-body {
    color: #f66;
}
.msg-input {
    background: var(--bg-card);
    color: var(--text-bright);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 3px 6px;
    font-size: 11px;
    font-family: var(--font-mono);
    flex: 1;
    min-width: 80px;
}
.diplo-form {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    margin-top: 4px;
}
.badge-alliance {
    font-size: 9px;
    background: rgba(71,255,138,0.15);
    color: var(--green);
    padding: 0 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
    vertical-align: middle;
}

/* Event Log */
#event-log {
    height: 150px;
    min-height: 60px;
    max-height: 50vh;
    background: rgba(2, 4, 10, 0.95);
    border-top: 1px solid var(--border);
    overflow-y: auto;
    padding: 8px 16px;
    flex-shrink: 0;
    position: relative;
}

#event-log::before {
    content: '';
    position: absolute;
    top: -1px; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-dim), transparent);
}

#event-log-resize {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 5px;
    cursor: ns-resize;
    background: transparent;
    z-index: 10;
}

#event-log-resize:hover {
    background: linear-gradient(90deg, transparent, rgba(77, 159, 255, 0.3), transparent);
}

#event-log-content { font-size: 12px; font-family: var(--font-mono); }

.event-line { padding: 2px 0; color: var(--text-dim); }
.event-line.combat { color: var(--red); text-shadow: 0 0 8px rgba(255, 71, 87, 0.2); }
.event-line.colonize { color: var(--green); text-shadow: 0 0 8px rgba(71, 255, 138, 0.2); }
.event-line.build_complete { color: var(--gold); }
.event-line.victory { color: #ffd700; font-weight: bold; text-shadow: 0 0 15px rgba(255, 215, 0, 0.5); animation: victoryGlow 1s ease-in-out infinite alternate; }

@keyframes victoryGlow {
    0% { text-shadow: 0 0 15px rgba(255, 215, 0, 0.5); }
    100% { text-shadow: 0 0 25px rgba(255, 215, 0, 0.8), 0 0 40px rgba(255, 215, 0, 0.3); }
}

/* Loading Overlay */
#loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2, 4, 10, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(6px);
}

#loading p {
    font-family: var(--font-display);
    font-size: 14px;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--accent);
    animation: loadPulse 1.5s ease-in-out infinite;
}

@keyframes loadPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(77, 159, 255, 0.15);
    border-top: 3px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 20px;
    box-shadow: 0 0 20px rgba(77, 159, 255, 0.2);
    position: relative;
}

/* Double ring spinner */
.spinner::before {
    content: '';
    position: absolute;
    top: 3px; left: 3px; right: 3px; bottom: 3px;
    border: 2px solid rgba(77, 159, 255, 0.1);
    border-bottom: 2px solid var(--accent-dim);
    border-radius: 50%;
    animation: spin 1.2s linear reverse infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Modals */
#combat-modal,
#game-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(2, 4, 10, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(6px);
}

.game-modal-box {
    border-color: rgba(77, 159, 255, 0.3) !important;
    box-shadow:
        0 0 60px rgba(77, 159, 255, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 0 40px rgba(77, 159, 255, 0.02) !important;
    max-width: 380px !important;
}
.game-modal-box::before {
    background: linear-gradient(90deg, transparent, rgba(77, 159, 255, 0.6), transparent) !important;
    box-shadow: 0 0 10px rgba(77, 159, 255, 0.4) !important;
}
.game-modal-box h2 {
    color: var(--accent-bright) !important;
    text-shadow: 0 0 20px rgba(77, 159, 255, 0.4) !important;
    font-size: 16px;
    letter-spacing: 3px;
}
.game-modal-box p {
    color: var(--text-dim);
    font-family: var(--font-body);
    font-size: 13px;
    margin-bottom: 12px;
    text-align: center;
}
.game-modal-input {
    width: 100%;
    background: var(--bg-card);
    color: var(--text-bright);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 16px;
    font-family: var(--font-mono);
    text-align: center;
    margin-bottom: 12px;
    outline: none;
}
.game-modal-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 8px rgba(77, 159, 255, 0.2);
}
.game-modal-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.modal-content {
    background: linear-gradient(135deg, rgba(12, 14, 30, 0.98), rgba(8, 10, 24, 0.98));
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: 12px;
    padding: 28px;
    max-width: 520px;
    width: 90%;
    max-height: 70vh;
    overflow-y: auto;
    box-shadow:
        0 0 60px rgba(255, 71, 87, 0.1),
        0 8px 32px rgba(0, 0, 0, 0.6),
        inset 0 0 40px rgba(255, 71, 87, 0.02);
    position: relative;
}

.modal-content::before {
    content: '';
    position: absolute;
    top: -1px; left: 15%; right: 15%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(255, 71, 87, 0.6), transparent);
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.4);
}

.modal-content h2 {
    font-family: var(--font-display);
    color: var(--red);
    font-weight: 700;
    letter-spacing: 4px;
    margin-bottom: 16px;
    text-align: center;
    text-shadow: 0 0 20px rgba(255, 71, 87, 0.4);
}

/* Combat modal content */
.combat-modal-content {
    max-width: 700px !important;
    width: 95% !important;
    padding: 20px 24px !important;
    max-height: 85vh !important;
}

.combat-header {
    text-align: center;
    margin-bottom: 12px;
}
.combat-location {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--red);
    letter-spacing: 3px;
    text-shadow: 0 0 15px rgba(255, 71, 87, 0.4);
}

/* ===== Battle Arena ===== */
.combat-arena {
    position: relative;
    display: flex;
    align-items: stretch;
    gap: 0;
    margin-bottom: 12px;
    padding: 16px 8px;
    background: radial-gradient(ellipse at center, rgba(10, 15, 40, 0.9), rgba(2, 4, 10, 0.95));
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.06);
    min-height: 160px;
    overflow: hidden;
}
.combat-arena::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect width="1" height="1" fill="rgba(255,255,255,0.02)"/></svg>');
    pointer-events: none;
}

.combat-fleet-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}
.combat-fleet-col .combat-side-name {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 2px;
    margin-bottom: 2px;
}
.combat-fleet-col .combat-ship-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.combat-ships-column {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    width: 100%;
}

.combat-ship-row {
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    transition: opacity 0.4s, transform 0.4s;
}
.combat-ship-row.destroyed {
    opacity: 0.15;
    transform: scale(0.7);
    filter: grayscale(1) brightness(0.5);
}
.combat-ship-row .ship-img {
    image-rendering: pixelated;
    filter: drop-shadow(0 0 3px rgba(100,150,255,0.3));
    transition: filter 0.3s;
}
.combat-ship-row.attacker-side .ship-img {
    transform: scaleX(-1);
}
.combat-ship-row .ship-hp-bubbles {
    display: flex;
    gap: 2px;
    align-items: center;
}
.combat-ship-row .hp-bubble {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    border: 1px solid rgba(68, 255, 136, 0.5);
    transition: background 0.3s ease-out, border-color 0.3s ease-out;
}
.combat-ship-row .hp-bubble.full {
    background: var(--green);
    border-color: var(--green);
    box-shadow: 0 0 3px var(--green);
}
.combat-ship-row .hp-bubble.empty {
    background: transparent;
    border-color: rgba(255,255,255,0.15);
    box-shadow: none;
}
.combat-ship-row .ship-label {
    font-family: var(--font-mono);
    font-size: 8px;
    color: var(--text-dim);
    white-space: nowrap;
    max-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ship size scaling */
.ship-size-scout { width: 24px; height: 24px; }
.ship-size-fighter { width: 32px; height: 32px; }
.ship-size-cruiser { width: 44px; height: 44px; }
.ship-size-battleship { width: 56px; height: 56px; }
.ship-size-colony { width: 36px; height: 36px; }
.ship-size-freighter { width: 34px; height: 34px; }

/* VS divider */
.combat-vs-divider {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 40px;
    position: relative;
    z-index: 2;
}
.combat-vs-divider .vs-text {
    font-family: var(--font-display);
    font-size: 14px;
    color: var(--red);
    letter-spacing: 3px;
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.5);
}
.combat-vs-divider::before,
.combat-vs-divider::after {
    content: '';
    width: 1px;
    flex: 1;
    background: linear-gradient(transparent, rgba(255, 71, 87, 0.3), transparent);
}

/* Laser / projectile animations */
.combat-laser {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ff4757, #ff6b81, transparent);
    z-index: 10;
    pointer-events: none;
    animation: laserFire 0.4s ease-out forwards;
    transform-origin: left center;
}
.combat-laser.defender-laser {
    background: linear-gradient(90deg, transparent, #4d9fff, #70b8ff, transparent);
}

/* Damage number popup */
.combat-dmg-popup {
    position: absolute;
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--red);
    pointer-events: none;
    z-index: 15;
    animation: dmgFloat 0.8s ease-out forwards;
    text-shadow: 0 0 6px rgba(255, 71, 87, 0.6);
}
.combat-dmg-popup.miss {
    color: var(--text-dim);
    font-size: 10px;
    text-shadow: none;
}
.combat-dmg-popup.blocked {
    color: var(--gold);
    text-shadow: 0 0 6px rgba(255, 179, 71, 0.4);
}

/* Explosion effect */
.combat-explosion {
    position: absolute;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 200, 50, 0.9), rgba(255, 71, 50, 0.6), transparent);
    z-index: 12;
    pointer-events: none;
    animation: explode 0.6s ease-out forwards;
}

/* Round-by-round log */
#combat-rounds {
    max-height: 160px;
    overflow-y: auto;
    margin-bottom: 10px;
}
.combat-round-log {
    padding: 6px 10px;
    margin: 3px 0;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
    border-left: 3px solid var(--gold-dim);
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-dim);
}
.combat-round-log .round-title {
    font-family: var(--font-display);
    font-size: 10px;
    color: var(--gold);
    letter-spacing: 2px;
    margin-bottom: 2px;
}
.combat-round-log .round-kills {
    color: var(--red);
}

/* Outcome */
.combat-result {
    text-align: center;
    font-family: var(--font-display);
    font-size: 16px;
    letter-spacing: 2px;
    padding: 12px;
    border-radius: 8px;
    background: rgba(71, 255, 138, 0.08);
    border: 1px solid rgba(71, 255, 138, 0.2);
    margin-bottom: 12px;
}
.combat-result.captured {
    background: rgba(255, 71, 87, 0.08);
    border-color: rgba(255, 71, 87, 0.3);
}
.combat-result-text {
    color: var(--text-bright);
}
.combat-captured-tag {
    display: inline-block;
    margin-top: 4px;
    color: var(--red);
    text-shadow: 0 0 10px rgba(255, 71, 87, 0.4);
}
.combat-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 8px;
}

/* Reveal animation */
.combat-reveal {
    animation: combatReveal 0.4s ease-out;
}
@keyframes combatReveal {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes laserFire {
    0% { opacity: 0; }
    20% { opacity: 1; }
    70% { opacity: 1; }
    100% { opacity: 0; }
}
@keyframes dmgFloat {
    0% { opacity: 1; transform: translateY(0) scale(1); }
    100% { opacity: 0; transform: translateY(-20px) scale(0.8); }
}
@keyframes explode {
    0% { transform: scale(0); opacity: 1; }
    50% { transform: scale(1.5); opacity: 0.8; }
    100% { transform: scale(2); opacity: 0; }
}
@keyframes shipHit {
    0% { filter: brightness(1); }
    30% { filter: brightness(3) saturate(0); }
    100% { filter: brightness(1); }
}
@keyframes shipExplode {
    0% { transform: scale(1); opacity: 1; filter: brightness(1); }
    30% { transform: scale(1.3); opacity: 1; filter: brightness(3) saturate(2); }
    100% { transform: scale(0.5); opacity: 0; filter: brightness(0.3); }
}

@media (max-width: 600px) {
    .combat-modal-content { padding: 12px 10px !important; max-width: 100% !important; }
    .ship-size-battleship { width: 40px; height: 40px; }
    .ship-size-cruiser { width: 32px; height: 32px; }
    .ship-size-fighter { width: 24px; height: 24px; }
    .ship-size-scout { width: 18px; height: 18px; }
    .ship-size-colony { width: 28px; height: 28px; }
    .ship-size-freighter { width: 26px; height: 26px; }
    .combat-ship-row .hp-bubble { width: 6px; height: 6px; }
    .combat-ship-row .ship-label { display: none; }
}

/* Owner dots */
.owner-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
    box-shadow: 0 0 6px currentColor;
}

/* Mobile panel toggle */
.btn-panel-toggle {
    display: none;
    position: fixed;
    bottom: 160px;
    right: 10px;
    z-index: 50;
    background: linear-gradient(135deg, #1a2a4a, #2a3a5a);
    color: var(--accent);
    border: 1px solid var(--border-glow);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    font-size: 22px;
    cursor: pointer;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5), 0 0 15px rgba(77, 159, 255, 0.1);
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border-glow); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ========== Profile Settings ========== */

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.92), rgba(12, 18, 38, 0.88));
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 24px;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    border-width: 3px;
}

.profile-notif-settings {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notif-toggle {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(10, 14, 30, 0.92), rgba(12, 18, 38, 0.88));
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.notif-toggle:hover {
    border-color: var(--border-glow);
    background: linear-gradient(135deg, rgba(14, 20, 38, 0.7), rgba(18, 24, 48, 0.5));
}

.notif-toggle-label {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    letter-spacing: 1px;
    flex: 1;
    min-width: 150px;
}

.notif-toggle-desc {
    font-size: 12px;
    color: var(--text-dim);
    flex: 2;
    min-width: 200px;
}

/* Hide the actual checkbox */
.notif-toggle input[type="checkbox"] {
    display: none;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: rgba(60, 20, 20, 0.8);
    border: 1px solid rgba(255, 71, 87, 0.3);
    border-radius: 12px;
    transition: all 0.3s;
    flex-shrink: 0;
    margin-left: 12px;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #ff6b6b;
    border-radius: 50%;
    transition: all 0.3s;
    box-shadow: 0 0 6px rgba(255, 71, 87, 0.3);
}

.notif-toggle input:checked + .toggle-switch {
    background: rgba(20, 60, 30, 0.8);
    border-color: rgba(71, 255, 138, 0.3);
}

.notif-toggle input:checked + .toggle-switch::after {
    left: 22px;
    background: var(--green);
    box-shadow: 0 0 6px rgba(71, 255, 138, 0.4);
}

.profile-save-msg {
    color: var(--green);
    font-size: 13px;
    margin-top: 12px;
    min-height: 18px;
    font-family: var(--font-mono);
}

/* ========== New Turn Banner ========== */

.new-turn-banner {
    position: fixed;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 900;
    letter-spacing: 16px;
    color: var(--accent-bright);
    text-shadow:
        0 0 40px rgba(77, 159, 255, 0.8),
        0 0 80px rgba(77, 159, 255, 0.4),
        0 0 120px rgba(77, 159, 255, 0.2);
    z-index: 80;
    pointer-events: none;
    animation: newTurnFade 2.5s ease-out forwards;
    text-transform: uppercase;
}

@keyframes newTurnFade {
    0% { opacity: 0; transform: translateX(-50%) scale(0.8); }
    15% { opacity: 1; transform: translateX(-50%) scale(1.05); }
    30% { transform: translateX(-50%) scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(1); }
}

/* ========== Game Over Overlay ========== */

#game-over-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: gameOverFadeIn 0.6s ease-out;
}

@keyframes gameOverFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.game-over-content {
    text-align: center;
    max-width: 500px;
    padding: 48px 40px;
}

.game-over-icon {
    font-size: 72px;
    margin-bottom: 16px;
    animation: gameOverPulse 2s ease-in-out infinite;
}

@keyframes gameOverPulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.1); opacity: 1; }
}

.game-over-title {
    font-family: var(--font-display);
    font-size: 56px;
    font-weight: 900;
    letter-spacing: 12px;
    text-transform: uppercase;
    margin: 0 0 12px;
    line-height: 1.1;
}

.game-over-title.victory {
    color: #ffd700;
    text-shadow: 0 0 40px rgba(255, 215, 0, 0.6), 0 0 80px rgba(255, 215, 0, 0.3);
}

.game-over-title.defeat {
    color: #f66;
    text-shadow: 0 0 40px rgba(255, 100, 100, 0.5), 0 0 80px rgba(255, 100, 100, 0.2);
}

.game-over-subtitle {
    color: #aac;
    font-size: 18px;
    margin: 0 0 32px;
    letter-spacing: 2px;
}

.game-over-stats {
    color: #8ac;
    font-size: 14px;
    margin-bottom: 32px;
    line-height: 1.8;
}

.game-over-btn {
    font-size: 18px;
    padding: 12px 48px;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* ========== Desktop Scale-Up (non-mobile) ========== */

@media (min-width: 769px) {
    /* Dashboard content text */
    #dash-gamertag { font-size: 17px; }
    .user-tag { font-size: 15px; }
    .dash-tab { font-size: 13px; }
    .dash-tab-content h3 { font-size: 18px; }
    .dash-tab-content h4 { font-size: 16px; }

    /* Game cards */
    .game-card-info strong { font-size: 18px; }
    .game-card-meta { font-size: 15px; }
    .game-card-desc { font-size: 15px; }

    /* Badges */
    .elo-badge { font-size: 14px; }
    .ranked-badge, .casual-badge { font-size: 14px; }
    .badge { font-size: 13px; }

    /* Announcements */
    .announcement-header strong { font-size: 18px; }
    .announcement-meta { font-size: 14px; }
    .announcement-body { font-size: 17px; }

    /* Buttons */
    .btn-primary { font-size: 15px; padding: 14px 40px; }
    .btn-small { font-size: 14px; padding: 6px 16px; }

    /* Forms */
    .game-options label { font-size: 17px; }
    .game-options input[type="text"],
    .game-options input[type="number"] { font-size: 16px; }
    .auth-form input { font-size: 16px; }
    .radio-group label { font-size: 16px; }

    /* Friends */
    .friend-card .friend-name { font-size: 17px; }
    .friend-card .friend-tag { font-size: 14px; }
    .friend-card .friend-status { font-size: 13px; }
    .friend-invite-option { font-size: 16px; }

    /* Notifications */
    .notif-item .notif-title { font-size: 16px; }
    .notif-item .notif-message { font-size: 15px; }
    .notif-item .notif-time { font-size: 13px; }

    /* Lobby */
    .lobby-player .player-name { font-size: 17px; }
    .lobby-player .player-slot { font-size: 15px; }
    .invite-card-info strong { font-size: 16px; }

    /* Leaderboard */
    .lb-record { font-size: 16px; }
    .page-info { font-size: 15px; }

    /* Panel hints */
    .panel-hint { font-size: 16px; }
}

/* ========== Mobile Responsive ========== */

@media (max-width: 768px) {
    #auth-screen h1 {
        font-size: 44px;
        letter-spacing: 12px;
    }

    #auth-screen::after { width: 300px; height: 300px; }

    .subtitle { font-size: 12px; letter-spacing: 6px; }
    #auth-box { width: 95vw; padding: 20px; }

    #dash-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
        padding: 12px 16px;
    }

    #dash-header h1 { font-size: 20px; }
    #dash-user-info { flex-wrap: wrap; justify-content: center; }
    #dash-content { padding: 12px; }

    .dash-tabs { overflow-x: auto; }
    .dash-tab { font-size: 11px; padding: 10px 8px; white-space: nowrap; letter-spacing: 1px; }

    .game-options { flex-direction: column; gap: 10px; }
    .game-options label { width: 100%; justify-content: space-between; }
    .game-options input[type="text"] { width: 140px; }
    .radio-group { flex-wrap: wrap; gap: 10px; }

    .game-card { flex-direction: column; gap: 10px; align-items: flex-start; }
    .game-card-actions { width: 100%; justify-content: flex-end; }

    #notifications-panel { right: 8px; left: 8px; width: auto; }
    #lobby-header { padding: 12px 16px; }
    #lobby-content { padding: 16px; }

    #top-bar {
        gap: 4px 6px;
        padding: 5px 6px;
        flex-wrap: wrap;
    }
    #top-bar span { font-size: 10px; }
    #btn-back { padding: 3px 6px; font-size: 9px; }
    #btn-submit-turn { padding: 4px 10px; font-size: 9px; letter-spacing: 1px; }
    .top-bar-right { gap: 4px; }
    .btn-font { padding: 2px 5px !important; font-size: 9px !important; min-width: 22px; }
    .turn-timer { font-size: 10px !important; }
    .turn-subs { font-size: 9px; }

    #side-panel {
        position: fixed;
        top: 0; right: -100vw;
        width: 100vw;
        height: 100vh;
        z-index: 40;
        transition: right 0.3s ease;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.6);
    }

    #side-panel.panel-open { right: 0; }
    .btn-panel-toggle { display: block; }

    #event-log { height: 100px; min-height: 40px; }

    #game-chat-panel { right: 0; left: 0; width: auto; }

    .btn-primary { padding: 14px 28px; font-size: 13px; }
    .btn-small { padding: 8px 14px; font-size: 12px; }
    .fleet-item { padding: 12px; }
    .build-option { padding: 10px 12px; }
}

@media (max-width: 480px) {
    #auth-screen h1 { font-size: 34px; letter-spacing: 8px; }
    #auth-screen::after { width: 220px; height: 220px; }
    .subtitle { font-size: 10px; letter-spacing: 4px; }
    #dash-header h1 { font-size: 16px; letter-spacing: 4px; }
    #top-bar { gap: 3px 5px; padding: 4px 5px; }
    #top-bar span { font-size: 9px; }
    #btn-submit-turn { padding: 3px 8px; font-size: 8px; letter-spacing: 1px; }
    #btn-back { padding: 2px 5px; font-size: 8px; }
    .btn-font { padding: 1px 4px !important; font-size: 8px !important; min-width: 20px; }
}

/* ========== Reference Chart Popup ========== */
.ref-chart-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.15s ease-out;
}
.ref-chart-popup {
    background: #1a1a2e;
    border: 1px solid #4af;
    border-radius: 8px;
    padding: 20px 24px;
    max-width: 720px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 0 30px rgba(68, 170, 255, 0.2);
    width: 95%;
}
.ref-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    margin-bottom: 4px;
}
.ref-table th {
    color: #888;
    font-weight: 600;
    text-align: left;
    padding: 4px 8px;
    border-bottom: 1px solid #333;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.ref-table td {
    padding: 4px 8px;
    color: #ccc;
    border-bottom: 1px solid #1e1e3a;
}
.ref-table tbody tr:hover {
    background: rgba(68, 170, 255, 0.05);
}
@media (max-width: 600px) {
    .ref-chart-popup { padding: 12px 10px; font-size: 11px; }
    .ref-table { font-size: 10px; }
    .ref-table th, .ref-table td { padding: 3px 4px; }
}

/* --- Galactic War --- */

/* Widen the dashboard when GW tab is active */
#dash-content.gw-active {
    max-width: 1200px;
}

@keyframes gwTickerScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.gw-faction-card {
    background: #0d0d22;
    border: 2px solid #2a2a4a;
    border-radius: 12px;
    padding: 20px;
    width: 220px;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    text-align: center;
}
.gw-faction-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.gw-faction-card.gw-full {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}
.gw-faction-card .gw-faction-name {
    font-size: 18px;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 6px;
}
.gw-faction-card .gw-faction-desc {
    color: #999;
    font-size: 12px;
    line-height: 1.4;
}
.gw-faction-card .gw-faction-members {
    color: #666;
    font-size: 11px;
    margin-top: 8px;
}
