:root {
    --bg-deep: #070d19;
    --bg-card: #0f172a;
    --bg-card-elevated: #16223b;
    --bg-glass: rgba(15, 23, 42, 0.88);
    --border-subtle: rgba(148, 163, 184, 0.14);
    --border-ice: rgba(56, 189, 248, 0.35);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    --ice-primary: #38bdf8;
    --ice-glow: rgba(56, 189, 248, 0.2);
    --gold: #f59e0b;
    --gold-bg: rgba(245, 158, 11, 0.14);
    --emerald: #10b981;
    --emerald-bg: rgba(16, 185, 129, 0.14);
    --rose: #f43f5e;
    --rose-bg: rgba(244, 63, 94, 0.14);
    --purple: #a855f7;
    --purple-bg: rgba(168, 85, 247, 0.14);
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

body {
    min-height: 100vh;
    padding-bottom: 88px;
    background:
        radial-gradient(circle at 15% 0%, rgba(56, 189, 248, 0.12), transparent 40%),
        radial-gradient(circle at 85% 10%, rgba(245, 158, 11, 0.08), transparent 35%),
        var(--bg-deep);
}

/* Sticky Top Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(7, 13, 25, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 16px;
}

.header-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alliance-crest {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #0284c7, #1e3a8a);
    border: 1px solid var(--ice-primary);
    box-shadow: 0 0 14px var(--ice-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    color: #fff;
    flex-shrink: 0;
}

.brand-titles h1 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.state-pill {
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 999px;
    background: var(--gold-bg);
    color: var(--gold);
    border: 1px solid rgba(245, 158, 11, 0.35);
    font-weight: 700;
}

.brand-sub {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.utc-badge {
    font-size: 0.74rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 5px 9px;
    border-radius: var(--radius-sm);
    color: var(--ice-primary);
    display: flex;
    align-items: center;
    gap: 5px;
}

.gen-select {
    background: var(--bg-card-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-ice);
    border-radius: var(--radius-sm);
    padding: 5px 8px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
}

.admin-link-btn {
    text-decoration: none;
    font-size: 0.74rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    padding: 5px 9px;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.admin-link-btn:hover {
    color: var(--text-main);
    border-color: var(--ice-primary);
}

/* Main Container */
.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 14px 14px 32px;
}

/* R5 Announcement Banner */
.r5-banner {
    border-radius: var(--radius-md);
    padding: 12px 15px;
    margin-bottom: 16px;
    border: 1px solid var(--border-ice);
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.14), rgba(15, 23, 42, 0.9));
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.r5-banner.urgent {
    border-color: rgba(245, 158, 11, 0.45);
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.16), rgba(15, 23, 42, 0.92));
}

.r5-banner.victory {
    border-color: rgba(16, 185, 129, 0.45);
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.16), rgba(15, 23, 42, 0.92));
}

.banner-icon {
    font-size: 1.25rem;
    line-height: 1;
    margin-top: 2px;
}

.banner-body h2 {
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
}

.banner-body p {
    font-size: 0.8rem;
    color: #cbd5e1;
}

/* Quick Search Bar */
.search-bar-wrap {
    margin-bottom: 16px;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 11px 14px 11px 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--ice-primary);
    box-shadow: 0 0 0 3px var(--ice-glow);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.95rem;
    pointer-events: none;
}

/* Desktop & Tablet Pill Navigation + Mobile Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 120;
    background: rgba(7, 13, 25, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    padding: 4px 4px env(safe-area-inset-bottom, 4px);
}

.nav-tab {
    appearance: none;
    background: none;
    border: none;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px 2px;
    gap: 3px;
    font-size: 0.67rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.nav-tab .tab-icon {
    font-size: 1.15rem;
    line-height: 1;
}

.nav-tab.active {
    color: var(--ice-primary);
    background: rgba(56, 189, 248, 0.1);
}

@media (min-width: 768px) {
    body {
        padding-bottom: 32px;
    }
    .bottom-nav {
        position: static;
        max-width: 1120px;
        margin: 0 auto 12px;
        background: var(--bg-card);
        border: 1px solid var(--border-subtle);
        border-radius: var(--radius-md);
        padding: 6px;
        gap: 6px;
    }
    .nav-tab {
        flex-direction: row;
        font-size: 0.85rem;
        padding: 9px 12px;
        gap: 8px;
    }
}

/* Tab Sections */
.tab-section {
    display: none;
    animation: fadeIn 0.18s ease-out;
}

.tab-section.active {
    display: block;
}

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

/* Sub-navigation pills (e.g. Events switcher) */
.subnav-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    margin-bottom: 16px;
    scrollbar-width: none;
}
.subnav-scroll::-webkit-scrollbar {
    display: none;
}

.sub-pill {
    appearance: none;
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    color: var(--text-muted);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s ease;
}

.sub-pill.active {
    background: var(--ice-primary);
    color: #030712;
    border-color: var(--ice-primary);
    box-shadow: 0 0 12px var(--ice-glow);
}

/* Grid & Cards */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 680px) {
    .grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 920px) {
    .grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 14px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.card-title {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-ice { background: rgba(56, 189, 248, 0.15); color: var(--ice-primary); border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-gold { background: var(--gold-bg); color: var(--gold); border: 1px solid rgba(245, 158, 11, 0.35); }
.badge-green { background: var(--emerald-bg); color: var(--emerald); border: 1px solid rgba(16, 185, 129, 0.35); }
.badge-red { background: var(--rose-bg); color: var(--rose); border: 1px solid rgba(244, 63, 94, 0.35); }
.badge-purple { background: var(--purple-bg); color: var(--purple); border: 1px solid rgba(168, 85, 247, 0.35); }

/* Lists & Callouts */
.tip-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.tip-list li {
    position: relative;
    padding-left: 20px;
    font-size: 0.86rem;
    color: #cbd5e1;
}

.tip-list li::before {
    content: "▸";
    position: absolute;
    left: 2px;
    color: var(--ice-primary);
    font-weight: bold;
}

.tip-list li strong {
    color: #fff;
}

.callout {
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-top: 12px;
    font-size: 0.83rem;
    border-left: 4px solid var(--ice-primary);
    background: rgba(56, 189, 248, 0.08);
    color: #e2e8f0;
}

.callout-warn {
    border-left-color: var(--gold);
    background: rgba(245, 158, 11, 0.09);
}

.callout-danger {
    border-left-color: var(--rose);
    background: rgba(244, 63, 94, 0.09);
}

.callout-success {
    border-left-color: var(--emerald);
    background: rgba(16, 185, 129, 0.09);
}

/* Hero Chip Lists */
.hero-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.hero-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 700;
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease;
}

.hero-chip:hover {
    transform: translateY(-1px);
}

.hero-chip.good {
    border-color: rgba(16, 185, 129, 0.45);
    background: rgba(16, 185, 129, 0.12);
    color: #a7f3d0;
}

.hero-chip.bad {
    border-color: rgba(244, 63, 94, 0.45);
    background: rgba(244, 63, 94, 0.12);
    color: #fecdd3;
}

.hero-chip.warn {
    border-color: rgba(245, 158, 11, 0.45);
    background: rgba(245, 158, 11, 0.12);
    color: #fde68a;
}

/* Interactive Battlefield Map Layout */
.map-workspace {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

@media (min-width: 860px) {
    .map-workspace {
        grid-template-columns: 1.25fr 1fr;
        align-items: start;
    }
}

.map-canvas-box {
    background: radial-gradient(circle at center, #112240 0%, #071020 100%);
    border: 1px solid var(--border-ice);
    border-radius: var(--radius-lg);
    padding: 10px;
    position: relative;
    overflow: hidden;
}

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

.map-filter-group {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.map-filter-btn {
    background: rgba(15, 23, 42, 0.85);
    color: var(--text-muted);
    border: 1px solid var(--border-subtle);
    padding: 4px 9px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.map-filter-btn.active {
    background: var(--ice-primary);
    color: #020617;
    border-color: var(--ice-primary);
}

.battle-svg {
    width: 100%;
    height: auto;
    aspect-ratio: 1 / 1;
    display: block;
    border-radius: var(--radius-md);
    background:
        linear-gradient(rgba(56, 189, 248, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 189, 248, 0.05) 1px, transparent 1px);
    background-size: 10% 10%;
    touch-action: manipulation;
}

.map-node {
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.map-node:hover {
    filter: brightness(1.22);
}

.map-node.selected .node-ring {
    stroke: #ffffff;
    stroke-width: 4px;
    stroke-dasharray: none;
}

.map-node.dimmed {
    opacity: 0.22;
}

.inspector-card {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-ice);
    border-radius: var(--radius-lg);
    padding: 16px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.35);
}

.stat-grid-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.stat-box {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}

.stat-box .label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-box .value {
    font-size: 0.92rem;
    font-weight: 800;
    color: #fff;
}

/* Ratio Bar & Calculator */
.ratio-bar {
    height: 24px;
    border-radius: 999px;
    overflow: hidden;
    display: flex;
    font-size: 0.72rem;
    font-weight: 800;
    margin: 8px 0 12px;
    border: 1px solid rgba(255,255,255,0.12);
}

.ratio-inf { background: #ef4444; color: #fff; display: flex; align-items: center; justify-content: center; }
.ratio-lanc { background: #3b82f6; color: #fff; display: flex; align-items: center; justify-content: center; }
.ratio-mark { background: #eab308; color: #0f172a; display: flex; align-items: center; justify-content: center; }

.calc-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}

.calc-input {
    background: var(--bg-deep);
    border: 1px solid var(--border-ice);
    color: #fff;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    width: 150px;
}

.preset-btn {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    padding: 7px 11px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
}

.preset-btn.active {
    border-color: var(--ice-primary);
    background: rgba(56, 189, 248, 0.16);
    color: var(--ice-primary);
}

/* Step Timeline */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.timeline-step {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-subtle);
    padding: 11px 13px;
    border-radius: var(--radius-md);
}

.step-time {
    background: var(--ice-primary);
    color: #020617;
    font-weight: 900;
    font-size: 0.74rem;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    margin-top: 2px;
}

/* Skill Tree Visualizer */
.skill-tree-row {
    display: grid;
    grid-template-columns: 70px 1fr 1fr;
    gap: 8px;
    align-items: center;
    margin-bottom: 8px;
}

.skill-choice {
    padding: 9px 11px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.skill-choice.recommended {
    border-color: var(--emerald);
    background: rgba(16, 185, 129, 0.13);
    color: #ecfdf5;
    font-weight: 700;
}

/* Schedule items */
.schedule-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-subtle);
    margin-bottom: 8px;
}

.schedule-time {
    text-align: right;
    white-space: nowrap;
}

