@font-face {
    font-family: 'Formula1Black';
    src: local('Formula1Black'),
         url("../fonts/Formula1-Black.f817b827ea06.ttf") format("truetype");
}

@font-face {
    font-family: 'Formula1Wide';
    src: local('Formula1Wide'),
         url("../fonts/Formula1-Wide.5d49e39d7227.ttf") format("truetype");
}

@font-face {
    font-family: 'Formula1Bold';
    src: local('Formula1Bold'),
         url("../fonts/Formula1-Bold.0819be9f7b49.ttf") format("truetype");
}

@font-face {
    font-family: 'Formula1Regular';
    src: local('Formula1Regular'),
         url("../fonts/Formula1-Regular.ea4e4ee44601.ttf") format("truetype");
}

.statistics-page {
    min-height: 100vh;
}

.stats-title {
    font-family: Formula1Bold;
    font-size: 2rem;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
}

.stats-top-filters {
    margin-bottom: 1%;
    position: relative;
    overflow: visible;
    z-index: 200;
    padding-top: 0.7rem;
    padding-bottom: 0.8rem;
}

.stats-filter-grid {
    display: flex;
    flex-wrap: nowrap;
    align-items: flex-end;
    gap: 1rem;
    overflow: visible;
    padding-bottom: 0.35rem;
    width: 100%;
}

.statistics-page .section-std {
    width: auto;
    min-width: 0;
    flex: 1 1 0;
    padding: 0.2rem 0.1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    font-family: Formula1Bold;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.statistics-page .dropdown-std {
    padding: 0;
    width: 100%;
}

.achievement-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.5rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #E10600;
    color: #ffffff;
    font-size: 0.82rem;
    line-height: 1;
    vertical-align: middle;
    text-transform: uppercase;
}

.achievement-badge-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.achievement-tooltip {
    position: absolute;
    left: 50%;
    top: 120%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85);
    color: #fff;
    font-family: Formula1Regular;
    font-size: 0.7rem;
    padding: 0.55rem 0.65rem;
    border-radius: 6px;
    white-space: normal;
    min-width: 240px;
    max-width: 360px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 10;
}

.achievement-badge-wrap:hover .achievement-tooltip {
    opacity: 1;
}

.statistics-page .standings-table {
    overflow: visible;
}

.statistics-page .standings-table td.user-name {
    overflow: visible;
    position: relative;
}

.achievement-tooltip-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.achievement-tooltip-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.15rem 0.2rem;
    border-radius: 6px;
}

.achievement-tooltip-item.is-featured {
    background: rgba(225, 6, 0, 0.18);
}

.achievement-tooltip-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #E10600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.82rem;
    flex: 0 0 auto;
    line-height: 1;
    text-align: center;
}

.achievement-tooltip-icon.icon-symbol {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-size: 0.98rem;
}

.achievement-tooltip-icon.icon-number {
    font-family: Formula1Bold, sans-serif;
    font-size: 0.44rem;
    letter-spacing: -0.03em;
}

.achievement-tooltip-name {
    font-family: Formula1Bold;
    font-size: 0.68rem;
    text-transform: uppercase;
}

.achievement-tooltip-tag {
    margin-left: auto;
    font-size: 0.55rem;
    text-transform: uppercase;
    background: #1b6f35;
    color: #fff;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
}

.achievement-tooltip-empty {
    font-family: Formula1Regular;
    font-size: 0.7rem;
}

.achievement-badge.icon-symbol {
    font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
    font-size: 0.8rem;
}

.achievement-badge.icon-number {
    font-family: Formula1Bold, sans-serif;
    font-size: 0.44rem;
    letter-spacing: -0.03em;
}

.stats-select,
.stats-input {
    width: 100%;
    border-radius: 10px !important;
    background-color: gray;
    color: white;
    border: none;
    padding: 0.45rem 0.6rem;
    font-family: Formula1Bold;
    text-transform: uppercase;
    font-size: 0.75rem;
    height: 2.25rem;
    line-height: 1.1;
}

.stats-select:focus,
.stats-input:focus {
    outline: 2px solid #E10600;
    outline-offset: 1px;
}

.stats-select option {
    color: black;
}

.statistics-page .section-name-std {
    margin-left: 0;
    margin-bottom: 0.45rem;
    min-height: 1.65rem;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    border-left: 3px solid #E10600;
    border-bottom: 3px solid #E10600;
    border-radius: 5px;
    padding: 0.2rem 0.5rem;
    font-family: Formula1Bold;
    text-transform: none;
    letter-spacing: 0.01em;
}

.stats-range {
    display: flex;
    gap: 0.5rem;
}

.stats-input::placeholder {
    color: #e6e6e6;
}

.stats-filter-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0;
    width: 100%;
    height: 2.25rem;
    align-items: stretch;
}

.stats-btn {
    border: none;
    border-radius: 8px;
    background-color: #E10600;
    color: white;
    font-family: Formula1Bold;
    text-transform: uppercase;
    font-size: 0.75rem;
    padding: 0.55rem 0.85rem;
    cursor: pointer;
    flex: 1;
    height: 2.25rem;
    line-height: 1.1;
}

.stats-btn:hover {
    background-color: #b90400;
}

.stats-btn-secondary {
    background-color: hsl(240, 5%, 28%);
}

.stats-btn-secondary:hover {
    background-color: hsl(240, 5%, 20%);
}

.stats-feedback {
    margin: 0 0 0.4rem 0;
    font-family: Formula1Regular;
    font-size: 0.9rem;
}

.stats-empty-state {
    margin: 0.5rem 0 1rem 0;
    padding: 0.75rem;
    background-color: #fff4f4;
    border: 1px solid #E10600;
    border-radius: 8px;
    color: #6e0000;
    font-family: Formula1Bold;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.trends-chart {
    width: 100%;
    min-height: 30rem;
    background: white;
    border-radius: 12px;
    border: 2px solid #E10600;
    overflow: hidden;
}

.stats-chart-panel {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.stats-chart-panel .gray-line {
    margin-bottom: 1.2rem;
}

.users-dropdown {
    position: relative;
}

.users-dropbtn {
    text-align: left;
}

.users-dropdown-content {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow-y: auto;
    background: hsl(240, 2%, 91%);
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1200;
    padding: 0.35rem;
}

.users-dropdown-content.show {
    display: block;
}

.users-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.3rem;
    font-family: Formula1Bold;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: black;
}

.users-option input {
    accent-color: #E10600;
}

.gp-dropdown {
    position: relative;
}

.statistics-page .section-std > .dropdown-std,
.statistics-page .section-std > .stats-filter-actions {
    min-height: 2.25rem;
}

.gp-range-btn {
    text-align: left;
}

.gp-range-content {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    background: hsl(240, 2%, 91%);
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1200;
    padding: 0.35rem;
}

.gp-range-content.show {
    display: block;
}

.gp-option {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.3rem;
    font-family: Formula1Bold;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: black;
}

.gp-option input {
    accent-color: #E10600;
}

.stats-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border: 2px solid #E10600;
    border-radius: 16px;
    background: #ffffff;
    overflow-y: hidden;
}

.statistics-table {
    width: 100%;
    min-width: 1080px;
    font-size: 0.9rem;
}

.standings-table.statistics-table {
    border: none !important;
    border-radius: 0;
    border-collapse: collapse;
    background-color: #ffffff;
}

.statistics-table thead {
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.statistics-table th {
    white-space: nowrap;
    padding: 0.56rem 0.58rem;
    line-height: 1.1;
}

.statistics-table tbody {
    font-family: Formula1Regular;
    font-size: 0.79rem;
}

.statistics-table td {
    padding: 0.44rem 0.58rem;
    line-height: 1.2;
}

.statistics-table td.user-name,
.statistics-table td.team-name {
    font-family: Formula1Bold;
    font-size: 0.86rem;
}

.statistics-table td.points,
.statistics-table td.wins,
.statistics-table td.podiums,
.statistics-table td.last-2,
.statistics-table td.rank {
    text-align: center;
}

.stats-matrix-legend {
    margin-top: 0.85rem;
    padding: 0.7rem 0.85rem;
    border-left: 3px solid #E10600;
    background: rgba(255, 255, 255, 0.35);
    border-radius: 6px;
    font-family: Formula1Regular;
    font-size: 0.78rem;
    line-height: 1.35;
    max-width: 56rem;
    margin-left: auto;
    text-align: right;
}

.stats-matrix-legend p {
    margin: 0.2rem 0;
}

.stats-matrix-legend code {
    color: inherit;
    background: transparent;
    font-family: Formula1Bold;
    font-size: 0.76rem;
    padding: 0;
}

.statistics-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.statistics-table th.sortable:hover {
    background-color: #b90400;
}

.stats-external-legend {
    margin-top: 0.8rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.3rem 0.75rem;
}

.stats-external-legend-item {
    border: none;
    background: transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: Formula1Regular;
    font-size: 0.74rem;
    color: #1d2634;
    padding: 0.1rem 0.15rem;
    cursor: pointer;
}

.stats-external-legend-icon {
    position: relative;
    width: 14px;
    height: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.stats-external-legend-line {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 2px;
    transform: translateY(-50%);
    border-radius: 2px;
}

.stats-external-legend-marker {
    position: relative;
    z-index: 1;
    width: 7px;
    height: 7px;
    display: inline-block;
    border-radius: 50%;
}

.stats-marker-circle {
    border-radius: 50%;
}

.stats-marker-square {
    border-radius: 1px;
}

.stats-marker-diamond {
    transform: rotate(45deg);
    border-radius: 1px;
}

.stats-marker-triangle,
.stats-marker-triangle-down {
    width: 0;
    height: 0;
    background: transparent !important;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.stats-marker-triangle {
    border-bottom: 7px solid currentColor;
    margin-top: -1px;
}

.stats-marker-triangle-down {
    border-top: 7px solid currentColor;
    margin-bottom: -1px;
}

.stats-external-legend-item.active {
    font-family: Formula1Bold;
}

.stats-external-legend-item.dimmed {
    opacity: 0.45;
}

@media (max-width: 1100px) {
    .stats-filter-grid {
        gap: 0.75rem;
    }

    .stats-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 700px) {
    .stats-filter-actions {
        flex-direction: column;
    }

    .stats-btn {
        width: 100%;
    }
}

/* -------------------------------------
   Optimal Team Page
------------------------------------- */
.optimal-team-page .stats-top-filters,
.optimal-team-page .stats-chart-panel {
    background-color: hsl(240, 2%, 64%);
    border-radius: 10px;
    padding: 0.9rem 1.1rem 1.1rem;
}

.optimal-team-page .stats-top-filters {
    margin-bottom: 0.9rem;
}

.optimal-team-page .stats-title {
    margin-bottom: 0.35rem;
}

.optimal-team-page .stats-feedback {
    margin: 0.3rem 0 0.75rem;
}

.optimal-team-wrapper {
    background: #f1f1f1;
    border: 2px solid #E10600;
    border-radius: 14px;
    padding: 0.8rem;
    overflow: visible;
}

.optimal-bonus-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.75rem;
    align-items: start;
}

.optimal-bonus-col {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.optimal-bonus-label {
    font-family: Formula1Regular;
    font-size: 0.8rem;
    margin: 0 0 0.15rem 0.2rem;
}

.optimal-bonus-card {
    border: 2px solid #999;
    border-radius: 6px;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    height: 74px;
    min-height: 74px;
    max-height: 74px;
}

.optimal-bonus-photo {
    width: 56px;
    flex: 0 0 56px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.optimal-bonus-photo img {
    width: 100%;
    max-width: 54px;
    max-height: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.optimal-bonus-data {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.optimal-bonus-name {
    font-family: Formula1Bold;
    font-size: 0.72rem;
    text-transform: uppercase;
    padding: 0.22rem 0.35rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.optimal-bonus-points {
    margin-top: auto;
    border-top: 1px solid #c9c9c9;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.22rem 0.4rem;
    font-family: Formula1Bold;
    font-size: 0.68rem;
    text-transform: uppercase;
}

.optimal-bonus-points strong {
    font-size: 1.8em;
    line-height: 1;
}

.optimal-assets-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.62rem;
    align-items: start;
}

.optimal-asset-card {
    background: #ffffff;
    border: 1px solid #d4d4d4;
    border-radius: 7px;
    overflow: hidden;
    position: relative;
}

.optimal-asset-card.captain {
    border: 2px solid #E10600;
}

.optimal-asset-card.captain::before {
    content: "x2";
    position: absolute;
    top: 5px;
    left: 5px;
    border-radius: 999px;
    background: #1f2534;
    color: #ffffff;
    font-family: Formula1Bold;
    font-size: 0.62rem;
    line-height: 1;
    padding: 0.2rem 0.38rem;
}

.optimal-asset-photo {
    height: 92px;
    min-height: 92px;
    max-height: 92px;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    overflow: hidden;
}

.optimal-asset-photo img {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.optimal-asset-data {
    padding: 0.34rem 0.4rem 0.45rem;
    background: #ffffff;
}

.optimal-asset-name {
    font-family: Formula1Bold;
    font-size: 0.8rem;
    text-transform: uppercase;
    line-height: 1.1;
    min-height: 1.9em;
}

.optimal-asset-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-family: Formula1Bold;
    text-transform: uppercase;
    line-height: 1.15;
}

.optimal-asset-row span {
    font-size: 0.74rem;
}

.optimal-asset-row strong {
    font-size: 1.9rem;
    line-height: 0.95;
}

.optimal-summary {
    margin-top: 0.7rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.optimal-summary-chip {
    border: 1px solid #d5d5d5;
    border-radius: 7px;
    background: #f6f6f6;
    padding: 0.26rem 0.5rem;
    font-family: Formula1Bold;
    font-size: 0.7rem;
    text-transform: uppercase;
}

.optimal-summary-chip.total {
    border-color: #E10600;
    color: #7f0000;
}

.optimal-team-page .optimal-subcontainer-gp {
    margin-bottom: 0.8rem;
}

.optimal-team-page .optimal-main-view-porra {
    margin-bottom: 0;
}

.optimal-team-page .show-points {
    justify-content: center;
    gap: 3.2rem;
    padding: 0.6rem 2% 1rem;
}

.optimal-team-page .cost-cap,
.optimal-team-page .total-points {
    padding: 0.2rem 0.7rem;
    min-width: 230px;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(29, 38, 52, 0.15);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.35);
}

.optimal-team-page .show-points .cost-cap span,
.optimal-team-page .show-points .total-points span {
    align-self: center !important;
}

.optimal-team-page .show-points .cost-cap span:first-child,
.optimal-team-page .show-points .total-points span:first-child {
    font-size: 0.95rem !important;
}

.optimal-team-page .show-points .cost-cap span:last-child,
.optimal-team-page .show-points .total-points span:last-child {
    font-size: 2rem !important;
    line-height: 1.05;
}

.optimal-footer-chips {
    margin-top: 0.45rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.optimal-footer-chip {
    border: 1px solid #d5d5d5;
    border-radius: 7px;
    background: #f6f6f6;
    padding: 0.2rem 0.45rem;
    font-family: Formula1Bold;
    font-size: 0.72rem;
    text-transform: uppercase;
}

.optimal-footer-chip.total {
    border-color: #E10600;
    color: #7f0000;
}

/* Standings chips + zoom stability (scoped to statistics page) */
.statistics-page .user-standings {
    overflow-x: auto;
    overflow-y: hidden;
}

.statistics-page .standings-table {
    width: 100%;
    min-width: 980px;
    table-layout: fixed;
}

.statistics-page .standings-table th,
.statistics-page .standings-table td {
    white-space: nowrap;
}

.statistics-page .chip-icons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.statistics-page .chip-icon {
    width: 2.75rem;
    height: 2.75rem;
    flex: 0 0 2.75rem;
}

.statistics-page .chip-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    transform: scale(2.6);
}

/* Fine centering per icon asset (both PNGs have asymmetric whitespace) */
.statistics-page .chip-icon.chip-drs img {
    transform: translateX(1px) scale(2.6);
}

.statistics-page .chip-icon.chip-pit img {
    transform: translateX(2px) scale(2.6);
}

/* -------------------------------------
   Bote Page
------------------------------------- */
.bote-top-panel {
    min-height: 260px;
    display: flex;
    flex-direction: column;
}

.bote-single-panel {
    padding: 1.2rem 1.15rem 2rem;
}

.bote-kpi-wrap {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    padding: 0;
    margin: 0;
}

.bote-kpi-meta {
    font-family: Formula1Regular;
    font-size: 0.95rem;
    text-transform: uppercase;
}

.bote-kpi-total {
    font-family: Formula1Bold;
    font-size: 3rem;
    line-height: 1.05;
    margin-top: 0.35rem;
}

.bote-kpi-caption {
    font-family: Formula1Regular;
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.bote-table {
    table-layout: fixed;
    width: 100%;
    min-width: 1180px;
}

.bote-table th,
.bote-table td {
    white-space: nowrap;
}

.bote-table-wrap {
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    margin-top: 1.5rem;
}

.bote-col-rank {
    width: 5%;
    text-align: center;
}

.bote-col-user {
    width: 28%;
    text-align: left;
}

.bote-col-team {
    width: 25%;
    text-align: left;
}

.bote-col-money {
    width: 14%;
    min-width: 170px;
    text-align: center;
}

.bote-table thead th {
    padding-left: 1.2rem;
    padding-right: 1.2rem;
    font-family: "Formula1Regular";
    font-size: 1.22rem;
    line-height: 1.15;
    text-align: center;
}

.bote-table thead th.bote-col-user,
.bote-table thead th.bote-col-team {
    text-align: left;
}

.bote-table tbody td {
    font-family: "Formula1Bold";
    font-size: clamp(0.65rem, 1vw, 1rem);
}

.bote-table tbody td.user-name,
.bote-table tbody td.team-name {
    font-family: "Formula1Regular";
}

.bote-table tbody td.points {
    font-family: "Formula1Bold";
}
