:root {
    --bg-dark: #090d16;
    --bg-dark-accent: #0f172a;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    
    /* Neon Theme Colors */
    --gold: #f59e0b;
    --gold-rgb: 245, 158, 11;
    --gold-glow: rgba(245, 158, 11, 0.25);
    
    --green: #10b981;
    --green-rgb: 16, 185, 129;
    --green-glow: rgba(16, 185, 129, 0.25);
    
    --cyan: #06b6d4;
    --cyan-rgb: 6, 182, 212;
    --cyan-glow: rgba(6, 182, 212, 0.25);
    
    --red: #f43f5e;
    --red-rgb: 244, 63, 94;
    --red-glow: rgba(244, 63, 94, 0.25);
    
    --magenta: #d946ef;
    --magenta-rgb: 217, 70, 239;
    --magenta-glow: rgba(217, 70, 239, 0.25);

    --border-glass: rgba(255, 255, 255, 0.08);
    --bg-glass: rgba(15, 23, 42, 0.65);
    --bg-glass-hover: rgba(15, 23, 42, 0.85);
}

/* Reset & Scrollbar */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

html, body {
    height: 100%;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100%;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-dark-accent);
    border-radius: 4px;
    border: 1px solid var(--border-glass);
}
::-webkit-scrollbar-thumb:hover {
    background: #1e293b;
}

/* Dynamic background effects */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.15;
    z-index: -2;
    pointer-events: none;
}

.glow-bg {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, rgba(0,0,0,0) 70%);
    top: -200px;
    right: -200px;
    z-index: -1;
    pointer-events: none;
}

/* Glassmorphism Panel Component */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-panel:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2.5rem;
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Custom Game Top Bar (Combined Header and Resources HUD) */
.game-top-bar {
    height: 3.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(9, 13, 22, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-compact {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.logo-compact strong {
    color: var(--cyan);
    text-shadow: 0 0 8px var(--cyan-glow);
}

.logo-icon-sm {
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--cyan), var(--magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 3px rgba(6, 182, 212, 0.5));
}

.user-greeting-sm {
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 0.25rem 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.top-bar-btn {
    text-decoration: none;
    color: var(--text-light);
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.top-bar-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-admin-sm {
    color: var(--red);
    border-color: rgba(244, 63, 94, 0.2);
}
.btn-admin-sm:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: var(--red);
}

.btn-logout-sm:hover {
    color: var(--red);
    background: rgba(244, 63, 94, 0.05);
}

.top-bar-resources {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.hud-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    font-weight: 700;
}

.hud-item .res-icon {
    font-size: 1rem;
}

.hud-item.gold-theme .res-icon { color: var(--gold); }
.hud-item.gold-theme #res-gold { color: #fff; text-shadow: 0 0 8px rgba(var(--gold-rgb), 0.3); }
.hud-item.gold-theme #rate-gold { color: var(--gold); font-size: 0.7rem; font-weight: 600; margin-left: 0.25rem; }

.hud-item.food-theme .res-icon { color: var(--green); }
.hud-item.food-theme #res-food { color: #fff; text-shadow: 0 0 8px rgba(var(--green-rgb), 0.3); }
.hud-item.food-theme #rate-food { color: var(--green); font-size: 0.7rem; font-weight: 600; margin-left: 0.25rem; }

.hud-item.pop-theme .res-icon { color: var(--cyan); }
.hud-item.pop-theme #res-pop { color: var(--cyan); text-shadow: 0 0 8px rgba(var(--cyan-rgb), 0.3); }

.hud-item.center-coords-theme {
    cursor: pointer;
    transition: all 0.2s;
}
.hud-item.center-coords-theme:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}
.hud-item.center-coords-theme .res-icon { color: var(--magenta); }
.hud-item.center-coords-theme #capital-pos { color: #fff; }

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo strong {
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan-glow);
}

.logo-icon {
    font-size: 1.75rem;
    background: linear-gradient(135deg, var(--cyan), var(--magenta));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 5px rgba(6, 182, 212, 0.5));
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-greeting {
    font-size: 0.95rem;
    color: var(--text-light);
    margin-right: 1rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Buttons */
.nav-btn {
    text-decoration: none;
    color: var(--text-light);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-admin {
    color: var(--red);
    border-color: rgba(244, 63, 94, 0.2);
}
.btn-admin:hover {
    background: rgba(244, 63, 94, 0.1);
    border-color: var(--red);
    box-shadow: 0 0 10px var(--red-glow);
}

.btn-logout:hover {
    color: var(--red);
    background: rgba(244, 63, 94, 0.05);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.95rem;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    box-shadow: 0 4px 15px rgba(2, 132, 199, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(2, 132, 199, 0.5);
    background: linear-gradient(135deg, #0369a1, #0284c7);
}

.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    box-shadow: 0 4px 15px rgba(5, 150, 105, 0.3);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(5, 150, 105, 0.5);
}

.btn-warning {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: white;
    box-shadow: 0 4px 15px rgba(217, 119, 6, 0.3);
}
.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.5);
}

.btn-danger {
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: white;
    box-shadow: 0 4px 15px rgba(225, 29, 72, 0.3);
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
    color: var(--text-light);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-outline-secondary {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-light);
}
.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Alert Notification System */
.alert-container {
    position: fixed;
    top: 5rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
}

.alert {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid var(--border-glass);
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    backdrop-filter: blur(10px);
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    border-left: 4px solid var(--green);
}
.alert-success .alert-icon {
    color: var(--green);
}

.alert-danger {
    border-left: 4px solid var(--red);
}
.alert-danger .alert-icon {
    color: var(--red);
}

.alert-icon {
    font-size: 1.25rem;
    margin-right: 0.75rem;
}

.alert-message {
    font-size: 0.9rem;
    margin-right: 1.5rem;
    line-height: 1.4;
}

.alert-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    margin-left: auto;
}
.alert-close:hover {
    color: var(--text-light);
}

/* Main Container */
.main-container {
    flex: 1;
    padding: 2rem 2.5rem;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.main-container:has(.game-layout) {
    padding: 0;
    max-width: none;
    margin: 0;
    width: 100%;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-container:has(.game-layout) + .main-footer {
    display: none;
}

/* Auth Pages (Login / Register) */
.auth-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 2.5rem;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    text-align: center;
    background: linear-gradient(135deg, #fff, var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group label i {
    margin-right: 0.25rem;
}

.form-control, .auth-form input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-light);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}

.form-control:focus, .auth-form input:focus {
    border-color: var(--cyan);
    background: rgba(255,255,255,0.06);
    box-shadow: 0 0 10px var(--cyan-glow);
}

.auth-footer {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.link-highlight {
    color: var(--cyan);
    text-decoration: none;
    font-weight: 600;
}
.link-highlight:hover {
    text-decoration: underline;
}

/* Game Dashboard Layout */
.game-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow: hidden;
}

/* Resources Bar */
.resources-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    padding: 1rem 1.5rem;
}

/* Floating Resources HUD inside canvas wrapper */
.resources-bar.floating-hud {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    background: rgba(9, 13, 22, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    width: auto;
}
.resources-bar.floating-hud .resource-item {
    padding: 0.25rem 0.6rem;
    gap: 0.4rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}
.resources-bar.floating-hud .res-icon {
    font-size: 1.1rem;
}
.resources-bar.floating-hud .res-val {
    font-size: 0.95rem;
    font-weight: 700;
}
.resources-bar.floating-hud .res-rate {
    font-size: 0.7rem;
}
.resources-bar.floating-hud .res-label {
    display: none;
}
.resources-bar.floating-hud .res-progress-container {
    display: none;
}

.resource-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.res-icon {
    font-size: 1.75rem;
    filter: drop-shadow(0 0 4px rgba(0,0,0,0.5));
}

.res-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.res-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

.res-val {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.res-rate {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Resource specific theme styles */
.gold-theme .res-icon { color: var(--gold); }
.gold-theme .res-val { color: #fff; text-shadow: 0 0 8px rgba(var(--gold-rgb), 0.3); }
.gold-theme .res-rate { color: var(--gold); }

.food-theme .res-icon { color: var(--green); }
.food-theme .res-val { color: #fff; text-shadow: 0 0 8px rgba(var(--green-rgb), 0.3); }
.food-theme .res-rate { color: var(--green); }

.pop-theme .res-icon { color: var(--cyan); }
.pop-theme .res-val { color: var(--cyan); text-shadow: 0 0 8px rgba(var(--cyan-rgb), 0.3); }
.res-progress-container {
    height: 4px;
    background: rgba(255,255,255,0.08);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}
.res-progress-bar {
    display: block;
    height: 100%;
    background: var(--cyan);
    border-radius: 2px;
    box-shadow: 0 0 5px var(--cyan-glow);
}

.center-coords-theme {
    cursor: pointer;
    transition: all 0.2s;
}
.center-coords-theme:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}
.center-coords-theme .res-icon { color: var(--magenta); }
.center-coords-theme .res-val { color: #fff; }

/* Floating canvas controls */
.floating-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 100;
    display: flex;
    gap: 0.5rem;
    pointer-events: auto;
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.floating-controls .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border-glass);
}
.floating-controls .btn-primary {
    background: rgba(2, 132, 199, 0.75);
}
.floating-controls .btn-primary:hover {
    background: rgba(3, 105, 161, 0.9);
}
.floating-controls .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Floating controls stay at top-right of canvas wrapper, no offset needed since sidebar is docked */

/* Game Main Area */
.game-main-area {
    position: relative;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: row;
    width: 100%;
    overflow: hidden;
}

.map-container {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-container:has(.game-layout) .map-container {
    border: none;
    border-radius: 0;
    box-shadow: none;
}

.map-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.map-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.map-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.map-instruction {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.canvas-wrapper {
    flex: 1;
    position: relative;
    background: radial-gradient(circle, #0e1626 0%, #060910 100%);
    cursor: grab;
}
.canvas-wrapper:active {
    cursor: grabbing;
}

#game-map {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
}

/* Sidebar Panel - Docked to the right of the map */
.actions-panel {
    position: relative;
    height: 100%;
    width: 380px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: rgba(9, 13, 22, 0.92); /* Glassmorphic sidebar */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-glass);
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s, border-color 0.3s;
    flex-shrink: 0;
}

.actions-panel.collapsed {
    width: 0 !important;
    opacity: 0;
    pointer-events: none;
    border-left-color: transparent;
}

.panel-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.15);
}

.panel-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Tab Switching System Styles */
.panel-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-glass);
    flex-shrink: 0;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.8rem 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border-bottom: 2px solid transparent;
}

.tab-btn:hover {
    color: var(--text-light);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--cyan);
    border-bottom: 2px solid var(--cyan);
    background: rgba(6, 182, 212, 0.05);
}

/* Tab Content Panels */
.tab-content {
    display: flex;
    flex-direction: column;
}

.tab-content.hidden {
    display: none !important;
}

.panel-body {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.9rem;
    line-height: 1.5;
}

.fog-hint {
    margin-top: 1rem;
    font-size: 0.8rem;
    font-style: italic;
}

.tile-info-card {
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.tile-coords-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.badge {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.1);
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-owner {
    background: rgba(6, 182, 212, 0.15);
    border-color: rgba(6, 182, 212, 0.3);
    color: var(--cyan);
}

.tile-attributes {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.attr-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding-bottom: 0.4rem;
}

.attr-lbl {
    color: var(--text-muted);
}

.attr-val {
    font-weight: 600;
}

.font-highlight {
    color: var(--cyan);
}

.alert-damaged {
    border: 1px solid rgba(244, 63, 94, 0.2);
    background: rgba(244, 63, 94, 0.05);
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    justify-content: center;
}

/* Action forms & inputs */
.tile-actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.action-section {
    border-top: 1px solid var(--border-glass);
    padding-top: 1.25rem;
}

.action-section h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.action-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.action-form {
    display: flex;
    gap: 0.5rem;
}

.action-form-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.input-with-max {
    display: flex;
    flex: 1;
    gap: 0.25rem;
}

.input-with-max input {
    flex: 1;
}

.build-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.build-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.05);
    transition: all 0.2s;
}
.build-item:hover {
    background: rgba(255,255,255,0.04);
}

.build-details {
    display: flex;
    flex-direction: column;
}

.build-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.build-costs {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.build-bonus {
    font-size: 0.75rem;
    color: var(--green);
}

.repair-details {
    padding: 0.75rem;
    background: rgba(217, 119, 6, 0.05);
    border: 1px solid rgba(217, 119, 6, 0.15);
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

/* Army target details style */
.army-target-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: rgba(244, 63, 94, 0.05);
    border: 1px solid rgba(244, 63, 94, 0.15);
    border-radius: 8px;
    font-size: 0.8rem;
    margin-bottom: 0.75rem;
}

.target-badge {
    color: var(--text-light);
}

.target-type {
    color: var(--red);
    font-weight: 700;
}

/* Modal Overlay Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.75);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
}

.modal-card {
    width: 90%;
    max-width: 500px;
    padding: 2.5rem;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.text-center { text-align: center; }
.text-left { text-align: left; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mt-3 { margin-top: 1rem; }

.combat-report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.85rem;
}

.combat-report-table th, .combat-report-table td {
    padding: 0.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.combat-report-table th {
    color: var(--text-muted);
    font-weight: 600;
}

/* Helper Class */
.hidden {
    display: none !important;
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-glass);
    background: rgba(9, 13, 22, 0.5);
    margin-top: auto;
}

.icon-gold { color: var(--gold); }
.icon-pulse {
    color: var(--red);
    animation: heartBeat 1.2s infinite;
}

@keyframes heartBeat {
    0% { transform: scale(1); }
    14% { transform: scale(1.1); }
    28% { transform: scale(1); }
    42% { transform: scale(1.1); }
    70% { transform: scale(1); }
}

/* Admin Dashboard Layout styling */
.admin-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
}

.stat-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-val {
    font-size: 1.75rem;
    font-weight: 900;
}

.border-red { border-left: 4px solid var(--red); }
.border-cyan { border-left: 4px solid var(--cyan); }
.border-green { border-left: 4px solid var(--green); }
.border-gold { border-left: 4px solid var(--gold); }
.border-magenta { border-left: 4px solid var(--magenta); }

.text-red { color: var(--red); }
.text-cyan { color: var(--cyan); }
.text-green { color: var(--green); }
.text-gold { color: var(--gold); }
.text-magenta { color: var(--magenta); }

.admin-main-row {
    display: flex;
    gap: 1.5rem;
}

.admin-card {
    flex: 1;
    padding: 1.75rem;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row.split .form-group {
    flex: 1;
}

.flex-1 { flex: 1; }

.flex-center-y {
    display: flex;
    align-items: center;
}

.checkbox-group {
    padding-top: 1.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th, .admin-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.admin-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 600;
}

.badge-admin {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--red);
}

.badge-player {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--green);
}

.font-bold { font-weight: 700; }

@media(max-width: 1024px) {
    .main-container:has(.game-layout) {
        flex: 1;
        min-height: 0;
    }
    .game-layout {
        flex: 1;
        min-height: 0;
    }
    .game-main-area {
        position: relative;
        flex: 1;
        min-height: 0;
        width: 100%;
        display: block; /* Disable horizontal flex layout on mobile */
    }
    .map-container {
        width: 100%;
        height: 100%;
    }
    .actions-panel {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        max-width: none;
        height: 50%;
        max-height: 450px;
        margin-top: 0;
        background: rgba(9, 13, 22, 0.96); /* High contrast glass background */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-left: none;
        border-top: 1px solid var(--border-glass);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    }
    .actions-panel.collapsed {
        transform: translateY(100%) !important;
        opacity: 0 !important;
        pointer-events: none !important;
        width: 100% !important;
    }
    #btn-close-sidebar {
        display: inline-flex !important;
    }
    #btn-toggle-sidebar {
        display: inline-flex !important;
    }
    .admin-main-row {
        flex-direction: column;
    }
    .resources-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media(max-width: 768px) {
    .game-top-bar {
        padding: 0 0.75rem;
    }
    .top-bar-left {
        gap: 0.5rem;
    }
    .logo-compact span {
        display: none;
    }
    .user-greeting-sm {
        display: none;
    }
    .top-bar-resources {
        gap: 0.4rem;
    }
    .hud-item {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
        gap: 0.3rem;
        border-radius: 12px;
    }
    .hud-item .res-icon {
        font-size: 0.85rem;
    }
    .floating-controls {
        top: 0.5rem;
        right: 0.5rem;
    }
    .floating-controls .btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    .resources-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0.75rem;
    }
    .resource-item {
        padding: 0.4rem 0.6rem;
        gap: 0.5rem;
    }
    .res-icon {
        font-size: 1.25rem;
    }
    .res-val {
        font-size: 1.05rem;
    }
    .res-label {
        font-size: 0.65rem;
    }
}

@media(max-width: 640px) {
    .main-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    .game-top-bar {
        height: auto;
        padding: 0.5rem;
        flex-direction: column;
        gap: 0.5rem;
    }
}
