:root {
    /* Secondary Surface Colors */
    --bg-surface: #1f2937;
    --border-light: #4b5563;
    --border-dark: #333333;
    --bg-black: #000000;
    --white: #ffffff;

    /* Dark Theme Accents */
    --info-dark: #1e40af;
    --danger-dark: #991b1b;
    --amber-600: #d97706;
    --amber-700: #b45309;
    --amber-800: #92400e;
    --amber-900: #78350f;
    --accent-color: #a855f7;

    /* RPG Theme Colors */
    --rpg-bg: #2c2925;
    --rpg-parchment: #e8d5a8;
    --rpg-parchment-dark: #d1ccbf;
    --rpg-border-dark: #8b5a2b;
    --rpg-border-light: #c0b08a;
    --rpg-text: #4a3525;

    /* Extended Colors */
    --bg-color-alt: #0f172a;
    --danger-hover: #dc2626;
    --success-light: #34d399;
    --info-light: #60a5fa;
    --danger-light: #f87171;
    --warning-light: #fbbf24;
    --accent-light: #a5b4fc;
    --accent-lighter: #e0e7ff;

    /* Modern Dark Theme Palette */
    --bg-color: #020617;
    --card-bg: #1e293b;
    --card-hover: #334155;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    /* Vibrant Accents */
    --accent-primary: #6366f1;
    /* Indigo */
    --accent-secondary: #8b5cf6;
    /* Violet */
    --accent-gradient: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    --accent-hover: #4f46e5;

    /* Status Colors */
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #3b82f6;

    /* Borders & Effects */
    --border-color: #334155;
    --border-hover: #475569;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --glow: 0 0 20px rgba(99, 102, 241, 0.15);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    background-image:
        radial-gradient(circle at 15% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.08) 0%, transparent 25%);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* --- Typography --- */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.025em;
}

h1 {
    font-size: 2.5rem;
    background: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* --- Header --- */
header {
    margin-bottom: 3rem;
    text-align: center;
    padding: 2rem 0;
    position: relative;
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.app-logo {
    height: 60px;
    width: auto;
}

header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

/* --- Buttons --- */
button {
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

.primary-btn {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 0 var(--accent-hover), 0 5px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.1s;
    transform: translateY(0);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.primary-btn:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--accent-hover), inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.primary-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 5px 0 var(--accent-hover), 0 6px 12px rgba(0, 0, 0, 0.3);
}

/* Fix Input Visibility in Search Containers */
/* Fix Input Visibility in Search Containers */
.growth-search-container input {
    background: var(--card-bg) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-hover) !important;
    font-size: 1.1rem;
    padding: 0 1rem 0 40px !important;
    /* Proper padding for text and icon */
    width: 100%;
    height: 100%;
    /* Fill the wrapper */
    border-radius: 0.5rem;
    outline: none;
    transition: all 0.2s;
    z-index: 1;
}

.growth-search-container input:focus {
    border-color: var(--accent-primary) !important;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Widen the search input wrapper and fix layout */
.growth-search-container .search-input-wrapper {
    flex: 2 !important;
    /* Grow to fill available space */
    min-width: 250px;
    /* Prevent collapse */
    height: 44px;
    /* Fixed height */
    position: relative;
    display: flex;
    align-items: center;
}

/* Position the icon */
.growth-search-container .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    /* CRITICAL: Click through icon to input */
    font-size: 1.2rem;
    color: var(--text-secondary);
    z-index: 2;
    /* Explicitly above input */
}

/* Widen the Stack Ranking Button */
.growth-search-container .primary-btn {
    min-width: 180px;
    padding: 0.75rem 2rem;
}

.growth-search-container input::placeholder {
    color: var(--text-secondary);
}

.secondary-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.secondary-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.05);
}

/* --- Cards --- */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    border-color: var(--border-hover);
}

/* --- Tabs --- */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    margin-left: auto;
    margin-right: auto;
    justify-content: center;
    padding: 0.5rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 0.75rem;
    border: 1px solid var(--border-color);
    width: fit-content;
    flex-wrap: wrap;
}

.tab-btn {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
}

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

.tab-btn.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Subtabs */
.prekvk-subtabs,
.kingdom-subtabs,
.heatmap-subtabs,
#uploadSubTabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    padding: 0.25rem 0.5rem;
    background: rgba(15, 20, 30, 0.5);
    border-radius: 1.5rem;
    border: 1px solid var(--border-color);
    width: fit-content;
    flex-wrap: wrap;
    backdrop-filter: blur(8px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.subtab-btn,
.calc-tab-btn,
.upload-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1.25rem;
    border-radius: 1.25rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.subtab-btn:hover,
.calc-tab-btn:hover,
.upload-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.subtab-btn.active,
.calc-tab-btn.active,
.upload-tab-btn.active {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-primary);
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.2);
    font-weight: 600;
}

/* Tab Content Visibility */
.tab-content,
.subtab-content,
.calc-tab-content,
.upload-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active,
.subtab-content.active,
.calc-tab-content.active,
.upload-tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- File Upload (Drop Zone) --- */
.upload-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.upload-zone {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 3rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(30, 41, 59, 0.3);
    cursor: pointer;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
    transform: scale(1.01);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.upload-zone:hover .drop-zone-icon {
    opacity: 1;
    color: var(--accent-primary);
}

.drop-zone-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.drop-zone-subtext {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.file-input-hidden {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.scan-details {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 0.5rem;
    color: var(--success-color);
    font-size: 0.9rem;
    display: none;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Inputs & Controls --- */
.controls {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.input-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

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

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

.mb-4 {
    margin-bottom: 1rem;
}

/* --- Scatter Chart Specifics --- */
.chart-container {
    position: relative;
    height: 600px;
    width: 100%;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    border: 1px solid var(--border-color);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.hero {
    background-color: var(--info-color);
    box-shadow: 0 0 8px rgba(59, 130, 246, 0.5);
}

.dot.warrior {
    background-color: var(--success-color);
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.dot.feeder {
    background-color: var(--danger-color);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.dot.slacker {
    background-color: var(--text-secondary);
}

.dot.yellow {
    background-color: var(--warning-light);
    box-shadow: 0 0 8px rgba(250, 204, 21, 0.5);
}

/* Input Styles */
.input-group input,
.prekvk-select,
.config-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.input-group input:focus,
.prekvk-select:focus,
.config-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Fix for dropdown options visibility */
.input-group select option,
.prekvk-select option,
select option {
    background-color: var(--card-bg);
    color: var(--text-primary);
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.results-header h2 {
    margin: 0;
}

/* Tables */
.table-container {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow-x: auto;
    background: var(--card-bg);
    max-height: 75vh;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-primary) var(--bg-color);
}

/* Custom Scrollbar */
.table-container::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

th {
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(8px);
    background: rgba(15, 23, 42, 0.95);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

/* Zebra Striping */
tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

/* Bonus Input Styling */
.bonus-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-primary);
    padding: 0.25rem 0.5rem;
    width: 80px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.bonus-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.4);
}

.chart-wrapper {
    position: relative;
    height: 400px;
    width: 100%;
    background: rgba(15, 23, 42, 0.3);
    border-radius: 1rem;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

/* --- Tooltips --- */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 125%;
    left: 50%;
    transform: translateX(-50%);
    bottom: auto;
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    white-space: pre-wrap;
    max-width: 300px;
    width: max-content;
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-color);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
    pointer-events: none;
    line-height: 1.4;
    text-align: left;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: 110%;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip Arrow */
[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--border-color);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
    bottom: 100%;
}

/* --- PreKVK Ranking --- */
.prekvk-select {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
}

.prekvk-select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

/* Upload Grid */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 20px;
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.02);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* Make Healing Check (last child) Full Width */
.upload-zone:last-child {
    grid-column: 1 / -1;
    border-color: var(--info-color);
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .upload-grid {
        grid-template-columns: 1fr;
    }
}

/* Status Badges */
.status-badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}

.status-fighter {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success-light);
    /* Green */
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-farmer {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info-light);
    /* Blue */
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-sleeper {
    background: rgba(148, 163, 184, 0.2);
    color: var(--text-secondary);
    /* Gray */
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.status-dropped {
    background: rgba(239, 68, 68, 0.2);
    color: var(--danger-light);
    /* Red */
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* --- Mobile & Tablet Optimization --- */
@media (max-width: 1024px) {
    .container {
        padding: 1rem;
    }

    .header-content h1 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {

    /* Header Stacking */
    .header-content {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .logo-container {
        margin-bottom: 1rem;
    }

    .header-controls {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
        margin-top: 1rem;
    }

    /* Tabs - Horizontal Scroll strip */
    .tabs {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        width: 100%;
        padding-bottom: 0.5rem;
        -webkit-overflow-scrolling: touch;
        /* Smooth scroll on iOS */
        scrollbar-width: thin;
        /* Firefox */
    }

    .tabs::-webkit-scrollbar {
        height: 4px;
    }

    .tab-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* Subtabs */
    .prekvk-subtabs,
    .kingdom-subtabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 5px;
        margin-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
    }

    .subtab-btn {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* Grids to Single Column */
    .upload-grid,
    .controls {
        grid-template-columns: 1fr;
    }

    /* Upload Zones */
    .upload-zone {
        padding: 2rem 1rem;
        min-height: auto;
    }

    .drop-zone-icon {
        font-size: 2rem;
    }

    /* Table Adjustments */
    th,
    td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .table-container {
        border: none;
        box-shadow: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 2rem;
    }

    /* Force horizontal scroll on tables */
    .dkp-table {
        min-width: 800px;
        /* Ensure it doesn't squash */
    }

    /* Ranking Controls Stacking */
    .ranking-header-controls {
        flex-direction: column !important;
        align-items: flex-start !important;
        width: 100%;
        margin-top: 1rem;
    }

    /* New Phone Who Dis - Stack Columns */
    .npwd-container {
        grid-template-columns: 1fr !important;
    }

    /* Input Groups */
    .input-group {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
    }

    .input-group label {
        margin-bottom: 0.5rem;
    }

    .prekvk-select,
    .profile-select,
    .profile-input {
        width: 100% !important;
        min-height: 44px;
        /* Touch target */
    }

    /* Header Controls - Town Hall and Reset */
    .header-controls {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }

    .filter-control {
        margin-right: 0;
        margin-bottom: 0;
        text-align: center;
        padding: 10px;
        background: var(--card-bg);
        border-radius: 8px;
    }

    .checkbox-label {
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.1rem;
    }

    #resetDataBtn {
        width: 100%;
        padding: 1rem;
    }

    /* Results Header Stacking */
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .results-header .input-group {
        margin-left: 0 !important;
        width: 100%;
    }
}

/* Default Desktop Styles for new class */
.ranking-header-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

/* --- FORCE FINAL FIXES --- */

/* 1. Bottom Controls: Centered on Desktop, Stacked on Mobile */
.bottom-controls {
    display: flex;
    justify-content: center;
    /* Center horizontally */
    align-items: center;
    gap: 2rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    width: 100%;
}

@media (max-width: 768px) {
    .bottom-controls {
        flex-direction: column;
        gap: 1.5rem;
    }

    #resetDataBtn,
    .filter-control {
        width: 100%;
        max-width: 300px;
    }
}

/* 2. Tooltips: High Contrast & Positioned Below */
[data-tooltip]::after {
    top: 110% !important;
    /* Force below */
    bottom: auto !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background-color: var(--bg-color-alt) !important;
    /* Dark Slate Blue */
    color: var(--text-primary) !important;
    /* Bright White */
    opacity: 1 !important;
    visibility: hidden;
    /* Start hidden */
    z-index: 10000 !important;
    /* Top of stack */
    border: 1px solid var(--accent-primary);
    /* Indigo Border */
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    width: max-content;
    max-width: 280px;
    white-space: pre-wrap;
    text-align: center;
}

[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
}

/* Hide tooltips on mobile */
@media (max-width: 768px) {
    [data-tooltip]::after {
        display: none !important;
    }
}

/* --- Command Center Styles --- */
.mode-selector {
    display: flex;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 0.5rem;
}

.mode-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 600;
    border-radius: 0.25rem;
    transition: all 0.2s;
}

.mode-btn.active {
    background: var(--accent-primary);
    color: white;
}

/* Report Card Styles */
.report-card-wrapper {
    display: flex;
    justify-content: center;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1rem;
    min-height: 400px;
    align-items: center;
}

.report-card {
    background: linear-gradient(145deg, var(--card-bg), var(--bg-color-alt));
    border: 2px solid var(--accent-primary);
    border-radius: 1rem;
    padding: 2rem;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

.report-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: var(--accent-gradient);
}

.card-header {
    text-align: center;
    margin-bottom: 2rem;
}

.card-grade {
    font-size: 5rem;
    font-weight: 800;
    text-shadow: 0 0 20px currentColor;
    line-height: 1;
    margin: 1rem 0;
}

.grade-S {
    color: var(--warning-light);
}

/* Gold */
.grade-A {
    color: var(--accent-light);
}

/* Indigo */
.grade-B {
    color: var(--success-light);
}

/* Emerald */
.grade-C {
    color: var(--warning-light);
}

/* Amber */
.grade-F {
    color: var(--danger-color);
}

/* Red */

.card-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.stat-box {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 0.5rem;
    text-align: center;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Squad Builder Styles */
.squads-container {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
    margin-top: 2rem;
}

.squad-column {
    flex: 1;
    min-width: 250px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
}

.squad-header {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.squad-list {
    list-style: none;
    padding: 0;
    margin: 0;
    font-size: 0.9rem;
}

.squad-member {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.squad-summary {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* SOC Tab Layout */
.soc-layout {
    display: flex;
    gap: 1.5rem;
    min-height: 500px;
}

.soc-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 200px;
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    padding-right: 1rem;
}

.soc-nav-btn {
    background: transparent;
    border: none;
    text-align: left;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    font-size: 0.9rem;
}

.soc-nav-btn:hover {
    background: var(--card-hover);
    color: var(--text-primary);
}

.soc-nav-btn.active {
    background: var(--accent-primary);
    color: white;
}

.soc-content-area {
    flex: 1;
    overflow-x: auto;
}

/* Upload Grid for Zone Tracker */
.upload-grid {
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow-x: auto;
    padding-bottom: 1rem;
}

.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    min-width: 140px;
    position: relative;
    cursor: pointer;
    background: var(--card-bg);
    transition: all 0.2s;
}

.upload-zone:hover {
    border-color: var(--accent-primary);
    background: var(--card-hover);
}

.upload-zone.loaded {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.1);
}

.zone-label {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.upload-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.upload-text {
    font-size: 0.8rem;
}

.upload-status {
    font-size: 0.7rem;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

.upload-zone.loaded .upload-status {
    color: var(--success-color);
    font-weight: bold;
}

.arrow-separator {
    color: var(--text-muted);
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* Zone Results Table */
.zone-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.zone-table th,
.zone-table td {
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    text-align: left;
}

.zone-table th {
    background: var(--card-bg);
    font-weight: 600;
    color: var(--text-secondary);
}

.zone-gain {
    color: var(--success-color);
}

.zone-loss {
    color: var(--danger-color);
}

/* War Council Styles */
.wc-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    height: calc(100vh - 220px);
    overflow: hidden;
}

/* Sidebar */
.wc-sidebar {
    background: rgba(30, 30, 35, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 0;
    /* Fixes grid item overflow */
    overflow: hidden;
    /* Ensures flex children scroll properly */
}

.wc-sidebar-header {
    margin-bottom: 1rem;
}

.wc-search,
.wc-alliance-filter {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
}

.wc-pool {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Workspace */
.wc-workspace-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.wc-toolbar {
    margin-bottom: 1rem;
    display: flex;
    gap: 0.5rem;
}

.wc-workspace {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
    overflow-y: auto;
    padding-right: 0.5rem;
    align-content: start;
}

/* Player Card */
.wc-player {
    background: rgba(255, 255, 255, 0.05);
    /* Glass effect */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    cursor: grab;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    position: relative;
}

.wc-player:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-color: rgba(var(--accent-primary-rgb), 0.5);
}

.wc-player:active {
    cursor: grabbing;
}

.wc-player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wc-player-name {
    font-weight: 600;
    color: var(--text-highlight);
    font-size: 0.95rem;
}

.wc-player-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Squad Card */
.wc-squad {
    background: rgba(40, 44, 52, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: fit-content;
    max-height: calc(100vh - 240px);
    /* Limit height */
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.wc-squad-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.wc-squad-title {
    font-weight: bold;
    color: var(--accent-secondary);
    font-size: 1.1rem;
    outline: none;
    border-bottom: 1px dashed transparent;
}

.wc-squad-title:focus {
    border-bottom-color: var(--accent-primary);
}

.wc-squad-stats-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.4rem;
    border-radius: 6px;
}

.wc-squad-list {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.25rem;
    display: flex;
    /* Enables Flexbox */
    flex-direction: column;
    /* Stacks items vertically */
    gap: 0.5rem;
    /* Adds gap between items */
}

/* Icon Buttons */
.wc-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 2px 6px;
}

.wc-icon-btn:hover {
    opacity: 1;
    color: var(--text-primary);
}

.wc-icon-btn.delete-btn:hover {
    color: var(--danger-color);
}

/* Mail Integration */
.wc-mail-btn {
    font-size: 1.2rem;
    margin-right: 0.5rem;
}

/* Modal Styles */
.modal {
    display: flex;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.close-modal:hover {
    color: var(--text-primary);
}

.file-browser {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.2s;
}

.file-item:hover {
    background: var(--card-hover);
}

.file-item.folder {
    font-weight: bold;
    color: var(--accent-primary);
}

/* FIX: Force SOC Section Visibility Logic */
.soc-section {
    display: block;
    width: 100%;
}

.soc-section.hidden {
    display: none !important;
}

.soc-content-area {
    width: 100%;
    flex: 1;
    overflow-y: auto;
}

/* CRITICAL FIX: Main Tab Visibility */
.tab-content {
    display: none;
    width: 100%;
    height: 100%;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* SOC Layout */
.soc-layout {
    display: flex;
    gap: 2rem;
    height: calc(100vh - 250px);
    /* Fill remaining height */
    min-height: 500px;
}

.soc-sidebar {
    width: 250px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
    overflow-y: auto;
}

.soc-nav-btn {
    text-align: left;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.soc-nav-btn:hover {
    background: var(--card-hover);
    color: var(--text-primary);
}

.soc-nav-btn.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent-primary);
    font-weight: 600;
}

/* SOC Upload Grid */
.upload-grid {
    display: flex;
    justify-content: center;
    align-items: stretch;
    /* Cards same height */
    gap: 1.5rem;
    flex-wrap: wrap;
    /* Allow wrap for smaller screens */
    width: 100%;
}

.upload-grid .upload-zone {
    flex: 1 1 280px;
    /* Wide cards */
    max-width: 350px;
    min-height: 250px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
    position: relative;
    gap: 10px;
}

.upload-grid .upload-zone:hover,
.upload-grid .upload-zone.drag-over {
    border-color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
}

.upload-grid .upload-zone .zone-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 0.5rem;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}

.upload-grid .upload-zone .upload-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.7;
}

.upload-grid .upload-zone .upload-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.upload-grid .upload-zone .cloud-link {
    font-size: 0.7rem;
    margin-top: 0.5rem;
    cursor: pointer;
    color: var(--accent-primary);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
}

.upload-grid .upload-zone .cloud-link:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--accent-primary);
}

.upload-grid .upload-zone .upload-status {
    font-size: 0.7rem;
    margin-top: auto;
    /* Push to bottom */
    color: var(--text-muted);
}

.upload-grid .upload-zone.loaded {
    border-color: var(--success-color);
    background: rgba(16, 185, 129, 0.05);
}

.upload-grid .upload-zone.loaded .upload-status {
    color: var(--success-color);
    font-weight: bold;
}

.arrow-separator {
    color: var(--text-muted);
    font-size: 1.2rem;
    opacity: 0.5;
    user-select: none;
}

/* Fix for Scan Details Overflow */
/* Fix for Scan Details Overflow */
.scan-kingdoms {
    /* auto height to avoid scrolling */
    font-size: 0.85em;
    margin-top: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 6px;
    border-radius: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    width: 100%;
}

.kingdom-chip {
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--accent-lighter);
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 500;
}

.scan-date {
    font-size: 0.8em;
    margin-bottom: 6px;
    opacity: 0.8;
    text-align: center;
    width: 100%;
    display: block;
}

/* Enhanced Upload Zone Sizing */
.upload-grid .upload-zone {
    flex: 0 0 160px;
    /* Wider */
    min-height: 220px;
    /* Taller */
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Align top so content grows down */
    align-items: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
    position: relative;
    gap: 5px;
}

/* Scrollbar Styling for Scan Details */
.scan-kingdoms::-webkit-scrollbar {
    width: 6px;
}

.scan-kingdoms::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.scan-kingdoms::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.scan-kingdoms::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.danger-btn {
    background: var(--danger-color) !important;
    border-color: var(--danger-hover) !important;
    color: white !important;
}

/* Global Scrollbar Theme (Overrides Browser Default) */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
    border: 2px solid var(--bg-surface);
    /* Creates padding effect */
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.danger-btn:hover {
    background: var(--danger-hover) !important;
}

/* --- SOC Timeline (Premium Web View) --- */
.timeline-card {
    padding: 2rem;
    background: radial-gradient(circle at top right, var(--card-bg), var(--bg-color-alt));
    border: 1px solid var(--border-color);
}

.timeline-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    position: relative;
    padding-left: 40px;
    /* More space for time labels */
}

/* Central Connector Line */
.timeline-container::before {
    content: '';
    position: absolute;
    left: 120px;
    /* Aligned with the dots */
    top: 15px;
    bottom: 15px;
    width: 3px;
    background: linear-gradient(to bottom, var(--accent-primary), var(--accent-secondary), var(--warning-color));
    z-index: 0;
    opacity: 0.3;
}

.timeline-item {
    display: flex;
    gap: 30px;
    padding-bottom: 25px;
    position: relative;
    z-index: 1;
}

/* Timeline Dot */
.timeline-item::before {
    content: '';
    position: absolute;
    left: 115px;
    /* (120px line - 6px radius + 1px center adjust) */
    top: 20px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-color);
    border: 3px solid var(--text-muted);
    box-shadow: 0 0 0 4px var(--bg-color);
    /* fake spacing from line */
    z-index: 2;
    transition: all 0.3s ease;
}

.timeline-item:hover::before {
    transform: scale(1.2);
    border-color: var(--accent-primary);
}

/* Phase Types */
.timeline-item.pre-kvk::before {
    border-color: var(--text-muted);
}

.timeline-item.chronicle::before {
    border-color: var(--accent-primary);
}

.timeline-item.major-event-red::before {
    border-color: var(--danger-color);
    background: var(--danger-color);
    box-shadow: 0 0 15px var(--danger-color);
}

.timeline-item.major-event-gold::before {
    border-color: var(--warning-color);
    background: var(--warning-color);
    box-shadow: 0 0 15px var(--warning-color);
}

/* Time Column */
.timeline-time {
    display: flex;
    flex-direction: column;
    width: 100px;
    /* Fixed width */
    text-align: right;
    padding-top: 15px;
    flex-shrink: 0;
}

.time-start,
.time-event {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.time-duration {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Content Card */
.timeline-content {
    flex: 1;
    background: rgba(30, 41, 59, 0.7);
    /* Glassmorphism base */
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 15px 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.timeline-content:hover {
    transform: translateX(10px) scale(1.01);
    border-color: var(--accent-primary);
    background: rgba(30, 41, 59, 0.9);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Header Typography */
.timeline-content h4 {
    margin: 0 0 5px 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

/* Event Card Specifics */
.event-card {
    border-left: 4px solid var(--info-color);
    background: rgba(59, 130, 246, 0.1);
    /* Subtle Blue Tint */
}

.timeline-item.major-event-red .event-card {
    border-left-color: var(--danger-color);
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.15), transparent);
    border-color: rgba(239, 68, 68, 0.3);
}

.timeline-item.major-event-gold .event-card {
    border-left-color: var(--warning-color);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15), transparent);
    border-color: rgba(245, 158, 11, 0.3);
}

.timeline-item.major-event-red:hover .event-card {
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.timeline-item.major-event-gold:hover .event-card {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

/* Metadata */
.timeline-reward {
    color: var(--warning-color);
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.timeline-note {
    color: var(--info-color);
    font-style: italic;
    font-size: 0.85rem;
    margin-top: 5px;
}

.event-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.3);
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* =========================================
   MOBILE & TABLET OVERHAUL
   ========================================= */

/* --- Tablet (max-width: 1024px) --- */
@media (max-width: 1024px) {
    .container {
        padding: 1.5rem;
        max-width: 100%;
    }

    /* Stack the SOC Layout (Sidebar on top, Content below) */
    .soc-layout {
        flex-direction: column;
    }

    /* Horizontal Scrollable SOC Sidebar */
    .soc-sidebar {
        width: 100%;
        min-width: 100%;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
        margin-bottom: 1.5rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        -webkit-overflow-scrolling: touch;
        /* iOS Smooth Scroll */
        scrollbar-width: thin;
        /* Firefox */
    }

    .soc-nav-btn {
        flex: 0 0 auto;
        /* Don't shrink buttons */
        padding: 0.75rem 1.25rem;
        border-right: 1px solid var(--border-color);
        border-bottom: none;
    }

    .soc-nav-btn:last-child {
        border-right: none;
    }
}

/* --- Mobile (max-width: 768px) --- */
@media (max-width: 768px) {

    /* Tighter Global Padding */
    .container {
        padding: 1rem;
    }

    /* Header Adjustments */
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    /* Scrollable Main Tabs */
    .tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        justify-content: flex-start;
        width: 100%;
        padding: 0.5rem;
        margin-bottom: 1.5rem;
        -webkit-overflow-scrolling: touch;
        background: transparent;
        border: none;
    }

    .tab-btn {
        flex: 0 0 auto;
        /* Prevent wrapping */
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
        background: rgba(30, 41, 59, 0.8);
        /* Better contrast on scroll */
        border: 1px solid var(--border-color);
        margin-right: 0.5rem;
    }

    .tab-btn.active {
        background: var(--accent-gradient);
    }

    /* Stack Upload Zones (Single Column) */
    .upload-section {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .upload-zone {
        padding: 2rem 1.5rem;
    }

    /* Pre-KVK Subtabs (Scrollable) */
    .prekvk-subtabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
    }

    .subtab-btn {
        flex: 0 0 auto;
    }

    /* Data Tables (Scrollable Wrapper) */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        /* Negative margin to pull to edges */
        padding: 0 1rem;
        width: calc(100% + 2rem);
    }

    table {
        min-width: 600px;
        /* Force scroll trigger */
    }

    /* SOC Timeline Adjustments */
    .timeline-container {
        padding-left: 0;
    }

    .timeline-container::before {
        left: 20px;
        /* Move line closer to edge */
    }

    .timeline-item {
        gap: 15px;
        padding-bottom: 20px;
    }

    .timeline-item::before {
        left: 15px;
        /* Re-align dot with line */
    }

    .timeline-time {
        width: auto;
        position: absolute;
        top: -10px;
        right: 0;
        text-align: right;
        flex-direction: row;
        gap: 10px;
        z-index: 5;
    }

    .time-start {
        background: rgba(2, 6, 23, 0.8);
        padding: 2px 8px;
        border-radius: 4px;
        font-size: 0.85rem;
    }

    .time-duration {
        display: none;
        /* Hide duration on mobile to save space */
    }

    .timeline-content {
        margin-top: 25px;
        /* Push content down to clear time label */
        margin-left: 40px;
        /* Clear the line */
    }
}

/* Split Card Upload Design */
.upload-zone.split-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    justify-content: space-between;
    overflow: hidden;
    gap: 0;
    min-height: 280px;
    background: rgba(30, 41, 59, 0.5);
    /* Darker base */
}

.split-card .card-header {
    background: rgba(59, 130, 246, 0.1);
    padding: 1rem;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    text-align: center;
}

.split-card .zone-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.split-card .zone-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.split-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    gap: 1rem;
}

.split-card .or-divider {
    font-size: 0.8rem;
    color: var(--text-muted);
    position: relative;
    width: 100%;
    text-align: center;
}

.split-card .or-divider::before,
.split-card .or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border-color);
}

.split-card .or-divider::before {
    left: 0;
}

.split-card .or-divider::after {
    right: 0;
}

.split-card .card-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

/* Optional Card Styling */
.upload-zone.optional-card {
    border: 2px dashed rgba(148, 163, 184, 0.4);
    background: rgba(148, 163, 184, 0.05);
}

.optional-card .card-header {
    background: rgba(148, 163, 184, 0.1);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.optional-card .zone-title {
    color: var(--text-secondary);
}

/* Action Buttons */
.action-btn {
    width: 100%;
    padding: 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.upload-btn {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.4);
}

.upload-btn:hover {
    background: rgba(59, 130, 246, 0.4);
}

.cloud-btn {
    background: transparent;
    opacity: 0.8;
}

.cloud-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.footer-btn {
    width: 100%;
    padding: 0.5rem;
    font-size: 0.9rem;
    border-radius: 4px;
    background: var(--success-color);
    color: white;
    border: none;
    cursor: pointer;
}

.footer-btn:hover {
    opacity: 0.9;
}

/* Pipeline Layout Overrides */
.upload-grid.pipeline-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    position: relative;
    padding: 2rem 0;
}

.pipeline-mode .upload-zone {
    flex: 1;
    max-width: 300px;
    position: relative;
    z-index: 2;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Primary Nodes (Start/End) - "Heroes" */
.pipeline-mode .upload-zone:not(.optional-card) {
    transform: scale(1.02);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.pipeline-mode .upload-zone:not(.optional-card):hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.6);
}

/* Detour Node (Healing) - "Side Quest" */
.pipeline-mode .upload-zone.optional-card {
    flex: 0.8;
    max-width: 250px;
    transform: translateY(20px);
    /* Hangs lower */
    opacity: 0.85;
    border-style: dashed;
}

.pipeline-mode .upload-zone.optional-card:hover {
    transform: translateY(15px) scale(1.02);
    opacity: 1;
    border-style: solid;
}

/* Pipeline Arrows */
.pipeline-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    animation: pulseArrow 2s infinite;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
    z-index: 1;
}

@keyframes pulseArrow {
    0% {
        opacity: 0.5;
        transform: translateX(0);
    }

    50% {
        opacity: 1;
        transform: translateX(5px);
    }

    100% {
        opacity: 0.5;
        transform: translateX(0);
    }
}

/* Connector Line (The "Pipeline") */
.pipeline-connector {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 0;
    pointer-events: none;
    display: none;
    /* User requested removal */
}

/* Pipeline Mobile Stack */
@media (max-width: 768px) {
    .upload-grid.pipeline-mode {
        flex-direction: column;
        gap: 1.5rem;
    }

    .pipeline-connector {
        width: 4px;
        height: 100%;
        top: 0;
        left: 50%;
        background: linear-gradient(180deg,
                rgba(59, 130, 246, 0) 0%,
                rgba(59, 130, 246, 0.2) 20%,
                rgba(59, 130, 246, 0.2) 80%,
                rgba(59, 130, 246, 0) 100%);
    }

    .pipeline-arrow {
        transform: rotate(90deg);
        animation: pulseArrowVertical 2s infinite;
    }

    @keyframes pulseArrowVertical {
        0% {
            opacity: 0.5;
            transform: rotate(90deg) translateY(0);
        }

        50% {
            opacity: 1;
            transform: rotate(90deg) translateY(5px);
        }

        100% {
            opacity: 0.5;
            transform: rotate(90deg) translateY(0);
        }
    }

    .pipeline-mode .upload-zone {
        max-width: 100%;
        width: 100%;
    }

    .pipeline-mode .upload-zone.optional-card {
        transform: scale(0.95);
        /* Just shrink slightly, don't offset Y */
    }
}

/* --- Smart Welcome Modal --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 500px;
    position: relative;
    overflow: hidden;
    animation: scaleIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-panel {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h2 {
    margin: 0;
    background: var(--accent-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.5rem;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* =========================================
   MAIL GENERATOR STYLES
   ========================================= */
.mail-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    height: calc(100vh - 200px);
    min-height: 500px;
    /* Fallback */
    width: 100%;
    position: relative;
    z-index: 10;
}

.mail-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.mail-panel .panel-header {
    padding: 0.75rem 1rem;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.tool-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.4rem 0.8rem;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.tool-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

.tool-group {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    border-right: 1px solid var(--border-color);
    padding-right: 0.5rem;
    margin-right: 0.5rem;
    position: relative;
}

.tool-group:last-child {
    border-right: none;
}

/* Editor Input */
#mail-input {
    flex: 1;
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: none;
    padding: 1rem;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 1rem;
    resize: none;
    outline: none;
    line-height: 1.5;
}

/* Symbol Picker */
.symbol-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 10px;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    min-width: 320px;
}

.symbol-tabs {
    display: flex;
    background-color: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
}

.symbol-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.wide-grid {
    grid-template-columns: repeat(6, 1fr);
}

.symbol-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 0;
    text-align: center;
    cursor: pointer;
    border-radius: 3px;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.symbol-btn:hover {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--white);
}

.symbol-btn.full-width {
    width: 100%;
    margin-bottom: 4px;
}

/* =========================================
   MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 768px) {
    .mail-layout {
        grid-template-columns: 1fr;
        height: auto !important;
        /* Override fixed height */
        min-height: auto !important;
        display: flex;
        flex-direction: column;
        gap: 2rem;
    }

    .mail-panel {
        height: 500px;
        /* Fixed height for mobile panels so they don't squash */
        min-height: 50vh;
    }

    .toolbar {
        flex-wrap: wrap;
    }

    .symbol-dropdown {
        min-width: 280px;
        width: 90vw;
    }

    .symbol-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    .wide-grid {
        grid-template-columns: repeat(5, 1fr);
        /* Reduce columns */
    }
}

/* RoK Game Preview Styles */
.rok-preview-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-primary);
}

/* =========================================
   DETAILED OVERVIEW TABLE
   ========================================= */
.overview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9em;
    white-space: nowrap;
    /* Prevent wrapping for wide data */
}

.overview-table th,
.overview-table td {
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    /* Numeric data alignment */
}

.overview-table th {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Align text columns (ID, Name, Status, Alliance, TH, Kingdom) left */
.overview-table th:nth-child(1),
.overview-table td:nth-child(1),
.overview-table th:nth-child(2),
.overview-table td:nth-child(2),
.overview-table th:nth-child(3),
.overview-table td:nth-child(3),
.overview-table th:nth-child(4),
.overview-table td:nth-child(4),
.overview-table th:nth-child(5),
.overview-table td:nth-child(5),
.overview-table th:nth-child(6),
.overview-table td:nth-child(6) {
    text-align: left;
}

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

/* Diff Coloring */
.diff-pos {
    color: var(--success-color);
    font-weight: 500;
}

.diff-neg {
    color: var(--danger-color);
    font-weight: 500;
}

.diff-neutral {
    color: var(--text-muted);
}

/* =========================================
   OVERVIEW CONTROLS (Search & Filter)
   ========================================= */
.overview-search,
.overview-alliance-filter {
    background: rgba(15, 23, 42, 0.6);
    /* Dark background */
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.overview-search:focus,
.overview-alliance-filter:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(15, 23, 42, 0.8);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.overview-search::placeholder {
    color: var(--text-muted);
}

.overview-alliance-filter option {
    background: var(--card-bg);
    color: var(--text-primary);
}

/* =========================================
   GROWTH TAB
   ========================================= */
.growth-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.growth-card {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.growth-card h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.growth-stat {
    font-size: 2.5rem;
    font-weight: 700;
}

/* Grades Colors */
.grade-s-u {
    border-top: 4px solid var(--warning-light);
}

.grade-a-u {
    border-top: 4px solid var(--success-light);
}

.grade-b-u {
    border-top: 4px solid var(--info-light);
}

.grade-c-u {
    border-top: 4px solid var(--danger-light);
}

.grade-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-weight: bold;
    font-size: 0.9rem;
    display: inline-block;
    min-width: 40px;
    text-align: center;
}

.bg-grade-s {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning-light);
    border: 1px solid rgba(251, 191, 36, 0.3);
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.1);
}

.bg-grade-a {
    background: rgba(52, 211, 153, 0.15);
    color: var(--success-light);
    border: 1px solid rgba(52, 211, 153, 0.3);
}

.bg-grade-b {
    background: rgba(96, 165, 250, 0.15);
    color: var(--info-light);
    border: 1px solid rgba(96, 165, 250, 0.3);
}

.bg-grade-c {
    background: rgba(248, 113, 113, 0.15);
    color: var(--danger-light);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.bg-grade-d {
    background: rgba(167, 139, 250, 0.15);
    color: var(--accent-light);
    border: 1px solid rgba(167, 139, 250, 0.3);
}

.bg-grade-f {
    background: rgba(100, 116, 139, 0.15);
    color: var(--text-secondary);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.archetype-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

/* Diff Utilities */
.diff-pos {
    color: var(--success-light);
    font-weight: bold;
}

.diff-neg {
    color: var(--danger-light);
    font-weight: bold;
}

.diff-neutral {
    color: var(--text-muted);
    opacity: 0.7;
}

/* Tooltip Styles */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--bg-color-alt);
    /* Slate 900 */
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    white-space: pre-wrap;
    width: max-content;
    max-width: 300px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 1000;
    border: 1px solid rgba(148, 163, 184, 0.2);
    text-align: left;
    line-height: 1.5;
    font-weight: normal;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 115%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-color-alt);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 1000;
}

[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

/* Growth Tab: Sticky Header */
.growth-table th {
    position: sticky;
    top: 0;
    z-index: 20;
    background-color: var(--card-bg);
    /* Match card bg */
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    /* Stronger shadow for separation */
}

/* Growth Tab: Date Range Info */
.growth-date-info {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.growth-date-info strong {
    color: var(--text-primary);
}

.growth-date-info .duration-badge {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info-light);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    /* Pill shape */
    font-size: 0.85em;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Growth Tab: Search Control */
.growth-search-container {
    margin-bottom: 1.5rem;
    max-width: 400px;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input-wrapper input {
    width: 100%;
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 0.75rem 2.5rem 0.75rem 2.5rem;
    /* Space for icon and clear btn */
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.search-input-wrapper input:focus {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
    outline: none;
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 1rem;
    opacity: 0.5;
    pointer-events: none;
}

.search-input-wrapper .search-clear-btn {
    position: absolute;
    right: 0.75rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.25rem;
    line-height: 1;
    border-radius: 50%;
}

.search-input-wrapper .search-clear-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.alliance-select-wrapper select {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    padding: 0.75rem 2rem 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 1rem;
    cursor: pointer;
    min-width: 150px;
    transition: all 0.2s;
}

.alliance-select-wrapper select:focus {
    background-color: rgba(30, 41, 59, 0.8);
    border-color: var(--primary-color);
    outline: none;
}

.search-row {
    margin-bottom: 0.5rem;
}

/* =========================================
   Live Feed Tab
   ========================================= */
#live-feed .live-controls {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.feed-console {
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    border: 1px solid var(--border-dark);
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.feed-console::-webkit-scrollbar {
    width: 8px;
    background: var(--bg-black);
}

.feed-console::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.status-indicator {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Blinking animation for 'LIVE' status */
@keyframes blink-live {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

#feedStatus:contains("LIVE") {
    animation: blink-live 2s infinite;
    box-shadow: 0 0 8px var(--success-color);
}

/* ==========================================
   ALLIANCE DUEL (VS MODE)
   ========================================== */
.alliance-vs-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1rem;
}

.vs-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.vs-competitor {
    flex: 1;
    display: flex;
    justify-content: center;
}

.vs-select {
    width: 100%;
    max-width: 300px;
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: bold;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.vs-competitor.blue .vs-select {
    border-color: var(--info-color);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

.vs-competitor.red .vs-select {
    border-color: var(--danger-color);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.2);
}

.vs-logo {
    font-size: 3rem;
    font-weight: 900;
    font-style: italic;
    color: var(--warning-color);
    text-shadow: 2px 2px 0 var(--bg-black);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

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

.vs-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.vs-stat-row {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vs-stat-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vs-stat-values {
    display: flex;
    justify-content: space-between;
    font-weight: bold;
    font-size: 1.1rem;
}

.val-blue {
    color: var(--info-light);
}

.val-red {
    color: var(--danger-light);
}

.vs-bar-container {
    height: 12px;
    background: var(--border-dark);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    display: flex;
}

.vs-bar-blue {
    background: linear-gradient(90deg, var(--info-dark), var(--info-color));
    height: 100%;
    transition: width 1s ease-in-out;
}

.vs-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.vs-dates {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Pokemon Card Styles */
.vs-arena {
    display: flex;
    justify-content: center;
    gap: 4rem;
    padding: 2rem 0;
    align-items: flex-start;
    position: relative;
    perspective: 1000px;
}

.vs-card-placeholder {
    width: 320px;
    height: 480px;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 1.2rem;
    background: rgba(0, 0, 0, 0.2);
}

.vs-card {
    width: 320px;
    min-height: 480px;
    background: var(--bg-secondary);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
}

.vs-card:hover {
    transform: translateY(-10px) rotateX(5deg);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
}

.vs-card.blue-card {
    border-top: 4px solid var(--info-color);
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
}

.vs-card.red-card {
    border-top: 4px solid var(--danger-color);
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
}

.vs-card-header {
    padding: 1.5rem;
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.vs-alliance-tag {
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
}

.vs-alliance-name {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0.5rem 0;
    text-transform: uppercase;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.vs-avatar {
    width: 100px;
    height: 100px;
    margin: 1rem auto;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    border: 4px solid rgba(255, 255, 255, 0.1);
}

.blue-card .vs-avatar {
    background: linear-gradient(135deg, var(--info-dark), var(--info-color));
}

.red-card .vs-avatar {
    background: linear-gradient(135deg, var(--danger-dark), var(--danger-color));
}

.vs-main-stat {
    text-align: center;
    padding: 1rem;
}

.vs-stat-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.vs-stat-value-main {
    font-size: 2rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.vs-sub-stats {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.vs-sub-stat-box {
    text-align: center;
}

.blue-card .vs-alliance-name {
    color: var(--info-light);
}

.red-card .vs-alliance-name {
    color: var(--danger-light);
}

/* Compact Grid Styles */
.vs-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.vs-compact-stat {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vs-compact-header {
    text-align: center;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 1px;
}

.vs-compact-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.vs-compact-bar-bg {
    flex: 1;
    height: 8px;
    background: var(--border-dark);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
}

.vs-compact-bar-fill {
    height: 100%;
    transition: width 1s ease-in-out;
}

.val-blue,
.val-red {
    font-weight: bold;
    font-size: 1rem;
    min-width: 60px;
}

.val-blue {
    text-align: right;
    color: var(--info-light);
}

.val-red {
    text-align: left;
    color: var(--danger-light);
}

.vs-detailed-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.8rem;
}

.vs-detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.vs-detail-row strong {
    color: white;
    font-weight: 600;
}

/* Hall of Legends Styles */
.hol-container {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    align-items: center;
}

.hol-badges {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    max-width: 1000px;
}

.hol-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem;
    width: 140px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.hol-badge:hover,
.hol-badge.active {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--info-color);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

.hol-badge-icon {
    font-size: 2.5rem;
}

.hol-badge-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.hol-badge.active .hol-badge-name {
    color: white;
}

.hol-podium-section {
    text-align: center;
    width: 100%;
}

.hol-category-title {
    margin-bottom: 2rem;
    font-size: 1.5rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hol-podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    /* Align to bottom for steps */
    gap: 1rem;
    height: 450px;
    /* Fixed height container */
    padding-bottom: 2rem;
}

.hol-step {
    width: 220px;
    background: linear-gradient(to bottom, var(--card-hover), var(--card-bg));
    border-radius: 8px 8px 0 0;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Player card sits on top */
    align-items: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.hol-player-card {
    transform: translateY(-90%);
    /* Sit on top of the step */
    width: 100%;
    text-align: center;
    position: relative;
    z-index: 2;
}

.hol-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 3px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
}

.rank-1 .hol-avatar {
    border-color: var(--warning-light);
    background: linear-gradient(135deg, var(--warning-color), var(--warning-light));
}

.rank-2 .hol-avatar {
    border-color: var(--text-secondary);
    background: linear-gradient(135deg, var(--text-muted), var(--text-secondary));
}

.rank-3 .hol-avatar {
    border-color: var(--amber-700);
    background: linear-gradient(135deg, var(--amber-900), var(--amber-700));
}

.hol-info {
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem;
    border-radius: 8px;
    margin: 0 10px;
    backdrop-filter: blur(4px);
}

.hol-name {
    font-weight: bold;
    font-size: 1.1rem;
    color: white;
}

.hol-alliance {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.hol-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--warning-light);
}

.hol-rank-num {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.2);
    margin: 0;
    padding: 0;
    line-height: 1;
    z-index: 0;
}

.rank-1 {
    height: 250px;
    background: linear-gradient(to bottom, var(--amber-600), var(--amber-800));
    border-color: var(--warning-light);
    box-shadow: 0 0 30px rgba(251, 191, 36, 0.2);
}

.rank-2 {
    height: 180px;
    background: linear-gradient(to bottom, var(--text-muted), var(--card-hover));
    border-color: var(--text-secondary);
}



/* Mail Preview - Parchment Theme */
.mail-preview-wrapper {
    background-color: var(--rpg-bg);
    padding: 2rem;
    position: relative;
    overflow-y: auto;
    display: flex;
    justify-content: center;
}

.rok-preview-container {
    background-color: var(--rpg-parchment);
    /* Parchment Color */
    background-image: linear-gradient(to bottom right, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0));
    border: 4px solid var(--rpg-border-dark);
    /* Wood Frame */
    border-radius: 6px;
    padding: 20px;
    min-height: 400px;
    width: 100%;
    max-width: 600px;

    font-family: 'Times New Roman', serif;
    color: var(--rpg-text);
    /* Dark Brown Text */
    font-size: 16px;
    line-height: 1.5;
    white-space: pre-wrap;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.1), 0 10px 20px rgba(0, 0, 0, 0.3);
}



/* Mail Preview - Light Paper Theme */
.mail-preview-wrapper {
    background-color: var(--rpg-bg);
    /* Keep dark surroundings */
    padding: 2rem;
    position: relative;
    overflow-y: auto;
    display: flex;
    justify-content: center;

}

/* Race to Glory */
.race-controls {
    background: rgba(255, 255, 255, 0.05);
    /* Glass tint */
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.race-data-display {
    font-variant-numeric: tabular-nums;
}

.race-chart-container canvas {
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
}


.rok-preview-container {
    background-color: var(--rpg-parchment) !important;
    /* Light Tan Parchment */
    background-image: none !important;
    border: 1px solid var(--rpg-border-light);
    border-radius: 4px;
    padding: 30px;
    /* More padding for paper margins */
    min-height: 500px;
    width: 100%;
    max-width: 600px;

    /* Typography match */
    font-family: 'Segoe UI', 'Roboto', 'Helvetica', sans-serif;
    color: var(--bg-black);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.6;
    white-space: pre-wrap;

    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Header Simulation injected via JS, but styled here */
.preview-header-sim {
    margin-bottom: 0px;
}

.preview-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--bg-black);
    margin-bottom: 4px;
}

.preview-subtitle {
    font-size: 14px;
    color: var(--border-dark);
    margin-bottom: 4px;
}

.preview-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.preview-divider {
    height: 1px;
    background-color: var(--rpg-parchment-dark);
    margin-bottom: 20px;
    width: 100%;
}

/* RPG Hero Card */
.rpg-hero-card {
    background: linear-gradient(145deg, rgba(30, 30, 30, 0.9), rgba(10, 10, 10, 0.95));
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-family: 'Segoe UI', sans-serif;
    position: relative;
    overflow: hidden;
}

.rpg-hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--success-color), var(--warning-color), var(--danger-color));
}

.hero-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-avatar {
    font-size: 3rem;
    background: rgba(255, 255, 255, 0.05);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.hero-info h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--white);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-class {
    color: var(--warning-light);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

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

.hero-badge {
    margin-left: auto;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Biome Theme Colors */
.hero-header.lion .hero-avatar {
    border-color: var(--success-color);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

.hero-header.bear .hero-avatar {
    border-color: var(--warning-color);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.hero-header.farmer .hero-avatar {
    border-color: var(--danger-color);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.hero-header.potato .hero-avatar {
    border-color: var(--text-muted);
    box-shadow: 0 0 15px rgba(107, 114, 128, 0.3);
}

.hero-stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-box {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 8px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 2px;
}

.stat-val {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--white);
}

.stat-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 5px;
    border-radius: 2px;
    overflow: hidden;
}

.stat-bar div {
    height: 100%;
    border-radius: 2px;
}

.stat-box.str .stat-bar div {
    background: var(--danger-color);
}

.stat-box.vit .stat-bar div {
    background: var(--success-color);
}

.stat-box.dex .stat-bar div {
    background: var(--warning-light);
}


/* Squad Builder */
.squad-workspace {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    height: 600px;
}

.commander-pool-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    display: flex;
    flex-direction: column;
}

.pool-filters {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.filter-btn {
    background: var(--border-dark);
    border: none;
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.filter-btn.active {
    background: var(--warning-light);
    color: var(--bg-black);
}

.pool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
    overflow-y: auto;
    flex: 1;
    padding-right: 5px;
}

.cmd-card {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    background-size: cover;
    background-position: center;
    border: 2px solid var(--border-color);
    cursor: pointer;
    position: relative;
    transition: transform 0.1s;
}

.cmd-card:hover {
    transform: scale(1.05);
    border-color: var(--white);
}

.cmd-card.legendary {
    border-color: var(--warning-light);
}

.cmd-card.epic {
    border-color: var(--accent-color);
}

/* Squad Canvas */
.squad-canvas-panel {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.squad-slots {
    display: flex;
    gap: 20px;
    align-items: center;
    margin: 40px 0;
}

.cmd-slot {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--border-light);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    cursor: pointer;
    position: relative;
}

.cmd-slot.filled {
    border-style: solid;
    border-color: var(--warning-light);
    background-size: cover;
}

.slot-label {
    position: absolute;
    top: -25px;
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.slot-content {
    font-size: 0.8rem;
    color: var(--border-light);
    text-align: center;
    padding: 5px;
}

.synergy-badge {
    background: var(--border-dark);
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--white);
}

.skill-config {
    width: 100%;
    max-width: 400px;
    background: rgba(0, 0, 0, 0.3);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.skill-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    align-items: center;
}

.skill-row input {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--white);
    padding: 5px;
    width: 80px;
    text-align: center;
    border-radius: 4px;
    letter-spacing: 2px;
}


/* --- Premium Center Stacked Footer --- */
.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: var(--bg-color-alt);
    padding: 3rem 0 2rem 0;
    margin-top: 4rem;
    color: var(--text-secondary);
    font-family: 'Inter', -apple-system, sans-serif;
    width: 100%;
}

.site-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    padding: 0 1rem;
}

.site-footer .footer-brand {
    margin-bottom: 2rem;
}

.site-footer .brand-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-footer .brand-tagline {
    font-size: 0.95rem;
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto;
}

.site-footer .footer-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 2.5rem;
}

.site-footer .version-tag {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.35rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.site-footer .donate-btn-wrapper {
    display: block;
    line-height: 0;
}

.site-footer .donate-btn-wrapper img {
    height: 36px;
    transition: transform 0.2s ease, filter 0.2s ease;
    border-radius: 6px;
}

.site-footer .donate-btn-wrapper:hover img {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.site-footer .footer-divider {
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    margin: 0 0 1.5rem 0;
}

.site-footer .footer-bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
}

.site-footer .copyright {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.site-footer .footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.site-footer .footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

.site-footer .footer-links a:hover {
    color: var(--accent-primary);
}

/* Optional hover underline effect */
.site-footer .footer-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -3px;
    left: 50%;
    background-color: var(--accent-primary);
    transition: all 0.2s ease;
    transform: translateX(-50%);
}

.site-footer .footer-links a:hover::after {
    width: 100%;
}

.config-input {
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.config-input:focus {
    border-color: var(--accent-primary);
    outline: none;
}

/* --- Animated Bot Mascot Easter Egg --- */
.mascot-container {
    position: relative;
    display: inline-block;
}

.bot-mascot {
    position: absolute;
    top: -40px;
    /* Sits exactly on the button */
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 45px;
    pointer-events: none;
    /* Let clicks pass through to the button */
    z-index: 10;
    animation: dropIn 2s ease-out forwards;
}

/* Head resembling the Unity gear/circle logo */
.bot-head {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 20px;
    height: 20px;
    background: transparent;
    border: 3px solid var(--accent-primary);
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.5);
    transition: all 0.3s ease;
    animation: headBob 4s infinite alternate ease-in-out;
}

/* Eyes */
.bot-eye {
    position: absolute;
    top: 5px;
    width: 4px;
    height: 4px;
    background: var(--accent-secondary);
    border-radius: 50%;
    transition: all 0.2s;
}

.bot-eye.left {
    left: 3px;
}

.bot-eye.right {
    right: 3px;
}

/* Sleeping state - eyes closed */
.bot-mascot .bot-eye {
    height: 1px;
    top: 8px;
    background: #475569;
}

/* Body / Stick */
.bot-body {
    position: absolute;
    top: 30px;
    left: 19px;
    width: 2px;
    height: 12px;
    background: var(--accent-primary);
}

/* Arms */
.bot-arm {
    position: absolute;
    top: 32px;
    width: 10px;
    height: 2px;
    background: var(--accent-primary);
}

.bot-arm.left {
    left: 10px;
    transform: rotate(30deg);
}

.bot-arm.right {
    right: 10px;
    transform: rotate(-30deg);
}

/* Zzz animation */
.bot-zzz {
    position: absolute;
    top: -5px;
    right: -10px;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: bold;
    font-family: 'Comic Sans MS', cursive, sans-serif;
    opacity: 0;
    animation: zzzFloat 3s infinite linear;
    animation-delay: 2s;
    /* Start after dropdown */
}

/* Wake up on hover of the container */
.mascot-container:hover .bot-mascot .bot-eye {
    height: 4px;
    top: 5px;
    background: var(--success-color);
    box-shadow: 0 0 5px var(--success-color);
}

.mascot-container:hover .bot-head {
    border-color: var(--success-color);
    transform: translateY(-3px);
    animation: none;
}

.mascot-container:hover .bot-arm.left {
    transform: rotate(-150deg);
    top: 25px;
    left: 5px;
}

.mascot-container:hover .bot-arm.right {
    transform: rotate(150deg);
    top: 25px;
    right: 5px;
}

.mascot-container:hover .bot-zzz {
    display: none;
    animation: none;
}

/* Animations */
@keyframes dropIn {
    0% {
        top: -150px;
        opacity: 0;
    }

    60% {
        top: -35px;
        opacity: 1;
    }

    80% {
        top: -45px;
        opacity: 1;
    }
}

@keyframes headBob {
    0% {
        transform: rotate(-5deg) translateY(0);
    }

    100% {
        transform: rotate(5deg) translateY(2px);
    }
}

@keyframes zzzFloat {
    0% {
        transform: translate(0, 0) scale(0.5);
        opacity: 0;
    }

    20% {
        opacity: 0.8;
    }

    80% {
        opacity: 0.5;
    }

    100% {
        transform: translate(15px, -20px) scale(1.5);
        opacity: 0;
    }
}