:root {
  --bg: #f1f3f4; --card: #ffffff; --text: #1f2328; --muted: #5a636b; --line: #dadfe3;
  --accent: #b45309; --accent-text: #ffffff; --link: #1a5fb4; --unread: #ffffff; --read: #f6f7f8; --cur: #fff4e5;
  --danger: #c0392b;
}
:root[data-theme="dark"] {
  --bg: #14171a; --card: #1c2024; --text: #e6e9ec; --muted: #9aa4ad; --line: #2c3238;
  --accent: #f08a2c; --accent-text: #1b1100; --link: #7db3f5; --unread: #1c2024; --read: #171a1d; --cur: #2b2217;
  --danger: #ef6b5b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171a; --card: #1c2024; --text: #e6e9ec; --muted: #9aa4ad; --line: #2c3238;
    --accent: #f08a2c; --accent-text: #1b1100; --link: #7db3f5; --unread: #1c2024; --read: #171a1d; --cur: #2b2217;
    --danger: #ef6b5b;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }
button { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 6px 11px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
button.danger { color: var(--danger); border-color: var(--danger); }
button.icon { padding: 5px 9px; font-size: 16px; line-height: 1; }
button.link { border: 0; background: none; padding: 0; color: var(--link); font-size: 12px; }
input, select { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }
input[type=search] { width: min(340px, 36vw); }
a { color: var(--link); }
.muted { color: var(--muted); font-size: 12.5px; }
.pad { padding: 8px 14px; }
.spacer { flex: 1; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; background: var(--card);
  border-bottom: 1px solid var(--line); padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
.logo { font-weight: 700; font-size: 18px; color: var(--accent); letter-spacing: .2px; margin-right: 6px; }
#status { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: right; }
.reflink { text-decoration: none; font-size: 18px; color: var(--muted); padding: 0 4px; }
#menuToggle { display: none; }

.layout { display: flex; align-items: flex-start; max-width: 1280px; margin: 0 auto; }
#side { width: 260px; flex: none; position: sticky; top: 52px; max-height: calc(100vh - 52px); overflow-y: auto;
  padding: 10px 6px 30px; }
.navrow { display: flex; width: 100%; justify-content: space-between; align-items: center; gap: 8px; text-align: left;
  border: 0; background: none; border-radius: 6px; padding: 6px 10px; }
.navrow:hover { background: var(--card); }
.navrow.sel { background: var(--card); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.navrow span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.navrow.feed { padding-left: 18px; font-size: 13.5px; }
.navrow.infolder { padding-left: 30px; }
.navrow.folder { font-weight: 600; }
.navrow .warn { color: var(--danger); }
.cnt { font-size: 12px; font-weight: 600; color: var(--muted); }
.cnt.has { color: var(--text); }
.navhead { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 10px 4px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.caret { display: inline-block; width: 12px; color: var(--muted); }

#content { flex: 1; min-width: 0; padding: 10px 12px 80px; }
.welcome { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 4px 18px 14px; margin-bottom: 12px; }
.welcome h2 { margin: 12px 0 6px; font-size: 18px; }
.actions { display: flex; gap: 8px; margin: 10px 0 2px; align-items: center; }
.actions.wrap { flex-wrap: wrap; }
.vbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 4px 0 10px; }
.vbar h2 { margin: 0; font-size: 17px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.empty { text-align: center; color: var(--muted); padding: 48px 16px; }
.empty b { color: var(--text); }

.entry { background: var(--unread); border: 1px solid var(--line); border-left: 3px solid transparent; border-radius: 6px;
  margin-bottom: 4px; scroll-margin-top: 62px; }
.entry:not(.unread) { background: var(--read); }
.entry.current { border-left-color: var(--accent); background: var(--cur); }
.entry.open { margin: 10px 0; box-shadow: 0 1px 6px rgba(0,0,0,.12); }
.erow { display: flex; gap: 8px; align-items: baseline; padding: 6px 10px; cursor: pointer; min-width: 0; }
.star { border: 0; background: none; padding: 0 2px; font-size: 17px; line-height: 1; color: var(--muted); align-self: center; }
.star.on { color: #e5a50a; }
.esrc { flex: none; width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; color: var(--muted); }
.entry.unread .esrc { color: var(--text); font-weight: 600; }
.etitle { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry.unread .etitle b { font-weight: 700; }
.entry:not(.unread) .etitle b { font-weight: 500; }
.esnip { color: var(--muted); }
.edate { flex: none; font-size: 12px; color: var(--muted); }
.entry.open .etitle { white-space: normal; }
.entry.open .esnip { display: none; }
.ebody { padding: 4px 18px 14px 18px; border-top: 1px solid var(--line); }
.ebody h3 { margin: 10px 0 2px; font-size: 20px; line-height: 1.25; }
.ebody h3 a { color: var(--text); text-decoration: none; }
.ebody h3 a:hover { text-decoration: underline; }
.byline { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.ecnt { font-size: 15.5px; line-height: 1.6; overflow-wrap: anywhere; max-width: 760px; }
.ecnt img { max-width: 100%; height: auto; border-radius: 4px; }
.ecnt pre { overflow-x: auto; background: var(--read); padding: 10px; border-radius: 6px; }
.ecnt table { display: block; overflow-x: auto; border-collapse: collapse; max-width: 100%; }
.ecnt td, .ecnt th { border: 1px solid var(--line); padding: 4px 8px; }
.ecnt blockquote { margin: 1em 0; padding-left: 14px; border-left: 3px solid var(--line); color: var(--muted); }
.eact { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.more { display: block; width: 100%; margin: 10px 0; padding: 9px; }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text); padding: 16px 18px;
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h3 { margin: 0 0 8px; } dialog h4 { margin: 16px 0 2px; }
dialog label { display: block; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
dialog label input, dialog label select { display: block; width: 100%; margin-top: 3px; color: var(--text); }
.btnlink { border: 1px solid var(--line); border-radius: 6px; padding: 6px 11px; text-decoration: none; color: var(--text); background: var(--card); }
.mrow { display: grid; grid-template-columns: 1fr 120px auto; gap: 6px; align-items: start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mrow .err { grid-column: 1 / -1; color: var(--danger); font-size: 12px; }
.mrow .url { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.keys { border-collapse: collapse; width: 100%; }
.keys td { padding: 4px 6px; border-bottom: 1px solid var(--line); }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font: 12px ui-monospace, monospace; background: var(--read); }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60;
  background: #2b2f33; color: #fff; padding: 10px 14px; border-radius: 8px; max-width: min(92vw, 520px); display: flex; gap: 12px; align-items: center; }
.toast button { background: none; border: 0; color: #ffb866; font-weight: 700; padding: 0; }
.scrim { display: none; }

@media (max-width: 820px) {
  #menuToggle { display: inline-block; }
  .logo { margin-right: 0; }
  input[type=search] { width: auto; flex: 1; min-width: 70px; }
  #status { display: none; }
  #side { position: fixed; z-index: 40; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); max-height: none; background: var(--bg);
    transform: translateX(-102%); transition: transform .18s; padding-top: max(14px, env(safe-area-inset-top)); border-right: 1px solid var(--line); }
  body.menu-open #side { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.4); }
  .esrc { display: none; }
  .erow { flex-wrap: wrap; }
  .etitle { flex-basis: calc(100% - 90px); }
  .ebody { padding: 4px 12px 12px; }
  #subBtn { padding: 6px 9px; }
  .mrow { grid-template-columns: 1fr auto; } .mrow .folder { grid-column: 1; }
}
@media print { .top, #side, .vbar, .eact { display: none !important; } }
@media (max-width: 820px) { .vbar select { flex: 1; min-width: 0; } .vbar h2 { flex-basis: 100%; } .vbar .spacer { display: none; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.chip { border-radius: 999px; padding: 4px 11px; font-size: 13px; }
.chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
#browseList { max-height: 46vh; overflow-y: auto; border-top: 1px solid var(--line); margin-top: 6px; }
#browseSearch { width: 100%; }
.brow { display: flex; gap: 10px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.brow .binfo { flex: 1; min-width: 0; }
.brow .bt { font-weight: 600; }
.brow .bd { color: var(--muted); font-size: 12.5px; }
.brow button { flex: none; min-width: 74px; }
.brow button.done { color: var(--muted); }

.later { border: 0; background: none; padding: 0 2px; font-size: 14px; line-height: 1; align-self: center; opacity: .35; filter: grayscale(1); }
.later.on { opacity: 1; filter: none; }
.savebar { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 10px; }
.savebar input { flex: 1 1 220px; min-width: 0; }
.savebar[hidden] { display: none; }

/* Narrow phones: logo and buttons on the first row, a full-width search box on its own row. */
@media (max-width: 560px) {
  .top { flex-wrap: wrap; row-gap: 6px; }
  .logo { margin-right: auto; }
  #search { order: 10; flex: 1 1 100%; width: 100%; }
}

/* About and FAQ text for search engines and first-time visitors; hidden in the installed app and when printing */
.about { max-width: 760px; margin: 0 auto; padding: 8px 16px 96px; color: var(--text); }
.about h2 { font-size: 1.2rem; margin: 1.4em 0 .4em; }
.about h3 { font-size: 1rem; margin: 1.1em 0 .3em; }
.about p, .about li { color: var(--muted); line-height: 1.55; }
.about ol { padding-left: 1.2em; }
.about details { border-top: 1px solid var(--line); padding: .6em 0; }
.about summary { cursor: pointer; font-weight: 600; color: var(--text); }
.about a { color: inherit; }
@media (display-mode: standalone) { .about { display: none; } }
@media print { .about { display: none !important; } }
/* shown only once the app has drawn its first screen (the app adds .ready), so it never flashes at the top while loading */
html:not(.ready) .about { display: none; }

/* keep the shell invisible until the app has drawn its first screen, so nothing shifts as banners and lists are filled in */
html:not(.ready) body > :not(script):not(style):not(link) { visibility: hidden; }


/* Respect the reduced-motion setting */
@media (prefers-reduced-motion: reduce){*,*::before,*::after{animation-duration:.01ms !important;animation-iteration-count:1 !important;transition-duration:.01ms !important;scroll-behavior:auto !important}}
