:root {
  --tv-bg: #070a12;
  --tv-panel: #0e1421;
  --tv-panel-2: #121a2b;
  --tv-line: #1e2a41;
  --tv-text: #e6edf8;
  --tv-muted: #7f8da8;
  --tv-accent: #38bdf8;
  --tv-blue: #4f8cff;
  --tv-red: #ef4444;
  --tv-radius: 16px;
  --tv-font: "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body.tv-body { min-height: 100vh; background: radial-gradient(1100px 500px at 20% -10%, rgba(56,189,248,.10), transparent 60%), radial-gradient(900px 450px at 100% 0%, rgba(79,140,255,.10), transparent 60%), var(--tv-bg); color: var(--tv-text); font-family: var(--tv-font); font-size: 13px; }
a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }
img { display: block; }

/* header */
.tv-header { height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 20px; border-bottom: 1px solid rgba(30,42,65,.7); position: sticky; top: 0; z-index: 30; background: rgba(9,13,23,.86); backdrop-filter: blur(14px); }
.tv-brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.tv-brand img { width: 34px; height: 34px; border-radius: 9px; }
.tv-brand b { display: block; font-size: 15px; letter-spacing: .5px; }
.tv-brand em { display: block; font-style: normal; font-size: 9px; letter-spacing: 2px; color: var(--tv-muted); margin-top: 2px; }
.tv-live-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 700; letter-spacing: 1.5px; color: #fecaca; border: 1px solid rgba(239,68,68,.4); background: rgba(239,68,68,.12); padding: 3px 9px; border-radius: 999px; }
.tv-live-pill i { width: 5px; height: 5px; border-radius: 50%; background: #ef4444; box-shadow: 0 0 8px #ef4444; animation: tvBlink 1.4s infinite; }
@keyframes tvBlink { 50% { opacity: .3; } }
.tv-clock { font-size: 13px; color: #b8c4d8; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.tv-header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.tv-search { display: flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border: 1px solid var(--tv-line); border-radius: 9px; background: rgba(18,26,43,.7); color: var(--tv-muted); }
.tv-search svg { width: 15px; height: 15px; }
.tv-search input { width: 170px; border: 0; outline: 0; background: none; color: var(--tv-text); font-size: 12px; }
.tv-search input::placeholder { color: #5c6a83; }
.tv-icon-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border: 1px solid var(--tv-line); border-radius: 9px; background: rgba(18,26,43,.7); color: #b8c4d8; font-size: 12px; cursor: pointer; }
.tv-icon-btn svg { width: 16px; height: 16px; }
.tv-icon-btn:hover { border-color: #334a6e; color: #fff; }

.tv-announcement { max-width: 1560px; margin: 12px auto 0; padding: 0 20px; color: var(--tv-muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* shell */
.tv-shell { max-width: 1560px; margin: 12px auto 24px; padding: 0 20px; display: grid; grid-template-columns: 196px minmax(0, 1fr) 296px; gap: 14px; align-items: start; }
.tv-categories, .tv-channel-panel, .tv-main { min-width: 0; }
.tv-categories { background: var(--tv-panel); border: 1px solid var(--tv-line); border-radius: var(--tv-radius); padding: 15px 12px 10px; }
.tv-side-title { display: flex; align-items: baseline; justify-content: space-between; padding: 0 6px 10px; border-bottom: 1px solid rgba(30,42,65,.7); }
.tv-side-title span { font-size: 13.5px; font-weight: 650; }
.tv-side-title em { font-style: normal; font-size: 8.5px; letter-spacing: 2px; color: var(--tv-muted); }
.tv-cat-list { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.tv-cat { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 8px; color: #a9b6cb; font-size: 12.5px; cursor: pointer; border: 1px solid transparent; background: none; text-align: left; width: 100%; }
.tv-cat:hover { background: rgba(56,189,248,.07); color: #e2f3ff; }
.tv-cat.active { background: linear-gradient(135deg, rgba(79,140,255,.22), rgba(34,211,238,.12)); border-color: rgba(56,189,248,.32); color: #eaf6ff; font-weight: 600; }
.tv-cat em { font-style: normal; font-size: 10px; color: #667791; }
.tv-side-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding: 10px 6px 0; border-top: 1px solid rgba(30,42,65,.7); color: #667791; font-size: 10.5px; }
.tv-side-footer a { color: #7dd3fc; }

/* main */
.tv-main { display: flex; flex-direction: column; gap: 12px; }
.tv-player-card { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--tv-line); border-radius: var(--tv-radius); overflow: hidden; box-shadow: 0 22px 60px rgba(0,0,0,.45); }
.tv-player-card video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.tv-player-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; background: radial-gradient(500px 260px at 50% 45%, rgba(56,189,248,.10), transparent 70%); z-index: 2; }
.tv-player-overlay[hidden] { display: none; }
.tv-player-overlay h3 { margin: 4px 0 0; font-size: 14px; font-weight: 550; color: #cbd8ea; }
.tv-player-overlay p { margin: 0; font-size: 11px; color: #64748b; }
.tv-loader { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,.14); border-top-color: var(--tv-accent); animation: tvSpin .8s linear infinite; }
@keyframes tvSpin { to { transform: rotate(360deg); } }
.tv-player-top { position: absolute; left: 12px; top: 12px; right: 12px; display: flex; align-items: center; gap: 7px; z-index: 4; }
.tv-player-live { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 4px; background: rgba(239,68,68,.9); color: #fff; font-size: 9px; font-weight: 700; letter-spacing: 1px; }
.tv-player-live i { width: 4px; height: 4px; border-radius: 50%; background: #fff; animation: tvBlink 1.4s infinite; }
.tv-player-quality { padding: 3px 7px; border-radius: 4px; background: rgba(15,23,42,.6); color: #dbeafe; font-size: 9px; }
.tv-fav-btn { margin-left: auto; width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,.18); background: rgba(15,23,42,.45); color: #fde047; font-size: 16px; cursor: pointer; backdrop-filter: blur(6px); }
.tv-fav-btn.on { background: rgba(250,204,21,.16); border-color: rgba(250,204,21,.5); }
.tv-controls { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 26px 14px 10px; background: linear-gradient(0deg, rgba(0,0,0,.78), transparent); z-index: 4; opacity: 0; transition: opacity .2s; }
.tv-player-card:hover .tv-controls, .tv-player-card:focus-within .tv-controls { opacity: 1; }
.tv-controls button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; color: #e2e8f0; cursor: pointer; }
.tv-controls button svg { width: 18px; height: 18px; }
.tv-controls input[type=range] { width: 90px; accent-color: var(--tv-accent); }
.tv-controls .spacer { flex: 1; }
.tv-time { font-size: 10.5px; color: rgba(255,255,255,.7); }

/* line bar */
.tv-line-bar { display: flex; gap: 8px; align-items: center; }
.tv-line { padding: 5px 12px; border-radius: 7px; border: 1px solid var(--tv-line); background: rgba(18,26,43,.6); color: #8fa1bd; font-size: 11px; cursor: pointer; }
.tv-line.active { color: #bae6fd; border-color: rgba(56,189,248,.4); background: rgba(56,189,248,.1); }

/* EPG timeline */
.tv-epg-timeline { background: var(--tv-panel); border: 1px solid var(--tv-line); border-radius: var(--tv-radius); overflow: hidden; }
.tv-epg-timeline.collapsed .tv-epg-scroll { display: none; }
.tv-epg-timeline-head { display: flex; align-items: center; gap: 16px; padding: 11px 15px; border-bottom: 1px solid rgba(30,42,65,.7); }
.tv-epg-date b { display: block; font-size: 13px; font-weight: 600; }
.tv-epg-date em { display: block; font-style: normal; font-size: 10.5px; color: var(--tv-muted); margin-top: 2px; }
.tv-epg-now { margin-left: auto; font-size: 11.5px; color: #7dd3fc; max-width: 45%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-epg-close { border: 1px solid var(--tv-line); background: rgba(18,26,43,.6); color: #8fa1bd; font-size: 10.5px; padding: 4px 10px; border-radius: 6px; cursor: pointer; }
.tv-epg-scroll { overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; scrollbar-color: #26364f transparent; }
.tv-epg-track { position: relative; width: 1440px; height: 92px; padding-top: 26px; }
.tv-epg-hours { position: absolute; left: 0; right: 0; top: 0; height: 24px; }
.tv-epg-hour { position: absolute; top: 5px; font-size: 9.5px; color: #63748f; transform: translateX(-50%); }
.tv-epg-hour::after { content: ""; position: absolute; left: 50%; top: 15px; width: 1px; height: 66px; background: rgba(79,140,255,.09); }
.tv-epg-program-row { position: absolute; left: 0; right: 0; top: 26px; height: 52px; }
.tv-epg-program { position: absolute; top: 0; height: 50px; padding: 7px 9px; border-radius: 7px; border: 1px solid rgba(79,140,255,.2); background: linear-gradient(180deg, rgba(79,140,255,.16), rgba(79,140,255,.07)); overflow: hidden; }
.tv-epg-program b { display: block; font-size: 11.5px; font-weight: 550; color: #cfe0f5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-epg-program span { display: block; font-size: 9px; color: #7f93b1; margin-top: 3px; }
.tv-epg-program.now { border-color: rgba(56,189,248,.6); background: linear-gradient(180deg, rgba(56,189,248,.3), rgba(56,189,248,.1)); }
.tv-epg-program.now b { color: #fff; }
.tv-epg-program.past { opacity: .5; }
.tv-epg-playhead { position: absolute; top: 24px; bottom: 8px; width: 2px; background: #22d3ee; box-shadow: 0 0 8px rgba(34,211,238,.7); z-index: 3; }
.tv-epg-playhead::before { content: ""; position: absolute; left: -3px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: #22d3ee; }

/* now card */
.tv-now-card { display: flex; align-items: center; gap: 16px; background: var(--tv-panel); border: 1px solid var(--tv-line); border-radius: var(--tv-radius); padding: 13px 15px; }
.tv-now-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.tv-now-left img { width: 54px; height: 40px; border-radius: 8px; background: #0a101c; object-fit: contain; padding: 3px; border: 1px solid var(--tv-line); }
.tv-now-left h2 { margin: 0; font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-now-left p { margin: 3px 0 0; font-size: 10.5px; color: var(--tv-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-epg { display: flex; gap: 24px; flex: 0 0 auto; }
.tv-epg-item { max-width: 190px; }
.tv-epg-item span { display: block; font-size: 9.5px; color: #6b7c95; letter-spacing: .5px; }
.tv-epg-item b { display: block; font-size: 11.5px; font-weight: 550; margin-top: 3px; color: #c8d8ec; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* channel panel */
.tv-channel-panel { background: var(--tv-panel); border: 1px solid var(--tv-line); border-radius: var(--tv-radius); padding: 14px 12px 12px; }
.tv-list-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 10px; border-bottom: 1px solid rgba(30,42,65,.7); }
.tv-list-head span { font-size: 13px; font-weight: 600; }
.tv-list-head em { font-style: normal; font-size: 10.5px; color: var(--tv-muted); margin-left: 7px; }
.tv-mini-btn { border: 1px solid var(--tv-line); background: none; color: #7f93b1; font-size: 10px; padding: 4px 9px; border-radius: 6px; cursor: pointer; }
.tv-channel-list { max-height: calc(100vh - 250px); overflow-y: auto; padding: 6px 0; scrollbar-width: thin; scrollbar-color: #26364f transparent; }
.tv-ch { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; width: 100%; background: none; text-align: left; color: inherit; }
.tv-ch:hover { background: rgba(56,189,248,.06); }
.tv-ch.active { background: linear-gradient(135deg, rgba(79,140,255,.2), rgba(34,211,238,.08)); border-color: rgba(56,189,248,.3); }
.tv-ch-logo { width: 44px; height: 32px; border-radius: 6px; background: #0a101c; display: grid; place-items: center; overflow: hidden; flex: 0 0 auto; color: #6b7c95; font-size: 10px; border: 1px solid rgba(30,42,65,.9); }
.tv-ch-logo img { width: 100%; height: 100%; object-fit: contain; }
.tv-ch-main { flex: 1; min-width: 0; }
.tv-ch-main b { display: block; font-size: 12px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-ch-main span { display: block; font-size: 9.5px; color: #667791; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tv-ch-dot { width: 5px; height: 5px; border-radius: 50%; background: #22c55e; flex: 0 0 auto; }
.tv-ch.active .tv-ch-dot { background: #22d3ee; box-shadow: 0 0 8px #22d3ee; }
.tv-load-more { width: 100%; margin-top: 8px; padding: 8px; border: 1px dashed var(--tv-line); border-radius: 8px; background: none; color: #7f93b1; font-size: 10.5px; cursor: pointer; }
.tv-load-more:hover { color: #bae6fd; border-color: #334a6e; }

/* drawer */
.tv-drawer-mask { position: fixed; inset: 0; background: rgba(2,6,15,.62); z-index: 50; }
.tv-drawer { position: fixed; right: 0; top: 0; bottom: 0; width: min(360px, 90vw); background: #0c1220; border-left: 1px solid var(--tv-line); z-index: 60; display: flex; flex-direction: column; }
.tv-drawer[hidden], .tv-drawer-mask[hidden] { display: none; }
.tv-drawer-head { height: 58px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border-bottom: 1px solid var(--tv-line); font-size: 14px; font-weight: 600; }
.tv-drawer-head button { border: 0; background: none; color: #8fa1bd; font-size: 22px; cursor: pointer; }
.tv-drawer-body { padding: 18px; color: #a9b6cb; font-size: 12.5px; line-height: 1.8; }
.tv-drawer-body .set-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid rgba(30,42,65,.7); }
.tv-drawer-body a { color: #7dd3fc; }

/* toast */
.tv-toast { position: fixed; left: 50%; bottom: 36px; transform: translateX(-50%) translateY(10px); background: rgba(15,23,42,.95); border: 1px solid var(--tv-line); color: #e2e8f0; padding: 9px 16px; border-radius: 10px; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s; z-index: 80; }
.tv-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1280px) {
  .tv-shell { grid-template-columns: 176px minmax(0, 1fr); }
  .tv-channel-panel { grid-column: 1 / -1; }
  .tv-channel-list { max-height: 260px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
}
@media (max-width: 860px) {
  .tv-header { height: 56px; padding: 0 12px; gap: 10px; }
  .tv-clock, .tv-live-pill, .tv-search { display: none; }
  .tv-icon-btn span { display: none; }
  .tv-shell { grid-template-columns: 1fr; padding: 0 10px; margin-top: 10px; }
  .tv-categories { padding: 10px; }
  .tv-side-title, .tv-side-footer { display: none; }
  .tv-cat-list { flex-direction: row; overflow-x: auto; margin: 0; }
  .tv-cat { flex: 0 0 auto; width: auto; white-space: nowrap; }
  .tv-channel-list { grid-template-columns: 1fr; }
  .tv-now-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .tv-epg { flex-direction: column; gap: 8px; }
  .tv-epg-item { max-width: 100%; }
  .tv-announcement { padding: 0 12px; }
  .tv-controls { opacity: 1; }
}

/* EPG 叠加在播放器内部 */
.tv-epg-toggle { padding: 3px 9px; border-radius: 4px; border: 1px solid rgba(56,189,248,.35); background: rgba(15,23,42,.55); color: #bae6fd; font-size: 9.5px; cursor: pointer; backdrop-filter: blur(6px); }
.tv-epg-toggle:hover { background: rgba(56,189,248,.18); }
.tv-epg-overlay { position: absolute; left: 0; right: 0; bottom: 0; z-index: 7; border-radius: 0; border: 0; border-top: 1px solid rgba(56,189,248,.22); background: rgba(7,11,20,.94); backdrop-filter: blur(16px); transform: translateY(104%); opacity: 0; pointer-events: none; transition: transform .24s ease, opacity .2s ease; }
.tv-epg-overlay.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.tv-epg-overlay .tv-epg-timeline-head { padding: 9px 14px; background: rgba(13,19,32,.7); }
.tv-epg-overlay .tv-epg-scroll { max-height: 118px; }
.tv-epg-overlay .tv-epg-track { height: 88px; }
@media (max-width: 860px) {
  .tv-epg-overlay .tv-epg-scroll { max-height: 126px; }
  .tv-epg-overlay .tv-epg-now { display: none; }
}
/* 广告投放 */
.tv-ad-logo { position: absolute; left: 12px; top: 46px; z-index: 5; display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 6px; background: rgba(15,23,42,.55); color: #f8fafc; font-size: 11px; font-weight: 600; backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,.14); }
.tv-ad-logo img { width: 20px; height: 20px; object-fit: contain; }
.tv-ad-marquee { position: absolute; left: 0; right: 0; bottom: 52px; height: 30px; z-index: 5; overflow: hidden; background: linear-gradient(90deg, rgba(0,0,0,.25), rgba(0,0,0,.55)); pointer-events: none; }
.tv-ad-marquee span { position: absolute; white-space: nowrap; line-height: 30px; color: #fcd34d; font-size: 12px; animation: tvAdMarquee 16s linear infinite; }
@keyframes tvAdMarquee { from { transform: translateX(100%); } to { transform: translateX(-120%); } }
.tv-ad-image { position: absolute; right: 12px; bottom: 92px; z-index: 5; width: min(240px, 34%); border-radius: 10px; overflow: hidden; background: rgba(15,23,42,.7); border: 1px solid rgba(255,255,255,.14); color: #e2e8f0; font-size: 11px; }
.tv-ad-image img { width: 100%; height: 90px; object-fit: cover; display: block; }
.tv-ad-image b { display: block; padding: 7px 9px; font-weight: 500; }
.tv-ad-overlay { position: absolute; inset: 0; z-index: 9; display: flex; align-items: center; justify-content: center; background: radial-gradient(500px 260px at 50% 45%, rgba(56,189,248,.1), transparent 70%), rgba(4,8,15,.9); }
.tv-ad-overlay[hidden] { display: none; }
.tv-ad-box { width: min(420px, 86%); text-align: center; color: #e6edf8; padding: 24px; border: 1px solid rgba(56,189,248,.22); border-radius: 14px; background: rgba(13,19,32,.86); box-shadow: 0 24px 70px rgba(0,0,0,.5); }
.tv-ad-box .ad-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; background: rgba(56,189,248,.16); color: #7dd3fc; font-size: 9px; letter-spacing: 1px; }
.tv-ad-box img { width: 100%; max-height: 210px; object-fit: contain; border-radius: 10px; margin: 12px 0 6px; background: #000; }
.tv-ad-box h3 { margin: 10px 0 6px; font-size: 17px; }
.tv-ad-box p { margin: 0; color: #94a3b8; font-size: 11.5px; line-height: 1.7; }
.tv-ad-box .ad-count { display: inline-block; margin-top: 14px; padding: 5px 13px; border-radius: 999px; background: rgba(56,189,248,.12); border: 1px solid rgba(56,189,248,.3); color: #bae6fd; font-size: 11px; }
.tv-ad-box .ad-skip { margin-top: 14px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.06); color: #cbd5e1; font-size: 11px; padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.tv-player-card.ad-lock .tv-controls { opacity: 0; pointer-events: none; }
.tv-player-card.ad-lock .tv-ad-overlay { display: flex; }