:root {
    --cd-crimson: #c41e3a;
    --cd-crimson-bright: #e0314f;
    --cd-crimson-dim: #8a1528;
    --cd-crimson-dark: #3d0a12;
    --cd-gold: #d4a745;
    --cd-gold-dim: #a07b2e;
    --cd-gold-dark: #3d2e10;
    --cd-green: #4caf50;
    --cd-green-dim: #2e7d32;
    --cd-blue: #5c9fd4;
    --cd-purple: #9c5cce;
    --cd-red: #e74c3c;
    --cd-ice: #7ec8e3;
    --bg-dark: #0d0d0f;
    --bg-card: #161618;
    --bg-light: #1a1a1e;
    --bg-lighter: #222226;
    --border-color: rgba(196, 30, 58, 0.2);
    --border-bright: rgba(196, 30, 58, 0.45);
    --text-primary: #e0d5c5;
    --text-secondary: rgba(224, 213, 197, 0.8);
    --text-muted: rgba(224, 213, 197, 0.5);
    --glow-sm: 0 0 5px rgba(196, 30, 58, 0.3);
    --glow-md: 0 0 10px rgba(196, 30, 58, 0.3);
    --glow-lg: 0 0 20px rgba(196, 30, 58, 0.2);
    --glow-gold: 0 0 10px rgba(212, 167, 69, 0.3);
}

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Crimson+Text:ital,wght@0,400;0,600;0,700;1,400&display=swap');

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

html, body {
    height: 100%;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Crimson Text', Georgia, serif;
    font-size: 17px;
    line-height: 1.6;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(196, 30, 58, 0.03) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 50%, rgba(212, 167, 69, 0.02) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb {
    background: var(--cd-crimson-dim);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--cd-crimson); }

.font-heading { font-family: 'Cinzel', serif; }

/* Header */
#app-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: linear-gradient(180deg, #0d0d0f 0%, rgba(13,13,15,0.97) 100%);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.6);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-logo {
    font-family: 'Cinzel', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--cd-crimson);
    text-shadow: var(--glow-md);
    white-space: nowrap;
    letter-spacing: 3px;
    text-transform: uppercase;
}

.app-logo span {
    color: var(--cd-gold);
    text-shadow: var(--glow-gold);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
}
.tab-nav::-webkit-scrollbar { display: none; }

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.6rem 0.7rem;
    cursor: pointer;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    transition: color 0.2s, text-shadow 0.2s;
}

.tab-btn:hover { color: var(--text-secondary); }

.tab-btn.active {
    color: var(--cd-crimson-bright);
    text-shadow: var(--glow-sm);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--cd-crimson), var(--cd-gold));
    box-shadow: var(--glow-sm);
}

/* Mobile hamburger */
.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-color);
    color: var(--cd-crimson);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
    font-size: 1.2rem;
    border-radius: 4px;
}

/* Main content */
#main-content {
    margin-top: 52px;
    min-height: calc(100vh - 52px);
    padding: 1rem;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 110px;
    position: relative;
    z-index: 1;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

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

.card:hover {
    border-color: var(--border-bright);
    box-shadow: var(--glow-sm);
}

.card-title {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--cd-gold);
}

.card-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.card-body { color: var(--text-secondary); font-size: 0.9rem; }

/* Badges */
.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-crimson { background: var(--cd-crimson-dark); color: var(--cd-crimson-bright); border: 1px solid var(--cd-crimson-dim); }
.badge-gold { background: var(--cd-gold-dark); color: var(--cd-gold); border: 1px solid var(--cd-gold-dim); }
.badge-green { background: rgba(76, 175, 80, 0.12); color: var(--cd-green); border: 1px solid var(--cd-green-dim); }
.badge-blue { background: rgba(92, 159, 212, 0.12); color: var(--cd-blue); border: 1px solid rgba(92, 159, 212, 0.3); }
.badge-purple { background: rgba(156, 92, 206, 0.12); color: var(--cd-purple); border: 1px solid rgba(156, 92, 206, 0.3); }
.badge-red { background: rgba(231, 76, 60, 0.12); color: var(--cd-red); border: 1px solid rgba(231, 76, 60, 0.3); }
.badge-ice { background: rgba(126, 200, 227, 0.12); color: var(--cd-ice); border: 1px solid rgba(126, 200, 227, 0.3); }

/* Search inputs */
.search-box {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--cd-gold);
    font-family: 'Crimson Text', serif;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box::placeholder { color: var(--text-muted); }
.search-box:focus {
    border-color: var(--cd-crimson-dim);
    box-shadow: var(--glow-md);
}

/* Filter buttons */
.filter-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
}

.filter-btn {
    background: var(--bg-lighter);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.78rem;
    font-weight: 600;
    transition: all 0.2s;
}

.filter-btn:hover { border-color: var(--border-bright); color: var(--text-secondary); }
.filter-btn.active {
    background: var(--cd-crimson-dark);
    border-color: var(--cd-crimson-dim);
    color: var(--cd-crimson-bright);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.data-table th {
    text-align: left;
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-bright);
    color: var(--cd-gold);
    font-family: 'Cinzel', serif;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 1px;
    white-space: nowrap;
}

.data-table td {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.data-table tr:hover td {
    background: rgba(196, 30, 58, 0.04);
    color: var(--text-primary);
}

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }

/* Section headers */
.section-title {
    font-family: 'Cinzel', serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--cd-gold);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.section-subtitle {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    color: var(--cd-crimson-bright);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1rem 0 0.5rem;
}

/* Stat bar */
.stat-bar-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.75rem;
    width: 55px;
    text-align: right;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    font-family: 'Cinzel', serif;
    letter-spacing: 0.5px;
}

.stat-bar {
    flex: 1;
    height: 14px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 2px;
    overflow: hidden;
}

.stat-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 1px;
}

.stat-bar-fill.fill-crimson { background: linear-gradient(90deg, var(--cd-crimson-dim), var(--cd-crimson)); }
.stat-bar-fill.fill-gold { background: linear-gradient(90deg, var(--cd-gold-dim), var(--cd-gold)); }
.stat-bar-fill.fill-green { background: linear-gradient(90deg, var(--cd-green-dim), var(--cd-green)); }
.stat-bar-fill.fill-blue { background: linear-gradient(90deg, rgba(92,159,212,0.5), var(--cd-blue)); }

.stat-value {
    font-size: 0.75rem;
    width: 28px;
    text-align: left;
    color: var(--text-muted);
}

/* Map styles */
#map-container {
    position: relative;
    isolation: isolate;
    height: calc(100vh - 120px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
}

#map {
    width: 100%;
    height: 100%;
    background: #0a0a0c;
}

.map-sidebar {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    background: rgba(13, 13, 15, 0.95);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    max-height: calc(100% - 20px);
    overflow-y: auto;
    width: 240px;
    backdrop-filter: blur(10px);
}

.map-sidebar h3 {
    font-family: 'Cinzel', serif;
    color: var(--cd-gold);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.5rem;
}

.map-filter-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.2rem 0;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.map-filter-label:hover { color: var(--text-primary); }

.map-filter-label input[type="checkbox"] {
    accent-color: var(--cd-crimson);
    width: 14px;
    height: 14px;
}

.map-filter-count {
    margin-left: auto;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Leaflet popup override */
.leaflet-popup-content-wrapper {
    background: rgba(13, 13, 15, 0.97) !important;
    border: 1px solid var(--border-bright) !important;
    border-radius: 8px !important;
    color: var(--text-primary) !important;
    box-shadow: var(--glow-md) !important;
}

.leaflet-popup-tip { background: rgba(13, 13, 15, 0.97) !important; }
.leaflet-popup-content { font-family: 'Crimson Text', serif !important; font-size: 0.95rem !important; line-height: 1.5 !important; }
.leaflet-popup-content b { color: var(--cd-gold); font-family: 'Cinzel', serif; font-size: 1rem; }
.leaflet-popup-close-button { color: var(--cd-crimson) !important; }

/* Map search results */
.map-results-header {
    font-family: 'Cinzel', serif;
    font-size: 0.72rem;
    color: var(--cd-gold);
    padding: 0.3rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.25rem;
}

.map-result-item {
    display: flex;
    align-items: center;
    padding: 0.35rem 0.4rem;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
    transition: background 0.15s;
}

.map-result-item:hover { background: var(--bg-lighter); }

.map-result-name {
    flex: 1;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-result-cat {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-left: 0.5rem;
    white-space: nowrap;
}

#map-search-results {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 0.5rem;
}

.map-filter-actions {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
}

.map-action-btn {
    flex: 1;
    padding: 0.25rem 0.5rem;
    background: var(--bg-lighter);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Cinzel', serif;
    font-size: 0.65rem;
    text-transform: uppercase;
    transition: all 0.15s;
}

.map-action-btn:hover {
    border-color: var(--border-bright);
    color: var(--cd-crimson);
}

/* Boss cards */
.boss-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.boss-card:hover {
    border-color: var(--cd-crimson-dim);
    box-shadow: var(--glow-md);
}

.boss-name {
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cd-crimson-bright);
    margin-bottom: 0.3rem;
}

.boss-hp {
    font-size: 1rem;
    color: var(--cd-red);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.boss-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.boss-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    font-style: italic;
}

.boss-strategy {
    background: var(--bg-light);
    border-radius: 4px;
    border-left: 3px solid var(--cd-gold);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
}

.boss-strategy-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cd-gold);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.boss-strategy-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.boss-drops {
    background: var(--bg-light);
    border-radius: 4px;
    border-left: 3px solid var(--cd-purple);
    padding: 0.75rem;
}

.boss-drops-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cd-purple);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

/* Companion cards */
.companion-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.companion-card:hover {
    border-color: var(--cd-gold-dim);
    box-shadow: var(--glow-gold);
}

.companion-name {
    font-family: 'Cinzel', serif;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cd-gold);
    margin-bottom: 0.25rem;
}

.companion-ability {
    background: var(--bg-light);
    border-radius: 4px;
    border-left: 3px solid var(--cd-crimson);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.companion-ability-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cd-crimson-bright);
    margin-bottom: 0.2rem;
    font-weight: 600;
}

.companion-passive {
    background: var(--bg-light);
    border-radius: 4px;
    border-left: 3px solid var(--cd-blue);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.companion-passive-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cd-blue);
    margin-bottom: 0.2rem;
    font-weight: 600;
}

/* Quest cards */
.quest-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.quest-card:hover {
    border-color: var(--cd-gold-dim);
    box-shadow: var(--glow-gold);
}

.quest-name {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cd-gold);
    margin-bottom: 0.3rem;
}

.quest-objectives {
    background: var(--bg-light);
    border-radius: 4px;
    border-left: 3px solid var(--cd-crimson);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.quest-objectives-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cd-crimson-bright);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

/* Crafting cards */
.crafting-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.crafting-card:hover {
    border-color: var(--cd-gold-dim);
    box-shadow: 0 0 10px rgba(212, 167, 69, 0.1);
}

.crafting-name {
    font-family: 'Cinzel', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--cd-gold);
    margin-bottom: 0.25rem;
}

.crafting-materials {
    background: var(--bg-light);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.crafting-materials-label {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cd-gold-dim);
    font-weight: 600;
}

/* Skill cards */
.skill-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.skill-card:hover {
    border-color: var(--cd-purple);
    box-shadow: 0 0 10px rgba(156, 92, 206, 0.15);
}

.skill-name {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 700;
    color: var(--cd-crimson-bright);
    margin-bottom: 0.25rem;
}

.skill-effect {
    background: var(--bg-light);
    border-radius: 4px;
    border-left: 3px solid var(--cd-purple);
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Combat technique cards */
.combat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.25rem;
    margin-bottom: 0.75rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.combat-card:hover {
    border-color: var(--cd-crimson-dim);
    box-shadow: var(--glow-md);
}

.combat-name {
    font-family: 'Cinzel', serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--cd-crimson-bright);
    margin-bottom: 0.25rem;
}

.combat-input {
    background: var(--bg-light);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    margin: 0.5rem 0;
    font-size: 0.9rem;
    color: var(--cd-gold);
    border: 1px solid var(--cd-gold-dark);
    font-weight: 600;
}

.combat-input-label {
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cd-gold-dim);
    font-weight: 600;
    display: block;
    margin-bottom: 0.15rem;
}

.combat-tips {
    background: var(--bg-light);
    border-radius: 4px;
    border-left: 3px solid var(--cd-gold);
    padding: 0.75rem;
}

.combat-tips-label {
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--cd-gold);
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.combat-tips-text {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Search result sections */
.search-section {
    margin-bottom: 1.5rem;
}

.search-section-title {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: var(--cd-crimson-bright);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid var(--border-color);
}

.search-result-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.4rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.search-result-item:hover {
    border-color: var(--border-bright);
}

.search-result-name {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--cd-gold);
}

.search-result-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Sub-tab navigation */
.sub-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sub-tab {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: color 0.2s;
    border-bottom: 2px solid transparent;
}

.sub-tab:hover { color: var(--text-secondary); }
.sub-tab.active {
    color: var(--cd-crimson-bright);
    border-bottom-color: var(--cd-crimson);
}

/* Loading spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(3, end) infinite;
}

@keyframes dots {
    0% { content: '.'; }
    33% { content: '..'; }
    66% { content: '...'; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-family: 'Cinzel', serif;
}

/* Highlight for search */
mark {
    background: rgba(196, 30, 58, 0.3);
    color: var(--cd-crimson-bright);
    padding: 0 2px;
    border-radius: 2px;
}

/* Overflow helper */
.overflow-x-auto {
    overflow-x: auto;
}

/* Spacing utilities */
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.p-2 { padding: 0.5rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }

/* Support / Buy Me a Coffee button */
.support-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--cd-gold-dim);
    border-radius: 16px;
    color: var(--cd-gold);
    font-family: 'Cinzel', serif;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.support-btn:hover {
    background: rgba(212, 167, 69, 0.12);
    border-color: var(--cd-gold);
    box-shadow: var(--glow-gold);
}

/* Sticky footer ad */
#ad-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, rgba(13, 13, 15, 0.85), rgba(13, 13, 15, 0.97));
    border-top: 1px solid var(--border-color);
    padding: 6px 0;
    backdrop-filter: blur(4px);
}

.ad-container {
    text-align: center;
    overflow: hidden;
}

.ad-container ins {
    background: transparent !important;
}

.ad-close {
    position: absolute;
    top: 2px;
    right: 8px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}

.ad-close:hover {
    color: var(--cd-red);
}

/* Difficulty badge colors */
.diff-easy { background: rgba(76, 175, 80, 0.12); color: var(--cd-green); border: 1px solid var(--cd-green-dim); }
.diff-medium { background: var(--cd-gold-dark); color: var(--cd-gold); border: 1px solid var(--cd-gold-dim); }
.diff-hard { background: rgba(231, 76, 60, 0.12); color: var(--cd-red); border: 1px solid rgba(231, 76, 60, 0.3); }
.diff-very-hard { background: rgba(156, 92, 206, 0.12); color: var(--cd-purple); border: 1px solid rgba(156, 92, 206, 0.3); }
.diff-extreme { background: var(--cd-crimson-dark); color: var(--cd-crimson-bright); border: 1px solid var(--cd-crimson-dim); }

/* Responsive */
@media (max-width: 768px) {
    .menu-toggle { display: block; }

    .tab-nav {
        display: none;
        position: fixed;
        top: 52px;
        left: 0; right: 0;
        background: var(--bg-dark);
        border-bottom: 1px solid var(--border-color);
        flex-direction: column;
        padding: 0.5rem;
        z-index: 999;
        max-height: 60vh;
        overflow-y: auto;
    }

    .tab-nav.open { display: flex; }

    .tab-btn {
        text-align: left;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid var(--border-color);
    }

    .tab-btn.active::after { display: none; }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    #map-container { height: calc(100vh - 160px); }

    .map-sidebar {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0; right: 0;
        width: 100%;
        max-height: 40vh;
        border-radius: 16px 16px 0 0;
        transform: translateY(calc(100% - 44px));
        transition: transform 0.3s;
    }

    .map-sidebar.open { transform: translateY(0); }

    .map-sidebar-handle {
        display: block;
        width: 40px;
        height: 4px;
        background: var(--cd-crimson-dim);
        border-radius: 2px;
        margin: 0 auto 0.75rem;
    }

    #main-content { padding: 0.5rem; padding-bottom: 70px; }
}

@media (max-width: 480px) {
    .app-logo { font-size: 1rem; }
    .header-inner { padding: 0.4rem 0.5rem; }
    .support-btn { font-size: 0.65rem; padding: 0.2rem 0.5rem; }

    .ad-container ins {
        width: 320px !important;
        height: 50px !important;
    }
}
