/* ─── Color Scheme ───────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root {
    --bg:         #100c10;
    --fg:         #eeddea;
    --accent:     #ffb5cf;
    --dim:        #a08890;
    --border:     #2e1828;
    --sel-bg:     #3e2030;
    --sel-fg:     #ffd8e8;
    --bar-bg:     #180d14;
    --hover-bg:   #1e1018;
    --outer-bg:   #0b0709;
    --overlay-bg: rgba(8, 4, 7, 0.88);
    --shadow:     rgba(0, 0, 0, 0.65);
  }
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:         #fef7f9;
    --fg:         #1a0c14;
    --accent:     #cc3c68;
    --dim:        #907080;
    --border:     #f0ccd8;
    --sel-bg:     #ffe0eb;
    --sel-fg:     #80102c;
    --bar-bg:     #f8e8ef;
    --hover-bg:   #fef0f4;
    --outer-bg:   #f5dfe9;
    --overlay-bg: rgba(20, 10, 14, 0.45);
    --shadow:     rgba(0, 0, 0, 0.14);
  }
}

/* ─── Theme overrides (set by :theme command) ────────── */

html[data-theme="bongo-dark"] {
  --bg:         #100c10;
  --fg:         #eeddea;
  --accent:     #ffb5cf;
  --dim:        #a08890;
  --border:     #2e1828;
  --sel-bg:     #3e2030;
  --sel-fg:     #ffd8e8;
  --bar-bg:     #180d14;
  --hover-bg:   #1e1018;
  --outer-bg:   #0b0709;
  --overlay-bg: rgba(8, 4, 7, 0.88);
  --shadow:     rgba(0, 0, 0, 0.65);
}

html[data-theme="bongo-light"] {
  --bg:         #fef7f9;
  --fg:         #1a0c14;
  --accent:     #cc3c68;
  --dim:        #907080;
  --border:     #f0ccd8;
  --sel-bg:     #ffe0eb;
  --sel-fg:     #80102c;
  --bar-bg:     #f8e8ef;
  --hover-bg:   #fef0f4;
  --outer-bg:   #f5dfe9;
  --overlay-bg: rgba(20, 10, 14, 0.45);
  --shadow:     rgba(0, 0, 0, 0.14);
}

html[data-theme="catppuccin-mocha"] {
  --bg:         #1e1e2e;
  --fg:         #cdd6f4;
  --accent:     #cba6f7;
  --dim:        #6c7086;
  --border:     #313244;
  --sel-bg:     #45475a;
  --sel-fg:     #cdd6f4;
  --bar-bg:     #181825;
  --hover-bg:   #27273a;
  --outer-bg:   #11111b;
  --overlay-bg: rgba(17, 17, 27, 0.90);
  --shadow:     rgba(0, 0, 0, 0.60);
}

html[data-theme="catppuccin-latte"] {
  --bg:         #eff1f5;
  --fg:         #4c4f69;
  --accent:     #8839ef;
  --dim:        #9ca0b0;
  --border:     #ccd0da;
  --sel-bg:     #ccd0da;
  --sel-fg:     #4c4f69;
  --bar-bg:     #e6e9ef;
  --hover-bg:   #dce0e8;
  --outer-bg:   #cdd0d8;
  --overlay-bg: rgba(76, 79, 105, 0.35);
  --shadow:     rgba(0, 0, 0, 0.10);
}

html[data-theme="nord"] {
  --bg:         #2e3440;
  --fg:         #eceff4;
  --accent:     #88c0d0;
  --dim:        #4c566a;
  --border:     #3b4252;
  --sel-bg:     #434c5e;
  --sel-fg:     #eceff4;
  --bar-bg:     #242933;
  --hover-bg:   #353d4c;
  --outer-bg:   #1e2430;
  --overlay-bg: rgba(46, 52, 64, 0.90);
  --shadow:     rgba(0, 0, 0, 0.60);
}

html[data-theme="rose-pine-moon"] {
  --bg:         #232136;
  --fg:         #e0def4;
  --accent:     #c4a7e7;
  --dim:        #6e6a86;
  --border:     #393552;
  --sel-bg:     #44415a;
  --sel-fg:     #e0def4;
  --bar-bg:     #1f1d2e;
  --hover-bg:   #2a273f;
  --outer-bg:   #191724;
  --overlay-bg: rgba(35, 33, 54, 0.90);
  --shadow:     rgba(0, 0, 0, 0.60);
}

html[data-theme="rose-pine-dawn"] {
  --bg:         #faf4ed;
  --fg:         #575279;
  --accent:     #907aa9;
  --dim:        #9893a5;
  --border:     #f2e9e1;
  --sel-bg:     #dfdad9;
  --sel-fg:     #575279;
  --bar-bg:     #f4ede8;
  --hover-bg:   #fffaf3;
  --outer-bg:   #ede8e0;
  --overlay-bg: rgba(87, 82, 121, 0.30);
  --shadow:     rgba(0, 0, 0, 0.12);
}

/* ─── Font size (controlled by :font command) ─────── */

:root { --fs: 20px; }
html  { font-size: var(--fs); }

/* ─── Screen-reader skip link ────────────────────────── */

.sr-skip {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.sr-skip:focus {
  position: fixed;
  top: 0; left: 0;
  width: auto; height: auto;
  overflow: visible;
  background: var(--accent);
  color: var(--bg);
  padding: 0.4em 0.9em;
  font-size: 0.85rem;
  z-index: 9999;
  text-decoration: none;
}

/* ─── Reset ──────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  overflow: hidden;
}

body {
  height: 100%;
  overflow: hidden;
  background: var(--outer-bg);
  color: var(--fg);
  font-family: 'Noto Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code',
               'Consolas', 'Menlo', 'Courier New', monospace;
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.hidden { display: none !important; }

/* Hide touch-only UI by default (desktop) */
.readme-touch,
.readme-note-touch,
.mobile-search-btn { display: none; }

/* ─── Shell (outer window) ───────────────────────────── */

.shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

/* ─── Bars ───────────────────────────────────────────── */

.tui-bar {
  flex-shrink: 0;
  height: 1.8em;
  padding: 0 0.6em;
  background: var(--bar-bg);
  display: flex;
  align-items: center;
  gap: 0.6em;
  user-select: none;
}


.bar-title {
  color: var(--accent);
  font-weight: bold;
  margin-top: .5em;
  letter-spacing: 0.04em;
  cursor: pointer;
}


/* ─── Content area ───────────────────────────────────── */

.tui-content {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
  padding: 0.3em 0.4em;
  gap: 0;
  background: var(--bar-bg);
}

/* ─── Sidebar (in-flow panel) ────────────────────────── */

.tui-sidebar {
  flex-shrink: 0;
  width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 1px solid transparent;
  border-radius: 8px;
  box-shadow: none;
  margin-right: 0;
  transition: width         0.12s cubic-bezier(0.4, 0, 0.2, 1),
              margin-left   0.12s cubic-bezier(0.4, 0, 0.2, 1),
              margin-right  0.12s cubic-bezier(0.4, 0, 0.2, 1),
              border-color  0s    0.12s;
}

.tui-sidebar.open {
  width: 320px;
  border-color: var(--border);
  margin-left: 0.25em;
  margin-right: 0.5em;
  transition: width         0.12s cubic-bezier(0.4, 0, 0.2, 1),
              margin-left   0.12s cubic-bezier(0.4, 0, 0.2, 1),
              margin-right  0.12s cubic-bezier(0.4, 0, 0.2, 1),
              border-color  0s    0s;
}

.sidebar-pane {
  flex: 1;
  background: var(--bg);
  border-radius: 8px;
  padding: 0.5em 0 1em;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-section {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  padding: 0.8em 0.8em 0.25em;
  user-select: none;
}

.sidebar-section-nav { cursor: pointer; }
.sidebar-section-nav:hover { color: var(--fg); }

.sidebar-item {
  --depth: 0;
  padding: 0.22em 0.5em 0.22em calc(0.7em + var(--depth) * 0.9em);
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  width: 100%;
  box-sizing: border-box;
}

.sidebar-toggle {
  color: var(--dim);
  font-size: 0.72em;
  margin-right: 0.2em;
  display: inline-block;
  width: 0.9em;
}

.sidebar-item:hover       { background: var(--fg); color: var(--sel-bg); }
.sidebar-item:hover .sidebar-toggle { color: var(--sel-bg); }
.sidebar-item.active      { color: var(--sel-fg); font-weight: bold; }
.sidebar-item.cursor      { background: var(--hover-bg); color: var(--sel-fg); }
.sidebar-item.active.cursor { background: var(--hover-bg); color: var(--sel-fg); font-weight: bold; }

/* ─── Main pane ──────────────────────────────────────── */

.tui-pane {
  flex: 1;
  overflow-y: auto;
  padding: 1.4em 1.2em 1em;
  border: 1px solid var(--border);
  min-width: 0;
  background: var(--bg);
  border-radius: 8px;
}

/* ─── Page box (CSS border + floating label) ─────────── */

.page-box {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 1.1em 0em 1.2em;
}

.box-label {
  position: absolute;
  top: -0.62em;
  left: 0.75em;
  background: var(--bg);
  padding: 0 0.35em;
  color: var(--accent);
  font-weight: bold;
  font-size: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  line-height: 1.3;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}

.box-inner {
  padding: 1.2em 1em 0.9em;
}

/* ─── Journal feed ───────────────────────────────────── */

.feed {
  display: flex;
  flex-direction: column;
  gap: 1em;
}

.entry {
  display: flex;
  gap: 0.8em;
  align-items: flex-start;
  cursor: pointer;
  padding: 0.2em 0.4em;
  margin: 0 -0.4em;
  border-radius: 4px;
}

.entry:hover                { background: var(--fg); }
.entry:hover .entry-date    { color: var(--bg); opacity: 0.7; }
.entry:hover .entry-icon    { color: var(--bg); }
.entry:hover .entry-title   { color: var(--bg); }
.entry:hover .entry-text    { color: var(--bg); opacity: 0.85; }

.entry-cursor               { background: var(--hover-bg); }

.entry-icon {
  color: var(--dim);
  font-size: 0.7em;
  margin-right: 0.3em;
}

.entry-date {
  font-size: 0.7rem;
  color: var(--dim);
  flex-shrink: 0;
  padding-top: 0.1em;
  min-width: 6em;
}

.entry-title {
  color: var(--fg);
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 0.2em;
}

.entry-text {
  color: var(--dim);
  font-size: 0.75rem;
  line-height: 1.65;
}

.entry-tags { display: flex; flex-wrap: wrap; gap: 0.3em; margin-top: 0.35em; }
.tag { font-size: 0.6rem; color: var(--dim); border: 1px solid var(--border); border-radius: 2px; padding: 0 0.4em; cursor: pointer; user-select: none; }
.tag:hover, .tag-active { color: var(--accent); border-color: var(--accent); }

.filter-bar { font-size: 0.68rem; color: var(--dim); margin-bottom: 0.6em; }
.filter-clear { color: var(--accent); cursor: pointer; }
.filter-clear:hover { text-decoration: underline; }
.feed-empty { padding: 0.3em 0; }

.feed-rule  { border: none; border-top: 1px solid var(--border); margin: 0.7em 0; }
.feed-meta  { color: var(--dim); font-size: 0.65rem; margin-top: 0.4em; display: flex; justify-content: space-between; align-items: center; }

.journal-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.6em;
  font-size: 0.68rem;
  user-select: none;
}

.page-btn         { color: var(--accent); cursor: pointer; }
.page-btn:hover   { text-decoration: underline; }
.page-btn.disabled { color: var(--dim); cursor: default; }
.page-btn.disabled:hover { text-decoration: none; }
.page-info        { color: var(--dim); }

.rss-badge {
  font-size: 0.6rem;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 1px 6px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.rss-badge:hover {
  background: var(--accent);
  color: var(--bg);
  text-decoration: none;
}

/* ─── Journal entry detail ───────────────────────────── */

.entry-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1em;
  margin-bottom: 0.5em;
}

.back-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0.1em 0.5em;
  flex-shrink: 0;
}

.back-btn:hover { background: var(--sel-bg); text-decoration: none; }

.entry-summary {
  color: var(--dim);
  font-size: 0.8rem;
  font-style: italic;
  margin: 0.6em 0 1.2em;
  line-height: 1.6;
}

.entry-content {
  font-size: 0.85rem;
  line-height: 1.8;
  color: var(--fg);
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4 { color: var(--accent); font-weight: bold; margin: 1.2em 0 0.4em; }
.entry-content h1 { font-size: 1rem; }
.entry-content h2 { font-size: 0.95rem; }
.entry-content h3,
.entry-content h4 { font-size: 0.88rem; }
.entry-content h1::before { content: '# ';   color: var(--dim); font-weight: normal; }
.entry-content h2::before { content: '## ';  color: var(--dim); font-weight: normal; }
.entry-content h3::before { content: '### '; color: var(--dim); font-weight: normal; }
.entry-content h4::before { content: '#### '; color: var(--dim); font-weight: normal; }

.entry-content p          { margin-bottom: 0.75em; }
.entry-content p:last-child { margin-bottom: 0; }
.entry-content a          { color: var(--accent); }
.entry-content a:hover    { background: var(--sel-bg); color: var(--sel-fg); border-radius: 2px; padding: 0 0.1em; text-decoration: none; }
.entry-content strong     { color: var(--accent); }
.entry-content em         { color: var(--dim); font-style: italic; }

.entry-content img {
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin: 0.8em 0;
}

.entry-content code {
  color: var(--accent);
  font-size: 0.88em;
  background: var(--hover-bg);
  padding: 0.05em 0.3em;
  border-radius: 3px;
}

.entry-content pre {
  background: var(--bar-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.8em 1em;
  overflow-x: auto;
  margin: 0.8em 0;
}

.entry-content pre code { background: none; padding: 0; color: var(--fg); }

.entry-content ul,
.entry-content ol         { margin: 0.4em 0 0.6em 1.5em; }
.entry-content li         { margin-bottom: 0.2em; }
.entry-content li ul,
.entry-content li ol      { margin-top: 0.2em; margin-bottom: 0; }

.entry-content blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 0.8em;
  color: var(--dim);
  margin: 0.8em 0;
  font-style: italic;
}

.entry-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1em 0;
}

.md-spacer { height: 1em; }

.entry-content mark {
  background: var(--sel-bg);
  color: var(--sel-fg);
  border-radius: 2px;
  padding: 0 0.15em;
}

.entry-content del {
  color: var(--dim);
  text-decoration: line-through;
}

.entry-content .footnotes { margin-top: 2em; }
.fn-list { list-style: decimal; padding-left: 1.5em; font-size: 0.78rem; color: var(--dim); }
.fn-list li { margin-bottom: 0.3em; }
.fn-ref  { color: var(--accent); font-size: 0.7em; vertical-align: super; line-height: 0; text-decoration: none; }
.fn-ref:hover { text-decoration: underline; }
.fn-back { color: var(--dim); text-decoration: none; margin-left: 0.25em; }
.fn-back:hover { color: var(--accent); }

@keyframes fn-flash {
  0%, 100% { background: transparent; }
  25%       { background: var(--sel-bg); }
}
.fn-flash { animation: fn-flash 1.3s ease; border-radius: 3px; }

.entry-header { align-items: center; }
.entry-actions { display: flex; align-items: center; gap: 0.4em; }

.permalink-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--dim);
  font-family: inherit;
  font-size: 0.7rem;
  cursor: pointer;
  padding: 0.1em 0.45em;
  flex-shrink: 0;
  line-height: 1.3;
}
.permalink-btn:hover          { color: var(--accent); border-color: var(--accent); }
.permalink-btn.permalink-copied { color: var(--accent); }

/* ─── Readme ─────────────────────────────────────────── */

.readme-intro { color: var(--fg); font-size: 0.9rem; margin-bottom: 1em; line-height: 1.8; }

.readme-keys {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  margin-bottom: 1em;
}

.readme-row { display: flex; gap: 1.2em; font-size: 0.85rem; }

.rk {
  color: var(--accent);
  min-width: 2.5em;
  flex-shrink: 0;
}

.readme-note {
  color: var(--dim);
  font-size: 0.75rem;
  margin-top: 0.8em;
}

.readme-note .hl { color: var(--accent); }


/* ─── Mobile search button (top bar) ────────────────── */

.mobile-search-btn {
  background: none;
  border: none;
  color: var(--dim);
  font-family: inherit;
  font-size: 0.65rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-left: auto;
}

/* ─── About / Contact ────────────────────────────────── */

.page-body { color: var(--fg); font-size: 0.9rem; line-height: 1.85; }
.page-body p { margin-bottom: 0.7em; }
.page-body a { color: var(--accent); }

.contact-list { display: flex; flex-direction: column; gap: 0.5em; margin-bottom: 1em; margin-top: 0.3em; }

.contact-row { display: flex; gap: 0.5em; font-size: 0.9rem; }
.contact-key { color: var(--dim); min-width: 5em; flex-shrink: 0; }
.contact-val a { color: var(--accent); }
.contact-note { color: var(--dim); font-size: 0.7rem; font-style: italic; }

/* ─── Status bar ─────────────────────────────────────── */

.status-keys {
  display: flex;
  align-items: center;
  gap: 0.9em;
  font-size: 0.65rem;
  color: var(--dim);
}

kbd {
  display: inline-block;
  padding: 0 0.3em;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--accent);
  font-family: inherit;
  font-size: 0.65rem;
  line-height: 1.45;
  vertical-align: middle;
}

/* ─── Command input ──────────────────────────────────── */

.cmd-wrap {
  display: flex;
  align-items: center;
  gap: 0.4em;
  flex: 1;
  overflow: hidden;
  min-width: 0;
}

.cmd-prompt {
  color: var(--accent);
  font-weight: bold;
  font-size: 1.1rem;
  line-height: 1;
}

.cmd-field {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.cmd-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--accent);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  box-sizing: content-box;
  min-width: 1ch;
  width: 1ch;
  padding: 0;
  flex-shrink: 0;
  caret-color: var(--accent);
}

.cmd-ghost {
  color: var(--dim);
  font-family: inherit;
  font-size: 0.85rem;
  white-space: nowrap;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.cmd-hint {
  color: var(--dim);
  font-size: 0.58rem;
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
}

/* ─── Overlays ───────────────────────────────────────── */

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay-box {
  background: var(--bar-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: min(26em, 92vw);
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 1.2em 3em var(--shadow);
}

.overlay-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: .5em;
  padding: 0.35em 0.7em;
  background: var(--bar-bg);
  border-radius: 8px 8px 0 0;
  font-weight: bold;
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.05em;
  user-select: none;
  position: sticky;
  top: 0;
}

.overlay-close { color: var(--dim); font-size: 0.6rem; font-weight: normal; cursor: pointer; }
.overlay-close:hover { color: var(--accent); }

.overlay-body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  margin: 0.3em 0.2em 0.2em;
  padding: 0.8em 0.9em 1em;
}

.help-table { width: 100%; border-collapse: collapse; margin-bottom: 0.5em; font-size: 0.8rem; }
.help-table td { padding: 0.2em 0; vertical-align: top; }
.help-table td:first-child { color: var(--accent); padding-right: 1em; width: 5.5em; white-space: nowrap; }
.help-table td:last-child { color: var(--dim); }

.help-section {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dim);
  margin: 0.8em 0 0.35em;
}

.help-chips { display: flex; flex-wrap: wrap; gap: 0.4em; }

.chip {
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.05em 0.45em;
  font-size: 0.75rem;
}

/* ─── Search modal ───────────────────────────────────── */

.overlay-search { align-items: flex-start; padding-top: 12vh; }

.search-box {
  background: var(--bar-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: min(32em, 92vw);
  max-height: 70vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 1.2em 3em var(--shadow);
}

.search-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.5em 0.75em;
  border-bottom: 1px solid var(--border);
}

.search-slash { color: var(--accent); font-weight: bold; }

.search-field {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--fg);
  font-family: inherit;
  font-size: 0.85rem;
}

.search-field::placeholder { color: var(--dim); }

.search-results { overflow-y: auto; }

.search-result {
  display: flex;
  gap: 0.6em;
  padding: 0.5em 0.75em;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.search-result:last-child { border-bottom: none; }
.search-result.search-active,
.search-result:hover { background: var(--hover-bg); }

.search-badge {
  font-size: 0.58rem;
  color: var(--dim);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.1em 0.4em;
  flex-shrink: 0;
  margin-top: 0.25em;
  letter-spacing: 0.04em;
}

.search-info { min-width: 0; }
.search-title { font-size: 0.82rem; color: var(--fg); font-weight: bold; }
.search-summary { font-size: 0.7rem; color: var(--dim); margin-top: 0.1em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-tags { display: flex; flex-wrap: wrap; gap: 0.3em; margin-top: 0.25em; }
.search-tag { font-size: 0.6rem; color: var(--dim); border: 1px solid var(--border); border-radius: 2px; padding: 0 0.35em; }
.search-hint { font-size: 0.72rem; color: var(--dim); padding: 0.7em 0.75em; }

/* ─── Theme picker ───────────────────────────────────── */

.theme-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.15em;
}

.theme-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3em 0.5em;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.82rem;
  color: var(--fg);
}

.theme-item:hover               { background: var(--hover-bg); }
.theme-item.active              { background: var(--sel-bg); color: var(--sel-fg); }
.theme-item.cursor              { animation: none; background: var(--fg); color: var(--bg); }
.theme-item.active.cursor       { background: var(--sel-fg); color: var(--sel-bg); }

.theme-swatches {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
  margin-left: 1em;
}

.theme-swatches span {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1px solid rgba(128, 128, 128, 0.25);
}

/* ─── Scrollbars ─────────────────────────────────────── */

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* ─── Mobile ─────────────────────────────────────────── */

@media (max-width: 600px) {
  html, body { overflow: auto; height: auto; }

  body { padding: 0; }

  .shell {
    height: 100svh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  /* sidebar pushes content; main pane clips rather than shrinks */
  .tui-sidebar.open { width: min(75vw, 260px); }
  .tui-pane { flex: none; width: 100%; }

  /* hide command bar on mobile */
  .cmd-wrap { display: none !important; }

  /* switch readme content to touch version */
  .readme-keys, .readme-note-kbd { display: none; }
  .readme-touch    { display: flex; flex-direction: column; gap: 0.3em; margin-bottom: 1em; }
  .readme-note-touch { display: block; }

  /* search button in status bar */
  .status-hint { display: none; }
  .mobile-search-btn { display: block; }
}
