/* ==============================================
   Immersive Mode (double-tap zoom)
   ============================================== */
.ios-room {
    touch-action: manipulation;
    /* Prevent default double-tap zoom */
}

.ios-room.immersive .ios-room-nav {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.ios-room.immersive .ios-room-stage {
    flex: 1;
    justify-content: center;
}

.ios-room.immersive .ios-speaker-ring {
    width: 220px;
    height: 220px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ios-room.immersive .ios-speaker-avatar {
    width: 200px;
    height: 200px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.ios-room.immersive .ios-speaker-name {
    font-size: 1.4rem;
    transition: font-size 0.3s ease;
}

.ios-room.immersive .ios-room-controls {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.ios-room.immersive .ios-room-subtitle {
    padding: 16px 24px;
}

.ios-room.immersive .ios-subtitle-text {
    font-size: 1.15rem;
}

.ios-room.immersive .ios-room-messages {
    max-height: 100px;
}

.ios-room.immersive .ios-room-waveform {
    height: 50px;
}

.ios-room.immersive .ios-room-waveform .v-bar {
    width: 4px;
}

/* Ensure cast row always visible */
.ios-room-cast {
    display: flex !important;
}

/* ─── Play/Pause Button (Replay) ─── */
.ios-ctrl-play {
    background: rgba(0, 210, 211, 0.15);
    color: #00d2d3;
    border-color: rgba(0, 210, 211, 0.2);
}

.ios-ctrl-play.active {
    background: rgba(0, 210, 211, 0.25);
    color: #00d2d3;
}

.ios-ctrl-play:active {
    background: rgba(0, 210, 211, 0.35);
}

/* ==============================================
   Responsive Breakpoints — All iPhone Sizes
   ============================================== */

/* ─── iPhone SE / 8 (375×667, 4.7", no notch) ─── */
@media screen and (max-width: 375px) and (max-height: 700px) {
    .ios-room-nav {
        padding-top: 28px;
        /* No notch */
    }

    .ios-speaker-ring {
        width: 100px;
        height: 100px;
    }

    .ios-speaker-avatar {
        width: 84px;
        height: 84px;
    }

    .ios-speaker-name {
        font-size: 0.95rem;
    }

    .ios-cast-avatar img {
        width: 36px;
        height: 36px;
    }

    .ios-cast-avatar span {
        font-size: 0.6rem;
    }

    .ios-room-cast {
        gap: 8px;
    }

    .ios-room-stage {
        gap: 10px;
        padding: 12px;
    }

    .ios-room-waveform {
        height: 28px;
    }

    .ios-subtitle-text {
        font-size: 0.82rem;
    }

    .ios-room-messages {
        max-height: 100px;
    }

    .ios-ctrl-btn {
        width: 42px;
        height: 42px;
        font-size: 0.9rem;
    }

    .ios-control-row {
        gap: 8px;
    }

    .ios-room-controls {
        padding: 8px 12px 12px;
    }

    /* Immersive mode on SE */
    .ios-room.immersive .ios-speaker-ring {
        width: 160px;
        height: 160px;
    }

    .ios-room.immersive .ios-speaker-avatar {
        width: 140px;
        height: 140px;
    }
}

/* ─── iPhone Mini / Standard (375-393px width) ─── */
@media screen and (min-width: 375px) and (max-width: 393px) and (min-height: 700px) {
    .ios-room-stage {
        gap: 14px;
        padding: 16px;
    }
}

/* ─── iPhone Pro Max / Plus (≥430px width) ─── */
@media screen and (min-width: 414px) {
    .ios-speaker-ring {
        width: 160px;
        height: 160px;
    }

    .ios-speaker-avatar {
        width: 140px;
        height: 140px;
    }

    .ios-speaker-name {
        font-size: 1.25rem;
    }

    .ios-cast-avatar img {
        width: 50px;
        height: 50px;
    }

    .ios-room-cast {
        gap: 16px;
    }

    .ios-room-stage {
        gap: 20px;
        padding: 24px;
    }

    .ios-subtitle-text {
        font-size: 1.05rem;
    }

    .ios-ctrl-btn {
        width: 52px;
        height: 52px;
    }

    .ios-control-row {
        gap: 16px;
    }

    /* Immersive mode on Max */
    .ios-room.immersive .ios-speaker-ring {
        width: 260px;
        height: 260px;
    }

    .ios-room.immersive .ios-speaker-avatar {
        width: 240px;
        height: 240px;
    }
}

/* ==============================================
   Feed Skeleton Loader
   ============================================== */
.mvp-feed-skeleton {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 16px;
}

.skeleton-card {
    height: 90px;
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.04) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.04) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s infinite;
}

@keyframes skeletonShimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Feed list scroll */
.mvp-feed-list {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* ==============================================
   Profile Sheet (popup)
   ============================================== */
.ios-profile-sheet {
    position: fixed;
    top: max(env(safe-area-inset-top, 54px), 54px);
    right: 16px;
    background: rgba(30, 30, 35, 0.96);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 20px;
    z-index: 3000;
    min-width: 180px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: iosSheetIn 0.2s ease;
}

@keyframes iosSheetIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-8px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ios-profile-name {
    font-weight: 700;
    font-size: 1rem;
    color: #fff;
    margin-bottom: 2px;
}

.ios-profile-email {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 14px;
}

.ios-profile-action {
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    background: rgba(255, 59, 48, 0.12);
    border: none;
    color: #ff3b30;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}

.ios-profile-action:active {
    background: rgba(255, 59, 48, 0.25);
}

/* ==============================================
   Offline Banner
   ============================================== */
.ios-offline-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 59, 48, 0.15);
    color: #ff6b6b;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: center;
    padding-top: max(env(safe-area-inset-top, 8px), 8px);
}

.ios-offline-banner i {
    opacity: 0.7;
}

/* ==============================================
   Replay Progress Bar
   ============================================== */
/* ═══════════════════════════════════════════════
   Replay Player (unified bottom panel)
   ═══════════════════════════════════════════════ */
.ios-player {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 20px calc(env(safe-area-inset-bottom, 16px) + 8px);
    background: rgba(15, 15, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Slider row: elapsed ── slider ── total */
.ios-player-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ios-player-time {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    font-variant-numeric: tabular-nums;
    min-width: 32px;
    text-align: center;
}

.ios-player-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.12);
    outline: none;
}

.ios-player-slider::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
}

.ios-player-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3);
    margin-top: -5px;
}

/* Transport row: CC ⏪ ▶️ ⏩ ♡ */
.ios-player-transport {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 4px 0;
}

.ios-player-skip {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.65);
    font-size: 1.2rem;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    transition: color 0.15s, transform 0.1s;
}

.ios-player-skip span {
    font-size: 0.55rem;
    opacity: 0.5;
}

.ios-player-skip:active {
    color: #fff;
    transform: scale(0.88);
}

.ios-player-play {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}

.ios-player-play:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.92);
}

/* Utility row */
.ios-player-utils {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding-top: 2px;
}

/* Auto-hide on idle (replay) — hide player bar + top nav */
#iosRoomPanel.controls-idle .ios-room-nav {
    opacity: 0;
    pointer-events: none;
}

#iosRoomPanel.controls-idle .ios-player {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

#iosRoomPanel .ios-room-nav {
    transition: opacity 0.4s ease;
}

#iosRoomPanel .ios-player {
    transition: transform 0.4s ease, opacity 0.3s ease;
}

/* ==============================================
   Message Bubbles (Replay Transcript — Apple Music Lyrics Style)
   Ported from web app's .live-lyrics-line design
   ============================================== */
.ios-msg-bubble {
    display: flex;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    filter: blur(1.5px);
    opacity: 0.35;
    transform: scale(0.93);
}

.ios-msg-bubble.active {
    filter: blur(0);
    opacity: 1;
    transform: scale(1);
    background: linear-gradient(135deg, rgba(243, 194, 106, 0.12) 0%, rgba(243, 194, 106, 0.03) 100%);
    border-left: 3px solid rgba(243, 194, 106, 0.7);
    padding-left: 17px;
}

.ios-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.ios-msg-bubble.active .ios-msg-avatar {
    border-color: rgba(243, 194, 106, 0.5);
    box-shadow: 0 0 12px rgba(243, 194, 106, 0.2);
}

.ios-msg-body {
    flex: 1;
    min-width: 0;
}

.ios-msg-name {
    font-size: 0.75rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.45);
    margin-bottom: 3px;
}

.ios-msg-bubble.active .ios-msg-name {
    color: rgba(243, 194, 106, 0.9);
}

.ios-msg-text {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    line-height: 1.5;
    word-break: break-word;
}

.ios-msg-bubble.active .ios-msg-text {
    color: #fff;
    font-weight: 600;
    text-shadow: 0 0 20px rgba(243, 194, 106, 0.3);
}
