/* schnews layout — colors come from themes.css (shared with snotes) */

* { box-sizing: border-box; }

/* font family + size come from fonts.css (--font-ui / --ui-font-size) */
html { font-size: var(--ui-font-size); }

body {
  margin: 0;
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Top bar ─────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--primary);
}
.brand-icon { height: 60px; border-radius: 4px; }

/* Theme-aware logo switching */
.brand-icon-dark { display: none; }
.brand-icon-light { display: inline-block; }

html[data-theme="dark"] .brand-icon-light,
html[data-theme="dracula"] .brand-icon-light,
html[data-theme="nord"] .brand-icon-light,
html[data-theme="tokyo-night"] .brand-icon-light,
html[data-theme="catppuccin"] .brand-icon-light,
html[data-theme="one-dark"] .brand-icon-light,
html[data-theme="sunset"] .brand-icon-light {
  display: none;
}

html[data-theme="dark"] .brand-icon-dark,
html[data-theme="dracula"] .brand-icon-dark,
html[data-theme="nord"] .brand-icon-dark,
html[data-theme="tokyo-night"] .brand-icon-dark,
html[data-theme="catppuccin"] .brand-icon-dark,
html[data-theme="one-dark"] .brand-icon-dark,
html[data-theme="sunset"] .brand-icon-dark {
  display: inline-block;
}
.spacer { flex: 1; }
.topbar-search { flex: 0 1 360px; min-width: 160px; }
.topbar-search input {
  width: 100%;
  padding: 6px 10px;
  border-radius: 16px;
  background: var(--input-bg);
}
.topbar-search input:focus { border-color: var(--primary); outline: none; }
select, input, button {
  font: inherit;
  color: var(--text);
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px 8px;
}
button {
  cursor: pointer;
  background: var(--bg-hover);
}
button:hover { border-color: var(--primary); }
button.primary {
  background: var(--primary-bg);
  border-color: var(--primary-bg);
  color: var(--on-primary);
}

/* ── Three-pane layout ────────────────────────────────── */
.layout {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: var(--sidebar-w, 240px) 7px var(--list-w, 380px) 7px 1fr;
  min-height: 0;
}
.sidebar, .listpane, .reader {
  min-height: 0;
  overflow-y: auto;
}
.reader { padding: 16px 22px; }

/* Reader panel hidden entirely: collapse the grid to sidebar + list. */
body.reader-off .reader,
body.reader-off .col-resizer[data-target="list"] {
  display: none;
}
@media (min-width: 901px) {
  body.reader-off .layout {
    grid-template-columns: var(--sidebar-w, 240px) 7px 1fr;
  }
}

/* ── Column resizers ──────────────────────────────────── */
.col-resizer {
  cursor: col-resize;
  touch-action: none;
  background: linear-gradient(to right, transparent 3px, var(--border) 3px, var(--border) 4px, transparent 4px);
}
.col-resizer:hover, .col-resizer.dragging {
  background: linear-gradient(to right, transparent 2px, var(--primary-bg) 2px, var(--primary-bg) 5px, transparent 5px);
}
body.resizing { user-select: none; cursor: col-resize; }
body.resizing .reader .r-content { pointer-events: none; }

/* ── Sidebar ──────────────────────────────────────────── */
.sidebar { background: var(--surface); padding: 10px 8px; }
.side-heading {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 6px 4px;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.side-heading .grow { flex: 1; }
.node {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.node:hover { background: var(--bg-hover); }
.node.active { background: var(--primary-bg); color: var(--on-primary); }
.node .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.node .count {
  font-size: .8rem;
  color: var(--muted);
  background: var(--bg-hover);
  border-radius: 9px;
  padding: 0 6px;
}
.node.active .count { background: transparent; color: var(--on-primary); }
.node .favicon { width: 16px; height: 16px; flex: 0 0 16px; border-radius: 3px; }
.favicon-fallback {
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 700;
  color: var(--muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 3px;
}
.node .favicon-fallback { width: 16px; height: 16px; flex: 0 0 16px; }
.node .star-toggle { visibility: hidden; background: none; border: none; padding: 0 2px; }
.node:hover .star-toggle, .node.starred .star-toggle { visibility: visible; }
.node .del { visibility: hidden; background: none; border: none; padding: 0 2px; }
.node .topic-refresh { visibility: hidden; background: none; border: none; padding: 0 2px; font-size: .8rem; }
.node:hover .topic-refresh, .node.active .topic-refresh { visibility: visible; }
.node:hover .del { visibility: visible; }
.kids { margin-left: 10px; border-left: 1px solid var(--border); padding-left: 4px; }

.add-topic { display: flex; gap: 4px; padding: 4px 6px; }
.add-topic input { flex: 1; min-width: 0; }
.mini {
  font-size: .8rem;
  padding: 2px 6px;
  border-radius: var(--radius);
  color: var(--muted);
}
.mini:hover { color: var(--primary); }
.node .markall { visibility: hidden; background: none; border: none; padding: 0 2px; font-size: .8rem; }
.node:hover .markall { visibility: visible; }
.node .twisty { width: 10px; font-size: .65rem; color: var(--muted); }
.favicon-fallback.topic { background: var(--primary); color: var(--on-primary); }
.empty.small { font-size: .86rem; padding: 4px 6px; text-align: left; }
.loadmore {
  display: block;
  width: calc(100% - 24px);
  margin: 10px 12px;
  color: var(--muted);
}

/* ── New-articles pill ────────────────────────────────── */
.new-articles {
  position: fixed;
  top: 84px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  background: var(--primary);
  color: var(--on-primary);
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .28);
}
.new-articles:hover { filter: brightness(1.08); }

/* ── Article list ─────────────────────────────────────── */
.listpane { background: var(--bg); }
.list-header {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}
.list-header h2 {
  font-size: 1rem;
  margin: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.article {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.article:hover { background: var(--bg-hover); }
.article.active { background: var(--primary-bg); }
.article.read .a-title { font-weight: 400; color: var(--muted); }
.article.read .a-source, .article.read .a-time { color: var(--muted); }
/* the selected row wins over the read/unread dimming */
.article.active, .article.active .a-title,
.article.active .a-snippet, .article.active .a-source,
.article.active .a-time, .article.active .a-star,
.article.active .count { color: var(--on-primary); }
.a-body { flex: 1; min-width: 0; }
.a-title { font-weight: 600; margin-bottom: 2px; }
.a-snippet {
  color: var(--muted);
  font-size: .86rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.a-snippet mark {
  background: var(--accent-soft, rgba(255, 214, 0, .35));
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}
.a-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: .8rem;
  color: var(--muted);
  margin-top: 3px;
}
.a-star { background: none; border: none; padding: 0 2px; color: var(--secondary); }
.a-favicon { width: 16px; height: 16px; flex: 0 0 16px; border-radius: 3px; margin-top: 2px; }
.empty { padding: 24px 12px; color: var(--muted); text-align: center; }

/* ── Reader ───────────────────────────────────────────── */
.reader h1 { font-size: 1.45rem; margin: 0 0 4px; }
.r-head { border-bottom: 1px solid var(--border); padding-bottom: 10px; margin-bottom: 14px; }
.r-meta { color: var(--muted); font-size: .86rem; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.reader .r-content { line-height: 1.6; max-width: 70ch; }
.reader .r-content img { max-width: 100%; height: auto; }
.reader .r-content pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 10px;
  border-radius: var(--radius);
  overflow-x: auto;
}
.reader .r-content blockquote {
  margin: 0 0 1em;
  padding-left: 12px;
  border-left: 3px solid var(--border);
  color: var(--muted);
}
.reader a { color: var(--primary); }
.r-thread {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 70ch;
}
.r-thread.hidden { display: none; }
.r-thread-loading, .r-thread-error { color: var(--muted); font-size: .86rem; }
.r-thread-error { color: var(--danger, #c0392b); }
.r-thread-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
}
.r-thread-item.current { border-color: var(--primary); }
.r-thread-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.r-thread-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.r-thread-author { font-weight: 600; }
.r-thread-acct { color: var(--muted); font-size: .82rem; }
.r-thread-time { color: var(--muted); font-size: .78rem; margin-left: auto; }
.r-thread-body { line-height: 1.5; }
.r-thread-body img { max-width: 100%; height: auto; }
.r-thread-body a { color: var(--primary); }

.r-foot {
  margin-top: 22px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: .82rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 70ch;
}
.r-foot-row { display: flex; gap: 8px; align-items: center; }
.r-foot-label {
  flex: 0 0 84px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .7rem;
  color: var(--muted);
}
.r-foot-value { min-width: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.r-foot-value a { color: var(--primary); }
.r-foot-source { display: flex; align-items: center; gap: 6px; min-width: 0; }
.r-foot .a-favicon { margin-top: 0; }
.r-foot-url { overflow-wrap: anywhere; }
.r-foot-tag {
  background: var(--primary);
  color: var(--on-primary);
  border-radius: var(--radius);
  padding: 1px 6px;
  font-size: .7rem;
  font-weight: 600;
}
.placeholder { color: var(--muted); }

/* ── Login ────────────────────────────────────────────── */
.login {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
.login.hidden { display: none; }
.login form { display: flex; flex-direction: column; gap: 8px; width: 240px; }
.login h1 { margin: 0; font-size: 1.3rem; color: var(--primary); }
.error { color: var(--danger); min-height: 1em; margin: 0; font-size: .86rem; }
.hidden { display: none !important; }

/* ── Theme selector ────────────────────────────────────── */
.theme-selector { position: relative; }
.theme-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: .93rem; font-family: inherit; cursor: pointer;
  transition: background 0.15s;
}
.theme-btn:hover { background: var(--bg-hover); }
.theme-label { color: var(--muted); white-space: nowrap; }
.font-swatch { font-family: var(--font-ui); font-weight: 700; line-height: 1; }
.chevron { font-size: .65rem; color: var(--muted); }
.theme-popover {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  padding: 10px; min-width: 200px; z-index: 60;
}
.font-selector .theme-popover { min-width: 250px; }
.theme-pop-header {
  font-size: .8rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 8px; padding: 0 4px;
}
.theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.theme-section {
  grid-column: 1 / -1;
  font-size: .8rem; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin: 6px 4px 2px; padding-top: 6px;
  border-top: 1px solid var(--border);
}
.theme-section:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.theme-option {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border: 1px solid transparent; border-radius: 6px;
  background: var(--bg); cursor: pointer; font-family: inherit;
  font-size: .93rem; color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}
.theme-option:hover { border-color: var(--border); }
.theme-option.active { border-color: var(--primary); }
.theme-swatch { display: flex; gap: 2px; flex-shrink: 0; }
.theme-dot { width: 10px; height: 10px; border-radius: 2px; }
.mode-row {
  display: flex; gap: 4px; margin-bottom: 8px;
  background: var(--bg); padding: 3px; border-radius: 8px;
  border: 1px solid var(--border);
}
.mode-btn {
  flex: 1; padding: 5px 0; border: none; border-radius: 6px;
  background: transparent; color: var(--muted); font-family: inherit;
  font-size: .86rem; cursor: pointer; transition: background 0.12s, color 0.12s;
}
.mode-btn.active { background: var(--surface); color: var(--text); }
.font-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.font-option {
  display: flex; align-items: baseline; gap: 8px; width: 100%;
  padding: 5px 8px; border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--text); font-family: inherit;
  text-align: left; cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.font-option:hover { background: var(--bg-hover); }
.font-option.active { border-color: var(--primary); }
.font-option-label {
  flex: 0 0 4.6rem; color: var(--muted);
  font-size: .78rem; letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.font-option-sample {
  flex: 1; min-width: 0; font-size: calc(var(--ui-font-size) * 1.15); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.auto-panel { display: flex; flex-direction: column; gap: 4px; }
.auto-label { font-size: .8rem; color: var(--muted); padding: 0 4px; }

/* ── Icon buttons ──────────────────────────────────────── */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  flex: 0 0 2rem;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--muted);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.icon-btn:hover { color: var(--primary); border-color: var(--primary); }
.mini.primary { background: var(--primary-bg); border-color: var(--primary-bg); color: var(--on-primary); }
.mini.danger:hover { color: var(--danger); border-color: var(--danger); }
#menu-button { display: none; }

/* ── Modals ────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.45);
}
.modal-card {
  display: flex;
  flex-direction: column;
  width: min(440px, 100%);
  max-height: min(85vh, 720px);
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.modal-card.wide { width: min(760px, 100%); }
.modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.modal-head h2 { margin: 0; font-size: 1.05rem; flex: 1; }
.modal-body {
  padding: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Settings form ─────────────────────────────────────── */
.group + .group { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.group-title {
  margin: 0 0 10px;
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
}
.field { display: block; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.field-label { display: block; margin-bottom: 5px; font-size: .9rem; font-weight: 600; }
.field.row .field-label { margin-bottom: 0; }
.field-row { display: flex; align-items: center; gap: 8px; }
.field-row input[type="text"], .field-row input[type="number"] { flex: 1; min-width: 0; }
.field-row input[type="number"] { max-width: 7rem; }
.unit { color: var(--muted); font-size: .86rem; }
.hint { display: block; margin-top: 5px; color: var(--muted); font-size: .8rem; }
.control { margin-top: 2px; }
.switch { flex: 0 0 auto; width: 1.15rem; height: 1.15rem; accent-color: var(--primary); }
.auto-panel { display: flex; flex-direction: column; gap: 4px; }
.auto-panel + .auto-panel { margin-top: 8px; }
.auto-label { font-size: .8rem; color: var(--muted); }

/* ── Keyboard shortcuts help ───────────────────────────── */
.kbd-list { display: flex; flex-direction: column; gap: 14px; }
.kbd-group { display: flex; flex-direction: column; gap: 6px; }
.kbd-row { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.kbd-row > span:last-child { color: var(--text); }
.kbd {
  display: inline-block;
  min-width: 1.4rem;
  padding: 2px 7px;
  text-align: center;
  font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, Consolas, monospace);
  font-size: .78rem;
  color: var(--text);
  background: var(--surface-2, var(--surface));
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
}

/* ── Subscription management ───────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.tab {
  flex: 1;
  padding: 6px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: .9rem;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }

.add-form, .edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  margin-bottom: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.add-form > input { flex: 1 1 12rem; min-width: 0; }
.edit-form input { flex: 1 1 10rem; min-width: 0; }
.cat-select { max-width: 11rem; }

/* full-width row inside a wrapping form, used by the alert scope picker */
.form-wide { flex: 0 0 auto; width: 100%; min-width: 0; }

.opml-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.picker-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border-bottom: 1px solid var(--border);
}
.picker-bar .pick-filter { flex: 1 1 auto; min-width: 0; }
.picker-list { max-height: 16rem; overflow-y: auto; padding: 4px; }
.pick-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px calc(6px + var(--depth, 0) * 1.1rem);
  border-radius: 6px;
  font-size: .88rem;
  cursor: pointer;
}
.pick-row:hover { background: var(--bg-hover); }
.pick-row[hidden] { display: none; }
.pick-row input[type="checkbox"] {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
}
.pick-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-count { flex: 0 0 auto; font-size: .78rem; color: var(--muted); }
.pick-head { font-weight: 600; }
.pick-caret { flex: 0 0 auto; width: 1em; color: var(--muted); }
.pick-group.collapsed > .pick-kids,
.pick-group[hidden] { display: none; }

.rows { display: flex; flex-direction: column; gap: 6px; }
.row {
  padding: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.row-main { display: flex; align-items: center; gap: 8px; }
.row-main .favicon { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 3px; }
.row-text { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-sub {
  color: var(--muted);
  font-size: .8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-error {
  color: var(--danger);
  font-size: .78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-count {
  flex: 0 0 auto;
  font-size: .8rem;
  color: var(--muted);
  background: var(--bg-hover);
  border-radius: 9px;
  padding: 0 7px;
}
.row-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.row-actions .mini { padding: 3px 8px; }

/* ── Mobile ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar, .listpane, .reader { grid-area: 1 / 1; }
  .col-resizer { display: none; }

  #menu-button { display: inline-flex; }

  /* one pane at a time: the feed drawer, the story list, or an open story */
  .sidebar, .reader { display: none; }
  body.nav-open .sidebar { display: block; }
  body.nav-open .listpane { display: none; }
  body.reader-open .reader { display: block; }
  body.reader-open .listpane { display: none; }

  .topbar { padding: 6px 8px; gap: 6px; }
  .brand-icon { height: 30px; }
  .brand { display: none; }
  .topbar-search { flex: 1 1 auto; }
  .theme-label, .font-swatch, .theme-btn .chevron { display: none; }
  .theme-btn, .icon-btn { padding: 4px 8px; }

  /* comfortable touch targets */
  .mini { padding: 6px 10px; font-size: .85rem; }
  .node { padding: 9px 8px; }
  .node .del, .node .markall, .node .topic-refresh { visibility: visible; }
  .article { padding: 11px 12px; }
  .a-star { padding: 4px 8px; }
  .list-header { padding: 8px 10px; }
  .add-topic input, .add-topic button { padding: 8px; }

  .reader { padding: 12px 14px; }
  .reader h1 { font-size: 1.25rem; }
  .reader .r-content { max-width: none; }
  .reader .r-foot { max-width: none; }
  .r-foot-label { flex: 0 0 72px; }
  .reader-back {
    display: inline-flex;
    margin-bottom: 8px;
    font-size: 1rem;
  }

  /* panels take over the screen */
  .modal { padding: 0; align-items: stretch; }
  .modal-card, .modal-card.wide {
    width: 100%;
    max-width: none;
    max-height: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
  }
  .modal-body { padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); }
  .modal-head { padding: 10px 14px; }
  .add-form, .edit-form { flex-direction: column; align-items: stretch; }
  .add-form > input, .edit-form input, .cat-select { max-width: none; width: 100%; }
  .picker-bar { flex-wrap: wrap; }
  .row-actions { gap: 8px; }
  .row-actions .mini { flex: 1 1 auto; text-align: center; }
  .row-title, .row-sub, .row-error { white-space: normal; }
}

@media (min-width: 901px) {
  .reader-back { display: none; }
}

/* keep the layout usable in landscape phones */
@media (max-width: 900px) and (orientation: landscape) {
  .modal { align-items: center; }
  .modal-card { max-height: 92vh; height: auto; }
}
