* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #0c0e14;
    --surface: #161a24;
    --surface-2: #1f2431;
    --text: #eef1f8;
    --muted: #8b93a7;
    --accent: #8ab4f8;
}

html,
body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100%;
}

body {
    padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
    background: rgba(12, 14, 20, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.brand-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent);
}

.search {
    flex: 1;
    min-width: 0;
    appearance: none;
    border: none;
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    padding: 9px 12px;
    font-size: 0.95rem;
    outline: none;
}

.categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 14px;
    scrollbar-width: none;
}

.categories::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    border: none;
    border-radius: 999px;
    padding: 7px 14px;
    background: var(--surface);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.chip.active {
    background: var(--accent);
    color: #0b1220;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
    gap: 10px;
    padding: 10px 14px 24px;
}

.loading,
.empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted);
    padding: 40px 0;
}

.channel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: none;
    border-radius: 14px;
    padding: 12px 8px 10px;
    color: var(--text);
}

.channel:active {
    background: var(--surface-2);
}

.channel img,
.channel .logo-fallback {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.channel .logo-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--muted);
}

.channel span {
    font-size: 0.72rem;
    line-height: 1.25;
    text-align: center;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Player ---- */
.player {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: #000;
    display: flex;
    flex-direction: column;
}

.player-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent);
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
}

.player-title {
    flex: 1;
    min-width: 0;
    font-size: 0.95rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-actions {
    display: flex;
    gap: 6px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 1rem;
}

#video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* ---- Bloqueio (outra tela ativa) ---- */
.blocked {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px;
    text-align: center;
    background: radial-gradient(
        ellipse at center,
        rgba(35, 42, 58, 0.92),
        rgba(12, 14, 20, 0.98)
    );
    color: var(--accent);
}

.blocked-title {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
}

.blocked-subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.blocked-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pill-btn {
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 999px;
    background: transparent;
    color: var(--text);
    padding: 11px 26px;
    font-size: 0.95rem;
    font-weight: 600;
}

.pill-btn.primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #0b1220;
}

/* ---- Sheet de cast ---- */
.sheet {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-end;
    background: rgba(0, 0, 0, 0.55);
}

.sheet-card {
    width: 100%;
    background: var(--surface);
    border-radius: 18px 18px 0 0;
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sheet-title {
    font-weight: 700;
    font-size: 1rem;
}

.sheet-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 40vh;
    overflow-y: auto;
}

.sheet-status {
    color: var(--muted);
    font-size: 0.9rem;
    padding: 8px 2px;
}

.device-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    border-radius: 12px;
    background: var(--surface-2);
    color: var(--text);
    padding: 13px 14px;
    font-size: 0.95rem;
    font-weight: 600;
    text-align: left;
}

.hidden {
    display: none !important;
}
