:root {
  --bg: #0b1113;
  --bg-2: #0e1618;
  --side: #11191d;
  --card: #141d21;
  --card-2: #18232a;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .12);
  --text: #f2f5f4;
  --muted: #9aa6a8;
  --subtle: #6b7779;
  --accent: #16e09d;
  --accent-ink: #052b1e;
  --accent-soft: rgba(22, 224, 157, .1);
  --gold: #f3c969;
  --warn-bg: rgba(243, 201, 105, .08);
  --radius: 12px;
  --side-w: 272px;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--bg); color: var(--text); }
body { font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.app { display: flex; min-height: 100vh; }
.main {
  flex: 1; min-width: 0; margin-left: var(--side-w);
  background: radial-gradient(1200px 500px at 50% -10%, rgba(22, 224, 157, .07), transparent 60%), var(--bg);
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  background: var(--side); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px; gap: 12px; overflow-y: auto;
}
.user-head { display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, #2c3a3f, #11191d); border: 2px solid var(--line-2); display: grid; place-items: center; font-weight: 800; color: var(--accent); }
.user-head .name { font-weight: 800; font-size: 15px; }
.user-head .sub { font-size: 11px; color: var(--subtle); }
.user-head .tools { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: rgba(255, 255, 255, .015); }
.growth-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.growth-row b { color: var(--gold); }
.bar { flex: 1; height: 4px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.growth-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--subtle); margin-top: 6px; }
.notice { border: 1px solid rgba(243, 201, 105, .45); background: var(--warn-bg); color: var(--gold); border-radius: 10px; padding: 10px 12px; font-size: 12px; font-weight: 700; text-align: center; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.quick button { border: 1px solid var(--line); border-radius: 10px; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }
.quick button:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.quick svg { width: 22px; height: 22px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: rgba(255, 255, 255, .04); border-radius: 12px; padding: 4px; }
.seg button { padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); display: flex; justify-content: center; align-items: center; gap: 6px; }
.seg button.on { background: var(--card-2); color: var(--text); }
.seg button.on svg { color: var(--accent); }
.side-empty { text-align: center; padding: 22px 0 10px; color: var(--muted); }
.side-empty svg { width: 26px; height: 26px; margin-bottom: 8px; }
.side-empty b { display: block; color: var(--text); font-size: 13px; }
.side-empty span { font-size: 12px; }
.side-list { display: flex; flex-direction: column; gap: 6px; }
.side-item { display: flex; gap: 10px; align-items: center; padding: 6px; border-radius: 8px; }
.side-item:hover { background: rgba(255, 255, 255, .04); }
.side-item img { width: 34px; height: 48px; border-radius: 4px; object-fit: cover; }
.side-item .t { font-size: 13px; font-weight: 700; }
.side-item .s { font-size: 11px; color: var(--subtle); }
.side-link { display: flex; justify-content: space-between; align-items: center; padding: 10px 6px; font-weight: 700; font-size: 13px; border-radius: 8px; }
.side-link:hover { background: rgba(255, 255, 255, .03); }
.side-link span { display: flex; gap: 8px; align-items: center; }
.side-spacer { flex: 1; }
.btn-accent { background: var(--accent); color: var(--accent-ink); font-weight: 800; border-radius: 10px; padding: 11px; display: flex; justify-content: center; align-items: center; gap: 8px; }
.btn-accent:hover { filter: brightness(1.08); }
.btn-ghost { border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 14px; color: var(--muted); font-weight: 700; }
.btn-ghost:hover { color: var(--text); }

/* ---------- Topbar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; justify-content: flex-end; align-items: center; padding: 14px 32px 0; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.menu-btn { display: none; margin-right: auto; background: rgba(11, 17, 19, .8); }
.pill-nav { display: flex; gap: 4px; background: rgba(17, 25, 29, .85); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; padding: 4px; }
.pill-nav a { padding: 7px 16px; border-radius: 10px; font-weight: 700; font-size: 13px; color: var(--muted); }
.pill-nav a.on { background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(22, 224, 157, .35); }

/* ---------- Home hero ---------- */
.page { padding: 0 32px 60px; max-width: 1240px; margin: 0 auto; }
.hero { text-align: center; padding: 6px 0 24px; }
.logo { font-size: 30px; font-weight: 900; letter-spacing: 1px; }
.domain { font-size: 12px; color: var(--muted); margin-top: 2px; }
.domain code { color: var(--accent); font-family: ui-monospace, Consolas, monospace; }
.composer { max-width: 640px; margin: 18px auto 0; border: 1px solid rgba(110, 160, 255, .35); background: rgba(20, 30, 40, .7); border-radius: 14px; padding: 12px; text-align: left; }
.composer textarea { width: 100%; background: none; border: 0; outline: none; color: var(--text); font: inherit; font-size: 15px; resize: none; height: 44px; }
.composer textarea::placeholder { color: var(--muted); }
.composer-row { display: flex; align-items: center; gap: 8px; }
.round { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .06); color: var(--muted); }
.mode { display: flex; background: rgba(255, 255, 255, .05); border-radius: 18px; padding: 3px; }
.mode button { padding: 5px 12px; border-radius: 15px; font-size: 13px; font-weight: 700; display: flex; gap: 5px; align-items: center; color: var(--muted); }
.mode button.on { background: var(--accent); color: var(--accent-ink); }
.mode svg { width: 14px; height: 14px; }
.send { margin-left: auto; display: flex; gap: 8px; }
.send .go { background: var(--accent); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; align-items: center; max-width: 760px; margin-inline: auto; }
.chips .lbl { font-size: 12px; color: var(--subtle); font-weight: 700; }
.chip { border: 1px solid var(--line-2); border-radius: 16px; padding: 4px 12px; font-size: 12px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; }
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip svg { width: 11px; height: 11px; fill: currentColor; stroke: none; }

/* ---------- Section ---------- */
.sec { margin-top: 30px; }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.sec-head h2 { font-size: 19px; font-weight: 900; }
.sec-head p { font-size: 12px; color: var(--muted); }
.sec-head .more { font-size: 12px; padding: 6px 12px; border-radius: 8px; background: rgba(255, 255, 255, .06); color: var(--muted); font-weight: 700; white-space: nowrap; }
.sec-head .more:hover { color: var(--text); }
.title-ico { display: flex; gap: 10px; align-items: center; }
.title-ico svg { color: var(--accent); width: 20px; height: 20px; }

/* calendar */
.cal-range { font-size: 12px; color: var(--muted); display: flex; gap: 14px; align-items: center; }
.cal-range a { color: var(--accent); font-weight: 700; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day { border: 1px solid var(--line); border-radius: 8px; padding: 8px 4px; text-align: center; background: rgba(255, 255, 255, .015); }
.day small { display: block; font-size: 11px; color: var(--muted); }
.day b { display: block; font-size: 15px; }
.day span { font-size: 11px; color: var(--subtle); }
.day.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.day.on small, .day.on b, .day.on span { color: var(--accent); }
.cal-cats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-top: 16px; }
.cal-cat h4 { display: flex; justify-content: space-between; font-size: 14px; font-weight: 800; margin-bottom: 8px; }
.cal-cat h4 span { color: var(--subtle); font-size: 12px; font-weight: 500; }
.cal-items { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cal-item { display: flex; gap: 8px; min-width: 0; }
.cal-item img { width: 40px; height: 56px; border-radius: 5px; object-fit: cover; flex: none; }
.cal-item .t { font-size: 12px; font-weight: 800; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-item .s { font-size: 11px; color: var(--subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* poster grid */
.grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.card { position: relative; border-radius: 10px; overflow: hidden; aspect-ratio: 2 / 3; background: var(--card); border: 1px solid var(--line); display: block; transition: transform .18s, border-color .18s; }
.card:hover { transform: translateY(-3px); border-color: rgba(22, 224, 157, .5); }
.card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card::after { content: ""; position: absolute; inset: 45% 0 0; background: linear-gradient(transparent, rgba(0, 0, 0, .88)); }
.badge { position: absolute; top: 7px; z-index: 2; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; background: rgba(0, 0, 0, .7); color: #fff; }
.badge.l { left: 7px; max-width: calc(100% - 58px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge.r { right: 7px; }
.card .cap { position: absolute; left: 9px; right: 9px; bottom: 8px; z-index: 2; }
.card .cap b { display: block; font-size: 13px; font-weight: 900; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .cap span { display: block; font-size: 11px; color: #c4cccd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.load-more { display: block; width: min(560px, 100%); margin: 40px auto 0; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .02); color: var(--muted); font-size: 12px; }

/* ---------- Player ---------- */
.player-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; margin-top: 14px; }
.video-box { background: #000; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; border: 1px solid var(--line); }
.video-box video { width: 100%; height: 100%; display: block; background: #000; }
.p-title { font-size: 22px; font-weight: 900; margin-top: 16px; }
.p-meta { color: var(--muted); font-size: 13px; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.p-meta .score { color: var(--gold); font-weight: 800; }
.p-desc { color: #c3cbcc; margin-top: 12px; font-size: 13px; line-height: 1.75; }
.p-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.panel { background: var(--side); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.panel + .panel { margin-top: 14px; }
.panel h3 { font-size: 14px; font-weight: 800; margin-bottom: 10px; display: flex; justify-content: space-between; }
.panel h3 span { font-size: 12px; color: var(--subtle); font-weight: 500; }
.lines { display: flex; flex-wrap: wrap; gap: 8px; }
.lines button, .eps button { border: 1px solid var(--line-2); border-radius: 8px; padding: 6px 10px; font-size: 12px; color: var(--muted); }
.lines button.on, .eps button.on { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.eps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; max-height: 300px; overflow-y: auto; }
.eps button { padding: 7px 0; }
.demo-note { font-size: 11px; color: var(--subtle); margin-top: 8px; }

/* ---------- Session (AI) ---------- */
.session { max-width: 860px; margin: 20px auto 0; }
.bubble { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.bubble.user { background: var(--accent-soft); border: 1px solid rgba(22, 224, 157, .3); margin-left: auto; max-width: 80%; width: fit-content; }
.bubble.ai { background: var(--side); border: 1px solid var(--line); }
.bubble.ai p { color: #c9d1d2; margin-bottom: 12px; }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: blink 1s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- Empty / short ---------- */
.empty { text-align: center; padding: 80px 0; color: var(--muted); }
.empty svg { width: 36px; height: 36px; margin-bottom: 10px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.shorts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.shorts .card { aspect-ratio: 9 / 16; }
.tabs { display: flex; gap: 8px; overflow-x: auto; margin: 14px 0; scrollbar-width: none; }
.tabs button { border: 1px solid var(--line-2); border-radius: 16px; padding: 5px 14px; font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); backdrop-filter: blur(4px); z-index: 90; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(560px, 100%); max-height: 86vh; background: #141c1f; border: 1px solid var(--line-2); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.modal-h { padding: 16px 18px 0; display: flex; align-items: center; gap: 10px; }
.modal-h b { font-size: 17px; font-weight: 900; }
.modal-h .date { font-size: 11px; border: 1px solid var(--line-2); border-radius: 10px; padding: 2px 8px; color: var(--muted); }
.modal .tabs { padding: 0 18px; }
.modal-body { overflow-y: auto; padding: 0 18px 14px; display: flex; flex-direction: column; gap: 10px; }
.ann { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: rgba(255, 255, 255, .02); }
.ann.hot { border-color: var(--accent); background: var(--accent-soft); }
.ann b { display: block; font-size: 14px; margin-bottom: 4px; }
.ann p { font-size: 12px; color: var(--muted); }
.modal-f { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px 18px 16px; border-top: 1px solid var(--line); }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); background: #1f2b30; border: 1px solid var(--line-2); padding: 9px 16px; border-radius: 10px; font-size: 13px; opacity: 0; pointer-events: none; transition: .2s; z-index: 99; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.scrim { display: none; }
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
  .cal-cats { grid-template-columns: repeat(2, 1fr); }
  .player-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .22s; }
  body.drawer .sidebar { transform: none; }
  body.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 35; }
  .menu-btn { display: grid; }
  .pill-nav { display: none; }
  .topbar { padding: 12px 16px 0; }
  .page { padding: 0 16px 90px; }
  .grid { grid-template-columns: repeat(3, 1fr); gap: 9px; }
  .shorts { grid-template-columns: repeat(3, 1fr); }
  .days { display: flex; overflow-x: auto; scrollbar-width: none; }
  .day { min-width: 64px; }
  .cal-cats { grid-template-columns: 1fr; }
  .bottom-nav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: rgba(17, 25, 29, .95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
  .bottom-nav a.on { color: var(--accent); }
  .bottom-nav svg { width: 22px; height: 22px; }
  .logo { font-size: 26px; }
  .card .cap b { font-size: 12px; }
}
@media (max-width: 420px) {
  .eps { grid-template-columns: repeat(4, 1fr); }
  .sec-head h2 { font-size: 17px; }
}

/* Live catalogue and player states */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.category-shortcuts a { text-align:center; border:1px solid var(--line); border-radius:9px; padding:9px 0; color:var(--muted); }
.category-shortcuts a:hover { color:var(--accent); border-color:var(--accent); }
.sidebar-foot { color:var(--subtle); font-size:11px; padding:8px 2px; }
.catalog-page { margin-top:28px; }
.catalog-page h1 { font-size:26px; }
.catalog-page .composer { margin:18px 0; max-width:100%; }
.catalog-tabs a { border:1px solid var(--line-2); border-radius:18px; padding:7px 16px; color:var(--muted); font-weight:700; white-space:nowrap; }
.catalog-tabs a.on { color:var(--accent-ink); background:var(--accent); border-color:var(--accent); }
.catalog-tabs { margin:22px 0; padding-bottom:4px; }
.search-hint { color:var(--subtle); font-size:12px; }
.search-submit { background:var(--accent); color:var(--accent-ink); padding:9px 14px; border-radius:10px; display:flex; align-items:center; gap:6px; font-weight:800; }
.composer-row { justify-content:space-between; }
.browse-all { display:block; text-align:center; color:var(--accent); }
.loading-state { padding:42px 12px; display:flex; align-items:center; justify-content:center; gap:10px; color:var(--muted); width:100%; grid-column:1/-1; }
.spinner { width:19px; height:19px; border:2px solid var(--line-2); border-top-color:var(--accent); border-radius:50%; animation:spin .8s linear infinite; display:inline-block; flex:none; }
@keyframes spin { to { transform:rotate(360deg); } }
.empty .btn-ghost { margin:16px auto 0; display:block; }
.end-note { text-align:center; color:var(--subtle); margin:28px 0; }
.player-back { display:flex; justify-content:space-between; color:var(--muted); margin-top:18px; }
.player-back a:hover { color:var(--accent); }
.playback-status { min-height:42px; padding:11px 2px 0; color:var(--accent); font-size:12px; }
.playback-status.is-error { color:var(--gold); }
.p-title #epLabel { display:block; font-size:14px; color:var(--muted); margin-top:4px; }
.player-help { display:flex; flex-wrap:wrap; justify-content:space-between; gap:12px; color:var(--subtle); font-size:12px; margin:18px 0; }
.player-help a { color:var(--accent); }
.extra-sources { margin-top:14px; font-size:12px; }
.muted { color:var(--muted); font-size:12px; }
.lines .line-failed { opacity:.5; }
.lines .season-link { border:1px solid var(--line-2); border-radius:8px; padding:6px 10px; color:var(--muted); font-size:12px; }
.lines .season-link.on { border-color:var(--accent); color:var(--accent); }
.episode-nav { display:flex; align-items:center; justify-content:space-between; gap:5px; margin-top:12px; font-size:11px; color:var(--muted); }
.episode-nav button { padding:7px; font-size:11px; }
button:disabled { cursor:default; opacity:.35; }
.episode-paging { margin-bottom:12px; color:var(--muted); font-size:12px; }
.episode-paging select { background:var(--card-2); color:var(--text); border:1px solid var(--line-2); padding:7px; border-radius:7px; margin-left:8px; }
.eps { grid-template-columns:repeat(4,minmax(0,1fr)); max-height:360px; }
.eps button { padding:8px 5px; line-height:1.4; overflow-wrap:anywhere; }
.poster-missing { background:linear-gradient(150deg,#18312d,#141d21); }
.poster-missing .cap b { white-space:normal; }
.video-box:has(video[poster]) { background:#000; }
@media (max-width:600px) {
  .search-hint { font-size:10px; }
  .catalog-page h1 { font-size:22px; }
  .player-wrap { gap:16px; }
  .eps { grid-template-columns:repeat(6,minmax(0,1fr)); }
  .player-help { line-height:1.7; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior:auto!important; animation:none!important; transition:none!important; } }
