:root {
  --bg: #f4efe5;
  --bg-strong: #e7dac5;
  --panel: rgba(255, 251, 245, 0.88);
  --panel-border: rgba(96, 71, 43, 0.18);
  --text: #2c241b;
  --muted: #6d5a47;
  --heading-accent: #3f1f69;
  --accent: #9a3412;
  --accent-soft: #f97316;
  --shadow: 0 24px 60px rgba(78, 49, 16, 0.12);
  --reading-font-size: 1rem;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

.admin-only {
  display: none !important;
}

.admin-mode section.admin-only {
  display: block !important;
}

.admin-mode label.admin-only {
  display: inline-flex !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(249, 115, 22, 0.12), transparent 30%),
    radial-gradient(circle at top right, rgba(120, 53, 15, 0.12), transparent 25%),
    linear-gradient(180deg, #fbf8f2 0%, var(--bg) 100%);
  font-family: Georgia, "Times New Roman", serif;
}

button,
input {
  font: inherit;
}

.shell {
  padding: 24px;
}

.shell.focus-mode .topbar {
  margin-bottom: 12px;
}

.shell.mobile-mode {
  padding: 14px;
}

.shell.touch-mode .inline-button,
.shell.touch-mode .search-controls button,
.shell.touch-mode .work-button,
.shell.touch-mode .toc-button,
.shell.touch-mode .demo-question,
.shell.touch-mode .test-question {
  min-height: 44px;
}

.topbar {
  display: block;
  margin-bottom: 20px;
}

.brand-line {
  display: block;
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.8rem;
}

h1,
h2 {
  margin: 0;
  font-weight: 600;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.brand-line h1,
.panel-left > section > .panel-heading h2,
#results-heading,
.query-panel > .panel-heading h2 {
  color: var(--heading-accent);
}

.hero-message {
  margin: 8px 0 0;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: var(--text);
  line-height: 1.4;
}

.subtitle,
.panel-heading p,
.work-meta,
.result-meta,
.result-date,
.reader-note {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.panel-note {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.45;
}

.focus-subtitle {
  margin-top: 6px;
}

.searchbar,
.panel,
.work-button,
.toc-button,
.movement-button,
.result-card,
.demo-question,
.test-question,
.interp-panel {
  backdrop-filter: blur(14px);
}

.searchbar,
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  border-radius: 20px;
}

.searchbar {
  padding: 16px;
}

.searchbar-side {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
}

.question-tools {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.debug-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.demo-panel {
  margin-top: 16px;
}

.status-panel {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(96, 71, 43, 0.15);
  background: rgba(255, 255, 255, 0.62);
}

.privacy-panel,
.feedback-panel,
.saved-panel,
.personal-library-panel {
  margin-top: 16px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(96, 71, 43, 0.15);
  background: rgba(255, 255, 255, 0.62);
}

.saved-sections {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.saved-subsection {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(96, 71, 43, 0.12);
}

.saved-subsection h3 {
  margin: 0;
  font-size: 1.08rem;
}

.saved-actions {
  margin-top: 8px;
}

.games-panel {
  gap: 12px;
}

.game-mode-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.game-mode-controls .inline-button {
  min-width: 0;
  padding: 9px 8px;
  font-size: 0.82rem;
  text-align: center;
}

.game-mode-controls .inline-button.active {
  outline: 2px solid rgba(154, 52, 18, 0.28);
  outline-offset: 2px;
  background: rgba(250, 237, 222, 0.98);
  color: var(--accent);
}

.game-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(96, 71, 43, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.game-prompt {
  display: grid;
  gap: 4px;
}

.game-card blockquote {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid rgba(154, 52, 18, 0.32);
  border-radius: 0 10px 10px 0;
  background: rgba(250, 237, 222, 0.44);
  line-height: 1.48;
  color: var(--text);
}

.game-options {
  display: grid;
  gap: 8px;
}

.game-option {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(96, 71, 43, 0.16);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  line-height: 1.35;
}

.game-option:hover,
.game-option:focus-visible {
  border-color: rgba(154, 52, 18, 0.42);
  outline: 2px solid rgba(154, 52, 18, 0.16);
  outline-offset: 2px;
}

.game-option.correct {
  border-color: rgba(22, 163, 74, 0.4);
  background: rgba(22, 163, 74, 0.12);
}

.game-option.wrong {
  border-color: rgba(185, 28, 28, 0.38);
  background: rgba(185, 28, 28, 0.1);
}

.game-result {
  display: grid;
  gap: 8px;
  color: var(--muted);
  line-height: 1.4;
}

.game-next {
  justify-self: start;
}

.status-summary {
  display: grid;
  gap: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: rgba(109, 90, 71, 0.14);
  color: var(--muted);
}

.status-badge.ready {
  background: rgba(22, 163, 74, 0.14);
  color: #166534;
}

.status-badge.warn {
  background: rgba(180, 83, 9, 0.16);
  color: #9a3412;
}

.status-badge.error {
  background: rgba(185, 28, 28, 0.12);
  color: #991b1b;
}

.status-meta,
.status-details {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.status-details {
  display: grid;
  gap: 4px;
  margin-top: 10px;
}

.status-actions {
  margin-top: 12px;
}

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

.annotation-form,
.annotations-list,
.reading-memory-list {
  display: grid;
  gap: 10px;
}

.annotation-form {
  margin-bottom: 12px;
}

.annotation-source {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(250, 237, 222, 0.68);
  border: 1px solid rgba(154, 52, 18, 0.12);
  color: var(--muted);
  line-height: 1.45;
}

.annotation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.annotation-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(96, 71, 43, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.reading-memory-card {
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(96, 71, 43, 0.14);
  background: rgba(250, 237, 222, 0.45);
}

.personal-library-list {
  display: grid;
  gap: 10px;
}

.personal-library-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(96, 71, 43, 0.14);
  background: rgba(255, 255, 255, 0.72);
}

.personal-library-card.active {
  border-color: rgba(154, 52, 18, 0.45);
  box-shadow: inset 0 0 0 1px rgba(154, 52, 18, 0.18);
  background: rgba(250, 237, 222, 0.95);
}

.annotation-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.reading-memory-card-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.annotation-card-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.personal-library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.annotation-card blockquote {
  margin: 10px 0 0;
  padding-left: 10px;
  border-left: 3px solid rgba(154, 52, 18, 0.35);
  color: var(--text);
  line-height: 1.5;
  max-height: 150px;
  overflow: auto;
}

.annotation-card p {
  margin: 10px 0 0;
  color: var(--text);
  line-height: 1.5;
}

.annotation-open,
.annotation-delete {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 2px 0;
  cursor: pointer;
  font: inherit;
  font-size: 0.85rem;
}

.annotation-open {
  color: var(--text);
  font-weight: 700;
}

.annotation-date {
  margin-top: 10px;
  color: var(--muted);
}

.annotation-import-status {
  min-height: 1.2em;
  margin: 8px 0 10px;
  color: var(--muted);
  line-height: 1.4;
}

.annotation-import-status.error {
  color: #991b1b;
}

.benchmark-form {
  margin-top: 12px;
}

.benchmark-active {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(96, 71, 43, 0.12);
  color: var(--muted);
  line-height: 1.45;
}

.feedback-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.feedback-field select,
.feedback-field textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(96, 71, 43, 0.18);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
  font: inherit;
}

.feedback-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.compact {
  margin-bottom: 10px;
}

.demo-questions {
  display: grid;
  gap: 8px;
}

.demo-question {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(96, 71, 43, 0.15);
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  cursor: pointer;
}

.test-question {
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(96, 71, 43, 0.15);
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  cursor: pointer;
}

.demo-question.active {
  border-color: rgba(154, 52, 18, 0.45);
  box-shadow: inset 0 0 0 1px rgba(154, 52, 18, 0.18);
  background: rgba(250, 237, 222, 0.95);
}

.test-question.active {
  border-color: rgba(154, 52, 18, 0.45);
  box-shadow: inset 0 0 0 1px rgba(154, 52, 18, 0.18);
  background: rgba(250, 237, 222, 0.95);
}

.search-label {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.search-controls {
  display: flex;
  gap: 10px;
}

.search-controls input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(96, 71, 43, 0.22);
  background: rgba(255, 255, 255, 0.8);
  color: var(--text);
  caret-color: var(--accent);
  cursor: text;
}

.search-controls input:focus {
  outline: 2px solid rgba(154, 52, 18, 0.22);
  outline-offset: 2px;
  border-color: rgba(154, 52, 18, 0.45);
  background: rgba(255, 255, 255, 0.96);
}

.search-controls button,
.action-button,
.inline-button {
  border: 0;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft) 100%);
  color: white;
  border-radius: 12px;
  padding: 11px 16px;
  cursor: pointer;
}

.search-controls button:disabled,
.demo-question:disabled {
  opacity: 0.7;
  cursor: wait;
}

.layout {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(300px, 0.82fr) minmax(520px, 1.55fr) minmax(320px, 0.95fr);
  align-items: start;
}

.layout.focus-mode {
  grid-template-columns: 1fr;
}

.panel {
  padding: 16px;
  min-height: 72vh;
}

.panel-left,
.panel-right {
  display: grid;
  gap: 16px;
  align-content: start;
}

.panel-left {
  grid-auto-rows: max-content;
}

.panel-center {
  display: flex;
  flex-direction: column;
}

.focus-mode .panel-left,
.focus-mode .panel-right {
  display: none;
}

.focus-mode .panel-center {
  min-height: calc(100vh - 150px);
}

.panel-left {
  max-width: 340px;
  height: calc(100vh - 48px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  min-height: 0;
  padding-right: 12px;
  -webkit-overflow-scrolling: touch;
}

.panel-left section {
  min-height: max-content;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
}

.filter-toggle {
  border: 1px solid rgba(96, 71, 43, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1;
  padding: 7px 10px;
  white-space: nowrap;
}

.work-filter-action-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  margin: -4px 0 12px;
}

.work-filter-action-row .filter-toggle {
  min-width: 0;
  text-align: center;
  white-space: normal;
}

#movements-jump-toggle {
  line-height: 1.1;
  padding-inline: 8px;
}

.filter-toggle:hover,
.filter-toggle:focus-visible,
.filter-toggle.active {
  border-color: rgba(154, 52, 18, 0.36);
  background: rgba(250, 237, 222, 0.92);
  outline: none;
}

.work-filter-panel {
  display: grid;
  gap: 10px;
  margin: -2px 0 12px;
  padding: 12px;
  border: 1px solid rgba(96, 71, 43, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.62);
}

.work-filter-group {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.work-filter-group legend {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 700;
}

.work-filter-options {
  display: grid;
  gap: 5px;
}

.work-filter-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: start;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.25;
}

.work-filter-option input {
  width: 15px;
  height: 15px;
  margin: 1px 0 0;
  accent-color: var(--accent);
}

.work-filter-option span {
  overflow-wrap: anywhere;
}

.work-filter-actions {
  padding-top: 2px;
}

.active-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 12px;
}

.active-filter-chip {
  border: 1px solid rgba(154, 52, 18, 0.18);
  border-radius: 999px;
  background: rgba(250, 237, 222, 0.76);
  color: var(--accent);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.15;
  padding: 6px 9px;
}

.active-filter-chip:hover,
.active-filter-chip:focus-visible {
  border-color: rgba(154, 52, 18, 0.42);
  outline: 2px solid rgba(154, 52, 18, 0.16);
  outline-offset: 2px;
}

.reader-controls {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.work-list,
.movement-list,
.toc-list,
.results-list {
  display: grid;
  gap: 10px;
}

.work-button,
.movement-button,
.toc-button {
  width: 100%;
  text-align: left;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(96, 71, 43, 0.15);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  color: inherit;
}

.center-toc-button {
  text-align: left;
}

.toc-button.kind-day,
.toc-button.kind-book,
.toc-button.kind-play,
.toc-button.kind-sonnets {
  background: rgba(250, 237, 222, 0.82);
  border-color: rgba(154, 52, 18, 0.24);
}

.toc-button.level-2 {
  width: calc(100% - 14px);
  margin-left: 14px;
  padding-block: 11px;
  border-radius: 10px;
}

.toc-button.level-2 strong {
  font-size: 0.95rem;
  line-height: 1.25;
}

.center-toc-label {
  margin: 4px 4px -2px;
  padding: 4px 8px 0;
  color: rgba(96, 71, 43, 0.75);
}

.play-act-link,
.play-scene-link {
  appearance: none;
  border: 0;
  background: none;
  color: var(--accent);
  cursor: pointer;
  text-align: left;
  padding: 0;
  justify-self: start;
  font: inherit;
}

.play-act-link {
  margin: 10px 4px 2px;
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.play-scene-link {
  margin: 0 4px 2px 18px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.play-scene-link strong {
  display: inline;
  margin: 0;
  font-weight: 600;
}

.play-act-link:hover,
.play-act-link:focus-visible,
.play-scene-link:hover,
.play-scene-link:focus-visible {
  color: rgba(154, 52, 18, 0.9);
}

.play-scene-link.active {
  color: rgba(154, 52, 18, 0.95);
  text-decoration-thickness: 2px;
}

.play-act-link:disabled {
  color: rgba(96, 71, 43, 0.45);
  cursor: default;
}

.toc-browser-list {
  align-content: start;
}

.toc-browser-card {
  cursor: default;
}

.toc-preview-card .expanded-reading {
  margin-top: 0;
}

.bible-browser-list {
  gap: 14px;
}

.bible-browser-heading strong {
  margin-bottom: 0;
}

.bible-testament-group {
  padding: 14px;
}

.bible-testament-heading {
  margin-bottom: 10px;
  color: rgba(154, 52, 18, 0.94);
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bible-book-grid {
  display: grid;
  gap: 8px;
}

.bible-book-row {
  display: grid;
  gap: 8px;
}

.bible-book-link,
.bible-chapter-chip {
  appearance: none;
  border: 1px solid rgba(96, 71, 43, 0.16);
  background: rgba(255, 255, 255, 0.68);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.bible-book-link {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  text-align: left;
  font-weight: 650;
  line-height: 1.2;
}

.bible-book-link:hover,
.bible-book-link:focus-visible,
.bible-chapter-chip:hover,
.bible-chapter-chip:focus-visible {
  border-color: rgba(154, 52, 18, 0.35);
  background: rgba(250, 237, 222, 0.9);
}

.bible-book-link.active,
.bible-chapter-chip.active {
  border-color: rgba(154, 52, 18, 0.5);
  box-shadow: inset 0 0 0 1px rgba(154, 52, 18, 0.18);
  background: rgba(250, 237, 222, 0.98);
}

.bible-chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(96, 71, 43, 0.12);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.78);
}

.bible-chapter-chip {
  min-height: 34px;
  border-radius: 7px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
}

.bible-all-books-button span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.story-cycle-browser-list {
  gap: 14px;
}

.story-cycle-heading strong {
  margin-bottom: 0;
}

.story-cycle-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.story-cycle-card.active {
  border-color: rgba(154, 52, 18, 0.38);
  background: rgba(250, 237, 222, 0.72);
}

.story-cycle-title {
  color: rgba(154, 52, 18, 0.94);
  font-weight: 750;
  line-height: 1.2;
}

.story-cycle-links {
  display: grid;
  gap: 7px;
}

.story-cycle-link {
  appearance: none;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid rgba(96, 71, 43, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 620;
  line-height: 1.22;
  text-align: left;
}

.story-cycle-link:hover,
.story-cycle-link:focus-visible {
  border-color: rgba(154, 52, 18, 0.35);
  background: rgba(250, 237, 222, 0.9);
}

.story-cycle-link.active {
  border-color: rgba(154, 52, 18, 0.5);
  box-shadow: inset 0 0 0 1px rgba(154, 52, 18, 0.18);
  background: rgba(250, 237, 222, 0.98);
}

.teaching-browser-list {
  gap: 14px;
}

.teaching-browser-heading strong {
  margin-bottom: 0;
}

.teaching-group-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.teaching-group-card.active {
  border-color: rgba(154, 52, 18, 0.38);
  background: rgba(250, 237, 222, 0.72);
}

.teaching-group-title {
  color: rgba(154, 52, 18, 0.94);
  font-weight: 750;
  line-height: 1.2;
}

.teaching-link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 7px;
}

.teaching-link {
  appearance: none;
  min-height: 38px;
  padding: 9px 11px;
  border: 1px solid rgba(96, 71, 43, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 620;
  line-height: 1.22;
  text-align: left;
}

.teaching-link:hover,
.teaching-link:focus-visible {
  border-color: rgba(154, 52, 18, 0.35);
  background: rgba(250, 237, 222, 0.9);
}

.teaching-link.active {
  border-color: rgba(154, 52, 18, 0.5);
  box-shadow: inset 0 0 0 1px rgba(154, 52, 18, 0.18);
  background: rgba(250, 237, 222, 0.98);
}

.work-button.active,
.movement-button.active,
.toc-button.active {
  border-color: rgba(154, 52, 18, 0.45);
  box-shadow: inset 0 0 0 1px rgba(154, 52, 18, 0.18);
  background: rgba(250, 237, 222, 0.95);
}

.work-button:focus-visible,
.movement-button:focus-visible,
.toc-button:focus-visible {
  outline: 3px solid rgba(154, 52, 18, 0.28);
  outline-offset: 2px;
}

.work-button strong,
.movement-button strong,
.toc-button strong,
.result-card strong {
  display: block;
  margin-bottom: 4px;
}

.work-context,
.work-date,
.personal-library-context,
.personal-library-date,
.movement-button span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.work-date,
.result-date {
  color: var(--muted);
  font-style: italic;
  opacity: 0.85;
}

.movement-button {
  padding-block: 12px;
}

.movements-panel .panel-heading {
  gap: 8px;
  margin-bottom: 8px;
}

.movements-panel .panel-heading h2 {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  line-height: 1.08;
}

.movements-panel .panel-heading p {
  font-size: 0.8rem;
  line-height: 1.25;
}

.movement-list {
  gap: 8px;
}

.movement-button {
  padding: 10px 12px;
}

.movement-button strong {
  font-size: 0.94rem;
  line-height: 1.12;
  margin-bottom: 3px;
}

.movement-button span {
  font-size: 0.78rem;
  line-height: 1.22;
}

.resizable-list-frame {
  min-height: 0;
}

.panel-left .resizable-list {
  height: var(--resizable-list-default-height, auto);
  max-height: var(--resizable-list-max-height, none);
  min-height: var(--resizable-list-min-height, 150px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

#works-list.resizable-list {
  --resizable-list-default-height: min(42vh, 460px);
  --resizable-list-max-height: min(72vh, 760px);
  --resizable-list-min-height: 220px;
}

#movements-list.resizable-list {
  --resizable-list-default-height: min(32vh, 330px);
  --resizable-list-max-height: min(58vh, 560px);
  --resizable-list-min-height: 150px;
}

.list-resize-handle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 16px;
  margin-top: 4px;
  padding: 0;
  border: 1px solid rgba(96, 71, 43, 0.16);
  border-radius: 8px;
  background: rgba(250, 237, 222, 0.72);
  cursor: ns-resize;
  touch-action: none;
}

.list-resize-handle::before {
  content: "";
  width: 42px;
  height: 3px;
  border-radius: 999px;
  background: rgba(96, 71, 43, 0.34);
}

.list-resize-handle:hover,
.list-resize-handle:focus-visible,
.resizable-list-frame.is-resizing .list-resize-handle {
  border-color: rgba(154, 52, 18, 0.34);
  background: rgba(250, 237, 222, 0.96);
}

.list-resize-handle:focus-visible {
  outline: 3px solid rgba(154, 52, 18, 0.18);
  outline-offset: 2px;
}

@media (min-width: 761px) {
  .brand-line {
    display: flex;
    align-items: baseline;
    gap: 18px;
  }

  .brand-line .hero-message {
    margin-top: 0;
  }

  .panel-left .work-list {
    max-height: min(42vh, 460px);
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .panel-left .movement-list {
    max-height: min(32vh, 330px);
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .panel-left .toc-list {
    max-height: min(30vh, 320px);
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
  }
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.interp-panel {
  display: none;
}

.interp-body {
  display: grid;
  gap: 8px;
}

.interp-row {
  display: grid;
  gap: 4px;
}

.interp-row strong {
  font-size: 0.84rem;
  color: var(--accent);
}

.interp-row span {
  color: var(--text);
  line-height: 1.45;
}

.reader-body {
  white-space: pre-wrap;
  line-height: 1.65;
  font-size: 1rem;
  padding: 8px 2px 2px;
  max-height: calc(84vh - 120px);
  overflow: auto;
}

.reader-body mark,
.snippet mark {
  background: rgba(249, 115, 22, 0.24);
  padding: 0 2px;
}

.reader-body mark.saved-highlight,
.snippet mark.saved-highlight,
.expanded-reading mark.saved-highlight {
  background: rgba(250, 204, 21, 0.42);
  box-shadow: inset 0 -0.18em rgba(250, 204, 21, 0.55);
}

.selection-toolbar {
  position: absolute;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: min(360px, calc(100vw - 24px));
  padding: 8px;
  border: 1px solid rgba(96, 71, 43, 0.18);
  border-radius: 12px;
  background: rgba(255, 252, 247, 0.98);
  box-shadow: 0 12px 30px rgba(58, 43, 30, 0.18);
}

.selection-toolbar[hidden] {
  display: none;
}

.selection-toolbar button {
  border: 0;
  border-radius: 9px;
  padding: 7px 9px;
  background: rgba(250, 237, 222, 0.82);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
}

.selection-toolbar button:hover,
.selection-toolbar button:focus-visible {
  background: rgba(213, 91, 39, 0.16);
  outline: none;
}

.result-card {
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid rgba(96, 71, 43, 0.14);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.result-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 30px rgba(78, 49, 16, 0.08);
}

.result-card.expanded {
  background: rgba(255, 252, 247, 0.98);
  border-color: rgba(154, 52, 18, 0.28);
  box-shadow: 0 22px 42px rgba(78, 49, 16, 0.12);
}

.result-card.browse-reader .expanded-reading {
  max-height: none;
  overflow: visible;
}

.result-card.focus-reader {
  cursor: default;
  min-height: calc(100vh - 260px);
}

.boundary-state {
  align-content: start;
}

.boundary-card {
  cursor: default;
  background: rgba(255, 252, 247, 0.94);
  border-color: rgba(154, 52, 18, 0.24);
}

.boundary-card:hover {
  transform: none;
  box-shadow: none;
}

.boundary-note {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.45;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.result-actions-primary,
.result-actions-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.result-actions-more {
  width: 100%;
  margin-top: 4px;
  border-radius: 12px;
  border: 1px solid rgba(96, 71, 43, 0.15);
  background: rgba(255, 255, 255, 0.56);
  padding: 8px 10px;
}

.result-actions-more summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.92rem;
  list-style: none;
}

.result-actions-more summary::-webkit-details-marker {
  display: none;
}

.result-actions-more[open] .result-actions-secondary {
  margin-top: 10px;
}

.inline-button {
  padding: 8px 12px;
  border-radius: 10px;
}

.inline-button.secondary,
.action-button.secondary {
  background: rgba(96, 71, 43, 0.1);
  color: var(--text);
}

.load-more-passages {
  display: flex;
  justify-content: center;
  padding: 8px 0 4px;
}

.load-more-button {
  min-width: min(100%, 260px);
}

.load-more-button:disabled {
  opacity: 0.68;
  cursor: wait;
}

.snippet {
  margin-top: 10px;
  color: var(--text);
  line-height: 1.55;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.match-why {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.95rem;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag-pill {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(154, 52, 18, 0.1);
  color: var(--accent);
  font-size: 0.82rem;
}

.debug-block {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(96, 71, 43, 0.12);
}

.expanded-reading {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(250, 237, 222, 0.62);
  border: 1px solid rgba(154, 52, 18, 0.12);
  white-space: pre-wrap;
  line-height: 1.62;
  font-size: var(--reading-font-size);
  max-height: calc(100vh - 280px);
  overflow: auto;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
}

.verse-reading {
  line-height: 1.8;
  letter-spacing: 0.01em;
}

.focus-reader .expanded-reading {
  max-height: none;
  min-height: calc(100vh - 360px);
  font-size: calc(var(--reading-font-size) * 1.05);
}

.mobile-reading-actions {
  display: flex;
  justify-content: flex-start;
  margin-top: 16px;
}

.reading-nav-top {
  display: flex;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.expanded-reading-title {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reader-poem-guide {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgba(154, 52, 18, 0.16);
  border-radius: 8px;
  background: rgba(255, 250, 244, 0.72);
  white-space: normal;
  font-size: 0.92rem;
  line-height: 1.35;
}

.reader-poem-guide-title {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.reader-poem-guide ol {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 6px 18px;
  margin: 0;
  padding-left: 20px;
}

.reader-poem-guide li {
  padding-left: 2px;
}

.reader-poem-guide a {
  color: var(--ink);
  text-decoration-color: rgba(154, 52, 18, 0.34);
  text-underline-offset: 3px;
}

.reader-poem-guide a:hover,
.reader-poem-guide a:focus-visible,
.reader-poem-guide-button:hover,
.reader-poem-guide-button:focus-visible {
  color: var(--accent);
  outline: none;
}

.reader-poem-guide-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration-line: underline;
  text-decoration-color: rgba(154, 52, 18, 0.34);
  text-underline-offset: 3px;
  cursor: pointer;
}

.reader-poem-guide-button.active {
  color: var(--accent);
}

.reader-poem-guide-poem {
  display: inline;
  font-weight: 700;
}

.reader-poem-guide-author {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.reader-poem-anchor {
  display: block;
  position: relative;
  top: -12px;
  height: 0;
}

.reader-footnote {
  position: relative;
  display: inline-flex;
  margin-left: 2px;
  white-space: normal;
}

.reader-footnote-button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0 4px;
  min-width: 18px;
  min-height: 18px;
  background: rgba(181, 75, 22, 0.12);
  color: var(--accent);
  font: inherit;
  font-size: 0.68em;
  line-height: 1.2;
  cursor: pointer;
}

.reader-footnote-button:hover,
.reader-footnote-button:focus-visible {
  background: rgba(181, 75, 22, 0.22);
  outline: 2px solid rgba(181, 75, 22, 0.28);
  outline-offset: 2px;
}

.reader-footnote-popover {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(100% + 8px);
  width: min(320px, calc(100vw - 56px));
  padding: 10px 12px;
  border: 1px solid rgba(154, 52, 18, 0.22);
  border-radius: 8px;
  background: #fffaf4;
  color: var(--ink);
  box-shadow: 0 12px 28px rgba(52, 33, 20, 0.18);
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.reader-footnote:focus-within .reader-footnote-popover,
.reader-footnote:hover .reader-footnote-popover,
.reader-footnote.is-open .reader-footnote-popover {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.reader-footnotes {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(96, 71, 43, 0.16);
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: normal;
}

.reader-footnotes-item {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  margin-top: 8px;
}

.reader-footnotes-marker {
  color: var(--accent);
  font-weight: 700;
}

.debug-grid {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

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

.search-progress-state {
  align-content: start;
}

.search-progress-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(96, 71, 43, 0.14);
  border-radius: 16px;
  background: rgba(255, 252, 247, 0.92);
}

.search-progress-copy {
  display: grid;
  gap: 4px;
}

.search-progress-copy strong {
  color: var(--text);
}

.search-progress-copy span {
  color: var(--muted);
  line-height: 1.45;
}

.search-progress-track {
  position: relative;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(96, 71, 43, 0.12);
}

.search-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(154, 52, 18, 0.38), var(--accent), rgba(154, 52, 18, 0.38));
  animation: search-progress-sweep 1.25s ease-in-out infinite;
}

@keyframes search-progress-sweep {
  0% {
    transform: translateX(-105%);
  }
  100% {
    transform: translateX(245%);
  }
}

.tiny {
  font-size: 0.85rem;
}

@media (prefers-reduced-motion: reduce) {
  .search-progress-bar {
    animation: none;
    width: 100%;
  }
}

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .panel {
    min-height: auto;
  }

  .panel-left {
    height: auto;
  }

  .reader-body {
    max-height: 60vh;
  }
}

@media (max-width: 760px) {
  .shell {
    padding: 14px;
  }

  .panel-left {
    max-width: none;
    max-height: none;
    overflow: visible;
    padding-right: 16px;
  }

  .shell.focus-mode {
    padding: 10px 10px 18px;
  }

  .shell.focus-mode .topbar {
    margin-bottom: 10px;
  }

  .mobile-home .panel-right {
    order: 1;
  }

  .mobile-home .panel-left {
    order: 2;
  }

  .mobile-home .panel-center {
    order: 3;
  }

  .mobile-has-search .panel-center {
    order: 1;
  }

  .mobile-has-search .panel-right {
    order: 2;
  }

  .mobile-has-search .panel-left {
    order: 3;
  }

  .mobile-home .panel-right,
  .mobile-has-search .panel-right {
    display: contents;
  }

  .mobile-home .query-panel,
  .mobile-has-search .query-panel {
    order: 1;
    padding: 16px;
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 20px;
    box-shadow: var(--shadow);
  }

  .mobile-has-search .query-panel {
    order: 2;
  }

  .mobile-home #saved-panel,
  .mobile-has-search #saved-panel {
    order: 4;
  }

  .mobile-home #feedback-panel,
  .mobile-home #benchmark-panel,
  .mobile-home #demo-panel,
  .mobile-home #tests-panel,
  .mobile-home #status-panel,
  .mobile-has-search #feedback-panel,
  .mobile-has-search #benchmark-panel,
  .mobile-has-search #demo-panel,
  .mobile-has-search #tests-panel,
  .mobile-has-search #status-panel {
    order: 5;
  }

  .mobile-browse-toc .panel-left {
    order: 1;
    max-width: none;
    width: 100%;
  }

  .mobile-browse-toc .panel-center,
  .mobile-browse-toc .panel-right {
    display: none;
  }

  .mobile-browse-toc .panel-right {
    display: block;
    order: 2;
  }

  .mobile-browse-toc .panel-right > .panel-heading,
  .mobile-browse-toc .panel-right #question-form,
  .mobile-browse-toc .panel-right .question-tools,
  .mobile-browse-toc .panel-right #status-panel,
  .mobile-browse-toc .panel-right #feedback-panel,
  .mobile-browse-toc .panel-right #benchmark-panel,
  .mobile-browse-toc .panel-right #demo-panel,
  .mobile-browse-toc .panel-right #tests-panel {
    display: none;
  }

  .mobile-browse-toc .panel-right .searchbar-side {
    display: block;
  }

  .mobile-browse-toc .panel-left {
    display: flex;
    flex-direction: column;
  }

  .mobile-browse-toc .panel-left section:first-child {
    order: 1;
  }

  .mobile-browse-toc #movements-panel {
    order: 2;
  }

  .mobile-browse-toc .work-list {
    max-height: min(28vh, 220px);
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-browse-toc .toc-list {
    max-height: none;
  }

  .mobile-browse-reading .panel-center {
    order: 1;
  }

  .mobile-browse-reading .panel-left {
    order: 2;
    max-width: none;
    width: 100%;
  }

  .mobile-browse-reading .panel-right {
    order: 3;
  }

  .mobile-shakespeare-toc .panel-center {
    order: 1;
    display: flex;
  }

  .mobile-shakespeare-toc .panel-left {
    order: 2;
    max-width: none;
    width: 100%;
  }

  .mobile-shakespeare-toc .panel-right {
    display: none;
  }

  .mobile-shakespeare-toc .results-list.toc-browser-list {
    gap: 12px;
  }

  .mobile-shakespeare-toc .toc-browser-card {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    min-height: 0;
  }

  .mobile-shakespeare-toc .toc-browser-card strong,
  .mobile-shakespeare-toc .toc-browser-card .result-meta {
    padding-left: 4px;
    padding-right: 4px;
  }

  .mobile-shakespeare-toc .toc-preview-card .expanded-reading {
    max-height: min(56vh, 540px);
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    line-height: 1.84;
  }

  .mobile-shakespeare-toc .toc-preview-card .expanded-reading-title {
    margin-bottom: 8px;
    padding: 0 4px;
  }

  .mobile-shakespeare-toc .play-act-link,
  .mobile-shakespeare-toc .play-scene-link {
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .panel-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .reader-controls {
    justify-content: flex-start;
  }

  .topbar {
    grid-template-columns: 1fr;
  }

  .search-controls {
    flex-direction: column;
  }

  .result-actions {
    flex-direction: column;
  }

  .result-actions-primary,
  .result-actions-secondary {
    width: 100%;
    flex-direction: column;
  }

  .inline-button,
  .search-controls button {
    width: 100%;
  }

  .expanded-reading {
    max-height: 220px;
    padding: 12px;
    line-height: 1.72;
  }

  .verse-reading {
    line-height: 1.92;
    padding-left: 10px;
    padding-right: 10px;
  }

  .focus-reader .expanded-reading {
    min-height: 0;
    max-height: none;
  }

  .shell.focus-mode .panel-center {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .shell.focus-mode .panel-heading {
    margin-bottom: 10px;
    padding: 0 4px;
  }

  .shell.focus-mode .result-card.focus-reader {
    background: transparent;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    padding: 0 4px;
    min-height: auto;
  }

  .shell.focus-mode .result-card strong,
  .shell.focus-mode .result-card .result-meta {
    padding: 0;
  }

  .shell.focus-mode .expanded-reading {
    margin-top: 10px;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .shell.focus-mode .expanded-reading-title {
    margin-bottom: 10px;
  }

  .shell.mobile-browse-reading .reader-controls {
    gap: 10px;
  }

  .shell.mobile-browse-reading #focus-return {
    width: 100%;
  }

  .shell.mobile-browse-reading #font-smaller,
  .shell.mobile-browse-reading #font-reset,
  .shell.mobile-browse-reading #font-larger,
  .shell.mobile-browse-reading #toggle-highlights {
    display: none;
  }

  #benchmark-panel {
    display: none;
  }

  .mobile-home .panel-left,
  .mobile-has-search .panel-left {
    padding-right: 16px;
  }

  .mobile-home .work-list,
  .mobile-has-search .work-list,
  .mobile-home .movement-list,
  .mobile-has-search .movement-list {
    max-height: min(38vh, 320px);
    overflow-y: auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .shell.mobile-mode .work-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .shell.mobile-mode .work-button {
    appearance: none;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    height: auto !important;
    block-size: auto !important;
    min-height: max-content;
    padding: 12px 14px;
    border-radius: 14px;
    overflow: visible;
    white-space: normal;
  }

  .shell.mobile-mode .work-button strong {
    margin-bottom: 5px;
    font-size: 1.05rem;
    line-height: 1.12;
    overflow-wrap: anywhere;
    hyphens: auto;
  }

  .shell.mobile-mode .work-context,
  .shell.mobile-mode .work-date {
    font-size: 0.82rem;
    line-height: 1.22;
    overflow-wrap: anywhere;
  }

  .shell.mobile-mode .work-date {
    margin-top: 3px;
  }

  .mobile-home #status-panel,
  .mobile-home #feedback-panel,
  .mobile-home #demo-panel,
  .mobile-home #tests-panel {
    display: none;
  }

  .mobile-reading-actions .inline-button {
    width: 100%;
  }

  .reading-nav-top .inline-button {
    width: 100%;
  }
}

.panel-left #works-list.resizable-list,
.panel-left #movements-list.resizable-list {
  height: var(--resizable-list-default-height, auto);
  max-height: var(--resizable-list-max-height, none);
  min-height: var(--resizable-list-min-height, 150px);
}

.mobile-home #works-list.resizable-list,
.mobile-has-search #works-list.resizable-list {
  --resizable-list-default-height: min(38vh, 320px);
  --resizable-list-max-height: min(72vh, 620px);
}

.mobile-home #movements-list.resizable-list,
.mobile-has-search #movements-list.resizable-list {
  --resizable-list-default-height: min(38vh, 320px);
  --resizable-list-max-height: min(62vh, 520px);
}

.mobile-browse-toc #works-list.resizable-list {
  --resizable-list-default-height: min(28vh, 220px);
  --resizable-list-max-height: min(62vh, 520px);
}
