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

/* ─── Dark theme (default) ───────────────────────────────── */
:root {
  --bg:           #0d0d10;
  --bg-panel:     #111116;
  --bg-card:      #17171e;
  --bg-hover:     #1e1e28;
  --border:       #252530;
  --border-light: #2e2e3e;
  --text:         #dddde8;
  --text-dim:     #a0a0b8;
  --text-faint:   #77778e;
  --accent:       #8b7df8;
  --accent-dim:   #2a2450;
  --accent-glow:  rgba(139,125,248,0.15);
  --accent-hover: #a89eff;
  --danger:       #e05a6a;
  --gold:         #d4a84b;
  --teal:         #4ec9b0;
  --nav-h:        52px;
  --right-w:      380px;
  --radius-sm:    4px;
  --radius:       8px;
  --radius-lg:    12px;
  --font-ui:      'Inter', system-ui, -apple-system, sans-serif;
  --font-text:    'Georgia', 'Palatino Linotype', 'Times New Roman', serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;
}

/* ─── Light theme ────────────────────────────────────────── */
[data-theme="light"] {
  --bg:           #f8f7f3;
  --bg-panel:     #f0eeea;
  --bg-card:      #ffffff;
  --bg-hover:     #e8e6e0;
  --border:       #d8d5cc;
  --border-light: #c4c0b4;
  --text:         #1a1a1f;
  --text-dim:     #3e3c4e;
  --text-faint:   #6e6e80;
  --accent:       #5b4fd8;
  --accent-dim:   #ede9ff;
  --accent-glow:  rgba(91,79,216,0.08);
  --accent-hover: #4840c0;
  --danger:       #c03040;
  --gold:         #a07020;
}

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button { font-family: inherit; cursor: pointer; }

/* ── App shell ─────────────────────────────── */
#app { height: 100%; display: flex; flex-direction: column; }

/* ── Loading ─────────────────────────────── */
.loading-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; color: var(--text-dim); font-size: 1rem; letter-spacing: 0.05em;
}

/* ─────────────────────────────────────────────
   TOP NAV
───────────────────────────────────────────── */
.topnav {
  height: var(--nav-h);
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.25rem;
  gap: 1rem;
  flex-shrink: 0;
  z-index: 50;
}

.topnav .brand {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.topnav .nav-breadcrumb {
  font-size: 0.8rem;
  color: var(--text-faint);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topnav .nav-breadcrumb span { color: var(--text-dim); }

.topnav .nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topnav .user-label {
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* Buttons */
.btn {
  padding: 0.3rem 0.8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-family: var(--font-ui);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

/* ─────────────────────────────────────────────
   READER  (main layout)
───────────────────────────────────────────── */
.page-reader {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.reader-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Left: text panel ───────────────────── */
.panel-text {
  flex: 1;
  overflow-y: auto;
  padding: 2.5rem 3rem 4rem;
  background: var(--bg);
  border-right: 1px solid var(--border);
  /* Wider left for text focus */
  min-width: 0;
}

.panel-text::-webkit-scrollbar { width: 6px; }
.panel-text::-webkit-scrollbar-track { background: transparent; }
.panel-text::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }

/* ── Right: analysis panel ────────────── */
.panel-analysis {
  width: var(--right-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-panel);
  overflow: hidden;
}

/* Right top: arc — distinct background to separate from analysis */
.analysis-arc {
  flex-shrink: 0;
  padding: 0;
  border-bottom: 2px solid var(--accent-dim);
  overflow-y: auto;
  max-height: 42%;
  background: var(--bg);
}
.analysis-arc::-webkit-scrollbar { width: 4px; }
.analysis-arc::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* Arc header — colored band */
.arc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.25rem;
  background: var(--accent-dim);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  position: sticky;
  top: 0;
  z-index: 1;
}
.arc-header-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.arc-body {
  padding: 0.9rem 1.25rem 1rem;
}

.analysis-arc .arc-text {
  font-size: 0.82rem;
  line-height: 1.65;
  color: var(--text-dim);
}

.resolution-targets { margin-top: 1rem; }

.resolution-targets .rt-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.rt-item {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-dim);
}

.rt-item .rt-num {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

/* Theme toggle button */
.btn-theme {
  width: 32px; height: 32px; padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-theme:hover { background: var(--bg-hover); color: var(--text); }

/* Panel collapse icon button */
.panel-toggle {
  width: 20px; height: 20px; padding: 0;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-faint);
  font-size: 0.65rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
  flex-shrink: 0;
}
.panel-toggle:hover { background: var(--bg-hover); color: var(--text-dim); }

/* Collapsed panels */
.analysis-arc.is-collapsed .arc-body,
.analysis-arc.is-collapsed .resolution-targets { display: none; }
.analysis-section.is-collapsed #as-content { display: none; }

/* Right bottom: current section detail */
.analysis-section {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  position: relative;
  background: var(--bg-panel);
}
.analysis-section::-webkit-scrollbar { width: 4px; }
.analysis-section::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 2px; }

/* Analysis header — teal/gold band to clearly differ from arc */
.as-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 1.25rem;
  background: color-mix(in srgb, var(--teal) 15%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--teal) 30%, transparent);
  position: sticky;
  top: 0;
  z-index: 1;
}
.as-header-label {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--teal);
}

#as-content {
  padding: 1rem 1.25rem 1.25rem;
}

.as-label, .as-page-label {
  font-size: 0.7rem;
  color: var(--text-faint);
  font-style: italic;
  margin-bottom: 0.3rem;
}

.as-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.75rem;
  line-height: 1.35;
}

.as-summary {
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.as-quote {
  border-left: 2px solid var(--accent);
  padding: 0.5rem 0.8rem;
  font-style: italic;
  font-size: 0.8rem;
  color: var(--accent-hover);
  background: var(--accent-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 1rem;
  line-height: 1.6;
}

.as-connection-label {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 0.4rem;
}

.as-connection {
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-dim);
  border-left: 2px solid var(--border-light);
  padding-left: 0.7rem;
  margin-bottom: 1rem;
}

.as-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.75rem;
}

.as-badge {
  background: var(--accent-dim);
  color: var(--accent-hover);
  border-radius: 10px;
  padding: 0.1rem 0.55rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.as-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  font-size: 0.8rem;
  text-align: center;
  padding: 1rem;
}

/* ─────────────────────────────────────────────
   TEXT PANEL  — section typography
───────────────────────────────────────────── */
.text-block {
  margin-bottom: 3.5rem;
  cursor: default;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.text-block:hover { background: color-mix(in srgb, var(--accent) 3%, transparent); }

.text-block-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

.text-block-num {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  flex-shrink: 0;
}

.text-block-title {
  font-size: 0.8rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-block-page {
  font-size: 0.7rem;
  color: var(--text-faint);
  margin-left: auto;
  flex-shrink: 0;
}

.text-section {
  font-family: var(--font-text);
  font-size: 1.05rem;
  line-height: 2;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  letter-spacing: 0.01em;
}

/* Highlight when section is "active" (visible in viewport) */
.text-block.is-active .text-block-num {
  color: var(--accent-hover);
}

/* ─────────────────────────────────────────────
   THEME LIST PAGE
───────────────────────────────────────────── */
.page-themes {
  max-width: 860px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.page-themes h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
  letter-spacing: -0.02em;
}

.page-themes .subtitle {
  color: var(--text-dim);
  margin-bottom: 0;
  font-size: 0.88rem;
}

/* ── Theme card ── */
.theme-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  display: block;
  color: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.theme-card:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  color: inherit;
}
.theme-card .tc-title {
  font-weight: 600;
  font-size: 0.93rem;
  margin-bottom: 0.3rem;
  color: var(--text);
}
.theme-card .tc-meta {
  font-size: 0.75rem;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ─────────────────────────────────────────────
   AUTH PAGE
───────────────────────────────────────────── */
.page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--bg);
}

.auth-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2.25rem;
  width: 100%;
  max-width: 360px;
}

.auth-box h2 { font-size: 1.2rem; font-weight: 700; margin-bottom: 1.5rem; }

.form-group { margin-bottom: 0.9rem; }
.form-group label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 0.3rem;
  font-weight: 500;
}
.form-group input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  transition: border-color 0.12s;
}
.form-group input:focus { outline: none; border-color: var(--accent); }

.form-error { color: var(--danger); font-size: 0.78rem; min-height: 1.2em; margin-top: 0.4rem; }
.form-link { font-size: 0.78rem; margin-top: 1rem; color: var(--text-faint); }

/* ─────────────────────────────────────────────
   THEMES HEADER + ACTIONS
───────────────────────────────────────────── */
.themes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
}

/* Actions row */
.themes-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* View toggle */
.view-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.view-btn {
  width: 32px; height: 30px;
  border: none;
  background: transparent;
  color: var(--text-faint);
  font-size: 0.95rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.view-btn:hover { background: var(--bg-hover); color: var(--text); }
.view-btn.active { background: var(--accent-dim); color: var(--accent); }
.view-btn + .view-btn { border-left: 1px solid var(--border); }

/* New folder button */
.btn-new-folder {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 0.78rem;
  font-family: var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn-new-folder:hover { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }

/* Import button */
.btn-import {
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 0.78rem;
  font-family: var(--font-ui);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-import:hover { background: var(--accent-dim); }
.btn-import:disabled { opacity: 0.5; cursor: wait; }

/* ── Library navigation (inside a folder) ── */
.lib-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.lib-back-btn {
  border: none;
  background: none;
  color: var(--text-faint);
  font-size: 0.82rem;
  font-family: var(--font-ui);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.12s, background 0.12s;
}
.lib-back-btn:hover { color: var(--text); background: var(--bg-hover); }
.lib-folder-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.lib-folder-icon { font-size: 1.1rem; }

/* ── Sections ── */
.lib-section { margin-bottom: 2.5rem; }
.lib-section-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 0.75rem;
}

/* ── Grid / List layouts ── */
.grid-view {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.list-view {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
/* List-view theme card overrides */
.list-view .theme-entry .theme-card {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
}
.list-view .tc-title { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; max-width: 55%; }
.list-view .tc-meta  { font-size: 0.73rem; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Theme entry (card wrapper) ── */
.theme-entry { position: relative; }

/* Admin edit overlay — hidden, revealed on hover */
.card-admin-overlay {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.theme-entry:hover .card-admin-overlay {
  opacity: 1;
  pointer-events: auto;
}
.list-view .theme-entry .card-admin-overlay { top: 50%; right: 0.5rem; transform: translateY(-50%); }

.card-edit-btn {
  width: 26px; height: 26px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-panel);
  color: var(--text-dim);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.card-edit-btn:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }

/* ── Folder cards (grid) ── */
.folder-grid-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1rem 0.9rem;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  text-align: center;
}
.folder-grid-card:hover { border-color: var(--accent); background: var(--bg-hover); }
.folder-grid-icon { font-size: 2.2rem; line-height: 1; margin-bottom: 0.5rem; }
.folder-grid-name {
  font-size: 0.88rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.folder-grid-count { font-size: 0.72rem; color: var(--text-faint); margin-top: 0.2rem; }

/* ── Folder rows (list) ── */
.folder-list-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  position: relative;
}
.folder-list-row:hover { border-color: var(--accent); background: var(--bg-hover); }
.folder-list-icon { font-size: 1.1rem; flex-shrink: 0; }
.folder-list-name { font-size: 0.88rem; font-weight: 600; color: var(--text); flex: 1; }
.folder-list-count { font-size: 0.73rem; color: var(--text-faint); }
.folder-list-arrow { color: var(--text-faint); font-size: 1rem; }

/* Folder admin action buttons (shared grid/list) */
.folder-card-actions {
  display: flex;
  gap: 0.2rem;
  opacity: 0;
  transition: opacity 0.15s;
}
.folder-grid-card:hover .folder-card-actions,
.folder-list-row:hover .folder-card-actions { opacity: 1; }
.folder-grid-card .folder-card-actions {
  position: absolute;
  top: 0.4rem; right: 0.4rem;
}
.folder-list-row .folder-card-actions { margin-left: auto; }

.folder-card-btn {
  width: 22px; height: 22px;
  border-radius: 3px;
  border: 1px solid transparent;
  background: var(--bg-hover);
  color: var(--text-faint);
  font-size: 0.78rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.folder-card-btn:hover { background: var(--bg-panel); color: var(--text); }
.folder-delete-btn:hover { background: rgba(224,90,106,0.12); color: var(--danger); }

/* Empty folder page */
.folder-empty-page {
  color: var(--text-faint); font-size: 0.88rem;
  padding: 3rem 0; text-align: center;
}
.no-themes { color: var(--text-faint); font-size: 0.9rem; margin-top: 2rem; }

/* ── Modal ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.75rem 2rem;
  width: 100%; max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}
.modal-title { font-size: 1rem; font-weight: 700; margin-bottom: 1.25rem; color: var(--text); }
.modal-actions { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem; }

/* ─────────────────────────────────────────────
   TOAST NOTIFICATIONS
───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: calc(var(--nav-h) + 12px);
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.82rem;
  color: #fff;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: auto;
  cursor: pointer;
  max-width: 360px;
}
.toast.toast-visible { opacity: 1; transform: translateX(0); }
.toast-success { border-left: 3px solid var(--teal); }
.toast-error   { border-left: 3px solid var(--danger); }
.toast-info    { border-left: 3px solid var(--accent); }

/* ─────────────────────────────────────────────
   FOCUS STATES
───────────────────────────────────────────── */
.btn:focus-visible,
.btn-primary:focus-visible,
.btn-theme:focus-visible,
.btn-import:focus-visible,
.panel-toggle:focus-visible,
.tool-btn:focus-visible,
.theme-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.form-group input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

/* ─────────────────────────────────────────────
   RESPONSIVE — tablet & mobile
───────────────────────────────────────────── */
@media (max-width: 768px) {
  .reader-body {
    flex-direction: column;
  }
  .panel-text {
    padding: 1.5rem 1.25rem 2rem;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 55vh;
  }
  .panel-analysis {
    width: 100%;
    max-height: 45vh;
  }
  .analysis-arc { max-height: 35%; }
  .page-themes { padding: 2rem 1rem; }
  .grid-view { grid-template-columns: 1fr; }
  .topnav {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }
  .topnav .nav-breadcrumb {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .panel-text { padding: 1rem; }
  .text-section { font-size: 0.95rem; line-height: 1.8; }
  .page-themes h1 { font-size: 1.4rem; }
  .themes-header { flex-wrap: wrap; }
  .auth-box { padding: 1.5rem; }
}
