﻿.tier-page {
    min-height: 100vh;
    padding: 20px;
    background: var(--sc-page-bg);
}

.tier-overview {
    display: grid;
    grid-template-columns: minmax(320px, .9fr) minmax(340px, .82fr) minmax(520px, 1.35fr);
    gap: 12px;
    align-items: stretch;
    margin-bottom: 12px;
}

.tier-left {
    min-width: 0;
    display: grid;
    align-content: start;
    gap: 12px;
}

.record-card {
    min-width: 0;
    background: var(--sc-card-bg);
    border: 1px solid var(--sc-border);
    border-radius: var(--sc-radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--sc-shadow);
}

.search-card {
    display: flex;
    gap: 10px;
    margin-bottom: 0;
}

.tier-search {
    flex: 1;
    border: none;
    border-radius: var(--sc-radius-sm);
    padding: 10px 12px;
    background: rgba(255,255,255,.8);
}

.tier-btn {
    border: none;
    border-radius: var(--sc-radius-sm);
    padding: 10px 20px;
    background: var(--sc-purple);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.tier-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.search-status {
    margin: 0;
    color: var(--sc-accent);
    font-weight: 700;
}

.search-status-text {
    line-height: 1.35;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: var(--sc-page-bg);
    backdrop-filter: none;
}

.loading-dialog {
    width: min(540px, calc(100vw - 32px));
    border: 1px solid rgba(255,255,255,.86);
    border-radius: 16px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 24px 70px rgba(15,23,42,.18);
    padding: 18px 20px 20px;
}

.loading-text {
    color: #2563eb;
    font-size: 17px;
    font-weight: var(--sc-font-heavy);
    line-height: 1.35;
    margin-bottom: 12px;
}

.search-progress {
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(37,99,235,.12);
}

.search-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sc-accent), var(--sc-purple));
    transition: width .18s ease;
}

.loading-percent {
    margin-top: 8px;
    color: #334155;
    text-align: right;
    font-size: 14px;
    font-weight: var(--sc-font-heavy);
}

.search-status.error {
    color: #dc2626;
}

.player-top {
    min-height: 86px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
}
    .player-top h2 {
        margin: 0 0 8px 0;
        font-size: 34px;
        font-weight: 800;
        color: var(--sc-text);
    }

.player-info {
    color: var(--sc-muted);
    margin-bottom: 8px;
}

.player-sub {
    font-size: 15px;
    color: #334155;
}

.tier-badge {
    min-width: 90px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0 16px;
    font-size: 16px;
    font-weight: 800;
    white-space: nowrap;
}

.tier-badge.tier-none {
    border: 1px solid #dbe2ee;
    background: #eef2f7;
    color: #64748b;
}

.tier-badges {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.admin-tier-form {
    display: grid;
    grid-template-columns: auto minmax(110px, 1fr) minmax(110px, 1fr) auto;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(148, 163, 184, .25);
}

.admin-tier-form input {
    min-width: 0;
    height: 40px;
    border: 1px solid rgba(191, 219, 254, .92);
    border-radius: 10px;
    padding: 0 10px;
    background: rgba(255, 255, 255, .8);
}

.admin-tier-form button {
    height: 40px;
    border: 0;
    border-radius: 10px;
    padding: 0 16px;
    background: var(--sc-accent);
    color: #fff;
    font-weight: var(--sc-font-heavy);
}

.admin-tier-form span {
    grid-column: 2 / -1;
    color: var(--sc-accent);
    font-weight: 800;
}

.tier-badge.tier-high,
.tier-badge.tier-mid,
.tier-badge.tier-low,
.tier-badge.tier-bottom {
    color: white;
}

.tier-badge.tier-high {
    background: #ef4444;
    box-shadow: 0 12px 28px rgba(239,68,68,.18);
}

.tier-badge.tier-mid {
    background: var(--sc-accent);
    box-shadow: 0 12px 28px rgba(37,99,235,.18);
}

.tier-badge.tier-low {
    background: #a78bfa;
    box-shadow: 0 12px 28px rgba(139,92,246,.18);
}

.tier-badge.tier-bottom {
    background: #111827;
    box-shadow: 0 12px 28px rgba(17,24,39,.18);
}

.player-card,
.map-card {
    margin-bottom: 0;
}

.map-card {
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: 16px;
}

.map-card .section-title {
    margin-bottom: 10px;
}

.map-card .map-table {
    flex: 1;
}

.map-table-wrap {
    width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
}

.stats-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, minmax(92px, 1fr));
    align-content: stretch;
    gap: 10px;
    min-width: 0;
  
}

.stat-card {
    min-height: 0;
    display: grid;
    align-content: center;
    text-align: center;
    padding: 12px 10px;
    margin-bottom: 0;
    overflow: hidden;
}

.stat-title {
    color: var(--sc-muted);
    font-size: 14px;
}

.stat-value {
    font-size: 22px;
    font-weight: 800;
}

.pie-chart svg {
    max-width: 100%;
}

.detail-loading {
    color: var(--sc-accent);
    font-size: 14px;
    font-weight: var(--sc-font-heavy);
    line-height: 1.35;
}

.detail-loading-inline {
    display: inline-block;
    color: var(--sc-accent);
    font-size: 11px;
    font-weight: 800;
    line-height: 1.25;
    white-space: normal;
}

.chart-summary-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.chart-card {
    min-width: 0;
    overflow: hidden;
    margin-bottom: 0;
}

.chart-card .section-title {
    margin-bottom: 4px;
    font-size: 22px;
}

.pie-chart {
    width: 100%;
    min-width: 0;
    height: 370px;
}

.pie-chart .c3-chart-arc text {
    fill: #fff;
    font-size: 15px;
    font-weight: var(--sc-font-heavy);
}

.pie-chart .c3-legend-item text {
    fill: var(--sc-text);
    font-size: 15px;
    font-weight: 800;
}

.pie-chart .c3-tooltip td,
.pie-chart .c3-tooltip th {
    font-size: 14px;
}

.chart-placeholder {
    min-height: 340px;
    display: grid;
    place-items: center;
    color: var(--sc-accent);
    font-weight: var(--sc-font-heavy);
}

.chart-placeholder.muted {
    color: var(--sc-muted);
}

.green {
    color: #16a34a;
}

.recent-table td.result-win {
    color: #ef4444;
    font-weight: var(--sc-font-heavy);
}

.recent-table td.result-lose {
    color: #111827;
    font-weight: var(--sc-font-heavy);
}

.recent-table td.result-draw {
    color: var(--sc-accent);
    font-weight: var(--sc-font-heavy);
}

.section-title {
    margin: 0 0 16px;
    font-size: 28px;
    font-weight: 800;
}

.recent-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 10px;
}

.recent-header .section-title {
    margin-bottom: 0;
}

.recent-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.recent-date {
    width: 142px;
    height: 38px;
    border: 1px solid #d5dce8;
    border-radius: var(--sc-radius-sm);
    background: rgba(255,255,255,.9);
    color: var(--sc-accent-strong);
    font-size: 15px;
    font-weight: 800;
    padding: 0 8px;
}

.recent-filter-btn {
    height: 38px;
    border: 0;
    border-radius: var(--sc-radius-sm);
    background: var(--sc-accent-strong);
    color: white;
    font-size: 14px;
    font-weight: var(--sc-font-heavy);
    padding: 0 18px;
    cursor: pointer;
}

.recent-summary {
    min-height: 42px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--sc-line);
    background: var(--sc-soft-bg);
    color: var(--sc-accent);
    font-weight: var(--sc-font-heavy);
    padding: 0 12px;
    margin-bottom: 14px;
}

.recent-summary strong {
    color: #111827;
}

.recent-empty {
    color: var(--sc-muted);
    font-weight: 700;
    margin: 18px 0 0;
}

.map-table,
.recent-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

    .map-table th,
    .map-table td,
    .recent-table th,
    .recent-table td {
        padding: 12px 16px;
        border-bottom: 1px solid rgba(0,0,0,.08);
        text-align: center;
        vertical-align: middle;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .map-table th,
    .map-table td {
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .map-table th,
    .recent-table th {
        background: rgba(255,255,255,.7);
        color: #111827;
        font-weight: 800;
    }

        .map-table td:first-child,
        .recent-table td:first-child,
        .map-table th:first-child,
        .recent-table th:first-child {
            text-align: left;
        }

.recent-table-wrap {
    height: 360px;
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-gutter: stable;
    border: 1px solid var(--sc-line);
    background: var(--sc-soft-bg);
}

.recent-table {
    min-width: 900px;
}
.recent-table thead th {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255,255,255,.95);
}

/* Keep mobile result panels inside the visual viewport. Equal-column grids stay
   1:1 instead of allowing their content to push one side off screen. */
@media (max-width: 1200px) {
    .tier-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .tier-left {
        grid-column: 1 / -1;
    }
}

@media (max-width: 820px) {
    .tier-page.home-record-search {
        width: 100%;
        min-width: 0;
        padding: 10px 0 24px;
        overflow-x: clip;
    }

    .tier-overview {
        width: 100%;
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .tier-left {
        grid-column: auto;
    }

    .stats-grid,
    .chart-summary-grid,
    .weapon-tier-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .record-card,
    .map-card,
    .chart-card,
    .stats-grid,
    .recent-table-wrap,
    .map-table-wrap {
        min-width: 0;
        max-width: 100%;
    }

    .map-table,
    .recent-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    .map-table th,
    .map-table td,
    .recent-table th,
    .recent-table td {
        padding: 9px 4px;
        font-size: clamp(9px, 2.7vw, 12px);
    }

    .recent-table-wrap {
        overflow-x: hidden;
        scrollbar-gutter: auto;
    }
}

.recent-match-row {
    cursor: pointer;
    transition: background-color .16s ease, box-shadow .16s ease;
}

.recent-match-row:hover,
.recent-match-row.expanded {
    background: rgba(219, 234, 254, .68);
    box-shadow: inset 3px 0 0 var(--sc-accent);
}

.match-expand-icon {
    display: inline-block;
    width: 18px;
    color: var(--sc-accent);
    font-weight: var(--sc-font-heavy);
}

.recent-table .match-detail-row > td {
    padding: 14px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    background: rgba(248, 250, 252, .96);
}

.match-detail-state {
    padding: 18px;
    color: var(--sc-muted);
    text-align: center;
    font-weight: 700;
}

.match-detail-state.error {
    color: #dc2626;
}

.match-team-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.match-team {
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--sc-line);
    border-radius: 12px;
    background: rgba(255, 255, 255, .9);
}

.match-team.winning-team {
    border-color: rgba(239, 68, 68, .35);
}

.match-team.losing-team {
    border-color: rgba(100, 116, 139, .35);
}

.match-team-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    color: #334155;
    background: rgba(241, 245, 249, .9);
}

.winning-team .match-team-title {
    color: #b91c1c;
    background: rgba(254, 226, 226, .75);
}

.match-team-title span {
    color: var(--sc-muted);
    font-size: 12px;
    font-weight: 700;
}

.match-player-table-wrap {
    overflow-x: auto;
}

.match-player-table {
    width: 100%;
    min-width: 360px;
    border-collapse: collapse;
}

.match-player-table th,
.match-player-table td {
    width: auto !important;
    padding: 9px 10px !important;
    border-bottom: 1px solid rgba(148, 163, 184, .18);
    text-align: center !important;
    white-space: nowrap !important;
}

.match-player-table th:first-child,
.match-player-table td:first-child {
    width: 46% !important;
    text-align: left !important;
}

.match-player-table tbody tr:last-child td {
    border-bottom: 0;
}

.match-player-table tr.searched-player td {
    color: #1d4ed8;
    background: rgba(219, 234, 254, .7);
    font-weight: var(--sc-font-heavy);
}

.recent-table th:nth-child(1),
.recent-table td:nth-child(1) {
    width: 18%;
}

.recent-table th:nth-child(2),
.recent-table td:nth-child(2) {
    width: 16%;
}

.recent-table th:nth-child(3),
.recent-table td:nth-child(3) {
    width: 13%;
}

.recent-table th:nth-child(4),
.recent-table td:nth-child(4) {
    width: 10%;
}

.recent-table th:nth-child(5),
.recent-table td:nth-child(5),
.recent-table th:nth-child(6),
.recent-table td:nth-child(6),
.recent-table th:nth-child(7),
.recent-table td:nth-child(7),
.recent-table th:nth-child(8),
.recent-table td:nth-child(8) {
    width: 7%;
}

.recent-table th:nth-child(9),
.recent-table td:nth-child(9) {
    width: 8%;
}

.recent-table th:nth-child(10),
.recent-table td:nth-child(10) {
    width: 7%;
}

.recent-table td:nth-child(2),
.recent-table td:nth-child(3) {
    overflow: hidden;
    text-overflow: ellipsis;
}

.map-table th:nth-child(1),
.map-table td:nth-child(1) {
    width: 20%;
}

.map-table th:nth-child(2),
.map-table td:nth-child(2) {
    width: 10%;
}

.map-table th:nth-child(3),
.map-table td:nth-child(3) {
    width: 18%;
    overflow: visible;
    text-overflow: clip;
}

.map-table th:nth-child(4),
.map-table td:nth-child(4),
.map-table th:nth-child(5),
.map-table td:nth-child(5),
.map-table th:nth-child(6),
.map-table td:nth-child(6),
.map-table th:nth-child(7),
.map-table td:nth-child(7) {
    width: 13%;
}

@media (max-width: 1200px) {
    .tier-overview {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .map-card {
        min-height: 0;
    }
}

@media (max-width: 900px) {
    .chart-summary-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 820px) {
    .tier-page {
        padding: 14px;
    }

    .record-card {
        padding: 16px;
    }

    .player-top {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .tier-badges {
        justify-items: start;
    }

    .admin-tier-form {
        grid-template-columns: 1fr;
    }

    .admin-tier-form span {
        grid-column: auto;
    }

    .section-title {
        font-size: 24px;
    }

    .recent-header {
        display: block;
    }

    .map-table th,
    .map-table td {
        padding: 12px 8px;
        font-size: 14px;
        overflow: visible;
        text-overflow: clip;
    }

    .map-table {
        min-width: 720px;
        table-layout: auto;
    }

    .recent-table th,
    .recent-table td {
        padding: 12px 10px;
        font-size: 14px;
    }

    .match-team-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        grid-template-rows: none;
        gap: 8px;
        margin-bottom: 20px;
    }

    .stats-grid .record-card {
        margin-bottom: 0;
    }

    .pie-chart {
        height: 320px;
    }
}

/* Liquid glass visual refresh */
.tier-page {
    background:
        radial-gradient(circle at 8% 4%, rgba(96, 165, 250, .42), transparent 30%),
        radial-gradient(circle at 92% 12%, rgba(196, 181, 253, .38), transparent 32%),
        radial-gradient(circle at 50% 100%, rgba(125, 211, 252, .28), transparent 36%),
        linear-gradient(145deg, #e9f2ff 0%, #f5f1ff 48%, #eaf8ff 100%);
    background-attachment: scroll;
}

.home-record-search {
    min-height: 0;
    padding: 8px 0 0;
    background: transparent;
}

.home-record-search.before-search {
    width: min(100%, 588px) !important;
}

.home-record-search.before-search .search-status {
    width: calc(100% - 116px);
    margin-top: 6px;
    padding-left: 2px;
    text-align: left;
}

.home-record-search.before-search .search-status-text {
    font-size: 15px;
}

.home-record-search.before-search .tier-overview,
.home-record-search.before-search .tier-left {
    display: block;
}

.home-record-search .search-card {
    border-radius: 18px;
    padding: 0 6px 0 0;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.home-record-search .tier-search {
    min-width: 0;
    min-height: 48px;
    border: 1px solid rgba(147, 197, 253, .7);
    font-size: 17px;
}

.home-record-search .tier-btn {
    flex: 0 0 auto;
    min-width: 100px;
    font-size: 16px;
    white-space: nowrap;
}

.home-record-search.has-results .tier-overview {
    position: relative;
    padding-top: 0;
}

.home-record-search.has-results .tier-left {
    height: 100%;
    grid-template-rows: auto minmax(0, 1fr) 126px;
}

.home-record-search.has-results .search-status {
    grid-row: 1;
}

.home-record-search.has-results .player-card {
    grid-row: 2;
    display: flex;
    align-items: center;
}

.home-record-search.has-results .weapon-tier-grid {
    grid-row: 3;
}

.home-record-search.has-results .weapon-tier-grid {
    height: 126px;
}

.home-record-search.has-results .weapon-record-card {
    height: 126px;
    min-height: 126px;
    padding: 12px;
}

.home-record-search.has-results .search-card {
    position: absolute;
    top: -58px;
    left: 50%;
    z-index: 5;
    width: min(588px, calc(100vw - 36px));
    transform: translateX(-50%);
}

@media (max-width: 1200px) {
    .home-record-search.has-results .tier-overview {
        padding-top: 0;
    }

    .home-record-search.has-results .search-card {
        position: static;
        width: 100%;
        margin-bottom: 12px;
        transform: none;
    }

    .home-record-search.has-results .tier-left {
        height: auto;
        grid-template-rows: none;
    }

    .home-record-search.has-results .search-status,
    .home-record-search.has-results .player-card,
    .home-record-search.has-results .weapon-tier-grid {
        grid-row: auto;
    }
}

.weapon-tier-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    min-height: 112px;
}

.weapon-record-card {
    min-height: 112px;
    display: grid;
    grid-template-columns: minmax(0, 35fr) minmax(0, 65fr);
    align-items: center;
    gap: 6px;
    margin-bottom: 0;
    text-align: center;
}

.weapon-tier-visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.weapon-tier-info {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.weapon-tier-info span {
    color: #405273;
    font-size: 16px;
    font-weight: var(--sc-font-heavy);
}

.weapon-tier-icon {
    width: clamp(52px, 5vw, 76px);
    height: clamp(52px, 5vw, 76px);
    display: inline-block;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    -webkit-mask: center / contain no-repeat;
    mask: center / contain no-repeat;
}

.weapon-tier-icon.rifle {
    -webkit-mask-image: url('/rifle.svg');
    mask-image: url('/rifle.svg');
}

.weapon-tier-icon.sniper {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    -webkit-mask-image: url('/sniper.svg');
    mask-image: url('/sniper.svg');
}

.weapon-tier-info strong {
    color: #0b1732;
    font-size: clamp(17px, 2vw, 24px);
    font-weight: var(--sc-font-black);
    white-space: nowrap;
}

.weapon-tier-value {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 7px;
    width: max-content;
    min-width: max-content;
    white-space: nowrap;
}

.weapon-tier-value strong {
    flex: 0 0 auto;
}

@media (max-width: 820px) {
    .weapon-tier-grid {
        min-height: 0;
    }

    .weapon-record-card {
        min-height: 78px;
        padding: 8px;
    }

    .weapon-tier-info {
        gap: 3px;
    }

    .weapon-tier-info span {
        font-size: 14px;
    }

    .weapon-tier-info strong {
        font-size: clamp(16px, 4.4vw, 20px);
        line-height: 1.15;
    }

    .weapon-tier-value {
        gap: 4px;
    }

    .weapon-tier-icon {
        width: 42px;
        height: 42px;
    }

}

.record-card {
    position: relative;
    border: 1.5px solid rgba(255, 255, 255, .96);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(240, 247, 255, .58)),
        rgba(255, 255, 255, .58);
    box-shadow:
        0 18px 48px rgba(37, 99, 235, .14),
        0 5px 16px rgba(15, 23, 42, .08),
        inset 0 1px 0 rgba(255, 255, 255, 1),
        inset 0 -1px 0 rgba(148, 163, 184, .16);
    transition: transform .24s ease, box-shadow .24s ease, border-color .24s ease;
}

.record-card::before {
    content: "";
    position: absolute;
    z-index: 2;
    top: 0;
    left: 12%;
    width: 76%;
    height: 1px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 1), transparent);
    pointer-events: none;
}

.player-card:hover,
.stat-card:hover,
.chart-card:hover,
.search-card:hover {
    transform: translateY(-3px);
    border-color: rgba(191, 219, 254, 1);
    box-shadow:
        0 24px 58px rgba(37, 99, 235, .2),
        0 8px 20px rgba(15, 23, 42, .1),
        inset 0 1px 0 #fff;
}

.tier-search,
.recent-date {
    min-height: 44px;
    border: 1.5px solid rgba(191, 219, 254, .92);
    background: rgba(255, 255, 255, .76);
    box-shadow: inset 0 2px 8px rgba(37, 99, 235, .07), 0 1px 0 #fff;
    font-size: 16px;
}

.tier-search:focus,
.recent-date:focus {
    outline: none;
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, .18), inset 0 1px 4px rgba(37, 99, 235, .06);
}

.tier-btn,
.recent-filter-btn {
    min-height: 44px;
    border: 1px solid rgba(255, 255, 255, .55);
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 12px 26px rgba(79, 70, 229, .28), inset 0 1px 0 rgba(255, 255, 255, .35);
    font-size: 15px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.tier-btn:hover,
.recent-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 17px 32px rgba(79, 70, 229, .34), inset 0 1px 0 rgba(255, 255, 255, .4);
}

.player-top h2 {
    color: #0d1933;
    font-size: clamp(36px, 2.7vw, 46px);
    font-weight: var(--sc-font-black);
    letter-spacing: -.03em;
}

.player-info,
.player-sub {
    color: #425475;
    font-size: 19px;
    font-weight: 750;
    line-height: 1.55;
}

.stat-card {
    min-height: 132px;
    border-color: rgba(219, 234, 254, .98);
    background:
        radial-gradient(circle at 82% 12%, rgba(191, 219, 254, .35), transparent 38%),
        linear-gradient(145deg, rgba(255, 255, 255, .92), rgba(239, 246, 255, .66));
}

.stat-title {
    color: #405273;
    font-size: 20px;
    font-weight: var(--sc-font-heavy);
    letter-spacing: -.01em;
}

.stat-value {
    margin-top: 5px;
    color: #0b1732;
    font-size: 35px;
    font-weight: var(--sc-font-black);
    letter-spacing: -.03em;
}

.stat-value.green {
    color: #0b9b5a;
}

.section-title {
    color: #0c1833;
    font-size: clamp(28px, 2.25vw, 35px);
    font-weight: var(--sc-font-black);
    letter-spacing: -.035em;
}

.chart-card .section-title {
    color: #152344;
    font-size: clamp(29px, 2vw, 34px);
}

.map-card .section-title {
    font-size: clamp(30px, 2.1vw, 36px);
}

.map-table,
.recent-table {
    border: 1px solid rgba(191, 219, 254, .66);
    border-radius: 14px;
    background: rgba(255, 255, 255, .38);
}

.map-table th,
.recent-table th {
    background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(232, 240, 255, .78));
    color: #34486e;
    font-size: 17px;
    font-weight: var(--sc-font-heavy);
}

.map-table td,
.recent-table td {
    border-bottom-color: rgba(148, 163, 184, .2);
    color: #1d2c49;
    font-size: 17px;
    font-weight: 800;
}

.map-table tbody tr,
.recent-table tbody tr {
    transition: background .18s ease, transform .18s ease;
}

.map-table tbody tr:hover,
.recent-table tbody tr:hover {
    background: rgba(219, 234, 254, .48);
}

.recent-summary {
    min-height: 50px;
    border: 1.5px solid rgba(191, 219, 254, .82);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .82), rgba(226, 238, 255, .58));
    box-shadow: inset 0 1px 0 #fff, 0 8px 22px rgba(37, 99, 235, .09);
    color: #2856a6;
    font-size: 18px;
}

.recent-summary strong {
    color: #0b1732;
    font-size: 19px;
}

.search-status-text {
    color: #1761d5;
    font-size: 18px;
    font-weight: var(--sc-font-heavy);
}

.recent-table .match-detail-row > td {
    border-bottom: 1px solid rgba(129, 140, 248, .55);
    background:
        radial-gradient(circle at 15% 0, rgba(254, 205, 211, .55), transparent 38%),
        radial-gradient(circle at 85% 0, rgba(199, 210, 254, .72), transparent 40%),
        linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(238, 242, 255, .88));
}

.recent-table .recent-match-row.expanded {
    background: linear-gradient(90deg, rgba(219, 234, 254, .96), rgba(237, 233, 254, .88));
    box-shadow: inset 4px 0 0 #4f46e5;
}

.match-team {
    border: 1.5px solid rgba(165, 180, 252, .88);
    border-radius: 14px;
    background: rgba(255, 255, 255, .92);
    box-shadow:
        0 12px 28px rgba(79, 70, 229, .14),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.match-team.winning-team {
    border-color: rgba(251, 113, 133, .82);
    box-shadow:
        0 12px 28px rgba(244, 63, 94, .16),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.match-team.losing-team {
    border-color: rgba(99, 102, 241, .7);
    box-shadow:
        0 12px 28px rgba(79, 70, 229, .16),
        inset 0 1px 0 rgba(255, 255, 255, 1);
}

.match-team-title {
    border-bottom: 1px solid rgba(99, 102, 241, .2);
    background: linear-gradient(135deg, rgba(224, 231, 255, .98), rgba(237, 233, 254, .92));
    color: #4338ca;
}

.winning-team .match-team-title {
    border-bottom-color: rgba(251, 113, 133, .32);
    background: linear-gradient(135deg, rgba(255, 228, 230, .98), rgba(254, 205, 211, .88));
    color: #e11d48;
}

.match-team-title strong {
    font-weight: var(--sc-font-black);
}

.match-team-title span {
    min-width: 34px;
    padding: 2px 7px;
    border: 1px solid rgba(99, 102, 241, .2);
    border-radius: 999px;
    background: rgba(255, 255, 255, .7);
    color: #4f46e5;
    text-align: center;
}

.winning-team .match-team-title span {
    border-color: rgba(244, 63, 94, .2);
    color: #e11d48;
}

.match-player-table th {
    background: rgba(238, 242, 255, .82);
    color: #3730a3;
}

.winning-team .match-player-table th {
    background: rgba(255, 241, 242, .9);
    color: #be123c;
}

.match-player-table tbody tr:nth-child(even) td {
    background: rgba(238, 242, 255, .38);
}

.winning-team .match-player-table tbody tr:nth-child(even) td {
    background: rgba(255, 241, 242, .55);
}

.match-player-table tbody tr:hover td {
    background: rgba(224, 231, 255, .88);
}

.winning-team .match-player-table tbody tr:hover td {
    background: rgba(255, 228, 230, .88);
}

.match-player-table tr.searched-player td {
    font-weight: var(--sc-font-black);
}

.match-player-table tr.searched-player-win td {
    color: #dc2626;
    background: #fee2e2 !important;
}

.match-player-table tr.searched-player-lose td {
    color: #1d4ed8;
    background: #dbeafe !important;
}

.match-player-table tr.searched-player-draw td {
    color: #475569;
    background: #e2e8f0 !important;
}

.pie-chart .c3-chart-arc text {
    font-size: 17px;
    font-weight: var(--sc-font-black);
}

.pie-chart .c3-legend-item text {
    fill: #243655;
    font-size: 18px;
    font-weight: 850;
}

.pie-chart .c3-tooltip td,
.pie-chart .c3-tooltip th {
    color: #17233d;
    font-size: 16px;
    font-weight: 750;
}

.recent-table-wrap {
    border: 1.5px solid rgba(191, 219, 254, .82);
    border-radius: 15px;
    background: rgba(255, 255, 255, .38);
    box-shadow: inset 0 1px 0 #fff;
}

.chart-placeholder,
.detail-loading {
    font-size: 17px;
    text-shadow: 0 1px 10px rgba(37, 99, 235, .12);
}

@media (max-width: 820px) {
    .record-card {
        border-radius: 17px;
        padding: 15px;
    }

    .stats-grid {
        margin-bottom: 12px;
    }

    .stats-grid .stat-card {
        min-height: 64px;
        padding: 8px 6px;
    }

    .stat-title {
        font-size: 12px;
        line-height: 1.2;
    }

    .stat-value {
        font-size: 20px;
        line-height: 1.2;
    }

    .pie-chart .c3-chart-arc text,
    .pie-chart .c3-legend-item text {
        font-size: 14px;
    }

    .chart-placeholder {
        min-height: 290px;
    }

    .player-info,
    .player-sub {
        font-size: 16px;
    }

    .map-table th,
    .map-table td,
    .recent-table th,
    .recent-table td {
        font-size: 14px;
    }

    .chart-card .section-title,
    .map-card .section-title,
    .section-title {
        font-size: 25px;
    }

    .search-status-text {
        font-size: 15px;
    }
}

.home-record-search.has-results .tier-left {
    height: 340px;
    grid-template-rows: minmax(0, 188px) 140px;
    gap: 12px;
    align-content: stretch;
}

.home-record-search.has-results .player-card {
    grid-row: 1;
    min-height: 188px;
    margin-bottom: 0;
}

.home-record-search.has-results .tier-mode-panel {
    grid-row: 2;
}

.home-record-search.has-results .weapon-tier-grid {
    height: auto;
    min-height: 0;
}

.home-record-search.has-results .weapon-record-card {
    height: 100%;
    min-height: 0;
    padding-block: 8px;
    box-sizing: border-box;
}

.tier-mode-panel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: grid;
    grid-template-rows: 36px minmax(0, 1fr);
    overflow: hidden;
    box-sizing: border-box;
    border: 1px solid rgba(191, 219, 254, .9);
    border-radius: 16px;
    background: rgba(255, 255, 255, .3);
    box-shadow: 0 10px 28px rgba(37, 99, 235, .1);
}

.tier-mode-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 3px;
    border: 0;
    border-bottom: 1px solid rgba(148, 163, 184, .45);
    border-radius: 0;
    background: rgba(255, 255, 255, .58);
    box-shadow: inset 0 1px 4px rgba(37, 99, 235, .08);
}

.tier-mode-toggle button {
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #42577b;
    font-weight: var(--sc-font-heavy);
    cursor: pointer;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.tier-mode-toggle button.active {
    background: linear-gradient(135deg, rgba(79, 124, 213, .94), rgba(126, 103, 199, .94));
    color: #fff;
    box-shadow:
        0 4px 12px rgba(76, 98, 165, .2),
        inset 0 1px 0 rgba(255, 255, 255, .28);
}

.tier-mode-panel .weapon-tier-grid {
    gap: 10px;
    padding: 5px 8px 8px;
    box-sizing: border-box;
}

.tier-mode-panel .weapon-record-card {
    border-radius: 12px;
    overflow: hidden;
}

.home-record-search.has-results .stats-grid {
    grid-template-rows: repeat(3, 106px);
}

.home-record-search.has-results .stat-card {
    min-height: 106px;
    padding-block: 8px;
}

.home-record-search.has-results .map-card {
    padding-block: 12px;
}

.home-record-search.has-results .map-card .section-title {
    margin-bottom: 6px;
}

.home-record-search.has-results .map-table th,
.home-record-search.has-results .map-table td {
    padding-top: 6px;
    padding-bottom: 6px;
}

@media (min-width: 1201px) {
    .home-record-search.has-results .tier-overview {
        grid-auto-rows: 340px;
    }

    .home-record-search.has-results .stats-grid,
    .home-record-search.has-results .map-card {
        height: 340px;
    }

    .home-record-search.has-results .player-top h2 {
        font-size: 38px;
    }

    .home-record-search.has-results .player-info,
    .home-record-search.has-results .player-sub {
        font-size: 16px;
        line-height: 1.4;
    }

    .home-record-search.has-results .weapon-tier-info {
        gap: 5px;
    }

    .home-record-search.has-results .weapon-tier-info span {
        font-size: 14px;
    }

    .home-record-search.has-results .weapon-tier-info strong {
        font-size: 21px;
    }

    .home-record-search.has-results .stat-title {
        font-size: 17px;
    }

    .home-record-search.has-results .stat-value {
        font-size: 30px;
    }

    .home-record-search.has-results .map-card .section-title {
        font-size: 28px;
        line-height: 1.15;
    }

    .home-record-search.has-results .map-table-wrap {
        overflow-x: hidden;
        overflow-y: hidden;
    }

    .home-record-search.has-results .recent-table-wrap {
        height: 600px;
    }

    .home-record-search.has-results .recent-header .section-title {
        font-size: 28px;
    }

    .home-record-search.has-results .recent-table .match-detail-row > td {
        padding: 8px;
    }

    .home-record-search.has-results .match-team-grid {
        gap: 8px;
    }

    .home-record-search.has-results .match-team-title {
        padding: 7px 10px;
        font-size: 14px;
    }

    .home-record-search.has-results .match-player-table th,
    .home-record-search.has-results .match-player-table td {
        padding: 5px 8px !important;
        font-size: 14px;
        line-height: 1.2;
    }
}

@media (max-width: 1200px) {
    .home-record-search.has-results .tier-left {
        height: auto;
        grid-template-rows: none;
    }

    .home-record-search.has-results .player-card,
    .home-record-search.has-results .tier-mode-panel,
    .home-record-search.has-results .weapon-tier-grid {
        grid-row: auto;
        min-height: 0;
    }

    .home-record-search.has-results .tier-mode-panel {
        height: 140px;
    }

    .home-record-search.has-results .stats-grid {
        grid-template-rows: none;
    }
}

/* Final mobile constraints intentionally live last so theme rules cannot
   reintroduce desktop widths or unequal paired panels. */
@media (max-width: 820px) {
    .home-record-search .stats-grid,
    .home-record-search .chart-summary-grid,
    .home-record-search .weapon-tier-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-record-search .map-table,
    .home-record-search .recent-table {
        width: 100%;
        min-width: 0;
        table-layout: fixed;
    }

    .home-record-search .map-table th,
    .home-record-search .map-table td,
    .home-record-search .recent-table th,
    .home-record-search .recent-table td {
        padding-right: 4px;
        padding-left: 4px;
        font-size: clamp(9px, 2.7vw, 12px);
    }
}
