/* The Hist -- ESO Combat Analytics
   britt0nia design system + Hist tree ambient theme */

:root {
    /* ── britt0nia design tokens ── */
    --bg: #161a22;
    --surface: #1e2430;
    --surface-alt: #252b38;
    --border: #3a4458;
    --pink: #e8b8c0;
    --pink-dim: #c49aa3;
    --mint: #7ec8a4;
    --mint-dim: #5ea888;
    --lavender: #b098c8;
    --lavender-dim: #8a78a8;
    --teal: #88b0b8;
    --gold: #f8e0a0;
    --bronze: #c49858;
    --bronze-dim: #a67d42;
    --azoth: #5b8dd9;
    --azoth-dim: #4a73b8;
    --text: #e8e0e8;
    --text-mid: #b0a8b8;
    --text-dim: #908898;
    --amber: #e8916e;
    --green: #7ec8a4;
    --red: #e87070;
    --orange: #e8916e;
    --blue: #5b8dd9;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

    /* ── Backward-compat aliases ── */
    --bg-primary: var(--bg);
    --bg-secondary: var(--surface);
    --bg-tertiary: var(--surface-alt);
    --bg-card: var(--surface);
    --border-accent: #4a5568;
    --text-primary: var(--text);
    --text-secondary: var(--text-mid);
    --text-muted: var(--text-dim);
    --accent-gold: var(--gold);
    --accent-amber: var(--amber);
    --accent-hover: var(--gold);
}

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

html { font-size: 16px; }

body {
    background-color: #05080a;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    min-height: 100vh;
}

h1 { font-size: 2.5rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: 1.75rem; font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.25rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem; font-weight: 600; }
.stat-value, .stat-num, [class*="mono"] { font-family: var(--font-mono); }

a {
    color: var(--mint);
    text-decoration: none;
}
a:hover { color: var(--mint-dim); }

/* === Navigation === */
nav {
    background: rgba(22, 26, 34, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-dim);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}
.nav-links a:hover { color: var(--text-mid); }
.nav-links a.active { color: var(--gold); }
.nav-badge-soon{display:inline-block;font-size:0.65rem;padding:0.1em 0.45em;margin-left:0.3em;vertical-align:middle;background:rgba(144,136,152,0.15);color:var(--text-dim);border:1px solid rgba(144,136,152,0.25);border-radius:9px;line-height:1.3;letter-spacing:0.02em;font-weight:500;}

/* === Layout === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.two-panel {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (max-width: 900px) {
    .two-panel { grid-template-columns: 1fr; }
}

/* === Cards === */
.card {
    background: rgba(10, 25, 20, 0.70);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(126, 200, 164, 0.1);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.card h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-mid);
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

/* === Form Controls === */
label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-mid);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

select {
    width: 100%;
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b0a8b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
    margin-bottom: 0.75rem;
}
select:hover { border-color: var(--mint-dim); }
select:focus { border-color: var(--mint); box-shadow: 0 0 0 2px rgba(126, 200, 164, 0.15); }

input[type="text"], input[type="number"], input[type="search"], textarea {
    width: 100%;
    background: var(--surface-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
    margin-bottom: 0.75rem;
}
input[type="text"]:focus, input[type="number"]:focus, input[type="search"]:focus, textarea:focus {
    border-color: var(--mint);
    box-shadow: 0 0 0 2px rgba(126, 200, 164, 0.15);
}

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--surface-alt);
    border-radius: 3px;
    outline: none;
    border: 1px solid var(--border);
    transition: var(--transition);
    margin-bottom: 0.5rem;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--mint);
    border: 2px solid var(--surface);
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transition: var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--mint-dim);
    transform: scale(1.15);
}
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--mint);
    border: 2px solid var(--surface);
    cursor: pointer;
}

input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    background: var(--surface-alt);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    vertical-align: middle;
    flex-shrink: 0;
}
input[type="checkbox"]:checked {
    background: var(--mint);
    border-color: var(--mint);
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid var(--bg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
input[type="checkbox"]:hover { border-color: var(--mint-dim); }

.range-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.range-row input[type="range"] { flex: 1; }

.range-value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-gold);
    min-width: 3.5rem;
    text-align: right;
}

/* === Toggle Switch === */
.toggle-group {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.toggle-btn {
    flex: 1;
    padding: 0.6rem 1rem;
    background: var(--surface-alt);
    color: var(--text-mid);
    border: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
}

.toggle-btn.active {
    background: var(--mint);
    color: var(--bg);
}

.toggle-btn:hover:not(.active) {
    background: var(--surface);
    color: var(--text);
}

/* === Primary Button === */
.btn-primary {
    width: 100%;
    padding: 10px 24px;
    background: var(--mint);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    letter-spacing: 0.03em;
}

.btn-primary:hover {
    background: var(--mint-dim);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(126, 200, 164, 0.3);
}

.btn-primary:active { transform: translateY(0); }

/* === Secondary Button === */
.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 20px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--mint-dim); background: var(--surface-alt); }

/* === Results Table === */
.results-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.875rem;
}

.results-table th {
    background: var(--surface-alt);
    color: var(--text-mid);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.results-table td {
    padding: 8px 12px;
    border-bottom: 1px solid rgba(58, 68, 88, 0.3);
    color: var(--text);
    vertical-align: middle;
    white-space: nowrap;
}

.results-table tr:hover td {
    background: rgba(30, 36, 48, 0.5);
}

.results-table tr.best td {
    color: var(--gold);
    font-weight: 600;
}

td.num { text-align: right; }

/* Table corner radius inside cards */
.results-table thead tr:first-child th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.results-table thead tr:first-child th:last-child { border-radius: 0 var(--radius-sm) 0 0; }

/* === Build Score === */
.build-score {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-bottom: 1rem;
}

.score-circle {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 1.6rem;
    font-weight: 700;
    flex-shrink: 0;
}

.score-meta { border: 3px solid var(--gold); color: var(--gold); }
.score-expert { border: 3px solid var(--mint); color: var(--mint); }
.score-proficient { border: 3px solid var(--azoth); color: var(--azoth); }
.score-developing { border: 3px solid var(--amber); color: var(--amber); }
.score-unoptimized { border: 3px solid var(--text-dim); color: var(--text-dim); }

.score-label {
    font-size: 1.1rem;
    font-weight: 600;
}

.score-sub {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* === Badge === */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-validated { background: rgba(126, 200, 164, 0.15); color: var(--mint); border: 1px solid var(--mint); }
.badge-unvalidated { background: rgba(232, 145, 110, 0.15); color: var(--amber); border: 1px solid var(--amber); }
.badge-pvp { background: rgba(232, 112, 112, 0.15); color: var(--red); border: 1px solid var(--red); }
.badge-pve { background: rgba(91, 141, 217, 0.15); color: var(--azoth); border: 1px solid var(--azoth); }

/* === Risk Tags === */
.risk-low { color: var(--green); }
.risk-medium { color: var(--orange); }
.risk-high { color: var(--red); }

/* === Hero Section === */
.hero {
    text-align: center;
    padding: 4rem 2rem 3rem;
}

.hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--gold);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.hero .tagline {
    font-size: 1.1rem;
    color: var(--text-mid);
    font-style: italic;
    margin-bottom: 3rem;
}

.features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto 3rem;
}

@media (max-width: 700px) {
    .features { grid-template-columns: 1fr; }
}

.feature-card {
    background: rgba(10, 25, 20, 0.70);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(126, 200, 164, 0.1);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: left;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.feature-card h3 {
    color: var(--mint);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.feature-card p {
    color: var(--text-mid);
    font-size: 0.9rem;
    line-height: 1.5;
}

.cta-btn {
    display: inline-block;
    padding: 0.85rem 2rem;
    background: var(--mint);
    color: var(--bg);
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 700;
    transition: var(--transition);
}

.cta-btn:hover {
    color: var(--bg);
    background: var(--mint-dim);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(126, 200, 164, 0.35);
}

/* === About Page === */
.about-content {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    background: rgba(10, 25, 20, 0.70);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(126, 200, 164, 0.1);
    border-radius: var(--radius);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    margin-top: 2rem;
}

.about-content h1 {
    color: var(--gold);
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.about-content p {
    color: var(--text-mid);
    margin-bottom: 1.25rem;
    font-size: 1rem;
    line-height: 1.75;
}

.about-content .attribution {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* === Footer === */
footer {
    text-align: center;
    padding: 24px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.8125rem;
    margin-top: 3rem;
    position: relative;
    z-index: 1;
}

/* === Skill Slot === */
.skill-slot {
    margin-bottom: 0.5rem;
}

.skill-slot select {
    margin-bottom: 0.25rem;
}

/* === Stat Contrib Bar === */
.contrib-bar {
    display: flex;
    height: 6px;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
}

.contrib-mag {
    background: var(--blue);
}

.contrib-sd {
    background: var(--accent-gold);
}

/* === Loading state === */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--mint);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* === Empty / Placeholder === */
.placeholder-text {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 2rem 1rem;
}

/* === Achievements Page === */
.achievements-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.achievements-header h1 {
    color: var(--gold);
    font-size: 1.8rem;
}

.achievement-progress {
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.progress-bar-outer {
    width: 200px;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-top: 0.4rem;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    background: linear-gradient(90deg, var(--mint), var(--teal));
    border-radius: 4px;
    transition: width 0.5s ease;
}

.achievement-filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.4rem 1rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-mid);
    font-size: 0.85rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: var(--transition);
}

.filter-btn:hover { border-color: var(--mint-dim); color: var(--text); }
.filter-btn.active { background: var(--mint); color: var(--bg); border-color: var(--mint); }

.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.achievement-card {
    background: rgba(10, 25, 20, 0.70);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(126, 200, 164, 0.1);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    position: relative;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}

.achievement-card.locked {
    opacity: 0.5;
}

.achievement-card.earned {
    border-color: var(--border-accent);
}

.achievement-card.earned.tier-gold { border-color: var(--accent-gold); }
.achievement-card.earned.tier-silver { border-color: #a8b5c4; }
.achievement-card.earned.tier-bronze { border-color: #cd7f32; }

.ach-icon {
    font-size: 2rem;
    flex-shrink: 0;
    width: 48px;
    text-align: center;
}

.ach-content { flex: 1; min-width: 0; }

.ach-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.ach-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.ach-meta {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.ach-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: auto;
}

.badge-secret { background: rgba(136, 46, 224, 0.15); color: #a855f7; border: 1px solid #a855f7; }
.badge-cat { background: rgba(88, 166, 255, 0.1); color: var(--blue); border: 1px solid transparent; font-size: 0.65rem; }
.badge-tier-bronze { background: rgba(205, 127, 50, 0.15); color: #cd7f32; border: 1px solid #cd7f32; }
.badge-tier-silver { background: rgba(168, 181, 196, 0.15); color: #a8b5c4; border: 1px solid #a8b5c4; }
.badge-tier-gold { background: rgba(212, 168, 67, 0.15); color: var(--accent-gold); border: 1px solid var(--accent-gold); }

/* === Achievement Toast Notification === */
.achievement-toast {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    animation: toastIn 0.4s ease, toastOut 0.4s ease 3.6s forwards;
    pointer-events: auto;
    min-width: 280px;
}

.toast-icon { font-size: 1.5rem; }
.toast-text { flex: 1; }
.toast-title {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gold);
}
.toast-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

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

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

/* === Sustain Gauge === */
.sustain-gauge {
    margin: 0.75rem 0;
}

.gauge-bar {
    width: 100%;
    height: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.gauge-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.5s ease;
}

.gauge-fill.sustainable { background: linear-gradient(90deg, var(--mint), var(--mint-dim)); }
.gauge-fill.borderline { background: linear-gradient(90deg, var(--amber), #c07050); }
.gauge-fill.critical { background: linear-gradient(90deg, var(--red), #c05050); }

.gauge-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* === Audit Grade Badge === */
.audit-grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    flex-shrink: 0;
}

.grade-S { border: 3px solid var(--gold); color: var(--gold); }
.grade-A { border: 3px solid var(--mint); color: var(--mint); }
.grade-B { border: 3px solid var(--teal); color: var(--teal); }
.grade-C { border: 3px solid var(--text-mid); color: var(--text-mid); }
.grade-D { border: 3px solid var(--amber); color: var(--amber); }
.grade-F { border: 3px solid var(--red); color: var(--red); }

/* === Audit Flags === */
.flag-list { list-style: none; }

.flag-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.flag-item:last-child { border-bottom: none; }

.flag-severity {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.flag-severity.critical { background: var(--red); }
.flag-severity.warning { background: var(--orange); }
.flag-severity.info { background: var(--blue); }
.flag-severity.strength { background: var(--green); }

/* === Set Bonus Badges === */
.set-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 0.3rem;
}

.set-badge-verified { background: rgba(126, 200, 164, 0.15); color: var(--mint); border: 1px solid var(--mint); }
.set-badge-effect { background: rgba(176, 152, 200, 0.15); color: var(--lavender); border: 1px solid var(--lavender); }
.set-badge-proc { background: rgba(91, 141, 217, 0.15); color: var(--azoth); border: 1px solid var(--azoth); }

/* === Tab Bar === */
.tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn:hover { color: var(--text-mid); }
.tab-btn.active {
    color: var(--text);
    border-bottom-color: var(--gold);
}

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

/* === BG Performance === */
.bg-lookup-form { max-width: 500px; }

.bg-status-banner {
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.bg-status-banner.connected {
    background: rgba(126, 200, 164, 0.1);
    color: var(--mint);
    border: 1px solid rgba(126, 200, 164, 0.3);
}

.bg-status-banner.unconfigured {
    background: rgba(232, 145, 110, 0.1);
    color: var(--amber);
    border: 1px solid rgba(232, 145, 110, 0.3);
}

.bg-status-banner.error {
    background: rgba(232, 112, 112, 0.1);
    color: var(--red);
    border: 1px solid rgba(232, 112, 112, 0.3);
}

.bg-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

@media (max-width: 700px) {
    .bg-stats-row { grid-template-columns: repeat(2, 1fr); }
}

.bg-stat-card {
    text-align: center;
    padding: 0.75rem;
    background: var(--bg-tertiary);
    border-radius: 6px;
}

.bg-stat-value {
    font-family: var(--font-mono);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gold);
}

.bg-stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.bg-skill-detail td {
    border-bottom: 1px solid var(--border);
}

/* === Hist Tree Ambient Effects === */
.hist-ambient {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
/* --- Layer 1: Luminous fog blobs --- */
.hist-fog {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    filter: blur(60px);
}
.hist-fog-1 {
    width: 700px; height: 400px;
    background: radial-gradient(circle, rgba(100,210,155,0.26) 0%, rgba(100,210,155,0.10) 55%, transparent 85%);
    top: 8%; left: 5%;
    animation: hist-fog-drift-1 70s ease-in-out infinite, hist-fog-pulse 12s ease-in-out infinite;
}
.hist-fog-2 {
    width: 600px; height: 380px;
    background: radial-gradient(circle, rgba(120,180,190,0.24) 0%, rgba(120,180,190,0.09) 55%, transparent 85%);
    top: 45%; right: 5%;
    animation: hist-fog-drift-2 80s ease-in-out infinite, hist-fog-pulse 15s ease-in-out infinite -5s;
}
.hist-fog-3 {
    width: 750px; height: 420px;
    background: radial-gradient(circle, rgba(248,224,140,0.22) 0%, rgba(248,224,140,0.08) 55%, transparent 85%);
    bottom: 15%; left: 25%;
    animation: hist-fog-drift-3 90s ease-in-out infinite, hist-fog-pulse 18s ease-in-out infinite -10s;
}
.hist-fog-4 {
    width: 550px; height: 350px;
    background: radial-gradient(circle, rgba(100,210,155,0.24) 0%, rgba(100,210,155,0.09) 55%, transparent 85%);
    top: 70%; left: 60%;
    animation: hist-fog-drift-4 65s ease-in-out infinite, hist-fog-pulse 14s ease-in-out infinite -7s;
}
@keyframes hist-fog-drift-1 {
    0%,100% { transform: translate(0,0) rotate(15deg); }
    33% { transform: translate(50px,-30px) rotate(15deg); }
    66% { transform: translate(-30px,40px) rotate(15deg); }
}
@keyframes hist-fog-drift-2 {
    0%,100% { transform: translate(0,0) rotate(-30deg); }
    33% { transform: translate(-40px,50px) rotate(-30deg); }
    66% { transform: translate(35px,-25px) rotate(-30deg); }
}
@keyframes hist-fog-drift-3 {
    0%,100% { transform: translate(0,0) rotate(45deg); }
    33% { transform: translate(45px,30px) rotate(45deg); }
    66% { transform: translate(-50px,-20px) rotate(45deg); }
}
@keyframes hist-fog-drift-4 {
    0%,100% { transform: translate(0,0) rotate(-10deg); }
    33% { transform: translate(-35px,-40px) rotate(-10deg); }
    66% { transform: translate(40px,25px) rotate(-10deg); }
}
@keyframes hist-fog-pulse {
    0%,100% { opacity: 0.55; }
    50% { opacity: 0.85; }
}

/* --- Layer 2: Enhanced sap particles --- */
.hist-mote {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    animation: hist-float linear infinite;
}
/* Small particles (8-12px) — visible dots */
.hist-mote-1  { width:8px;  height:8px;  background:rgba(126,200,164,0.80); left:6%;  bottom:-10px; animation-duration:28s; animation-delay:0s;   filter:blur(1px); box-shadow:0 0 8px rgba(126,200,164,0.60); }
.hist-mote-2  { width:10px; height:10px; background:rgba(136,176,184,0.70); left:14%; bottom:-10px; animation-duration:32s; animation-delay:3s;   filter:blur(1px); box-shadow:0 0 10px rgba(136,176,184,0.55); }
.hist-mote-3  { width:9px;  height:9px;  background:rgba(126,200,164,0.75); left:25%; bottom:-10px; animation-duration:26s; animation-delay:7s;   filter:blur(1px); box-shadow:0 0 8px rgba(126,200,164,0.60); }
.hist-mote-4  { width:11px; height:11px; background:rgba(248,224,160,0.65); left:35%; bottom:-10px; animation-duration:34s; animation-delay:1s;   filter:blur(1px); box-shadow:0 0 12px rgba(248,224,160,0.50); }
.hist-mote-5  { width:8px;  height:8px;  background:rgba(136,176,184,0.75); left:44%; bottom:-10px; animation-duration:30s; animation-delay:10s;  filter:blur(1px); box-shadow:0 0 8px rgba(136,176,184,0.60); }
.hist-mote-6  { width:10px; height:10px; background:rgba(126,200,164,0.70); left:55%; bottom:-10px; animation-duration:27s; animation-delay:5s;   filter:blur(1px); box-shadow:0 0 10px rgba(126,200,164,0.55); }
.hist-mote-7  { width:9px;  height:9px;  background:rgba(248,224,160,0.70); left:65%; bottom:-10px; animation-duration:35s; animation-delay:14s;  filter:blur(1px); box-shadow:0 0 10px rgba(248,224,160,0.55); }
.hist-mote-8  { width:11px; height:11px; background:rgba(126,200,164,0.75); left:76%; bottom:-10px; animation-duration:29s; animation-delay:8s;   filter:blur(1px); box-shadow:0 0 12px rgba(126,200,164,0.60); }
.hist-mote-9  { width:8px;  height:8px;  background:rgba(136,176,184,0.70); left:88%; bottom:-10px; animation-duration:33s; animation-delay:12s;  filter:blur(1px); box-shadow:0 0 8px rgba(136,176,184,0.55); }
.hist-mote-10 { width:10px; height:10px; background:rgba(126,200,164,0.65); left:3%;  bottom:-10px; animation-duration:31s; animation-delay:16s;  filter:blur(1px); box-shadow:0 0 10px rgba(126,200,164,0.50); }
/* Medium particles (12-15px) */
.hist-mote-11 { width:13px; height:13px; background:rgba(126,200,164,0.55); left:20%; bottom:-10px; animation-duration:36s; animation-delay:2s;   filter:blur(1px); box-shadow:0 0 14px rgba(126,200,164,0.50); --mote-peak:0.70; --mote-mid:0.50; }
.hist-mote-12 { width:14px; height:14px; background:rgba(136,176,184,0.50); left:40%; bottom:-10px; animation-duration:38s; animation-delay:9s;   filter:blur(1px); box-shadow:0 0 16px rgba(136,176,184,0.45); --mote-peak:0.65; --mote-mid:0.45; }
.hist-mote-13 { width:12px; height:12px; background:rgba(248,224,160,0.55); left:60%; bottom:-10px; animation-duration:34s; animation-delay:18s;  filter:blur(1px); box-shadow:0 0 14px rgba(248,224,160,0.50); --mote-peak:0.70; --mote-mid:0.50; }
.hist-mote-14 { width:15px; height:15px; background:rgba(126,200,164,0.50); left:80%; bottom:-10px; animation-duration:40s; animation-delay:6s;   filter:blur(1px); box-shadow:0 0 18px rgba(126,200,164,0.45); --mote-peak:0.65; --mote-mid:0.45; }
/* Large particles (22-28px) — soft atmospheric */
.hist-mote-15 { width:24px; height:24px; background:rgba(126,200,164,0.35); left:15%; bottom:-10px; animation-duration:40s; animation-delay:4s;   filter:blur(2px); box-shadow:0 0 22px rgba(126,200,164,0.30); --mote-peak:0.40; --mote-mid:0.25; }
.hist-mote-16 { width:28px; height:28px; background:rgba(136,176,184,0.30); left:50%; bottom:-10px; animation-duration:38s; animation-delay:15s;  filter:blur(2px); box-shadow:0 0 26px rgba(136,176,184,0.25); --mote-peak:0.35; --mote-mid:0.22; }
.hist-mote-17 { width:22px; height:22px; background:rgba(248,224,160,0.35); left:72%; bottom:-10px; animation-duration:36s; animation-delay:20s;  filter:blur(2px); box-shadow:0 0 20px rgba(248,224,160,0.30); --mote-peak:0.40; --mote-mid:0.25; }
.hist-mote-18 { width:26px; height:26px; background:rgba(126,200,164,0.30); left:92%; bottom:-10px; animation-duration:42s; animation-delay:11s;  filter:blur(2px); box-shadow:0 0 24px rgba(126,200,164,0.25); --mote-peak:0.35; --mote-mid:0.22; }

@keyframes hist-float {
    0%   { opacity: 0; transform: translateY(0) translateX(0); }
    10%  { opacity: var(--mote-peak, 0.70); }
    30%  { transform: translateY(-25vh) translateX(20px); }
    50%  { opacity: var(--mote-mid, 0.50); transform: translateY(-50vh) translateX(-15px); }
    70%  { transform: translateY(-75vh) translateX(12px); }
    90%  { opacity: var(--mote-peak, 0.70); }
    100% { opacity: 0; transform: translateY(-105vh) translateX(-8px); }
}

/* --- Layer 3: Firefly orbs --- */
.hist-firefly {
    position: absolute;
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
}
.hist-firefly-1  { width:6px;  height:6px;  background:#f8e0a0; left:8%;  top:30%; filter:blur(1.5px); box-shadow:0 0 6px 2px rgba(248,224,160,0.6); animation: firefly-drift-1 38s ease-in-out infinite, firefly-flicker-a 8.4s ease-in-out infinite; }
.hist-firefly-2  { width:8px;  height:8px;  background:#f0c870; left:22%; top:60%; filter:blur(2px);   box-shadow:0 0 8px 3px rgba(240,200,112,0.5); animation: firefly-drift-2 44s ease-in-out infinite, firefly-flicker-b 7.0s ease-in-out infinite; }
.hist-firefly-3  { width:5px;  height:5px;  background:#f8e0a0; left:40%; top:20%; filter:blur(1px);   box-shadow:0 0 5px 2px rgba(248,224,160,0.6); animation: firefly-drift-3 36s ease-in-out infinite, firefly-flicker-c 10.0s ease-in-out infinite; }
.hist-firefly-4  { width:9px;  height:9px;  background:#e8c06e; left:55%; top:70%; filter:blur(2px);   box-shadow:0 0 8px 3px rgba(232,192,110,0.5); animation: firefly-drift-1 42s ease-in-out infinite 6s, firefly-flicker-d 7.6s ease-in-out infinite; }
.hist-firefly-5  { width:5px;  height:5px;  background:#f8e0a0; left:70%; top:40%; filter:blur(1px);   box-shadow:0 0 5px 2px rgba(248,224,160,0.6); animation: firefly-drift-2 34s ease-in-out infinite 10s, firefly-flicker-a 9.4s ease-in-out infinite; }
.hist-firefly-6  { width:7px;  height:7px;  background:#f0c870; left:85%; top:55%; filter:blur(1.5px); box-shadow:0 0 6px 2px rgba(240,200,112,0.5); animation: firefly-drift-3 46s ease-in-out infinite 3s, firefly-flicker-c 6.4s ease-in-out infinite; }
.hist-firefly-7  { width:10px; height:10px; background:#f8e0a0; left:35%; top:80%; filter:blur(2px);   box-shadow:0 0 8px 3px rgba(248,224,160,0.5); animation: firefly-drift-1 50s ease-in-out infinite 15s, firefly-flicker-b 11.0s ease-in-out infinite; }
.hist-firefly-8  { width:4px;  height:4px;  background:#f0c870; left:92%; top:15%; filter:blur(1px);   box-shadow:0 0 4px 2px rgba(240,200,112,0.6); animation: firefly-drift-2 40s ease-in-out infinite 8s, firefly-flicker-d 8.0s ease-in-out infinite; }
.hist-firefly-9  { width:6px;  height:6px;  background:#f8e0a0; left:15%; top:12%; filter:blur(1.5px); box-shadow:0 0 6px 2px rgba(248,224,160,0.6); animation: firefly-drift-3 41s ease-in-out infinite 5s, firefly-flicker-b 9.0s ease-in-out infinite; }
.hist-firefly-10 { width:4px;  height:4px;  background:#f0c870; left:48%; top:45%; filter:blur(1px);   box-shadow:0 0 4px 2px rgba(240,200,112,0.6); animation: firefly-drift-1 37s ease-in-out infinite 12s, firefly-flicker-c 7.8s ease-in-out infinite; }
.hist-firefly-11 { width:7px;  height:7px;  background:#f8e0a0; left:78%; top:75%; filter:blur(1.5px); box-shadow:0 0 6px 2px rgba(248,224,160,0.5); animation: firefly-drift-2 48s ease-in-out infinite 2s, firefly-flicker-a 10.6s ease-in-out infinite; }
.hist-firefly-12 { width:5px;  height:5px;  background:#e8c06e; left:62%; top:18%; filter:blur(1px);   box-shadow:0 0 5px 2px rgba(232,192,110,0.6); animation: firefly-drift-3 35s ease-in-out infinite 9s, firefly-flicker-d 6.8s ease-in-out infinite; }
.hist-firefly-13 { width:8px;  height:8px;  background:#f8e0a0; left:5%;  top:85%; filter:blur(2px);   box-shadow:0 0 8px 3px rgba(248,224,160,0.5); animation: firefly-drift-1 45s ease-in-out infinite 7s, firefly-flicker-b 8.8s ease-in-out infinite; }
.hist-firefly-14 { width:4px;  height:4px;  background:#f0c870; left:30%; top:50%; filter:blur(1px);   box-shadow:0 0 4px 2px rgba(240,200,112,0.6); animation: firefly-drift-2 39s ease-in-out infinite 14s, firefly-flicker-c 11.2s ease-in-out infinite; }
.hist-firefly-15 { width:6px;  height:6px;  background:#f8e0a0; left:88%; top:35%; filter:blur(1.5px); box-shadow:0 0 6px 2px rgba(248,224,160,0.6); animation: firefly-drift-3 43s ease-in-out infinite 4s, firefly-flicker-a 7.4s ease-in-out infinite; }
.hist-firefly-16 { width:5px;  height:5px;  background:#e8c06e; left:52%; top:90%; filter:blur(1px);   box-shadow:0 0 5px 2px rgba(232,192,110,0.5); animation: firefly-drift-1 47s ease-in-out infinite 11s, firefly-flicker-d 9.6s ease-in-out infinite; }

/* Wandering drift paths — multi-axis movement */
@keyframes firefly-drift-1 {
    0%   { transform: translate(0, 0); }
    20%  { transform: translate(30px, -40px); }
    40%  { transform: translate(-20px, -80px); }
    60%  { transform: translate(50px, -30px); }
    80%  { transform: translate(-10px, -70px); }
    100% { transform: translate(0, 0); }
}
@keyframes firefly-drift-2 {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-40px, -20px); }
    50%  { transform: translate(20px, -60px); }
    75%  { transform: translate(-30px, 10px); }
    100% { transform: translate(0, 0); }
}
@keyframes firefly-drift-3 {
    0%   { transform: translate(0, 0); }
    15%  { transform: translate(25px, 30px); }
    35%  { transform: translate(-35px, -25px); }
    55%  { transform: translate(15px, -50px); }
    75%  { transform: translate(-20px, 20px); }
    100% { transform: translate(0, 0); }
}

/* Flicker patterns — soft aurora pulses */
@keyframes firefly-flicker-a {
    0%, 100% { opacity: 0.05; }
    8%       { opacity: 0.80; }
    12%      { opacity: 0.08; }
    50%      { opacity: 0.04; }
    55%      { opacity: 0.75; }
    60%      { opacity: 0.05; }
}
@keyframes firefly-flicker-b {
    0%, 100% { opacity: 0.04; }
    15%      { opacity: 0.78; }
    22%      { opacity: 0.08; }
    65%      { opacity: 0.05; }
    70%      { opacity: 0.85; }
    76%      { opacity: 0.04; }
}
@keyframes firefly-flicker-c {
    0%, 100% { opacity: 0.06; }
    20%      { opacity: 0.05; }
    30%      { opacity: 0.82; }
    36%      { opacity: 0.04; }
    78%      { opacity: 0.72; }
    84%      { opacity: 0.05; }
}
@keyframes firefly-flicker-d {
    0%, 100% { opacity: 0.04; }
    5%       { opacity: 0.88; }
    10%      { opacity: 0.06; }
    42%      { opacity: 0.70; }
    48%      { opacity: 0.08; }
    85%      { opacity: 0.80; }
    90%      { opacity: 0.04; }
}

/* Card hover glow — mystical lift + multi-layer mint emanation */
.sect {
    position: relative;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
}
#sectSkills { z-index: 10; }
.sect:hover, .card:hover, .feature-card:hover, .achievement-card:hover {
    transform: translateY(-4px);
    border-color: rgba(126, 200, 164, 0.4);
    box-shadow: 0 8px 32px rgba(126, 200, 164, 0.15),
                0 0 15px rgba(126, 200, 164, 0.12),
                0 0 60px rgba(126, 200, 164, 0.06),
                inset 0 1px 0 rgba(126, 200, 164, 0.15);
}
/* Top edge sap drip glow */
.sect::after {
    content: '';
    position: absolute;
    top: -1px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(126, 200, 164, 0.5), transparent);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}
.sect:hover::after { opacity: 1; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--surface-alt); }

/* === Selection === */
::selection { background: rgba(126, 200, 164, 0.3); color: var(--text); }

/* ═══ Sticky Stats HUD ═══ */
#statsHud {
    position: fixed;
    top: 110px;
    right: 16px;
    z-index: 45;
    background: rgba(10, 25, 20, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(126, 200, 164, 0.2);
    border-radius: 12px;
    padding: 8px 12px;
    max-width: 300px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    font-family: var(--font-body);
}
#statsHud.visible {
    opacity: 1;
    pointer-events: auto;
}
.hud-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px 12px;
}
.hud-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    white-space: nowrap;
}
.hud-stat svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}
.hud-label {
    color: var(--text-dim);
    font-weight: 500;
}
.hud-val {
    color: var(--text);
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.72rem;
}
.hud-grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    min-width: 20px;
}
.hud-collapse-btn {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.65rem;
    padding: 0 0 0 6px;
    line-height: 1;
    transition: color 0.15s;
}
.hud-collapse-btn:hover { color: var(--text); }
.hud-collapsed .hud-grid { display: none; }
.hud-collapsed { padding: 5px 10px; }
.hud-collapsed-bar {
    display: none;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: var(--text-dim);
}
.hud-collapsed .hud-collapsed-bar { display: flex; }
.hud-collapsed .hud-expand-row { display: none; }
.hud-expand-row {
    display: flex;
    justify-content: flex-end;
}
@media (max-width: 768px) {
    #statsHud { display: none !important; }
}

/* ═══ Phase 11F: Loading states & micro-interactions ═══ */

@keyframes shimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Example Build button */
.btn-example {
    border: 1px solid var(--mint); color: var(--mint); background: transparent;
    border-radius: 8px; padding: 10px 20px; cursor: pointer; margin-top: 12px;
    font-family: var(--font); font-size: 0.95rem; transition: background 0.2s, color 0.2s;
}
.btn-example:hover { background: var(--mint); color: var(--bg); }

/* Calculate button loading spinner */
.btn-calc.loading { pointer-events: none; opacity: 0.85; }
.btn-calc.loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

/* Character sheet skeleton shimmer */
#charSheetContent.loading .cs-val {
    color: transparent !important;
    background: linear-gradient(90deg, rgba(126,200,164,0.05) 25%, rgba(126,200,164,0.1) 50%, rgba(126,200,164,0.05) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
    min-width: 40px;
    display: inline-block;
}

/* Stat value change flash */
.stat-up  { color: var(--mint) !important; }
.stat-down { color: var(--amber) !important; }

/* Section expand/collapse transition */
.sect-body {
    transition: max-height 0.25s ease-out;
}
