/* =========================================================
   GRIDPREDICT - RACE REPLAY
   ========================================================= */

.public-replay {
    padding: 34px 20px 55px;
}

.replay-container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
}


/* =========================================================
   HEADER
   ========================================================= */

.replay-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;

    margin-bottom: 20px;
    padding-bottom: 18px;

    border-bottom: 1px solid
    rgba(255, 255, 255, 0.08);
}

.replay-kicker {
    margin-bottom: 4px;

    color: #e10600;

    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.replay-title {
    margin: 0;

    color: #ffffff;

    font-size: 1.8rem;
    font-weight: 700;
}

.replay-circuit {
    margin-top: 4px;

    color: #7d8698;

    font-size: 0.8rem;
}

.replay-lap-counter {
    display: flex;
    align-items: baseline;
    gap: 5px;

    color: #697284;

    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.replay-lap-counter strong {
    color: #ffffff;

    font-size: 1.6rem;
}


/* =========================================================
   MESSAGES
   ========================================================= */

.replay-message {
    padding: 30px;

    text-align: center;

    color: #8d96a8;

    background: #151820;

    border: 1px solid
    rgba(255, 255, 255, 0.06);

    border-radius: 8px;
}

.replay-message-error {
    color: #ff7777;
}


/* =========================================================
   CHART
   ========================================================= */

.replay-chart-card {
    margin-bottom: 18px;
    padding: 16px;

    background: #151820;

    border: 1px solid
    rgba(255, 255, 255, 0.06);

    border-radius: 8px;
}

.replay-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin-bottom: 10px;
}

.replay-chart-header h2 {
    margin: 0;

    color: #ffffff;

    font-size: 0.95rem;
    font-weight: 700;
}

.replay-chart-header span {
    display: block;

    margin-top: 2px;

    color: #697284;

    font-size: 0.65rem;
}

.replay-chart-current {
    color: #697284;

    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.replay-chart-current strong {
    margin-left: 3px;

    color: #ffffff;

    font-size: 1rem;
}

.replay-chart {
    width: 100%;
    height: 270px;

    overflow: hidden;

    border-radius: 4px;
}

#replay-position-chart {
    display: block;

    width: 100%;
    height: 100%;
}


/* =========================================================
   SECTION HEADERS
   ========================================================= */

.replay-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    margin: 0 0 8px;
}

.replay-section-header h2 {
    margin: 0;

    color: #ffffff;

    font-size: 0.9rem;
    font-weight: 700;
}

.replay-section-header span {
    display: block;

    margin-top: 2px;

    color: #697284;

    font-size: 0.65rem;
}

.replay-section-header strong {
    color: #aeb5c3;
}


/* =========================================================
   CLASSIFICATION
   ========================================================= */

.replay-standings {
    display: grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap: 4px 6px;

    margin-bottom: 18px;
}

.replay-driver {
    position: relative;

    display: grid;

    grid-template-columns:
        30px minmax(90px, 1fr) 75px 35px;

    align-items: center;

    min-height: 44px;

    padding: 5px 8px 5px 10px;

    background: #151820;

    border: 1px solid
    rgba(255, 255, 255, 0.05);

    border-radius: 6px;

    overflow: hidden;
}

.replay-driver::before {
    content: "";

    position: absolute;

    left: 0;
    top: 0;
    bottom: 0;

    width: 3px;

    background: var(--team-colour);
}

.replay-position {
    color: #8d96a8;

    font-size: 0.72rem;
    font-weight: 700;

    text-align: center;
}

.replay-driver-info {
    min-width: 0;
}

.replay-driver-name {
    color: #ffffff;

    font-size: 0.72rem;
    font-weight: 700;
}

.replay-team {
    margin-top: 1px;

    color: #697284;

    font-size: 0.58rem;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.replay-tyres {
    display: flex;
    flex-direction: column;
    align-items: flex-start;

    min-width: 0;

    gap: 1px;
}

.replay-compound {
    padding: 2px 5px;

    color: #ffffff;

    font-size: 0.57rem;
    font-weight: 700;

    border-radius: 3px;

    background: rgba(255, 255, 255, 0.08);
}

.replay-tyre-age {
    color: #697284;

    font-size: 0.55rem;
}

.replay-pit {
    justify-self: end;

    padding: 3px 5px;

    color: #ffffff;

    font-size: 0.52rem;
    font-weight: 700;

    background: #e10600;

    border-radius: 3px;
}


/* =========================================================
   CONTROLS
   ========================================================= */

.replay-controls {
    display: grid;

    grid-template-columns:
        auto minmax(200px, 1fr) auto;

    align-items: center;

    gap: 12px;

    margin-bottom: 18px;
    padding: 12px;

    background: #151820;

    border: 1px solid
    rgba(255, 255, 255, 0.06);

    border-radius: 8px;
}

.replay-main-controls {
    display: flex;

    gap: 4px;
}

.replay-control-button {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 34px;
    height: 34px;

    padding: 0;

    color: #ffffff;

    background: #202530;

    border: 0;
    border-radius: 6px;

    cursor: pointer;

    transition:
            background 0.15s ease,
            transform 0.1s ease;
}

.replay-control-button:hover {
    background: #2b303c;
}

.replay-control-button:active {
    transform: scale(0.94);
}

.replay-play-button {
    background: #e10600;
}

.replay-play-button:hover {
    background: #f20a03;
}


/* =========================================================
   TIMELINE
   ========================================================= */

.replay-timeline {
    min-width: 0;
}

.replay-timeline-labels {
    display: flex;
    justify-content: space-between;

    margin-bottom: 3px;

    color: #697284;

    font-size: 0.53rem;
    font-weight: 600;
}

.replay-timeline-labels strong {
    color: #aeb5c3;
}

.replay-slider {
    display: block;

    width: 100%;
    height: 4px;

    margin: 0;

    cursor: pointer;

    accent-color: #e10600;
}


/* =========================================================
   SPEED
   ========================================================= */

.replay-speed {
    display: flex;

    gap: 3px;
}

.replay-speed button {
    min-width: 39px;
    height: 32px;

    padding: 0 7px;

    color: #8d96a8;

    font-size: 0.6rem;
    font-weight: 700;

    background: #202530;

    border: 0;
    border-radius: 5px;

    cursor: pointer;
}

.replay-speed button:hover {
    color: #ffffff;

    background: #2b303c;
}

.replay-speed button.active {
    color: #ffffff;

    background: #e10600;
}


/* =========================================================
   EVENTS
   ========================================================= */

.replay-events {
    padding: 14px 16px;

    background: #151820;

    border: 1px solid
    rgba(255, 255, 255, 0.06);

    border-radius: 8px;
}

.replay-events-header {
    margin-bottom: 8px;
}

.replay-event-list {
    max-height: 260px;

    overflow-y: auto;
}

.replay-event {
    display: grid;

    grid-template-columns:
        90px 35px 18px 35px minmax(0, 1fr);

    align-items: baseline;

    gap: 5px;

    padding: 7px 0;

    border-top: 1px solid
    rgba(255, 255, 255, 0.045);

    color: #8d96a8;

    font-size: 0.62rem;
}

.replay-event:first-child {
    border-top: 0;
}

.replay-event-type {
    color: #ffffff;

    font-size: 0.55rem;
    font-weight: 700;
}

.replay-event-driver {
    color: #ffffff;

    font-size: 0.6rem;
    font-weight: 700;
}

.replay-event-arrow {
    color: #697284;

    text-align: center;
}

.replay-event-message {
    min-width: 0;

    color: #8d96a8;

    overflow: hidden;
    text-overflow: ellipsis;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

    .public-replay {
        padding: 22px 10px 40px;
    }

    .replay-header {
        align-items: flex-start;

        margin-bottom: 14px;
        padding-bottom: 14px;
    }

    .replay-title {
        font-size: 1.35rem;
    }

    .replay-kicker {
        font-size: 0.58rem;
    }

    .replay-circuit {
        font-size: 0.7rem;
    }

    .replay-lap-counter strong {
        font-size: 1.3rem;
    }


    /* Chart */

    .replay-chart-card {
        padding: 11px;

        margin-bottom: 14px;
    }

    .replay-chart {
        height: 190px;
    }

    .replay-chart-header span {
        display: none;
    }


    /* Classification */

    .replay-standings {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));

        gap: 3px;
    }

    .replay-driver {
        grid-template-columns:
            24px minmax(35px, 1fr) 55px 24px;

        min-height: 39px;

        padding: 4px 5px 4px 6px;
    }

    .replay-position {
        font-size: 0.62rem;
    }

    .replay-driver-name {
        font-size: 0.62rem;
    }

    .replay-team {
        display: none;
    }

    .replay-compound {
        padding: 2px 4px;

        font-size: 0.5rem;
    }

    .replay-tyre-age {
        font-size: 0.48rem;
    }

    .replay-pit {
        padding: 2px 3px;

        font-size: 0.45rem;
    }


    /* Controls */

    .replay-controls {
        grid-template-columns:
            auto minmax(0, 1fr);

        gap: 8px;

        padding: 9px;
    }

    .replay-main-controls {
        gap: 3px;
    }

    .replay-control-button {
        width: 31px;
        height: 31px;
    }

    .replay-timeline {
        min-width: 0;
    }

    .replay-speed {
        grid-column: 1 / -1;

        justify-content: center;
    }

    .replay-speed button {
        min-width: 48px;
    }


    /* Events */

    .replay-events {
        padding: 12px;
    }

    .replay-event {
        grid-template-columns:
            75px 30px 14px 30px minmax(0, 1fr);

        font-size: 0.55rem;
    }

    .replay-event-type {
        font-size: 0.48rem;
    }

    .replay-event-driver {
        font-size: 0.52rem;
    }

    .replay-event-message {
        font-size: 0.5rem;
    }

}

/* Graph / classification switch */
.replay-view-switch {
    display: flex;
    gap: 6px;
    margin: 0 0 12px;
    padding: 4px;
    background: #151820;
    border: 1px solid rgba(255,255,255,.07);
    border-radius: 8px;
}
.replay-view-switch button {
    flex: 1;
    min-height: 38px;
    padding: 8px 12px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #8d96a8;
    font: inherit;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
}
.replay-view-switch button.active {
    background: #e10600;
    color: #fff;
}
.replay-view-switch button:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.replay-chart-card { min-width: 0; }
.replay-chart { height: 330px; }

@media (max-width: 768px) {
    .replay-view-switch { margin-bottom: 9px; }
    .replay-view-switch button { min-height: 42px; font-size: .72rem; padding: 7px 5px; }
    .replay-chart-card { padding: 9px; }
    .replay-chart { height: 280px; }
}
@media (max-width: 420px) {
    .replay-chart { height: 300px; }
    .replay-view-switch button { font-size: .68rem; }
}


/* =========================================================
   READABILITY + COLLAPSIBLE RACE EVENTS
   ========================================================= */

/* Give the position chart the available vertical space by default. */
.replay-chart {
    height: clamp(390px, 56vh, 620px);
    min-height: 390px;
}

/* Increase small typography across the replay UI. */
.replay-kicker { font-size: .72rem; }
.replay-title { font-size: 2rem; }
.replay-circuit { font-size: .92rem; }
.replay-lap-counter { font-size: .78rem; }
.replay-chart-header h2,
.replay-section-header h2 { font-size: 1.05rem; }
.replay-chart-header span,
.replay-section-header span { font-size: .78rem; }
.replay-position,
.replay-driver-name { font-size: .86rem; }
.replay-team { font-size: .7rem; }
.replay-compound { font-size: .68rem; }
.replay-tyre-age { font-size: .66rem; }
.replay-pit { font-size: .62rem; }
.replay-timeline-labels { font-size: .68rem; }
.replay-speed button { font-size: .74rem; }
.replay-event { font-size: .78rem; }
.replay-event-type,
.replay-event-driver { font-size: .72rem; }
.replay-event-message { line-height: 1.45; }

.replay-events {
    padding: 0;
    overflow: hidden;
}

.replay-events-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 0;
    background: transparent;
    color: #fff;
    text-align: left;
    cursor: pointer;
}

.replay-events-toggle:hover { background: rgba(255,255,255,.035); }
.replay-events-toggle:focus-visible { outline: 2px solid #e10600; outline-offset: -3px; }
.replay-events-toggle-copy { display: flex; flex-direction: column; gap: 4px; }
.replay-events-toggle-copy > strong { font-size: 1rem; }
.replay-events-toggle-copy > span { color: #8d96a8; font-size: .78rem; }
.replay-events-toggle-copy > span strong { color: #dce1eb; }
.replay-events-toggle > i { color: #aeb5c3; font-size: .9rem; }
.replay-events .replay-event-list { padding: 0 18px 14px; max-height: 320px; overflow-y: auto; }
.replay-no-events { color: #8d96a8; font-size: .85rem; margin: 0; padding: 12px 0; }

@media (max-width: 768px) {
    .replay-chart { height: clamp(360px, 62vh, 540px); min-height: 360px; }
    .replay-title { font-size: 1.55rem; }
    .replay-circuit { font-size: .84rem; }
    .replay-chart-header h2, .replay-section-header h2 { font-size: 1rem; }
    .replay-chart-header span, .replay-section-header span { font-size: .72rem; }
    .replay-position, .replay-driver-name { font-size: .76rem; }
    .replay-team { font-size: .64rem; }
    .replay-compound { font-size: .62rem; }
    .replay-tyre-age { font-size: .6rem; }
    .replay-event { font-size: .72rem; }
    .replay-event-type, .replay-event-driver { font-size: .66rem; }
    .replay-events-toggle { padding: 14px; }
    .replay-events .replay-event-list { padding: 0 14px 12px; }
}

@media (max-width: 420px) {
    .replay-chart { height: 390px; min-height: 390px; }
    .replay-title { font-size: 1.35rem; }
    .replay-lap-counter strong { font-size: 1.2rem; }
    .replay-events-toggle-copy > strong { font-size: .92rem; }
}

.replay-lap-counter {
    display: flex;
    align-items: baseline;
    gap: 4px;
    white-space: nowrap;
}

@media (max-width: 599px) {
    .replay-lap-counter {
        display: flex;
    }

    .replay-lap-counter > span {
        display: inline;
    }
}



/* =========================================================
   REPLAY - RESPONSIVE FIX
   Solo móvil y tablet. Escritorio conserva el CSS original.
   ========================================================= */

@media (max-width: 768px) {

    .public-replay,
    .public-replay *,
    .public-replay *::before,
    .public-replay *::after {
        box-sizing: border-box;
    }

    .public-replay {
        min-width: 0;
        overflow-x: clip;
    }

    .replay-container {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        margin-inline: auto;
    }

    .replay-container > *,
    .replay-container [x-show] {
        min-width: 0;
        max-width: 100%;
    }

    /* Selector de vistas */

    .replay-view-switch {
        display: flex;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .replay-view-switch button {
        flex: 1 1 0;
        min-width: 0;
        white-space: normal;
    }

    /* Gráfica */

    .replay-chart-card {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .replay-chart {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        overflow: hidden;
        height: clamp(360px, 62vh, 540px);
        min-height: 360px;
    }

    #replay-position-chart {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .replay-chart-header {
        min-width: 0;
        gap: 8px;
    }

    .replay-chart-header > div:first-child {
        min-width: 0;
    }

    .replay-title {
        overflow-wrap: anywhere;
    }

    /* Clasificación */

    .replay-standings {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .replay-driver {
        grid-template-columns:
            24px minmax(0, 1fr) 55px 20px;
        min-width: 0;
    }

    /* Controles */

    .replay-controls {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 8px;
    }

    .replay-main-controls,
    .replay-timeline,
    .replay-speed {
        min-width: 0;
    }

    .replay-timeline {
        width: 100%;
    }

    .replay-slider {
        display: block;
        width: 100%;
        max-width: 100%;
    }

    .replay-speed {
        grid-column: 1 / -1;
        justify-content: center;
    }

    /* Eventos */

    .replay-events,
    .replay-event-list,
    .replay-event {
        min-width: 0;
        max-width: 100%;
    }

    .replay-event {
        grid-template-columns:
            minmax(0, 75px)
            minmax(0, 30px)
            14px
            minmax(0, 30px)
            minmax(0, 1fr);
    }

    .replay-event-message {
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

/* =========================================================
   MÓVIL
   ========================================================= */

@media (max-width: 480px) {

    .public-replay {
        padding: 14px 8px 26px;
    }

    .replay-chart-card {
        padding: 7px;
    }

    .replay-chart {
        height: 390px;
        min-height: 390px;
    }

    .replay-view-switch {
        gap: 4px;
        padding: 3px;
    }

    .replay-view-switch button {
        padding: 8px 3px;
        font-size: 0.68rem;
        min-height: 42px;
    }

    .replay-lap-counter {
        flex-shrink: 0;
        gap: 3px;
    }

    .replay-lap-counter strong {
        font-size: 1.1rem;
    }

    .replay-standings {
        grid-template-columns: minmax(0, 1fr);
    }

    .replay-driver {
        grid-template-columns:
            30px minmax(0, 1fr) 65px 28px;
    }

    .replay-controls {
        grid-template-columns: minmax(0, 1fr);
    }

    .replay-main-controls {
        justify-content: center;
    }

    .replay-timeline {
        grid-column: 1;
        grid-row: 2;
    }

    .replay-speed {
        grid-column: 1;
        grid-row: 3;
        flex-wrap: wrap;
    }

    .replay-event {
        grid-template-columns:
            minmax(0, 65px)
            minmax(0, 26px)
            12px
            minmax(0, 26px)
            minmax(0, 1fr);
        gap: 3px;
    }
}

/* =========================================================
   MÓVILES MUY ESTRECHOS
   ========================================================= */

@media (max-width: 360px) {

    .public-replay {
        padding-inline: 5px;
    }

    .replay-chart-card {
        padding: 5px;
    }

    .replay-chart {
        height: 320px;
        min-height: 320px;
    }

    .replay-chart-header h2 {
        font-size: 0.9rem;
    }

    .replay-view-switch button {
        font-size: 0.62rem;
    }

    .replay-driver {
        grid-template-columns:
            25px minmax(0, 1fr) 55px 22px;
        padding-inline: 5px;
    }

    .replay-team {
        display: none;
    }

    .replay-speed button {
        min-width: 42px;
        padding-inline: 5px;
    }
}


/* =========================================================
   REPLAY LOADING
   ========================================================= */

.replay-loading {
    flex: 1;
    width: 100%;
    min-height: 320px;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 32px 20px;
    margin-bottom: 24px;

    background: #171b27;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.replay-loading-content {
    width: 100%;
    max-width: 520px;

    display: flex;
    flex-direction: column;
    align-items: center;

    text-align: center;
}

.replay-loading-spinner {
    width: 64px;
    height: 64px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 24px;

    border: 1px solid rgba(225, 6, 0, 0.35);
    border-radius: 50%;

    color: #e10600;
    font-size: 26px;

    animation: replay-loading-pulse 1.8s ease-in-out infinite;
}

.replay-loading-content h2 {
    margin: 0 0 12px;

    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
}

.replay-loading-stage {
    min-height: 24px;
    margin: 0 0 24px;

    color: #aab3c5;
    font-size: 0.95rem;
}

.replay-loading-progress {
    width: 100%;
    max-width: 420px;
}

.replay-loading-progress-track {
    width: 100%;
    height: 7px;

    overflow: hidden;

    background: #292e3b;
    border-radius: 999px;
}

.replay-loading-progress-bar {
    width: 35%;
    height: 100%;

    background: #e10600;
    border-radius: 999px;

    animation: replay-loading-progress 1.6s ease-in-out infinite;
}

.replay-loading-note {
    margin: 16px 0 0;

    color: #727d91;
    font-size: 0.8rem;
}

@keyframes replay-loading-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.92);
        opacity: 0.65;
    }
}

@keyframes replay-loading-progress {
    0% {
        transform: translateX(-110%);
    }

    100% {
        transform: translateX(310%);
    }
}

@media (prefers-reduced-motion: reduce) {
    .replay-loading-spinner,
    .replay-loading-progress-bar {
        animation: none;
    }
}


/* =========================================================
   REPLAY PAGE LAYOUT
   ========================================================= */

.public-replay {
    flex: 1 0 auto;

    display: flex;
    flex-direction: column;

    width: 100%;
}

.public-replay .replay-container {
    flex: 1 0 auto;

    display: flex;
    flex-direction: column;

    width: 100%;
}

.public-replay .replay-loading {
    flex: 1 0 auto;
}

/* =========================================================
   RACE EVENTS - TEXTO COMPLETO Y MULTILÍNEA
   ========================================================= */

.replay-events .replay-event {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 5px;

    width: 100%;
    min-width: 0;
    height: auto;
}

/* Tipo de evento y pilotos: permanecen en la primera línea */
.replay-events .replay-event-type,
.replay-events .replay-event-driver,
.replay-events .replay-event-arrow {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Mensaje: ocupa todo el ancho y crece tantas líneas como necesite */
.replay-events .replay-event-message {
    display: block;

    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    height: auto;

    white-space: normal;
    overflow: visible;
    text-overflow: clip;

    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.5;
}

/* Race Events: mejorar legibilidad en móvil */
@media (max-width: 768px) {
    .replay-events .replay-event {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .replay-events .replay-event-type,
    .replay-events .replay-event-driver {
        font-size: 0.8rem;
    }

    .replay-events .replay-event-message {
        font-size: 0.85rem;
        line-height: 1.6;
    }
}

/* ==========================================
   SOCIAL VIDEO RECORDING PANEL
   ========================================== */

.replay-recording-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;

    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;

    background: #151820;
    border: 1px solid rgba(225, 6, 0, 0.45);
    border-radius: 14px;

    color: #ffffff;
}

.replay-recording-info {
    flex: 1;
    min-width: 0;
}

.replay-recording-title {
    display: block;
    font-size: 1.1rem;
    font-weight: 700;
}

.replay-recording-description {
    margin: 0.5rem 0 0;
    color: #aab2c0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.replay-recording-status {
    margin: 0.75rem 0 0;
    color: #ffffff;
    font-size: 0.9rem;
}

.replay-recording-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.replay-recording-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;

    padding: 0.8rem 1.1rem;

    border: none;
    border-radius: 8px;

    font-size: 0.9rem;
    font-weight: 700;

    cursor: pointer;
    transition: opacity 0.2s ease;
}

.replay-recording-actions button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.replay-recording-start {
    background: #e10600;
    color: #ffffff;
}

.replay-recording-stop {
    background: #343b49;
    color: #ffffff;
}

.replay-recording-actions button:not(:disabled):hover {
    opacity: 0.85;
}

@media (max-width: 640px) {
    .replay-recording-panel {
        flex-direction: column;
        align-items: stretch;
    }

    .replay-recording-actions {
        width: 100%;
        flex-direction: column;
    }

    .replay-recording-actions button {
        width: 100%;
    }
}

/* =========================================================
   RECORDING WORKSPACE
   ========================================================= */

.replay-recording-workspace {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

.replay-recording-preview {
    width: 100%;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    background: #090b11;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
}

#replay-recording-preview-canvas {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.replay-recording-controls {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    background: #151820;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
}

.replay-recording-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #fff;
}

.replay-recording-info > span {
    color: #8d96a8;
    font-size: 0.85rem;
}

.replay-recording-controls .replay-recording-actions {
    display: flex;
    gap: 10px;
}

.replay-recording-controls .replay-recording-actions button {
    flex: 1;
    min-height: 44px;
}

@media (min-width: 900px) {
    .replay-recording-workspace {
        max-width: 440px;
    }
}

/* El replay sigue renderizado para poder dibujar su gráfica,
   pero no se muestra en la página de grabación. */
.replay-render-source {
    position: fixed;
    top: 0;
    left: -500px;

    width: 420px;
    max-width: none;
    min-width: 420px;

    visibility: hidden;
    pointer-events: none;
    z-index: -1;
}

.replay-recording-speed {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.replay-recording-speed label {
    color: var(--text-secondary, #aab2c0);
    font-size: 14px;
}

.replay-recording-speed select {
    background: #0b0e14;
    color: #fff;
    border: 1px solid #343946;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
}

.replay-title-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

.replay-title-row .replay-title {
    margin: 0;
}

.replay-share-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    width: 2.25rem;
    height: 2.25rem;

    padding: 0;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.2));
    border-radius: 50%;

    background: transparent;
    color: inherit;

    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.replay-share-button:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.replay-share-button i {
    font-size: 0.95rem;
}

/* =========================================================
   RECORDING ACTION BUTTONS
   ========================================================= */

.replay-recording-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    min-height: 58px;
    padding: 12px 18px;

    border: 0;
    border-radius: 9px;

    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;

    cursor: pointer;
    transition: background 0.2s ease, opacity 0.2s ease;
}

/* Record */
.replay-recording-start {
    background: #e10600;
    color: #ffffff;
}

.replay-recording-start:hover:not(:disabled) {
    background: #f21b14;
}

/* Stop */
.replay-recording-stop {
    background: #343b49;
    color: #ffffff;
}

/* Save video */
.replay-recording-save {
    background: #f0f1f3;
    color: #111111;
}

.replay-recording-save:hover:not(:disabled) {
    background: #ffffff;
}

/* Share video */
.replay-recording-share {
    background: #f0f1f3;
    color: #111111;
}

.replay-recording-share:hover:not(:disabled) {
    background: #ffffff;
}

/* Iconos */
.replay-recording-actions button i {
    font-size: 0.95rem;
    flex-shrink: 0;
}

/* Botones deshabilitados */
.replay-recording-actions button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Móvil */
@media (max-width: 640px) {
    .replay-recording-controls .replay-recording-actions {
        flex-wrap: wrap;
    }

    .replay-recording-controls .replay-recording-actions button {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* ==========================================
   SOCIAL MEDIA TEXT
   ========================================== */

.replay-social-copy {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    margin-bottom: 4px;
}

.replay-social-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.replay-social-field label {
    color: #aab2c0;
    font-size: 0.85rem;
    font-weight: 700;
}

/* Textarea + copy button */
.replay-social-input-row {
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
}

.replay-social-input-row textarea {
    display: block;
    width: 100%;
    min-width: 0;
    height: auto;
    min-height: 52px;
    max-height: none;
    overflow: hidden;
    resize: none;
    box-sizing: border-box;

    padding: 12px 48px 12px 13px;

    color: #e9edf5;
    background: #0b0e14;

    border: 1px solid #343946;
    border-radius: 9px;

    font: inherit;
    font-size: 0.87rem;
    line-height: 1.5;
}

#replay-social-title {
    min-height: 52px;
}

#replay-social-description {
    min-height: 110px;
}

/* Icon-only button inside the field */
.replay-social-copy-button {
    position: absolute;
    top: 7px;
    right: 7px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 32px;
    height: 32px;
    padding: 0;

    color: #cbd2de;
    background: #252b37;

    border: 1px solid #3b4352;
    border-radius: 7px;

    cursor: pointer;
    transition:
            background 0.2s ease,
            color 0.2s ease,
            border-color 0.2s ease;
}

.replay-social-copy-button:hover {
    color: #ffffff;
    background: #343c4b;
    border-color: #596477;
}

.replay-social-copy-button:active {
    transform: scale(0.96);
}

.replay-social-copy-button i {
    font-size: 0.9rem;
}

/* Focus */
.replay-social-input-row textarea:focus {
    outline: none;
    border-color: #596477;
}

.replay-social-copy-button:focus-visible {
    outline: 2px solid #e10600;
    outline-offset: 2px;
}

/* Mobile */
@media (max-width: 480px) {
    .replay-social-copy {
        gap: 12px;
    }

    #replay-social-description {
        min-height: 125px;
    }
}

/* ==========================================
   RECORDING ACTIONS
   ========================================== */

.replay-recording-actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

/* Record and Stop */
.replay-recording-start,
.replay-recording-stop {
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    padding: 12px 16px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;

    border: 1px solid transparent;
    border-radius: 9px;

    font: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.25;

    cursor: pointer;
}

.replay-recording-start {
    background: #e10600;
    color: #fff;
}

.replay-recording-stop {
    background: #343b49;
    color: #fff;
}

/* Save and Share: only rendered after recording */
.replay-recording-result-actions {
    display: flex;
    flex: 1 1 0;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
}

.replay-recording-save,
.replay-recording-share {
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    padding: 10px 12px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    background: #252b37;
    color: #e9edf5;

    border: 1px solid #3b4352;
    border-radius: 9px;

    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;

    cursor: pointer;
}

.replay-recording-save:hover,
.replay-recording-share:hover {
    background: #343c4b;
    border-color: #596477;
}

.replay-recording-save i,
.replay-recording-share i {
    flex-shrink: 0;
}

.replay-recording-save:disabled,
.replay-recording-share:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 480px) {
    .replay-recording-actions {
        flex-wrap: wrap;
    }

    .replay-recording-start,
    .replay-recording-stop {
        flex: 1 1 100%;
        width: 100%;
    }

    .replay-recording-result-actions {
        flex: 1 1 100%;
        width: 100%;
    }

    .replay-recording-save,
    .replay-recording-share {
        flex: 1 1 0;
        min-width: 0;
    }
}

/* ==========================================
   RECORDING RESULT ACTIONS
   ========================================== */

.replay-recording-result-actions {
    display: flex;
    flex: 1 1 0;
    align-items: stretch;
    gap: 10px;
    min-width: 0;
    width: 100%;
}

.replay-recording-result-actions button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    padding: 10px 12px;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    border-radius: 9px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1.25;
    text-align: center;
}

/* No mostrar botones que Alpine haya ocultado */
.replay-recording-result-actions button[x-cloak] {
    display: none;
}

@media (max-width: 480px) {
    .replay-recording-result-actions {
        flex-wrap: wrap;
    }

    .replay-recording-result-actions button {
        flex: 1 1 100%;
        width: 100%;
    }
}