body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: #121214;
    color: #ffffff;
    margin: 0;
    padding: 20px;
}

h1 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    border-bottom: 2px solid #e10600;
    /* Rojo F1 */
    padding-bottom: 10px;
}

.h2NumLaps {
    display: inline;
    background: #1a1a1e;
    border-radius: 5px;
    padding: 10px 22px;
}

.sessionName {
    display: inline;
    background-color: #e10600;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 5px;
}

.lapSeparator {
    color: #e10600;
}



.status-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    background: #2a2a30;
    color: #aaa;
}

.status-badge.online {
    background: #1b4332;
    color: #52b788;
}

.upTable {
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
}

.switchGapBtn,
.optLeaderm .optInterval {
    background-color: #1a1a1e;
    color: #ffffff;
    border: 1px solid #2a2a32;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

/* Change select background to F1 red on hover */
.optLeader:hover,
.optInterval:hover {
    background-color: #e10600;
}

.f1teamlogo,
.tyreImg {
    width: 24px;
    height: 24px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 6px;
}

.imgArrow {
    width: 15px;
    height: 15px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 6px;
    margin-left: 6px;
}

/* Banner de estado de pista */
.track-status-banner {
    font-size: 0.85rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
    display: inline-block;
}

/* Bandera Amarilla */
.track-status-banner.status-yellow {
    background-color: #ffd000;
    color: #000000;
}

/* Bandera Roja (animada con pulso) */
.track-status-banner.status-red {
    background-color: #d90429;
    color: #ffffff;
    animation: pulse-red 1s infinite alternate;
}

/* Safety Car Físico y VSC */
.track-status-banner.status-sc {
    background-color: #ff9100;
    color: #000000;
}

.track-status-banner.status-vsc {
    background-color: #ffb703;
    color: #000000;
}

/* Bandera Verde */
.track-status-banner.status-green {
    background-color: #2a9d8f;
    color: #ffffff;
}

/* Bandera a cuadros */
.track-status-banner.status-chequered {
    background-color: #ffffff;
    color: #000000;
}

/* Categoria 'Other' */
.track-status-banner.status-other {
    background-color: #081E3A;
    color: #ffffff;
}

.fia_msg_img,
.car_img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 9px;
    margin-left: 6px;
}

@keyframes pulse-red {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0.7;
        transform: scale(1.03);
    }
}


/* Dispositivos móviles*/
@media (max-width: 768px) {

    .f1teamlogo,
    .tyreImg {
        width: 32px;
        height: 32px;
    }

    .imgArrow {
        width: 12px;
        height: 12px;
    }

    th,
    td {
        padding: 10px 8px;
    }

    th:nth-child(1),
    td:nth-child(1) {
        min-width: 65px;
    }

    th:nth-child(2),
    td:nth-child(2) {
        min-width: 95px;
    }

    .upTable {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .h2NumLaps {
        display: inline;
        background: #1a1a1e;
        border-radius: 5px;
        padding: 10px 22px;
    }

    .text-section-radios {
        gap: 10px;
    }

    .radios-title {
        font-size: 1.05rem;
    }

    .text-view-radios {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* Pantallas de Tablet (Modo vertical y horizontal estándar) */
@media (min-width: 769px) and (max-width: 1024px) {
    .h2NumLaps {
        display: inline;
        background: #1a1a1e;
        border-radius: 5px;
        padding: 10px 22px;
    }

    .text-section-radios {
        gap: 12px;
    }

    .radios-title {
        font-size: 1.15rem;
    }

    .text-view-radios {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    th:nth-child(1),
    td:nth-child(1) {
        min-width: 74px;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: #1a1a1e;
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 12px 16px;
    text-align: left;
}

/* Columna del piloto: evita que el nombre salte debajo de la raya y le da anchura mínima */
th:nth-child(2),
td:nth-child(2) {
    white-space: nowrap;
    min-width: 85px;
}

/* Columna del neumatico */
th:nth-child(6),
td:nth-child(6) {
    white-space: nowrap;
    min-width: 85px;
}

th {
    background: #222227;
    color: #999;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:not(:last-child) {
    border-bottom: 1px solid #2a2a32;
}

.team-stripe {
    display: inline-block;
    width: 4px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
    border-radius: 2px;
}

.tyre-badge {
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.75rem;
}

.tyre-SOFT {
    background: #d90429;
    color: white;
}

.tyre-MEDIUM {
    background: #ffd166;
    color: black;
}

.tyre-HARD {
    background: #ffffff;
    color: black;
}

.tyre-INTERMEDIATE {
    background: #06d6a0;
    color: black;
}

.tyre-WET {
    background: #118ab2;
    color: white;
}

/* Sección de radios */

.radios-section {
    margin-top: 30px;
    margin-bottom: 40px;
}

.radios-title {
    font-size: 1.25rem;
    color: #ffffff;
    border-left: 4px solid #e10600;
    padding-left: 10px;
    margin: 0;
    white-space: nowrap;
}

.radios-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 16px;
}

.radio-card {
    background: #1a1a1e;
    border: 1px solid #2a2a32;
    border-radius: 8px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    transition: transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.radio-card:hover {
    transform: translateY(-2px);
    border-color: #3e3e4a;
}

.radio-card.is-playing {
    border-color: #e10600;
    box-shadow: 0 0 12px rgba(225, 6, 0, 0.35);
}

.radio-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.radio-driver-block {
    display: flex;
    align-items: center;
    gap: 8px;
}

.radio-driver-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
}

.radio-driver-number {
    font-size: 0.8rem;
    color: #888892;
    font-weight: 600;
}

.radio-time-badge {
    font-size: 0.75rem;
    color: #aaaaaf;
    background: #24242a;
    padding: 3px 8px;
    border-radius: 4px;
}

.radio-card-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.radio-team-block {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: #bbbbbf;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.radio-play-btn {
    background-color: #e10600;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 7px 14px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.radio-play-btn:hover {
    background-color: #b30500;
}

.radio-play-btn:active {
    transform: scale(0.97);
}

.radio-play-btn.playing {
    background-color: #1b4332;
    color: #52b788;
    border: 1px solid #52b788;
}

.text-section-radios {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 15px;
    margin-bottom: 20px;
}

.slide-radios {
    display: none;
}

.text-view-radios {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 6px 14px;
    background-color: #e10600;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    transition: background-color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0;
}

.text-view-radios:hover {
    background-color: #b30500;
}

.text-view-radios:active {
    transform: scale(0.97);
}

.text-view-radios a {
    color: inherit;
    text-decoration: none;
}

/* Barra progresiva y tiempo de reproducción */
.radio-progress-container {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-height 0.25s ease, opacity 0.25s ease, margin-top 0.25s ease;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 0;
}

.radio-card.is-playing .radio-progress-container,
.radio-card.has-audio .radio-progress-container {
    max-height: 45px;
    opacity: 1;
    margin-top: 4px;
}

.radio-progress-bar {
    width: 100%;
    height: 5px;
    background-color: #2a2a32;
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.radio-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #e10600, #ff4d4d);
    border-radius: 3px;
    transition: width 0.1s linear;
}

.radio-time-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    font-family: monospace, -apple-system, sans-serif;
    color: #888892;
    padding: 0 2px;
}

.radio-current-time {
    color: #ffffff;
    font-weight: 600;
}

.radio-duration-time {
    color: #aaaaaf;
}

.no-radios {
    grid-column: 1 / -1;
    text-align: center;
    color: #888892;
    font-size: 0.9rem;
    padding: 24px;
    background: #1a1a1e;
    border-radius: 8px;
    border: 1px dashed #2a2a32;
}

/* Sección del tiempo */
.weatherHtml {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    margin: 20px 0;
}

.wbox {
    width: 230px;
    height: 100px;
    display: flex;
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 2px;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 12px;
    background:
        radial-gradient(circle at 22% 18%, rgba(255, 255, 255, 0.9), transparent 38%),
        linear-gradient(145deg, #83d4ff 0%, #38a9ed 48%, #1677c8 100%);
    box-shadow: 0 5px 16px rgba(28, 137, 207, 0.28);
    color: #082b49;
    text-align: center;
}

.wbox a {
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

@media (max-width: 768px) {
    .weatherHtml {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 4px;
    }

    .wbox {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .wbox a {
        font-size: 0.85rem;
    }
}

/* ===== Broadcast Delay Control ===== */
.selOpts {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.selOptDelay {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: #1a1a1e;
    border: 1px solid #2a2a32;
    border-radius: 10px;
    padding: 6px 12px;
}

.delay-label {
    font-size: 0.8rem;
    color: #aaa;
    white-space: nowrap;
}

.delay-input {
    width: 58px;
    background: #0d0d10;
    color: #ffffff;
    border: 1px solid #3a3a44;
    border-radius: 6px;
    padding: 5px 8px;
    font-size: 0.875rem;
    text-align: center;
    -moz-appearance: textfield;
}

.delay-input::-webkit-inner-spin-button,
.delay-input::-webkit-outer-spin-button {
    opacity: 0.4;
}

.delay-btn {
    background: #e10600;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 5px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
}

.delay-btn:hover {
    background: #c00500;
}

.delay-btn:active {
    transform: scale(0.96);
}

.delay-badge {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 20px;
    background: #2a2a30;
    color: #aaa;
    white-space: nowrap;
    transition: background 0.3s ease, color 0.3s ease;
}

.delay-badge.delay-active {
    background: #4a1a00;
    color: #ff8c42;
    border: 1px solid #e10600;
}

/* --- Responsive: tablet (≤ 768px) --- */
@media (max-width: 768px) {
    .upTable {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .selOpts {
        width: 100%;
        gap: 10px;
    }

    .selOptDelay {
        width: 100%;
        box-sizing: border-box;
        justify-content: space-between;
    }

    .delay-label {
        flex-basis: 100%;
        margin-bottom: 2px;
    }
}

/* --- Responsive: móvil (≤ 480px) --- */
@media (max-width: 480px) {
    .selOpts {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .selOptGap {
        width: 100%;
    }

    .switchGapBtn {
        width: 100%;
        box-sizing: border-box;
    }

    .selOptDelay {
        width: 100%;
        box-sizing: border-box;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
        padding: 10px 12px;
    }

    .delay-label {
        font-size: 0.85rem;
    }

    .delay-input {
        width: 100%;
        box-sizing: border-box;
        font-size: 1rem;
        padding: 8px;
    }

    .delay-btn {
        width: 100%;
        padding: 9px;
        font-size: 0.9rem;
    }

    .delay-badge {
        text-align: center;
    }
}

.dRetired {
    background-color: rgba(255, 255, 255, 0.03);
    opacity: 0.5;
}