/* ===== CSS Variables ===== */
:root {
    --bg-deep: #070a14;
    --bg-primary: #0a0e1a;
    --bg-card: #0f1424;
    --bg-card-hover: #141a30;
    --bg-surface: #111628;
    --bg-input: #0d1220;
    --border: #1a2040;
    --border-hover: #2a3560;
    --border-gold: #d4a95344;

    --gold: #d4a953;
    --gold-light: #e8c878;
    --gold-dim: #a07d35;
    --gold-glow: #d4a95322;

    --text-primary: #e8e4dc;
    --text-secondary: #8a8fa8;
    --text-muted: #5a5f78;
    --text-bright: #f0ece4;

    --success: #4ade80;
    --error: #f87171;
    --info: #60a5fa;

    --font-display: 'Cinzel', 'Georgia', serif;
    --font-body: 'Outfit', 'Segoe UI', sans-serif;

    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-gold: 0 0 20px rgba(212, 169, 83, 0.1);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
}

/* ===== Grain Overlay ===== */
.grain-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; z-index: 9999; opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat; background-size: 256px 256px;
}

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

/* ===== Header ===== */
.site-header {
    background: linear-gradient(180deg, rgba(15, 20, 36, 0.98) 0%, rgba(10, 14, 26, 0.95) 100%);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    backdrop-filter: blur(16px);
}
.header-inner {
    max-width: 1280px; margin: 0 auto; padding: 16px 24px;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.logo-area { display: flex; flex-direction: column; gap: 2px; }
.site-title {
    font-family: var(--font-display); font-size: 1.6rem; font-weight: 700;
    letter-spacing: 0.05em; color: var(--text-bright); line-height: 1.2;
}
.site-title .accent { color: var(--gold); text-shadow: 0 0 20px rgba(212, 169, 83, 0.3); }
.site-subtitle { font-size: 0.78rem; color: var(--text-muted); font-weight: 400; letter-spacing: 0.02em; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
    border: none; border-radius: var(--radius); font-family: var(--font-body);
    font-size: 0.875rem; font-weight: 600; cursor: pointer;
    transition: all var(--transition); white-space: nowrap;
}
.btn-gold {
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
    color: #0a0e1a; box-shadow: 0 2px 12px rgba(212, 169, 83, 0.25);
}
.btn-gold:hover {
    background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
    box-shadow: 0 4px 20px rgba(212, 169, 83, 0.4); transform: translateY(-1px);
}

/* ===== Stats Bar ===== */
.stats-bar { background: var(--bg-primary); border-bottom: 1px solid var(--border); }
.stats-inner {
    max-width: 1280px; margin: 0 auto; padding: 16px 24px;
    display: flex; align-items: center; gap: 24px; overflow-x: auto;
}
.stat-item { display: flex; flex-direction: column; align-items: center; min-width: 120px; flex: 1; }
.stat-value {
    font-family: var(--font-display); font-size: 1.25rem; font-weight: 700;
    color: var(--gold); min-width: 60px; text-align: center;
}
.stat-label {
    font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.08em; font-weight: 500; margin-top: 2px;
}
.stat-divider { width: 1px; height: 32px; background: var(--border); flex-shrink: 0; }

/* ===== Main Content ===== */
.main-content { max-width: 1280px; margin: 0 auto; padding: 0 24px 48px; }

/* ===== View Toggle ===== */
.view-toggle-bar { padding: 24px 0 16px; display: flex; justify-content: flex-start; }
.view-toggles {
    display: flex; gap: 4px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius); padding: 4px;
}
.view-toggle {
    display: flex; align-items: center; gap: 6px; padding: 8px 20px;
    border: none; border-radius: 6px; background: transparent;
    color: var(--text-secondary); font-family: var(--font-body);
    font-size: 0.875rem; font-weight: 500; cursor: pointer;
    transition: all var(--transition);
}
.view-toggle:hover { color: var(--text-primary); }
.view-toggle.active {
    background: var(--gold); color: #0a0e1a; font-weight: 600;
    box-shadow: 0 2px 8px rgba(212, 169, 83, 0.25);
}
.view-panel { display: none; }
.view-panel.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Character Portrait Grid ===== */
.char-grid-wrapper {
    margin-bottom: 16px;
}
.char-grid-wrapper > .filter-label {
    display: block;
    margin-bottom: 8px;
}
.char-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.char-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 6px 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 64px;
    text-align: center;
}
.char-grid-item:hover {
    border-color: var(--gold-dim);
    background: rgba(212, 175, 55, 0.05);
}
.char-grid-item.active {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.12);
    box-shadow: 0 0 8px var(--gold-glow);
}
.char-grid-portrait {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
}
.char-grid-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.char-grid-portrait span {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.char-grid-all {
    color: var(--text-secondary);
}
.char-grid-name {
    font-size: 0.6rem;
    color: var(--text-secondary);
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}
.char-grid-item.active .char-grid-name {
    color: var(--gold);
}

/* ===== Filters ===== */
.filter-bar, .leaderboard-filters {
    display: flex; flex-wrap: wrap; gap: 16px; padding: 16px 20px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.filter-group-grow { flex: 1; min-width: 160px; }
.filter-toggle-group { min-width: auto; align-items: center; }
.filter-label {
    font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.06em; font-weight: 600;
}
.filter-select, .filter-input {
    background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px;
    color: var(--text-primary); font-family: var(--font-body); font-size: 0.85rem;
    padding: 8px 12px; transition: border-color var(--transition); outline: none;
}
.filter-select:focus, .filter-input:focus { border-color: var(--gold-dim); box-shadow: 0 0 0 2px var(--gold-glow); }
.filter-select option { background: var(--bg-card); color: var(--text-primary); }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 24px; transition: all var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute; width: 18px; height: 18px;
    left: 2px; bottom: 2px; background: var(--text-secondary);
    border-radius: 50%; transition: all var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--gold); border-color: var(--gold); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); background: #0a0e1a; }

/* ===== Typeahead ===== */
.typeahead-wrap {
    position: relative;
}
.typeahead-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
.typeahead-option {
    padding: 8px 12px;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s ease;
}
.typeahead-option:hover,
.typeahead-option.active {
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold);
}

/* ===== Encounter Cards ===== */
.encounter-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px 20px;
    margin-bottom: 10px; cursor: pointer;
    transition: all var(--transition); position: relative; overflow: hidden;
}
.encounter-card::before {
    content: ''; position: absolute; top: 0; left: 0;
    width: 3px; height: 100%; background: var(--gold);
    opacity: 0; transition: opacity var(--transition);
}
.encounter-card:hover {
    border-color: var(--border-hover); background: var(--bg-card-hover);
    box-shadow: var(--shadow-gold); transform: translateY(-1px);
}
.encounter-card:hover::before { opacity: 1; }
.encounter-card-top {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 12px; margin-bottom: 10px;
}
.encounter-name {
    font-family: var(--font-display); font-size: 1.05rem;
    font-weight: 600; color: var(--text-bright);
}
.encounter-meta { display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.encounter-meta-item { display: flex; align-items: center; gap: 4px; font-size: 0.8rem; color: var(--text-secondary); }
.encounter-meta-item svg { width: 14px; height: 14px; flex-shrink: 0; }
.encounter-duration {
    font-family: 'Outfit', monospace; font-weight: 600;
    color: var(--gold-light); font-size: 0.85rem;
}
.completed-badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 8px; border-radius: 4px; font-size: 0.72rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.completed-badge.success { background: rgba(74, 222, 128, 0.1); color: var(--success); border: 1px solid rgba(74, 222, 128, 0.2); }
.completed-badge.failed { background: rgba(248, 113, 113, 0.1); color: var(--error); border: 1px solid rgba(248, 113, 113, 0.2); }

/* ===== Party Row ===== */
.party-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.party-member {
    display: flex; align-items: flex-start; gap: 6px;
    padding: 6px 10px; background: var(--bg-surface);
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.78rem; transition: all var(--transition); min-width: 0;
}
.party-member:hover { border-color: var(--border-hover); }
.char-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.char-name { color: var(--text-primary); font-weight: 500; white-space: nowrap; }
.player-name { color: var(--text-muted); font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-member-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.party-member-top { display: flex; align-items: center; gap: 6px; }
.party-dps { color: var(--gold); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; margin-left: auto; }
.party-dps-bar { width: 100%; height: 3px; background: var(--bg-primary); border-radius: 2px; overflow: hidden; }
.party-dps-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); border-radius: 2px; transition: width 0.3s ease; }

/* Character Portrait (small, in cards) */
.char-portrait-sm {
    width: 24px; height: 24px; border-radius: 4px;
    object-fit: cover; flex-shrink: 0; margin-top: 2px;
    border: 1px solid var(--border);
}

/* ===== Leaderboard (legacy — kept for encounter cards elsewhere) ===== */
.leaderboard-rank {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%;
    font-family: var(--font-display); font-weight: 700;
    font-size: 0.8rem; flex-shrink: 0; margin-right: 12px;
}
.leaderboard-rank.rank-1 { background: linear-gradient(135deg, #ffd700, #b8860b); color: #1a0f00; box-shadow: 0 0 12px rgba(255, 215, 0, 0.3); }
.leaderboard-rank.rank-2 { background: linear-gradient(135deg, #c0c0c0, #808080); color: #1a1a1a; }
.leaderboard-rank.rank-3 { background: linear-gradient(135deg, #cd7f32, #8b4513); color: #1a0f00; }
.leaderboard-rank.rank-other { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }
.leaderboard-card { display: flex; align-items: center; }

/* ===== Leaderboard v2 — Quest → Character → Top Players ===== */
.lb-quest-section { margin-bottom: 8px; }
.lb-quest-header {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 14px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text-primary); font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: background var(--transition), border-color var(--transition);
    text-align: left;
}
.lb-quest-header:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.lb-quest-name { flex: 1; font-family: var(--font-display); font-size: 0.9rem; }
.lb-quest-count { color: var(--text-muted); font-size: 0.75rem; font-weight: 400; font-family: var(--font-body); }
.lb-quest-meta { color: var(--text-muted); font-size: 0.72rem; font-weight: 400; white-space: nowrap; }
.lb-chevron { color: var(--text-muted); flex-shrink: 0; transition: transform var(--transition); }
.lb-quest-header.open .lb-chevron { transform: rotate(180deg); }
.lb-quest-body {
    display: none; padding: 8px 0 4px 0;
}
.lb-quest-body.open { display: block; }

.lb-char-group {
    margin: 0 0 10px 0; padding: 10px 12px;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
}
.lb-char-header {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 8px; padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.lb-char-name {
    font-size: 0.82rem; font-weight: 600; color: var(--text-primary);
}

.lb-entries { display: flex; flex-direction: column; gap: 3px; }
.lb-entry {
    display: flex; align-items: center; gap: 8px;
    padding: 4px 6px; border-radius: 4px;
    cursor: pointer; transition: background var(--transition);
    font-size: 0.78rem;
}
.lb-entry:hover { background: var(--bg-card-hover); }

.lb-rank {
    display: inline-flex; align-items: center; justify-content: center;
    width: 20px; height: 20px; border-radius: 50%;
    font-family: var(--font-display); font-weight: 700;
    font-size: 0.65rem; flex-shrink: 0;
}
.lb-rank.rank-1 { background: linear-gradient(135deg, #ffd700, #b8860b); color: #1a0f00; box-shadow: 0 0 8px rgba(255, 215, 0, 0.25); }
.lb-rank.rank-2 { background: linear-gradient(135deg, #c0c0c0, #808080); color: #1a1a1a; }
.lb-rank.rank-3 { background: linear-gradient(135deg, #cd7f32, #8b4513); color: #1a0f00; }
.lb-rank.rank-other { background: var(--bg-surface); color: var(--text-muted); border: 1px solid var(--border); }

.lb-player {
    flex: 0 0 auto; min-width: 80px; max-width: 160px;
    color: var(--text-secondary); font-size: 0.76rem;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lb-bar-cell { flex: 1; min-width: 40px; }
.lb-bar {
    width: 100%; height: 4px;
    background: var(--bg-primary); border-radius: 2px; overflow: hidden;
}
.lb-bar-fill {
    height: 100%; border-radius: 2px;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold));
    transition: width 0.3s ease;
}
.lb-dps {
    flex-shrink: 0; min-width: 48px; text-align: right;
    color: var(--gold); font-size: 0.76rem; font-weight: 600;
    letter-spacing: 0.02em;
}

/* ===== Pagination ===== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 24px 0; }
.page-btn {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: 6px;
    background: var(--bg-card); color: var(--text-secondary);
    font-family: var(--font-body); font-size: 0.85rem;
    cursor: pointer; transition: all var(--transition);
}
.page-btn:hover:not(:disabled) { border-color: var(--gold-dim); color: var(--gold); background: var(--bg-card-hover); }
.page-btn.active { background: var(--gold); border-color: var(--gold); color: #0a0e1a; font-weight: 600; }
.page-btn:disabled { opacity: 0.3; cursor: default; }
.page-info { color: var(--text-muted); font-size: 0.8rem; padding: 0 8px; }

/* ===== Modal ===== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
    z-index: 1000; display: none; align-items: flex-start;
    justify-content: center; padding: 24px; overflow-y: auto;
}
.modal-overlay.open { display: flex; animation: fadeIn 0.2s ease; }
.modal {
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius-xl); width: 100%; max-width: 560px;
    max-height: none; margin: 40px 0;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}
.modal-detail { max-width: 820px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px; border-bottom: 1px solid var(--border);
    position: sticky; top: 0; background: var(--bg-primary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0; z-index: 10;
}
.modal-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; color: var(--text-bright); }
.modal-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.5rem; cursor: pointer; padding: 0 4px;
    transition: color var(--transition); line-height: 1;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 24px; }

/* ===== Upload Zone ===== */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius-lg);
    padding: 48px 24px; text-align: center; cursor: pointer;
    transition: all var(--transition);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--gold-dim); background: var(--gold-glow); }
.upload-icon { color: var(--gold); margin-bottom: 16px; }
.upload-text { font-size: 1rem; color: var(--text-primary); margin-bottom: 4px; }
.upload-subtext { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 12px; }
.upload-path { font-size: 0.78rem; color: var(--text-muted); }
.upload-path code { background: var(--bg-card); padding: 2px 6px; border-radius: 4px; color: var(--gold); font-size: 0.76rem; }
.progress-bar { width: 100%; height: 6px; background: var(--bg-card); border-radius: 3px; overflow: hidden; margin-bottom: 12px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 3px; width: 0%; transition: width 0.3s ease; }
.progress-text { font-size: 0.85rem; color: var(--text-secondary); text-align: center; }
.progress-detail { font-size: 0.72rem; color: var(--text-muted); text-align: center; margin-top: 6px; min-height: 1em; font-variant-numeric: tabular-nums; }
.upload-result { text-align: center; padding: 16px; }
.upload-result.success { color: var(--success); }
.upload-result.error { color: var(--error); }
.upload-result .result-icon { font-size: 2rem; margin-bottom: 8px; }
.upload-result .result-text { font-size: 0.95rem; font-weight: 500; }

/* ===== Detail Modal — Header Info ===== */
.detail-header-info { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.detail-info-item { display: flex; flex-direction: column; gap: 2px; }
.detail-info-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.detail-info-value { font-size: 0.95rem; color: var(--text-primary); font-weight: 500; }
.section-label {
    font-family: var(--font-display); font-size: 0.9rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px;
}

/* ===== Detail Player Cards (Enhanced) ===== */
.detail-players { display: flex; flex-direction: column; gap: 10px; }
.detail-player-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
}
.detail-player-header {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px; cursor: pointer;
    transition: background var(--transition);
}
.detail-player-header:hover { background: var(--bg-card-hover); }

/* Character Portrait (detail) */
.char-portrait-detail {
    width: 40px; height: 40px; border-radius: 6px;
    object-fit: cover; flex-shrink: 0;
    border: 2px solid var(--border);
}
.detail-player-slot {
    width: 40px; height: 40px; display: flex; align-items: center;
    justify-content: center; background: var(--bg-surface);
    border-radius: 6px; font-size: 0.75rem; font-weight: 700;
    color: var(--text-muted); flex-shrink: 0;
}
.detail-player-meta { flex: 1; min-width: 0; }
.detail-player-char {
    font-weight: 600; color: var(--text-bright); font-size: 0.95rem;
    display: flex; align-items: center; gap: 6px;
}
.detail-player-name { font-size: 0.8rem; color: var(--text-secondary); }
.detail-player-dps-big { text-align: right; flex-shrink: 0; }
.dps-number { font-size: 1.1rem; font-weight: 700; color: var(--gold); display: block; line-height: 1.2; }
.dps-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.detail-dmg-summary { text-align: right; flex-shrink: 0; min-width: 90px; }
.dmg-total { font-size: 0.78rem; color: var(--text-secondary); display: block; }
.dmg-pct { font-size: 0.72rem; color: var(--gold-dim); font-weight: 600; }
.expand-chevron {
    flex-shrink: 0; color: var(--text-muted);
    transition: transform var(--transition);
}

/* Detail Player Body */
.detail-player-body {
    border-top: 1px solid var(--border); padding: 16px;
    background: var(--bg-surface);
}
.detail-stats-grid {
    display: grid; grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 8px; margin-bottom: 16px; padding: 8px 10px;
    background: var(--bg-card); border-radius: 6px;
    border: 1px solid var(--border);
}
.detail-stat { display: flex; flex-direction: column; gap: 1px; }
.detail-stat-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.detail-stat-value { font-size: 0.82rem; color: var(--text-primary); font-weight: 600; }

/* ===== Player Tabs (Skills / Build) ===== */
.player-tabs {
    display: flex; gap: 2px; margin-bottom: 12px;
    background: var(--bg-card); border-radius: 6px;
    padding: 3px; border: 1px solid var(--border);
}
.player-tab {
    display: flex; align-items: center; gap: 5px;
    padding: 6px 14px; border: none; border-radius: 4px;
    background: transparent; color: var(--text-secondary);
    font-family: var(--font-body); font-size: 0.78rem;
    font-weight: 500; cursor: pointer;
    transition: all var(--transition); flex: 1;
    justify-content: center;
}
.player-tab:hover { color: var(--text-primary); }
.player-tab.active {
    background: var(--gold); color: #0a0e1a; font-weight: 600;
}
.player-tab-panel { display: none; }
.player-tab-panel.active { display: block; animation: fadeIn 0.2s ease; }

/* ===== Skill Breakdown Table ===== */
.skill-table { font-size: 0.78rem; }
.skill-header {
    display: grid;
    grid-template-columns: minmax(120px, 1.5fr) 1fr 50px 70px 45px;
    gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.68rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.skill-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.5fr) 1fr 50px 70px 45px;
    gap: 8px; padding: 5px 0; align-items: center;
    border-bottom: 1px solid rgba(26, 32, 64, 0.5);
    transition: background var(--transition);
}
.skill-row:hover { background: rgba(212, 169, 83, 0.04); }
.skill-name { color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skill-bar-cell { display: flex; align-items: center; }
.skill-bar { width: 100%; height: 6px; background: var(--bg-card); border-radius: 3px; overflow: hidden; }
.skill-bar-fill {
    height: 100%; border-radius: 3px;
    background: linear-gradient(90deg, var(--gold-dim), var(--gold));
}
.skill-bar-fill.skill-bar-capping {
    background: linear-gradient(90deg, #2d7a3a, #4caf50);
}
.skill-bar-fill.skill-bar-undercap {
    background: linear-gradient(90deg, #9a3333, #e05555);
}
.skill-bar-fill.skill-bar-partial {
    background: linear-gradient(90deg, #8a7a2a, #d4a926);
}
.skill-bar-fill.skill-bar-noformula {
    background: linear-gradient(90deg, #4a4a4a, #6a6a6a);
}
.skill-bar-fill.skill-bar-capping-lowcap {
    background: linear-gradient(90deg, #4a90c2, #6bb3e0) !important;
}
.skill-hits { color: var(--text-muted); text-align: right; font-size: 0.72rem; }
.skill-dmg { color: var(--text-primary); text-align: right; font-weight: 600; }
.skill-pct { color: var(--gold); text-align: right; font-weight: 600; }

/* ===== Expandable Skill Rows ===== */
.skill-row-wrapper {
    border-bottom: 1px solid rgba(26, 32, 64, 0.5);
}
.skill-row-wrapper .skill-row {
    border-bottom: none;
    cursor: pointer;
    grid-template-columns: minmax(120px, 1.5fr) 1fr 50px 70px 45px 20px;
    gap: 8px;
    border-radius: 4px;
    padding: 5px 2px;
    user-select: none;
}
.skill-row-wrapper .skill-row:hover {
    background: rgba(212, 169, 83, 0.07);
}
.skill-expand-icon {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: transform var(--transition);
    flex-shrink: 0;
}
.skill-row-wrapper.expanded .skill-expand-icon {
    transform: rotate(180deg);
}

/* Detail Panel */
.skill-detail-panel {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    background: rgba(10, 14, 26, 0.6);
    border-left: 2px solid var(--border-gold);
    margin: 0 0 4px 4px;
    border-radius: 0 0 var(--radius) var(--radius);
}
.skill-detail-section {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(26, 32, 64, 0.5);
}
.skill-detail-section:last-child { border-bottom: none; }
.skill-detail-title {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--text-muted);
    margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}

/* Actual Stats Grid */
.skill-actual-grid {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.skill-actual-item {
    display: flex; flex-direction: column; gap: 1px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 5px 10px; min-width: 60px;
}
.sdi-label { font-size: 0.62rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.sdi-value { font-size: 0.82rem; font-weight: 600; color: var(--text-bright); }

/* Formula Table */
.skill-formula-table {
    width: 100%; border-collapse: collapse; font-size: 0.74rem;
}
.skill-formula-table thead th {
    color: var(--text-muted); font-weight: 600; font-size: 0.65rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 3px 6px; text-align: right; border-bottom: 1px solid var(--border);
}
.skill-formula-table thead th:first-child { text-align: left; }
.skill-formula-table tbody td {
    padding: 4px 6px; text-align: right;
    border-bottom: 1px solid rgba(26, 32, 64, 0.3);
    vertical-align: middle;
}
.skill-formula-table tbody tr:last-child td { border-bottom: none; }
.skill-formula-table tbody td.sft-hit { text-align: left; color: var(--text-secondary); font-size: 0.72rem; }
.skill-formula-table tbody td.sft-ratio { color: var(--text-muted); }
.skill-formula-table tbody td.sft-crit { font-weight: 600; color: var(--text-bright); }
.skill-formula-table tbody td.sft-nocrit { color: var(--text-secondary); }
.skill-formula-table tbody td.sft-cap { color: var(--text-muted); }
.skill-formula-table tbody td.sft-info { padding: 0 2px; width: 22px; text-align: center; }

/* Cap status row colors */
.cap-status-capping td.sft-crit { color: var(--success) !important; }
.cap-status-close td.sft-crit { color: #facc15 !important; }
.cap-status-under td.sft-crit { color: var(--error) !important; }
/* When cap-status class is on the td itself (preview table per-cell coloring) */
td.sft-crit.cap-status-capping { color: var(--success) !important; }
td.sft-crit.cap-status-close { color: #facc15 !important; }
td.sft-crit.cap-status-under { color: var(--error) !important; }

/* Formula tooltip */
.formula-help {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; border-radius: 50%;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.62rem; font-weight: 700;
    cursor: pointer; font-family: var(--font-body);
    transition: border-color var(--transition), color var(--transition);
    text-transform: none; letter-spacing: 0;
}
.formula-help:hover {
    border-color: var(--gold-dim); color: var(--gold);
}

/* Row-level info button */
.row-tip-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 16px; height: 16px; min-width: 16px; border-radius: 50%;
    background: var(--bg-surface); border: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.6rem; font-weight: 700;
    cursor: pointer; font-family: var(--font-body);
    padding: 0; margin-left: 4px; vertical-align: middle;
    transition: border-color var(--transition), color var(--transition), background var(--transition);
    line-height: 1;
}
.row-tip-btn:hover {
    border-color: var(--gold-dim); color: var(--gold); background: var(--bg-card-hover);
}

/* Cap bars */
.skill-cap-list { display: flex; flex-direction: column; gap: 5px; }
.skill-cap-row {
    display: grid;
    grid-template-columns: minmax(80px, 1.2fr) 1fr 40px 70px;
    gap: 6px; align-items: center; font-size: 0.73rem;
}
.skill-cap-label { color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skill-cap-bar-wrap {
    height: 5px; background: var(--bg-card); border-radius: 3px; overflow: hidden;
}
.skill-cap-bar {
    height: 100%; border-radius: 3px; transition: width 0.4s ease;
}
.cap-bar-green { background: linear-gradient(90deg, #22c55e, #4ade80); }
.cap-bar-yellow { background: linear-gradient(90deg, #ca8a04, #facc15); }
.cap-bar-red { background: linear-gradient(90deg, #dc2626, #f87171); }
.skill-cap-pct { color: var(--text-secondary); text-align: right; font-size: 0.72rem; }
.skill-cap-num { color: var(--text-muted); text-align: right; font-size: 0.7rem; }

/* Cap badges */
.cap-badge {
    display: inline-block; padding: 1px 6px; border-radius: 4px;
    font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
}
.cap-badge-green { background: rgba(74, 222, 128, 0.12); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.25); }
.cap-badge-red { background: rgba(248, 113, 113, 0.12); color: #f87171; border: 1px solid rgba(248, 113, 113, 0.25); }

/* Suggestions */
.skill-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.suggestion-pill {
    display: inline-flex; align-items: center; gap: 4px;
    background: rgba(212, 169, 83, 0.08); border: 1px solid rgba(212, 169, 83, 0.2);
    border-radius: 20px; padding: 3px 10px 3px 8px;
    font-size: 0.72rem; color: var(--text-secondary);
    transition: background var(--transition);
}
.suggestion-pill:hover { background: rgba(212, 169, 83, 0.14); }
.suggestion-pill.active {
    background: rgba(212, 169, 83, 0.25);
    border-color: var(--gold);
    color: var(--gold-light);
    box-shadow: 0 0 8px rgba(212, 169, 83, 0.2);
    cursor: pointer;
}
.suggestion-pill { cursor: pointer; }
.suggestion-pct { color: var(--gold); font-weight: 700; font-size: 0.7rem; }
.glass-cannon-cap-note {
    font-size: 0.65rem; color: var(--text-muted); margin-left: 2px;
}
.suggestion-pill-cap {
    background: rgba(100, 180, 255, 0.08); border-color: rgba(100, 180, 255, 0.25);
}
.suggestion-pill-cap:hover {
    background: rgba(100, 180, 255, 0.16);
}
.suggestion-pill-cap.active {
    background: rgba(100, 180, 255, 0.25);
    border-color: #64b4ff;
    color: #a0d0ff;
    box-shadow: 0 0 8px rgba(100, 180, 255, 0.2);
}
.suggestion-pill-cap .suggestion-pct {
    color: #64b4ff;
}
.suggestion-divider {
    display: inline-flex; align-items: center;
    font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); padding: 0 2px;
    opacity: 0.6;
}
.suggestion-divider::before,
.suggestion-divider::after {
    content: ''; display: inline-block;
    width: 10px; height: 1px;
    background: var(--text-muted); opacity: 0.4;
    margin: 0 4px;
}

/* No formula note */
.skill-no-formula {
    font-size: 0.71rem; color: var(--text-muted); font-style: italic; margin-top: 6px;
}

/* Update header to match new column layout */
.skill-table .skill-header {
    grid-template-columns: minmax(120px, 1.5fr) 1fr 50px 70px 45px 20px;
}


.build-section { margin-bottom: 16px; }
.build-section:last-child { margin-bottom: 0; }
.build-section-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.75rem; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    font-weight: 600; margin-bottom: 8px;
}
.build-section-label svg { color: var(--gold-dim); }
.count-badge {
    background: var(--bg-card); padding: 1px 6px;
    border-radius: 10px; font-size: 0.68rem;
    color: var(--gold); border: 1px solid var(--border);
}

/* Weapon Card */
.weapon-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 12px; position: relative;
    border-left: 3px solid var(--gold);
}
.weapon-name { font-weight: 600; color: var(--text-bright); font-size: 0.88rem; margin-bottom: 4px; }
.weapon-details {
    display: flex; flex-wrap: wrap; gap: 8px;
    font-size: 0.75rem; color: var(--text-secondary);
}
.weapon-stars { color: var(--gold); letter-spacing: 1px; }
.weapon-traits { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.weapon-trait {
    font-size: 0.72rem; color: var(--info);
    background: rgba(96, 165, 250, 0.08);
    padding: 2px 8px; border-radius: 4px;
    border: 1px solid rgba(96, 165, 250, 0.15);
}

/* Sigils Grid — Compact trait-only layout */
.sigils-grid { display: flex; flex-direction: column; gap: 3px; }
.sigil-row {
    display: flex; align-items: center; gap: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; padding: 4px 10px;
    transition: background var(--transition);
}
.sigil-row:hover { background: var(--bg-card-hover); }
.sigil-trait-cell {
    display: flex; align-items: center; gap: 5px;
    flex: 1; min-width: 0; font-size: 0.78rem;
}
.sigil-trait-name {
    color: var(--text-primary); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sigil-trait-lv {
    color: var(--gold); font-weight: 600; font-size: 0.72rem;
    white-space: nowrap; flex-shrink: 0;
}
.sigil-divider {
    width: 1px; height: 20px; background: var(--border);
    margin: 0 4px; flex-shrink: 0;
}
.boost-indicator {
    display: inline-block;
    font-size: 0.6rem; font-weight: 700;
    color: var(--success); margin-left: 2px;
    vertical-align: super;
}

/* Sigil Booster Badge */
.sigil-booster-badge {
    font-size: 0.68rem; font-weight: 700;
    color: var(--success); background: rgba(74, 222, 128, 0.1);
    padding: 2px 8px; border-radius: 4px;
    border: 1px solid rgba(74, 222, 128, 0.2);
    white-space: nowrap;
}
.booster-badge {
    background: rgba(74, 222, 128, 0.1) !important;
    color: var(--success) !important;
    border-color: rgba(74, 222, 128, 0.2) !important;
}
.booster-badge-sm {
    background: rgba(74, 222, 128, 0.1) !important;
    color: var(--success) !important;
    border-color: rgba(74, 222, 128, 0.2) !important;
    font-size: 0.62rem !important;
}

/* Crit Warpath label */
.crit-warpath {
    background: linear-gradient(135deg, #e84393, #fd79a8) !important;
    color: #fff !important;
    font-size: 0.58rem;
}

/* Legacy compat (keep for other uses) */
.sigil-item {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; padding: 8px 10px;
}
.sigil-main { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sigil-name { font-weight: 500; color: var(--text-primary); font-size: 0.8rem; }
.sigil-level { font-size: 0.72rem; color: var(--gold); font-weight: 600; flex-shrink: 0; }
.sigil-traits { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.sigil-trait {
    font-size: 0.68rem; color: var(--text-muted);
    background: var(--bg-surface); padding: 1px 6px;
    border-radius: 3px; border: 1px solid var(--border);
}

/* Overmasteries */
.om-list { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.om-item {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; padding: 6px 10px;
}
.om-name { font-size: 0.75rem; color: var(--text-secondary); }
.om-value { font-size: 0.78rem; color: var(--gold); font-weight: 600; }

.no-data-text { color: var(--text-muted); font-size: 0.85rem; text-align: center; padding: 16px; }

/* ===== Sigil Icons ===== */
.sigil-icon {
    width: 24px; height: 24px; border-radius: 4px;
    object-fit: contain; flex-shrink: 0;
    image-rendering: auto;
}
.sigil-name-with-icon {
    display: flex; align-items: center; gap: 8px;
    min-width: 0;
}
.trait-icon-sm {
    width: 16px; height: 16px; border-radius: 2px;
    object-fit: contain; flex-shrink: 0;
    vertical-align: middle; margin-right: 3px;
}
.trait-icon-xs {
    width: 28px; height: 28px; border-radius: 3px;
    object-fit: contain; flex-shrink: 0;
    vertical-align: middle;
}

/* ===== Trait Summary Table ===== */
.trait-summary-table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.trait-summary-header {
    display: grid;
    grid-template-columns: minmax(140px, 1.5fr) 1fr 90px;
    gap: 8px; padding: 7px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted); font-size: 0.68rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.trait-summary-row {
    display: grid;
    grid-template-columns: minmax(140px, 1.5fr) 1fr 90px;
    gap: 8px; padding: 6px 12px;
    align-items: center;
    border-bottom: 1px solid rgba(26, 32, 64, 0.4);
    transition: background var(--transition);
}
.trait-summary-row:last-child { border-bottom: none; }
.trait-summary-row:hover { background: rgba(212, 169, 83, 0.04); }

/* Maxed traits — gold highlight */
.trait-summary-row.trait-maxed {
    background: rgba(212, 169, 83, 0.06);
}
.trait-summary-row.trait-maxed:hover {
    background: rgba(212, 169, 83, 0.1);
}
.trait-summary-row.trait-maxed .trait-summary-name {
    color: var(--gold-light); font-weight: 600;
}
.trait-summary-row.trait-maxed .trait-summary-level {
    color: var(--gold-light); font-weight: 700;
}
.trait-summary-row.trait-maxed .trait-summary-bar-fill {
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    box-shadow: 0 0 6px rgba(212, 169, 83, 0.4);
}

/* Partial traits */
.trait-summary-row.trait-partial .trait-summary-name { color: var(--text-primary); }
.trait-summary-row.trait-partial .trait-summary-level { color: var(--text-secondary); }
.trait-summary-row.trait-partial .trait-summary-bar-fill {
    background: linear-gradient(90deg, var(--info), #81b5f7);
}

/* Unknown cap traits */
.trait-summary-row.trait-unknown-cap .trait-summary-name { color: var(--text-secondary); }
.trait-summary-row.trait-unknown-cap .trait-summary-level { color: var(--text-muted); }
.trait-summary-row.trait-unknown-cap .trait-summary-bar-fill {
    background: var(--text-muted); opacity: 0.5;
}

.trait-summary-name {
    font-size: 0.78rem; font-weight: 500;
    display: flex; align-items: center; gap: 4px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.trait-summary-bar-cell {
    display: flex; align-items: center;
}
.trait-summary-bar {
    width: 100%; height: 6px;
    background: var(--bg-card); border-radius: 3px;
    overflow: hidden;
}
.trait-summary-bar-fill {
    height: 100%; border-radius: 3px;
    transition: width 0.3s ease;
}
.trait-summary-level {
    font-size: 0.78rem; font-weight: 600;
    text-align: right; white-space: nowrap;
    display: flex; align-items: center; justify-content: flex-end; gap: 4px;
}
.trait-cap-label {
    display: inline-block;
    background: linear-gradient(135deg, var(--gold), var(--gold-dim));
    color: #0a0e1a; font-size: 0.62rem; font-weight: 800;
    padding: 1px 5px; border-radius: 3px;
    text-transform: uppercase; letter-spacing: 0.06em;
}
.trait-cap-remaining {
    color: var(--text-muted); font-weight: 400; font-size: 0.72rem;
}
.maxed-badge {
    background: rgba(212, 169, 83, 0.15) !important;
    color: var(--gold-light) !important;
    border-color: rgba(212, 169, 83, 0.25) !important;
}

/* ===== Empty State ===== */
.empty-state { text-align: center; padding: 64px 24px; }
.empty-state-icon { color: var(--text-muted); margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-family: var(--font-display); font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state-text { font-size: 0.85rem; color: var(--text-muted); max-width: 360px; margin: 0 auto; }

/* ===== Footer ===== */
.site-footer { border-top: 1px solid var(--border); padding: 32px 24px; text-align: center; }
.footer-inner { max-width: 1280px; margin: 0 auto; }
.site-footer p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 4px; }
.site-footer a { color: var(--gold); text-decoration: none; transition: color var(--transition); }
.site-footer a:hover { color: var(--gold-light); }
.footer-note { font-size: 0.72rem !important; opacity: 0.6; }

/* ===== Skeleton ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite; border-radius: 4px;
}
.skeleton-text { width: 60px; height: 20px; display: inline-block; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.encounter-skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%; animation: skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-lg); height: 100px; margin-bottom: 12px;
}

/* ===== Character Color Mapping ===== */
.char-color-gran { background: #4a90d9; }
.char-color-djeeta { background: #e07a5f; }
.char-color-katalina { background: #5b9bd5; }
.char-color-rackam { background: #d9534f; }
.char-color-io { background: #f0ad4e; }
.char-color-eugen { background: #5cb85c; }
.char-color-rosetta { background: #d4587a; }
.char-color-ferry { background: #b19cd9; }
.char-color-lancelot { background: #5bc0de; }
.char-color-vane { background: #6ab04c; }
.char-color-percival { background: #e74c3c; }
.char-color-siegfried { background: #34495e; }
.char-color-charlotta { background: #f39c12; }
.char-color-yodarha { background: #1abc9c; }
.char-color-narmaya { background: #9b59b6; }
.char-color-ghandagoza { background: #e67e22; }
.char-color-zeta { background: #e84393; }
.char-color-vaseraga { background: #2d3436; }
.char-color-cagliostro { background: #fdcb6e; }
.char-color-id { background: #6c5ce7; }
.char-color-sandalphon { background: #a29bfe; }
.char-color-seofon { background: #00cec9; }
.char-color-tweyen { background: #fd79a8; }

/* Weapon Card with Image Layout */
.weapon-card-with-image {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.weapon-image-wrap {
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    padding-top: 2px;
}
.weapon-image {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 6px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    image-rendering: auto;
    flex-shrink: 0;
}
.weapon-card-body {
    flex: 1;
    min-width: 0;
}

/* Weapon type badges */
.weapon-type-badge {
    font-size: 0.62rem; font-weight: 700;
    padding: 1px 6px; border-radius: 3px;
    text-transform: capitalize; letter-spacing: 0.04em;
    white-space: nowrap;
}
.weapon-type-terminus {
    background: rgba(248, 113, 113, 0.12);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.25);
}
.weapon-type-ascension {
    background: rgba(96, 165, 250, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(96, 165, 250, 0.25);
}
.weapon-type-ascension_dlc {
    background: rgba(167, 139, 250, 0.12);
    color: #a78bfa;
    border: 1px solid rgba(167, 139, 250, 0.25);
}
.weapon-type-executioner {
    background: rgba(251, 146, 60, 0.12);
    color: #fb923c;
    border: 1px solid rgba(251, 146, 60, 0.25);
}
.weapon-type-stinger {
    background: rgba(250, 204, 21, 0.12);
    color: #facc15;
    border: 1px solid rgba(250, 204, 21, 0.25);
}
.weapon-type-stunner {
    background: rgba(52, 211, 153, 0.12);
    color: #34d399;
    border: 1px solid rgba(52, 211, 153, 0.25);
}
.weapon-type-defender {
    background: rgba(74, 222, 128, 0.12);
    color: #4ade80;
    border: 1px solid rgba(74, 222, 128, 0.25);
}

/* Weapon traits label */
.weapon-traits-label {
    font-size: 0.62rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.06em; margin-right: 4px;
}

/* Intrinsic weapon trait style */
.weapon-trait-intrinsic {
    color: #a78bfa !important;
    background: rgba(167, 139, 250, 0.08) !important;
    border-color: rgba(167, 139, 250, 0.18) !important;
}

/* ===== Sigil Row New Layout ===== */
/* Override previous layout for the two-column design */
.sigil-trait-left {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    text-align: right;
}
.sigil-trait-right {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    flex: 1;
    min-width: 0;
    font-size: 0.78rem;
    text-align: left;
}
.sigil-trait-left .sigil-trait-name,
.sigil-trait-right .sigil-trait-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Override boost-indicator: same size as lv, white, NOT superscript */
.boost-indicator {
    display: inline;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    color: #fff !important;
    margin-left: 1px;
    vertical-align: baseline !important;
}

/* ===== Trait Overflow Highlighting ===== */
.trait-summary-row.trait-overflow {
    background: rgba(248, 113, 113, 0.07);
}
.trait-summary-row.trait-overflow:hover {
    background: rgba(248, 113, 113, 0.12);
}
.trait-summary-row.trait-overflow .trait-summary-name {
    color: #fca5a5;
}
.trait-summary-row.trait-overflow .trait-summary-bar-fill {
    background: linear-gradient(90deg, #ef4444, #fca5a5);
}
.trait-overflow-label {
    display: inline-block;
    background: rgba(248, 113, 113, 0.18);
    color: #fca5a5;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

/* ===== Crit Badge (partial crit % display) ===== */
.crit-badge {
    display: inline-block;
    background: rgba(250, 204, 21, 0.12);
    color: #facc15;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    border: 1px solid rgba(250, 204, 21, 0.25);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.crit-maxed-badge {
    background: rgba(212, 169, 83, 0.15) !important;
    color: var(--gold-light) !important;
    border-color: rgba(212, 169, 83, 0.3) !important;
}
.crit-partial-badge {
    background: rgba(250, 204, 21, 0.1) !important;
    color: #facc15 !important;
    border-color: rgba(250, 204, 21, 0.2) !important;
}

/* ===== Issues Panel ===== */
.issues-label {
    color: #fbbf24 !important;
}
.issues-label svg {
    color: #fbbf24 !important;
}
.issues-count-badge {
    background: rgba(251, 191, 36, 0.12) !important;
    color: #fbbf24 !important;
    border-color: rgba(251, 191, 36, 0.25) !important;
}
.issues-panel {
    background: rgba(251, 191, 36, 0.05);
    border: 1px solid rgba(251, 191, 36, 0.2);
    border-radius: var(--radius);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.issue-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
    font-size: 0.77rem;
    color: #fcd34d;
    line-height: 1.4;
}
.issue-icon {
    flex-shrink: 0;
    color: #fbbf24;
    margin-top: 1px;
}


@media (max-width: 768px) {
    .header-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .stats-inner { gap: 16px; padding: 12px 16px; }
    .stat-item { min-width: 80px; }
    .stat-value { font-size: 1rem; }
    .char-grid { gap: 6px; }
    .char-grid-item { width: 52px; padding: 4px 2px; }
    .char-grid-portrait { width: 32px; height: 32px; }
    .char-grid-name { font-size: 0.5rem; }
    .filter-bar, .leaderboard-filters { flex-direction: column; gap: 12px; }
    .filter-group { min-width: 100%; }
    .encounter-card-top { flex-direction: column; }
    .encounter-meta { flex-wrap: wrap; }
    .party-row { grid-template-columns: 1fr 1fr; gap: 4px; }
    .party-member { font-size: 0.72rem; padding: 4px 8px; }
    .lb-player { max-width: 120px; }
    .lb-quest-name { font-size: 0.8rem; }
    .detail-stats-grid { grid-template-columns: 1fr 1fr; }
    .main-content { padding: 0 16px 32px; }
    .view-toggles { width: 100%; }
    .view-toggle { flex: 1; justify-content: center; }
    .modal { border-radius: var(--radius-lg); }
    .modal-overlay { padding: 16px; }
    .skill-table .skill-header, .skill-row-wrapper .skill-row { grid-template-columns: minmax(90px, 1.2fr) 1fr 40px 55px 40px 18px; gap: 4px; }
    .detail-player-header { flex-wrap: wrap; gap: 8px; }
    .om-list { grid-template-columns: 1fr; }
    .trait-summary-header, .trait-summary-row {
        grid-template-columns: minmax(100px, 1.2fr) 1fr 70px;
        gap: 4px; padding: 5px 8px;
    }
    .trait-summary-name { font-size: 0.72rem; }
    .trait-summary-level { font-size: 0.72rem; }
    .sigil-row { flex-wrap: nowrap; }
    .sigil-divider { display: block; }
    .sigil-trait-left, .sigil-trait-right { font-size: 0.72rem; }
    .weapon-card-with-image { flex-direction: row; }
    .weapon-image { width: 40px; height: 40px; }
}

@media (max-width: 480px) {
    .site-title { font-size: 1.3rem; }
    .btn-gold { padding: 8px 16px; font-size: 0.8rem; }
    .encounter-name { font-size: 0.95rem; }
    .skill-table .skill-header, .skill-row-wrapper .skill-row { grid-template-columns: minmax(80px, 1fr) 50px 40px 18px; }
    .skill-bar-cell, .skill-pct { display: none; }
}

/* ===== CHARACTER BUFFS ===== */
.buff-toggles {
    display: flex; flex-direction: column; gap: 6px;
}
.buff-toggle-item {
    display: flex; align-items: center; gap: 8px;
    flex-wrap: wrap;
}
.buff-toggle-label {
    display: flex; align-items: center; gap: 7px;
    cursor: pointer; padding: 5px 10px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); transition: border-color var(--transition), background var(--transition);
    font-size: 0.76rem; color: var(--text-secondary);
    user-select: none;
}
.buff-toggle-label:hover {
    border-color: var(--gold-dim); background: var(--bg-card-hover);
}
.buff-toggle-label input[type="checkbox"] {
    appearance: none; -webkit-appearance: none;
    width: 14px; height: 14px; border-radius: 3px;
    border: 1.5px solid var(--gold-dim);
    background: var(--bg-input);
    cursor: pointer; position: relative;
    flex-shrink: 0; transition: background var(--transition), border-color var(--transition);
}
.buff-toggle-label input[type="checkbox"]:checked {
    background: var(--gold); border-color: var(--gold);
}
.buff-toggle-label input[type="checkbox"]:checked::after {
    content: '';
    position: absolute; left: 3px; top: 1px;
    width: 5px; height: 8px;
    border: 2px solid #0a0e1a;
    border-top: none; border-left: none;
    transform: rotate(45deg);
}
.buff-toggle-label:has(input:checked) {
    border-color: var(--gold-dim);
    background: rgba(212, 169, 83, 0.08);
    color: var(--text-bright);
}
.buff-name {
    font-weight: 500; color: inherit;
}
.buff-value-badge {
    font-size: 0.66rem; font-weight: 700; color: var(--gold);
    background: rgba(212, 169, 83, 0.1); border: 1px solid rgba(212, 169, 83, 0.2);
    border-radius: 10px; padding: 1px 6px; margin-left: 2px;
}
.buff-variant-select {
    background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-secondary); border-radius: var(--radius);
    padding: 3px 8px; font-size: 0.72rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: border-color var(--transition);
}
.buff-variant-select:hover, .buff-variant-select:focus {
    border-color: var(--gold-dim); outline: none;
    color: var(--text-bright);
}
.sft-supp {
    color: var(--info); font-size: 0.7rem;
}
.supp-buff-val {
    color: var(--info); font-weight: 600;
}

/* ===== SUGGESTION PREVIEW ===== */
.preview-section {
    margin-top: 10px;
    border-top: 1px solid rgba(212, 169, 83, 0.15);
    padding-top: 10px;
}
.preview-title {
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.08em; color: var(--gold-dim);
    margin-bottom: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.preview-sigil-name {
    display: inline-block; background: rgba(212, 169, 83, 0.12);
    border: 1px solid rgba(212, 169, 83, 0.25); border-radius: 10px;
    padding: 1px 7px; font-size: 0.68rem; color: var(--gold);
    text-transform: none; letter-spacing: 0;
}
.preview-table {
    border-top: 1px solid rgba(212, 169, 83, 0.2);
}
.preview-improved {
    color: var(--success) !important;
    font-weight: 700;
}
.preview-improved::after {
    content: ' \2191';
    font-size: 0.7em;
    vertical-align: middle;
}

/* ===== Tooltip Overlay ===== */
.tip-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(0,0,0,0.55); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    animation: tipFadeIn 0.15s ease-out;
}
@keyframes tipFadeIn { from { opacity: 0; } to { opacity: 1; } }
.tip-overlay-content {
    background: var(--bg-card); border: 1px solid var(--border-hover);
    border-radius: var(--radius); padding: 16px 20px 18px;
    max-width: 420px; width: 92vw;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px var(--border);
    position: relative;
    animation: tipSlideIn 0.15s ease-out;
}
@keyframes tipSlideIn { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.tip-overlay-close {
    position: absolute; top: 8px; right: 10px;
    background: none; border: none; color: var(--text-muted);
    font-size: 1.3rem; cursor: pointer; line-height: 1;
    transition: color var(--transition);
}
.tip-overlay-close:hover { color: var(--gold); }
.tip-overlay-body {
    font-family: var(--font-body); font-size: 0.78rem;
    color: var(--text-primary); line-height: 1.65;
}
.tip-overlay-body .tip-section {
    margin-bottom: 8px;
}
.tip-overlay-body .tip-divider {
    border: none; border-top: 1px solid var(--border);
    margin: 8px 0;
}
.tip-overlay-body .tip-label {
    color: var(--text-muted); font-size: 0.7rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    margin-bottom: 2px;
}
.tip-overlay-body .tip-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 1px 0;
}
.tip-overlay-body .tip-row .tip-key { color: var(--text-secondary); }
.tip-overlay-body .tip-row .tip-val { color: var(--text-bright); font-weight: 600; font-variant-numeric: tabular-nums; }
.tip-overlay-body .tip-status-capping { color: var(--success); font-weight: 700; }
.tip-overlay-body .tip-status-under { color: var(--error); font-weight: 600; }

/* ===== Encounter Charts (DPS & SBA) ===== */
.encounter-charts-section {
    margin-bottom: 20px;
}
.chart-tab-bar {
    display: flex; gap: 2px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 4px;
    border-bottom: none;
}
.chart-tab {
    flex: 1;
    padding: 10px 16px;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.chart-tab:hover {
    color: var(--text-primary);
    background: rgba(192, 168, 128, 0.06);
}
.chart-tab.active {
    color: var(--gold);
    background: rgba(192, 168, 128, 0.1);
}
.chart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 16px;
    min-height: 300px;
    position: relative;
}
.chart-panel canvas {
    width: 100% !important;
    height: 350px !important;
}
@media (max-width: 600px) {
    .chart-panel canvas {
        height: 250px !important;
    }
    .chart-panel {
        padding: 8px;
    }
}
