/* ============================================
   IPTV Player - Estilos Globais
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e0e0e0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   Header
   ============================================ */

.header {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    border-bottom: 3px solid #e94560;
    margin-bottom: 2rem;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
}

.logo {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.subtitle {
    color: #b0b0b0;
    font-size: 0.95rem;
    margin: 0;
}

/* ============================================
   Container Principal
   ============================================ */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   Painel de Controle
   ============================================ */

.control-panel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(233, 69, 96, 0.3);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.control-group label {
    font-weight: 600;
    color: #fff;
    font-size: 0.95rem;
}

.input-group {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.input-field {
    flex: 1;
    min-width: 250px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: #e94560;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 0 10px rgba(233, 69, 96, 0.3);
}

.input-field::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* ============================================
   Botões
   ============================================ */

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, #e94560 0%, #d9395d 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(233, 69, 96, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(233, 69, 96, 0.3);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(233, 69, 96, 0.2);
    border-color: #e94560;
}

/* ============================================
   Seção de Filtros
   ============================================ */

.filters-section {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #e94560;
    background: rgba(255, 255, 255, 0.12);
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-filter {
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-filter:focus {
    outline: none;
    border-color: #e94560;
}

.category-filter:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-filter option {
    background: #1a1a2e;
    color: #fff;
}

/* ============================================
   Info Stats
   ============================================ */

.info-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.stat-label {
    color: #b0b0b0;
    font-size: 0.9rem;
    font-weight: 600;
}

.stat-value {
    color: #e94560;
    font-size: 1.2rem;
    font-weight: 700;
    min-width: 30px;
}

/* ============================================
   Mensagens de Status
   ============================================ */

.status-message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.status-message.loading {
    background: rgba(33, 150, 243, 0.15);
    border: 1px solid rgba(33, 150, 243, 0.3);
    color: #64b5f6;
}

.status-message.success {
    background: rgba(76, 175, 80, 0.15);
    border: 1px solid rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.status-message.error {
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #ef5350;
}

/* ============================================
   Grade de Catálogo
   ============================================ */

.catalog-section {
    margin-bottom: 3rem;
}

.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    animation: fadeIn 0.4s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: #b0b0b0;
    font-size: 1.1rem;
}

/* ============================================
   Cards do Catálogo
   ============================================ */

.catalog-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(233, 69, 96, 0.2);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.catalog-card:hover {
    transform: translateY(-8px);
    border-color: #e94560;
    box-shadow: 0 8px 30px rgba(233, 69, 96, 0.3);
    background: rgba(255, 255, 255, 0.08);
}

.card-image {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, rgba(233, 69, 96, 0.1) 0%, rgba(15, 52, 96, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.catalog-card.is-live .card-image img {
    object-fit: contain;
}

.card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 3rem;
}

.card-info {
    padding: 1rem;
}

.card-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-height: 2.6em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-category {
    font-size: 0.8rem;
    color: #e94560;
    background: rgba(233, 69, 96, 0.15);
    padding: 0.35rem 0.6rem;
    border-radius: 4px;
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* ============================================
   Modal do Player
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeInModal 0.3s ease;
    overflow-y: auto;
}

@keyframes fadeInModal {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: linear-gradient(135deg, #0f3460 0%, #1a1a2e 100%);
    max-width: 900px;
    width: 90%;
    margin: auto;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideInModal 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

@keyframes slideInModal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 1.5rem;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.363);
    transform: rotate(90deg);
}

#playerModal .modal-header {
    padding-right: 5rem;
}

#playerModal .modal-close {
    top: 50%;
    right: 1.25rem;
    transform: translateY(-50%);
}

#playerModal .modal-close:hover {
    transform: translateY(-50%) rotate(90deg);
}

.modal-header {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    padding: 2rem;
    border-bottom: 1px solid rgba(233, 69, 96, 0.2);
    position: relative;
}

.modal-logo {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid rgba(233, 69, 96, 0.3);
}

.modal-info {
    flex: 1;
}

.modal-info h2 {
    font-size: 1.8rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.modal-info p {
    color: #e94560;
    font-size: 0.95rem;
    font-weight: 600;
}

.player-container {
    position: relative;
    flex: 1;
    padding: 2rem;
    background: rgba(0, 0, 0, 0.3);
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.video-player {
    width: 100%;
    height: 100%;
    max-height: 500px;
    border-radius: 8px;
    background: #000;
}

.next-episode-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 20px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.18), rgba(0, 0, 0, 0.88));
}

.next-episode-overlay[hidden] {
    display: none !important;
}

.next-episode-progress[hidden],
.next-episode-actions[hidden] {
    display: none !important;
}

.next-episode-card {
    width: min(420px, 100%);
    padding: 18px;
    border: 1px solid rgba(34, 211, 238, 0.32);
    border-radius: 8px;
    background: rgba(7, 10, 15, 0.96);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.46);
}

.next-episode-label,
.next-episode-series,
.next-episode-card h3,
.next-episode-card p {
    letter-spacing: 0;
}

.next-episode-label {
    margin: 0 0 5px;
    color: var(--azul-claro, #22d3ee);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
}

.next-episode-series {
    margin: 0 0 4px;
    color: #cbd5e1;
    font-size: 0.88rem;
}

.next-episode-card h3 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 1.12rem;
    line-height: 1.25;
}

#nextEpisodeCountdown {
    margin: 0;
    color: #dbeafe;
    font-size: 0.9rem;
}

.next-episode-progress {
    height: 5px;
    margin: 12px 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

.next-episode-progress span {
    display: block;
    width: 100%;
    height: 100%;
    transform-origin: left center;
    background: linear-gradient(90deg, #22d3ee, #2563eb);
    transition: width 0.25s linear;
}

.next-episode-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.next-episode-actions button {
    min-height: 42px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-size: 0.86rem;
    font-weight: 800;
    cursor: pointer;
}

#playNextEpisodeNow {
    color: #020617;
    background: linear-gradient(90deg, #22d3ee, #2563eb);
}

#cancelNextEpisode {
    color: #fff;
    background: rgba(255, 255, 255, 0.13);
}

.error-message {
    padding: 1rem;
    background: rgba(244, 67, 54, 0.15);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #ef5350;
    border-radius: 8px;
    margin: 0 2rem;
    text-align: center;
}

.login-modal-content {
    max-width: 430px;
}

.login-modal-header {
    margin-bottom: 22px;
}

.login-modal-header h2 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 1.85rem;
}

.login-modal-header p:last-child {
    margin: 0;
    color: #aeb8c7;
}

.login-form {
    display: grid;
    gap: 10px;
}

.login-form label {
    color: #e5e7eb;
    font-size: 0.86rem;
    font-weight: 800;
}

.login-form .input-field {
    width: 100%;
}

.login-error {
    margin: 2px 0 0;
    color: #ff8aa1;
    font-size: 0.86rem;
}

.login-form .btn {
    margin-top: 8px;
}

/* ============================================
   Loading Spinner
   ============================================ */

.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid #e94560;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Media Queries - Responsividade
   ============================================ */

@media (max-width: 768px) {
    .header {
        padding: 1.5rem 1rem;
    }

    .logo {
        font-size: 1.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .filter-group {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

    .category-filter {
        width: 100%;
    }

    .catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
    }

    .info-stats {
        gap: 1rem;
        justify-content: space-between;
    }

    .modal-content {
        width: 95%;
        margin: 1rem auto;
    }

    .modal-header {
        flex-direction: column;
        text-align: center;
    }

    .modal-logo {
        width: 100px;
        height: 100px;
        margin: 0 auto;
    }

    .modal-info h2 {
        font-size: 1.1rem;
    }

    .player-container {
        padding: 1rem;
        min-height: 300px;
    }

}

@media (max-width: 480px) {
    .container {
        padding: 0 0.5rem;
    }

    .control-panel,
    .filters-section {
        padding: 1rem;
    }

    .control-group label {
        font-size: 0.85rem;
    }

    .input-field,
    .search-input,
    .category-filter {
        font-size: 16px; /* Previne zoom no iOS */
    }

    .catalog-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.8rem;
    }

    .card-title {
        font-size: 0.85rem;
    }

    .card-image {
        height: 120px;
    }

    .info-stats {
        flex-direction: column;
        gap: 0.8rem;
    }

    .modal-content {
        margin: 0.5rem auto;
    }

    .modal-header {
        padding: 1.5rem 1rem;
    }

    .player-container {
        padding: 1rem;
        min-height: 250px;
    }
}

/* ============================================
   Layout com categorias laterais
   ============================================ */

body {
    background: #111;
    color: #f5f5f5;
}

.header {
    display: none;
}

.stream-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 80;
    min-height: 72px;
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    background: rgba(8, 8, 10, 0.94);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px);
}

.stream-header-main {
    display: flex;
    align-items: center;
    gap: 28px;
    min-width: 0;
}

.stream-brand {
    color: #f20542;
    font-size: 1.72rem;
    line-height: 1;
    font-weight: 950;
    letter-spacing: 0;
    text-decoration: none;
    white-space: nowrap;
}

.mode-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-tab {
    min-height: 38px;
    padding: 0 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #d3d8e0;
    font: inherit;
    font-size: 0.94rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.16s ease, color 0.16s ease;
}

.mode-tab:hover {
    color: #fff;
    background: #232323;
}

.mode-tab.active {
    color: #fff;
    background: #f20542;
}

.stream-actions {
    width: min(330px, 34vw);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.stream-actions .search-input {
    min-width: 0;
    flex: 1 1 220px;
    height: 42px;
    border-radius: 8px;
}

.auth-area {
    position: relative;
    flex: 0 0 auto;
}

.login-button,
.user-button,
.user-dropdown button {
    min-height: 42px;
    padding: 0 15px;
    border: 0;
    border-radius: 8px;
    color: #fff;
    background: #f20542;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 850;
    cursor: pointer;
}

.user-button {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: #232323;
    border: 1px solid #3a3a3a;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 210px;
    padding: 8px;
    border: 1px solid #333;
    border-radius: 8px;
    background: rgba(2, 6, 23, 0.98);
    box-shadow: var(--shadow);
    border-color: rgba(34, 211, 238, 0.22);
    z-index: 1000;
}

.user-dropdown button {
    width: 100%;
    justify-content: flex-start;
    background: transparent;
    color: #f4f4f5;
    text-align: left;
}

.user-dropdown button:hover {
    background: #232323;
}

.autoplay-toggle {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 8px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #f4f4f5;
    font-size: 0.8rem;
    line-height: 1.3;
    cursor: pointer;
}

.autoplay-toggle input {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    accent-color: var(--azul-claro, #22d3ee);
}

.container.app-shell {
    max-width: none;
    width: 100%;
    min-height: 100vh;
    padding: 28px 24px 24px;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    grid-template-areas:
        "categories controls"
        "categories filters"
        "categories status"
        "categories catalog";
    grid-template-rows: auto auto auto minmax(0, 1fr);
    gap: 12px 18px;
}

.container.app-shell.spa-shell {
    padding-top: 94px;
}

.mode-panel {
    grid-area: controls;
    margin: 0;
    padding: 14px 0 2px;
}

.category-panel {
    grid-area: categories;
    min-height: 0;
    padding: 22px 10px 16px;
    background: #202020;
    border: 1px solid #2b2b2b;
    border-radius: 16px;
    overflow-y: auto;
}

.category-panel-header {
    padding: 0 10px 12px;
}

.category-panel h2,
.catalog-heading h2 {
    margin: 0;
    color: #fff;
    font-size: 1.75rem;
    line-height: 1.15;
}

.category-panel p {
    color: #b8c0cb;
    font-size: 0.78rem;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.category-item {
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: #e8edf5;
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.category-item:hover {
    background: #2f2f2f;
}

.category-item.active {
    background: #2f2f2f;
    color: #fff;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.control-panel {
    grid-area: controls;
    margin: 0;
    padding: 12px;
    background: #1e1e1f;
    border: 1px solid #303030;
    border-radius: 12px;
}

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.page-toolbar h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(1.45rem, 2vw, 2rem);
    line-height: 1.1;
}

.mode-summary {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 0 12px;
    border: 1px solid #303030;
    border-radius: 8px;
    color: #cbd5e1;
    background: #171717;
    font-size: 0.84rem;
    font-weight: 800;
    white-space: nowrap;
}

.mode-summary span:first-child {
    color: #fff;
}

.page-kicker {
    margin: 0 0 4px;
    color: #9ca3af;
    font-size: 0.74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.content-tabs {
    display: inline-flex;
    gap: 6px;
    padding: 5px;
    border: 1px solid #303030;
    border-radius: 10px;
    background: #171717;
}

.content-tabs a {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 13px;
    border-radius: 8px;
    color: #cbd5e1;
    font-size: 0.84rem;
    font-weight: 800;
    text-decoration: none;
}

.content-tabs a:hover {
    color: #fff;
    background: #262626;
}

.content-tabs a.active {
    color: #fff;
    background: #f20542;
}

.control-group label {
    color: #d8dbe0;
    font-size: 0.8rem;
}

.input-group {
    gap: 8px;
}

.input-field,
.search-input {
    height: 46px;
    background: #202020;
    border-color: #353535;
    border-radius: 10px;
    color: #f6f6f6;
}

.btn {
    min-height: 42px;
    border-radius: 8px;
}

.filters-section {
    grid-area: filters;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
}

.filter-group {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) auto;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.search-input {
    width: 100%;
}

.category-filter,
.info-stats {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.status-message {
    grid-area: status;
    margin: 0;
}

.catalog-section {
    grid-area: catalog;
    min-height: 0;
    margin: 0;
    padding: 0;
}

.catalog-heading {
    display: flex;
    align-items: center;
    min-height: 36px;
    margin-bottom: 12px;
}

.catalog-grid {
    height: calc(100vh - 190px);
    min-height: 320px;
    padding-right: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(278px, 1fr));
    grid-auto-rows: 112px;
    align-content: start;
    align-items: start;
    gap: 10px;
    overflow-y: auto;
}

.catalog-grid.is-virtualized {
    position: relative;
    display: block;
    gap: 0;
    animation: none;
}

.virtual-spacer {
    width: 1px;
    min-height: 100%;
    pointer-events: none;
}

.virtual-layer {
    position: absolute;
    inset: 0 6px 0 0;
    pointer-events: none;
}

.catalog-card {
    position: relative;
    height: 112px;
    min-height: 112px;
    padding: 8px;
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 10px;
    background: #242424;
    border: 1px solid #323232;
    border-radius: 10px;
    box-shadow: none;
    contain: layout paint style;
    content-visibility: auto;
    contain-intrinsic-size: 112px 278px;
}

.catalog-card.is-live {
    height: 112px;
}

.catalog-card:hover {
    border-color: #4a4a4a;
    transform: translateY(-1px);
}

.catalog-card.virtual-item {
    position: absolute;
    top: 0;
    left: 0;
    height: 112px;
    pointer-events: auto;
    will-change: transform;
    animation: none !important;
}

.catalog-card.virtual-item:hover {
    border-color: rgba(34, 211, 238, 0.58);
    box-shadow: var(--glow);
}

.card-image {
    width: 90px;
    height: 90px;
    margin: 0;
    border-radius: 10px;
    background: #3a3a3a;
}

.card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cfd3d8;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 0;
}

.card-info {
    min-width: 0;
    padding: 2px 0 0;
}

.catalog-card.is-live .card-info {
    display: flex;
    min-height: 0;
    flex-direction: column;
    justify-content: space-between;
    padding: 2px 0;
}

.card-title {
    min-height: 42px;
    margin: 0 0 6px;
    padding: 5px 6px;
    background: #151515;
    color: #fff;
    font-size: 0.98rem;
    line-height: 1.15;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-category {
    max-width: 100%;
    margin: 0 0 6px;
    display: block;
    color: #cbd5e1;
    font-size: 0.78rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.catalog-card.is-live .card-category {
    display: none;
}

.live-badge {
    width: max-content;
    min-height: 26px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: #f20542;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
}

.empty-state {
    grid-column: 1 / -1;
    min-height: 260px;
    background: #202020;
    border: 1px solid #303030;
    border-radius: 12px;
}

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .stream-header {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .stream-header-main {
        justify-content: space-between;
        gap: 16px;
    }

    .stream-actions {
        width: 100%;
    }

    .container.app-shell {
        min-height: auto;
        padding: 16px;
        grid-template-columns: 1fr;
        grid-template-areas:
            "controls"
            "categories"
            "filters"
            "status"
            "catalog";
    }

    .container.app-shell.spa-shell {
        padding-top: 136px;
    }

    .category-panel {
        max-height: 210px;
    }

    .page-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .category-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    }

    .catalog-grid {
        height: auto;
        min-height: 320px;
    }
}

@media (max-width: 560px) {
    .stream-header-main {
        align-items: center
        /*flex-direction: column;*/
    }

    .stream-actions {
        align-items: stretch;
    }

    .mode-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .mode-tab {
        padding: 0 8px;
    }

    .container.app-shell.spa-shell {
        padding-top: 178px;
    }

    .content-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
    }

    .content-tabs a {
        padding: 0 8px;
    }

    .filter-group {
        grid-template-columns: 1fr;
    }

    .catalog-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   MinhaTV blue theme
   ============================================ */

:root {
    --azul-claro: #22d3ee;
    --azul-medio: #0ea5e9;
    --azul-forte: #2563eb;
    --fundo: #020617;
    --preto: #000;
    --bg: var(--fundo);
    --bg-soft: #07111f;
    --panel: rgba(255, 255, 255, 0.065);
    --panel-strong: rgba(255, 255, 255, 0.105);
    --line: rgba(255, 255, 255, 0.13);
    --text: #f7fbff;
    --muted: #cbd5f5;
    --soft: #dbeafe;
    --green: var(--azul-claro);
    --green-strong: var(--azul-medio);
    --cyan: var(--azul-claro);
    --gold: var(--azul-claro);
    --ink: #020617;
    --accent-gradient: linear-gradient(90deg, var(--azul-claro), var(--azul-forte));
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
    --glow: 0 0 22px rgba(14, 165, 233, 0.45);
    --glow-strong: 0 0 34px rgba(34, 211, 238, 0.62);
    --max: 1180px;
}

body {
    background:
        radial-gradient(circle at 18% -10%, rgba(34, 211, 238, 0.20), transparent 30%),
        radial-gradient(circle at 88% 8%, rgba(37, 99, 235, 0.22), transparent 32%),
        linear-gradient(180deg, #020617 0%, #06101f 58%, #020617 100%);
    color: var(--text);
}

.stream-header {
    min-height: 70px;
    background: rgba(2, 6, 23, 0.86);
    border-bottom: 1px solid rgba(34, 211, 238, 0.18);
    box-shadow: 0 18px 54px rgba(0, 0, 0, 0.34);
}

.stream-brand {
    color: var(--text);
    text-shadow: var(--glow);
}

.stream-brand::first-letter {
    color: var(--azul-claro);
}

.mode-tab {
    color: var(--muted);
}

.mode-tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.08);
}

.mode-tab.active,
.login-button,
.btn-primary {
    color: var(--ink);
    background: var(--accent-gradient);
    box-shadow: var(--glow);
}

.stream-actions {
    width: min(420px, 40vw);
}

.stream-actions .search-input,
.input-field {
    border-color: rgba(34, 211, 238, 0.18);
    background: rgba(2, 6, 23, 0.72);
    color: var(--text);
}

.stream-actions .search-input:focus,
.input-field:focus {
    border-color: var(--azul-claro);
    box-shadow: var(--glow);
}

.user-button {
    background: rgba(255, 255, 255, 0.075);
    border-color: rgba(34, 211, 238, 0.24);
    color: var(--soft);
}

.user-dropdown {
    border-color: rgba(34, 211, 238, 0.22);
    background: rgba(2, 6, 23, 0.98);
    box-shadow: var(--shadow);
    min-width: 210px;
}

.user-dropdown button + button {
    margin-top: 4px;
}

.user-dropdown button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.container.app-shell.spa-shell {
    padding-top: 92px;
}

.mode-panel {
    display: none;
}

body.is-logged-in .mode-panel {
    display: block;
}

.mode-panel,
.category-panel,
.empty-state,
.catalog-card,
.modal-content {
    background: linear-gradient(180deg, var(--panel-strong), var(--panel));
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px);
}

.category-panel {
    border-color: rgba(34, 211, 238, 0.18);
}

.page-kicker {
    color: var(--azul-claro);
}

.category-panel h2,
.catalog-heading h2,
.page-toolbar h1 {
    color: var(--text);
}

.category-panel p,
.card-category,
.login-modal-header p:last-child {
    color: var(--muted);
}

.category-item {
    color: var(--soft);
}

.category-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.category-item.active {
    color: var(--ink);
    background: var(--accent-gradient);
    box-shadow: var(--glow);
}

.catalog-grid {
    scrollbar-color: var(--azul-medio) rgba(255, 255, 255, 0.08);
    grid-auto-rows: 112px;
    align-content: start;
    align-items: start;
}

.catalog-grid.is-virtualized {
    grid-auto-rows: unset;
}

.catalog-card {
    background: rgba(7, 17, 31, 0.78);
    border-color: rgba(34, 211, 238, 0.12);
}

.catalog-card:hover {
    border-color: rgba(34, 211, 238, 0.58);
    box-shadow: var(--glow);
}

.catalog-card:focus-visible,
.category-item:focus-visible,
.mode-tab:focus-visible,
.login-button:focus-visible,
.user-button:focus-visible,
.back-series-button:focus-visible {
    outline: 2px solid var(--azul-claro);
    outline-offset: 3px;
}

.card-image {
    background: rgba(2, 6, 23, 0.68);
    border: 1px solid rgba(34, 211, 238, 0.14);
}

.card-title {
    background: rgba(2, 6, 23, 0.58);
}

.live-badge {
    color: var(--ink);
    background: var(--accent-gradient);
}

.catalog-grid.poster-grid {
    grid-template-columns: repeat(auto-fill, 160px);
    grid-auto-rows: 278px;
    justify-content: start;
    align-content: start;
    gap: 5px;
}

.catalog-grid.poster-grid.episode-grid {
    grid-template-columns: repeat(auto-fill, 160px);
    grid-auto-rows: 160px;
}

.catalog-grid.poster-grid.is-virtualized {
    display: block;
}

.catalog-grid.poster-grid.is-virtualized .virtual-layer {
    right: 0;
}

.catalog-card.is-movie,
.catalog-card.is-series {
    position: relative;
    height: 278px;
    min-height: 278px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 2px solid #2563eb;
    border-radius: 15px;
    background: #1c1c1c;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
    contain-intrinsic-size: 278px 160px;
}

.catalog-grid.episode-grid .catalog-card.is-series {
    height: 160px;
    min-height: 160px;
    padding: 8px;
    gap: 6px;
    border-radius: 12px;
    contain-intrinsic-size: 160px 160px;
}

.catalog-card.is-movie.virtual-item,
.catalog-card.is-series.virtual-item {
    position: absolute;
}

.catalog-card.is-movie:hover,
.catalog-card.is-series:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.28), 0 18px 34px rgba(0, 0, 0, 0.36);
}

.catalog-card.is-movie .card-image,
.catalog-card.is-series .card-image {
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: #2a2a2a;
    overflow: hidden;
}

.catalog-card.is-movie .card-image img,
.catalog-card.is-series .card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.catalog-grid.episode-grid .catalog-card.is-series .card-image img {
    object-fit: contain;
}

.catalog-card.is-movie .card-image-placeholder,
.catalog-card.is-series .card-image-placeholder {
    min-height: 100%;
    color: #f8fafc;
    background: linear-gradient(145deg, #374151, #111827);
    font-size: 1.1rem;
}

.catalog-card.is-movie .card-info,
.catalog-card.is-series .card-info {
    padding: 0;
}

.catalog-card.is-movie .card-title,
.catalog-card.is-series .card-title {
    min-height: 38px;
    margin: 0;
    padding: 8px 9px;
    display: flex;
    align-items: center;
    border-radius: 6px;
    background: #111;
    color: #fff;
    font-size: 0.94rem;
    font-weight: 800;
    line-height: 1.15;
    -webkit-line-clamp: unset;
}

.catalog-grid.episode-grid .catalog-card.is-series .card-title {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 0.82rem;
}

.catalog-card.is-movie .card-category,
.catalog-card.is-series .card-category,
.catalog-card.is-movie .live-badge,
.catalog-card.is-series .live-badge {
    display: none;
}

.favorite-button {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #2563eb;
    border-radius: 9px;
    background: rgba(17, 17, 17, 0.322);
    color: #2563eb;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(2px);
}

.favorite-button_live {
    position: absolute;
    bottom: 8px;
    right: 16px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #2563eb;
    border-radius: 9px;
    background: rgba(17, 17, 17, 0.322);
    color: #2563eb;
    font-size: 1.05rem;
    line-height: 1;
    cursor: pointer;
    backdrop-filter: blur(8px);
}




.watch-progress {
    position: absolute;
    right: 8px;
    bottom: 5px;
    left: 8px;
    z-index: 3;
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.16);
    pointer-events: none;
}

.watch-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--accent-gradient);
}

.catalog-grid.poster-grid.continue-grid {
    grid-template-columns: repeat(auto-fit, 220px);
    grid-auto-rows: 205px;
    align-content: start;
    justify-content: center;
    gap: 12px;
}

.continue-grid-card {
    position: relative;
    width: 220px;
    height: 205px;
    min-height: 205px;
    display: flex;
    overflow: hidden;
    flex-direction: column;
    border: 1px solid rgba(34, 211, 238, 0.20);
    border-radius: 8px;
    background: rgba(7, 17, 31, 0.92);
    color: var(--text);
    cursor: pointer;
}

.continue-grid-card:hover {
    border-color: rgba(34, 211, 238, 0.62);
}

.continue-grid-card:focus-visible {
    outline: 2px solid var(--azul-claro);
    outline-offset: 2px;
}

.continue-grid-media {
    width: 100%;
    aspect-ratio: 16 / 9;
    flex: 0 0 auto;
    overflow: hidden;
    background: rgba(2, 6, 23, 0.9);
}

.continue-grid-media img,
.continue-grid-media .card-image-placeholder {
    width: 100%;
    height: 100%;
    min-height: 0;
    display: flex;
    object-fit: contain;
}

.continue-grid-info {
    display: flex;
    min-width: 0;
    padding: 8px 9px 12px;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 3px;
}

.continue-grid-info strong,
.continue-grid-info small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.continue-grid-info strong {
    font-size: 0.86rem;
}

.continue-grid-info small {
    color: var(--muted);
    font-size: 0.72rem;
}

.continue-grid-remaining {
    opacity: 0.78;
}

.catalog-grid.continue-grid .empty-state {
    width: 100%;
    grid-column: 1 / -1;
}

.catalog-grid.episode-grid .catalog-card.is-series .favorite-button {
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.empty-state {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    text-align: center;
}

.status-message.loading,
.status-message.success {
    background: rgba(14, 165, 233, 0.14);
    border-color: rgba(34, 211, 238, 0.26);
    color: var(--soft);
}

.login-modal-content {
    width: min(370px, calc(100vw - 32px));
    max-height: none;
    margin: 0 auto;
    align-self: center;
    padding: 22px;
    border-radius: 14px;
    display: block;
    overflow: visible;
    background:
        linear-gradient(180deg, rgba(7, 17, 31, 0.98), rgba(2, 6, 23, 0.98));
    border-color: rgba(34, 211, 238, 0.22);
    box-shadow: var(--shadow), var(--glow);
}

.login-modal {
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-modal-header {
    margin-bottom: 16px;
}

.login-modal-header h2 {
    margin-bottom: 6px;
    font-size: 1.45rem;
}

.login-modal-header p:last-child {
    font-size: 0.88rem;
    line-height: 1.4;
}

.login-form {
    gap: 7px;
}

.remember-login-option {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 5px 0 2px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.3;
}

.remember-login-option input {
    width: 16px;
    height: 16px;
    accent-color: var(--azul-claro);
}

.login-form label {
    color: var(--soft);
}

.login-form .input-field {
    min-width: 0;
    height: 38px;
    padding: 0 11px;
}

.login-form .btn {
    min-height: 40px;
    padding-block: 0;
}

.modal-close {
    color: var(--soft);
}

.modal-close:hover {
    color: var(--azul-claro);
}

.catalog-heading {
    gap: 12px;
}

.back-series-button {
    min-height: 34px;
    padding: 0 12px;
    border: 1px solid rgba(34, 211, 238, 0.28);
    border-radius: 8px;
    background: rgba(34, 211, 238, 0.10);
    color: var(--soft);
    font: inherit;
    font-size: 0.82rem;
    font-weight: 800;
    cursor: pointer;
}

.back-series-button:hover {
    background: rgba(34, 211, 238, 0.18);
}

@media (max-width: 900px) and (orientation: landscape) {
    body[data-app="spa"] #playerModal {
        padding: 4px;
        overflow: hidden;
    }

    body[data-app="spa"] #playerModal .modal-content {
        width: calc(100vw - 8px) !important;
        max-width: none !important;
        height: calc(100dvh - 8px) !important;
        max-height: calc(100dvh - 8px) !important;
        margin: auto !important;
        border-radius: 8px !important;
        overflow: hidden !important;
    }

    body[data-app="spa"] #playerModal .modal-header {
        flex: 0 0 auto;
        min-height: 42px;
        padding: 8px 44px 7px 12px !important;
    }

    body[data-app="spa"] #playerModal .modal-info h2 {
        overflow: hidden;
        font-size: 0.95rem !important;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    body[data-app="spa"] #playerModal .player-container {
        flex: 1 1 auto;
        min-height: 0 !important;
        padding: 4px !important;
    }

    body[data-app="spa"] #playerModal .video-player {
        width: 100%;
        height: 100%;
        max-height: none !important;
        object-fit: contain;
    }
}

@media (max-width: 900px) {
    .mode-panel {
        display: none !important;
    }

    .stream-actions {
        width: 100%;
    }

    .container.app-shell.spa-shell {
        padding-top: 132px;
    }
}

@media (max-width: 560px) {
    .stream-header {
        gap: 10px;
    }

    .stream-actions {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .container.app-shell.spa-shell {
        padding-top: 174px;
    }

    .catalog-grid.poster-grid {
        grid-template-columns: repeat(auto-fill, 160px);
        grid-auto-rows: 278px;
        justify-content: center;
        gap: 5px;
    }

    .catalog-card.is-movie,
    .catalog-card.is-series {
        height: 278px;
        min-height: 278px;
    }

    .catalog-grid.poster-grid.episode-grid {
        grid-template-columns: repeat(auto-fill, 160px);
        grid-auto-rows: 160px;
    }

    .catalog-grid.episode-grid .catalog-card.is-series {
        height: 160px;
        min-height: 160px;
        padding: 7px;
    }
}

@media (max-width: 900px), (pointer: coarse) {
    * {
        animation-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }

    .stream-header,
    .mode-panel,
    .category-panel,
    .empty-state,
    .catalog-card,
    .modal-content,
    .webplayer-footer,
    .user-dropdown,
    .login-modal-content {
        backdrop-filter: none !important;
        box-shadow: none !important;
    }

    .catalog-card,
    .mode-tab,
    .category-item,
    .login-button,
    .user-button,
    .favorite-button,
    .favorite-button_live,
    .back-series-button {
        transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease !important;
    }

    .catalog-card:hover,
    .catalog-card.is-movie:hover,
    .catalog-card.is-series:hover {
        transform: none !important;
        box-shadow: none !important;
    }

    .catalog-card.virtual-item {
        will-change: auto !important;
    }

    .catalog-card {
        content-visibility: auto;
    }
}

@media (max-width: 900px) {
    :root {
        --mobile-stream-header: 120px;
        --mobile-shell-gap: 10px;
    }

    body[data-app="spa"] {
        height: 100dvh;
        overflow: hidden !important;
    }

    body[data-app="spa"] .stream-header {
        position: fixed;
        inset: 0 0 auto 0;
        z-index: 80;
        min-height: var(--mobile-stream-header);
        max-height: var(--mobile-stream-header);
        overflow: hidden;
    }

    body[data-app="spa"] .container.app-shell.spa-shell {
        position: fixed;
        inset: calc(var(--mobile-stream-header) + var(--mobile-shell-gap)) 0 0 0;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 0 10px 10px;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto minmax(0, 1fr);
        grid-template-areas:
            "categories"
            "catalog";
        gap: 8px;
        overflow: hidden;
    }

    body[data-app="spa"] .filters-section,
    body[data-app="spa"] .mode-panel {
        display: none !important;
    }

    body[data-app="spa"] .category-panel {
        grid-area: categories;
        max-height: 72px;
        min-height: 0;
        padding: 8px;
        overflow: hidden;
    }

    body[data-app="spa"] .category-panel-header {
        display: none;
    }

    body[data-app="spa"] .category-list {
        min-height: 0;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0 2px 4px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
    }

    body[data-app="spa"] .category-item {
        flex: 0 0 auto;
        width: auto;
        min-width: max-content;
        min-height: 42px;
        padding: 0 12px;
        white-space: nowrap;
    }

    body[data-app="spa"] .catalog-section {
        grid-area: catalog;
        display: flex;
        min-height: 0;
        overflow: hidden;
        flex-direction: column;
    }

    body[data-app="spa"] .catalog-heading {
        flex: 0 0 auto;
        min-height: 28px;
        margin: 0 0 8px;
    }

    body[data-app="spa"] .catalog-grid {
        flex: 1 1 auto;
        height: auto !important;
        min-height: 0 !important;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }

    body[data-app="spa"] .catalog-grid.poster-grid {
        grid-template-columns: repeat(auto-fill, 160px);
        grid-auto-rows: 278px;
        gap: 5px;
    }

    body[data-app="spa"] .catalog-card.is-movie,
    body[data-app="spa"] .catalog-card.is-series {
        height: 278px !important;
        min-height: 278px !important;
    }

    body[data-app="spa"] .catalog-grid.poster-grid.episode-grid {
        grid-template-columns: repeat(auto-fill, 160px) !important;
        grid-auto-rows: 160px !important;
    }

    body[data-app="spa"] .catalog-grid.episode-grid .catalog-card.is-series {
        height: 160px !important;
        min-height: 160px !important;
        padding: 7px !important;
    }
}

@media (max-width: 560px) {
    :root {
        --mobile-stream-header: 154px;
    }
}

/* Desktop SPA viewport layout */
.webplayer-footer {
    display: none;
}

@media (min-width: 901px) {
    :root {
        --webplayer-header: 72px;
        --webplayer-footer: 30px;
        --webplayer-edge: 6px;
    }

    body[data-app="spa"] {
        height: 100vh;
        overflow: hidden;
    }

    body[data-app="spa"] .stream-header {
        height: var(--webplayer-header);
        min-height: var(--webplayer-header);
    }

    body[data-app="spa"] .container.app-shell.spa-shell {
        position: fixed;
        inset: calc(var(--webplayer-header) + var(--webplayer-edge)) 0 calc(var(--webplayer-footer) + var(--webplayer-edge)) 0;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: 0 6px;
        display: grid;
        grid-template-columns: 230px minmax(0, 1fr);
        grid-template-rows: minmax(0, 1fr);
        grid-template-areas: "categories catalog";
        gap: 18px;
        overflow: hidden;
    }

    body[data-app="spa"] .mode-panel,
    body[data-app="spa"] .filters-section {
        display: none !important;
    }

    body[data-app="spa"] .status-message {
        position: fixed;
        top: calc(var(--webplayer-header) + 10px);
        left: 50%;
        z-index: 90;
        max-width: min(620px, calc(100vw - 48px));
        transform: translateX(-50%);
    }

    body[data-app="spa"] .category-panel,
    body[data-app="spa"] .catalog-section {
        height: 100%;
        max-height: 100%;
        min-height: 0;
    }

    body[data-app="spa"] .category-panel {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    body[data-app="spa"] .category-panel-header {
        flex: 0 0 auto;
    }

    body[data-app="spa"] .category-list {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        padding-right: 4px;
        scrollbar-color: var(--azul-medio) rgba(255, 255, 255, 0.08);
    }

    body[data-app="spa"] .catalog-section {
        display: flex;
        width: calc(100% + 24px);
        margin-right: -24px;
        flex-direction: column;
        overflow: hidden;
    }

    body[data-app="spa"] .catalog-heading {
        flex: 0 0 auto;
        min-height: 28px;
        margin: 0 0 6px;
        padding-right: 24px;
    }

    body[data-app="spa"] .catalog-grid {
        flex: 1 1 auto;
        height: auto;
        min-height: 0;
        padding-right: 0;
        overflow-y: auto;
    }

    body[data-app="spa"] .webplayer-footer {
        position: fixed;
        inset: auto 0 0 0;
        z-index: 70;
        height: var(--webplayer-footer);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 18px;
        border-top: 1px solid rgba(34, 211, 238, 0.14);
        background: rgba(2, 6, 23, 0.88);
        color: var(--muted);
        font-size: 0.78rem;
        line-height: 1;
        backdrop-filter: blur(14px);
    }

    body[data-app="spa"] .webplayer-footer p {
        max-width: calc(100vw - 36px);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 900px) {
    :root {
        --mobile-stream-header: 90px;
    }

    body[data-app="spa"] {
        width: 100vw;
        height: 100dvh;
        overflow: hidden !important;
    }

    body[data-app="spa"] .stream-header {
        position: fixed !important;
        inset: 0 0 auto 0 !important;
        z-index: 100;
        width: 100%;
        height: var(--mobile-stream-header) !important;
        min-height: var(--mobile-stream-header) !important;
        max-height: var(--mobile-stream-header) !important;
        padding: 4px 8px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        justify-content: flex-start !important;
        gap: 3px !important;
        overflow: visible !important;
    }

    body[data-app="spa"] .stream-header-main {
        width: 100%;
        min-height: 36px;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 10px !important;
    }

    body[data-app="spa"] .stream-brand {
        flex: 0 0 auto;
        font-size: 1.55rem;
    }

    body[data-app="spa"] .mode-tabs {
        flex: 1 1 auto;
        min-width: 0;
        display: flex !important;
        justify-content: flex-end;
        gap: 6px;
    }

    body[data-app="spa"] .mode-tab {
        min-height: 34px;
        padding: 0 10px;
        font-size: 0.82rem;
    }

    body[data-app="spa"] .stream-actions {
        width: 100%;
        min-height: 42px;
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center !important;
        gap: 8px !important;
    }

    body[data-app="spa"] .container.app-shell.spa-shell {
        position: fixed !important;
        inset: var(--mobile-stream-header) 0 0 0 !important;
        width: 100vw !important;
        height: auto !important;
        min-height: 0 !important;
        padding: 0 8px 8px !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        overflow: hidden !important;
    }

    body[data-app="spa"] .stream-actions,
    body[data-app="spa"] .auth-area,
    body[data-app="spa"] .user-menu {
        position: relative;
        z-index: 140;
        overflow: visible !important;
    }

    body[data-app="spa"] .user-dropdown {
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        z-index: 9999 !important;
        max-width: calc(100vw - 24px);
    }

    body[data-app="spa"] .mode-panel,
    body[data-app="spa"] .filters-section,
    body[data-app="spa"] .category-panel-header {
        display: none !important;
    }

    body[data-app="spa"] .category-panel {
        width: 100% !important;
        max-width: none !important;
        flex: 0 0 62px !important;
        height: 62px !important;
        min-height: 62px !important;
        max-height: 62px !important;
        padding: 8px 6px !important;
        overflow: visible !important;
        border-radius: 12px !important;
    }

    body[data-app="spa"] .category-list {
        width: 100% !important;
        height: 46px !important;
        min-height: 0 !important;
        display: flex !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        padding: 0 4px 8px !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
        touch-action: pan-x;
    }

    body[data-app="spa"] .category-list::-webkit-scrollbar {
        display: none;
    }

    body[data-app="spa"] .category-item {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: max-content !important;
        min-height: 42px !important;
        height: 42px !important;
        padding: 0 14px !important;
        white-space: nowrap !important;
        scroll-snap-align: start;
        border-radius: 10px !important;
    }

    body[data-app="spa"] .catalog-section {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        flex: 1 1 auto !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
    }

    body[data-app="spa"] .catalog-heading {
        flex: 0 0 auto !important;
        width: 100% !important;
        min-height: 30px !important;
        margin: 0 0 8px !important;
    }

    body[data-app="spa"] .catalog-heading h2 {
        white-space: nowrap !important;
    }

    body[data-app="spa"] .catalog-grid {
        width: 100% !important;
        min-width: 0 !important;
        min-height: 0 !important;
        height: auto !important;
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 560px) {
    :root {
        --mobile-stream-header: 90px;
    }
}

@media (max-width: 900px) {
    body[data-app="spa"] .modal {
        align-items: center;
        justify-content: center;
        padding: 10px;
        overflow-y: auto;
    }

    body[data-app="spa"] .modal-content {
        width: min(100%, 520px) !important;
        min-height: 0 !important;
        max-height: calc(100dvh - 20px) !important;
        height: auto !important;
        margin: auto !important;
        border-radius: 12px !important;
        overflow-y: auto !important;
    }

    body[data-app="spa"] .modal-header {
        padding: 14px 44px 12px 14px !important;
        gap: 12px !important;
    }

    body[data-app="spa"] #playerModal .modal-header {
        padding-right: 58px !important;
    }

    body[data-app="spa"] #playerModal .modal-close {
        right: 10px;
    }

    body[data-app="spa"] .modal-logo {
        width: 64px !important;
        height: 64px !important;
    }

    body[data-app="spa"] .modal-info h2 {
        font-size: 1.05rem !important;
        line-height: 1.2 !important;
    }

    body[data-app="spa"] .player-container {
        min-height: 0 !important;
        padding: 10px !important;
    }

    body[data-app="spa"] .video-player {
        max-height: 42dvh !important;
    }

    body[data-app="spa"] .next-episode-overlay {
        padding: 10px;
    }

    body[data-app="spa"] .next-episode-card {
        padding: 14px;
        box-shadow: none;
    }

    body[data-app="spa"] .next-episode-actions button {
        flex: 1 1 130px;
        min-height: 46px;
    }

}

@media (max-width: 900px) {
    body[data-app="spa"] .catalog-section {
        width: calc(100% + 8px) !important;
        margin-right: -8px !important;
    }

    body[data-app="spa"] .catalog-heading {
        padding-right: 8px !important;
    }

    body[data-app="spa"] .catalog-grid {
        padding-right: 0 !important;
    }

    body[data-app="spa"] .catalog-grid.poster-grid.continue-grid {
        grid-template-columns: repeat(auto-fit, 156px) !important;
        grid-auto-rows: 160px !important;
        justify-content: center !important;
        gap: 10px !important;
    }

    body[data-app="spa"] .continue-grid-card {
        width: 160px;
        height: 160px;
        min-height: 160px;
        box-shadow: none;
    }

    body[data-app="spa"] .continue-grid-info {
        padding: 6px 8px 10px;
    }

    body[data-app="spa"] .category-panel .category-list {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: flex-start !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
    }

    body[data-app="spa"] .category-panel .category-list .category-item {
        flex: 0 0 auto !important;
        width: auto !important;
        max-width: none !important;
        min-width: max-content !important;
    }
}

@media (max-width: 560px) {
    body[data-app="spa"] .catalog-grid.poster-grid:not(.continue-grid) {
        padding-right: 8px !important;
    }
}

@media (max-width: 900px) and (orientation: landscape) {
    body[data-app="spa"] .container.app-shell.spa-shell {
        display: grid !important;
        grid-template-columns: clamp(150px, 24vw, 210px) minmax(0, 1fr) !important;
        grid-template-rows: minmax(0, 1fr) !important;
        grid-template-areas: "categories catalog" !important;
        align-items: stretch !important;
        gap: 8px !important;
    }

    body[data-app="spa"] .category-panel {
        grid-area: categories !important;
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: none !important;
        padding: 8px 6px !important;
        overflow: hidden !important;
    }

    body[data-app="spa"] .category-panel .category-list {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        padding: 0 4px 4px !important;
        display: flex !important;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        gap: 6px !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        scroll-snap-type: none !important;
        touch-action: pan-y !important;
        scrollbar-width: thin;
    }

    body[data-app="spa"] .category-panel .category-list .category-item {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        min-height: 40px !important;
        height: auto !important;
        flex: 0 0 auto !important;
        padding: 9px 10px !important;
        overflow: hidden;
        text-align: left;
        text-overflow: ellipsis;
        white-space: nowrap !important;
        scroll-snap-align: none;
    }

    body[data-app="spa"] .catalog-section {
        grid-area: catalog !important;
        min-width: 0 !important;
        min-height: 0 !important;
    }

    body[data-app="spa"] .status-message {
        position: fixed !important;
        inset: auto 16px 12px calc(clamp(150px, 24vw, 210px) + 24px) !important;
        z-index: 120;
        width: fit-content;
        max-width: calc(100vw - clamp(150px, 24vw, 210px) - 40px);
        min-height: 40px;
        margin: 0 auto !important;
        padding: 9px 12px;
        pointer-events: none;
        line-height: 1.25;
    }
}
