.stats-content {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

@media (min-width: 1200px) {
    .stats-content {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .stats-content {
        grid-template-columns: 1fr;
    }
}

/* ===== Stat block — dota1x6 chrome =====
   Flat card bg #0a1823, no border, sharp 2px corners, dropshadow.
   Heading: Reaver-uppercase with thin orange underline (10% width). */
.stat-block {
    background: var(--color-bg-base, #0a1823);
    border: none;
    border-radius: 2px;
    padding: 16px 18px 14px;
    box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.85),
                inset 0 0 0 1px rgba(255, 255, 255, 0.02);
    overflow: visible;
}

.stat-block h2 {
    margin: 0 0 14px 0;
    padding-bottom: 10px;
    font-family: var(--font-display, 'Reaver');
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-strong, #fff);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
}
.stat-block h2::before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 36px;
    height: 2px;
    background: var(--color-primary-500, #fb8c07);
}
.stat-block h2 .title-text { display: inline; }

.stat-block table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    table-layout: fixed;
}

.stat-block table thead th {
    background-color: #0e222e;
    background-image: url('../../assets/images/bg/table-head.png');
    padding: 10px 8px;
    text-align: left;
    border: none;
    font-family: var(--font-sans);
    font-size: 10px;
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.stat-block table td {
    padding: 10px 8px;
    background-color: transparent;
    border: none;
    color: var(--color-text-default);
    box-shadow: inset 0 -1px 0 0 rgba(255, 255, 255, 0.03);
}

.stat-block table tbody tr:last-child td { box-shadow: none; }

.stat-block table tbody tr {
    transition: background-color 150ms ease;
}
.stat-block table tbody tr:hover td {
    background-color: var(--color-bg-surface-3, #0f212c);
}
.stat-block table tbody tr.current-user-row td {
    background: linear-gradient(90deg,
        rgba(251, 140, 7, 0.10) 0%,
        rgba(251, 140, 7, 0.02) 100%);
    box-shadow: inset 2px 0 0 0 var(--color-primary-500);
}

/* hero/ability icon base — overridden in fixed-cell section below */

.no-data {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 20px;
}

.tooltip-trigger {
    cursor: help;
    color: var(--accent);
    margin-left: 5px;
}

.tooltip-text {
    display: none;
    position: absolute;
    background: var(--bg-surface-elevated);
    color: var(--text-primary);
    padding: 8px;
    border-radius: 4px;
    font-size: 12px;
    max-width: 200px;
    z-index: 1000;
    border: 1px solid var(--border-primary);
}

.tooltip-trigger:hover .tooltip-text {
    display: block;
}

/* Filter header */
.stats-page-header {
    background: var(--bg-surface-elevated);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.stats-filter-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 120px;
}

.filter-group label {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
}

.filter-group select,
.filter-group input[type="number"] {
    padding: 12px 16px;
    border: 1px solid var(--border-primary);
    border-radius: 8px;
    background: var(--bg-surface);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.filter-group select:focus,
.filter-group input[type="number"]:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-muted);
}

.filter-group select:hover,
.filter-group input[type="number"]:hover {
    border-color: var(--accent);
}

.stats-submit-btn {
    padding: 12px 24px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-start;
}

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

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

.season-info {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
}

/* Simple headers */
.stat-block-header {
    margin-bottom: 15px;
}

.stat-block-header h2 {
    margin-bottom: 0;
    font-size: 16px;
}

.stat-block h2 {
    margin-bottom: 15px;
    font-size: 16px;
}

/* Tooltip with subfilter */
.tooltip-trigger {
    position: relative;
    cursor: pointer;
    margin-left: 8px;
}

.tooltip-trigger.has-filter {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
    transition: all 0.2s ease;
}

.tooltip-trigger.has-filter:hover {
    background: var(--accent-hover);
    transform: scale(1.1);
}

/* Advanced tooltip with subfilter */
.tooltip-trigger .tooltip-text.with-filter {
    min-width: 200px;
    padding: 12px;
    background: var(--bg-surface-elevated);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border: 1px solid var(--border-primary);
}

.filter-in-tooltip {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-primary);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-in-tooltip label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.filter-control {
    display: flex;
    gap: 6px;
    align-items: center;
}

.filter-control input {
    width: 60px;
    padding: 4px 6px;
    border: 1px solid var(--border-primary);
    border-radius: 4px;
    background: var(--bg-surface);
    font-size: 11px;
    color: var(--text-primary);
    outline: none;
}

.filter-control button {
    width: 24px;
    height: 24px;
    padding: 0;
    background: var(--color-negative);
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-control button:hover {
    opacity: 0.85;
    transform: scale(1.05);
}

/* Column widths for fixed table layout */
.stat-block table th:first-child,
.stat-block table td:first-child {
    width: 2rem;
    text-align: center;
}
/* Last numeric columns — fixed narrow */
.stat-block table th:nth-child(n+3),
.stat-block table td:nth-child(n+3) {
    width: 4.5rem;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.stat-block table th:nth-child(n+3) {
    font-size: 11px;
}
/* Instant tooltip on hover for cells with data-tip */
.stat-block table td[data-tip] {
    cursor: help;
    position: relative;
    overflow: visible !important;
}
.stat-block table td[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: 100%;
    right: 0;
    padding: 4px 8px;
    background: var(--bg-surface-elevated, #1e2328);
    color: var(--text-primary, #e0e0e0);
    font-size: 11px;
    white-space: nowrap;
    border-radius: 4px;
    border: 1px solid var(--border-primary, rgba(255,255,255,0.1));
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s;
    z-index: 100;
}
.stat-block table td[data-tip]:hover::after {
    opacity: 1;
}
/* Name column (2nd) takes remaining space */
.stat-block table th:nth-child(2),
.stat-block table td:nth-child(2) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Prevent stat-block from growing beyond grid cell.
   overflow: visible is required so .tooltip-text (positioned at bottom: 140%
   above the trigger inside h2) is not clipped by the block. min-width: 0
   handles the grid sizing on its own; individual cells (.hero-cell,
   .ability-cell, .player-cell) already do their own ellipsis clipping. */
.stat-block {
    overflow: visible;
    min-width: 0;
}

/* Fixed height cells */
.hero-cell, .ability-cell, .player-cell {
    height: 35px;
    vertical-align: middle;
    padding: 4px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hero-cell, .ability-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    overflow: hidden;
}
.hero-cell a, .ability-cell a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
}

.hero-cell img, .ability-cell img {
    width: 24px;
    height: 24px;
    flex: none;
    vertical-align: middle;
    border-radius: 2px;
}

.hero-cell span, .ability-cell span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    line-height: 1.1;
}

/* Fixed row height */
.stat-block table tr {
    height: 35px;
}

.stat-block table td {
    vertical-align: middle;
    padding: 4px 8px;
    font-size: 13px;
}

.stat-block table th {
    vertical-align: middle;
    padding: 6px 8px;
    font-size: 13px;
}

/* Responsive filters */
@media (max-width: 768px) {
    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        min-width: auto;
        width: 100%;
    }

    .stats-submit-btn {
        align-self: stretch;
        margin-top: 10px;
    }

    .stat-block-header {
        position: relative;
    }

    .sub-filter {
        position: static;
        margin-top: 4px;
        justify-content: flex-end;
        background: rgba(255,255,255,0.05);
    }

    .sub-filter-input {
        width: 45px;
    }
}
