/* Version: V.6.16.1538 */

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.82);
    backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    width: min(560px, calc(100vw - 32px));
    max-height: 78vh;
    margin: 7vh auto 0;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    background: linear-gradient(
            180deg,
            rgba(30, 41, 59, 0.96),
            rgba(15, 23, 42, 0.98)
    );
    box-shadow:
            0 24px 70px rgba(0, 0, 0, 0.52),
            0 0 0 1px rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(14px);
    animation: modalShow 0.2s ease-out;
}

@keyframes modalShow {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.985);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 22px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    color: #f1f5f9;
    font-size: 18px;
    font-weight: 800;
}

.modal-body {
    padding: 22px;
    overflow: auto;
    max-height: calc(78vh - 76px);
}

.modal-body::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.modal-body::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.35);
}

.modal-close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #94a3b8;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition:
            background 0.18s ease,
            color 0.18s ease,
            transform 0.18s ease;
}

.modal-close:hover {
    background: rgba(51, 65, 85, 0.9);
    color: #f8fafc;
    transform: scale(1.04);
}

/* Changelog Modal */
.changelog-list {
    max-height: calc(78vh - 82px);
    overflow-y: auto;
    padding: 8px 22px 22px;
}

.changelog-list::-webkit-scrollbar {
    width: 8px;
}

.changelog-list::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.22);
}

.changelog-item {
    padding: 18px 0;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.changelog-item:first-child {
    padding-top: 10px;
    border-top: none;
}

.changelog-item h3 {
    margin: 0;
    color: #c7d2fe;
    font-size: 15px;
    font-weight: 800;
}

.changelog-date {
    margin: 6px 0 12px;
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.changelog-item ul {
    margin: 0;
    padding-left: 18px;
}

.changelog-item li {
    margin: 6px 0;
    color: #cbd5e1;
    font-size: 13px;
    line-height: 1.55;
}

/* Battle Analysis Modal */
.battle-analysis-modal {
    width: min(1120px, calc(100vw - 48px));
    max-height: 88vh;
    margin-top: 4vh;
}

.battle-analysis-modal .modal-body {
    max-height: calc(88vh - 76px);
}

.battle-analysis-modal .result-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.battle-analysis-modal .result-table th,
.battle-analysis-modal .result-table td {
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: top;
    line-height: 1.45;
}

.battle-analysis-modal .result-table thead,
.battle-analysis-modal .result-table tbody {
    display: block;
}

.battle-analysis-modal .result-table tbody {
    max-height: min(560px, calc(88vh - 210px));
    overflow-y: auto;
    overflow-x: hidden;
}

.battle-analysis-modal .result-table thead tr,
.battle-analysis-modal .result-table tbody tr {
    display: table;
    width: 100%;
    table-layout: fixed;
}

.battle-analysis-modal .result-table tbody::-webkit-scrollbar {
    width: 10px;
}

.battle-analysis-modal .result-table tbody::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.24);
}

.battle-analysis-modal .result-table tbody::-webkit-scrollbar-track {
    background: rgba(15, 23, 42, 0.35);
}

.battle-analysis-table {
    width: calc(100% - 32px);
    margin: 16px;
}

#battleAnalysisSkillPanel .result-table th:nth-child(1),
#battleAnalysisSkillPanel .result-table td:nth-child(1) {
    width: 22%;
}

#battleAnalysisSkillPanel .result-table th:nth-child(2),
#battleAnalysisSkillPanel .result-table td:nth-child(2) {
    width: 18%;
}

#battleAnalysisSkillPanel .result-table th:nth-child(3),
#battleAnalysisSkillPanel .result-table td:nth-child(3) {
    width: 42%;
}

#battleAnalysisSkillPanel .result-table th:nth-child(4),
#battleAnalysisSkillPanel .result-table td:nth-child(4) {
    width: 18%;
}

.battle-analysis-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.battle-analysis-tab {
    height: 32px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    background: rgba(15, 23, 42, 0.9);
    color: #94a3b8;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}

.battle-analysis-tab.active {
    border-color: rgba(129, 140, 248, 0.55);
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
}

.battle-analysis-panel {
    display: none;
}

.battle-analysis-panel.active {
    display: block;
}

.battle-analysis-empty {
    padding: 44px;
    color: #94a3b8;
    text-align: center;
    font-size: 13px;
}

.battle-analysis-skill-row.clickable {
    cursor: pointer;
}

.battle-analysis-skill-row.clickable:hover td,
.battle-analysis-skill-row.clickable:focus td {
    background: rgba(99, 102, 241, 0.14);
}

.battle-analysis-skill-detail-row {
    display: table !important;
}

.battle-analysis-skill-detail-row td {
    padding: 12px;
    background: rgba(2, 6, 23, 0.72);
}

.battle-analysis-skill-detail {
    display: block;
    min-width: 0;
}

.near-best-analysis {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.near-best-summary,
.near-best-buckets {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.near-best-summary > span,
.near-best-summary-chip,
.near-best-bucket {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 34px;
    border: 1px solid rgba(96, 165, 250, 0.34);
    border-radius: 8px;
    padding: 7px 10px;
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), rgba(2, 6, 23, 0.9));
    color: #e5edf8;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.near-best-summary-label {
    color: #9fb3d1;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

.near-best-summary-value {
    color: #f8fbff;
    font-size: 12px;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.best-timeline-summary .near-best-summary-chip {
    min-width: 78px;
}

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

.near-best-chart {
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.34);
    padding: 10px;
}

.near-best-chart h4 {
    margin: 0 0 8px;
    color: #e5e7eb;
    font-size: 13px;
    font-weight: 800;
}

.near-best-chart svg {
    display: block;
    width: 100%;
    height: auto;
}

.near-best-axis {
    stroke: rgba(203, 213, 225, 0.5);
    stroke-width: 1;
}

.near-best-grid {
    stroke: rgba(148, 163, 184, 0.12);
    stroke-width: 1;
}

.near-best-point {
    fill: #22d3ee;
    fill-opacity: 0.72;
    stroke: rgba(240, 249, 255, 0.72);
    stroke-width: 0.6;
}

.near-best-axis-label,
.near-best-tick {
    fill: #b8c7dc;
    font-family: inherit;
    font-weight: 800;
    paint-order: stroke;
    stroke: rgba(2, 6, 23, 0.72);
    stroke-linejoin: round;
    stroke-width: 2px;
}

.near-best-axis-label {
    fill: #d8e3f2;
    font-size: 15px;
}

.near-best-tick {
    font-size: 13px;
}

.near-best-chart-empty {
    display: flex;
    min-height: 180px;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 13px;
}

@media (max-width: 820px) {
    .near-best-grid-layout {
        grid-template-columns: 1fr;
    }
}
