:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #15191e;
  --muted: #6b7380;
  --line: #e3e6ea;
  --chip: #eceef1;
  --chip-on: #15191e;
  --chip-on-text: #ffffff;
  --accent: #0b7a53;
  --hot: #d9480f;
  --warm: #e8a317;
  --error: #c92a2a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a;
    --card: #171d24;
    --text: #e8ebef;
    --muted: #8a93a0;
    --line: #262e38;
    --chip: #222a33;
    --chip-on: #e8ebef;
    --chip-on-text: #0f141a;
    --accent: #3ec48e;
    --hot: #ff7a45;
    --warm: #f2c14e;
    --error: #ff6b6b;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  -webkit-text-size-adjust: 100%;
}

button { font: inherit; color: inherit; }
a { color: var(--accent); }

/* login */
.screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
#login-form { width: 100%; max-width: 320px; display: grid; gap: 12px; }
#login-form h1 { margin: 0 0 8px; font-size: 24px; }
#login-form input, #login-form button {
  padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-size: 16px; color: var(--text);
}
#login-form button { background: var(--chip-on); color: var(--chip-on-text); border: 0; font-weight: 600; }
.error { color: var(--error); min-height: 1.5em; margin: 0; font-size: 14px; }

/* header */
.top {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--line);
}
.bar { display: flex; align-items: center; gap: 4px; padding: 8px 12px 4px 16px; }
.bar h1 { flex: 1; margin: 0; font-size: 20px; cursor: pointer; }
.icon {
  width: 40px; height: 40px; display: grid; place-items: center; border: 0; background: none;
  font-size: 20px; color: var(--text); text-decoration: none; border-radius: 10px;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips button {
  flex: none; border: 0; background: var(--chip); padding: 6px 12px; border-radius: 999px; font-size: 14px; white-space: nowrap;
}
.chips.tags button { padding: 4px 10px; font-size: 13px; }
.chips button.on { background: var(--chip-on); color: var(--chip-on-text); }

/* list */
main { padding: 8px 12px; display: grid; gap: 8px; max-width: 720px; margin: 0 auto; }
.card {
  background: var(--card); border-radius: 12px; padding: 12px 14px; border-left: 3px solid transparent;
  display: grid; grid-template-columns: 1fr auto; gap: 0 12px; cursor: pointer;
}
.card.s5 { border-left-color: var(--hot); }
.card.s4 { border-left-color: var(--warm); }
.card.read h2, .card.read p { color: var(--muted); }
.card .meta { grid-column: 1 / -1; }
.card h2, .card p { grid-column: 1; min-width: 0; overflow-wrap: anywhere; }
.card h2 { margin: 2px 0 2px; font-size: 16px; line-height: 1.4; font-weight: 600; }
.card p { margin: 0; font-size: 14px; color: var(--text); opacity: 0.85; }
.card img.thumb { width: 88px; height: 50px; object-fit: cover; border-radius: 6px; grid-row: 2 / span 2; grid-column: 2; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 12px; color: var(--muted); }
.meta .src { font-weight: 600; color: var(--text); opacity: 0.8; }
.tag { background: var(--chip); border-radius: 4px; padding: 0 6px; }
.star { color: var(--warm); }
.status { text-align: center; color: var(--muted); font-size: 14px; padding: 12px; margin: 0; }
#sentinel { height: 1px; }

/* sheets */
.sheet {
  position: fixed; inset: 0; z-index: 10; overflow-y: auto; background: var(--bg);
  padding: calc(env(safe-area-inset-top) + 8px) 16px calc(env(safe-area-inset-bottom) + 32px);
}
.sheet .bar { padding: 0 0 8px; }
.sheet .bar button { border: 0; background: none; font-size: 17px; color: var(--accent); padding: 8px 0; }
.sheet .bar .spacer { flex: 1; }
.sheet article { max-width: 720px; margin: 0 auto; }
.sheet h2 { font-size: 21px; line-height: 1.4; margin: 8px 0; }
.sheet .summary { font-size: 16px; margin: 0 0 16px; }
.analysis { background: var(--card); border-radius: 12px; padding: 12px 14px; margin: 0 0 16px; font-size: 15px; }
.analysis h3 { font-size: 15px; margin: 10px 0 2px; color: var(--accent); }
.analysis h3:first-child { margin-top: 0; }
.analysis p { margin: 0 0 4px; }
.analysis .muted, .muted { color: var(--muted); }
details { background: var(--card); border-radius: 12px; padding: 10px 14px; margin: 0 0 16px; }
details summary { cursor: pointer; color: var(--muted); font-size: 14px; }
details .original { white-space: pre-wrap; word-break: break-word; font-size: 15px; margin: 8px 0 0; }
details h3 { font-size: 16px; margin: 8px 0 0; }
.open-link { display: inline-block; padding: 10px 16px; border-radius: 10px; background: var(--chip); text-decoration: none; color: var(--text); }
.button {
  border: 0; border-radius: 10px; padding: 10px 14px; background: var(--chip); font-size: 15px; cursor: pointer; margin: 4px 8px 4px 0;
}
.button.primary { background: var(--chip-on); color: var(--chip-on-text); }
.section { background: var(--card); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; }
.section h3 { margin: 0 0 8px; font-size: 16px; }
.section ul { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.section li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-top: 1px solid var(--line); }
.section li:first-child { border-top: 0; }
.ok { color: var(--accent); }
.bad { color: var(--error); }
.hint { font-size: 14px; color: var(--muted); margin: 4px 0; }
