:root {
  --bg: #0e0f13;
  --bg2: #15171d;
  --panel: #1b1e26;
  --panel2: #232734;
  --line: #2c3140;
  --text: #e8eaf0;
  --muted: #9aa3b2;
  --accent: #ff5a5f;
  --accent2: #4d8dff;
  --ok: #36c275;
  --warn: #f0a020;
  --radius: 12px;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #1a1d27 0%, var(--bg) 60%);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: rgba(14,15,19,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand .logo { font-size: 24px; }
.brand .title { font-size: 20px; font-weight: 800; letter-spacing: .5px; }
.brand .sub { font-size: 12px; color: var(--muted); }
.search { flex: 1; display: flex; max-width: 640px; margin: 0 auto; }
.search input {
  flex: 1; padding: 10px 14px; border-radius: 10px 0 0 10px;
  border: 1px solid var(--line); border-right: none; background: var(--panel);
  color: var(--text); outline: none; font-size: 14px;
}
.search input:focus { border-color: var(--accent2); }
.search button {
  padding: 10px 18px; border: none; border-radius: 0 10px 10px 0;
  background: var(--accent); color: #fff; font-weight: 600; cursor: pointer;
}
.actions .ghost, .manage-foot .ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 9px 14px; border-radius: 10px; cursor: pointer; font-size: 13px;
}
.actions .ghost:hover { color: var(--text); border-color: var(--accent2); }

/* 布局 */
.layout { display: flex; min-height: calc(100vh - 60px); }
.sidebar {
  width: 240px; flex-shrink: 0; padding: 16px 12px;
  background: var(--bg2); border-right: 1px solid var(--line);
  overflow-y: auto;
}
.sidebar-head { font-size: 13px; color: var(--muted); margin: 4px 8px 12px; letter-spacing: 1px; }
.interface-list { list-style: none; margin: 0; padding: 0; }
.interface-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 10px; border-radius: 10px; cursor: pointer; margin-bottom: 4px;
  border: 1px solid transparent;
}
.interface-list li:hover { background: var(--panel); }
.interface-list li.active { background: var(--panel2); border-color: var(--accent2); }
.interface-list .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex-shrink: 0; }
.interface-list .dot.ok { background: var(--ok); }
.interface-list .dot.err { background: var(--accent); }
.interface-list .name { font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.interface-list .cnt { font-size: 11px; color: var(--muted); }
.sidebar-tip { font-size: 11px; color: var(--muted); margin: 14px 8px 0; line-height: 1.6; }
.lan-hint { background: var(--panel); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; padding: 7px 20px; text-align: center; }
.lan-hint b { color: var(--accent2); }

/* 主内容 */
.content { flex: 1; padding: 20px 24px; overflow-y: auto; }
.section-head { font-size: 18px; font-weight: 700; margin: 4px 0 16px; display: flex; align-items: center; gap: 10px; }
.section-head .meta { font-size: 12px; color: var(--muted); font-weight: 400; }

/* 站点卡片 */
.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.site-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; cursor: pointer; transition: .15s; position: relative;
}
.site-card:hover { transform: translateY(-2px); border-color: var(--accent2); box-shadow: var(--shadow); }
.site-card .sname { font-size: 14px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.site-card .badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px; margin-right: 6px;
}
.badge.cms { background: rgba(54,194,117,.18); color: var(--ok); }
.badge.spider { background: rgba(240,160,32,.18); color: var(--warn); }
.badge.unknown { background: rgba(154,163,178,.18); color: var(--muted); }
.site-card .stip { font-size: 11px; color: var(--muted); margin-top: 8px; line-height: 1.5; }

/* 分类条 */
.cat-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cat-bar .chip {
  padding: 7px 14px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line);
  font-size: 13px; cursor: pointer; color: var(--muted);
}
.cat-bar .chip:hover { color: var(--text); }
.cat-bar .chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* 海报墙 */
.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.poster {
  cursor: pointer; border-radius: 10px; overflow: hidden; background: var(--panel);
  border: 1px solid var(--line); transition: .15s;
}
.poster:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent2); }
.poster .thumb {
  width: 100%; aspect-ratio: 2/3; background: var(--panel2) center/cover no-repeat;
  position: relative;
}
.poster .thumb .ph {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 28px; color: var(--muted); background: linear-gradient(135deg,#222633,#2c3242);
}
.poster .remark {
  position: absolute; bottom: 6px; left: 6px; right: 6px; font-size: 11px; color: #fff;
  background: rgba(0,0,0,.55); padding: 2px 6px; border-radius: 6px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.poster .pname { font-size: 13px; padding: 8px 8px 10px; line-height: 1.4; height: 46px; overflow: hidden; }

/* 分页 */
.pager { display: flex; gap: 8px; justify-content: center; margin: 24px 0; flex-wrap: wrap; }
.pager button {
  background: var(--panel); color: var(--text); border: 1px solid var(--line);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px;
}
.pager button:hover:not(:disabled) { border-color: var(--accent2); }
.pager button.active { background: var(--accent2); border-color: var(--accent2); color: #fff; }
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* 弹层 */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal-box { background: var(--bg2); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); max-width: 920px; width: 100%; max-height: 90vh; overflow: auto; position: relative; }
.modal-box .close { position: absolute; top: 12px; right: 12px; z-index: 5; background: rgba(0,0,0,.4); border: none; color: #fff; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 16px; }

/* 详情 */
.detail-box { padding: 24px; }
.detail-top { display: flex; gap: 20px; }
.detail-top .dposter { width: 180px; flex-shrink: 0; border-radius: 10px; aspect-ratio: 2/3; background: center/cover no-repeat var(--panel2); }
.detail-info { flex: 1; }
.detail-info h2 { margin: 0 0 10px; font-size: 22px; }
.detail-info .row { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.detail-info .row b { color: var(--text); }
.detail-info .desc { font-size: 13px; color: var(--muted); line-height: 1.7; margin-top: 12px; max-height: 120px; overflow: auto; }
.episodes { margin-top: 20px; }
.episodes h4 { font-size: 14px; margin: 0 0 10px; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; max-height: 320px; overflow: auto; }
.ep-grid button {
  background: var(--panel); border: 1px solid var(--line); color: var(--text);
  padding: 8px 6px; border-radius: 8px; cursor: pointer; font-size: 12px; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ep-grid button:hover { border-color: var(--accent); background: var(--panel2); }

/* 播放器 */
.player-box { max-width: 1100px; }
.player-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.player-head #playerTitle { font-size: 15px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-head select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-size: 13px; max-width: 260px; }
.player-wrap { position: relative; background: #000; }
.player-wrap video { width: 100%; display: block; max-height: 70vh; background: #000; }
.player-msg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; padding: 20px; text-align: center; }

/* 片源管理 */
.manage-box { padding: 24px; max-width: 620px; }
.manage-box h3 { margin: 0 0 16px; }
#manageList { display: flex; flex-direction: column; gap: 8px; max-height: 50vh; overflow: auto; margin-bottom: 14px; }
.ms-row { display: flex; align-items: center; gap: 10px; background: var(--panel); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); }
.ms-row .ms-name { flex: 1; font-size: 13px; }
.ms-row .ms-url { font-size: 11px; color: var(--muted); flex: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-row button { background: transparent; border: 1px solid var(--line); color: var(--accent); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12px; }
.manage-add { display: flex; gap: 8px; flex-wrap: wrap; }
.manage-add input { flex: 1; min-width: 160px; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.manage-add button { background: var(--accent); border: none; color: #fff; padding: 9px 16px; border-radius: 8px; cursor: pointer; font-weight: 600; }
.manage-foot { margin-top: 14px; }

/* toast */
.toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--panel2); color: var(--text); padding: 12px 20px; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); z-index: 80; font-size: 13px; }
.toast.err { border-color: var(--accent); }
.toast.ok { border-color: var(--ok); }

.loading { text-align: center; color: var(--muted); padding: 40px; font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 40px; font-size: 14px; }

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 10px 12px; }
  .brand .sub { display: none; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .actions { margin-left: auto; }
  .layout { flex-direction: column; }
  .sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .sidebar-head { display: none; }
  .interface-list { display: flex; overflow-x: auto; gap: 6px; padding-bottom: 4px; }
  .interface-list li { flex: 0 0 auto; margin-bottom: 0; }
  .interface-list .cnt { display: none; }
  .sidebar-tip { display: none; }
  .content { padding: 14px; }
  .poster-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 10px; }
  .site-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .detail-top { flex-direction: column; }
  .detail-top .dposter { width: 130px; align-self: center; }
  .modal { padding: 0; }
  .modal-box { max-width: 100%; border-radius: 0; max-height: 100vh; height: 100vh; }
  .player-box { height: 100vh; display: flex; flex-direction: column; }
  .player-wrap video { max-height: calc(100vh - 64px); }
  .player-head { flex-wrap: wrap; }
  .player-head select { max-width: 45%; }
  .lan-hint { font-size: 11px; padding: 6px 12px; }
}
