:root {
    --bg: #0e1116;
    --bg-elev: #161b22;
    --fg: #e6edf3;
    --fg-dim: #8b949e;
    --accent: #4493f8;
    --accent-fg: #ffffff;
    --error: #f85149;
    --warn: #d29922;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    min-height: 100vh;
}

/* ── header ────────────────────────────────────────────────────────── */
header {
    padding: 16px 24px;
    border-bottom: 1px solid #21262d;
    display: flex;
    align-items: center;
}
header h1 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* ── main layout ───────────────────────────────────────────────────── */
main {
    padding: 20px 24px;
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ── status chip ───────────────────────────────────────────────────── */
.status {
    padding: 8px 12px;
    border-radius: var(--radius);
    background: var(--bg-elev);
    color: var(--fg-dim);
    font-size: 13px;
    margin-bottom: 10px;
}
.status[data-kind="error"] { color: var(--error); }
.status[data-kind="warn"]  { color: var(--warn); }

/* ── channel strip ─────────────────────────────────────────────────── */
.channel-strip { width: 100%; }

.channels {
    list-style: none;
    padding: 4px 2px 8px;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.channel-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-elev);
    border: 1px solid #21262d;
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 120ms, transform 120ms, background 120ms;
    white-space: nowrap;
}
.channel-btn:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.channel-btn.active {
    border-color: var(--accent);
    background: #1a2332;
    color: var(--accent);
}
.channel-btn .play-icon {
    width: 26px;
    height: 26px;
    flex: 0 0 26px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--accent-fg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    transition: background 120ms;
}
.channel-btn.active .play-icon {
    background: #1c6ed4;
}

/* ── player section ────────────────────────────────────────────────── */
.player-section { width: 100%; }

.player-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
    min-height: 24px;
}
.now-playing {
    font-size: 15px;
    font-weight: 600;
    color: var(--fg);
}
.player-status {
    font-size: 12px;
    color: var(--fg-dim);
}
.player-status[data-kind="error"] { color: var(--error); }

.video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid #21262d;
}

/* ── Video.js / city-theme overrides ───────────────────────────────── */

/* Fill the aspect-ratio container */
.video-wrap .video-js {
    width: 100%;
    height: 100%;
    font-family: inherit;
}
.video-wrap .video-js .vjs-tech {
    width: 100%;
    height: 100%;
}

/* Control bar — gradient fade from transparent so video shows through */
.video-wrap .vjs-control-bar {
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
    height: 3.4em;
    padding: 0 6px;
}

/* Progress bar & volume level — site accent colour */
.video-wrap .vjs-play-progress,
.video-wrap .vjs-play-progress::before,
.video-wrap .vjs-volume-level,
.video-wrap .vjs-volume-level::before {
    background: var(--accent);
}
.video-wrap .vjs-load-progress,
.video-wrap .vjs-load-progress div {
    background: rgba(68, 147, 248, 0.25);
}
.video-wrap .vjs-slider {
    background: rgba(255, 255, 255, 0.15);
}

/* LIVE badge */
.video-wrap .vjs-live-control {
    display: flex;
    align-items: center;
}
.video-wrap .vjs-live-display {
    font-size: 0.85em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
/* Pulse the red dot when actually at the live edge */
.video-wrap .vjs-liveui .vjs-seek-to-live-control.vjs-at-live-edge .vjs-icon-placeholder::before {
    color: #ff4444;
    animation: live-pulse 1.6s ease-in-out infinite;
}
@keyframes live-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

/* Big play button — circular, centred, blurred glass */
.video-wrap .vjs-big-play-button {
    width: 68px;
    height: 68px;
    line-height: 68px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.75);
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(6px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    transition: background 150ms, border-color 150ms, transform 150ms;
}
.video-wrap .vjs-big-play-button:hover,
.video-wrap .vjs-big-play-button:focus {
    background: rgba(68, 147, 248, 0.55);
    border-color: var(--accent);
    transform: translate(-50%, -50%) scale(1.08);
}
.video-wrap .vjs-big-play-button .vjs-icon-placeholder::before {
    font-size: 2em;
    line-height: 68px;
}

/* Tooltip / time display */
.video-wrap .vjs-time-tooltip,
.video-wrap .vjs-mouse-display .vjs-time-tooltip {
    background: var(--bg-elev);
    color: var(--fg);
    border-radius: 4px;
    font-size: 11px;
}

/* Focus rings — keep keyboard nav visible but subtle */
.video-wrap .vjs-button:focus .vjs-icon-placeholder::before,
.video-wrap .vjs-control:focus .vjs-icon-placeholder::before {
    text-shadow: 0 0 0 2px var(--accent);
}
.overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: var(--fg-dim);
    font-size: 15px;
    letter-spacing: 0.02em;
    pointer-events: none;
    z-index: 4;
}
.overlay.hidden { display: none; }

/* ── unmute prompt ─────────────────────────────────────────────────── */
.unmute-prompt {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    cursor: pointer;
    animation: fade-up 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.unmute-prompt[hidden] { display: none; }

@keyframes fade-up {
    from { opacity: 0; transform: translateY(8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.unmute-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-radius: 50px;
    color: #fff;
    font-size: 15px;
    font-weight: 500;
    font-family: inherit;
    padding: 14px 28px;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: background 150ms, border-color 150ms, transform 150ms, box-shadow 150ms;
    animation: unmute-pulse 2.4s ease-in-out 0.8s infinite;
}
.unmute-btn:hover,
.unmute-prompt:focus-within .unmute-btn {
    background: rgba(68, 147, 248, 0.4);
    border-color: var(--accent);
    transform: scale(1.06);
    box-shadow: 0 0 0 4px rgba(68, 147, 248, 0.2);
    animation: none;
}
.unmute-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    opacity: 0.9;
}
@keyframes unmute-pulse {
    0%, 100% { box-shadow: 0 0 0 0   rgba(68, 147, 248, 0); }
    50%       { box-shadow: 0 0 0 10px rgba(68, 147, 248, 0.18); }
}

/* ── spinner ───────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }


/* ════════════════════════════════════════════════════════════════════
   YouTube-alike player page
   ════════════════════════════════════════════════════════════════════ */

:root {
    --yt-bg:        #0f0f0f;
    --yt-bg2:       #1a1a1a;
    --yt-border:    #3f3f3f;
    --yt-fg:        #f1f1f1;
    --yt-fg-dim:    #aaaaaa;
    --yt-red:       #ff0000;
    --yt-red-dark:  #cc0000;
}

body.player-page {
    background: var(--yt-bg);
    color: var(--yt-fg);
}

/* ── YouTube-style header ──────────────────────────────────────────── */
.yt-header {
    position: sticky;
    top: 0;
    z-index: 100;
    height: 56px;
    background: var(--yt-bg);
    border-bottom: 1px solid var(--yt-border);
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.yt-logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 6px;
}

.yt-logo-icon {
    width: 100px;
    height: 22px;
    overflow: visible;
}

.yt-logo:hover text {
    opacity: 0.8;
}

/* ── Page layout ───────────────────────────────────────────────────── */
.yt-layout {
    max-width: 1280px;
    margin: 0 auto;
    padding: 24px 24px 48px;
}

.yt-primary {
    width: 100%;
}

/* ── Video container ───────────────────────────────────────────────── */
body.player-page .video-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 0;           /* YouTube has no rounded corners on the player */
    overflow: hidden;
    border: none;
}

/* ── Below-video metadata ──────────────────────────────────────────── */
.yt-below-video {
    padding: 12px 0 0;
    border-bottom: 1px solid var(--yt-border);
    padding-bottom: 16px;
}

.yt-title {
    margin: 0 0 10px;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--yt-fg);
}

.yt-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.yt-live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--yt-red);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.07em;
    padding: 3px 8px 3px 6px;
    border-radius: 3px;
    text-transform: uppercase;
    user-select: none;
}

.yt-live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fff;
    animation: yt-live-pulse 1.8s ease-in-out infinite;
}

@keyframes yt-live-pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(0.85); }
}

.yt-status {
    margin: 0;
    font-size: 13px;
    color: var(--yt-fg-dim);
}
.yt-status[data-kind="error"] { color: var(--error); }
.yt-status[data-kind="warn"]  { color: var(--warn); }

/* ── Overlay ───────────────────────────────────────────────────────── */
body.player-page .overlay {
    background: rgba(0, 0, 0, 0.75);
    gap: 10px;
    font-size: 14px;
    color: var(--yt-fg-dim);
}

body.player-page .overlay .overlay-spinner {
    display: inline-block;
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.75s linear infinite;
    flex-shrink: 0;
}

/* ── Video.js overrides — YouTube style ────────────────────────────── */

/* Fill the container */
body.player-page .video-wrap .video-js {
    width: 100%;
    height: 100%;
    font-family: inherit;
}
body.player-page .video-wrap .video-js .vjs-tech {
    width: 100%;
    height: 100%;
}

/* Hide city-theme artifacts */
body.player-page .video-wrap .video-js.vjs-theme-city .vjs-control-bar { background: none; }

/* Control bar — gradient, YouTube proportions */
body.player-page .video-wrap .vjs-control-bar {
    background: linear-gradient(transparent, rgba(0,0,0,0.8));
    height: 3.6em;
    padding: 0 8px;
    transition: opacity 0.2s;
}

/* Progress bar — YouTube red */
body.player-page .video-wrap .vjs-play-progress,
body.player-page .video-wrap .vjs-play-progress::before {
    background: var(--yt-red);
}
body.player-page .video-wrap .vjs-play-progress::before {
    /* The circle scrubber dot */
    top: -4px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    content: '';
}
body.player-page .video-wrap .vjs-progress-holder:hover .vjs-play-progress::before {
    transform: scale(1);
}

/* Loaded / buffered bar */
body.player-page .video-wrap .vjs-load-progress,
body.player-page .video-wrap .vjs-load-progress div {
    background: rgba(255, 255, 255, 0.25);
}

/* Track (the unfilled part) */
body.player-page .video-wrap .vjs-slider {
    background: rgba(255, 255, 255, 0.2);
}

/* Volume level */
body.player-page .video-wrap .vjs-volume-level,
body.player-page .video-wrap .vjs-volume-level::before {
    background: #fff;
}

/* Progress bar height — thicker on hover like YouTube */
body.player-page .video-wrap .vjs-progress-control .vjs-slider {
    height: 3px;
    transition: height 0.1s;
}
body.player-page .video-wrap .vjs-progress-control:hover .vjs-slider {
    height: 5px;
}

/* LIVE badge */
body.player-page .video-wrap .vjs-live-display {
    font-size: 0.82em;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
body.player-page .video-wrap .vjs-seek-to-live-control.vjs-at-live-edge .vjs-icon-placeholder::before {
    color: var(--yt-red);
    animation: live-pulse 1.6s ease-in-out infinite;
}

/* Big play button — YouTube style: no border, dark circle */
body.player-page .video-wrap .vjs-big-play-button {
    width: 68px;
    height: 68px;
    line-height: 68px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0;
    transition: background 150ms, transform 150ms;
}
body.player-page .video-wrap .vjs-big-play-button:hover,
body.player-page .video-wrap .vjs-big-play-button:focus {
    background: rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -50%) scale(1.08);
}
body.player-page .video-wrap .vjs-big-play-button .vjs-icon-placeholder::before {
    font-size: 2.2em;
    line-height: 68px;
    color: #fff;
}

/* Tooltip */
body.player-page .video-wrap .vjs-time-tooltip,
body.player-page .video-wrap .vjs-mouse-display .vjs-time-tooltip {
    background: rgba(28,28,28,0.9);
    color: #fff;
    border-radius: 2px;
    font-size: 12px;
    padding: 3px 6px;
}

/* Focus outline — keep keyboard nav accessible */
body.player-page .video-wrap .vjs-button:focus .vjs-icon-placeholder::before,
body.player-page .video-wrap .vjs-control:focus .vjs-icon-placeholder::before {
    text-shadow: 0 0 0 2px rgba(255,255,255,0.6);
}
