:root {
  color-scheme: light;
  --paper: #f4f3ef;
  --surface: #fcfbf8;
  --ink: #24282d;
  --muted: #4e5861;
  --accent: #913b2b;
  --line: #ccc8bf;
  font: 16px/1.58 system-ui, "PingFang TC", "Microsoft JhengHei", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); }
h1,h2,h3,p { margin: 0; }
button,input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.wrap { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-bar { min-height: 57px; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px 14px; padding-block: 7px; }
.brand { display: inline-flex; gap: 10px; align-items: center; font-weight: 750; color: inherit; text-decoration: none; }
.brand img { border-radius: 8px; }
.brand small { color: var(--muted); font-size: .72rem; margin-left: 4px; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 15px; }
.site-nav a { display: inline-flex; min-height: 44px; align-items: center; color: inherit; text-decoration: none; }
.site-account { margin-inline-start: auto; }
.site-account a, .site-account button {
  display: inline-flex; align-items: center; min-height: 44px; padding-inline: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--accent);
  text-decoration: none; white-space: nowrap;
}
.site-account a:hover, .site-account button:hover { border-color: var(--accent); }
.site-nav a[aria-current] { color: var(--accent); text-decoration: underline; text-underline-offset: 5px; }
.intro { margin: 26px 0 21px; }
h1 { font: 700 clamp(2.6rem, 6vw, 4.25rem)/1.12 Georgia, serif; letter-spacing: -.05em; }
.intro p { color: var(--muted); margin-top: 7px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(244px, 280px); gap: 22px; margin-bottom: 34px; align-items: start; }
#lists { display: flex; flex-wrap: wrap; align-items: stretch; gap: 6px; border-bottom: 1px solid var(--line); }
#lists button { background: none; border: 0; padding: 7px 18px; font-weight: 720; }
#lists [aria-current] { background: var(--accent); color: white; }
.feed-info { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 3px 10px; padding: 13px 0; font-size: .8rem; color: var(--muted); }
.feed-info label { white-space: nowrap; margin-inline-start: auto; }
#subscription-settings { padding-block: 12px 4px; }
#subscription-settings select, #subscription-settings button { margin: 4px; }
#subscription-status, #youtube-subscription-note { color: var(--muted); font-size: .85rem; }
#followed-channels { max-width: 26rem; margin-block: 8px; }
#subscription-settings button, .pagination button, .pagination select, .feed-info select {
  min-height: 38px; border: 1px solid var(--line); padding: 4px 8px; background: var(--surface);
}
.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pagination button:disabled { opacity: .55; cursor: default; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 242px), 1fr)); gap: 15px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; }
.preview { position: relative; }
.thumbnail { display: block; aspect-ratio: 16 / 9; width: 100%; object-fit: cover; background: #d3d5d3; }
.play-symbol { position: absolute; inset: 50% auto auto 50%; translate: -50% -50%; display: grid; place-items: center; width: 50px; height: 38px; border-radius: 8px; background: #24282de6; }
.play-symbol::before { content: ""; margin-left: 2px; border-left: 12px solid #fff; border-block: 7px solid transparent; }
.card-body { padding: 12px; display: flex; flex-direction: column; flex-grow: 1; }
.meta { color: var(--muted); font-size: .76rem; overflow-wrap: anywhere; }
.card h3 { margin-top: 6px; font-size: 1rem; overflow-wrap: anywhere; }
.card .play { display: block; padding: 0; border: 0; background: transparent; text-align: start; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.card .play::after { position: absolute; inset: 0; content: ""; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 12px; margin-top: auto; }
.actions button, .rule-list button { border: 1px solid var(--line); background: var(--surface); padding: 2px 6px; font-size: .76rem; }
.actions button { position: relative; }
.actions [aria-pressed=true] { color: var(--accent); border-color: var(--accent); }
.settings { background: var(--surface); border: 1px solid var(--line); padding: 14px; min-width: 0; }
.settings h2 { margin-bottom: 8px; font-size: 1.12rem; }
.settings h3, #keyword-form > label, summary { font-weight: 700; font-size: .92rem; }
.settings p { color: var(--muted); font-size: .77rem; }
.checks label { display: block; margin-bottom: 4px; font-size: .9rem; }
.checks input { accent-color: var(--accent); }
#keyword-form, .channel-rules, .seen-history { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 9px; }
.form-row { display: flex; gap: 5px; margin: 4px 0; }
.form-row input { border: 1px solid var(--line); padding: 4px 6px; min-width: 0; flex: 1; font-size: .82rem; }
.form-row button { border: 1px solid var(--accent); background: var(--accent); color: white; padding: 2px 7px; font-size: .82rem; }
.rule-list { list-style: none; padding: 0; margin: 5px 0 0; }
.rule-list:empty { margin: 0; }
.rule-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: .78rem; margin: 4px 0; }
.rule-list span { min-width: 0; overflow-wrap: anywhere; }
.rule-list button { flex-shrink: 0; }
summary { cursor: pointer; }
.notice { border: 1px solid var(--line); padding: 14px; background: var(--surface); color: var(--muted); }
.video-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; }
.video-header h2 { font-size: 1rem; overflow-wrap: anywhere; }
.video-header button { white-space: nowrap; background: var(--surface); border: 1px solid var(--line); padding: 5px 9px; }
#video-dialog { width: min(880px, calc(100% - 24px)); max-height: calc(100dvh - 24px); padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
#video-dialog::backdrop { background: #1c2025bf; }
#video-player { background: #111; }
#video-player iframe { display: block; width: 100%; aspect-ratio: 16 / 9; min-height: 200px; border: 0; }
body:has(#video-dialog[open]) { overflow: hidden; }
.save-status:not(:empty) { padding-top: 8px; }
@media (max-width: 720px) {
  .wrap { width: calc(100% - 26px); }
  .layout { grid-template-columns: 1fr; gap: 12px; }
  .settings { grid-row: 1; }
}

#topic-settings {
  margin-block: 0.75rem;
}

#topic-settings label {
  display: inline-block;
  margin-inline-end: 0.5rem;
}

#topic {
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1px solid #beb5ab;
  border-radius: 0.55rem;
  padding: 0.45rem 0.75rem;
}
