/* ═══════════════════════════════════════════════════════════
   Discover Builds — Page Styles
   Theme: dark/gold matching pob-viewer
   ═══════════════════════════════════════════════════════════ */

body {
    zoom: 1 !important;
}

body.discover-page .hovercraft {
    zoom: 0.9;
}

body.discover-page .boxed-container {
    margin-right: 342px;
}

body, a, button, .clickable, [role="button"] {
    cursor: auto !important;
}

/* Override site custom cursors — use browser defaults on this page */
body.discover-page,
body.discover-page * {
    cursor: auto !important;
}
body.discover-page a,
body.discover-page button,
body.discover-page [onclick],
body.discover-page [onclick] *,
body.discover-page .stat-dist-row[data-stat],
body.discover-page .stat-dist-row[data-stat] * {
    cursor: pointer !important;
}

:root {
    --disc-bg-page: #0d0d0d;
    --disc-bg-panel: #121418;
    --disc-bg-card: #181c22;
    --disc-bg-card-hover: #1e2430;
    --disc-border: #2a2f3a;
    --disc-border-active: #c49c50;
    --disc-text: #c8ccd4;
    --disc-text-bright: #e5e7eb;
    --disc-text-dim: #6b7280;
    --disc-gold: #c49c50;
    --disc-gold-bright: #e29f30;
    --disc-orange: #af6025;
    --disc-life: #e05050;
    --disc-es: #4a9cdc;
    --disc-mana: #6ab0e8;
    --disc-dps: #ff9900;
    --disc-armour: #c8483b;
    --disc-evasion: #7ed321;
    --disc-ward: #ffdf3b;
    --disc-fire: #c8483b;
    --disc-cold: #4a9cdc;
    --disc-lightning: #ffdf3b;
    --disc-chaos: #d789d7;
}

/* ─── League Toggle ────────────────────────────────────── */

#discover-league-toggle {
    margin: 15px auto 5px;
}

.disc-toggle-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
}

.disc-toggle-buttons {
    display: flex;
}

.league-btn {
    padding: 8px 28px;
    background: #1a1b1b;
    border: 1px solid var(--disc-border);
    color: var(--disc-text);
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.league-btn:first-child {
    border-radius: 6px 0 0 6px;
}

.league-btn:last-child {
    border-radius: 0 6px 6px 0;
}

.league-btn.active {
    background: linear-gradient(180deg, #2a2520, #1a1510);
    border-color: var(--disc-gold);
    color: var(--disc-gold-bright);
}

.league-btn:hover:not(.active) {
    border-color: var(--disc-gold);
    color: var(--disc-text-bright);
}

/* ─── Settings ────────────────────────────────────────── */

.disc-settings-wrap {
    position: relative;
}

.disc-settings-btn {
    background: none;
    border: 1px solid var(--disc-border);
    border-radius: 6px;
    color: var(--disc-text-dim);
    font-size: 20px;
    width: 36px;
    height: 36px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.disc-settings-btn:hover {
    border-color: var(--disc-gold);
    color: var(--disc-gold);
}

.disc-settings-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--disc-bg-card);
    border: 1px solid var(--disc-border);
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 320px;
    max-width: calc(100vw - 16px);
    box-sizing: border-box;
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.disc-settings-dropdown.open {
    display: block;
}

.disc-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.disc-settings-close {
    display: none;
    background: none;
    border: none;
    color: var(--disc-text-dim);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
}

.disc-settings-close:hover {
    color: var(--disc-text-bright);
}

.disc-settings-title {
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 14px;
    color: var(--disc-gold);
    margin-bottom: 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--disc-border);
}

.disc-settings-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 13px;
    color: var(--disc-text);
    transition: color 0.15s;
}

.disc-settings-item:hover {
    color: var(--disc-text-bright);
}

.disc-settings-item input[type="checkbox"] {
    accent-color: var(--disc-gold);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

/* ─── Breadcrumb ───────────────────────────────────────── */

.discover-breadcrumb {
    padding: 8px 20px;
    font-size: 15px;
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    color: var(--disc-text-dim);
}

.discover-breadcrumb .crumb {
    cursor: pointer;
    color: var(--disc-gold);
    transition: color 0.15s;
}

.discover-breadcrumb .crumb:hover:not(.active) {
    color: var(--disc-gold-bright);
}

.discover-breadcrumb .crumb.active {
    color: var(--disc-text-bright);
    cursor: default;
}

.discover-breadcrumb .sep {
    margin: 0 8px;
    color: var(--disc-text-dim);
}

/* ─── Loading ──────────────────────────────────────────── */

.discover-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 80px 0;
}

.discover-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--disc-border);
    border-top-color: var(--disc-gold);
    border-radius: 50%;
    animation: disc-spin 0.8s linear infinite;
}

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

/* ─── Summary Bar ──────────────────────────────────────── */

.discover-summary {
    display: flex;
    gap: 12px;
    padding: 0 15px 15px;
    flex-wrap: wrap;
}

.summary-stat {
    background: var(--disc-bg-panel);
    border: 1px solid var(--disc-border);
    border-radius: 8px;
    padding: 12px 18px;
    flex: 1;
    min-width: 140px;
    text-align: center;
}

.summary-stat .stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--disc-gold-bright);
    display: block;
}

.summary-stat .stat-label {
    font-size: 13px;
    color: var(--disc-text-dim);
    margin-top: 2px;
}

/* ─── Ascendancy Grid ──────────────────────────────────── */

.ascendancy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    padding: 15px;
}

.ascendancy-card {
    background: linear-gradient(180deg, var(--disc-bg-card), var(--disc-bg-panel));
    border: 1px solid var(--disc-border);
    border-radius: 8px;
    padding: 16px 12px;
    text-align: center;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
    cursor: pointer;
}

.ascendancy-card:hover {
    border-color: var(--disc-gold);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(196, 156, 80, 0.15);
}

.ascendancy-card img {
    width: 64px;
    height: auto;
    margin-bottom: 6px;
    border-radius: 5px;
}

.ascendancy-card .asc-name {
    font-size: 16px;
    color: var(--disc-text-bright);
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    margin-bottom: 4px;
}

.ascendancy-card .asc-count {
    font-size: 13px;
    color: var(--disc-gold);
    margin-bottom: 6px;
}

.asc-bar {
    height: 4px;
    background: #2a2a2a;
    border-radius: 2px;
    overflow: hidden;
}

.asc-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--disc-gold), var(--disc-gold-bright));
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* ─── Trend Badges ────────────────────────────────────── */

.trend-badge {
    display: inline-block;
    font-size: 10px;
    font-family: Arial, sans-serif;
    padding: 1px 5px;
    border-radius: 3px;
    margin-left: 5px;
    vertical-align: middle;
    line-height: 1.4;
}

.trend-up {
    color: #4caf50;
    background: rgba(76, 175, 80, 0.15);
}

.trend-down {
    color: #e05050;
    background: rgba(224, 80, 80, 0.15);
}

.trend-new {
    color: var(--disc-gold);
    background: rgba(196, 156, 80, 0.15);
}

/* ─── Section Headers ──────────────────────────────────── */

.disc-section {
    padding: 15px;
    background: var(--disc-bg-card);
    border-radius: 8px;
    border: 1px solid var(--disc-border);
    margin-bottom: 10px;
}

.disc-section-title {
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 18px;
    color: var(--disc-gold);
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--disc-border);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Usage Bars (item/gem/keystone popularity) ────────── */

.usage-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.usage-row {
    display: flex;
    align-items: center;
    gap: 0;
    padding: 3px 0;
    position: relative;
}

.usage-rank {
    min-width: 26px;
    text-align: right;
    color: var(--disc-text-dim);
    font-size: 12px;
    padding-right: 8px;
    flex-shrink: 0;
}

/* Bar fills the full remaining width; name is overlaid on top */
.usage-bar-wrap {
    flex: 1;
    height: 26px;
    background: #1a1a1a;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

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

.usage-bar-fill.item-bar {
    background: linear-gradient(90deg, #7a4a18, #af6025);
}

.usage-bar-fill.gem-bar {
    background: linear-gradient(90deg, #0d3030, #1a5550);
}

.usage-bar-fill.support-bar {
    background: linear-gradient(90deg, #18184a, #2e2e68);
}

.usage-bar-fill.keystone-bar {
    background: linear-gradient(90deg, #7a6020, #c49c50);
}

.usage-bar-fill.mod-bar {
    background: linear-gradient(90deg, #4a2a5a, #8a5a9a);
}

.usage-bar-fill.synth-bar {
    background: linear-gradient(90deg, #2a5a7a, #4a7a9a);
}

.usage-bar-fill.eldritch-bar {
    background: linear-gradient(90deg, #7a2a4a, #9a4a6a);
}

.usage-bar-fill.mastery-bar {
    background: linear-gradient(90deg, #2a4a3a, #3d8b5e);
}

.usage-bar-fill.tattoo-bar {
    background: linear-gradient(90deg, #4a3a2a, #8b6b3d);
}

.usage-bar-fill.runegraft-bar {
    background: linear-gradient(90deg, #2a3a5a, #3d6b8b);
}

.usage-bar-fill.flask-bar {
    background: linear-gradient(90deg, #5a2a4a, #9b4a7a);
}

.usage-bar-fill.notable-bar {
    background: linear-gradient(90deg, #5a4a20, #a08030);
}

.usage-bar-fill.charge-bar {
    background: linear-gradient(90deg, #3a3a3a, #6a6a6a);
}

.usage-bar-fill.cluster-small-bar {
    background: linear-gradient(90deg, #5b8c5a, #3d6b3d);
}

.usage-bar-fill.cluster-medium-bar {
    background: linear-gradient(90deg, #7a6b8a, #5a4b6a);
}

.usage-bar-fill.cluster-large-bar {
    background: linear-gradient(90deg, #8a7b5a, #6a5b3a);
}

.usage-bar-fill.cluster-mega-bar {
    background: linear-gradient(90deg, #8a4b4b, #6a2b2b);
}

.usage-bar-fill.abyssal-bar {
    background: linear-gradient(90deg, #1a4a4a, #2d7a7a);
}
.usage-bar-fill.granted-bar {
    background: linear-gradient(90deg, #3a2a5a, #5a4a8a);
}

/* Icon inside bar area */
.usage-icon {
    position: absolute;
    left: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border-radius: 4px;
    z-index: 2;
    pointer-events: none;
    object-fit: contain;
}
.usage-icon.mastery-sprite {
    background-repeat: no-repeat;
    object-fit: unset;
}

/* Name overlaid inside the bar area */
.usage-name {
    position: absolute;
    left: 8px;
    top: 0;
    height: 100%;
    display: block;
    line-height: 26px;
    color: var(--disc-text-bright);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: calc(100% - 16px);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    z-index: 1;
    pointer-events: none;
}

/* Expanded row — show full text on tap (mobile) or click */
.usage-row.expanded .usage-bar-wrap {
    height: auto;
    min-height: 26px;
}
.usage-row.expanded .usage-name {
    position: relative;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    max-width: none;
    left: 0;
    padding: 4px 8px;
}
.usage-row.expanded .usage-icon + .usage-name {
    left: 0;
    margin-left: 28px;
    padding-left: 4px;
}
.usage-row.expanded .usage-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
}

/* Shift name right when icon is present */
.usage-icon + .usage-name {
    left: 28px;
    max-width: calc(100% - 36px);
}

.usage-name.gem-active {
    color: #4dd9d0;
}

.usage-name.gem-support {
    color: #a0b0ff;
}

.usage-name.gem-red,
.gem-red {
    color: #c8483b;
}

.usage-name.gem-green,
.gem-green {
    color: #7ed321;
}

.usage-name.gem-blue,
.gem-blue {
    color: #4a9cdc;
}

.usage-name.gem-white,
.gem-white {
    color: #d6ccbe;
}

.usage-pct {
    min-width: 48px;
    text-align: right;
    color: var(--disc-text-dim);
    font-size: 13px;
    padding-left: 6px;
    flex-shrink: 0;
}

.usage-count {
    min-width: 36px;
    text-align: right;
    color: var(--disc-text-dim);
    font-size: 12px;
    flex-shrink: 0;
}

/* ─── Tooltip ─────────────────────────────────────────── */

.disc-tooltip {
    position: fixed;
    z-index: 9999;
    background: #1a1a2e;
    border: 1px solid var(--disc-gold, #c49c50);
    border-radius: 4px;
    padding: 8px 12px;
    max-width: 350px;
    pointer-events: none;
    font-size: 13px;
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.tip-title {
    color: var(--disc-gold, #c49c50);
    font-weight: bold;
    margin-bottom: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 4px;
    line-height: 1.2;
}

.tip-stat {
    color: #a0a0b8;
    line-height: 1.4;
}

/* ─── Calculation Breakdown ───────────────────────────── */

.calc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    line-height: 1;
    padding-top: 1px;
    background: rgba(196, 156, 80, 0.15);
    border: 1px solid var(--disc-gold);
    border-radius: 3px;
    color: var(--disc-gold);
    font-size: 10px;
    font-weight: bold;
    margin-left: 6px;
    cursor: pointer;
    vertical-align: middle;
    transition: all 0.2s;
    user-select: none;
    font-family: Arial, sans-serif;
}

.calc-btn:hover {
    background: var(--disc-gold);
    color: #0d0d0d;
}

.tip-stat.calc-line {
    font-family: 'Fontin SmallCaps', sans-serif;
    font-size: 13px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding: 2px 0;
}
.tip-stat.calc-line:last-child {
    border-bottom: none;
}

/* ─── Calc Breakdown Mobile Modal ─────────────────────── */
.calc-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #1a1712;
    z-index: 9999;
    flex-direction: column;
}
.calc-modal-overlay.active {
    display: flex;
}
.calc-modal {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
.calc-modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
.calc-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    border: none;
    color: #ccc;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.calc-modal-title {
    font-family: 'Fontin SmallCaps', sans-serif;
    font-size: 16px;
    color: var(--disc-gold);
}
.calc-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    -webkit-overflow-scrolling: touch;
}
.calc-note {
    font-size: 11px !important;
    color: #999 !important;
    font-style: italic !important;
    margin-top: 10px;
    padding-top: 4px;
    line-height: 1.3;
    font-family: 'Fontin SmallCaps', sans-serif;
}

/* ─── Stats Panel ──────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
}

.stat-card {
    background: var(--disc-bg-panel);
    border: 1px solid var(--disc-border);
    border-radius: 6px;
    padding: 10px 12px;
    text-align: center;
}

.stat-card .stat-card-value {
    font-size: 18px;
    font-weight: bold;
    display: block;
}

.stat-card .stat-card-label {
    font-size: 12px;
    color: var(--disc-text-dim);
    margin-top: 2px;
}

/* Stat colors */
.stat-life { color: var(--disc-life); }
.stat-es { color: var(--disc-es); }
.stat-flask { color: #8bc34a; }
.stat-mana { color: var(--disc-mana); }
.stat-dps { color: var(--disc-dps); }
.stat-armour { color: var(--disc-armour); }
.stat-evasion { color: var(--disc-evasion); }
.stat-ward { color: var(--disc-ward); }
.stat-fire { color: var(--disc-fire); }
.stat-cold { color: var(--disc-cold); }
.stat-lightning { color: var(--disc-lightning); }
.stat-chaos { color: var(--disc-chaos); }
.stat-ehp { color: #a0d0a0; }
.stat-crit { color: #e8d44d; }
.stat-speed { color: #56b4e9; }
.stat-tft { color: var(--disc-gold); }
.stat-frenzy { color: #7ed321; }
.stat-power { color: #4a9cdc; }
.stat-endurance { color: #e05050; }
.stat-str { color: #c8483b; }
.stat-dex { color: #7ed321; }
.stat-int { color: #4a9cdc; }
.stat-iiq { color: #e8d44d; }
.stat-iir { color: #d789d7; }
.stat-default { color: var(--disc-text-bright); }

/* Table header stat colors */
.disc-table th[data-sort="CombinedDPS"] { color: var(--disc-dps); }
.disc-table th[data-sort="Life"] { color: var(--disc-life); }
.disc-table th[data-sort="EnergyShield"] { color: var(--disc-es); }
.disc-table th[data-sort="Mana"] { color: var(--disc-mana); }
.disc-table th[data-sort="TotalEHP"] { color: #a0d0a0; }
.disc-table th[data-sort="Armour"] { color: var(--disc-armour); }
.disc-table th[data-sort="Evasion"] { color: var(--disc-evasion); }
.disc-table th[data-sort="CritChance"] { color: #e8d44d; }
.disc-table th[data-sort="Speed"] { color: #56b4e9; }
.disc-table th[data-sort="ItemQuantity"] { color: #e8d44d; }
.disc-table th[data-sort="ItemRarity"] { color: #d789d7; }
.disc-table th[data-sort="tftItems"] { color: var(--disc-gold); }

/* ─── Sortable Table ───────────────────────────────────── */

.disc-table-wrap {
    overflow-x: auto;
    margin: 0 -5px;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.disc-top-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    height: 14px;
    margin: 0 -5px;
    display: none; /* Shown by JS when overflowing */
    background: #0a0a0a;
    border-bottom: 1px solid #1a1a1a;
}

/* Hide top scrollbar on touch devices where direct swiping is preferred */
@media (pointer: coarse), (max-width: 900px) {
    .disc-top-scroll {
        display: none !important;
    }
}

.disc-top-scroll-inner {
    height: 14px;
}

/* Custom Scrollbar for Discovery Table (Desktop) */
.disc-top-scroll::-webkit-scrollbar,
.disc-table-wrap::-webkit-scrollbar {
    height: 14px;
}
.disc-top-scroll::-webkit-scrollbar-track,
.disc-table-wrap::-webkit-scrollbar-track {
    background: #0a0a0a;
}
.disc-top-scroll::-webkit-scrollbar-thumb,
.disc-table-wrap::-webkit-scrollbar-thumb {
    background: #a36520;
    border-radius: 4px;
    border: 2px solid #0a0a0a;
}
.disc-top-scroll::-webkit-scrollbar-thumb:hover,
.disc-table-wrap::-webkit-scrollbar-thumb:hover {
    background: #c47b2b;
}

.disc-top-scroll::-webkit-scrollbar-button,
.disc-table-wrap::-webkit-scrollbar-button {
    display: block;
    width: 14px;
    background-color: #0a0a0a;
    background-repeat: no-repeat;
    background-position: center;
}

.disc-top-scroll::-webkit-scrollbar-button:horizontal:decrement,
.disc-table-wrap::-webkit-scrollbar-button:horizontal:decrement {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M7 2L3 5l4 3z' fill='%23a36520'/%3E%3C/svg%3E");
}

.disc-top-scroll::-webkit-scrollbar-button:horizontal:increment,
.disc-table-wrap::-webkit-scrollbar-button:horizontal:increment {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M3 2l4 3-4 3z' fill='%23a36520'/%3E%3C/svg%3E");
}

/* Firefox scrollbar support */
.disc-top-scroll {
    scrollbar-color: #a36520 #0a0a0a;
    scrollbar-width: auto;
}
.disc-table-wrap {
    scrollbar-width: none; /* Hide bottom one */
}

.disc-table-wrap::-webkit-scrollbar {
    display: none; /* Hide bottom one */
}

/* Scroll hint: sticky first column */
.disc-table td:first-child,
.disc-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 10;
    background: var(--disc-bg-panel);
}

.disc-table tr:hover td:first-child {
    background: var(--disc-bg-panel);
}

.disc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.disc-table th {
    background: var(--disc-bg-panel);
    color: var(--disc-gold);
    padding: 10px 10px;
    text-align: left;
    font-size: 13px;
    border-bottom: 2px solid var(--disc-gold);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

.disc-table th:hover {
    color: var(--disc-gold-bright);
}

.disc-table th.sorted-asc::after {
    content: ' ▲';
    font-size: 10px;
}

.disc-table th.sorted-desc::after {
    content: ' ▼';
    font-size: 10px;
}

.disc-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #1e2228;
    color: var(--disc-text);
    white-space: nowrap;
}

.disc-table tr:hover td {
    background: rgba(196, 156, 80, 0.04);
}

.disc-table .cell-asc {
    display: flex;
    align-items: center;
    gap: 6px;
}

.disc-table .cell-asc img {
    width: 24px;
    height: auto;
}

.disc-table .pob-link {
    color: var(--disc-gold);
    text-decoration: none;
    font-size: 13px;
    cursor: pointer;
}

.disc-table .pob-link:hover {
    color: var(--disc-gold-bright);
    text-decoration: underline;
}

.disc-table-hint {
    display: none; /* Controlled by JS */
    font-size: 11px;
    color: var(--disc-gold);
    margin-bottom: 5px;
    text-align: right;
    font-style: italic;
    opacity: 0.8;
}

/* ─── Skill Table (in ascendancy detail) ───────────────── */

.disc-section-hint {
    font-size: 13px;
    color: var(--disc-text-dim);
    font-style: italic;
    padding: 0 0 8px;
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
}

.skill-row {
    cursor: pointer;
}

.skill-row:hover td {
    background: rgba(196, 156, 80, 0.08) !important;
}

.skill-row-chevron {
    color: var(--disc-gold);
    font-size: 18px;
    text-align: right;
    padding-right: 6px !important;
    opacity: 0.5;
    transition: opacity 0.15s, transform 0.15s;
    white-space: nowrap;
}

.skill-row:hover .skill-row-chevron {
    opacity: 1;
}

/* ─── Skill Gems Grid (Overview) ──────────────────────── */

.skill-gems-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 6px;
    margin-bottom: 10px;
}

.skill-gem-card {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--disc-bg-panel);
    border: 1px solid var(--disc-border);
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.skill-gem-card:hover {
    border-color: var(--disc-gold);
    background: var(--disc-bg-card-hover);
}

.skill-gem-card img {
    width: 28px;
    height: 28px;
    border-radius: 3px;
    flex-shrink: 0;
}

.skill-gem-name {
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 14px;
    color: var(--disc-text-bright);
}

.skill-gem-meta {
    font-size: 11px;
    color: var(--disc-text-dim);
}

.skill-gem-hidden {
    display: none;
}

.disc-table .cell-skill {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.disc-table .cell-skill img {
    width: 24px;
    height: 24px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* ─── Pagination ───────────────────────────────────────── */

.disc-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 15px;
}

.disc-pagination button {
    padding: 6px 14px;
    background: var(--disc-bg-card);
    border: 1px solid var(--disc-border);
    border-radius: 4px;
    color: var(--disc-text);
    cursor: pointer;
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 14px;
    transition: all 0.15s;
}

.disc-pagination button:hover:not(:disabled) {
    border-color: var(--disc-gold);
    color: var(--disc-gold);
}

.disc-pagination button:disabled {
    opacity: 0.3;
    cursor: default;
}

.disc-pagination .page-info {
    color: var(--disc-text-dim);
    font-size: 13px;
}

/* ─── Search ───────────────────────────────────────────── */

.disc-search {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 10px;
    background: #0a0a0a;
    border: 1px solid var(--disc-border);
    border-radius: 6px;
    color: var(--disc-text);
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.disc-search:focus {
    border-color: var(--disc-gold);
}

.disc-search::placeholder {
    color: var(--disc-text-dim);
}

/* ─── Ascendancy Detail Header ─────────────────────────── */

.asc-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 15px;
    background: linear-gradient(180deg, var(--disc-bg-card), transparent);
    border-radius: 8px;
    margin: 0 15px 10px;
}

.asc-detail-header img {
    width: 80px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

.asc-detail-header .asc-detail-info h2 {
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 26px;
    color: var(--disc-gold-bright);
    margin: 0;
}

.asc-detail-header .asc-detail-meta {
    font-size: 14px;
    color: var(--disc-text-dim);
    margin-top: 2px;
}

.asc-detail-header .asc-detail-meta span {
    color: var(--disc-text);
}

/* ─── Skill Detail Header ─────────────────────────────── */

.skill-detail-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 15px;
    background: linear-gradient(180deg, var(--disc-bg-card), transparent);
    border-radius: 8px;
    margin: 0 15px 10px;
}

.skill-detail-header img {
    width: 64px;
    height: auto;
}

.skill-detail-header h2 {
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 22px;
    color: var(--disc-gold-bright);
    margin: 0;
}

.skill-detail-header .skill-detail-meta {
    font-size: 14px;
    color: var(--disc-text-dim);
    margin-top: 2px;
}

/* ─── Ascendancy Selector (global skill view) ──────────── */

.skill-asc-selector {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 0 15px 10px;
}

.skill-asc-label {
    font-size: 12px;
    color: var(--disc-text-dim);
    margin-right: 4px;
}

.skill-asc-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--disc-bg-panel);
    border: 1px solid var(--disc-border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--disc-text);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.skill-asc-tag:hover {
    border-color: var(--disc-gold);
    background: var(--disc-bg-card);
}

.skill-asc-tag img {
    width: 20px;
    height: 20px;
    border-radius: 2px;
}

.skill-asc-count {
    color: var(--disc-gold);
    margin-left: 2px;
}

/* ─── Two-Column Layout ────────────────────────────────── */

#discover-content > .disc-section {
    margin-left: 15px;
    margin-right: 15px;
}

.disc-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    padding: 0 15px;
    margin-bottom: 10px;
}

.disc-columns > .disc-section {
    margin-bottom: 0;
}

.disc-columns > .disc-section:only-child {
    grid-column: 1 / -1;
}

/* ─── Bloodline Tags ───────────────────────────────────── */

.bloodline-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 15px 10px;
}

.bloodline-tag {
    background: var(--disc-bg-panel);
    border: 1px solid var(--disc-border);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    color: var(--disc-text);
}

.bloodline-tag .bl-count {
    color: var(--disc-gold);
    margin-left: 4px;
}

/* ─── Unique Item Mods Section ─────────────────────────── */

.mod-section {
    margin-top: 8px;
}

.mod-section-header {
    font-size: 15px;
    color: var(--disc-orange);
    margin-bottom: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mod-section-header.rare-mod {
    color: #ffd700;
}

.mod-section-header:hover {
    color: var(--disc-gold-bright);
}

.mod-section-header .toggle-icon {
    font-size: 10px;
    transition: transform 0.2s;
}

.mod-section-header .toggle-icon.open {
    transform: rotate(90deg);
}

.mod-list {
    display: none;
    padding-left: 10px;
}

.mod-list.open {
    display: block;
}

/* ─── Rankings View Button ─────────────────────────────── */

.disc-view-rankings {
    display: block;
    margin: 10px auto 0;
    padding: 10px 28px;
    background: linear-gradient(180deg, #2a2520, #1a1510);
    border: 1px solid var(--disc-gold);
    border-radius: 6px;
    color: var(--disc-gold-bright);
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.disc-view-rankings:hover {
    background: linear-gradient(180deg, #3a3530, #2a2520);
    color: #fff;
}

/* ─── Stat Distribution Bars ───────────────────────────── */

.stat-dist-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.stat-dist-label {
    width: 200px;
    flex-shrink: 0;
    font-size: 13px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stat-dist-bar-wrap {
    flex: 1;
    height: 22px;
    background: #1a1a1a;
    border-radius: 3px;
    position: relative;
    padding-left: 4px;
    padding-right: 4px;
}

.stat-dist-range {
    position: absolute;
    height: 100%;
    background: rgba(196, 156, 80, 0.2);
    border-left: 2px solid var(--disc-gold);
    border-right: 2px solid var(--disc-gold);
    border-radius: 2px;
}

.stat-dist-median {
    position: absolute;
    width: 3px;
    height: 100%;
    background: var(--disc-gold-bright);
    border-radius: 1px;
    z-index: 1;
}

.stat-dist-values {
    width: 220px;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--disc-text-dim);
    display: flex;
    gap: 12px;
    justify-content: left;
    border-left: 1px solid rgba(255,255,255,0.07);
    padding-left: 6px;
}

.stat-dist-values span {
    white-space: nowrap;
}

/* ─── Stat Ranking Panel (inline below stat bars) ────── */

.stat-dist-hint {
    font-size: 14px;
    color: var(--disc-gold-bright);
    padding: 6px 0 12px;
    text-align: center;
    letter-spacing: 0.5px;
}

.stat-dist-row[data-stat] {
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    padding: 8px 4px;
}
.stat-dist-row[data-stat],
.stat-dist-row[data-stat] * {
    cursor: pointer;
}
.stat-dist-row[data-stat]:hover {
    background: rgba(196, 156, 80, 0.06);
}
.stat-dist-row[data-stat]:hover .stat-dist-expand-hint {
    opacity: 1;
}
.stat-dist-row.expanded {
    background: rgba(196, 156, 80, 0.1);
}
.stat-dist-row.expanded .stat-dist-expand-hint {
    opacity: 1;
    transform: rotate(90deg);
}

.stat-dist-expand-hint {
    font-size: 10px;
    color: var(--disc-gold);
    opacity: 0;
    transition: opacity 0.15s, transform 0.15s;
    margin-left: 4px;
    flex-shrink: 0;
}

.stat-ranking-panel {
    margin: 4px 0 12px 0;
    padding: 10px 12px;
    background: rgba(20, 20, 20, 0.9);
    border: 1px solid rgba(196, 156, 80, 0.15);
    border-radius: 6px;
}

.stat-ranking-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.stat-ranking-toggle {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 3px;
    cursor: pointer;
    background: rgba(255,255,255,0.05);
    color: var(--disc-text-dim);
    transition: all 0.15s;
}
.stat-ranking-toggle:hover {
    background: rgba(255,255,255,0.1);
}
.stat-ranking-toggle.active {
    background: rgba(196, 156, 80, 0.2);
    color: var(--disc-gold-bright);
}

.stat-ranking-count {
    font-size: 11px;
    color: var(--disc-text-dim);
    margin-left: auto;
    flex-shrink: 0;
}

.stat-ranking-note {
    font-size: 11px;
    color: var(--disc-text-dim);
    font-style: italic;
    opacity: 0.7;
    flex: 1;
    text-align: center;
}

.stat-ranking-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.stat-ranking-table th,
.stat-ranking-table td {
    padding: 5px 10px;
    white-space: nowrap;
    border-right: 1px solid rgba(255,255,255,0.05);
}
.stat-ranking-table th:last-child,
.stat-ranking-table td:last-child {
    border-right: none;
}
.stat-ranking-table th {
    text-align: left;
    font-size: 11px;
    color: var(--disc-text-dim);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.stat-ranking-table td {
    border-bottom: 1px solid rgba(255,255,255,0.03);
}
.stat-ranking-table tr:hover td {
    background: rgba(255,255,255,0.03);
}
.stat-ranking-table .cell-asc {
    display: flex;
    align-items: center;
    gap: 4px;
}
.stat-ranking-table .cell-asc img {
    height: 18px;
    width: auto;
    flex-shrink: 0;
}

/* Column widths + alignment for stat ranking table — must override th { text-align: left } */
.stat-ranking-table th.sr-rank,
.stat-ranking-table td.sr-rank { width: 1%; text-align: center; }
.stat-ranking-table th.sr-asc,
.stat-ranking-table td.sr-asc  { width: 1%; }
.stat-ranking-table th.sr-skill,
.stat-ranking-table td.sr-skill { width: 1%; }
.stat-ranking-table th.sr-char,
.stat-ranking-table td.sr-char  { width: 50%; }
.stat-ranking-table th.sr-val,
.stat-ranking-table td.sr-val   { width: 1%; text-align: center; font-weight: 600; white-space: nowrap; }
.stat-ranking-table th.sr-pob,
.stat-ranking-table td.sr-pob   { width: 1%; text-align: center; white-space: nowrap; }

.stat-ranking-table .pob-link {
    color: var(--disc-gold);
    text-decoration: none;
    font-size: 12px;
}
.stat-ranking-table .pob-link:hover {
    color: var(--disc-gold-bright);
    text-decoration: underline;
}

.stat-ranking-show-all {
    display: block;
    margin: 8px auto 0;
    padding: 4px 16px;
    font-family: 'Fontin SmallCaps', serif;
    font-size: 13px;
    background: rgba(255,255,255,0.05);
    color: var(--disc-text-dim);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s;
}
.stat-ranking-show-all:hover {
    background: rgba(196, 156, 80, 0.15);
    color: var(--disc-gold-bright);
    border-color: rgba(196, 156, 80, 0.3);
}

/* ─── Back Arrow ───────────────────────────────────────── */

.disc-back-arrow {
    font-size: 24px;
    color: var(--disc-gold);
    cursor: pointer;
    padding: 4px 8px;
    transition: color 0.15s;
    flex-shrink: 0;
}

.disc-back-arrow:hover {
    color: var(--disc-gold-bright);
}

/* ─── View More ───────────────────────────────────────── */

.usage-hidden {
    display: none;
}

.usage-hidden.open {
    display: block;
}

.view-more-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 6px;
    margin-top: 4px;
    cursor: pointer;
    color: var(--disc-gold);
    background: var(--disc-bg-card);
    border: 1px solid #2a2d35;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Fontin SmallCaps', Arial, sans-serif;
    transition: all 0.15s;
}

.view-more-btn:hover {
    background: #1e2228;
    color: var(--disc-gold-bright);
    border-color: var(--disc-gold);
}

/* ─── Responsive ───────────────────────────────────────── */

@media (max-width: 1200px) {
    .ascendancy-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
        padding: 10px;
    }

    .ascendancy-card {
        padding: 12px 8px;
    }

    .ascendancy-card img {
        width: 44px;
        height: auto;
    }

    .ascendancy-card .asc-name {
        font-size: 14px;
    }

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

    .asc-detail-header {
        margin: 0 10px 10px;
    }

    .disc-section {
        padding: 10px;
    }

    .discover-summary {
        padding: 0 10px 10px;
    }

    .disc-back-btn {
        display: inline-block;
    }
}

@media (max-width: 1450px) {
    .disc-table {
        font-size: 11px;
    }
}

@media (max-width: 768px) {
    /* Settings dropdown: full screen on mobile */
    .disc-settings-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        min-width: 0;
        max-width: none;
        max-height: none;
        border-radius: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        margin-top: 0;
        padding-top: 56px;
        z-index: 1000;
    }

    .disc-settings-close {
        display: flex;
        position: absolute;
        top: 8px;
        left: 12px;
        right: auto;
        color: #e05050;
    }

    .disc-settings-header {
        padding-left: 0;
    }

    /* Reduce outer padding so content uses ~95% of viewport width */
    body.discover-page .main-content {
        padding: 5px !important;
    }

    #discover-content > .disc-section {
        margin-left: 0;
        margin-right: 0;
    }

    .disc-columns {
        padding: 0;
        gap: 8px;
    }

    .discover-summary {
        padding: 0 0 10px;
    }

    .skill-asc-selector,
    .bloodline-tags {
        padding-left: 0;
        padding-right: 0;
    }

    /* ─── Stat Distributions: stacked layout on mobile ─── */
    .stat-dist-row {
        flex-wrap: wrap;
        gap: 4px 0;
        padding: 8px 4px;
    }

    .stat-dist-label {
        width: auto;
        flex-shrink: 1;
        text-align: left;
        font-size: 12px;
        order: 1;
    }

    .stat-dist-values {
        width: auto;
        flex-shrink: 1;
        order: 2;
        margin-left: auto;
        gap: 8px;
        font-size: 11px;
        justify-content: flex-start;
    }

    .stat-dist-bar-wrap {
        width: 100%;
        flex: none;
        order: 3;
        height: 18px;
    }

    .stat-dist-expand-hint {
        display: none;
    }

    .stat-dist-hint {
        font-size: 11px;
        padding: 4px 0 8px;
    }

    /* ─── Stat Ranking: scrollable table on mobile ─── */
    .stat-ranking-panel {
        padding: 8px;
        margin: 4px 0 8px;
    }

    .stat-ranking-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 11px;
    }

    .stat-ranking-table th,
    .stat-ranking-table td {
        padding: 4px 6px;
    }

    .stat-ranking-controls {
        flex-wrap: wrap;
        gap: 6px;
    }

    .stat-ranking-note {
        order: 3;
        flex: 0 0 100%;
        text-align: center;
        margin-top: 2px;
    }
}

@media (max-width: 480px) {
    .ascendancy-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .summary-stat {
        min-width: 100px;
    }

    .summary-stat .stat-value {
        font-size: 20px;
    }

    .usage-name {
        font-size: 12px;
    }

    .usage-icon {
        width: 16px;
        height: 16px;
    }

    .usage-icon + .usage-name {
        left: 28px;
    }

    .disc-table {
        font-size: 10px;
    }

    .disc-table th, .disc-table td {
        padding: 3px 4px;
    }

    /* Hide less critical columns on small mobile */
    .disc-table th:nth-child(8),
    .disc-table td:nth-child(8),
    .disc-table th:nth-child(9),
    .disc-table td:nth-child(9),
    .disc-table th:nth-child(10),
    .disc-table td:nth-child(10) {
        display: none;
    }

    /* ─── Stat Distributions: tighter on small screens ─── */
    .stat-dist-label {
        font-size: 11px;
    }

    .stat-dist-values {
        font-size: 10px;
        gap: 6px;
    }

    .stat-dist-bar-wrap {
        height: 14px;
    }

    .stat-ranking-table {
        font-size: 10px;
    }

    .stat-ranking-table th,
    .stat-ranking-table td {
        padding: 3px 4px;
    }

    /* Hide asc/skill cols in ranking on tiny screens (global view) */
    .stat-ranking-table .sr-asc,
    .stat-ranking-table .sr-skill {
        display: none;
    }
}

/* ─── Item Choices by Slot ──────────────────────────────── */
.ic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}
.ic-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    padding: 10px 12px;
}
.ic-slot {
    font-size: 13px;
    font-weight: bold;
    color: #c8aa6e;
    margin-bottom: 6px;
}
.ic-total {
    font-weight: normal;
    color: var(--disc-text-dim, #888);
    font-size: 11px;
}
.ic-bar {
    display: flex;
    height: 10px;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
    background: #222;
    gap: 1px;
}
.ic-seg { height: 100%; border-radius: 2px; min-width: 3px; }
.ic-seg.ic-unique, .ic-dot.ic-unique { background: #af6025; }
.ic-seg.ic-synth,  .ic-dot.ic-synth  { background: #6e9ec8; }
.ic-seg.ic-eldritch, .ic-dot.ic-eldritch { background: #b06ea0; }
.ic-seg.ic-influenced, .ic-dot.ic-influenced { background: #6ec87a; }
.ic-seg.ic-fractured, .ic-dot.ic-fractured { background: #c8a06e; }
.ic-seg.ic-rare, .ic-dot.ic-rare { background: #666; }
.ic-cats { font-size: 11px; line-height: 1.6; }
.ic-cat {
    display: flex;
    align-items: center;
    gap: 5px;
}
.ic-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.ic-label { color: #ccc; }
.ic-pct { margin-left: auto; font-weight: bold; color: #ddd; }
.ic-unique-name {
    margin-left: 12px;
    color: #ddd;
    font-size: 10px;
}
.ic-unique-name span { color: #999; font-weight: bold; }
.ic-subtype {
    margin-left: 12px;
    color: #a0d8a8;
    font-size: 10px;
}
.ic-subtype span { color: #999; font-weight: bold; }

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

/* Match pob-viewer footer size */
.site-footer { zoom: 0.9; }
