/* IPTV Player — Apple TV 风格：纯黑底、玻璃卡片、白色选中态、红色直播角标。
   Polish per better-ui / better-typography / better-motion / better-colors:
   concentric radii (outer = inner + padding), dark-mode ring shadows,
   1px image outlines, hover only on hover-capable pointers, press 0.96/150ms,
   icons currentColor with weight-matched stroke, 16px inputs on mobile. */

:root {
  --bg: #000000;
  --bg-soft: #0a0a0c;
  --surface: #1c1c1e;
  --surface-2: #2c2c2e;
  --surface-3: #3a3a3c;
  --text: #f5f5f7;
  --muted: #98989d;
  --faint: #636366;
  --accent: #ffffff;
  --live: #ff453a;
  --switch-on: #30d158;
  --ring: 0 0 0 1px oklch(1 0 0 / 0.08);
  --ring-hover: 0 0 0 1px oklch(1 0 0 / 0.16);
  --shadow-elev:
    0 0 0 1px oklch(1 0 0 / 0.08),
    0 1px 2px rgb(0 0 0 / 0.5),
    0 8px 24px rgb(0 0 0 / 0.5);
  --shadow-pop:
    0 0 0 1px oklch(1 0 0 / 0.08),
    0 2px 4px rgb(0 0 0 / 0.5),
    0 16px 40px rgb(0 0 0 / 0.6);
  --radius-card: 20px;
  --radius-inner: 12px;
  --radius-btn: 10px;
  --radius-pill: 999px;
  --tabbar-h: 64px;
  --ease-out: cubic-bezier(0.2, 0, 0, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

input, select, textarea {
  font: inherit;
  color: inherit;
}

img { display: block; max-width: 100%; }

.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;
}

#app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
}

/* ---------- 顶栏 ---------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 8px 0;
  background: var(--bg);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--accent);
  color: #000;
  flex: none;
}

.brand-mark svg { width: 20px; height: 20px; }

.brand-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.source-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 8px 0 14px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--ring);
  font-size: 15px;
  font-weight: 600;
  transition: background-color 150ms var(--ease-out), transform 150ms var(--ease-out);
}

.source-pill-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.source-pill-caret {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--muted);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  color: var(--text);
  transition: background-color 150ms var(--ease-out), transform 150ms var(--ease-out);
}

.icon-btn svg { width: 22px; height: 22px; }

.search-toggle { background: var(--surface); box-shadow: var(--ring); }

/* 搜索行：桌面常驻，手机收起（点放大镜展开） */
.search-row {
  display: none;
  flex: 1 1 100%;
  align-items: center;
  gap: 8px;
}

.toolbar.search-open { flex-wrap: wrap; }
.toolbar.search-open .search-row { display: flex; }
.toolbar.search-open .source-pill,
.toolbar.search-open .search-toggle { display: none; }

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 8px 0 12px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--ring);
}

.search-wrap:focus-within { box-shadow: 0 0 0 1.5px var(--accent); }

.search-icon {
  width: 18px;
  height: 18px;
  flex: none;
  color: var(--muted);
}

.search-wrap input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
  color: var(--text);
}

.search-wrap input::placeholder { color: var(--faint); }
.search-wrap input::-webkit-search-cancel-button { display: none; }

.search-clear {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text);
}

.search-clear svg { width: 14px; height: 14px; }

.search-cancel {
  flex: none;
  height: 40px;
  padding: 0 4px;
  font-size: 16px;
  color: var(--accent);
}

/* ---------- 主区 ---------- */
.main { min-height: 60vh; }

.view[hidden] { display: none; }

/* ---------- 频道布局 ---------- */
.channel-layout { display: block; }

.channel-sidebar { display: none; }

.channel-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* 手机：视频 + 分组 chips 一起吸顶；桌面：只有视频吸顶 */
.sticky-zone {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  margin: 0 -16px;
  padding: 0 16px 4px;
}

.video-card {
  position: relative;
  border-radius: 0;
  background: #000;
  overflow: hidden;
}

.player-container {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}

.player-container video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
}

.video-empty,
.video-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  text-align: center;
  background: #000;
}

.video-empty .empty-icon {
  width: 48px;
  height: 48px;
  color: var(--faint);
}

.empty-text,
.video-error-text {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.video-error-actions {
  display: flex;
  gap: 8px;
}

/* 分组 chips：手机横滑，桌面隐藏 */
.group-chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 10px 0 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.group-chips::-webkit-scrollbar { display: none; }

.group-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: none;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  background: var(--surface);
  box-shadow: var(--ring);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  transition: background-color 150ms var(--ease-out), transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.group-chip-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.group-chip.is-active {
  background: var(--accent);
  color: #000;
  box-shadow: none;
}

.group-chip.is-active .group-chip-count { color: rgb(0 0 0 / 0.6); }

/* 正在播放条 */
.now-playing {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 8px 8px 12px;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--ring);
}

.now-playing-logo {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.1);
}

.now-playing-fallback {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 8px;
  background: var(--surface-2);
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.1);
  font-size: 17px;
  font-weight: 700;
}

.now-playing-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.now-playing-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.now-playing-group {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--live);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

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

@keyframes live-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.now-playing-nav {
  display: flex;
  gap: 4px;
  flex: none;
}

.now-playing-nav .icon-btn { background: var(--surface-2); }

/* ---------- 频道列表 ---------- */
.channel-list-container { min-height: 240px; }

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 4px 8px;
}

.group-head-name {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.group-head-count {
  font-size: 13px;
  color: var(--muted);
  flex: none;
}

.channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 8px 12px;
  border-radius: 16px;
  text-align: left;
  content-visibility: auto;
  contain-intrinsic-size: 64px;
  transition: background-color 150ms var(--ease-out), transform 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}

.channel-row.is-active {
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px oklch(1 0 0 / 0.85);
}

.channel-logo {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 12px;
  object-fit: contain;
  background: var(--surface);
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.1);
}

.channel-fallback {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.1);
  font-size: 18px;
  font-weight: 700;
}

.channel-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.channel-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-meta {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.channel-play {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
}

.channel-play svg { width: 16px; height: 16px; }

.channel-row.is-active .channel-play {
  background: var(--accent);
  color: #000;
}

.list-empty {
  padding: 64px 24px;
  text-align: center;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

/* 骨架屏 */
.skeleton-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 12px;
}

.skeleton-logo {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 12px;
  background: var(--surface-2);
}

.skeleton-line {
  flex: 1 1 auto;
  height: 16px;
  border-radius: 8px;
  background: var(--surface-2);
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius-btn);
  font-size: 16px;
  font-weight: 600;
  transition: background-color 150ms var(--ease-out), transform 150ms var(--ease-out), opacity 150ms var(--ease-out);
}

.btn:disabled { opacity: 0.4; }

.btn svg { width: 18px; height: 18px; }

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-ghost {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--live);
  color: #fff;
}

.btn-sm {
  min-height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

.btn-block { width: 100%; }

/* ---------- 数据源 / 配置页 ---------- */
.page {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 0 8px;
}

.page-head { margin-bottom: 20px; }

.page-title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.page-sub {
  margin: 0;
  font-size: 15px;
  color: var(--muted);
}

.source-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.card {
  padding: 16px;
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: var(--ring);
}

.card + .card { margin-top: 12px; }

.card-title {
  margin: 0 0 12px;
  font-size: 17px;
  font-weight: 700;
}

.card-text {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--muted);
}

.card-hint {
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

.source-card.is-active { box-shadow: inset 0 0 0 1.5px oklch(1 0 0 / 0.85); }

.source-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.source-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: none;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 22px;
  background: var(--surface-3);
  color: var(--text);
}

.source-meta {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.setting-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
}

.setting-row + .setting-row { border-top: 1px solid oklch(1 0 0 / 0.08); }

.setting-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.setting-desc {
  display: block;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.setting-row > .switch { margin-left: auto; flex: none; }

/* iOS 风格开关 */
.switch { position: relative; display: inline-block; }

.switch input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  display: block;
  width: 51px;
  height: 31px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background-color 200ms var(--ease-out);
}

.switch-track::after {
  content: "";
  display: block;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.4);
  transform: translate(2px, 2px);
  transition: transform 200ms var(--ease-out);
}

.switch input:checked + .switch-track { background: var(--switch-on); }
.switch input:checked + .switch-track::after { transform: translate(22px, 2px); }

.about {
  margin: 24px 0 0;
  text-align: center;
  font-size: 13px;
  color: var(--faint);
}

/* ---------- 底部导航 ---------- */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  background: rgb(0 0 0 / 0.85);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border-top: 1px solid oklch(1 0 0 / 0.1);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.tabbar-inner {
  display: flex;
  max-width: 1200px;
  height: var(--tabbar-h);
  margin: 0 auto;
}

.tab-btn {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  min-height: 48px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  transition: color 150ms var(--ease-out);
}

.tab-btn svg { width: 24px; height: 24px; }

.tab-btn.is-active { color: var(--text); }

.tab-btn.is-active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 24px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
  transform: translateX(-50%);
}

/* ---------- 数据源抽屉 ---------- */
.sheet-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.sheet {
  width: 100%;
  max-height: 72dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: sheet-up 300ms var(--ease-out);
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-handle {
  width: 36px;
  height: 5px;
  margin: 4px auto 8px;
  border-radius: 999px;
  background: var(--surface-3);
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.sheet-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sheet-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.sheet-empty {
  margin: 0;
  padding: 24px 0;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 12px;
  border-radius: 12px;
  text-align: left;
  transition: background-color 150ms var(--ease-out), transform 150ms var(--ease-out);
}

.sheet-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.sheet-item-name {
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-item-meta {
  font-size: 13px;
  color: var(--muted);
}

.sheet-item-check {
  width: 22px;
  height: 22px;
  flex: none;
  color: var(--accent);
}

/* ---------- 对话框 ---------- */
.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgb(0 0 0 / 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.dialog {
  width: 100%;
  max-height: 88dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  box-shadow: var(--shadow-pop);
  animation: sheet-up 300ms var(--ease-out);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.dialog-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border-radius: 12px;
  background: var(--surface-2);
}

.seg-btn {
  flex: 1 1 0;
  min-height: 36px;
  border-radius: 9px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}

.seg-btn.is-active {
  background: var(--surface-3);
  color: var(--text);
}

.field { display: block; margin-bottom: 16px; }

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.field input[type="text"],
.field input[type="number"],
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 0;
  border-radius: 12px;
  outline: 0;
  background: var(--surface-2);
  box-shadow: var(--ring);
  font-size: 16px;
  color: var(--text);
  resize: vertical;
}

.field input:focus,
.field textarea:focus { box-shadow: 0 0 0 1.5px var(--accent); }

.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress { margin-bottom: 16px; }

.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width 200ms var(--ease-out);
}

.progress-text {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 16px);
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}

.toast {
  max-width: 100%;
  padding: 12px 18px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  box-shadow: var(--shadow-elev);
  font-size: 15px;
  font-weight: 500;
  text-align: center;
}

.toast.is-error { background: var(--live); color: #fff; }

/* ---------- Shaka 播放器控件：放大触摸目标 ---------- */
.player-container .shaka-controls-button {
  width: 44px !important;
  height: 44px !important;
}

.player-container .shaka-controls-button svg {
  width: 26px !important;
  height: 26px !important;
}

.player-container .shaka-seek-bar-container { height: 28px !important; }

.player-container .shaka-overflow-menu button,
.player-container .shaka-settings-menu button {
  min-height: 44px !important;
  font-size: 15px !important;
}

.player-container .shaka-current-time,
.player-container .shaka-time-container { font-size: 15px !important; }

/* ---------- 交互动效：只在可悬停设备上做 hover，按压统一 0.96 ---------- */
@media (hover: hover) and (pointer: fine) {
  .source-pill:hover { background: var(--surface-2); }
  .icon-btn:hover { background: var(--surface-2); }
  .group-chip:hover { background: var(--surface-2); }
  .channel-row:hover { background: var(--surface); }
  .channel-row.is-active:hover { background: var(--surface-2); }
  .tab-btn:hover { color: var(--text); }
  .sheet-item:hover { background: var(--surface-2); }
  .btn-primary:hover { background: #e5e5e7; }
  .btn-ghost:hover { background: var(--surface-3); }
  .btn-danger:hover { background: #ff5e55; }
  .group-item:hover { background: var(--surface); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

.source-pill:active,
.icon-btn:active,
.group-chip:active,
.channel-row:active,
.tab-btn:active,
.sheet-item:active,
.btn:active { transform: scale(0.96); transition-duration: 150ms; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 桌面端 ---------- */
@media (min-width: 1024px) {
  #app { padding: 0 24px calc(var(--tabbar-h) + 24px); }

  .toolbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 60px;
    padding: 10px 0;
    background: rgb(0 0 0 / 0.85);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid oklch(1 0 0 / 0.08);
  }

  .source-pill { flex: 0 1 auto; max-width: 280px; }

  .search-toggle,
  .search-cancel { display: none; }

  .search-row {
    display: flex;
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .search-wrap { max-width: 360px; }

  .channel-layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
  }

  .channel-sidebar {
    display: block;
    position: sticky;
    top: 84px;
  }

  .sidebar-title {
    margin-bottom: 8px;
    padding: 0 12px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
  }

  .group-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  .group-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 10px;
    text-align: left;
    transition: background-color 150ms var(--ease-out), transform 150ms var(--ease-out);
  }

  .group-item-name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .group-item-count {
    flex: none;
    font-size: 13px;
    color: var(--muted);
  }

  .group-item.is-active {
    background: var(--surface-2);
    font-weight: 600;
  }

  .group-item.is-active .group-item-count { color: var(--text); }

  .sticky-zone {
    position: sticky;
    top: 76px;
    margin: 0;
    padding: 0 0 4px;
    background: transparent;
  }

  .video-card {
    border-radius: var(--radius-card);
    background: var(--surface);
    padding: 8px;
    box-shadow: var(--shadow-elev);
  }

  .player-container { border-radius: var(--radius-inner); }

  .group-chips { display: none; }

  .channel-row { min-height: 56px; contain-intrinsic-size: 56px; }

  .sheet-overlay { align-items: center; }

  .sheet {
    width: 440px;
    max-height: 80dvh;
    padding: 16px;
    border-radius: 20px;
    animation: sheet-up 300ms var(--ease-out);
  }

  .sheet-handle { display: none; }

  .dialog-overlay { align-items: center; padding: 24px; }

  .dialog {
    width: 480px;
    padding: 20px;
    border-radius: 20px;
  }
}
