:root {
  --bg: #f6f4ef;
  --surface: #ffffff;
  --text: #22251f;
  --muted: #6d7268;
  --line: #e4e1d8;
  --accent: #3f5a4c;
  --accent-text: #ffffff;
  --error: #9b3b2e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161816;
    --surface: #1f221f;
    --text: #e6e7e1;
    --muted: #9a9f95;
    --line: #2f332e;
    --accent: #8fb39f;
    --accent-text: #132019;
    --error: #e59a8c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main {
  max-width: 640px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}
a { color: inherit; }
h1 { font-size: 1.4rem; font-weight: 600; margin: 0; }
h2 { font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 32px 0 10px; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 4px; }
.meta { color: var(--muted); font-size: 0.9rem; margin: 4px 0 16px; }
.error { color: var(--error); font-size: 0.9rem; }
.empty { color: var(--muted); padding: 48px 0; text-align: center; }

.link { background: none; border: 0; padding: 8px 0; font: inherit; color: var(--muted); cursor: pointer; text-decoration: none; }
.link:hover { color: var(--text); }
.btn {
  font: inherit; font-size: 0.95rem; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
}
.btn.quiet { background: transparent; color: var(--text); border-color: var(--line); }
.btn:disabled { opacity: 0.5; cursor: default; }

/* Video list */
.videos { list-style: none; margin: 0; padding: 0; }
.videos li + li { border-top: 1px solid var(--line); }
.videos a { display: flex; gap: 12px; align-items: center; padding: 14px 0; text-decoration: none; }
.videos img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; flex: none; background: var(--line); }
.v-title { display: block; font-weight: 500; }
.v-channel { display: block; color: var(--muted); font-size: 0.875rem; margin-top: 2px; }

/* Watch page */
.player-wrap { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 8px; overflow: hidden; margin: 4px 0 14px; }
.player-wrap iframe, .player-wrap > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.watch-title { font-size: 1.1rem; font-weight: 600; margin: 0; text-transform: none; letter-spacing: 0; color: var(--text); }

/* Settings */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row small { display: block; color: var(--muted); }
.row .grow { min-width: 0; flex: 1; }
.row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
input[type="time"], input[type="search"] {
  font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
}
input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
form.add { display: flex; gap: 8px; margin-bottom: 8px; }
form.add input { flex: 1; min-width: 0; }
.match { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; }
.match + .match { border-top: 1px solid var(--line); }
.match img { width: 48px; height: 48px; border-radius: 50%; flex: none; background: var(--line); }
.match .desc { color: var(--muted); font-size: 0.85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin: 2px 0 0; }
details summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; padding: 8px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
