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

body {
    background: #0a0a0f;
    color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 0;
}

.shell {
    width: 100%;
    max-width: 720px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Top bar ── */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Channel dropdown ── */
.channel-dropdown { position: relative; }

.channel-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    max-width: 60vw;
}

.channel-btn:hover { border-color: #3a3a52; }

.channel-btn .fa-caret-down {
    color: #888;
    font-size: 0.9rem;
    transition: transform 0.2s;
}

.channel-btn.open .fa-caret-down { transform: rotate(180deg); }

.channel-btn-label {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    width: 260px;
    max-width: 80vw;
    background: #12121f;
    border: 1px solid #2a2a3e;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    z-index: 50;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: min(70vh, 460px);
}

.channel-panel[hidden] { display: none; }

.channel-search { padding: 10px; border-bottom: 1px solid #20203a; }

.channel-search input {
    width: 100%;
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 0.8rem;
    outline: none;
}

.channel-search input:focus { border-color: #e91e63; }

.channel-list { overflow-y: auto; padding: 6px; }

.channel-section + .channel-section {
    border-top: 1px solid #1d1d33;
    margin-top: 4px;
    padding-top: 4px;
}

.channel-section-title {
    font-size: 0.65rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #6b6b8a;
    padding: 8px 10px 4px;
    font-weight: 700;
}

.ch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #d0d0e0;
}

.ch-row:hover { background: #1c1c33; }
.ch-row.active { background: rgba(233, 30, 99, 0.15); color: #fff; }

.ch-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ch-badge {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: #e91e63;
    background: rgba(233, 30, 99, 0.15);
    padding: 2px 7px;
    border-radius: 10px;
}

/* Status dots. green = live, grey = offline, dim = unknown */
.ch-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3a3a52;
    flex-shrink: 0;
}

.ch-dot.unknown { background: #555; }

.ch-dot.live {
    background: #2ecc71;
    animation: livePulse 1.6s infinite;
}

@keyframes livePulse {
    0%   { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0.5); }
    70%  { box-shadow: 0 0 0 6px rgba(46, 204, 113, 0); }
    100% { box-shadow: 0 0 0 0 rgba(46, 204, 113, 0); }
}

.channel-empty {
    padding: 18px;
    text-align: center;
    color: #666;
    font-size: 0.8rem;
}

.channel-custom {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #20203a;
}

.channel-custom input {
    flex: 1;
    background: #1a1a2e;
    color: #e0e0e0;
    border: 1px solid #2a2a3e;
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 0.8rem;
    outline: none;
}

.channel-custom input:focus { border-color: #e91e63; }

.channel-custom button {
    background: #e91e63;
    color: #fff;
    border: none;
    padding: 7px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    cursor: pointer;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #e91e63, #ff5722);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #fff;
}

.live-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(233, 30, 99, 0.15);
    color: #e91e63;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 5px 14px;
    border-radius: 20px;
    letter-spacing: 1px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #e91e63;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ── Player card ── */
.player-card {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 0 20px;
}

.player-card video,
.player-card iframe {
    width: 100%;
    height: 100%;
    display: block;
}

/* Shaka UI overrides */
.shaka-video-container {
    width: 100% !important;
    height: 100% !important;
}

/* ── Loader ── */
.loader {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #000;
    z-index: 10;
    transition: opacity 0.4s ease;
}

.loader.out {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(233, 30, 99, 0.2);
    border-top-color: #e91e63;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loader span {
    font-size: 0.85rem;
    color: #888;
}

/* ── Error overlay ── */
.error-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    background: rgba(0, 0, 0, 0.85);
    z-index: 20;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.error-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.error-overlay.hidden {
    display: none;
}

/* Only the direct-child status icon is large — not the icon inside the button */
.error-overlay > i {
    font-size: 2.5rem;
    color: #e91e63;
}

.error-overlay p {
    font-size: 0.95rem;
    color: #ccc;
}

.retry-btn {
    background: #e91e63;
    color: #fff;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.retry-btn:hover {
    background: #c2185b;
}

/* ── Utility ── */
.hidden { display: none !important; }

@media (max-width: 480px) {
    .topbar { padding: 10px 14px; }
    .brand { font-size: 0.95rem; }
}
