:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --text: #121826;
  --muted: #5b6475;
  --border: #e2e6ef;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --hot: #dc2626;
  --free: #059669;
  --free-bg: #d1fae5;
  --hot-bg: #fee2e2;
  --chip-active: #121826;
  --chip-active-text: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1220; --surface: #121a2b; --surface-2: #1a2438; --text: #e6e9f2; --muted: #98a2b8;
    --border: #243049; --accent: #60a5fa; --accent-text: #0b1220; --hot: #f87171; --free: #34d399;
    --free-bg: #064e3b; --hot-bg: #4c1d1d; --chip-active: #e6e9f2; --chip-active-text: #0b1220;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b1220; --surface: #121a2b; --surface-2: #1a2438; --text: #e6e9f2; --muted: #98a2b8;
  --border: #243049; --accent: #60a5fa; --accent-text: #0b1220; --hot: #f87171; --free: #34d399;
  --free-bg: #064e3b; --hot-bg: #4c1d1d; --chip-active: #e6e9f2; --chip-active-text: #0b1220;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h2 { font-size: 20px; margin: 8px 0 4px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; }
.tabs { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.tab {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-weight: 600;
  padding: 6px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.tab.active { background: var(--surface-2); color: var(--text); }
.count:not(:empty) { background: var(--hot); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 12px; margin-left: 2px; }
.btn {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); padding: 6px 12px; border-radius: 8px;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.small { padding: 3px 9px; font-size: 13px; }

main { max-width: 880px; margin: 0 auto; padding: 12px 16px 64px; }
.toolbar { display: flex; gap: 8px; }
.toolbar select, .toolbar input, .card select {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; min-width: 0;
}
.toolbar input { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 4px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 11px; font: inherit; font-size: 13px; cursor: pointer;
}
.chip.active { background: var(--chip-active); color: var(--chip-active-text); border-color: var(--chip-active); }
.chip .n { opacity: .6; margin-left: 3px; }
.status { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.item.hot { border-left: 3px solid var(--hot); }
.item-head {
  width: 100%; display: flex; gap: 10px; align-items: flex-start; text-align: left;
  border: 0; background: transparent; color: inherit; font: inherit; padding: 10px 12px; cursor: pointer;
}
.badges { display: flex; flex-direction: column; gap: 2px; font-size: 16px; line-height: 1.2; padding-top: 1px; }
.text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.headline {
  color: var(--muted); font-size: 14px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.score { font-weight: 700; font-size: 13px; color: var(--text); background: var(--surface-2); border-radius: 6px; padding: 0 6px; }
.item.hot .score { background: var(--hot-bg); color: var(--hot); }
.tag-free { color: var(--free); background: var(--free-bg); border-radius: 6px; padding: 0 6px; font-weight: 700; font-size: 12px; }

.item-head.static { cursor: default; }
.item-body { padding: 0 14px 14px 40px; border-top: 1px solid var(--border); }
.item-body h4 { margin: 12px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.item-body ul, .item-body ol { margin: 0; padding-left: 20px; }
.item-body li { margin: 2px 0; }
.free-box { margin-top: 12px; background: var(--free-bg); color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 14px; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.detail { background: var(--surface-2); border-radius: 8px; padding: 4px 12px 10px; margin-top: 6px; }
.detail summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.sources { font-size: 13px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.thumb { display: block; width: 100%; max-width: 360px; border-radius: 8px; margin-top: 12px; aspect-ratio: 16/9; object-fit: cover; background: var(--surface-2); }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin: 10px 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; }
.prop-status { font-size: 12px; font-weight: 700; border-radius: 6px; padding: 0 6px; background: var(--surface-2); }

@media (max-width: 560px) {
  .brand span, .lbl { display: none; }
  .topbar { gap: 8px; }
  .item-body { padding-left: 14px; }
  .title { white-space: normal; }
}
