/* ============================================
   STATS PANEL
   Charts, mana curve, synergy stats, widgets
   ============================================ */

/* Stats Charts Layout */
.stats-charts {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

/* Main Grid Layout */
.stats-grid-main {
    display: grid;
    gap: 16px;
    grid-template-columns: 1fr;
    grid-template-areas:
        "arch" "cons" "mana" "type"
        "color" "prod" "rare" "tags"
        "synd" "weak" "func" "syng" "comb";
}

/* Base Area Assignments */
.grid-item-arch {
    grid-area: arch;
}

.grid-item-cons {
    grid-area: cons;
}

.grid-item-mana {
    grid-area: mana;
}

.grid-item-type {
    grid-area: type;
}

.grid-item-color {
    grid-area: color;
}

.grid-item-prod {
    grid-area: prod;
}

.grid-item-rare {
    grid-area: rare;
}

.grid-item-tags {
    grid-area: tags;
}

.grid-item-synd {
    grid-area: synd;
}

.grid-item-weak {
    grid-area: weak;
}

.grid-item-func {
    grid-area: func;
}

.grid-item-syng {
    grid-area: syng;
}

.grid-item-comb {
    grid-area: comb;
}

.stats-score-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: stretch;
}

.stats-score-bar .stat-item {
    flex: 1 1 120px;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    min-height: 140px;
    padding: 12px;
    background: var(--widget-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.stats-score-bar .stat-item .stat-label {
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--chart-title-color);
    text-align: center;
    flex-shrink: 0;
    margin-bottom: 8px;
}

.stats-score-bar .stat-item .stat-value {
    font-size: 2.2em;
    font-weight: 700;
    text-align: center;
}





.stats-score-bar .stat-item .widget-content,
.stats-score-bar .stat-item .salt-score-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-score-bar .stat-item .widget-extras,
.stats-score-bar .stat-item .salt-extras {
    flex-shrink: 0;
    text-align: center;
}

/* Chart Container */
.chart-container {
    flex: 1;
    background: var(--widget-bg);
    padding: 12px;
    border-radius: 8px;
}

/* Enhanced Chart Container */
.chart-container {
    background: var(--widget-bg);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 250px;
}

.chart-title {
    font-size: 0.85em;
    color: var(--chart-title-color);
    margin: 0 0 10px 0;
    text-align: center;
}

/* Mana Curve */
.mana-curve {
    height: 100px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

.curve-bars {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    height: 80px;
    gap: 4px;
}

.curve-bar-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    height: 80px;
}

.curve-bar {
    width: 100%;
    min-width: 20px;
    max-width: 30px;
    min-height: 8px;
    background: linear-gradient(to top, var(--accent-color), var(--accent-hover));
    border-radius: 4px 4px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    position: relative;
    transition: height 0.3s ease;
}

.bar-count,
.bar-total {
    font-size: 0.65em;
    color: #fff;
    position: absolute;
    top: -16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.curve-label {
    font-size: 0.7em;
    color: #888;
    margin-top: 4px;
}

/* Stacked bar for 0 CMC column */
.stacked-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    width: 100%;
}

.spell-bar,
.proactive-bar {
    background: linear-gradient(to top, var(--accent-color), var(--accent-hover)) !important;
}

.reactive-bar {
    background: linear-gradient(to top, var(--type-instant), #5dade2) !important;
}

.land-bar {
    background: linear-gradient(to top, #8B4513, #A0522D) !important;
    border-radius: 0 !important;
}

.stacked-bar .curve-bar:first-child {
    border-radius: 4px 4px 0 0;
}

.mana-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    padding-bottom: 8px;
    width: 100%;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
}

/* Stats Row 2 */
.stats-row-2 {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: stretch;
}

.stats-row-2 .stat-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--widget-bg);
    border-radius: 12px;
    min-width: 100px;
    min-height: 130px;
}

.stats-row-2 .stat-label {
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 500;
    text-align: center;
    flex-shrink: 0;
}

.stats-row-2 .stat-value {
    font-size: 1.6em;
    font-weight: 700;
    color: var(--accent-color);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stats-row-2 .type-breakdown {
    flex: 1;
    min-width: 200px;
}

.stats-color-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

/* Stat Item */
.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    justify-content: center;
    padding: 12px 20px;
    background: var(--widget-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    min-width: 80px;
}

.stat-label {
    font-size: 0.7em;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--accent-color);
}

/* Type Breakdown */
.type-breakdown {
    flex: 1;
    min-width: 200px;
}

.type-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    justify-content: center;
    width: 100%;
}

.type-bar-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.type-label {
    font-size: 0.7em;
    color: #888;
    width: 80px;
    text-align: right;
}

.type-bar-container {
    flex: 1;
    height: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.type-bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.type-count {
    font-size: 0.75em;
    color: #aaa;
    width: 24px;
    text-align: right;
}

/* Color/Rarity Pie Charts */
.color-pie,
.rarity-pie {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
}

.pie-chart-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex: 1;
    padding: 8px;
}

.pie-chart {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.pie-legend {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85em;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.legend-label {
    color: var(--text-secondary);
    white-space: nowrap;
}

/* Synergy Stats */
.synergy-stats {
    padding: 10px;
}

.stats-title {
    margin: 0 0 16px 0;
    color: var(--accent-color);
    font-size: 1.1em;
}

.synergy-title {
    font-size: 1em;
    color: #aaa;
    margin: 16px 0 10px 0;
}

.synergy-count {
    margin: 0 0 10px 0;
    color: #888;
    font-size: 0.9em;
}

.synergy-count strong {
    color: var(--accent-color);
    font-size: 1.2em;
}

.synergy-filter-row {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.synergy-dropdown {
    flex: 1;
    padding: 10px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 6px;
    color: var(--text-color);
    font-size: 1em;
    cursor: pointer;
}

.synergy-dropdown:focus {
    outline: none;
    border-color: var(--accent-color);
}

.synergy-badge-count {
    background: var(--accent-color);
    color: #000;
    font-weight: bold;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.9em;
    min-width: 30px;
    text-align: center;
}

.synergy-badge-count.empty {
    background: #444;
    color: #888;
}

.no-synergies {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.synergy-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Stats Synergy Container */
.stats-synergy-container {
    background: var(--widget-bg);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
}

.stats-synergy-container .info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-synergy-container .info-header .info-name {
    font-weight: bold;
    color: var(--accent-light);
    font-size: 1.1em;
}

.stats-synergy-container .info-header .info-synergies {
    color: #aaa;
    font-size: 0.9em;
}

/* Grouped Interactions Container */
.grouped-interactions-container {
    display: flex;
    gap: 20px;
    background: var(--widget-bg);
    border-radius: 8px;
    padding: 15px;
}

.focus-card-column {
    width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.focus-card-image img {
    /* width: 100%; - REMOVED: Conflicts with .card-image-wrapper max-width sizing */
    border-radius: 4.75% / 3.5%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.focus-card-name {
    font-weight: bold;
    color: var(--accent-color);
    text-align: center;
    font-size: 0.9em;
}

.interactions-list-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.synergy-group {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

.synergy-group-header {
    width: 100%;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 10px;
    border-radius: 4px;
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
}

/* Partner Links */
.partner-link {
    display: inline-block;
    cursor: pointer;
    transition: color 0.2s ease;
    position: relative;
    padding: 2px 0;
}

.partner-link:hover {
    color: var(--accent-light);
}

.interaction-row {
    display: flex;
    align-items: center;
    padding: 4px 0 4px 15px;
}

.interaction-row:hover {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
}

.interaction-partner-name {
    flex: 1;
    text-align: left;
    font-weight: normal;
    color: #ddd;
}

.synergy-pair {
    display: flex;
    align-items: center;
    padding: 4px 0 4px 12px;
    font-size: 0.85em;
    color: #aaa;
}

.pair-card {
    color: var(--text-color);
}

.pair-connector {
    margin: 0 8px;
    color: var(--accent-color);
}

.pair-card.hoverable {
    position: relative;
    cursor: pointer;
    font-weight: 500;
}

.pair-card.hoverable:hover {
    color: var(--accent-color);
}

/* Salt Score Widget */
.salt-score-widget {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    align-items: center;
    padding: 12px 16px;
    background: var(--widget-bg);
    border-radius: 12px;
    min-width: 140px;
    min-height: 130px;
}

.salt-score-widget .stat-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85em;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.salt-score-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 0;
}

.salt-value {
    font-size: 2em;
    font-weight: 700;
    line-height: 1;
}

.salt-extras {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.salt-label {
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.salt-flavor {
    font-size: 0.7em;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    max-width: 140px;
}

.salt-total {
    font-size: 0.65em;
    color: var(--text-secondary);
    margin-top: 2px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.salt-badge {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid;
    border-radius: 8px;
    width: 100%;
}

.salt-badge-value {
    font-size: 1.3em;
    font-weight: 700;
    line-height: 1;
}

.salt-badge-label {
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.no-salt-data {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85em;
}

/* CMC Widget */
.cmc-widget {
    min-width: 120px;
}

.cmc-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.cmc-extras {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.cmc-label {
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cmc-flavor {
    font-size: 0.7em;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

/* Generic Widget Layout */
.widget-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.widget-extras {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.widget-label {
    font-size: 0.9em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.widget-flavor {
    font-size: 0.7em;
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
}

.widget-pct {
    font-size: 0.7em;
    color: var(--text-secondary);
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

/* Archetype Radar Chart */
.archetype-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    gap: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    position: relative;
}

.radar-svg {
    width: 100%;
    max-width: 250px;
    max-height: 250px;
    overflow: visible;
    flex-shrink: 1;
}

.radar-grid {
    fill: none;
    stroke: var(--input-border);
    stroke-width: 1px;
}

.radar-axis {
    stroke: var(--input-border);
    stroke-width: 1px;
}

.radar-data {
    fill: var(--radar-color);
    fill-opacity: 0.2;
    stroke: var(--radar-color);
    stroke-width: 2px;
    transition: all 0.5s ease-out;
}

.radar-point {
    fill: var(--radar-color);
    transition: all 0.5s ease-out;
}

.radar-label {
    fill: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.archetype-summary {
    margin-top: 4px;
    text-align: center;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    width: 100%;
}

/* Badge Styling */
.archetype-badge {
    position: relative;
    /* bottom: 8px; Removed relative to container */
    /* left: 50%; Removed */
    /* transform: translateX(-50%); Removed */
    margin-top: -8px;
    /* Slight pull-up closer to chart */
    margin-bottom: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03));
    border: 1.5px solid var(--radar-color);
    border-radius: 20px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--radar-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    max-width: 90%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
}

/* Multi-color gradient border for combined archetypes */
.archetype-badge.multi {
    border: 2px solid transparent;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03)) padding-box,
        linear-gradient(90deg, var(--color-1), var(--color-2)) border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Mobile Overrides */
/* ============================================
   RESPONSIVE GRID LAYOUTS
   ============================================ */

/* Mobile Stack (< 1024px) */
@media (max-width: 1023px) {
    .stats-grid-main {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .stats-score-bar {
        flex-direction: row !important;
        flex-wrap: wrap !important;
    }

    .stats-score-bar .stat-item {
        flex: 1 1 140px;
        width: auto !important;
        min-height: 110px;
        padding: 10px;
    }

    .stats-grid-main .chart-container {
        height: auto !important;
        min-height: 180px;
        max-height: none !important;
    }

    /* Radar chart mobile overrides */
    .grid-item-arch .chart-container {
        min-height: 280px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .archetype-radar .archetype-display {
        position: relative !important;
        height: auto !important;
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }

    .archetype-radar .radar-svg {
        max-width: 220px !important;
    }

    .weakness-checklist,
    .synergy-cluster-list {
        columns: 1 !important;
    }

    .weakness-row {
        flex-direction: row;
        justify-content: space-between;
        gap: 4px;
    }

    .weakness-info {
        min-width: 0;
        flex: 1;
    }

    .weakness-name {
        font-size: 0.78em;
    }

    .weakness-level {
        font-size: 0.65em;
        padding: 1px 5px;
    }
}

/* Standard Desktop (1024px - 1599px) */
@media (min-width: 1024px) and (max-width: 1599px) {
    .stats-grid-main {
        grid-template-columns: 1fr 1fr;
        grid-template-areas:
            "arch cons"
            "mana type"
            "color prod"
            "rare tags"
            "synd synd"
            "weak weak"
            "func func"
            "syng syng"
            "comb comb";
    }
}

/* Ultra-Wide Desktop (1600px+) */
@media (min-width: 1600px) {
    .stats-grid-main {
        grid-template-columns: 1fr 1fr 1fr;
        grid-template-areas:
            "arch tags cons"
            "mana rare type"
            "color prod synd"
            "weak weak weak"
            "func func func"
            "syng syng comb";
    }
}

/* ============================================
   NEW STATS INSIGHT ROWS (Rows 4 & 5)
   ============================================ */



/* ============================================
   MANA PRODUCTION CHART
   ============================================ */

.mana-production-container {
    min-height: 240px;
}

.mana-prod-subtitle {
    font-size: 0.75em;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 10px;
    font-style: italic;
}

.mana-prod-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85em;
    text-align: center;
    padding: 16px 0;
}

.mana-prod-bars {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
    justify-content: center;
    padding: 4px 0;
}

/* Each color row: symbol | dual-bar group | warning */
.mana-prod-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.mana-prod-symbol {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mana-sym-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Two-bar group (pips on top, srcs below) */
.mana-prod-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.mana-prod-bar-row {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mana-prod-bar-label {
    font-size: 0.62em;
    color: var(--text-muted);
    width: 26px;
    text-align: right;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.mana-prod-bar-track {
    flex: 1;
    height: 11px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.mana-prod-bar {
    height: 100%;
    border-radius: 4px;
    min-width: 2px;
    transition: width 0.35s ease;
}

.pip-bar {
    opacity: 1.0;
}

.src-bar {
    opacity: 0.85;
}

.mana-prod-bar-count {
    font-size: 0.65em;
    color: var(--text-muted);
    width: 18px;
    text-align: right;
    flex-shrink: 0;
}

/* Warning column */
.mana-prod-warn-col {
    width: 16px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mana-warn-badge {
    font-size: 0.85em;
    color: var(--warning-color);
    cursor: default;
}

/* Legend row at bottom */
.mana-prod-legend {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 8px;
    flex-wrap: wrap;
    font-size: 0.7em;
    color: var(--text-muted);
}

.mana-leg-pip {
    color: var(--accent-color);
    font-weight: 600;
}

.mana-leg-src {
    color: var(--text-secondary);
}

.mana-leg-warn {
    color: var(--warning-color);
}

/* ============================================
   RELIABILITY DIAMOND (Consistency Widget)
   ============================================ */

.reliability-diamond-container {
    min-height: 240px;
}

.reliability-diamond {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

/* SVG diamond chart */
.diamond-svg {
    width: 100%;
    max-width: 200px;
    max-height: 200px;
    overflow: visible;
}

.diamond-data {
    fill: rgba(158, 158, 255, 0.18);
    stroke: var(--accent-color);
    stroke-width: 2px;
    transition: all 0.5s ease-out;
}

.radar-node {
    cursor: help;
    transition: r 0.15s ease-out, opacity 0.15s;
    opacity: 0.9;
}

.radar-node:hover {
    r: 6;
    opacity: 1;
}

/* Label overrides — keep same size as archetype radar labels */
.diamond-label {
    fill: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Numeric score table below the diamond */
.diamond-scores {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
    margin-top: 4px;
}

.diamond-score-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 8px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.78em;
    transition: background 0.15s;
}

.diamond-score-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.diamond-score-row.score-warn {
    border-left: 2px solid var(--warning-color);
}

.diamond-axis-name {
    color: var(--text-secondary);
    font-weight: 500;
}

.diamond-axis-score-group {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.diamond-axis-value {
    font-weight: 700;
    font-size: 0.9em;
    text-align: right;
}

.diamond-axis-target {
    color: var(--text-muted);
    font-size: 0.85em;
}

/* Hint list */
.diamond-hints {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 4px;
}

/* Standardized Stat Insights */
.stat-insight {
    font-size: 0.74em;
    margin: 0;
    padding: 6px 10px;
    border-radius: 0 4px 4px 0;
    border-left: 3px solid transparent;
    line-height: 1.4;
    display: flex;
    align-items: flex-start;
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
    animation: fadeIn 0.3s ease-out;
}

.stat-insight-icon {
    flex-shrink: 0;
    font-size: 1.1em;
    margin-top: 2px;
}

.stat-insight-content {
    flex: 1;
    display: inline;
}

.insight-warning {
    color: var(--warning-color);
    background: rgba(255, 215, 0, 0.06);
    border-left-color: var(--warning-color);
}

.insight-critical {
    color: var(--danger-color);
    background: rgba(255, 77, 77, 0.06);
    border-left-color: var(--danger-color);
}

.insight-info {
    color: var(--type-instant);
    background: rgba(52, 152, 219, 0.06);
    border-left-color: var(--type-instant);
}

.insight-success {
    color: var(--success-color);
    background: rgba(76, 175, 80, 0.06);
    border-left-color: var(--success-color);
}

.curve-insights {
    margin-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 12px;
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ============================================
   TAG CLOUD
   ============================================ */

.tag-cloud-container {
    min-height: 240px;
    display: flex;
    flex-direction: column;
}

/* Toggle Button in footer */

.tag-cloud-toggle {
    font-size: 0.72em;
    padding: 3px 8px;
    background: var(--accent-bg);
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    color: var(--accent-color);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
    font-family: inherit;
}

.tag-cloud-toggle:hover {
    background: var(--accent-color);
    color: var(--bg-color);
}

.tag-cloud-footer {
    display: flex;
    justify-content: flex-end;
    padding-right: 8px;
    margin-top: auto;
}

.tag-cloud-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85em;
    text-align: center;
    padding: 20px 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Chip cloud wrapper */
.tag-cloud-chips {
    flex: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    line-height: 1.8;
}

/* Individual pill chip */
.tag-cloud-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 14px;
    border: 1px solid transparent;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: default;
    transition: opacity 0.2s, transform 0.15s;
}

.tag-cloud-chip:hover {
    opacity: 0.85;
    transform: scale(1.06);
}

/* Count badge inside chip */
.tag-cloud-count {
    font-size: 0.72em;
    font-weight: 500;
    opacity: 0.75;
    background: rgba(0, 0, 0, 0.18);
    padding: 0 4px;
    border-radius: 6px;
    min-width: 14px;
    text-align: center;
}

/* ============================================
   SYNERGY DENSITY SCORE
   ============================================ */

.synergy-density-container {
    min-height: 240px;
}

.synergy-density-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85em;
    text-align: center;
    padding: 20px 0;
}

.synergy-density-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    flex: 1;
}

/* Donut ring */
.synergy-donut-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.synergy-donut {
    overflow: visible;
    transition: all 0.4s ease;
}

.synergy-donut-pct {
    font-size: 13px;
    font-weight: 700;
    fill: var(--text-color);
}

.synergy-donut-label {
    font-size: 0.74em;
    color: var(--text-muted);
    font-style: italic;
    text-transform: capitalize;
    letter-spacing: 0.04em;
}

/* Cluster list */
.synergy-cluster-list {
    width: 100%;
    columns: 1;
    gap: 16px;
}

@media (min-width: 900px) {
    .synergy-cluster-list {
        columns: 2;
    }
}

@media (min-width: 1400px) {
    .synergy-cluster-list {
        columns: 3;
    }
}

.synergy-cluster-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    margin-bottom: 4px;
    border-radius: 6px;
    font-size: 0.78em;
    transition: background 0.15s;
    break-inside: avoid;
}

.synergy-cluster-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.cluster-active {
    color: var(--text-color);
}

.cluster-orphan-src {
    color: var(--warning-color);
    opacity: 0.9;
}

.cluster-orphan-pay {
    color: var(--type-instant);
    opacity: 0.9;
}

.cluster-icon {
    flex-shrink: 0;
    font-size: 0.9em;
}

.cluster-name {
    flex: 1;
    font-weight: 500;
}

.cluster-edges {
    font-size: 0.85em;
    color: var(--text-muted);
    min-width: 20px;
    text-align: right;
}

.cluster-hint {
    font-size: 0.8em;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   Vulnerability PROFILE
   ============================================ */

.weakness-profile-container {
    min-height: 240px;
}

/* Card Link in Suggestions */
.card-link-suggestion {
    color: var(--accent-color);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
    /* Subtle space where underline would be */
    padding-bottom: 1px;
}

.card-link-suggestion:hover {
    color: var(--accent-light, #c0c0ff);
    border-bottom: 1px solid var(--accent-glow);
    filter: brightness(1.1);
}

.weakness-checklist {
    width: 100%;
    columns: 1;
    gap: 12px;
}

@media (min-width: 900px) {
    .weakness-checklist {
        columns: 2;
    }
}

.weakness-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px;
    margin-bottom: 8px;
    border-radius: 8px;
    border-left: 3px solid transparent;
    background: rgba(255, 255, 255, 0.02);
    transition: background 0.15s;
    flex-wrap: wrap;
    break-inside: avoid;
}

.weakness-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.check-healthy {
    border-left-color: var(--success-color);
}

.check-minor {
    border-left-color: var(--type-instant);
}

.check-moderate {
    border-left-color: var(--warning-color);
}

.check-critical {
    border-left-color: var(--danger-color);
}

.weakness-icon {
    font-size: 0.9em;
    flex-shrink: 0;
    margin-top: 1px;
}

.weakness-info {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 100px;
}

.weakness-name {
    font-size: 0.82em;
    font-weight: 600;
    color: var(--text-color);
}

.weakness-count {
    font-size: 0.72em;
    color: var(--text-muted);
}

.weakness-level {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
    align-self: flex-start;
}

.check-healthy .weakness-level {
    background: rgba(76, 175, 80, 0.15);
    color: var(--success-color);
}

.check-minor .weakness-level {
    background: rgba(52, 152, 219, 0.15);
    color: var(--type-instant);
}

.check-moderate .weakness-level {
    background: rgba(255, 215, 0, 0.15);
    color: var(--warning-color);
}

.check-critical .weakness-level {
    background: rgba(255, 77, 77, 0.15);
    color: var(--danger-color);
}

.weakness-hint {
    width: 100%;
    margin: 4px 0 0 0;
    font-size: 0.74em;
    color: var(--text-secondary);
    font-style: italic;
    line-height: 1.4;
}

/* ============================================
   FUNCTIONAL CURVE — CAST TIMING WINDOW
   ============================================ */

.functional-curve-container {
    min-height: 240px;
}

/* ── Main wrapper ── */
.fc-main-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    position: relative;
}

/* ── Heat Map ── */

.fc-heatmap-section {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
}

.fc-heat-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 0;
}

.fc-heat-cmc-header {
    width: 36px;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    text-align: right;
    padding-right: 6px;
    vertical-align: bottom;
    padding-bottom: 4px;
}

.fc-heat-turn-header {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
    padding-bottom: 4px;
    vertical-align: bottom;
}

.fc-heat-cmc-label {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-secondary);
    text-align: right;
    padding-right: 6px;
    vertical-align: middle;
    white-space: nowrap;
}

.fc-heat-row {
    height: 22px;
}

.fc-heat-cell {
    text-align: center;
    vertical-align: middle;
    border-radius: 2px;
    cursor: default;
    transition: filter 0.12s, border-color 0.12s;
    position: relative;
}

.fc-heat-cell:hover {
    filter: brightness(1.35);
    border-color: rgba(255, 255, 255, 0.3) !important;
    z-index: 2;
}

/* High-coverage cell marker dot */
.fc-heat-dot {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    vertical-align: middle;
}

.fc-heat-turn-label {
    font-size: 0.72em;
    color: var(--text-muted);
    text-align: center;
    margin-top: 4px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* ── Lane Toggle Button ── */

.fc-lane-toggle {
    align-self: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.72em;
    padding: 4px 14px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-family: inherit;
    letter-spacing: 0.03em;
    z-index: 10;
    position: relative;
}

.fc-lane-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-color);
}

/* ── Swim Lane Section ── */

.chart-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.chart-title-row.centered {
    justify-content: center;
    position: relative;
}

.chart-title-row.centered .fc-axis-hint {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

.chart-title-row .chart-title {
    margin: 0;
}

/* Wrapper holds the SVG + tooltip */
.fc-wrapper {
    position: relative;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.fc-plot-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

.fc-empty {
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85em;
    text-align: center;
    padding: 20px 0;
}

.fc-axis-hint {
    font-size: 0.7em;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0.04em;
    opacity: 0.8;
}

/* ── SVG text elements ── */

.fc-axis-label {
    font-size: 8px;
    fill: var(--text-muted, #777);
    font-family: inherit;
}

.fc-axis-label-main {
    font-size: 10px;
    font-weight: 700;
    fill: var(--text-secondary, #bbb);
    font-family: inherit;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.fc-band-label {
    font-size: 8px;
    font-weight: 700;
    fill: var(--text-secondary, #999);
    font-family: inherit;
}

.fc-grid-line {
    stroke: rgba(255, 255, 255, 0.05);
    stroke-width: 1;
}

/* ── Swim lane segment colors ── */

.fc-seg {
    rx: 0.5;
    transition: filter 0.15s, opacity 0.15s, stroke 0.15s;
    pointer-events: none;
}

/* Sweet Spot — bright teal; fully opaque so it paints over the heat map background */
.fc-seg-sweet {
    fill: #2dd4c4;
    opacity: 1.0;
}

/* Declining Value — warm orange; fully opaque over heat map */
.fc-seg-declining {
    fill: #f39c12;
    opacity: 1.0;
}

/* Reactive — muted blue; slightly more opaque so it shows over heat map */
.fc-seg-reactive {
    fill: #3498db;
    opacity: 0.80;
}

/* Reliability marker — dot at expected_turn (where avg hand can cast it) */
.fc-dot-expected {
    fill: #2dd4c4;
    stroke: rgba(0, 0, 0, 0.5);
    stroke-width: 0.5px;
    filter: drop-shadow(0 0 1.5px rgba(45, 212, 196, 0.6));
    pointer-events: none;
}

.fc-window-arrow {
    font-size: 8px;
    fill: #f39c12;
    font-family: inherit;
    font-weight: bold;
    pointer-events: none;
}

/* ── Swim lane hover highlighting ── */

.fc-window {
    transition: transform 0.1s;
    pointer-events: all;
}

.fc-row-highlighter {
    opacity: 0;
    transition: opacity 0.1s;
    fill: rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.fc-window:hover .fc-row-highlighter {
    opacity: 1;
}

.fc-window:hover .fc-seg {
    filter: brightness(1.35) contrast(1.1);
    opacity: 1;
    stroke: rgba(255, 255, 255, 0.7) !important;
    stroke-width: 0.4px;
}

.fc-window:hover .fc-dot-expected {
    filter: brightness(1.5) drop-shadow(0 0 3px rgba(45, 212, 196, 1));
    stroke: white !important;
}

.fc-hover-target {
    cursor: crosshair;
    pointer-events: all !important;
}

/* ── Tooltip ── */

.fc-tooltip {
    position: absolute;
    pointer-events: none;
    background: var(--card-bg, #1a1b26);
    border: 1px solid var(--border-color, #414868);
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 11px;
    color: var(--text-color, #c0caf5);
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

/* ── Controls bar (button row below SVG) ── */

.fc-controls-row {
    display: flex;
    justify-content: flex-end;
    padding: 4px 0;
}

.fc-lane-toggle {
    background: transparent;
    border: 1px solid var(--border-color, #414868);
    border-radius: 4px;
    color: var(--text-muted, #8b949e);
    cursor: pointer;
    font-size: 0.75em;
    padding: 3px 10px;
    transition: background 0.15s, color 0.15s;
}

.fc-lane-toggle:hover {
    background: var(--hover-bg, rgba(255, 255, 255, 0.06));
    color: var(--text-color, #c0caf5);
}

/* ── Legend (3 items) ── */

.fc-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 8px;
    font-size: 0.72em;
    color: var(--text-muted);
}

.fc-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.fc-legend-item::before {
    content: "";
    display: inline-block;
    border-radius: 2px;
    width: 10px;
    height: 3px;
}

.fc-leg-sweet::before {
    background: #2dd4c4;
}

.fc-leg-declining::before {
    background: #f39c12;
}

.fc-leg-reactive::before {
    background: #3498db;
    opacity: 0.6;
}
/* X spell legend: gradient orange (less value) -> teal (sweet spot) */
.fc-leg-x-spell::before {
    background: linear-gradient(to right, #f39c12 40%, #2dd4c4 60%);
}

/* Teal arrow on X spell lines (always-scaling indicator) */
.fc-window-arrow-sweet {
    font-size: 8px;
    fill: #2dd4c4;
    font-family: inherit;
    font-weight: bold;
    pointer-events: none;
}
