/* ═══════════════════════════════════════════════════════════════════════════
   CONQUEST - Dark Fantasy Strategy Game
   Refined Medieval Aesthetic with Modern Polish
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   Typography - Cross-platform Premium Fonts
   Crimson Pro for display (elegant, highly readable)
   Inter for UI elements (excellent clarity on screens)
   ───────────────────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Inter:wght@400;500;600;700&display=swap');

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Variables / Design Tokens
   ───────────────────────────────────────────────────────────────────────────── */
:root {
    /* Color Palette - Refined Dark Fantasy */
    --bg-dark: #0b0b0f;
    --bg-darker: #050507;
    --bg-card: #111118;
    --bg-card-hover: #18181f;
    --bg-surface: #0d0d12;
    --bg-elevated: #151520;

    /* Gold Accent - Warmer, More Luxurious */
    --gold-primary: #d4a84b;
    --gold-light: #e8c97d;
    --gold-dark: #9a7832;
    --gold-muted: #7d6329;
    --gold-glow: rgba(212, 168, 75, 0.25);
    --gold-glow-strong: rgba(212, 168, 75, 0.4);

    /* Crimson Accent */
    --crimson: #8b1e3f;
    --crimson-light: #c23d5e;
    --crimson-dark: #5c1429;
    --crimson-glow: rgba(139, 30, 63, 0.35);

    /* Steel Blue Accent */
    --steel-blue: #4a6fa5;
    --steel-light: #6b8fc5;
    --steel-glow: rgba(74, 111, 165, 0.25);

    /* Faction Colors */
    --faction-north: #3d5a80;
    --faction-north-light: #5d8ab0;
    --faction-south: #8b4049;
    --faction-south-light: #c06070;

    /* Text Colors - Improved Contrast */
    --text-primary: #ede9e0;
    --text-secondary: #a09a90;
    --text-muted: #605850;
    --text-gold: #d4a84b;
    --text-dim: #454038;

    /* Borders & Effects */
    --border-subtle: rgba(212, 168, 75, 0.12);
    --border-medium: rgba(212, 168, 75, 0.25);
    --border-accent: rgba(212, 168, 75, 0.45);
    --shadow-dark: 0 4px 24px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 0 40px rgba(212, 168, 75, 0.15);
    --shadow-lift: 0 8px 32px rgba(0, 0, 0, 0.4);

    /* Typography - Cross-platform optimized */
    --font-display: 'Crimson Pro', 'Palatino Linotype', Palatino, Georgia, serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, monospace;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Transitions - Refined Easing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --transition-fast: 180ms var(--ease-out-expo);
    --transition-normal: 280ms var(--ease-out-expo);
    --transition-slow: 450ms var(--ease-out-expo);
    --transition-slower: 600ms var(--ease-out-quart);

    /* Border Radius */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 10px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    font-weight: 400;
    line-height: 1.65;
    color: var(--text-primary);
    background: var(--bg-dark);
    min-height: 100vh;
    overflow-x: hidden;
    letter-spacing: 0.01em;
}

/* Background texture - subtle vignette and noise */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 120% 100% at 50% 0%, transparent 50%, rgba(0, 0, 0, 0.4) 100%),
        radial-gradient(ellipse at 15% 15%, rgba(212, 168, 75, 0.025) 0%, transparent 45%),
        radial-gradient(ellipse at 85% 85%, rgba(139, 30, 63, 0.02) 0%, transparent 45%);
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
    z-index: -1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Typography
   ───────────────────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-primary);
    text-transform: uppercase;
    line-height: 1.25;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    background: linear-gradient(
        160deg,
        var(--gold-light) 0%,
        var(--gold-primary) 40%,
        var(--gold-dark) 100%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 2px 20px var(--gold-glow));
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    color: var(--gold-light);
}

h3 {
    font-size: 1.375rem;
    color: var(--text-primary);
}

p {
    margin-bottom: var(--space-md);
}

a {
    color: var(--gold-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--gold-light);
}

::selection {
    background: var(--gold-muted);
    color: var(--bg-dark);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Layout Components
   ───────────────────────────────────────────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.page {
    display: none;
    min-height: 100vh;
    padding-top: 64px;
    opacity: 0;
    transform: translateY(12px);
}

.page.active {
    display: block;
    animation: pageReveal 0.5s var(--ease-out-expo) forwards;
}

@keyframes pageReveal {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Header / Navigation (Mobile-first)
   ───────────────────────────────────────────────────────────────────────────── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: linear-gradient(
        180deg,
        rgba(5, 5, 7, 0.98) 0%,
        rgba(5, 5, 7, 0.92) 100%
    );
    border-bottom: 1px solid var(--border-subtle);
    z-index: 1000;
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-sm);
}

.logo {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--gold-primary);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
}

.logo::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-primary), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.logo:hover {
    color: var(--gold-light);
    text-shadow: 0 0 30px var(--gold-glow-strong);
}

.logo:hover::after {
    opacity: 1;
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.nav-link {
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: var(--space-xs) var(--space-sm);
    min-height: 44px;
    display: flex;
    align-items: center;
    position: relative;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--gold-primary);
    transition: all var(--transition-normal);
    transform: translateX(-50%);
}

.nav-link:hover,
.nav-link.active {
    color: var(--gold-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.user-menu {
    display: none;
    align-items: center;
    gap: 1rem;
    margin-left: 1rem;
    padding-left: 1.25rem;
    border-left: 1px solid var(--border-subtle);
}

.user-menu #user-name {
    color: var(--gold-primary);
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   Buttons - Refined with Better Feedback
   ───────────────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: var(--space-sm) var(--space-md);
    min-height: 44px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    isolation: isolate;
    -webkit-tap-highlight-color: transparent;
}

.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        110deg,
        transparent 0%,
        rgba(255, 255, 255, 0.08) 45%,
        rgba(255, 255, 255, 0.12) 50%,
        rgba(255, 255, 255, 0.08) 55%,
        transparent 100%
    );
    transform: translateX(-100%);
    transition: transform 0.6s var(--ease-out-expo);
    z-index: -1;
}

.btn:hover::before {
    transform: translateX(100%);
}

.btn-primary {
    background: linear-gradient(
        145deg,
        var(--gold-dark) 0%,
        var(--gold-primary) 45%,
        var(--gold-light) 100%
    );
    color: var(--bg-dark);
    box-shadow:
        0 2px 8px var(--gold-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 24px var(--gold-glow-strong),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px var(--gold-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--gold-primary);
    border: 1px solid var(--border-medium);
    box-shadow: inset 0 0 0 0 var(--gold-glow);
}

.btn-secondary:hover {
    background: rgba(212, 168, 75, 0.08);
    border-color: var(--gold-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.btn-danger {
    background: linear-gradient(
        145deg,
        var(--crimson-dark) 0%,
        var(--crimson) 50%,
        var(--crimson-light) 100%
    );
    color: var(--text-primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--crimson-glow);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Cards & Panels - Improved Depth
   ───────────────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    transition: all var(--transition-normal);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(
        135deg,
        rgba(212, 168, 75, 0.03) 0%,
        transparent 50%
    );
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-gold), var(--shadow-lift);
    transform: translateY(-2px);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--gold-light);
    letter-spacing: 0.05em;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Forms & Inputs - Enhanced Focus States
   ───────────────────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
}

.form-input {
    width: 100%;
    padding: 0.875rem var(--space-md);
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-darker);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow:
        0 0 0 3px var(--gold-glow),
        inset 0 0 0 1px var(--gold-muted);
    background: var(--bg-surface);
}

.form-input::placeholder {
    color: var(--text-dim);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Home Page - Hero Section (Mobile-first)
   ───────────────────────────────────────────────────────────────────────────── */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 64px);
    text-align: center;
    padding: var(--space-lg);
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 600px;
    height: 600px;
    transform: translate(-50%, -50%);
    background: radial-gradient(
        circle,
        rgba(212, 168, 75, 0.06) 0%,
        transparent 70%
    );
    pointer-events: none;
}

.hero-title {
    font-size: clamp(2rem, 10vw, 5rem);
    margin-bottom: var(--space-md);
    animation: heroTitleReveal 1s var(--ease-out-expo) forwards;
    opacity: 0;
}

@keyframes heroTitleReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
        filter: drop-shadow(0 0 0 transparent);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        filter: drop-shadow(0 4px 30px var(--gold-glow));
    }
}

.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(0.9375rem, 4vw, 1.375rem);
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    max-width: 600px;
    line-height: 1.6;
    padding: 0 var(--space-sm);
    animation: heroSubtitleReveal 0.8s var(--ease-out-expo) 0.2s forwards;
    opacity: 0;
}

@keyframes heroSubtitleReveal {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
    max-width: 280px;
    animation: heroActionsReveal 0.8s var(--ease-out-expo) 0.4s forwards;
    opacity: 0;
}

.hero-actions .btn {
    width: 100%;
}

@keyframes heroActionsReveal {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.features {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-lg);
    padding: var(--space-xl) 0;
}

.feature {
    text-align: center;
    padding: var(--space-lg);
    transition: transform var(--transition-normal);
}

.feature:hover {
    transform: translateY(-4px);
}

.feature-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
    border: 1px solid var(--border-medium);
    border-radius: 50%;
    color: var(--gold-primary);
    transition: all var(--transition-normal);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.feature:hover .feature-icon {
    border-color: var(--gold-primary);
    box-shadow: 0 0 30px var(--gold-glow);
    transform: scale(1.05);
}

.feature-title {
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
    letter-spacing: 0.05em;
}

.feature-desc {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Lobby Page
   ───────────────────────────────────────────────────────────────────────────── */
.lobby {
    padding: var(--space-2xl) 0;
}

.lobby-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.lobby-actions {
    display: flex;
    gap: var(--space-md);
}

.refresh-icon {
    display: inline-block;
    transition: transform 0.4s var(--ease-out-expo);
}

.btn:hover .refresh-icon {
    transform: rotate(180deg);
}

.lobby-stats {
    display: flex;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-family: var(--font-display);
    font-size: 2.25rem;
    font-weight: 600;
    color: var(--gold-primary);
    line-height: 1;
}

.stat-label {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: var(--space-xs);
}

.games-list {
    display: grid;
    gap: var(--space-md);
}

.game-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: var(--space-lg);
    padding: var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.game-item:hover {
    border-color: var(--border-medium);
    transform: translateX(6px);
    box-shadow: var(--shadow-gold), -4px 0 0 var(--gold-primary);
}

.game-name {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.game-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.game-info {
    display: flex;
    gap: var(--space-lg);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.game-settings {
    display: flex;
    gap: var(--space-md);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.game-setting {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.game-players {
    color: var(--gold-primary);
    font-weight: 600;
}

.no-games {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px dashed var(--border-subtle);
    border-radius: var(--radius-md);
    font-style: italic;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Modal - Refined Overlay
   ───────────────────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px) saturate(150%);
    -webkit-backdrop-filter: blur(8px) saturate(150%);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    opacity: 0;
}

.modal-overlay.active {
    display: flex;
    animation: modalOverlayReveal 0.3s var(--ease-out-expo) forwards;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    width: 100%;
    max-width: 500px;
    animation: modalSlide 0.4s var(--ease-out-expo);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 60px var(--gold-glow);
}

.modal.modal-large {
    max-width: 600px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
}

.settings-section {
    margin-top: var(--space-lg);
    padding-top: var(--space-lg);
    border-top: 1px solid var(--border-subtle);
}

.settings-title {
    font-family: var(--font-display);
    font-size: 0.8125rem;
    color: var(--gold-primary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: var(--space-md);
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--gold-light);
    letter-spacing: 0.05em;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--crimson);
    border-color: var(--crimson);
    color: white;
}

.modal-actions {
    display: flex;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    justify-content: flex-end;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Game Page - Full Canvas Mode
   ───────────────────────────────────────────────────────────────────────────── */
#page-game {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    padding-top: 56px;
    box-sizing: border-box;
    overflow: hidden;
}

.full-canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: var(--bg-dark);
}

#page-game .waiting-room {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
}

#page-game .units-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

/* Legacy game-container styles (Mobile-first) */
.game-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 56px);
    padding: var(--space-xs);
    overflow: hidden;
}

.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-md);
    flex-shrink: 0;
}

.turn-info {
    display: flex;
    align-items: center;
    gap: var(--space-xl);
}

.turn-number {
    font-family: var(--font-display);
    font-size: 1.25rem;
    color: var(--gold-light);
}

.turn-timer {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 100px;
    text-align: center;
}

.turn-timer.warning {
    color: var(--crimson-light);
    animation: timerPulse 1s ease infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.02); }
}

.resources-bar {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
    justify-content: center;
}

.resource {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 2px 4px;
    background: var(--bg-darker);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
    min-width: 0;
}

.resource:hover {
    border-color: var(--border-medium);
    background: var(--bg-card-hover);
}

.resource-emoji {
    font-size: 0.875rem;
    line-height: 1;
}

.resource-divider {
    display: none;
}

.resource-value {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 16px;
    text-align: center;
}

/* Resource change indicators */
.resource-change {
    font-size: 0.625rem;
    font-weight: 600;
    margin-left: 2px;
}

.resource-change.positive {
    color: #5a9a5a;
}

.resource-change.negative {
    color: #c05050;
}

.resource-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.resource-icon.wood { background: linear-gradient(135deg, #4a7c59 0%, #3a5c45 100%); }
.resource-icon.stone { background: linear-gradient(135deg, #7a7a7a 0%, #5a5a5a 100%); }
.resource-icon.iron { background: linear-gradient(135deg, #6a6a7e 0%, #4a4a5e 100%); }
.resource-icon.food { background: linear-gradient(135deg, #b68c5c 0%, #8a6a42 100%); }

.view-toggle {
    display: flex;
    gap: var(--space-xs);
    background: var(--bg-darker);
    padding: var(--space-xs);
    border-radius: var(--radius-sm);
}

.view-btn {
    padding: var(--space-sm) var(--space-lg);
    font-family: var(--font-display);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.view-btn.active {
    background: var(--gold-primary);
    color: var(--bg-dark);
}

.game-main {
    display: flex;
    gap: var(--space-md);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.game-board {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    min-height: 0;
}

.game-board canvas {
    display: block;
    margin: 0 auto;
}

.faction-label {
    text-align: center;
    padding: var(--space-sm);
    font-family: var(--font-display);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
}

.faction-label.top {
    border-bottom: 1px solid var(--border-subtle);
}

.faction-label.bottom {
    border-top: 1px solid var(--border-subtle);
}

.faction-label.north {
    color: var(--faction-north-light);
}

.faction-label.south {
    color: var(--faction-south-light);
}

/* Territory Popup */
.territory-popup {
    position: absolute;
    z-index: 100;
    width: 280px;
    background: var(--bg-card);
    border: 2px solid var(--border-accent);
    border-radius: var(--radius-lg);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 0 30px var(--gold-glow);
    cursor: move;
    user-select: none;
    transition: box-shadow var(--transition-fast);
}

.territory-popup:hover {
    box-shadow:
        0 16px 50px rgba(0, 0, 0, 0.7),
        0 0 40px var(--gold-glow-strong);
}

.territory-popup.hidden {
    display: none;
}

.popup-connector {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 99;
}

.popup-connector line {
    stroke: var(--gold-primary);
    stroke-width: 2;
    stroke-dasharray: 6 4;
    opacity: 0.8;
}

.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-card) 100%);
    border-bottom: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: move;
}

.popup-title {
    font-family: var(--font-display);
    font-size: 0.875rem;
    color: var(--gold-light);
    letter-spacing: 0.05em;
}

.popup-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.popup-close:hover {
    background: var(--crimson);
    border-color: var(--crimson);
    color: white;
}

.popup-content {
    padding: var(--space-md);
    max-height: 300px;
    overflow-y: auto;
}

.popup-section {
    margin-bottom: var(--space-md);
}

.popup-section:last-child {
    margin-bottom: 0;
}

.popup-label {
    font-family: var(--font-display);
    font-size: 0.625rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.popup-value {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.popup-value.north {
    color: var(--faction-north-light);
}

.popup-value.south {
    color: var(--faction-south-light);
}

.popup-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.popup-units-list,
.popup-structures-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.popup-unit-item,
.popup-structure-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-darker);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.popup-unit-icon,
.popup-structure-icon {
    font-size: 1.25rem;
    width: 28px;
    text-align: center;
}

.popup-unit-info,
.popup-structure-info {
    flex: 1;
}

.popup-unit-name,
.popup-structure-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.popup-unit-hp,
.popup-structure-hp {
    font-size: 0.625rem;
    color: var(--text-secondary);
}

.popup-hp-bar {
    width: 50px;
    height: 6px;
    background: var(--bg-dark);
    border-radius: 3px;
    overflow: hidden;
}

.popup-hp-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-fast);
}

.popup-hp-fill.high {
    background: linear-gradient(90deg, #3daa6a, #4ade80);
}

.popup-hp-fill.medium {
    background: linear-gradient(90deg, #d4a020, #fbbf24);
}

.popup-hp-fill.low {
    background: linear-gradient(90deg, #c44040, #f87171);
}

.popup-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
}

.popup-actions:empty {
    display: none;
}

.popup-action-btn {
    width: 100%;
    padding: var(--space-sm);
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.popup-action-btn.primary {
    background: var(--gold-primary);
    border: 1px solid var(--gold-light);
    color: var(--bg-dark);
}

.popup-action-btn.primary:hover {
    background: var(--gold-light);
}

.popup-action-btn.danger {
    background: var(--crimson);
    border: 1px solid var(--crimson-light);
    color: white;
}

.popup-action-btn.danger:hover {
    background: var(--crimson-light);
}

/* Territory Panel (bottom bar) */
.territory-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-lg);
}

.territory-panel.hidden {
    display: none;
}

.territory-panel-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

.territory-panel-title {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--gold-light);
    letter-spacing: 0.05em;
}

.panel-control-badge {
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-family: var(--font-display);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-control-badge.north {
    background: var(--faction-north);
    color: var(--faction-north-light);
    border: 1px solid var(--faction-north-light);
}

.panel-control-badge.south {
    background: var(--faction-south);
    color: var(--faction-south-light);
    border: 1px solid var(--faction-south-light);
}

.territory-panel-content {
    display: flex;
    gap: var(--space-lg);
    align-items: flex-start;
    overflow-x: auto;
}

.territory-panel-section {
    flex-shrink: 0;
}

.territory-panel-section .section-label {
    font-family: var(--font-display);
    font-size: 0.625rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}

.panel-items-list {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.panel-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.panel-unit-item,
.panel-structure-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-darker);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.panel-unit-icon,
.panel-structure-icon {
    font-size: 1.25rem;
}

.panel-unit-info,
.panel-structure-info {
    display: flex;
    flex-direction: column;
}

.panel-unit-name,
.panel-structure-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

.panel-hp {
    font-size: 0.625rem;
    color: var(--text-secondary);
}

.panel-hp-bar {
    width: 40px;
    height: 4px;
    background: var(--bg-dark);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.panel-hp-fill {
    height: 100%;
    border-radius: 2px;
}

.panel-hp-fill.high {
    background: linear-gradient(90deg, #3daa6a, #4ade80);
}

.panel-hp-fill.medium {
    background: linear-gradient(90deg, #d4a020, #fbbf24);
}

.panel-hp-fill.low {
    background: linear-gradient(90deg, #c44040, #f87171);
}

.actions-section {
    margin-left: auto;
    display: flex;
    align-items: center;
}

.panel-actions {
    display: flex;
    gap: var(--space-sm);
}

.panel-actions:empty {
    display: none;
}

.panel-action-btn {
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.panel-action-btn.primary {
    background: var(--gold-primary);
    border: 1px solid var(--gold-light);
    color: var(--bg-dark);
}

.panel-action-btn.primary:hover {
    background: var(--gold-light);
}

.panel-action-btn.danger {
    background: var(--crimson);
    border: 1px solid var(--crimson-light);
    color: white;
}

.panel-action-btn.danger:hover {
    background: var(--crimson-light);
}

.game-sidebar {
    width: 300px;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-md);
}

.panel-title {
    font-family: var(--font-display);
    font-size: 0.8125rem;
    letter-spacing: 0.12em;
    color: var(--gold-primary);
    text-transform: uppercase;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-subtle);
}

/* Cards Hand */
.cards-hand {
    padding: var(--space-sm) var(--space-lg);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    margin-top: var(--space-md);
}

.cards-hand-title {
    font-family: var(--font-display);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
}

.cards-container {
    display: flex;
    gap: var(--space-sm);
    overflow-x: auto;
    padding-bottom: var(--space-sm);
}

.game-card {
    flex-shrink: 0;
    width: 120px;
    height: 160px;
    background: linear-gradient(145deg, var(--bg-darker) 0%, var(--bg-card) 100%);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-sm);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-12px);
    border-color: var(--gold-primary);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5);
}

.game-card.selected {
    border-color: var(--gold-light);
    box-shadow: 0 0 25px var(--gold-glow);
}

.card-type {
    font-family: var(--font-display);
    font-size: 0.5625rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--gold-primary);
    margin-bottom: var(--space-xs);
}

.card-name {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    flex: 1;
}

.card-desc {
    font-size: 0.625rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.card-cost {
    display: flex;
    gap: var(--space-xs);
    margin-top: auto;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-subtle);
}

.cost-item {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 0.625rem;
}

.cost-icon {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Actions Queue
   ───────────────────────────────────────────────────────────────────────────── */
.action-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
    background: var(--bg-darker);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
}

.action-item:last-child {
    margin-bottom: 0;
}

.action-info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.action-icon {
    font-size: 1rem;
}

.action-cancel {
    background: none;
    border: none;
    color: var(--crimson-light);
    cursor: pointer;
    padding: var(--space-xs);
    font-size: 1rem;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.action-cancel:hover {
    opacity: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Units Panel
   ───────────────────────────────────────────────────────────────────────────── */
.units-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    border: 1px solid var(--border-accent);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    z-index: 2000;
    min-width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlide 0.4s var(--ease-out-expo);
    box-shadow:
        0 24px 80px rgba(0, 0, 0, 0.6),
        0 0 60px var(--gold-glow);
}

.units-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-subtle);
}

.panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.panel-close:hover {
    background: var(--crimson);
    border-color: var(--crimson);
    color: white;
}

.units-section {
    margin-bottom: var(--space-lg);
}

.section-title {
    font-family: var(--font-display);
    font-size: 0.6875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-bottom: var(--space-md);
}

.units-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-md);
}

.unit-card {
    padding: var(--space-md);
    background: var(--bg-darker);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
}

.unit-card:hover {
    border-color: var(--gold-primary);
    transform: translateY(-3px);
}

.unit-card.selected {
    border-color: var(--gold-light);
    box-shadow: 0 0 20px var(--gold-glow);
}

.unit-icon {
    font-size: 2rem;
    margin-bottom: var(--space-sm);
}

.unit-name {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.unit-stats {
    font-size: 0.625rem;
    color: var(--text-muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Waiting Room
   ───────────────────────────────────────────────────────────────────────────── */
.waiting-room {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

.waiting-title {
    font-size: 2rem;
    margin-bottom: var(--space-lg);
}

.waiting-players {
    display: flex;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.player-slot {
    padding: var(--space-md) var(--space-lg);
    background: var(--bg-darker);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.player-slot.filled {
    border-color: var(--gold-primary);
}

.player-slot.north {
    border-left: 3px solid var(--faction-north);
}

.player-slot.south {
    border-left: 3px solid var(--faction-south);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Connection Status
   ───────────────────────────────────────────────────────────────────────────── */
.connection-status {
    position: fixed;
    bottom: var(--space-md);
    right: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 0.6875rem;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.connected {
    background: #4ade80;
    box-shadow: 0 0 12px rgba(74, 222, 128, 0.5);
}

.status-dot.disconnected {
    background: #f87171;
    box-shadow: 0 0 12px rgba(248, 113, 113, 0.5);
    animation: disconnectedPulse 2s ease infinite;
}

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

/* ─────────────────────────────────────────────────────────────────────────────
   Utility Classes
   ───────────────────────────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-gold {
    color: var(--gold-primary);
}

.mb-md {
    margin-bottom: var(--space-md);
}

.mb-lg {
    margin-bottom: var(--space-lg);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Scrollbar Styling
   ───────────────────────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 5px;
    border: 2px solid var(--bg-darker);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-primary);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-medium) var(--bg-darker);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Game Event Log
   ───────────────────────────────────────────────────────────────────────────── */
.game-log {
    display: none; /* Hidden - log is now drawn on canvas */
}

.game-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(212, 168, 75, 0.08);
    border-bottom: 1px solid rgba(212, 168, 75, 0.25);
}

.log-title {
    font-family: var(--font-display);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gold-light);
    letter-spacing: 0.05em;
}

.log-clear-btn {
    background: rgba(139, 30, 63, 0.25);
    border: 1px solid rgba(139, 30, 63, 0.4);
    color: var(--text-primary);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.log-clear-btn:hover {
    background: rgba(139, 30, 63, 0.4);
    border-color: rgba(139, 30, 63, 0.7);
}

.game-log-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column-reverse;
}

.log-entry {
    padding: 0.4rem 0.75rem;
    margin-bottom: 0.3rem;
    border-left: 3px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.2);
    animation: logEntrySlide 0.3s var(--ease-out-expo);
}

@keyframes logEntrySlide {
    from {
        transform: translateY(10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.log-entry-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-right: 0.5rem;
    font-family: var(--font-mono);
}

.log-entry.type-game {
    border-left-color: var(--gold-primary);
    background: rgba(212, 168, 75, 0.05);
}

.log-entry.type-battle {
    border-left-color: var(--crimson);
    background: rgba(139, 30, 63, 0.05);
}

.log-entry.type-card {
    border-left-color: var(--steel-blue);
    background: rgba(74, 111, 165, 0.05);
}

.log-entry.type-territory {
    border-left-color: #6b8b3d;
    background: rgba(107, 139, 61, 0.05);
}

.log-entry.type-event {
    border-left-color: #8b5a3f;
    background: rgba(139, 90, 63, 0.05);
}

.log-entry.type-player {
    border-left-color: var(--text-muted);
    background: rgba(90, 85, 80, 0.05);
}

.log-faction-north {
    color: var(--faction-north-light);
    font-weight: 600;
}

.log-faction-south {
    color: var(--faction-south-light);
    font-weight: 600;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive - Tablet and up (min-width: 600px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 600px) {
    .header {
        height: 64px;
    }

    .header-inner {
        padding: 0 var(--space-md);
    }

    .logo {
        font-size: 1.375rem;
        letter-spacing: 0.18em;
    }

    .nav {
        gap: var(--space-md);
    }

    .nav-link {
        font-size: 0.75rem;
        padding: var(--space-sm);
    }

    .page {
        padding-top: 72px;
    }

    #page-game {
        padding-top: 64px;
    }

    .game-container {
        height: calc(100vh - 64px);
        padding: var(--space-sm);
    }

    .hero {
        padding: var(--space-xl);
    }

    .hero-actions {
        flex-direction: row;
        gap: var(--space-md);
        max-width: none;
        width: auto;
    }

    .hero-actions .btn {
        width: auto;
        padding: var(--space-md) var(--space-xl);
    }

    .btn {
        font-size: 0.875rem;
        padding: var(--space-md) var(--space-lg);
    }

    .features {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xl);
    }

    .modal {
        max-width: 500px;
    }

    .modal-large {
        max-width: 600px;
    }

    /* Resources bar - tablet and up */
    .resources-bar {
        gap: var(--space-sm);
    }

    .resource {
        gap: 4px;
        padding: 4px 8px;
    }

    .resource-emoji {
        font-size: 1rem;
    }

    .resource-value {
        font-size: 0.875rem;
        min-width: 20px;
    }

    .resource-divider {
        display: block;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive - Desktop (min-width: 900px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 900px) {
    .header {
        height: 70px;
    }

    .header-inner {
        padding: 0 var(--space-lg);
    }

    .logo {
        font-size: 1.625rem;
        letter-spacing: 0.2em;
    }

    .nav {
        gap: var(--space-xl);
    }

    .nav-link {
        font-size: 0.8125rem;
        letter-spacing: 0.06em;
    }

    .page {
        padding-top: 80px;
    }

    #page-game {
        padding-top: 70px;
    }

    .game-container {
        height: calc(100vh - 70px);
        padding: var(--space-md);
    }

    .hero {
        min-height: calc(100vh - 80px);
        padding: var(--space-2xl);
    }

    .hero-subtitle {
        padding: 0;
    }

    .btn {
        padding: var(--space-md) var(--space-xl);
    }

    .features {
        grid-template-columns: repeat(3, 1fr);
    }

    .game-sidebar {
        width: 300px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Responsive - Large Desktop (min-width: 1200px)
   ───────────────────────────────────────────────────────────────────────────── */
@media (min-width: 1200px) {
    .container {
        padding: 0 var(--space-xl);
    }

    .feature {
        padding: var(--space-xl);
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Touch Device Optimizations
   ───────────────────────────────────────────────────────────────────────────── */
@media (hover: none) and (pointer: coarse) {
    .game-card:hover {
        transform: none;
    }

    .resource:hover {
        border-color: var(--border-subtle);
        background: var(--bg-darker);
    }

    .btn {
        min-height: 44px;
        min-width: 44px;
    }

    .nav-link {
        min-height: 44px;
        display: flex;
        align-items: center;
    }

    .game-board,
    .game-card,
    .resource {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }

    /* Disable hover states that could cause issues */
    .card:hover {
        transform: none;
    }

    .feature:hover {
        transform: none;
    }

    .feature:hover .feature-icon {
        transform: none;
    }
}

/* ──────────────────────────────────────────────────────────���──────────────────
   Reduced Motion Support
   ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─────────────────────────────────────────────────────────────────────────────
   High Contrast Mode Support
   ───────────────────────────────────────────────────────────────────────────── */
@media (prefers-contrast: high) {
    :root {
        --border-subtle: rgba(212, 168, 75, 0.3);
        --border-medium: rgba(212, 168, 75, 0.5);
        --text-secondary: #c0bab0;
        --text-muted: #807a70;
    }
}
