/* 视频预览 · 手机优先样式；默认夜间模式，html[data-theme="light"] 切换白昼。 */
:root,
html[data-theme="dark"] {
  --accent: #4caf7d;
  --accent-press: #3d9468;
  --bg: #0f1311;
  --ink: #e8ede9;
  --muted: #9aa89f;
  --card: #1a201c;
  --card-press: #212924;
  --line: #2b332e;
  --danger: #e2726b;
  --topbar-bg: rgba(21, 26, 23, 0.94);
  --input-bg: #121714;
  --cover-bg: #0a0d0b;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

html[data-theme="light"] {
  --accent: #2f6f4e;
  --accent-press: #265a40;
  --bg: #f4f6f4;
  --ink: #1b211d;
  --muted: #616d66;
  --card: #ffffff;
  --card-press: #f0f2f0;
  --line: #e2e7e3;
  --danger: #b3372e;
  --topbar-bg: rgba(255, 255, 255, 0.94);
  --input-bg: #ffffff;
  --cover-bg: #1d2420;
  --shadow: 0 18px 48px rgba(27, 33, 29, 0.12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[v-cloak], .boot { display: none; }

.boot {
  display: block;
  color: var(--muted);
  text-align: center;
  padding-top: 22vh;
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* ---------- 登录页 ---------- */
.login-shell {
  justify-content: center;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  gap: 22px;
}

.brand { text-align: center; }

.brand .logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 20px;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-left: 4px;
}

.brand h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: .02em; }
.brand p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius, 14px);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }

.panel input {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 16px;
  color: var(--ink);
  background: var(--input-bg);
  outline: none;
}

.panel input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

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

.primary {
  height: 46px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  transition: background .15s ease;
}

.primary:active { background: var(--accent-press); }
.primary:disabled { opacity: .6; }

.error {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

.foot-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 54px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  background: var(--topbar-bg);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.brand-text { font-size: 17px; font-weight: 700; }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 13px; max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:active { background: color-mix(in srgb, var(--ink) 8%, transparent); }

.ghost {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  color: var(--muted);
}

.ghost:active { background: var(--card-press); }

/* ---------- 首页列表 ---------- */
.home { flex: 1; padding: 14px 14px calc(24px + env(safe-area-inset-bottom)); }

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  width: 100%;
  display: block;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  transition: transform .12s ease;
}

.card:active { transform: scale(.985); }

.cover {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--cover-bg);
  overflow: hidden;
}

.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .85);
  font-size: 34px;
}

.dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 12px;
  border-radius: 6px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}

.meta { display: block; padding: 12px 14px 14px; }

.card-title {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- 播放页 ---------- */
.player { flex: 1; padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}

.stage video {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
}

.media-error {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .82);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
}

.media-error p { margin: 0; font-size: 15px; }
.media-error .hint { color: rgba(255, 255, 255, .72); font-size: 13px; }
.media-error .primary { height: 40px; padding: 0 22px; }

.detail { padding: 16px 16px 0; }
.detail h1 { margin: 0 0 8px; font-size: 19px; line-height: 1.35; }
.detail .desc { margin: 0 0 10px; color: var(--ink); font-size: 14.5px; }
.detail .attr { margin: 0 0 6px; color: var(--muted); font-size: 12px; }

.save-state {
  margin: 12px 0 0;
  color: var(--accent);
  font-size: 12.5px;
  min-height: 18px;
}

.save-state.warn { color: var(--danger); }

/* ---------- 通用状态 ---------- */
.state {
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.state-title { margin: 0; font-size: 16px; color: var(--ink); font-weight: 600; }
.state .hint { margin: 0; font-size: 13px; }
.state .primary { margin-top: 8px; width: 160px; }

/* ---------- 桌面适配 ---------- */
@media (min-width: 720px) {
  html, body { background: color-mix(in srgb, var(--bg) 92%, #000); }

  html[data-theme="light"], html[data-theme="light"] body { background: #e8ebe8; }

  .shell {
    box-shadow: var(--shadow);
    margin: 24px auto;
    min-height: auto;
    border-radius: 18px;
    overflow: clip;
  }

  .login-shell { min-height: 640px; }

  .home { padding: 18px 18px 28px; }
  .detail { padding: 18px 20px 0; }
}
