/* ==========================================================================
   VERSEFORGE — STYLES & THEME PROFILES (style.css)
   ========================================================================== */

/* ==========================================================================
   7 DYNAMIC BIBLICAL COLOR PROFILES (CSS THEMES)
   ========================================================================== */

:root {
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 1. Anvil & Parchment (Light) - Default */
:root, [data-theme="parchment-gold"] {
  --bg-void: #f6f0e7;
  --bg-grad-1: #faf6ef;
  --bg-grad-2: #f6f0e7;
  --bg-grad-3: #eee5d8;
  --bg-card: rgba(255, 253, 249, 0.94);
  --bg-card-hover: rgba(255, 255, 255, 0.98);
  --bg-card-dark: rgba(243, 235, 222, 0.92);
  
  --border-subtle: rgba(171, 116, 37, 0.22);
  --border-sky: rgba(171, 116, 37, 0.55);
  --border-lime: rgba(147, 99, 34, 0.50);
  --border-yellow: rgba(202, 138, 4, 0.50);
  
  --sky-bright: #ab7425;
  --sky-light: #c58d3c;
  --sky-glow: rgba(171, 116, 37, 0.35);
  
  --lime-bright: #936322;
  --lime-light: #ab7425;
  --lime-soft: #dfbe89;
  --lime-glow: rgba(171, 116, 37, 0.30);
  
  --sun-yellow: #ca8a04;
  --sun-light: #eab308;
  --sun-glow: rgba(202, 138, 4, 0.30);
  
  --text-chalk: #1f2126;
  --text-linen: #000000;
  --text-muted: #797166;
  --text-untyped: #b0a89d;
  --text-correct: #000000;
  
  --rose-crimson: #b91c1c;
  --rose-glow: rgba(185, 28, 28, 0.35);

  --bloom-grad: linear-gradient(180deg, rgba(171, 116, 37, 0.14) 0%, rgba(147, 99, 34, 0.08) 45%, rgba(180, 83, 9, 0.04) 75%, transparent 100%);
  --badge-text: #ab7425;
  --badge-bg: rgba(171, 116, 37, 0.12);
  --badge-border: rgba(171, 116, 37, 0.45);
  --badge-glow: rgba(171, 116, 37, 0.15);

  --caret-grad: linear-gradient(180deg, #ab7425 0%, #000000 100%);

  --ui-bg: #f6f0e7;
  --ui-surface: #fbf8f2;
  --ui-surface-2: #ede5d8;
  --ui-ink: #1f2126;
  --ui-muted: #787065;
  --ui-line: #ddd4c4;
  --ui-accent: #ab7425;
  --ui-accent-strong: #8c5d1c;
  --ui-accent-soft: #f0e3ce;
  --ui-focus: #8c5d1c;
}

/* 2. Eden & Beryl (Light) */
[data-theme="olive-earth"] {
  --bg-void: #f2fbf6;
  --bg-grad-1: #fafffc;
  --bg-grad-2: #edf9f2;
  --bg-grad-3: #def4e7;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: rgba(240, 253, 244, 0.98);
  --bg-card-dark: rgba(220, 247, 230, 0.90);
  
  --border-subtle: rgba(101, 163, 13, 0.25);
  --border-sky: rgba(2, 132, 199, 0.55);
  --border-lime: rgba(101, 163, 13, 0.50);
  --border-yellow: rgba(202, 138, 4, 0.50);
  
  --sky-bright: #0284c7;
  --sky-light: #0369a1;
  --sky-glow: rgba(2, 132, 199, 0.35);
  
  --lime-bright: #65a30d;
  --lime-light: #4d7c0f;
  --lime-soft: #bef264;
  --lime-glow: rgba(101, 163, 13, 0.30);
  
  --sun-yellow: #ca8a04;
  --sun-light: #eab308;
  --sun-glow: rgba(202, 138, 4, 0.30);
  
  --text-chalk: #052e16;
  --text-linen: #0284c7;
  --text-muted: #486a55;
  --text-untyped: #a8bcc5;
  --text-correct: #089cb9;
  
  --rose-crimson: #dc2626;
  --rose-glow: rgba(220, 38, 38, 0.30);

  --bloom-grad: linear-gradient(180deg, rgba(2, 132, 199, 0.12) 0%, rgba(101, 163, 13, 0.08) 45%, rgba(202, 138, 4, 0.05) 75%, transparent 100%);
  --badge-text: #4d7c0f;
  --badge-bg: rgba(101, 163, 13, 0.12);
  --badge-border: rgba(101, 163, 13, 0.40);
  --badge-glow: rgba(101, 163, 13, 0.15);

  --caret-grad: linear-gradient(180deg, #0284c7 0%, #65a30d 50%, #ca8a04 100%);

  --ui-bg: #eef2eb;
  --ui-surface: #f8faf6;
  --ui-surface-2: #e6ece1;
  --ui-ink: #273029;
  --ui-muted: #667166;
  --ui-line: #cad2c6;
  --ui-accent: #667a58;
  --ui-accent-strong: #526b49;
  --ui-accent-soft: #e0e8db;
  --ui-focus: #819178;
}

/* 3. Azure & Chalcedony (Light) */
[data-theme="light-word"] {
  --bg-void: #f4f8fc;
  --bg-grad-1: #ffffff;
  --bg-grad-2: #eff6ff;
  --bg-grad-3: #dbeafe;
  --bg-card: rgba(255, 255, 255, 0.94);
  --bg-card-hover: rgba(240, 249, 255, 1);
  --bg-card-dark: rgba(224, 242, 254, 0.90);
  
  --border-subtle: rgba(2, 132, 199, 0.25);
  --border-sky: rgba(0, 102, 255, 0.55);
  --border-lime: rgba(37, 99, 235, 0.50);
  --border-yellow: rgba(30, 58, 138, 0.50);
  
  --sky-bright: #0066ff;
  --sky-light: #0044cc;
  --sky-glow: rgba(0, 102, 255, 0.35);
  
  --lime-bright: #1d4ed8;
  --lime-light: #1e40af;
  --lime-soft: #3b82f6;
  --lime-glow: rgba(37, 99, 235, 0.30);
  
  --sun-yellow: #1e3a8a;
  --sun-light: #1e1b4b;
  --sun-glow: rgba(30, 58, 138, 0.25);
  
  --text-chalk: #0c2340;
  --text-linen: #0066ff;
  --text-muted: #526c88;
  --text-untyped: #b3cde6;
  --text-correct: #1d4ed8;
  
  --rose-crimson: #dc2626;
  --rose-glow: rgba(220, 38, 38, 0.25);

  --bloom-grad: linear-gradient(180deg, rgba(0, 102, 255, 0.12) 0%, rgba(37, 99, 235, 0.06) 45%, transparent 80%);
  --badge-text: #0066ff;
  --badge-bg: rgba(0, 102, 255, 0.08);
  --badge-border: rgba(0, 102, 255, 0.38);
  --badge-glow: rgba(0, 102, 255, 0.15);

  --caret-grad: linear-gradient(180deg, #0066ff 0%, #1e3a8a 100%);

  --ui-bg: #f2f5f8;
  --ui-surface: #fbfcfd;
  --ui-surface-2: #e8edf2;
  --ui-ink: #25313d;
  --ui-muted: #66727d;
  --ui-line: #ccd5de;
  --ui-accent: #53769b;
  --ui-accent-strong: #416383;
  --ui-accent-soft: #e2e9f0;
  --ui-focus: #718aa3;
}

/* 4. Dawn & Ligure (Light) */
[data-theme="rose-ligure"] {
  --bg-void: #fcf5f3;
  --bg-grad-1: #fff9f5;
  --bg-grad-2: #faeaec;
  --bg-grad-3: #eee1ec;
  --bg-card: rgba(255, 252, 250, 0.94);
  --bg-card-hover: rgba(255, 248, 245, 0.98);
  --bg-card-dark: rgba(248, 232, 234, 0.92);
  
  --border-subtle: rgba(225, 29, 72, 0.22);
  --border-sky: rgba(225, 29, 72, 0.55);
  --border-lime: rgba(234, 88, 12, 0.50);
  --border-yellow: rgba(217, 0, 197, 0.45);
  
  --sky-bright: #e11d48;
  --sky-light: #be123c;
  --sky-glow: rgba(225, 29, 72, 0.35);
  
  --lime-bright: #ea580c;
  --lime-light: #9a3412;
  --lime-soft: #f97316;
  --lime-glow: rgba(234, 88, 12, 0.30);
  
  --sun-yellow: #d900c5;
  --sun-light: #e100ff;
  --sun-glow: rgba(218, 0, 255, 0.30);
  
  --text-chalk: #330d1a;
  --text-linen: #e11d48;
  --text-muted: #7d4957;
  --text-untyped: #cfa3b0;
  --text-correct: #ff2986;
  
  --rose-crimson: #b91c1c;
  --rose-glow: rgba(185, 28, 28, 0.35);

  --bloom-grad: linear-gradient(180deg, rgba(225, 29, 72, 0.12) 0%, rgba(234, 88, 12, 0.07) 45%, rgba(202, 138, 4, 0.04) 75%, transparent 100%);
  --badge-text: #be123c;
  --badge-bg: rgba(225, 29, 72, 0.10);
  --badge-border: rgba(225, 29, 72, 0.40);
  --badge-glow: rgba(225, 29, 72, 0.15);

  --caret-grad: linear-gradient(180deg, #e11d48 0%, #ea580c 50%, #ca8a04 100%);

  --ui-bg: #f5eeec;
  --ui-surface: #fcf9f7;
  --ui-surface-2: #eee1de;
  --ui-ink: #352a2d;
  --ui-muted: #78696c;
  --ui-line: #d8c9ca;
  --ui-accent: #8c5d66;
  --ui-accent-strong: #774853;
  --ui-accent-soft: #eee0e2;
  --ui-focus: #9b7278;
}

/* 5. Slate & Emerald (Dark) */
[data-theme="slate-emerald"] {
  --bg-void: #0d0f12;
  --bg-grad-1: #202127;
  --bg-grad-2: #15161a;
  --bg-grad-3: #0d0f12;
  --bg-card: rgba(26, 27, 33, 0.88);
  --bg-card-hover: rgba(36, 38, 46, 0.95);
  --bg-card-dark: rgba(18, 19, 24, 0.75);
  
  --border-subtle: rgba(120, 113, 108, 0.25);
  --border-sky: rgba(56, 189, 248, 0.4);
  --border-lime: rgba(190, 242, 100, 0.45);
  --border-yellow: rgba(250, 204, 21, 0.45);
  
  --sky-bright: #38bdf8;
  --sky-light: #7dd3fc;
  --sky-glow: rgba(56, 189, 248, 0.35);
  
  --lime-bright: #a3e635;
  --lime-light: #bef264;
  --lime-soft: #d9f99d;
  --lime-glow: rgba(190, 242, 100, 0.35);
  
  --sun-yellow: #facc15;
  --sun-light: #fef08a;
  --sun-glow: rgba(250, 204, 21, 0.4);
  
  --text-chalk: #f5f5f4;
  --text-linen: #fafaf9;
  --text-muted: #a8a29e;
  --text-untyped: #8c857e;
  --text-correct: #bef264;
  
  --rose-crimson: #fb7185;
  --rose-glow: rgba(251, 113, 133, 0.4);

  --bloom-grad: linear-gradient(180deg, rgba(56, 189, 248, 0.14) 0%, rgba(190, 242, 100, 0.09) 45%, rgba(250, 204, 21, 0.04) 75%, transparent 100%);
  --badge-text: #38bdf8;
  --badge-bg: rgba(56, 189, 248, 0.12);
  --badge-border: rgba(56, 189, 248, 0.35);
  --badge-glow: rgba(56, 189, 248, 0.15);

  --caret-grad: linear-gradient(180deg, #ffffff 0%, #38bdf8 55%, #bef264 100%);

  --ui-bg: #0d0f12;
  --ui-surface: #12161a;
  --ui-surface-2: #171d20;
  --ui-ink: #f3f0e8;
  --ui-muted: #a8ada9;
  --ui-line: #30383a;
  --ui-accent: #8fb79b;
  --ui-accent-strong: #a9d0b1;
  --ui-accent-soft: #1d2923;
  --ui-focus: #7ca18a;
}

/* 6. Ember & Sardius (Dark) */
[data-theme="sunset-fire"] {
  --bg-void: #050203;
  --bg-grad-1: #1f0a07;
  --bg-grad-2: #120504;
  --bg-grad-3: #050203;
  --bg-card: rgba(28, 10, 8, 0.88);
  --bg-card-hover: rgba(40, 15, 12, 0.95);
  --bg-card-dark: rgba(16, 5, 4, 0.85);
  
  --border-subtle: rgba(255, 68, 0, 0.22);
  --border-sky: rgba(255, 68, 0, 0.60);
  --border-lime: rgba(255, 170, 0, 0.50);
  --border-yellow: rgba(255, 215, 0, 0.50);
  
  --sky-bright: #ff3700;
  --sky-light: #ff8555;
  --sky-glow: rgba(255, 55, 0, 0.55);
  
  --lime-bright: #ffaa00;
  --lime-light: #ffc04d;
  --lime-soft: #fff6e5;
  --lime-glow: rgba(255, 170, 0, 0.50);
  
  --sun-yellow: #ffd000;
  --sun-light: #fff099;
  --sun-glow: rgba(255, 208, 0, 0.55);
  
  --text-chalk: #fff5f2;
  --text-linen: #ffffff;
  --text-muted: #b3887f;
  --text-untyped: #9e6960;
  --text-correct: #ffaa00;
  
  --rose-crimson: #ff1744;
  --rose-glow: rgba(255, 23, 68, 0.50);

  --bloom-grad: linear-gradient(180deg, rgba(255, 55, 0, 0.20) 0%, rgba(255, 170, 0, 0.10) 45%, rgba(255, 208, 0, 0.04) 75%, transparent 100%);
  --badge-text: #ff8555;
  --badge-bg: rgba(255, 55, 0, 0.14);
  --badge-border: rgba(255, 68, 0, 0.45);
  --badge-glow: rgba(255, 55, 0, 0.20);

  --caret-grad: linear-gradient(180deg, #ffffff 0%, #ff3700 55%, #ffd000 100%);

  --ui-bg: #17110f;
  --ui-surface: #1e1714;
  --ui-surface-2: #261c18;
  --ui-ink: #f5eee5;
  --ui-muted: #b9aaa1;
  --ui-line: #40302a;
  --ui-accent: #c58c65;
  --ui-accent-strong: #d8a27a;
  --ui-accent-soft: #30221c;
  --ui-focus: #a46b4b;
}

/* 7. Cobalt & Sapphire (Dark) */
[data-theme="heavenly-blue"] {
  --bg-void: #02040d;
  --bg-grad-1: #091226;
  --bg-grad-2: #050a16;
  --bg-grad-3: #02040d;
  --bg-card: rgba(10, 20, 42, 0.88);
  --bg-card-hover: rgba(16, 32, 68, 0.95);
  --bg-card-dark: rgba(6, 12, 26, 0.82);
  
  --border-subtle: rgba(0, 220, 255, 0.22);
  --border-sky: rgba(0, 220, 255, 0.55);
  --border-lime: rgba(96, 165, 250, 0.50);
  --border-yellow: rgba(167, 139, 250, 0.50);
  
  --sky-bright: #00e1ff;
  --sky-light: #8cf3ff;
  --sky-glow: rgba(0, 225, 255, 0.50);
  
  --lime-bright: #60a5fa;
  --lime-light: #bfdbfe;
  --lime-soft: #eff6ff;
  --lime-glow: rgba(96, 165, 250, 0.45);
  
  --sun-yellow: #a78bfa;
  --sun-light: #ddd6fe;
  --sun-glow: rgba(167, 139, 250, 0.48);
  
  --text-chalk: #f0f7ff;
  --text-linen: #ffffff;
  --text-muted: #889fc2;
  --text-untyped: #6884ab;
  --text-correct: #cbdff5;
  
  --rose-crimson: #ff2a6d;
  --rose-glow: rgba(255, 42, 109, 0.45);

  --bloom-grad: linear-gradient(180deg, rgba(0, 225, 255, 0.16) 0%, rgba(96, 165, 250, 0.09) 45%, rgba(167, 139, 250, 0.04) 75%, transparent 100%);
  --badge-text: #00e1ff;
  --badge-bg: rgba(0, 225, 255, 0.12);
  --badge-border: rgba(0, 220, 255, 0.45);
  --badge-glow: rgba(0, 225, 255, 0.20);

  --caret-grad: linear-gradient(180deg, #ffffff 0%, #00e1ff 55%, #60a5fa 100%);

  --ui-bg: #0d121b;
  --ui-surface: #111a27;
  --ui-surface-2: #172333;
  --ui-ink: #f1f4f7;
  --ui-muted: #9eabb8;
  --ui-line: #2d3a48;
  --ui-accent: #86a7c8;
  --ui-accent-strong: #a8c4df;
  --ui-accent-soft: #1b2837;
  --ui-focus: #7799bc;
}

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--ui-bg);
  color: var(--ui-ink);
  font-family: var(--font-sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
  transition: background-color 260ms ease, color 260ms ease;
}

#particles-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 350;
  contain: strict;
}

/* ==========================================================================
   HEADER SECTION
   ========================================================================== */

header.editorial-header.minimal-header {
  position: relative;
  z-index: 120;
  min-height: 62px;
  padding: 0.7rem clamp(1rem, 2.5vw, 2.2rem);
  display: grid;
  grid-template-columns: 1fr;
  align-items: center;
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-line);
  width: 100%;
}

.minimal-header .brand-group {
  justify-self: center;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
}

.minimal-header .brand-title {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--ui-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border: 1px solid var(--ui-line);
  font-family: var(--font-ui);
  font-size: 0.62rem;
  letter-spacing: 0.02em;
  color: var(--ui-accent);
}

.minimal-header .brand-subtitle {
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 700;
  color: var(--ui-muted);
  letter-spacing: 0.13em;
  margin-top: 0.16rem;
  white-space: nowrap;
}

/* ==========================================================================
   MAIN CONTAINER (FULL-WIDTH CONFIGURATION)
   ========================================================================== */

main.editorial-main {
  width: 100%;
  max-width: 100%;
  padding: 0.8rem clamp(1rem, 3vw, 3rem) 2rem;
  display: block;
  position: relative;
  z-index: 1;
  flex: 1;
}

main.editorial-main.full-width {
  width: 100%;
  max-width: 100%;
}

.workspace-column {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.workspace-column.full-width {
  width: 100%;
  max-width: 100%;
}

/* ==========================================================================
   PASSAGE HEADER STRIP & POPOVER SELECTOR
   ========================================================================== */

.passage-header-strip {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.15rem 0 0.55rem;
  border-bottom: 1px solid var(--ui-line);
  width: 100%;
}

.passage-header-strip .verse-heading {
  margin-bottom: 0;
}

.eyebrow {
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ui-accent);
}

.verse-title {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 600;
  color: var(--ui-ink);
  letter-spacing: -0.02em;
  line-height: 1.15;
  letter-spacing: normal;
}

.verse-subline {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  margin-top: 0.15rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--ui-muted);
}

.passage-control-wrap {
  position: relative;
  flex-shrink: 0;
  margin-bottom: 0.15rem;
}

.passage-toggle-btn {
  appearance: none;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  color: var(--ui-ink);
  padding: 0.45rem 1.15rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.55rem;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.passage-toggle-btn:hover,
.passage-toggle-btn[aria-expanded="true"] {
  border-color: var(--ui-accent);
  background: var(--ui-surface-2);
  color: var(--ui-accent-strong);
}

.passage-toggle-btn .chev {
  transition: transform 180ms ease;
  opacity: 0.6;
}

.passage-toggle-btn[aria-expanded="true"] .chev {
  transform: rotate(180deg);
}

.passage-popover {
  position: absolute;
  z-index: 250;
  top: calc(100% + 0.5rem);
  right: 0;
  left: auto;
  width: min(480px, calc(100vw - 2rem));
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 0.85rem;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.16);
  padding: 1.15rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
  display: block;
}

.passage-popover.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.popover-kicker {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--ui-accent);
  margin-bottom: 0.4rem;
}

.reference-entry {
  display: flex;
  align-items: center;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-surface);
  overflow: hidden;
  min-height: 2.2rem;
}

.passage-reference-input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ui-ink);
  padding: 0.45rem 1rem;
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 700;
}

.passage-reference-input::placeholder {
  color: var(--ui-muted);
  opacity: 0.8;
}

.passage-reference-btn {
  border: none;
  border-left: 1px solid var(--ui-line);
  background: transparent;
  color: var(--ui-muted);
  padding: 0.45rem 1.15rem;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: color 150ms ease, background-color 150ms ease;
}

.passage-reference-btn:hover {
  color: var(--ui-ink);
  background: var(--ui-surface-2);
}

.popover-divider {
  height: 1px;
  background: var(--ui-line);
  margin: 0.85rem 0;
}

.passage-browse-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.passage-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background-color: var(--ui-surface);
  color: var(--ui-ink);
  padding: 0.45rem 1.6rem;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
  text-align-last: center;
  background-image: linear-gradient(45deg, transparent 50%, var(--ui-muted) 50%), linear-gradient(135deg, var(--ui-muted) 50%, transparent 50%);
  background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  flex: 1;
  min-width: 0;
  outline: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.passage-select:hover, .passage-select:focus {
  border-color: var(--ui-accent);
  background-color: var(--ui-surface-2);
}

.passage-select option {
  text-align: left;
  background: var(--ui-surface);
  color: var(--ui-ink);
}

.passage-scope-toggle {
  display: flex;
  width: 100%;
  margin-bottom: 0.85rem;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  padding: 3px;
  gap: 3px;
  background: var(--ui-surface);
}

.passage-scope-toggle .scripture-mode-choice {
  flex: 1;
  min-width: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-muted);
  border-radius: 999px;
  padding: 0.42rem 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.passage-scope-toggle .scripture-mode-choice:hover {
  color: var(--ui-ink);
}

.passage-scope-toggle .scripture-mode-choice.active {
  color: var(--ui-ink);
  background: var(--ui-surface-2);
  border-color: var(--ui-line);
}

.verse-grid-hint {
  font-family: var(--font-ui);
  font-size: 0.66rem;
  color: var(--ui-muted);
  margin-bottom: 0.5rem;
}

.verse-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.3rem;
  max-height: 195px;
  overflow-y: auto;
  padding-right: 0.2rem;
}

.verse-grid-cell {
  border: 1px solid var(--ui-line);
  background: transparent;
  color: var(--ui-muted);
  border-radius: 0.4rem;
  padding: 0.4rem 0;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.verse-grid-cell:hover {
  border-color: var(--ui-accent);
  color: var(--ui-ink);
  background: var(--ui-surface-2);
}

.verse-grid-cell.in-range {
  background: var(--ui-accent);
  border-color: var(--ui-accent);
  color: var(--ui-surface);
}

.verse-grid-cell.current:not(.in-range) {
  border-color: var(--ui-accent-strong);
  color: var(--ui-ink);
  font-weight: 800;
}

/* ==========================================================================
   STREAMLINED CONTROLS STRIP
   ========================================================================== */

.streamlined-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem 0.65rem;
  padding: 0.35rem 0 0.45rem;
  border-bottom: none;
  flex-wrap: wrap; /* Allows buttons to wrap cleanly onto a new row instead of extending off-screen */
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.visual-group {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  flex-shrink: 0;
}

.control-label {
  font-family: var(--font-ui);
  font-size: 0.52rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--ui-muted);
  text-transform: uppercase;
  white-space: nowrap;
}

.control-separator {
  width: 1px;
  height: 16px;
  background: var(--ui-line);
  flex: 0 0 auto;
  margin: 0 0.15rem;
}

/* Theme Swatches (Light themes first from left to right, then dark themes) */
.theme-swatches {
  display: flex;
  align-items: center;
  gap: 0.28rem;
}

.theme-swatch-circle {
  appearance: none;
  width: 16px;
  height: 16px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  border: 1px solid var(--ui-line);
  background: var(--swatch-a) linear-gradient(90deg, var(--swatch-a) 0 50%, var(--swatch-b) 50% 100%);
  position: relative;
  transition: transform 140ms ease, border-color 140ms ease;
}

.theme-swatch-circle::after {
  content: "";
  position: absolute;
  inset: -3px;
  border: 1px solid transparent;
  border-radius: 50%;
  transition: border-color 140ms ease;
}

.theme-swatch-circle:hover {
  transform: translateY(-1px);
}

.theme-swatch-circle.selected {
  border-color: var(--ui-accent-strong);
}

.theme-swatch-circle.selected::after {
  border-color: var(--ui-accent-strong);
}

/* Light Theme Swatches */
.theme-swatch-circle[data-theme-id="parchment-gold"] { --swatch-a:#ab7425; --swatch-b:#f6f0e7; }
.theme-swatch-circle[data-theme-id="olive-earth"] { --swatch-a:#45603f; --swatch-b:#91ab7b; }
.theme-swatch-circle[data-theme-id="light-word"] { --swatch-a:#4e6e91; --swatch-b:#a9c8df; }
.theme-swatch-circle[data-theme-id="rose-ligure"] { --swatch-a:#704553; --swatch-b:#c99ba4; }
/* Dark Theme Swatches */
.theme-swatch-circle[data-theme-id="slate-emerald"] { --swatch-a:#3b4b43; --swatch-b:#a8c9af; }
.theme-swatch-circle[data-theme-id="sunset-fire"] { --swatch-a:#54281f; --swatch-b:#c47b59; }
.theme-swatch-circle[data-theme-id="heavenly-blue"] { --swatch-a:#29445e; --swatch-b:#88a9cb; }

/* Effect Icons */
.effect-icons {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  position: relative;
  z-index: 5;
}

.effect-icon {
  position: relative;
  z-index: 3;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--ui-line);
  background: var(--ui-surface);
  color: var(--ui-muted);
  display: grid;
  place-items: center;
  padding: 0;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.effect-icon svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms ease;
}

.effect-icon:hover {
  color: var(--ui-ink);
  border-color: var(--ui-accent);
  background: var(--ui-surface-2);
  transform: translateY(-1px);
}

.effect-icon.selected {
  color: var(--ui-accent-strong);
  border-color: var(--ui-accent-strong);
  background: var(--ui-accent-soft);
  box-shadow: 0 0 0 2px var(--ui-accent-soft);
}

/* Scripture Mode Choice Pills */
.scripture-display-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: var(--ui-surface);
}

.scripture-display-toggle .scripture-mode-choice {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ui-muted);
  border-radius: 999px;
  padding: 0.32rem 0.58rem;
  font-family: var(--font-ui);
  font-size: 0.63rem;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.scripture-display-toggle .scripture-mode-choice:hover {
  color: var(--ui-ink);
}

.scripture-display-toggle .scripture-mode-choice.active {
  color: var(--ui-ink);
  background: var(--ui-surface-2);
  border-color: var(--ui-line);
}

/* Action Toggles */
.compact-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
}

.compact-toggle {
  appearance: none;
  border: 1px solid var(--ui-line);
  background: transparent;
  color: var(--ui-muted);
  border-radius: 999px;
  height: 1.85rem;
  padding: 0 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.compact-toggle svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.compact-toggle:hover {
  color: var(--ui-ink);
  border-color: var(--ui-accent);
  background: var(--ui-surface-2);
}

.compact-toggle.active {
  color: var(--ui-accent-strong);
  border-color: var(--ui-accent);
  background: var(--ui-accent-soft);
}

.sound-toggle {
  width: 1.85rem;
  padding: 0;
}

/* ==========================================================================
   TYPING ARENA & DISPLAY ENGINE (EXPANDED HORIZONTALLY)
   ========================================================================== */

.typing-arena {
  position: relative;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 1rem;
  padding: clamp(1.5rem, 3vw, 2.8rem) clamp(1.25rem, 4vw, 3.8rem);
  height: clamp(20rem, 42vh, 32rem);
  min-height: clamp(20rem, 42vh, 32rem);
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: text;
  outline: none;
  margin-top: 0.25rem;
  transition: border-color 180ms ease, background-color 220ms ease;
}

.typing-arena:focus-within, .typing-arena.focused {
  border-color: var(--ui-focus);
}

#keystroke-receiver {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 5;
  font-size: 16px; /* Stops iOS auto-zoom on focus */
  cursor: text;
}

.scripture-display {
  position: relative;
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 1.75rem;
  line-height: 1.45;
  letter-spacing: 0.005em;
  display: block;
  text-align: left;
  width: 100%;
  box-sizing: border-box;
  flex-shrink: 0;
  pointer-events: none; /* Let taps pass straight through to the input */
}

.word-segment {
  display: inline-block;
  white-space: nowrap;
  margin-bottom: 0.06em;
}

.char-glyph {
  position: relative;
  display: inline-block;
  color: var(--text-untyped);
  font-weight: 600; 
  transition: color 0.15s ease, text-shadow 0.2s ease, opacity 0.25s ease;
  backface-visibility: hidden;
}

.char-glyph.space-glyph {
  display: inline-block;
  width: 0.25em;
}

.char-glyph.correct {
  color: var(--text-correct);
  text-shadow: 0 0 14px var(--lime-glow);
  animation: glyph-dynamic-hop 0.28s cubic-bezier(0.2, 0.9, 0.2, 1) forwards;
}

[data-theme="parchment-gold"] .char-glyph.correct {
  text-shadow: none;
}

@keyframes glyph-dynamic-hop {
  0% {
    transform: translateY(-3px) scale(1.08);
  }
  50% { transform: translateY(-1.5px) scale(1.03); }
  100% {
    transform: translateY(0) scale(1);
    color: var(--text-correct);
  }
}

.typing-arena.fx-none .char-glyph.correct {
  animation: none;
  transform: none;
}

.char-glyph.incorrect {
  color: var(--rose-crimson);
  background: var(--rose-glow);
  border-radius: 3px;
  text-shadow: 0 0 10px rgba(251, 113, 133, 0.8), 0 0 18px var(--rose-glow);
  animation: glyph-error-pulse 0.22s ease-out forwards;
}

@keyframes glyph-error-pulse {
  0% { transform: translateY(-2px) scale(1.12); }
  50% { transform: translateY(0) scale(0.97); }
  100% { transform: translateY(0) scale(1); }
}

.char-glyph.current {
  color: var(--text-chalk);
  text-shadow: 0 0 10px rgba(245, 245, 244, 0.5);
}

[data-theme="parchment-gold"] .char-glyph.current {
  text-shadow: none;
  color: var(--ui-accent-strong);
}

.typing-caret {
  position: absolute;
  width: 2.2px;
  height: 1.35em;
  background: var(--caret-grad);
  border-radius: 1px;
  box-shadow: 0 0 8px var(--sky-bright);
  pointer-events: none;
  z-index: 20;
  top: 0;
  left: 0;
  transition: transform 0.06s ease-out, height 0.1s ease;
  animation: caret-pulse 1.1s ease-in-out infinite;
  will-change: transform;
}

.typing-caret.hidden {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
}

@keyframes caret-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* Veiled and Initials Display Modes */
.mode-veiled .char-glyph:not(.correct):not(.incorrect) {
  filter: blur(8px);
  opacity: 0.3;
  user-select: none;
}

.mode-veiled .char-glyph.current {
  filter: blur(4.5px);
  opacity: 0.6;
}

.mode-first-letter .char-glyph.masked:not(.correct):not(.incorrect) {
  visibility: hidden;
}

.mode-first-letter .char-glyph.masked:not(.correct):not(.incorrect)::after {
  visibility: visible;
  content: "•";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted);
  opacity: 0.5;
  font-size: 0.85em;
}

.mode-first-letter .char-glyph.word-initial:not(.correct):not(.incorrect) {
  color: var(--sky-bright);
  opacity: 0.95;
  text-shadow: 0 0 10px var(--sky-glow);
}

/* Chapter Mode Scrolling & Numbering */
.typing-arena.chapter-active {
  align-items: flex-start;
  justify-content: flex-start;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 14%, black 86%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 14%, black 86%, transparent 100%);
}

.typing-arena.chapter-active .scripture-display {
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.verse-num-marker {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.58em;
  font-weight: 800;
  color: var(--sky-bright);
  opacity: 0.8;
  vertical-align: super;
  margin-right: 0.2em;
}

/* ==========================================================================
   WORKSPACE FOOTER
   ========================================================================== */

.workspace-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 0.25rem;
  margin-top: -0.15rem;
  width: 100%;
}

.key-hint {
  font-family: var(--font-ui);
  color: var(--ui-muted);
  font-size: 0.68rem;
  letter-spacing: 0.03em;
}

.key-badge {
  display: inline-flex;
  min-width: 2.2rem;
  justify-content: center;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--ui-line);
  margin: 0 0.35rem 0 0;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: var(--ui-ink);
  border-radius: 4px;
}

.footer-nav {
  display: flex;
  gap: 0.3rem;
}

.quiet-nav {
  background: transparent;
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  color: var(--ui-muted);
  padding: 0.35rem 0.75rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.quiet-nav:hover {
  background: var(--ui-surface-2);
  color: var(--ui-ink);
  border-color: var(--ui-accent);
}

/* ==========================================================================
   COMPLETION RESULTS MODAL
   ========================================================================== */

.completion-panel {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(12, 14, 16, 0.45);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.completion-panel.showing {
  opacity: 1;
  pointer-events: auto;
}

.completion-panel[hidden] {
  display: none !important;
}

.completion-card {
  position: relative;
  width: min(780px, calc(100vw - 2.5rem));
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 1.1rem;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  transform: translateY(10px) scale(0.98);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1), opacity 220ms ease;
}

.completion-panel.showing .completion-card {
  transform: translateY(0) scale(1);
}

.completion-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.25rem 1.6rem 1.15rem;
  gap: 1.5rem;
}

.completion-header h2 {
  font-family: 'EB Garamond', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 600;
  color: var(--ui-ink);
  margin-top: 0.15rem;
  line-height: 1.1;
}

.completion-header p {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  color: var(--ui-muted);
  margin-top: 0.15rem;
}

.completion-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding-right: 1.6rem;
}

.completion-action {
  border: 1px solid var(--ui-line);
  border-radius: 999px;
  background: transparent;
  color: var(--ui-ink);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 800;
  padding: 0.45rem 1.2rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}

.completion-action:hover {
  background: var(--ui-surface-2);
}

.completion-action.primary {
  border-color: var(--ui-accent);
  color: var(--ui-accent-strong);
  background: var(--ui-surface-2);
}

.completion-action.primary:hover {
  border-color: var(--ui-accent-strong);
  background: var(--ui-accent-soft);
}

.completion-x {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  border: none;
  background: transparent;
  color: var(--ui-muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
  transition: color 150ms ease;
}

.completion-x:hover {
  color: var(--ui-ink);
}

.completion-metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--ui-line);
  border-bottom: 1px solid var(--ui-line);
  background: var(--ui-surface);
}

.completion-metrics > div {
  padding: 1.15rem 1rem;
  text-align: center;
}

.completion-metrics > div + div {
  border-left: 1px solid var(--ui-line);
}

.completion-metrics span {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ui-muted);
}

.completion-metrics strong {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-ui);
  font-size: 1.55rem;
  color: var(--ui-ink);
  font-variant-numeric: tabular-nums;
}

.completion-details {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  padding: 1.15rem 1.4rem 1.35rem;
  background: var(--ui-surface-2);
  border-top: 1px solid var(--ui-line);
}

.completion-detail-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.completion-detail-card span {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ui-muted);
  white-space: nowrap;
}

.completion-detail-card strong {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ui-ink);
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   APP TOAST
   ========================================================================== */

.app-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 1000;
  background: var(--ui-surface);
  border: 1px solid var(--ui-line);
  border-radius: 0.6rem;
  padding: 0.75rem 1.25rem;
  color: var(--ui-ink);
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* ==========================================================================
   RESPONSIVE LAYOUT ADJUSTMENTS
   ========================================================================== */

/* Hides vertical separator lines when controls wrap so they never cause overflow */
@media (max-width: 1120px) {
  .control-separator {
    display: none;
  }
}

@media (max-width: 760px) {
  .passage-header-strip {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.65rem;
  }
  .passage-control-wrap {
    width: 100%;
  }
  .passage-toggle-btn {
    width: 100%;
    justify-content: center;
  }
  .passage-popover {
    left: 0;
    right: auto;
  }
  .streamlined-controls {
    gap: 0.5rem;
  }
  .compact-actions {
    width: 100%;
    margin-left: 0;
  }
  .compact-toggle {
    flex: 1;
  }
  .completion-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .completion-details {
    grid-template-columns: repeat(2, 1fr);
  }
}