:root {
  --bg: #121212;
  --bg-soft: #1c1c1e;
  --card: rgba(34, 34, 38, 0.86);
  --card-strong: rgba(44, 44, 48, 0.96);
  --text: #f8f8f8;
  --muted: #a9a9b2;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #9fd0ff;
  --accent-strong: #4aa3ff;
  --danger: #ff5a66;
  --radius: 28px;
  --reader-font-size: 21px;
  --reader-line-height: 1.55;
  --reader-width: 760px;
  color-scheme: dark;
}

body.light {
  --bg: #f5f5f7;
  --bg-soft: #ffffff;
  --card: rgba(255, 255, 255, 0.88);
  --card-strong: rgba(255, 255, 255, 0.98);
  --text: #161618;
  --muted: #64646d;
  --line: rgba(20, 20, 25, 0.12);
  --accent: #006edb;
  --accent-strong: #007aff;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { min-height: 100%; margin: 0; }
body {
  background:
    radial-gradient(circle at 15% 5%, rgba(74, 163, 255, 0.18), transparent 28rem),
    radial-gradient(circle at 85% 0%, rgba(159, 208, 255, 0.12), transparent 22rem),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button, input, textarea, select {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  cursor: pointer;
}

.bible-shell,
.archive-shell {
  width: min(980px, 100%);
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.archive-shell[hidden],
[hidden] { display: none !important; }

.bible-top,
.top-bar,
.archive-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.connection-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 214, 102, 0.42);
  border-radius: 999px;
  background: rgba(255, 214, 102, 0.14);
  color: #ffd666;
  font-size: 13px;
  font-weight: 900;
  padding: 0 12px;
  white-space: nowrap;
}

.connection-pill.hidden {
  display: none;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(32px, 8vw, 54px); letter-spacing: 0; }
h2 { font-size: 24px; margin-bottom: 14px; }
h3 { margin-bottom: 8px; }

.icon-button,
.ghost-button,
.primary,
.pill-button,
.archive-tabs button {
  min-height: 46px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 0 18px;
  font-weight: 800;
}

.icon-button {
  width: 52px;
  padding: 0;
  font-size: 22px;
}

.primary {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-strong), #7fc7ff);
  color: #fff;
  border: 0;
  box-shadow: 0 14px 34px rgba(0, 122, 255, 0.22);
}

.reader-card,
.day-verse-card,
.recent-places-card,
.panel,
.archive-card,
.archive-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.reader-card {
  width: min(100%, var(--reader-width));
  padding: 18px;
  margin-bottom: 16px;
  margin-left: auto;
  margin-right: auto;
  touch-action: pan-y;
}

.day-verse-card {
  width: min(100%, var(--reader-width));
  display: grid;
  gap: 12px;
  padding: 16px;
  margin: 0 auto 16px;
}

.day-verse-card[hidden] {
  display: none;
}

.day-verse-card .panel-head {
  margin-bottom: 0;
}

.day-verse-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.day-verse-text {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-soft);
  color: var(--text);
  text-align: left;
}

.day-verse-text strong {
  color: var(--accent);
  font-size: 15px;
  font-weight: 900;
}

.day-verse-text span {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.5;
}

.day-verse-attribution {
  justify-self: start;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.day-verse-attribution:hover {
  color: var(--accent);
}

.day-verse-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.day-verse-actions .ghost-button {
  width: 100%;
}

.day-verse-status {
  min-height: 18px;
  margin: -4px 0 0;
}

.recent-places-card {
  width: min(100%, var(--reader-width));
  display: grid;
  padding: 16px;
  margin: 0 auto 16px;
}

.recent-places-card {
  gap: 10px;
}

.recent-places-card[hidden] {
  display: none;
}

.recent-places-card .panel-head {
  margin-bottom: 0;
}

.offline-mode-card {
  width: min(100%, var(--reader-width));
  display: grid;
  gap: 6px;
  margin: 0 auto 16px;
  padding: 16px;
  border: 1px solid rgba(255, 214, 102, 0.42);
  border-radius: var(--radius);
  background: rgba(255, 214, 102, 0.13);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18);
}

.offline-mode-card strong {
  color: #ffd666;
  font-size: 17px;
}

.offline-mode-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.recent-places-list {
  display: grid;
  gap: 8px;
}

.recent-place-item {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-soft);
  color: var(--text);
  text-align: left;
}

.recent-place-item.active {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-strong) 58%, transparent);
}

.recent-place-item strong {
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
}

.recent-place-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.reader-nav,
.reader-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.reader-nav-bottom {
  margin-top: 18px;
  margin-bottom: 0;
}

.return-place-button {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 0 0 14px;
  border: 1px solid color-mix(in srgb, var(--accent-strong) 42%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent-strong) 16%, var(--bg-soft));
  color: var(--text);
  padding: 0 14px;
  font-weight: 900;
  text-align: left;
}

.return-place-button[hidden] {
  display: none;
}

.quick-jump {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(78px, 0.55fr) minmax(78px, 0.55fr) minmax(104px, 0.55fr);
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: color-mix(in srgb, var(--bg-soft) 82%, transparent);
}

.quick-jump label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.quick-jump select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card-strong);
  color: var(--text);
  padding: 0 12px;
  font-size: 16px;
}

.quick-jump .primary-soft {
  width: 100%;
  min-height: 44px;
}

.round-button {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
}

.book-title {
  flex: 1;
  text-align: left;
  background: transparent;
  padding: 8px 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.book-title strong {
  display: block;
  font-size: clamp(28px, 8vw, 48px);
  line-height: 1.04;
}

.book-title span {
  display: block;
  color: var(--muted);
  font-weight: 700;
  margin-top: 6px;
}

.chapter-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 14px;
  scrollbar-width: none;
}

.chapter-strip-bottom {
  padding-top: 0;
  padding-bottom: 0;
}

.chapter-strip::-webkit-scrollbar { display: none; }
.chapter-strip button {
  min-width: 44px;
  height: 44px;
  border-radius: 16px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 800;
}
.chapter-strip button.active {
  background: var(--accent-strong);
  color: #fff;
}

.verses {
  display: grid;
  gap: 14px;
}

.verse {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 12px;
  align-items: start;
  font-size: var(--reader-font-size);
  line-height: var(--reader-line-height);
  padding: 10px 12px 10px 6px;
  border-radius: 18px;
  cursor: pointer;
  touch-action: manipulation;
}

.verse.active {
  background: color-mix(in srgb, var(--accent-strong) 14%, transparent);
}

.verse.highlight-yellow {
  background: color-mix(in srgb, #ffd84d 30%, transparent);
}

.verse.highlight-green {
  background: color-mix(in srgb, #45d483 24%, transparent);
}

.verse.highlight-blue {
  background: color-mix(in srgb, #66b6ff 24%, transparent);
}

.verse.highlight-pink {
  background: color-mix(in srgb, #ff7ab6 24%, transparent);
}

.verse.active.highlight-yellow,
.verse.active.highlight-green,
.verse.active.highlight-blue,
.verse.active.highlight-pink {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent-strong) 68%, transparent);
}

.verse-num {
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
  padding-top: 8px;
}

.verse-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.verse-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.reader-tools,
.reader-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.reading-controls {
  width: min(100%, var(--reader-width));
  display: grid;
  grid-template-columns: auto repeat(3, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 auto 16px;
}

.reading-controls label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.reading-controls input[type="range"] {
  min-height: 46px;
  padding: 0;
  accent-color: var(--accent-strong);
}

.reader-book-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.verse-actions {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: color-mix(in srgb, var(--bg-soft) 82%, transparent);
}

.verse-context-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  width: min(360px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card-strong);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.verse-context-menu button {
  min-height: 44px;
  border-radius: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 900;
}

.verse-actions-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.verse-actions label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.verse-actions textarea {
  min-height: 84px;
  border-radius: 16px;
}

.highlight-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--bg-soft);
}

.swatch.active {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-strong) 22%, transparent);
}

.swatch-none {
  background:
    linear-gradient(135deg, transparent 45%, var(--danger) 47%, var(--danger) 53%, transparent 55%),
    var(--bg-soft);
}

.swatch-yellow { background: #ffd84d; }
.swatch-green { background: #45d483; }
.swatch-blue { background: #66b6ff; }
.swatch-pink { background: #ff7ab6; }

.verse-action-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.verse-action-status {
  min-height: 20px;
  margin: 0;
}

.focus-reading {
  width: min(var(--reader-width), 100%);
}

.focus-reading .reading-controls,
.focus-reading .reader-tools,
.focus-reading .day-verse-card,
.focus-reading .recent-places-card,
.focus-reading .offline-mode-card,
.focus-reading .panel,
.focus-reading .quick-jump,
.focus-reading .reader-book-nav,
.focus-reading .verse-actions {
  display: none;
}

.focus-reading .bible-top {
  position: sticky;
  top: env(safe-area-inset-top);
  z-index: 20;
  justify-content: flex-end;
  margin-bottom: 8px;
  pointer-events: none;
}

.focus-reading .bible-top > div:first-child,
.focus-reading #themeToggle {
  display: none;
}

.focus-reading .top-actions,
.focus-reading #focusToggle {
  pointer-events: auto;
}

.focus-reading .reader-card {
  margin-top: 0;
  box-shadow: none;
  border-color: transparent;
  background: transparent;
  backdrop-filter: none;
  padding: 0 2px;
}

.reader-tools {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: end;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin: 0 0 16px;
}

.reader-tools label,
.archive-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.reader-tools input,
.archive-card input,
.archive-form input,
.archive-form textarea,
.secret-dialog input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-soft);
  color: var(--text);
  padding: 0 14px;
  outline: 0;
}

.archive-form textarea {
  min-height: 120px;
  padding-top: 12px;
  resize: vertical;
}

.reader-tools input:focus,
.archive-card input:focus,
.archive-form input:focus,
.archive-form textarea:focus,
.secret-dialog input:focus {
  border-color: var(--accent-strong);
}

.primary-soft {
  min-height: 46px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--accent-strong) 20%, var(--bg-soft));
  border: 1px solid color-mix(in srgb, var(--accent-strong) 42%, transparent);
  color: var(--text);
  padding: 0 16px;
  font-weight: 900;
  white-space: nowrap;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.book-controls,
.search-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 12px;
}

input,
textarea,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--bg-soft);
  color: var(--text);
  padding: 13px 15px;
  outline: none;
}

textarea {
  min-height: 116px;
  resize: vertical;
}

.book-list,
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(138px, 1fr));
  gap: 10px;
}

.book-list button,
.book-grid button,
.result-item,
.archive-item {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px;
  text-align: left;
  color: var(--text);
}

.book-list button.active,
.book-grid button.active {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}

.search-results,
.bookmark-list,
.archive-list {
  display: grid;
  gap: 10px;
}

.export-panel {
  display: grid;
  gap: 12px;
}

.export-panel .panel-head,
.export-panel p {
  margin: 0;
}

.export-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.export-actions .ghost-button {
  min-height: 48px;
}

.export-status {
  min-height: 20px;
}

.archive-list .archive-file-item {
  position: relative;
  display: grid;
  gap: 8px;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.archive-pinned-block,
.archive-regular-block {
  display: grid;
  gap: 10px;
}

.archive-pinned-block {
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--accent-strong) 42%, var(--line));
  border-radius: 22px;
  background: color-mix(in srgb, var(--accent-strong) 10%, transparent);
}

.archive-pinned-block h3,
.archive-regular-block h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.archive-pinned-list,
.archive-regular-list {
  display: grid;
  gap: 10px;
}

.archive-list .archive-file-item:hover,
.archive-list .archive-file-item:active {
  border-color: var(--accent-strong);
  background: var(--bg-soft);
  transform: translateY(-1px);
}

.archive-list .archive-file-item strong {
  display: block;
  font-size: 16px;
  line-height: 1.35;
}

.archive-list .archive-file-item span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.archive-action-menu {
  position: fixed;
  z-index: 1200;
  min-width: 200px;
  background: var(--card-strong);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 8px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
  display: grid;
  gap: 6px;
}

.archive-action-button {
  min-height: 44px;
  border-radius: 14px;
  padding: 0 14px;
  text-align: left;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--text);
  font-weight: 800;
}

.archive-action-button.secondary {
  color: var(--muted);
}

.archive-action-button.danger {
  color: var(--danger);
}

.muted {
  color: var(--muted);
}

.secret-dialog {
  width: min(390px, calc(100vw - 28px));
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card-strong);
  color: var(--text);
  padding: 0;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48);
}

.secret-dialog::backdrop {
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(18px);
}

.secret-dialog form {
  display: grid;
  gap: 14px;
  padding: 22px;
}

.secret-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.archive-shell {
  background: var(--bg);
}

.archive-top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.archive-card,
.archive-list {
  padding: 16px;
  margin-bottom: 14px;
}

.archive-settings h2 {
  margin-bottom: 12px;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.archive-tabs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 4px 0 14px;
  scrollbar-width: none;
}
.archive-tabs::-webkit-scrollbar { display: none; }
.archive-tabs button {
  white-space: nowrap;
  color: var(--text);
}
.archive-tabs button.active {
  background: var(--accent-strong);
  color: #fff;
}

.archive-form {
  display: grid;
  gap: 12px;
}

.archive-password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.archive-password-row .ghost-button {
  min-height: 46px;
  border-radius: 16px;
}

.archive-password-generator {
  display: grid;
  grid-template-columns: minmax(92px, 0.8fr) repeat(4, auto) auto;
  gap: 8px;
  align-items: center;
}

.archive-password-generator label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.archive-password-generator label:first-child {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.archive-password-generator input[type="number"] {
  min-height: 38px;
  padding: 0 10px;
  border-radius: 12px;
}

.archive-password-generator input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent-strong);
}

.archive-password-generator .ghost-button {
  min-height: 42px;
  border-radius: 14px;
}

.archive-import-export {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.archive-meta-fields {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.archive-filter-toggle {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.archive-card label.archive-filter-toggle {
  display: inline-flex;
}

.archive-filter-toggle input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--accent-strong);
}

.archive-edit-notice {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin: 0 0 14px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--accent-strong) 38%, transparent);
  border-radius: 18px;
  background: color-mix(in srgb, var(--accent-strong) 12%, var(--bg-soft));
}

.archive-edit-notice span {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.archive-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.archive-item {
  display: grid;
  gap: 10px;
}

.archive-item-title {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.archive-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.archive-tag-row span {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  background: var(--bg-soft);
  font-size: 12px;
  font-weight: 800;
}

.archive-trash-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  border: 1px solid rgba(255, 90, 102, 0.34);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--danger);
  font-size: 11px;
  font-weight: 900;
  vertical-align: middle;
}

.archive-item.active {
  border-color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px var(--accent-strong);
}

.primary-soft[aria-pressed="true"] {
  background: color-mix(in srgb, var(--accent-strong) 34%, var(--bg-soft));
  border-color: var(--accent-strong);
}

.archive-item footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.danger {
  color: var(--danger);
  border-color: rgba(255, 90, 102, 0.34);
}

.archive-preview,
.file-preview {
  max-width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  overflow: auto;
}

.archive-preview {
  max-height: 60dvh;
  padding: 12px;
  white-space: pre-wrap;
}

.archive-preview img {
  display: block;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 14px;
}

.archive-preview video,
.archive-preview audio {
  display: block;
  width: 100%;
}

.archive-preview iframe,
iframe.file-preview {
  width: 100%;
  height: 70dvh;
  background: white;
}

.archive-file-preview {
  display: grid;
  gap: 8px;
}

.archive-file-preview a {
  color: var(--accent-strong);
  font-weight: 800;
}

@media (max-width: 680px) {
  .bible-top {
    align-items: flex-start;
  }

  .reader-tools,
  .reader-actions,
  .quick-jump,
  .reading-controls,
  .reader-book-nav,
  .verse-action-buttons,
  .book-controls,
  .search-controls,
  .archive-actions {
    grid-template-columns: 1fr;
  }

  .top-actions {
    flex: 0 0 auto;
  }

  .panel.compact-panel { padding: 14px; }
  .book-list,
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-top { align-items: flex-start; }
  .archive-top-actions,
  .settings-grid,
  .archive-edit-notice { grid-template-columns: 1fr; }
  .archive-password-generator {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .archive-password-generator .ghost-button {
    grid-column: 1 / -1;
  }
  .archive-meta-fields {
    grid-template-columns: 1fr;
  }
  .archive-import-export {
    grid-template-columns: 1fr;
  }
  .archive-top-actions {
    display: grid;
    justify-content: stretch;
    width: 100%;
  }
}
