/* ==============================================
   VocalFuse iOS MVP — 3-Tab Design System
   ============================================== */

/* ─── Global: Disable double-tap zoom on iOS ─── */
body.ios-mvp,
body.ios-mvp * {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

body.ios-mvp {
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
}

/* ─── iOS MVP Shell ─── */
body.ios-mvp .sidebar,
body.ios-mvp .top-bar,
body.ios-mvp .dashboard-layout {
    display: none !important;
}

body.ios-mvp .app-stage {
    margin-left: 0 !important;
}

body.ios-mvp .app-container {
    padding: 0;
    max-width: 100%;
}

/* ─── Tab Bar ─── */
.mvp-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(56px + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(10, 10, 12, 0.92);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    z-index: 1000;
}

.mvp-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.mvp-tab i {
    font-size: 1.25rem;
    transition: transform 0.2s;
}

.mvp-tab.active {
    color: var(--gold);
}

.mvp-tab.active i {
    transform: scale(1.1);
}

/* Create tab accent */
.mvp-tab.create-tab i {
    font-size: 1.6rem;
    color: var(--gold);
}

/* ─── Tab Panels ─── */
.mvp-panel {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: calc(56px + var(--safe-bottom));
    overflow: hidden;
    padding-top: max(env(safe-area-inset-top, 59px), 59px);
    background: var(--bg-dark);
}

.mvp-panel.active {
    display: block;
    animation: mvpFadeIn 0.2s ease;
}

@keyframes mvpFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ─── Feed Panel ─── */
#panelFeed {
    overflow: hidden;
}

.mvp-feed {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px 16px 0;
}

.mvp-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 16px;
    flex-shrink: 0;
}

.mvp-feed-logo {
    height: 32px;
    width: 32px;
    border-radius: 6px;
}

.mvp-profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    overflow: hidden;
}

.mvp-credit-badge {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(243, 194, 106, 0.12);
    border: 1px solid rgba(243, 194, 106, 0.25);
    border-radius: 20px;
    padding: 5px 12px;
    color: var(--gold);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
}

.mvp-credit-badge i {
    font-size: 0.78rem;
}

/* Segmented Control */
.mvp-segment {
    display: flex;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 3px;
    margin-bottom: 20px;
    flex-shrink: 0;
}

.mvp-segment-btn {
    flex: 1;
    padding: 10px 0;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.mvp-segment-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.mvp-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulse 1.5s infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.3;
    }
}

/* ─── Session Feed Cards ─── */
.mvp-feed-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.mvp-feed-card {
    display: flex;
    gap: 14px;
    padding: 14px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mvp-feed-card:active {
    transform: scale(0.98);
    background: rgba(255, 255, 255, 0.06);
}

.mvp-feed-card.live {
    border-color: rgba(94, 234, 212, 0.2);
    box-shadow: 0 0 20px rgba(94, 234, 212, 0.06);
}

.mvp-feed-cover {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.05);
}

.mvp-feed-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.mvp-feed-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mvp-feed-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.mvp-feed-avatars {
    display: flex;
}

.mvp-feed-avatars img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
    margin-left: -6px;
    object-fit: cover;
}

.mvp-feed-avatars img:first-child {
    margin-left: 0;
}

.mvp-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mvp-live-badge .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ef4444;
    animation: livePulse 1.5s infinite;
}

.mvp-feed-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    min-height: 50vh;
}

.mvp-feed-empty i {
    font-size: 2.5rem;
    margin-bottom: 14px;
    opacity: 0.25;
}

/* ─── Cast Panel (Character Grid) ─── */
#panelCast {
    overflow: hidden;
}

.mvp-cast {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px 16px 0;
}

.mvp-cast-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0 16px;
    flex-shrink: 0;
}

.mvp-cast-title {
    font-size: 1.6rem;
    font-weight: 800;
}

.mvp-cast-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

.mvp-cast-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

.mvp-cast-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 20px 12px 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.mvp-cast-card:active {
    transform: scale(0.96);
}

.mvp-cast-card.create-card {
    border-style: dashed;
    border-color: rgba(243, 194, 106, 0.3);
    background: rgba(243, 194, 106, 0.03);
}

.mvp-cast-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--glass-border);
}

.mvp-cast-card.create-card .mvp-cast-avatar {
    border-color: rgba(243, 194, 106, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--gold);
}

.mvp-cast-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mvp-cast-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
}

.mvp-cast-tag {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--cyan);
    background: rgba(94, 234, 212, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
}

.mvp-cast-menu {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 4px;
}

/* ─── Create Bottom Sheet ─── */
.mvp-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.mvp-sheet-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.mvp-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(18, 18, 22, 0.97);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border-radius: 24px 24px 0 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2001;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0 20px calc(20px + var(--safe-bottom));
}

.mvp-sheet-overlay.open .mvp-sheet {
    transform: translateY(0);
}

.mvp-sheet-handle {
    width: 36px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    margin: 10px auto 20px;
}

.mvp-sheet h2 {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 20px;
}

.mvp-sheet-section {
    margin-bottom: 20px;
}

.mvp-sheet-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: block;
}

/* Topic Input */
.mvp-topic-input {
    width: 100%;
    min-height: 56px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px 16px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    resize: none;
    transition: border-color 0.2s;
}

.mvp-topic-input:focus {
    border-color: var(--cyan);
}

.mvp-topic-input::placeholder {
    color: var(--text-muted);
}

/* Title Input Row */
.mvp-title-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.mvp-title-input {
    flex: 1;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0 14px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.mvp-title-input:focus { border-color: var(--cyan); }
.mvp-title-input::placeholder { color: var(--text-muted); font-size: 0.85rem; }
.mvp-title-input.generating {
    background: linear-gradient(90deg, rgba(255,255,255,0.03), rgba(255,255,255,0.08), rgba(255,255,255,0.03));
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.mvp-title-refresh {
    width: 44px; height: 44px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.05);
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
}
.mvp-title-refresh:active { transform: scale(0.9); background: rgba(255,255,255,0.1); }
.mvp-title-refresh.spinning i { animation: spin 0.6s linear; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Topic Chips */
.mvp-topic-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.mvp-chip {
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}

.mvp-chip:active {
    background: rgba(243, 194, 106, 0.12);
    border-color: var(--gold);
    color: var(--gold);
}

/* Cast Picker (horizontal) */
.mvp-cast-picker {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 0;
}

.mvp-cast-picker::-webkit-scrollbar {
    display: none;
}

.mvp-pick {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    cursor: pointer;
}

.mvp-pick-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.06);
    border: 3px solid transparent;
    transition: border-color 0.2s;
}

.mvp-pick.selected .mvp-pick-avatar {
    border-color: var(--cyan);
}

.mvp-pick-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mvp-pick-name {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    max-width: 60px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mvp-pick.selected .mvp-pick-name {
    color: var(--cyan);
}

/* Duration Segmented */
.mvp-duration {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 3px;
}

.mvp-dur-btn {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.mvp-dur-btn.active {
    background: var(--gold);
    color: #000;
}

/* Go Live Button */
.mvp-go-live {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: none;
    font-size: 1.05rem;
    font-weight: 800;
    font-family: inherit;
    cursor: pointer;
    background: linear-gradient(135deg, var(--gold), #e0a040);
    color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
    transition: opacity 0.2s;
}

.mvp-go-live:active {
    opacity: 0.85;
    transform: scale(0.98);
}

.mvp-go-live:disabled {
    opacity: 0.35;
    pointer-events: none;
}

/* ==============================================
   iOS Native Room View
   ============================================== */

/* ─── Room Panel ─── */
.ios-room {
    display: none;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark, #0a0a0c);
    z-index: 999;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ios-room.active {
    opacity: 1;
    transform: translateY(0);
}

/* ─── Top Nav (TikTok: semi-transparent floating) ─── */
.ios-room-nav {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    padding: max(env(safe-area-inset-top, 54px), 54px) 16px 10px;
    gap: 12px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
}

.ios-room-back,
.ios-room-share {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: #fff;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.ios-room-back:active,
.ios-room-share:active {
    background: rgba(255, 255, 255, 0.15);
}

.ios-room-nav-center {
    flex: 1;
    text-align: center;
}

.ios-room-title {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ios-room-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    font-size: 0.72rem;
    color: rgba(255, 255, 255, 0.5);
}

.ios-live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ff3b30;
    animation: iosLivePulse 1.5s infinite;
}

@keyframes iosLivePulse {

    0%,
    100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.5);
    }

    50% {
        opacity: 0.7;
        box-shadow: 0 0 0 6px rgba(255, 59, 48, 0);
    }
}

.ios-room-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ─── Character Stage ─── */
.ios-room-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    min-height: 0;
}

.ios-speaker-ring {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0, 210, 211, 0.15), rgba(255, 179, 64, 0.15));
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.ios-speaker-ring::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid rgba(0, 210, 211, 0.2);
    transition: all 0.3s ease;
}

.ios-speaker-ring.speaking {
    background: linear-gradient(135deg, rgba(0, 210, 211, 0.3), rgba(255, 179, 64, 0.3));
    box-shadow: 0 0 40px rgba(0, 210, 211, 0.25), 0 0 80px rgba(255, 179, 64, 0.15);
}

.ios-speaker-ring.speaking::before {
    border-color: rgba(0, 210, 211, 0.5);
    animation: iosSpeakerPulse 2s infinite;
}

@keyframes iosSpeakerPulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.08);
        opacity: 0.6;
    }
}

.ios-speaker-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.ios-speaker-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    text-align: center;
}

/* Cast row (small avatars) */
.ios-room-cast {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 100%;
}

.ios-cast-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.ios-cast-avatar.speaking,
.participant.speaking .ios-cast-avatar {
    opacity: 1;
}

/* Override web app's golden rectangular frame on speaking participant */
body.ios-mvp .participant.speaking {
    transform: none !important;
    border-color: transparent !important;
    box-shadow: none !important;
}

body.ios-mvp .participant.speaking::after {
    display: none !important;
}

body.ios-mvp .participant.speaking .ios-cast-avatar img {
    border-color: rgba(0, 210, 211, 0.6);
    box-shadow: 0 0 12px rgba(0, 210, 211, 0.3);
}

.ios-cast-avatar img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.ios-cast-avatar span {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Waveform Visualizer (inside stage, below cast) ─── */
.ios-room-waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3.5px;
    height: 36px;
    margin-top: 20px;
    padding: 0;
}

.ios-room-waveform .v-bar {
    width: 3.5px;
    background: linear-gradient(to top, rgba(0, 210, 211, 0.6), rgba(232, 184, 73, 0.9));
    border-radius: 3px;
    height: 6px;
    transition: height 0.12s ease-out;
}

.ios-room-waveform.is-speaking {
    filter: drop-shadow(0 0 8px rgba(0, 210, 211, 0.3));
}

.ios-room-waveform.is-speaking .v-bar {
    animation: iosWave 0.55s ease-in-out infinite alternate;
}

.ios-room-waveform.is-speaking .v-bar:nth-child(1) { animation-delay: 0s; }
.ios-room-waveform.is-speaking .v-bar:nth-child(2) { animation-delay: 0.07s; }
.ios-room-waveform.is-speaking .v-bar:nth-child(3) { animation-delay: 0.14s; }
.ios-room-waveform.is-speaking .v-bar:nth-child(4) { animation-delay: 0.21s; }
.ios-room-waveform.is-speaking .v-bar:nth-child(5) { animation-delay: 0.28s; }
.ios-room-waveform.is-speaking .v-bar:nth-child(6) { animation-delay: 0.21s; }
.ios-room-waveform.is-speaking .v-bar:nth-child(7) { animation-delay: 0.14s; }
.ios-room-waveform.is-speaking .v-bar:nth-child(8) { animation-delay: 0.07s; }
.ios-room-waveform.is-speaking .v-bar:nth-child(9) { animation-delay: 0s; }

@keyframes iosWave {
    from {
        height: 4px;
    }

    to {
        height: 22px;
    }
}

/* ─── Subtitle Area ─── */
.ios-room-subtitle {
    padding: 8px 20px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-subtitle-text {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.85);
    text-align: center;
    line-height: 1.5;
    font-weight: 500;
    max-width: 100%;
}

/* ─── Messages (TikTok: bottom-left floating chat) ─── */
.ios-room .ios-room-messages {
    position: absolute;
    left: 0;
    bottom: 180px;
    width: 70%;
    max-height: 40vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 8px 16px;
    z-index: 5;
    mask-image: linear-gradient(transparent 0%, black 20%, black 100%);
    -webkit-mask-image: linear-gradient(transparent 0%, black 20%, black 100%);
}

/* Full-screen chat mode (when subtitles ON) — Apple Music Lyrics Style */
.ios-room-messages.fullscreen-chat {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 180px;
    width: 100%;
    max-height: none;
    background: rgba(0, 0, 0, 0.85);
    /* Large vertical padding to center first/last items — like web app */
    padding: 30vh 16px 25vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    /* Fade mask at top and bottom */
    mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 15%, black 85%, transparent 100%);
}

.ios-room-messages.fullscreen-chat::-webkit-scrollbar {
    display: none;
}

/* TikTok-style right-side action column */
.tiktok-action-col {
    position: absolute;
    right: 12px;
    bottom: 160px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.tiktok-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.tiktok-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.tiktok-action-btn:active {
    transform: scale(0.88);
}

.tiktok-action-btn.active {
    background: rgba(255, 59, 92, 0.2);
}

.tiktok-action-btn.active i.fa-heart {
    color: #ff3b5c;
}

.tiktok-action-label {
    font-size: 0.7rem;
    color: #fff;
    font-weight: 600;
    text-align: center;
}

/* ─── Bottom Controls (TikTok: transparent floating bar) ─── */
.ios-room-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
}

.ios-control-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 8px;
}

.ios-lang-select-inline {
    height: 32px;
    padding: 0 8px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 0.75rem;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    flex-shrink: 0;
}

.ios-ctrl-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #fff;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
    position: relative;
}

.ios-ctrl-btn span {
    display: none;
}

/* Like badge (count inside button) — must override .ios-ctrl-btn span { display:none } */
.ios-ctrl-btn .ios-like-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff3b5c;
    color: #fff;
    font-size: 0.55rem;
    min-width: 14px;
    height: 14px;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    padding: 0 3px;
}

.ios-ctrl-btn .ios-like-badge:empty {
    display: none !important;
}

.ios-ctrl-btn.active i.fa-heart {
    color: #ff3b5c;
}

.ios-ctrl-btn:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.2);
}

.ios-ctrl-btn.active {
    background: rgba(255, 255, 255, 0.2);
}

/* Mic recording animation */
.ios-ctrl-btn.recording {
    background: rgba(255, 59, 48, 0.3);
    animation: mic-pulse 1.2s ease-in-out infinite;
}

.ios-ctrl-btn.recording i {
    color: #ff3b30;
}

@keyframes mic-pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.4);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 12px 4px rgba(255, 59, 48, 0.3);
    }
}

/* Like badge: click-through so parent button gets clicks */
.ios-like-badge {
    pointer-events: none;
}

/* Heart pop animation */
.ios-ctrl-btn.like-pop {
    animation: heart-pop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heart-pop {
    0% {
        transform: scale(1);
    }

    30% {
        transform: scale(1.35);
    }

    60% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.ios-ctrl-btn.active i.fa-heart {
    color: #ff3b5c;
    text-shadow: 0 0 8px rgba(255, 59, 92, 0.5);
}

/* Audio muted button */
.ios-ctrl-btn.muted {
    opacity: 0.5;
}

.ios-ctrl-stop {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.2);
}

.ios-ctrl-stop:active {
    background: rgba(255, 59, 48, 0.3);
}

/* Language selector */
.ios-lang-select {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82rem;
    margin-bottom: 8px;
    -webkit-appearance: none;
    appearance: none;
}

/* Input row */
.ios-input-row {
    display: flex;
    gap: 8px;
}

.ios-chat-input {
    flex: 1;
    padding: 10px 14px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.9rem;
    outline: none;
}

.ios-chat-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.ios-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gold, #e8b849);
    border: none;
    color: #000;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.ios-send-btn:active {
    transform: scale(0.92);
}

/* ─── Tab bar hidden in room ─── */
.mvp-tab-bar.hidden {
    display: none !important;
}

/* ==============================================
   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 {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 20px;
}

/* ==============================================
   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: ⏪ ▶️ ⏩ */
.ios-player-transport {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 36px;
    padding: 6px 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;
}

/* ==============================================
   Settings Sheet
   ============================================== */
.ios-settings-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(20, 20, 24, 0.97);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: 20px 20px 0 0;
    padding: 20px 20px max(env(safe-area-inset-bottom, 16px), 16px);
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.ios-settings-sheet.open {
    transform: translateY(0);
}

.ios-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.ios-settings-header button {
    background: rgba(255, 255, 255, 0.08);
    border: none;
    color: rgba(255, 255, 255, 0.5);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ios-settings-section {
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ios-settings-section:last-of-type {
    border-bottom: none;
}

.ios-settings-user {
    display: flex;
    align-items: center;
    gap: 14px;
}

.ios-settings-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
}

.ios-settings-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ios-settings-name {
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
}

.ios-settings-email {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.35);
    margin-top: 2px;
}

.ios-settings-label {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.3);
    margin-bottom: 10px;
}

.ios-settings-credits {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ios-settings-credit-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold, #ffb800);
}

.ios-settings-credit-count i {
    font-size: 1rem;
}

.ios-settings-buy-btn {
    background: linear-gradient(135deg, var(--gold, #ffb800), #ff8c00);
    border: none;
    color: #000;
    font-weight: 700;
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ios-settings-lang-picker {
    display: flex;
    gap: 8px;
}

.ios-lang-opt {
    flex: 1;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.ios-lang-opt.active {
    background: rgba(0, 212, 255, 0.12);
    border-color: var(--cyan, #00d4ff);
    color: var(--cyan, #00d4ff);
    font-weight: 600;
}

.ios-settings-action {
    width: 100%;
    padding: 14px;
    border: none;
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ios-settings-version {
    text-align: center;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.15);
    margin-top: 16px;
    padding-top: 8px;
}