:root {
  --bg: #3a4cc1; --text: #2B2118; --muted: #6E5F4B; --body: #4A3D2E;
  --visited: #93897B; --border: #D6CAB1; --ctl-hover: #DFD3BA; --accent: #8A3A1E; --error: #A12C1B;
  --serif: 'Newsreader', Georgia, serif;
  --sans: 'Instrument Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #306b9e; --text: #EFE7D6; --muted: #A89A82; --body: #CDBFA5;
    --border: #3A3225; --ctl-hover: #332B21; --accent: #E08A63; --error: #F08A78;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.4 var(--sans); }
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button, label.ctl, a.ctl { cursor: pointer; }
form { margin: 0; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.error { color: var(--error); font-size: 13px; margin: 4px 0; min-height: 1em; }

.shell { max-width: 1100px; margin: 0 auto; padding: 0 20px 80px; min-height: 100vh; }
.wordmark { font: 700 28px/1 var(--serif); letter-spacing: -0.02em; margin: 0; }

input:not([type=checkbox]), select {
  min-height: 44px; padding: 0 10px; background: transparent;
  border: 1px solid var(--border); border-radius: 6px;
}
.primary { min-height: 44px; padding: 0 16px; border: 0; border-radius: 6px; background: var(--text); color: var(--bg); font-weight: 600; }
.primary:hover { background: var(--accent); }

/* login */
#login { display: grid; place-items: center; padding-bottom: 0; }
#login-form { display: grid; gap: 10px; width: min(320px, 100%); }
#login-form .wordmark { margin-bottom: 8px; }

/* header */
#top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; padding: 20px 0 16px; border-bottom: 2px solid var(--text); }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13px; color: var(--muted); }
.ctl { display: inline-flex; align-items: center; min-height: 44px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 13px; text-underline-offset: 4px; }
.ctl:hover:not(:disabled):not(.disabled) { background: var(--ctl-hover); }
.ctl:disabled, .ctl.disabled { opacity: 0.4; cursor: default; }
#feed-filter { display: flex; align-items: center; }
#feed-select { border: 0; font-size: 13px; color: var(--muted); max-width: 52vw; cursor: pointer; }
#feed-select option { color: #000; }

/* manage panel */
#manage-panel { padding: 14px 0; border-bottom: 1px solid var(--border); }
#add-form { display: flex; gap: 8px; }
#add-form input { flex: 1; }
#feed-list { list-style: none; margin: 8px 0; padding: 0; }
#feed-list li { display: flex; align-items: center; gap: 8px; min-height: 32px; font-size: 13px; }
#feed-list .name { flex: 1; min-width: 0; margin: 0; }
#feed-list .name input { width: 100%; min-height: 32px; padding: 0 6px; border-color: transparent; background: transparent; font-size: 13px; text-overflow: ellipsis; }
#feed-list .name input:hover, #feed-list .name input:focus { border-color: var(--border); }
#feed-list li.err .name input { color: var(--error); }
#feed-list .del { min-width: 44px; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tools form { display: flex; align-items: center; gap: 8px; }
.tools input[type=file] { font-size: 13px; padding-top: 9px; }

/* list */
#article-list { margin: 0; padding: 0; list-style: none; }
.row { padding: 16px 0 16px 20px; border-bottom: 1px solid var(--border); }
.body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.title { font: 600 21px/1.25 var(--serif); letter-spacing: -0.01em; text-wrap: pretty; overflow-wrap: anywhere; }
a.title:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
/* "Read" is just a visited link: the browser tracks it, we only pick the color. */
a.title:visited { color: var(--visited); }
.row.active { box-shadow: inset 3px 0 0 var(--accent); }
.domain { font: 11px var(--mono); color: var(--muted); }
.excerpt { margin: 0; font-size: 14px; line-height: 1.5; color: var(--body); text-wrap: pretty;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 13px; color: var(--muted); }
.meta .feed { display: inline-flex; align-items: center; gap: 6px; line-height: 16px; font-weight: 600; color: var(--text); }
.favicon { width: 16px; height: 16px; border-radius: 3px; flex: none; }
.meta a.comments { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.meta a.comments:hover { color: var(--accent); }

#list-empty { padding: 56px 0; text-align: center; color: var(--muted); font: 19px var(--serif); }
#pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding-top: 20px; }
#pager .ctl { font: 12px var(--mono); }
#pager .ctl:hover:not(.disabled):not(.disabled) { color: var(--accent); }
#page-info { font: 11px var(--mono); color: var(--muted); min-width: 9em; text-align: center; }
#count { padding-top: 8px; text-align: center; font: 11px var(--mono); color: var(--muted); }

@media (max-width: 520px) {
  .shell { padding: 0 16px 64px; }
  .title { font-size: 19px; }
  .row { margin: 0 -8px; padding: 10px 8px 10px 16px; }
  #top { margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
  .body { gap: 3px; }
  .head { gap: 0 8px; }
  .meta { gap: 0 8px; }
  #feed-filter { display: flex; align-items: center; }
#feed-select { max-width: 100%; }
}
