/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0e1015;
    --bg-secondary: #151820;
    --bg-tertiary: #1a1e28;
    --bg-card: #181c26;
    --bg-hover: #1f2430;
    --border: #2a2f3d;
    --border-light: #353b4d;
    --text-primary: #e8eaf0;
    --text-secondary: #9da3b4;
    --text-muted: #6b7185;
    --accent: #ff4655;
    --accent-hover: #ff5c69;
    --green: #3ecf8e;
    --green-bg: rgba(62, 207, 142, 0.1);
    --red: #ff4655;
    --red-bg: rgba(255, 70, 85, 0.1);
    --blue: #5b8dea;
    --yellow: #f5c542;
    --purple: #a78bfa;
    --orange: #f59e0b;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 24px rgba(0, 0, 0, 0.4);
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
}

/* ===== Navbar ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(14, 16, 21, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    margin-left: -240px;
    padding-left: 240px;
    transition: margin-left 0.25s ease, padding-left 0.25s ease;
}

body.sidebar-collapsed .navbar {
    margin-left: 0;
    padding-left: 0;
}

.nav-left-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Hamburger button */
.hamburger-btn {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px;
    height: 36px;
    padding: 8px;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
}

.hamburger-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
    transition: background 0.15s;
}

.hamburger-btn:hover {
    background: var(--bg-hover);
}

.hamburger-btn:hover span {
    background: var(--text-primary);
}

/* Sidebar - open by default, collapsible */
.sidebar {
    position: fixed;
    top: 56px;
    left: 0;
    width: 240px;
    height: calc(100vh - 56px);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    z-index: 100;
    transition: left 0.25s ease, width 0.25s ease;
    padding: 16px 0;
    overflow-y: auto;
}

.sidebar.collapsed {
    left: -240px;
}

/* Shift content area when sidebar is open — padding on body keeps containers centered */
body {
    padding-left: 240px;
    transition: padding-left 0.25s ease;
}

body.sidebar-collapsed {
    padding-left: 0;
}

/* Hamburger rotates to indicate collapse/expand */
.hamburger-btn.sidebar-open span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}
.hamburger-btn.sidebar-open span:nth-child(2) {
    opacity: 0;
}
.hamburger-btn.sidebar-open span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

.sidebar-overlay {
    display: none;
}

/* Floating expand button visible when sidebar is collapsed */
.sidebar-expand-btn {
    display: none;
    position: fixed;
    top: 64px;
    left: 8px;
    z-index: 101;
    width: 36px;
    height: 36px;
    padding: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    transition: background 0.15s;
}

.sidebar-expand-btn span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
}

.sidebar-expand-btn:hover {
    background: var(--bg-hover);
}

.sidebar-expand-btn:hover span {
    background: var(--text-primary);
}

body.sidebar-collapsed .sidebar-expand-btn {
    display: flex;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 4px 12px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}

.sidebar-header .hamburger-btn {
    margin: 0;
}

.sidebar-section {
    padding: 0 12px;
}

.sidebar-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 12px 6px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    margin-bottom: 2px;
}

.sidebar-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.sidebar-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

.sidebar-item svg {
    flex-shrink: 0;
}

/* Page visibility */
.page-hidden {
    display: none;
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-tab {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    text-decoration: none;
    opacity: 0.4;
    transition: opacity 0.2s;
    position: relative;
}

.logo-tab:hover {
    opacity: 0.7;
}

.logo-tab.active {
    opacity: 1;
}

.logo-otp {
    color: var(--accent);
}

.logo-val {
    color: var(--text-primary);
}

.logo-lol {
    color: #c89b3c;
}

/* Coming Soon page */
.coming-soon-page {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    z-index: 50;
    background: var(--bg-primary);
    align-items: center;
    justify-content: center;
}

.coming-soon-page.visible {
    display: flex;
}

.coming-soon-content {
    text-align: center;
}

.coming-soon-logo {
    margin-bottom: 24px;
}

.coming-soon-content h2 {
    font-size: 2rem;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.coming-soon-content p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.93rem;
    transition: color 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

/* ===== Container ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Hero ===== */
.hero {
    padding: 48px 0 32px;
    text-align: center;
}

.hero h1 {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--accent), #ff8a94);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.hero-sub {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 640px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ===== Toolbar (vstats-style) ===== */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
    margin-bottom: 12px;
    gap: 12px;
    flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rank-dropdown-icon {
    width: 20px;
    height: 20px;
    margin-right: 6px;
    vertical-align: middle;
}

/* Rank Toggle Dropdown */
.rank-toggle-menu {
    padding: 8px !important;
    min-width: 240px !important;
    left: auto !important;
    right: 0;
}

.rank-toggle-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}

.rank-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 4px);
    background: transparent;
    cursor: pointer;
    opacity: 0.35;
    filter: grayscale(100%);
    transition: all 0.15s ease;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
}

.rank-toggle img {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

.rank-toggle span {
    pointer-events: none;
}

.rank-toggle.active {
    opacity: 1;
    filter: none;
    background: rgba(255, 70, 85, 0.12);
    border-color: rgba(255, 70, 85, 0.3);
    color: var(--text-primary);
}

.rank-toggle:hover {
    opacity: 0.85;
    filter: grayscale(30%);
    background: rgba(255, 255, 255, 0.06);
}

.rank-toggle.active:hover {
    filter: none;
    opacity: 1;
    background: rgba(255, 70, 85, 0.18);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.dropdown-trigger:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.dropdown-trigger svg {
    flex-shrink: 0;
}

.dropdown-arrow {
    opacity: 0.5;
    transition: transform 0.2s;
}

.dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 180px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    animation: dropdownIn 0.15s ease;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown.open .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.1s;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.dropdown-item.active {
    color: var(--text-primary);
    background: rgba(255, 70, 85, 0.1);
}

/* Rank icons (colored dots) */
.rank-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rank-icon svg { width: 14px; height: 14px; }

.rank-radiant    { background: linear-gradient(135deg, #fef3c7, #fbbf24); }
.rank-immortal   { background: linear-gradient(135deg, #fecaca, #ef4444); }
.rank-ascendant  { background: linear-gradient(135deg, #d1fae5, #34d399); }
.rank-diamond    { background: linear-gradient(135deg, #e0e7ff, #818cf8); }
.rank-platinum   { background: linear-gradient(135deg, #cffafe, #22d3ee); }
.rank-gold       { background: linear-gradient(135deg, #fef3c7, #f59e0b); }
.rank-silver     { background: linear-gradient(135deg, #e5e7eb, #9ca3af); }
.rank-bronze     { background: linear-gradient(135deg, #fde68a, #b45309); }
.rank-iron       { background: linear-gradient(135deg, #d1d5db, #6b7280); }

/* Act dropdown trigger (vstats style) */
.act-trigger {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border) !important;
    border-radius: 8px !important;
    padding: 8px 16px !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    color: var(--text-primary) !important;
}

.act-trigger:hover {
    background: var(--bg-hover) !important;
}

.act-menu {
    min-width: 260px;
}

/* Role icon buttons */
.role-icons {
    display: flex;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.role-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 38px;
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}

.role-icon-btn:last-child {
    border-right: none;
}

.role-icon-btn:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.role-icon-btn.active {
    color: white;
    background: var(--accent);
}

.role-icon-img {
    width: 18px;
    height: 18px;
    filter: brightness(0.7);
    transition: filter 0.15s;
}

.role-icon-btn:hover .role-icon-img {
    filter: brightness(1);
}

.role-icon-btn.active .role-icon-img {
    filter: brightness(1.2);
}

/* Count filter slider */
.count-filter {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
}

.count-filter-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}

.count-filter-label span {
    color: var(--accent);
    font-weight: 700;
    min-width: 40px;
    display: inline-block;
}

.count-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.count-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.count-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: 2px solid var(--bg-card);
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

/* Sort row */
.sort-row {
    margin-bottom: 20px;
}

.sort-row-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

.sort-select {
    min-width: 190px;
}

/* Select input (shared) */
.select-input {
    padding: 7px 12px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    appearance: auto;
}

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

/* ===== Summary Cards ===== */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.summary-card .card-label {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.summary-card .card-value {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.summary-card .card-sub {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.card-value.green { color: var(--green); }
.card-value.red { color: var(--red); }
.card-value.blue { color: var(--blue); }
.card-value.accent { color: var(--accent); }

/* ===== Table ===== */
.table-section {
    margin-bottom: 48px;
}

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

.table-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.table-legend {
    display: flex;
    gap: 16px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.dot.green { background: var(--green); }
.dot.red { background: var(--red); }

.table-wrapper {
    overflow-x: clip;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
}

.stats-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.stats-table thead th {
    position: sticky;
    top: 56px;
    z-index: 2;
}

.stats-table th {
    background: var(--bg-tertiary);
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}

.stats-table th:hover {
    color: var(--text-primary);
}

.stats-table th.sortable {
    cursor: pointer;
}

.stats-table th.sort-active {
    color: var(--accent);
}

.stats-table th.sort-active .th-label::after {
    margin-left: 4px;
    font-size: 0.7rem;
}

.stats-table th.sort-desc .th-label::after {
    content: '\25BC';
}

.stats-table th.sort-asc .th-label::after {
    content: '\25B2';
}

.th-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.th-label {
    color: var(--text-secondary);
    font-size: 0.82rem;
}

.th-sub {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 500;
}

.stats-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    transition: background 0.1s;
}

.stats-table tbody tr:hover td {
    background: var(--bg-hover);
}

.stats-table tbody tr:last-child td {
    border-bottom: none;
}

/* Agent cell */
.agent-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.agent-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.agent-icon-img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.agent-icon-img.compare-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
}

.role-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-tag-icon {
    width: 14px;
    height: 14px;
    filter: brightness(1.2);
}

.role-tag.duelist { background: rgba(255, 70, 85, 0.15); color: #ff6b78; }
.role-tag.initiator { background: rgba(91, 141, 234, 0.15); color: #7ba3f0; }
.role-tag.controller { background: rgba(167, 139, 250, 0.15); color: #b9a4fc; }
.role-tag.sentinel { background: rgba(62, 207, 142, 0.15); color: #5fd9a4; }

.delta-cell {
    font-weight: 700;
}

.delta-cell.positive {
    color: var(--green);
}

.delta-cell.negative {
    color: var(--red);
}

.wr-bar-cell {
    position: relative;
}

.wr-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 2px;
    opacity: 0.5;
}

/* ===== Comparison Section ===== */
.comparison-section {
    margin-bottom: 48px;
}

.comparison-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.section-sub {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.comparison-selectors {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.compare-select {
    min-width: 200px;
}

.vs-badge {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--accent);
    padding: 4px 12px;
    background: var(--red-bg);
    border-radius: 6px;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.comparison-placeholder {
    grid-column: 1 / -1;
    text-align: center;
    padding: 48px;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
}

.compare-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.compare-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.compare-agent-name {
    font-size: 1.2rem;
    font-weight: 700;
}

.compare-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(42, 47, 61, 0.5);
}

.compare-stat-row:last-child {
    border-bottom: none;
}

.compare-stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.compare-stat-value {
    font-weight: 700;
    font-size: 1rem;
}

.compare-bar-section {
    margin-top: 20px;
}

.compare-bar-row {
    margin-bottom: 14px;
}

.compare-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.82rem;
    margin-bottom: 6px;
}

.compare-bar-label span:first-child {
    color: var(--text-secondary);
}

.compare-bar-label span:last-child {
    font-weight: 600;
}

.compare-bar-track {
    height: 8px;
    background: var(--bg-primary);
    border-radius: 4px;
    overflow: hidden;
}

.compare-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.4s ease;
}

/* ===== Insights ===== */
.insights-section {
    margin-bottom: 48px;
}

.insights-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.insight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.insight-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.insight-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.insight-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
}

/* ===== IGL Interactive ===== */

/* Round tracker */
.igl-progress {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.igl-round-tracker {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    flex: 1;
}

.igl-dot {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    border: 1px solid transparent;
    transition: all 0.2s;
}

.igl-dot-current {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(99, 102, 241, 0.15);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.3);
}

.igl-dot-win {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.igl-dot-loss {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.igl-dot-half {
    margin-left: 8px;
}

.igl-score {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    white-space: nowrap;
    letter-spacing: 2px;
}

/* Card panel */
.igl-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.igl-game-over {
    text-align: center;
    padding: 48px 24px;
}

.igl-final-score {
    font-size: 3rem;
    font-weight: 800;
    margin: 16px 0;
    letter-spacing: 4px;
}

.igl-card-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.igl-card-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 0;
}

.igl-context {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
}

.igl-ctx-win { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.igl-ctx-loss { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.igl-ctx-fresh { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.igl-ctx-defense { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }

/* Sections layout */
.igl-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.igl-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Option cards */
.igl-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.igl-option-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.igl-option-best {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.06);
}

.igl-best-tag {
    font-size: 0.65rem;
    font-weight: 800;
    color: #4ade80;
    background: rgba(34, 197, 94, 0.15);
    padding: 2px 6px;
    border-radius: 3px;
    letter-spacing: 1px;
}

.igl-option-stats {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: auto;
    text-align: right;
}

.igl-option-wr {
    font-weight: 700;
    font-size: 0.95rem;
}

.igl-option-usage {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.igl-option-sample {
    font-size: 0.72rem;
    color: var(--text-dimmed, #555);
}

.igl-option-base {
    font-size: 0.7rem;
    color: var(--text-dimmed, #555);
    text-decoration: line-through;
    opacity: 0.6;
}

.igl-adj-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 2px;
}

.igl-adj-tag {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.igl-option-yours {
    font-size: 0.72rem;
    font-weight: 600;
    margin-top: 2px;
}

/* Site and buy badges (kept from before) */
.igl-site-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    min-width: 32px;
    text-align: center;
}

.igl-site-a { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.igl-site-b { background: rgba(59, 130, 246, 0.15); color: #60a5fa; }
.igl-site-c { background: rgba(168, 85, 247, 0.15); color: #c084fc; }

.igl-buy-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    min-width: 60px;
    text-align: center;
}

.igl-buy-eco { background: rgba(239, 68, 68, 0.12); color: #f87171; }
.igl-buy-force { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.igl-buy-full { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.igl-buy-half { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }

/* Prediction bar */
.igl-predict-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.igl-predict-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
}

.igl-pattern-note {
    font-size: 0.85rem;
    color: #fbbf24;
    margin: 0 0 12px 0;
    padding: 8px 12px;
    background: rgba(251, 191, 36, 0.08);
    border-radius: 6px;
    border-left: 3px solid #fbbf24;
}

/* Action buttons */
.igl-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.igl-action-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.igl-btn {
    padding: 8px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s;
}

.igl-btn-win {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}
.igl-btn-win:hover {
    background: rgba(34, 197, 94, 0.3);
}

.igl-btn-loss {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}
.igl-btn-loss:hover {
    background: rgba(239, 68, 68, 0.3);
}

.igl-btn-reset {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
    margin-top: 16px;
}
.igl-btn-reset:hover {
    background: rgba(99, 102, 241, 0.3);
}

.igl-btn-site {
    padding: 6px 14px;
    font-size: 0.82rem;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}
.igl-btn-site:hover {
    border-color: var(--accent);
}
.igl-btn-site-active {
    border-color: var(--accent) !important;
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

.igl-defense-actions {
    flex-direction: column;
    align-items: flex-start;
}

.igl-defense-inputs {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.igl-site-select,
.igl-result-select {
    display: flex;
    align-items: center;
    gap: 8px;
}

.igl-site-select span {
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* Reset button in toolbar */
.igl-reset-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.igl-reset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* History */
.igl-history {
    margin-top: 8px;
}

.igl-history h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: var(--text-primary);
}

.igl-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.igl-hist-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 6px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    font-size: 0.82rem;
}

.igl-hist-win { border-left: 3px solid #4ade80; }
.igl-hist-loss { border-left: 3px solid #f87171; }

.igl-hist-round {
    font-weight: 700;
    color: var(--text-primary);
    min-width: 32px;
}

.igl-hist-result {
    font-weight: 800;
    min-width: 16px;
}

.igl-hist-win .igl-hist-result { color: #4ade80; }
.igl-hist-loss .igl-hist-result { color: #f87171; }

.igl-hist-detail {
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 700px) {
    .igl-sections {
        grid-template-columns: 1fr;
    }
    .igl-score {
        font-size: 1.3rem;
    }
    .igl-dot {
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
    }
}

/* ===== IGL Win Probability Bar ===== */
.igl-winprob {
    margin-bottom: 20px;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.igl-winprob-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.igl-winprob-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.igl-winprob-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.igl-winprob-value {
    font-size: 1.1rem;
    font-weight: 800;
    min-width: 48px;
}

.igl-winprob-value:last-of-type {
    text-align: right;
}

.igl-winprob-track {
    flex: 1;
    height: 8px;
    background: rgba(239, 68, 68, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.igl-winprob-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.igl-winprob-teams {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 58px;
}

/* ===== 9-3 Curse Page ===== */

.curse-input-section {
    margin-bottom: 24px;
}

.curse-input-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.curse-team-input {
    text-align: center;
}

.curse-team-input label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.curse-score-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.curse-adj-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.curse-adj-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.curse-score-num {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    min-width: 48px;
    text-align: center;
}

.curse-vs {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 24px;
}

/* Curse state card */
.curse-card {
    margin-bottom: 24px;
}

.curse-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.curse-probs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.curse-prob-card {
    padding: 14px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.curse-prob-label {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.curse-prob-value {
    font-size: 2rem;
    font-weight: 800;
}

.curse-prob-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

.curse-prob-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.curse-fill-win { background: rgb(34, 197, 94); }
.curse-fill-lose { background: rgb(239, 68, 68); }

.curse-sample {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.curse-next {
    margin-top: 8px;
}

.curse-next h4 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin: 0 0 8px 0;
}

.curse-next-options {
    display: flex;
    gap: 12px;
}

.curse-next-card {
    flex: 1;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.curse-next-label {
    font-size: 0.82rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.curse-next-prob {
    font-size: 0.9rem;
    font-weight: 700;
}

/* Curse tags */
.curse-tag {
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.5px;
}

.curse-tag-cursed { background: rgba(168, 85, 247, 0.2); color: #c084fc; }
.curse-tag-tied { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.curse-tag-comeback { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.curse-tag-closeout { background: rgba(34, 197, 94, 0.15); color: #4ade80; }
.curse-tag-ahead { background: rgba(34, 197, 94, 0.1); color: #4ade80; }
.curse-tag-behind { background: rgba(239, 68, 68, 0.1); color: #f87171; }

/* Heatmap */
.curse-heatmap-section {
    margin-top: 8px;
}

.curse-heatmap-section h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 4px 0;
}

.curse-heatmap-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 12px 0;
}

.curse-heatmap {
    border-collapse: collapse;
    width: 100%;
}

.curse-heatmap th,
.curse-heatmap td {
    padding: 6px 4px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.curse-heatmap th {
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-weight: 700;
}

.curse-hm-corner {
    font-size: 0.65rem;
    white-space: nowrap;
}

.curse-hm-cell {
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-primary);
}

.curse-hm-cell:hover {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
    z-index: 1;
    position: relative;
}

.curse-hm-selected {
    outline: 2px solid #fff !important;
    outline-offset: -2px;
    z-index: 2;
    position: relative;
    font-weight: 800;
}

.curse-hm-cursed {
    box-shadow: inset 0 0 0 1px rgba(168, 85, 247, 0.5);
}

@media (max-width: 700px) {
    .curse-probs {
        grid-template-columns: 1fr;
    }
    .curse-next-options {
        flex-direction: column;
    }
    .curse-input-row {
        gap: 16px;
    }
    .curse-score-num {
        font-size: 1.8rem;
    }
    .curse-heatmap th,
    .curse-heatmap td {
        font-size: 0.6rem;
        padding: 4px 2px;
    }
}

/* Sidebar responsive: auto-collapse on mobile */
@media (max-width: 900px) {
    .sidebar {
        left: -240px;
    }
    .sidebar:not(.collapsed) {
        left: -240px;
    }
    body {
        padding-left: 0 !important;
    }
}

/* ===== Footer ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-top: 24px;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .controls {
        flex-direction: column;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }

    .summary-cards {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .summary-cards {
        grid-template-columns: 1fr;
    }

    html {
        font-size: 13px;
    }
}

/* ===== Nav Settings Button ===== */
.nav-settings-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.nav-settings-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

/* ===== Modal ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: flex-start;
    padding: 40px 16px;
    overflow-y: auto;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
    line-height: 1;
}

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

.modal-body {
    padding: 24px;
    max-height: 65vh;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

/* API Notice */
.api-notice {
    display: flex;
    gap: 10px;
    padding: 14px;
    background: rgba(91, 141, 234, 0.08);
    border: 1px solid rgba(91, 141, 234, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    line-height: 1.5;
}

.api-notice svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--blue);
}

.api-notice a {
    color: var(--blue);
}

/* API Toggle */
.api-toggle {
    display: flex;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.api-toggle-btn {
    flex: 1;
    padding: 9px 16px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.api-toggle-btn.active {
    background: var(--accent);
    color: white;
}

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

/* Form elements */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s;
}

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

.form-input::placeholder {
    color: var(--text-muted);
}

.form-hint {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-hint a {
    color: var(--blue);
    text-decoration: none;
}

.form-hint a:hover {
    text-decoration: underline;
}

.form-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-range {
    flex: 1;
    accent-color: var(--accent);
}

.form-range-value {
    font-weight: 700;
    font-size: 0.9rem;
    min-width: 40px;
    text-align: right;
    color: var(--accent);
}

.form-divider {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

.form-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 14px;
    color: var(--text-primary);
}

/* Seed players */
.seed-input-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.seed-input-row .form-input {
    flex: 1;
}

.seed-player-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 120px;
    overflow-y: auto;
}

.seed-tag {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.seed-tag-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 2px;
}

.seed-tag-remove:hover {
    color: var(--accent);
}

/* API Status */
.api-status {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.85rem;
}

.status-label {
    color: var(--text-muted);
}

.status-value {
    color: var(--text-primary);
    font-weight: 600;
}

.progress-bar-track {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s;
    width: 0%;
}

/* Buttons */
.btn {
    padding: 9px 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

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

.btn-accent:hover {
    background: var(--accent-hover);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-danger {
    background: #7f1d1d;
    border-color: #991b1b;
    color: #fca5a5;
}

.btn-danger:hover {
    background: #991b1b;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

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

/* ===== Rank Distribution Page ===== */
.rd-view-toggle {
    display: flex;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-left: 12px;
}

.rd-toggle-btn {
    padding: 6px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.rd-toggle-btn:hover {
    color: var(--text-primary);
}

.rd-toggle-btn.active {
    background: var(--accent);
    color: #fff;
}

.rd-chart-section {
    margin-bottom: 32px;
}

/* Vertical bar chart */
.rd-vchart {
    position: relative;
    height: 440px;
    padding-left: 40px;
    padding-bottom: 80px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding-top: 20px;
    padding-right: 16px;
}

.rd-vchart-grid {
    position: absolute;
    top: 20px;
    left: 40px;
    right: 16px;
    bottom: 80px;
}

.rd-vchart-gridline {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1px solid var(--border);
    height: 0;
}

.rd-vchart-ylabel {
    position: absolute;
    left: -38px;
    top: -8px;
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 600;
    width: 34px;
    text-align: right;
}

.rd-vchart-bars {
    position: absolute;
    top: 20px;
    left: 44px;
    right: 16px;
    bottom: 80px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.rd-vchart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    height: 100%;
    justify-content: flex-end;
}

.rd-vchart-pct {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 2px;
    white-space: nowrap;
    min-height: 14px;
}

.rd-vchart-barwrap {
    width: 100%;
    max-width: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-end;
    height: 100%;
}

.rd-vchart-bar {
    width: 100%;
    border-radius: 3px 3px 0 0;
    min-height: 1px;
    transition: height 0.4s ease;
}

.rd-vchart-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    position: absolute;
    bottom: -74px;
    left: 50%;
    transform: translateX(-50%);
}

.rd-vchart-label span {
    font-size: 0.55rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: capitalize;
    writing-mode: vertical-lr;
    transform: rotate(180deg);
    white-space: nowrap;
    height: 48px;
}

.rd-vchart-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.rd-vchart-col {
    position: relative;
}

.rd-vchart-col:hover .rd-vchart-bar {
    filter: brightness(1.3);
}

.rd-vchart-col:hover .rd-vchart-pct {
    color: var(--text-primary);
}

.rd-rank-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* Stat overlay dropdown */
.rd-stat-select-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 12px;
}

.rd-stat-select-wrap label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    white-space: nowrap;
}

.rd-stat-select-wrap select {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 6px);
    padding: 5px 10px;
    font-size: 0.8rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
}

.rd-stat-select-wrap select:hover,
.rd-stat-select-wrap select:focus {
    border-color: var(--accent);
}

/* SVG line chart overlay */
.rd-vchart-line-svg {
    position: absolute;
    top: 20px;
    left: 44px;
    right: 16px;
    bottom: 80px;
    z-index: 3;
    pointer-events: none;
    overflow: hidden;
}

.rd-vchart-line-path {
    fill: none;
    stroke: var(--accent, #ff4655);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 4px rgba(255, 70, 85, 0.5));
}

.rd-vchart-line-dot {
    fill: var(--accent, #ff4655);
    stroke: var(--bg-card);
    stroke-width: 2;
    pointer-events: all;
    cursor: default;
    transition: r 0.15s;
}

.rd-vchart-line-dot:hover {
    r: 9;
    filter: drop-shadow(0 0 6px rgba(255, 70, 85, 0.8));
}

/* Right Y-axis for line chart */
.rd-vchart-line-yaxis {
    position: absolute;
    top: 20px;
    right: 0;
    bottom: 80px;
    width: 48px;
    pointer-events: none;
    z-index: 2;
}

.rd-vchart-line-ylabel {
    position: absolute;
    right: 4px;
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--accent, #ff4655);
    transform: translateY(50%);
    white-space: nowrap;
    opacity: 0.7;
}

/* Widen chart when line axis is shown */
.rd-vchart--has-line {
    padding-right: 56px;
}

.rd-vchart--has-line .rd-vchart-grid,
.rd-vchart--has-line .rd-vchart-bars,
.rd-vchart--has-line .rd-vchart-line-svg {
    right: 56px;
}

/* Line chart legend */
.rd-line-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.rd-line-legend-swatch {
    width: 20px;
    height: 3px;
    border-radius: 2px;
    background: var(--accent, #ff4655);
    display: inline-block;
}

.rd-table-section {
    margin-top: 32px;
}

.rd-table th {
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.08em;
}

.rd-subtier-row td {
    font-size: 0.8rem;
    padding-top: 4px;
    padding-bottom: 4px;
    border-top: 1px solid var(--border);
    opacity: 0.7;
}

.rd-subtier-row:hover td {
    opacity: 1;
}

@media (max-width: 768px) {
    .rd-bar-label {
        width: 90px;
    }
    .rd-rank-name {
        font-size: 0.75rem;
    }
    .rd-bar-pct {
        width: 45px;
        font-size: 0.75rem;
    }
}

/* ===== Twitch Sidebar Embed ===== */

.sidebar-twitch {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.sidebar-twitch .sidebar-label {
    display: flex;
    align-items: center;
    gap: 6px;
}

.twitch-close-btn {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity 0.15s, color 0.15s;
}
.twitch-close-btn:hover {
    opacity: 1;
    color: var(--text);
}

.twitch-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e91916;
    display: inline-block;
    animation: twitch-pulse 2s ease-in-out infinite;
}

@keyframes twitch-pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(233, 25, 22, 0.6); }
    50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(233, 25, 22, 0); }
}

.twitch-embed-wrap {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    margin-bottom: 6px;
}

.twitch-embed-wrap iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    display: block;
}

.twitch-channel-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #9146ff;
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm, 4px);
    transition: background 0.15s;
}

.twitch-channel-link:hover {
    background: rgba(145, 70, 255, 0.12);
}

/* ===== Legal Pages (TOS / Privacy) ===== */

.legal-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 4px;
    border: 1px solid var(--border);
    width: fit-content;
}

.legal-tab {
    padding: 10px 24px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius);
    transition: all 0.2s;
}

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

.legal-tab.active {
    background: var(--accent, #ff4655);
    color: #fff;
}

.legal-content {
    max-width: 800px;
}

.legal-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px 28px;
    margin-bottom: 16px;
}

.legal-section h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.legal-section p {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.legal-section p:last-child {
    margin-bottom: 0;
}

.legal-section ul {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.legal-section ul li {
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text-secondary);
    padding: 4px 0 4px 20px;
    position: relative;
}

.legal-section ul li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent, #ff4655);
}

.legal-section ul li strong {
    color: var(--text-primary);
}

.legal-section a {
    color: var(--accent, #ff4655);
    text-decoration: none;
    transition: opacity 0.2s;
}

.legal-section a:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* Footer links */
.footer-links {
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.footer-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--accent, #ff4655);
}

.footer-sep {
    color: var(--text-muted);
    opacity: 0.4;
    font-size: 0.7rem;
}

/* ===== Advertising ===== */

/* Right sidebar ad rail */
.ad-sidebar {
    position: fixed;
    top: 60px;
    right: 0;
    width: 180px;
    height: calc(100vh - 60px);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px 8px;
    overflow-y: auto;
    pointer-events: auto;
}

/* Push main content left when ad sidebar is visible */
body.ads-enabled .container,
body.ads-enabled .footer {
    margin-right: 180px;
}

body.ads-enabled .navbar .nav-content {
    padding-right: 196px;
}

/* Top banner ad */
.ad-banner {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 8px 16px;
    background: var(--bg-surface, #1a1a2e);
    border-bottom: 1px solid var(--border, #2a2a3e);
    margin-left: 0;
}

body.ads-enabled .ad-banner {
    margin-right: 180px;
}

/* Ad slot containers */
.ad-slot {
    background: var(--bg-card, #16213e);
    border: 1px solid var(--border, #2a2a3e);
    border-radius: var(--radius, 8px);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-slot--sidebar {
    width: 160px;
    min-height: 600px;
}

.ad-slot--banner {
    width: 728px;
    max-width: 100%;
    height: 90px;
}

/* Placeholder text shown before ad loads */
.ad-placeholder {
    color: var(--text-muted, #555);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.4;
}

/* Hide sidebar ads on smaller screens */
@media (max-width: 1100px) {
    .ad-sidebar {
        display: none !important;
    }
    body.ads-enabled .container,
    body.ads-enabled .footer,
    body.ads-enabled .navbar .nav-content {
        margin-right: 0;
        padding-right: 16px;
    }
}

@media (max-width: 768px) {
    .ad-banner {
        display: none !important;
    }
    .ad-slot--banner {
        width: 320px;
        height: 50px;
    }
}
