:root {
  --bg: #0D1117; --bar: #10151C; --panel: #151B23; --line: #27303B; --line2: #303A47;
  --text: #E7EAEE; --soft: #C3CAD3; --muted: #9AA4B1; --accent: #7FD6C8; --accent-hi: #B4EDE3;
  --hover: #1D242E; --sel: #263140;
  --crit: #FF9C8F; --crit-bg: #3A1D1C; --high: #F3B75A; --med: #A9C4F5;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-hi); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* header */
.top { background: var(--bar); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1400px; margin: 0 auto; padding: 12px 24px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 19px; letter-spacing: -0.01em; }
.brand svg { color: var(--accent); }
.brand:hover { color: var(--text); }
.search { flex: 1 1 220px; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; outline: none; }
.search:focus-within { border-color: var(--accent); }
.lang { margin-left: 0; display: flex; height: 44px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.lang button { min-width: 48px; padding: 0 12px; border: 0; background: transparent; color: var(--soft); font-weight: 500; font-size: 14px; }
.lang button[aria-pressed="true"] { background: var(--text); color: var(--bg); }

/* layout */
.page { max-width: 1400px; margin: 0 auto; padding: 24px; }
.cols { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.left, .right { display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.panel h2 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
h2.label { margin-bottom: 8px; }
.notice { margin-bottom: 16px; padding: 10px 14px; border: 1px dashed var(--line2); border-radius: 8px; color: var(--soft); font-size: 14px; }

/* lists of filter rows */
.list { display: flex; flex-direction: column; gap: 2px; }
.row { min-height: 44px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--text); font-weight: 500; font-size: 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; width: 100%; }
.row:hover { background: var(--hover); }
.row[aria-pressed="true"] { background: var(--sel); }
.row .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .n { font-size: 13px; color: var(--muted); flex: none; }
.groups { max-height: 420px; overflow-y: auto; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
details > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; cursor: default; }
details > summary::-webkit-details-marker { display: none; }
#groupsummary { display: none; font-size: 13px; }
.dims { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.dims button { min-height: 44px; border-radius: 8px; border: 1px solid var(--line2); background: transparent; color: var(--soft); font-weight: 500; font-size: 14px; }
.dims button:last-child:nth-child(odd) { grid-column: span 2; }
.dims button[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }

/* feed */
.feed-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; margin-bottom: 14px; }
.feed-head h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
#stories { display: flex; flex-direction: column; gap: 14px; }
.day { margin-top: 10px; font-size: 17px; font-weight: 600; }
.day span { font-weight: 400; font-size: 13px; color: var(--muted); }
.story { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 22px; display: flex; flex-direction: column; gap: 8px; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--muted); }
.topic { font-weight: 600; color: var(--med); }
.topic.hot { color: var(--high); }
.badge { padding: 1px 6px; border: 1px solid var(--line2); border-radius: 4px; font-size: 11px; color: var(--soft); }
.badge.top { border: 0; padding: 3px 8px; border-radius: 6px; background: var(--crit-bg); color: var(--crit); font-weight: 600; font-size: 12px; letter-spacing: 0.04em; }
.badge.new { border-color: var(--accent); color: var(--accent); }
.story h3 { font-size: 18px; font-weight: 600; line-height: 1.3; }
.story h3 a { color: var(--text); text-decoration: none; }
.story h3 a:hover { color: var(--accent-hi); text-decoration: underline; }
.story p { color: var(--soft); max-width: 75ch; overflow-wrap: anywhere; }
.story.lead { padding: 28px; gap: 12px; }
.story.lead h3 { font-size: 30px; line-height: 1.15; letter-spacing: -0.02em; max-width: 26ch; }
.story.lead p { font-size: 17px; line-height: 1.6; }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; }
.foot a { padding: 6px 0; }
.tag { padding: 3px 8px; border: 1px solid var(--line2); border-radius: 6px; color: var(--soft); background: transparent; font-size: 12px; }
button.tag:hover { border-color: var(--muted); }
.tag.cve { font-family: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace; }
.empty { padding: 24px; border: 1px dashed var(--line2); border-radius: 12px; color: var(--muted); }
.more { min-height: 44px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--text); font-weight: 500; }
.more:hover { background: var(--hover); }

/* right column */
.sources { list-style: none; margin: 8px 0 0; padding: 0; font-size: 14px; }
.sources li { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--line); }
.sources .bad { color: var(--crit); }

/* tablet: right column drops below */
@media (max-width: 1150px) {
  .cols { grid-template-columns: 230px minmax(0, 1fr); }
  .right { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .right .panel { flex: 1 1 280px; }
}
/* phone: single column, period as chips, groups collapsed */
@media (max-width: 760px) {
  .top { position: static; }
  .top-in { padding: 10px 16px; gap: 10px 12px; }
  .brand span { font-size: 17px; }
  .search { order: 3; flex-basis: 100%; }
  .page { padding: 16px; }
  .cols { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .left { gap: 12px; }
  .left .panel:first-child { background: transparent; border: 0; padding: 0; }
  .left .panel:first-child .label { display: none; }
  .periods { flex-direction: row; gap: 8px; overflow-x: auto; margin: 0 -16px; padding: 0 16px 2px; }
  .periods .row { width: auto; flex: none; border: 1px solid var(--line2); border-radius: 22px; padding: 0 16px; }
  .periods .row[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
  .periods .row[aria-pressed="true"] .n { color: var(--bg); }
  details > summary { cursor: pointer; margin-bottom: 0; min-height: 44px; }
  details[open] > summary { margin-bottom: 8px; }
  #groupsummary { display: inline; }
  .groups { max-height: 300px; }
  .feed-head h1 { font-size: 20px; }
  .story { padding: 16px 18px; }
  .story h3 { font-size: 17px; }
  .story.lead { padding: 20px 18px; }
  .story.lead h3 { font-size: 24px; }
  .story.lead p { font-size: 15px; }
}

/* source editor (only shown when the local server is running) */
.srcadmin { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.btns .more { padding: 0 14px; font-size: 14px; }
.more.primary { background: var(--text); border-color: var(--text); color: var(--bg); }
.more:disabled { opacity: 0.5; cursor: default; }
#srcform { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
#srcform[hidden] { display: none; }
#srclist li { align-items: center; }
#srclist .name { min-width: 0; overflow-wrap: anywhere; }
.remove { flex: none; min-width: 44px; min-height: 44px; border: 1px solid var(--line2); border-radius: 8px; background: transparent; color: var(--crit); font-size: 13px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input, .field select { height: 44px; padding: 0 10px; border: 1px solid var(--line2); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; font-size: 14px; min-width: 0; }

.langsw { margin-left: auto; }
@media (max-width: 760px) { .top-in .lang { flex: none; } }

/* the hidden attribute must win over the display rules above */
[hidden] { display: none !important; }
