/* ================================================================
   Faith Readers — Tabernacle Prayer Guide
   "Illuminated Scriptorium" — ancient parchment scroll + glassmorphism.
   Frosted-glass instrument panels frame a real parchment scroll, on a
   warm textured backdrop, with gold-leaf accents and unmistakable
   selected states. Cohesive Faith Readers palette (green / gold / brown
   / cream). All class hooks match index.html + app.js.
   ================================================================ */

/* ---- LIGHT (aged parchment scriptorium) ---- */
:root {
  /* COSMIC SCRIPTORIUM (default) — luminous deep space behind floating glass */
  --green:        #80C257;
  --green-dark:   #4E8C30;
  --green-deep:   #2C4A1C;
  --green-glow:   rgba(121, 184, 78, 0.45);
  --brown:        #E0A24A;
  --earth:        #CBB892;
  --gold:         #E8B341;
  --gold-light:   #F6D173;
  --gold-pale:    #F8E6AE;
  --veil:         #A38FE8;
  --wax:          #C2564B;

  --ink:          #F2E9D6;
  --ink-soft:     #D9CAAE;
  --ink-mute:     #A1916F;

  /* deep-space backdrop */
  --bg-a:         #17281D;
  --bg-b:         #0E1724;
  --bg-c:         #06080F;
  --bg-vignette:  rgba(0, 0, 0, 0.6);

  /* GLASS tokens — translucent so the cosmic light glows through */
  --glass-bg:       rgba(34, 46, 40, 0.28);
  --glass-strong:   rgba(40, 52, 44, 0.52);
  --glass-trough:   rgba(0, 0, 0, 0.24);
  --glass-border:   rgba(255, 255, 255, 0.22);
  --glass-edge:     rgba(232, 179, 65, 0.32);
  --glass-blur:     blur(22px) saturate(1.45) brightness(1.06);
  --glass-shadow:   0 30px 80px rgba(0, 0, 0, 0.55), 0 8px 24px rgba(0, 0, 0, 0.4);

  --field-bg:     rgba(10, 14, 20, 0.46);
  --field-border: rgba(232, 213, 168, 0.24);

  --divider:      rgba(232, 213, 168, 0.14);

  /* parchment scroll (stays warm & legible in both themes) */
  --pr-paper:     #FBF3DF;
  --pr-paper-2:   #F1E4C6;
  --pr-ink:       #2C2012;
  --pr-rule:      rgba(123, 63, 0, 0.30);
  --pr-gold:      rgba(200, 134, 10, 0.55);
  --pr-stage:     rgba(0, 0, 0, 0.34);

  --noise-op:     0.05;
  --noise-blend:  overlay;
}

/* ---- LIGHT (aged parchment scriptorium — the alternate) ---- */
[data-theme="light"] {
  --green:        #2D5016;
  --green-dark:   #1E3A0E;
  --green-deep:   #16280C;
  --green-glow:   rgba(45, 80, 22, 0.35);
  --brown:        #7B3F00;
  --earth:        #3D1C02;
  --gold:         #C8860A;
  --gold-light:   #E8B341;
  --gold-pale:    #F3D88A;
  --veil:         #5B4B8A;
  --wax:          #8A2D24;

  --ink:          #2A1B0C;
  --ink-soft:     #574326;
  --ink-mute:     #897154;

  --bg-a:         #F3E8CE;
  --bg-b:         #E6D4AC;
  --bg-c:         #D2BC8C;
  --bg-vignette:  rgba(74, 46, 12, 0.20);

  --glass-bg:       rgba(255, 250, 239, 0.46);
  --glass-strong:   rgba(255, 250, 240, 0.66);
  --glass-trough:   rgba(74, 46, 12, 0.10);
  --glass-border:   rgba(255, 255, 255, 0.60);
  --glass-edge:     rgba(200, 134, 10, 0.34);
  --glass-blur:     blur(16px) saturate(1.3);
  --glass-shadow:   0 12px 40px rgba(60, 30, 5, 0.20), 0 2px 8px rgba(60, 30, 5, 0.10);

  --field-bg:     rgba(255, 252, 245, 0.70);
  --field-border: rgba(123, 63, 0, 0.24);

  --divider:      rgba(123, 63, 0, 0.16);

  --pr-paper:     #FBF3DF;
  --pr-paper-2:   #F3E7C9;
  --pr-ink:       #2C2012;
  --pr-rule:      rgba(123, 63, 0, 0.30);
  --pr-gold:      rgba(200, 134, 10, 0.55);
  --pr-stage:     rgba(74, 46, 12, 0.16);

  --noise-op:     0.05;
  --noise-blend:  multiply;
}

/* ================================================================ RESET / BACKDROP */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* the [hidden] attribute must always win over component display rules */
[hidden] { display: none !important; }

body {
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  min-height: 100vh;
  /* COSMIC: nebula glows of divine light over deep space */
  background:
    radial-gradient(40% 48% at 14% 16%, rgba(240, 188, 78, 0.42), transparent 68%),
    radial-gradient(46% 54% at 86% 22%, rgba(160, 132, 236, 0.44), transparent 70%),
    radial-gradient(58% 56% at 50% 100%, rgba(86, 170, 96, 0.40), transparent 70%),
    radial-gradient(32% 36% at 70% 64%, rgba(240, 196, 96, 0.26), transparent 68%),
    radial-gradient(28% 30% at 24% 80%, rgba(150, 124, 224, 0.22), transparent 70%),
    radial-gradient(125% 122% at 50% 2%, #1B3024 0%, #0F1A28 46%, #05070E 100%);
  background-attachment: fixed;
}
[data-theme="light"] body {
  background:
    radial-gradient(42% 42% at 18% 12%, rgba(200, 134, 10, 0.16), transparent 70%),
    radial-gradient(40% 42% at 84% 16%, rgba(91, 75, 138, 0.10), transparent 72%),
    radial-gradient(135% 120% at 50% -12%, var(--bg-a) 0%, var(--bg-b) 52%, var(--bg-c) 100%);
}
/* COSMIC: a scattered starfield that gently twinkles */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 22%, rgba(255,250,235,0.9), transparent 60%),
    radial-gradient(1.5px 1.5px at 28% 64%, rgba(255,244,222,0.7), transparent 60%),
    radial-gradient(1px 1px at 47% 31%, rgba(255,255,255,0.85), transparent 60%),
    radial-gradient(1.5px 1.5px at 63% 78%, rgba(255,247,228,0.7), transparent 60%),
    radial-gradient(1px 1px at 76% 16%, rgba(255,255,255,0.9), transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 50%, rgba(255,244,218,0.75), transparent 60%),
    radial-gradient(1px 1px at 38% 90%, rgba(255,255,255,0.7), transparent 60%),
    radial-gradient(1px 1px at 8% 78%, rgba(255,255,255,0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 95% 82%, rgba(255,247,228,0.7), transparent 60%),
    radial-gradient(1px 1px at 55% 7%, rgba(255,255,255,0.85), transparent 60%),
    radial-gradient(1px 1px at 33% 44%, rgba(255,255,255,0.6), transparent 60%),
    radial-gradient(1px 1px at 67% 40%, rgba(255,250,235,0.6), transparent 60%);
  opacity: 0.72;
}
/* LIGHT: parchment grain instead of stars */
[data-theme="light"] body::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--noise-op); mix-blend-mode: var(--noise-blend); animation: none;
}
/* COSMIC: slow drifting aurora of light */
body::after {
  content: '';
  position: fixed; inset: -20%; z-index: 0; pointer-events: none;
  background:
    radial-gradient(36% 36% at 32% 38%, rgba(232, 179, 65, 0.14), transparent 60%),
    radial-gradient(34% 34% at 68% 62%, rgba(150, 124, 224, 0.13), transparent 60%);
  mix-blend-mode: screen;
}
[data-theme="light"] body::after {
  inset: 0; mix-blend-mode: normal;
  background: radial-gradient(120% 100% at 50% 40%, transparent 55%, var(--bg-vignette) 100%);
}

.app-shell { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* ================================================================ TOOLBAR (dark glass) */
.app-toolbar {
  position: sticky; top: 0; z-index: 30;
  background: linear-gradient(135deg, rgba(22,40,12,0.82) 0%, rgba(30,58,14,0.78) 45%, rgba(45,80,22,0.72) 100%);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  color: #F6EFDD;
  box-shadow: 0 6px 28px rgba(0,0,0,0.28);
  border-bottom: 1px solid rgba(243, 216, 138, 0.28);
}
.app-toolbar::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold) 18%, var(--gold-light) 50%, var(--gold) 82%, transparent);
  box-shadow: 0 0 14px rgba(232, 179, 65, 0.6);
}
.toolbar-inner {
  max-width: 1400px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
}
.toolbar-brand { display: flex; align-items: center; gap: 15px; min-width: 0; }
.toolbar-logo-wrap {
  width: 54px; height: 54px; border-radius: 14px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 25%, rgba(243,216,138,0.30), rgba(255,255,255,0.04));
  border: 1px solid rgba(243, 216, 138, 0.45);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.22), 0 4px 14px rgba(0,0,0,0.25);
}
.toolbar-mark { filter: drop-shadow(0 1px 3px rgba(0,0,0,0.35)); }
.toolbar-title {
  font-family: 'Cinzel', 'Playfair Display', serif; font-weight: 700; font-size: 23px;
  letter-spacing: 0.6px; line-height: 1.1; color: #FBF3DF;
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.toolbar-tagline {
  font-size: 10.5px; font-weight: 600; color: rgba(243, 216, 138, 0.85);
  margin-top: 4px; letter-spacing: 1.4px; text-transform: uppercase;
}
.toolbar-actions { display: flex; align-items: center; gap: 12px; }
.toolbar-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px;
  font-size: 10.5px; font-weight: 700; border-radius: 20px; letter-spacing: 0.5px; white-space: nowrap;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.badge-gold { background: rgba(232, 179, 65, 0.22); color: var(--gold-pale); border: 1px solid rgba(232, 179, 65, 0.42); }
.badge-soft { background: rgba(255, 255, 255, 0.08); color: rgba(246, 239, 221, 0.82); border: 1px solid rgba(255, 255, 255, 0.16); }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.10); border: 1px solid rgba(243, 216, 138, 0.35);
  color: var(--gold-pale); display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.18); transform: translateY(-1px) rotate(-8deg); box-shadow: 0 0 16px rgba(232,179,65,0.4); }
/* cosmic default shows the sun (switch to light); light shows the moon (back to cosmic) */
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.mobile-tool-tabs { display: none; }

/* ================================================================ WORKSPACE */
.workspace {
  flex: 1; max-width: 1400px; margin: 0 auto; width: 100%;
  padding: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start;
}

/* ================================================================ GLASS PANELS */
.panel {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  box-shadow:
    var(--glass-shadow),
    0 0 0 1px var(--glass-edge),
    inset 0 1px 0 rgba(255,255,255,0.30),
    inset 0 0 70px rgba(255,255,255,0.05);
  overflow: hidden;
  animation: fadeIn 0.55s ease both;
}
.panel-build  { animation-delay: 0.04s; }
.panel-prayer { animation-delay: 0.12s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* gold corner flourishes */
.panel::before, .panel::after {
  content: ''; position: absolute; width: 18px; height: 18px; pointer-events: none; z-index: 2; opacity: 0.7;
}
.panel::before { top: 9px; left: 9px; border-top: 2px solid var(--gold); border-left: 2px solid var(--gold); border-top-left-radius: 8px; }
.panel::after  { bottom: 9px; right: 9px; border-bottom: 2px solid var(--gold); border-right: 2px solid var(--gold); border-bottom-right-radius: 8px; }

.panel-header {
  background: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0.04));
  border-bottom: 1px solid var(--glass-edge);
  padding: 13px 20px; display: flex; align-items: center; gap: 9px;
  font-family: 'Cinzel', serif; font-size: 12.5px; font-weight: 600;
  color: var(--gold-pale); text-transform: uppercase; letter-spacing: 1.2px;
}
[data-theme="light"] .panel-header { color: var(--brown); }
.panel-header { background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02)); }
[data-theme="light"] .panel-header { background: linear-gradient(180deg, rgba(255,255,255,0.28), rgba(255,255,255,0.04)); }
.panel-icon { color: var(--gold); flex-shrink: 0; filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15)); }
.header-hint {
  margin-left: auto; font-family: 'Inter', sans-serif; font-size: 10.5px; font-weight: 500;
  color: var(--ink-mute); text-transform: none; letter-spacing: 0; opacity: 0.9;
}
.panel-body { padding: 20px; }

/* ================================================================ CONTROL BLOCK */
.control-block {
  background: var(--glass-trough);
  border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 16px; margin-bottom: 18px;
  display: flex; flex-direction: column; gap: 15px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.control-group { display: flex; flex-direction: column; gap: 8px; }
.control-label {
  font-family: 'Cinzel', serif; font-size: 11px; font-weight: 700;
  color: var(--gold-pale); text-transform: uppercase; letter-spacing: 1px;
  display: flex; align-items: center; gap: 8px;
}
[data-theme="light"] .control-label { color: var(--brown); }
.control-label::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--divider), transparent); }
.control-group-meta { flex-direction: row; gap: 12px; }
.field-inline { flex: 1; }
.field-date { max-width: 168px; }

/* ================================================================ SEGMENTED TOGGLES — bold, obvious selected state */
.toggle-group {
  display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: var(--glass-trough);
  border: 1px solid var(--field-border);
  box-shadow: inset 0 2px 6px rgba(74,46,12,0.10);
}
.toggle-option { flex: 1; position: relative; min-width: 0; }
.toggle-option input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 10px; border-radius: 9px; cursor: pointer; user-select: none;
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 600; white-space: nowrap;
  color: var(--ink-soft); background: transparent;
  transition: all 0.2s cubic-bezier(.2,.7,.2,1);
}
.toggle-btn:hover { background: rgba(255,255,255,0.10); color: var(--ink); }
[data-theme="light"] .toggle-btn:hover { background: rgba(255,255,255,0.45); }

/* THE SELECTED STATE — green key, gold ring, glow, raised, bold */
.toggle-option input[type="radio"]:checked + .toggle-btn {
  color: #FBF3DF; font-weight: 700;
  background: linear-gradient(155deg, #3C6A1F 0%, var(--green) 45%, var(--green-dark) 100%);
  box-shadow:
    0 0 0 1.5px var(--gold-light),
    0 6px 16px var(--green-glow),
    inset 0 1px 0 rgba(255,255,255,0.30),
    inset 0 -2px 6px rgba(0,0,0,0.18);
  transform: translateY(-1px) scale(1.02);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.toggle-option input[type="radio"]:focus-visible + .toggle-btn { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ================================================================ FIELDS */
.field { display: flex; flex-direction: column; gap: 5px; }
.field-wide { grid-column: 1 / -1; }
.field > label {
  font-weight: 600; font-size: 11px; color: var(--ink-mute); letter-spacing: 0.2px; line-height: 1.3;
}
.field-opt { font-weight: 500; opacity: 0.7; }
.field textarea, .field input[type="text"], .field input[type="date"] {
  width: 100%; padding: 10px 13px; font-family: 'Inter', sans-serif; font-size: 13.5px;
  color: var(--ink); background: var(--field-bg);
  border: 1px solid var(--field-border); border-radius: 10px; outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s; resize: vertical; line-height: 1.5;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.field textarea { min-height: 46px; }
.field textarea:focus, .field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 22%, transparent), inset 0 1px 3px rgba(74,46,12,0.06);
  background: var(--pr-paper);
}
.field input[type="date"] { color-scheme: dark; }
[data-theme="light"] .field input[type="date"] { color-scheme: light; }

/* ================================================================ JOURNEY STEPPER */
.journey {
  position: relative; display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 6px; margin: 6px 2px 20px;
}
.journey-line {
  position: absolute; top: 18px; left: 12%; right: 12%; height: 2px; z-index: 0;
  background: repeating-linear-gradient(90deg, var(--divider) 0 6px, transparent 6px 12px);
}
.journey-station {
  position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-align: center; cursor: pointer; background: none; border: none; padding: 0; font-family: inherit;
}
.journey-dot {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--glass-strong); border: 2px solid var(--field-border);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 15px; color: var(--ink-mute);
  transition: all 0.28s cubic-bezier(.2,.7,.2,1); box-shadow: 0 2px 6px rgba(74,46,12,0.12);
}
.journey-name {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.4px; line-height: 1.2;
  color: var(--ink-mute); text-transform: uppercase; max-width: 86px;
}
.journey-station[data-filled="true"] .journey-dot {
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 82%, #fff) 0%, var(--accent) 70%);
  border-color: var(--accent); color: #FFF;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 45%, transparent);
}
.journey-station[data-filled="true"] .journey-name { color: var(--accent); }
.journey-station[data-active="true"] .journey-dot {
  border-color: var(--gold-light);
  outline: 3px solid color-mix(in srgb, var(--gold) 38%, transparent); outline-offset: 2px;
  transform: translateY(-3px) scale(1.06);
  box-shadow: 0 6px 16px rgba(200,134,10,0.4);
}
.journey-station[data-active="true"]:not([data-filled="true"]) .journey-dot { color: var(--gold); }
.journey-station[data-active="true"] .journey-name { color: var(--gold); }
.journey-station:hover .journey-dot { transform: translateY(-2px); }

/* ================================================================ STAGE CARDS (illuminated parchment) */
.sec-card {
  position: relative; border-radius: 15px; margin-bottom: 14px; overflow: hidden;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(14px) saturate(1.3); backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--glass-border);
  border-left: 5px solid var(--accent);
  box-shadow:
    var(--glass-shadow),
    inset 0 1px 0 rgba(255,255,255,0.22),
    inset 0 0 40px color-mix(in srgb, var(--accent) 6%, transparent);
  animation: fadeIn 0.34s ease both;
}
.sec-head {
  display: flex; align-items: center; gap: 13px; padding: 15px 16px 13px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent);
}
.sec-step {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 19px; color: #FFF;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent) 78%, #fff) 0%, var(--accent) 65%, color-mix(in srgb, var(--accent) 70%, #000) 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.4), 0 4px 12px color-mix(in srgb, var(--accent) 40%, transparent);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.sec-headtext { flex: 1; min-width: 0; }
.sec-kicker {
  font-family: 'Cinzel', serif; font-size: 9.5px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 3px;
}
.sec-title {
  font-family: 'Playfair Display', serif; font-weight: 700; font-size: 17px; line-height: 1.15; color: var(--ink);
}
.sec-fillcount {
  font-size: 10px; font-weight: 700; color: #FFF; background: var(--accent);
  border-radius: 20px; padding: 3px 9px; flex-shrink: 0; opacity: 0; transition: opacity 0.2s;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 40%, transparent);
}
.sec-card[data-filled="true"] .sec-fillcount { opacity: 1; }

.sec-scripture {
  font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 14.5px;
  color: var(--ink-soft); line-height: 1.45; padding: 10px 16px 4px;
  border-top: 1px solid var(--divider);
}
.sec-teach {
  margin: 10px 16px 4px; padding: 11px 13px; border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 9%, var(--glass-strong));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 12.5px; line-height: 1.55; color: var(--ink-soft);
}
.sec-teach-tag {
  display: block; font-family: 'Cinzel', serif; font-size: 9.5px; font-weight: 700; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 4px;
}
.sec-fields { padding: 12px 16px 17px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ================================================================ WALKTHROUGH NAV */
.wizard-nav {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 4px;
}
.wizard-progress {
  flex: 1; text-align: center; font-family: 'Cinzel', serif; font-size: 11px; font-weight: 600;
  letter-spacing: 0.8px; color: var(--gold-pale); text-transform: uppercase;
}
[data-theme="light"] .wizard-progress { color: var(--brown); }
.btn-nav {
  display: inline-flex; align-items: center; gap: 6px; padding: 11px 18px; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--ink-soft); background: var(--glass-strong);
  border: 1px solid var(--field-border); border-radius: 11px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: all 0.18s ease;
}
.btn-nav:hover { border-color: var(--gold); color: var(--brown); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(200,134,10,0.2); }
.btn-nav-primary {
  color: #FBF3DF; border-color: transparent;
  background: linear-gradient(155deg, #3C6A1F 0%, var(--green) 50%, var(--green-dark) 100%);
  box-shadow: 0 0 0 1.5px var(--gold-light), 0 5px 14px var(--green-glow), inset 0 1px 0 rgba(255,255,255,0.25);
}
.btn-nav-primary:hover { color: #FFF; transform: translateY(-2px); box-shadow: 0 0 0 1.5px var(--gold-light), 0 8px 20px var(--green-glow); }

/* PREPARE — gold illuminated call to action */
.btn-generate {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 16px 24px; cursor: pointer; position: relative; overflow: hidden;
  font-family: 'Cinzel', serif; font-size: 15px; font-weight: 700; letter-spacing: 0.5px; color: #3a1f02;
  background: linear-gradient(150deg, var(--gold-pale) 0%, var(--gold-light) 40%, var(--gold) 100%);
  border: 1px solid rgba(255,255,255,0.4); border-radius: 13px;
  box-shadow: 0 0 0 1.5px rgba(123,63,0,0.25), 0 8px 22px rgba(200,134,10,0.40), inset 0 1px 0 rgba(255,255,255,0.55);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.btn-generate::before {
  content: ''; position: absolute; top: 0; left: -120%; width: 80%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent); transform: skewX(-18deg);
  transition: left 0.6s ease;
}
.btn-generate:hover { transform: translateY(-2px); box-shadow: 0 0 0 1.5px rgba(123,63,0,0.3), 0 12px 30px rgba(200,134,10,0.5); }
.btn-generate:hover::before { left: 130%; }
.btn-generate:active { transform: translateY(0); }
.btn-prepare { margin-top: 12px; }

.build-actions-secondary { display: flex; gap: 8px; margin-top: 12px; justify-content: center; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 600;
  color: var(--brown); background: var(--glass-strong);
  border: 1px solid var(--field-border); border-radius: 10px; transition: all 0.18s ease;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.btn-ghost:hover { background: var(--brown); color: #FBF3DF; border-color: var(--brown); transform: translateY(-1px); }
.btn-ghost-quiet { color: var(--ink-mute); }
.btn-ghost-quiet:hover { background: var(--ink-mute); color: #FBF3DF; border-color: var(--ink-mute); }

/* ================================================================ REVIEW STEP */
.review-card {
  background: var(--glass-trough); border: 1px solid var(--glass-border);
  border-radius: 14px; padding: 18px; margin-bottom: 4px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.35);
}
.review-head h3 { font-family: 'Playfair Display', serif; font-size: 19px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.review-head p { font-size: 12.5px; color: var(--ink-mute); line-height: 1.5; margin-bottom: 14px; }
.review-sec { border-left: 3px solid var(--accent); padding: 4px 0 4px 13px; margin-bottom: 15px; }
.review-sec:last-child { margin-bottom: 0; }
.review-sec h4 {
  font-family: 'Cinzel', serif; font-size: 10.5px; font-weight: 700; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--accent); margin-bottom: 8px; line-height: 1.3;
}
.review-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.review-list li { display: flex; flex-direction: column; gap: 1px; }
.rv-q { font-size: 10.5px; font-weight: 600; color: var(--ink-mute); }
.rv-a { font-size: 13.5px; color: var(--ink); line-height: 1.4; }
.rv-empty { font-size: 12px; font-style: italic; color: var(--ink-mute); line-height: 1.5; }

/* ================================================================ PRAYER PANEL */
.panel-header-prayer { gap: 8px; }
.view-toggle {
  margin-left: auto; display: flex; gap: 4px; padding: 4px; border-radius: 10px;
  background: var(--glass-trough); border: 1px solid var(--field-border);
}
.view-btn {
  font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 700; cursor: pointer;
  color: var(--ink-mute); background: transparent; border: none; border-radius: 6px;
  padding: 6px 12px; text-transform: none; letter-spacing: 0.2px; transition: all 0.18s ease;
}
.view-btn:hover { color: var(--ink); background: rgba(255,255,255,0.3); }
.view-btn.active {
  color: #FBF3DF;
  background: linear-gradient(155deg, #3C6A1F, var(--green-dark));
  box-shadow: 0 0 0 1px var(--gold-light), 0 3px 9px var(--green-glow), inset 0 1px 0 rgba(255,255,255,0.25);
}

.prayer-body { display: flex; flex-direction: column; gap: 15px; }

.refine-bar { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
  background: var(--glass-strong); border: 1px solid var(--field-border); border-radius: 20px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: all 0.16s ease;
}
.chip svg { opacity: 0.75; }
.chip:hover { border-color: var(--gold); color: var(--brown); background: color-mix(in srgb, var(--gold) 12%, var(--glass-strong)); transform: translateY(-1px); box-shadow: 0 3px 10px rgba(200,134,10,0.18); }
.chip:active { transform: translateY(0); }
.chip-more { gap: 4px; font-weight: 700; }
.chip-more svg { transition: transform 0.2s ease; }
.chip-more-open svg { transform: rotate(180deg); }
.refine-more {
  width: 100%; display: flex; gap: 7px; flex-wrap: wrap; margin-top: 3px;
  padding-top: 10px; border-top: 1px dashed var(--divider);
}

/* ---- the parchment SCROLL ---- */
.prayer-stage {
  position: relative; border-radius: 14px; padding: 22px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(232,179,65,0.07), transparent 62%),
    var(--pr-stage);
  box-shadow: inset 0 2px 18px rgba(0,0,0,0.40);
  max-height: 62vh; overflow-y: auto;
}
.prayer-page {
  position: relative; border-radius: 5px; padding: 40px 38px 34px; color: var(--pr-ink);
  background:
    radial-gradient(140% 120% at 50% 0%, var(--pr-paper) 0%, var(--pr-paper-2) 100%);
  box-shadow:
    0 24px 70px rgba(0,0,0,0.55),
    0 0 54px rgba(232,179,65,0.22),   /* warm cosmic aura — lit scroll */
    inset 0 0 0 13px var(--pr-paper),
    inset 0 0 0 14px var(--pr-gold),
    inset 0 0 0 17px var(--pr-paper),
    inset 0 0 0 18px rgba(123,63,0,0.22);
}
/* parchment grain on the scroll */
.prayer-page::before {
  content: ''; position: absolute; inset: 0; border-radius: 5px; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E");
  opacity: 0.05; mix-blend-mode: multiply; border-radius: 5px;
}
/* top fleuron */
.prayer-page::after {
  content: '\2766'; position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  font-size: 17px; color: var(--pr-gold); z-index: 1; pointer-events: none;
}
.prayer-empty {
  position: relative; z-index: 1; text-align: center; color: #6a5740;
  padding: 30px 12px; display: flex; flex-direction: column; align-items: center; gap: 11px;
}
.prayer-empty svg { color: rgba(123, 63, 0, 0.5); }
.prayer-empty h3 { font-family: 'Playfair Display', serif; font-size: 19px; color: #4a3a24; font-weight: 600; }
.prayer-empty p { font-size: 13px; max-width: 350px; line-height: 1.65; color: #6a5740; }
.prayer-content { position: relative; z-index: 1; }

.pr-doc-head { text-align: center; margin-bottom: 18px; padding-bottom: 15px; border-bottom: 1px solid var(--pr-rule); }
.pr-doc-kicker { font-family: 'Cinzel', serif; font-size: 10px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; color: #7B3F00; }
.pr-doc-title { font-family: 'Cinzel', 'Playfair Display', serif; font-size: 25px; font-weight: 700; color: var(--pr-ink); margin-top: 6px; line-height: 1.15; }
.pr-doc-sub { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 14.5px; color: #6a5740; margin-top: 5px; }
.pr-doc-meta { font-family: 'Inter', sans-serif; font-size: 11px; color: #8a7860; margin-top: 9px; letter-spacing: 0.4px; }

.pr-guide-note {
  font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 14.5px;
  color: #8a7456; text-align: center; line-height: 1.5; margin: 0 0 20px; padding: 0 8px 14px;
  border-bottom: 1px solid var(--pr-rule);
}
.pr-open { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 600; color: var(--pr-ink); margin-bottom: 13px; line-height: 1.4; }
.pr-body { font-family: 'Cormorant Garamond', 'Playfair Display', serif; font-size: 19px; line-height: 1.75; color: #36291a; margin-bottom: 15px; }
/* tabernacle action cue — what to DO at this stage (reflect, read the Word, intercede) */
.pr-action {
  font-family: 'Inter', sans-serif; font-size: 11.5px; font-style: italic; line-height: 1.5;
  color: #7a6244; margin: -6px 0 16px; padding: 8px 12px;
  background: rgba(200,134,10,0.07); border-left: 2px solid var(--pr-gold); border-radius: 0 7px 7px 0;
}
.pr-action::before { content: '\2726\00a0\00a0'; color: #c8a05a; }
.pr-sec .pr-action { margin-bottom: 0; }
.pr-close { font-family: 'Playfair Display', serif; font-style: italic; font-size: 17.5px; color: var(--pr-ink); margin-top: 8px; font-weight: 500; }
.pr-sec { margin-bottom: 17px; }
.pr-sec-title {
  font-family: 'Cinzel', serif; font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: #7B3F00; margin-bottom: 7px; display: flex; align-items: center; gap: 9px;
}
.pr-sec-title::before { content: '\2767'; color: var(--pr-gold); font-size: 12px; }
.pr-sec-title::after { content: ''; flex: 1; height: 1px; background: linear-gradient(90deg, var(--pr-rule), transparent); }
.pr-sec .pr-body { margin-bottom: 0; }
.pr-signature {
  margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--pr-rule);
  font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 12.5px;
  color: #8a7860; text-align: center; line-height: 1.5;
}
/* wax-seal flourish under the signature */
.pr-signature::before {
  content: '\271D'; display: block; width: 30px; height: 30px; margin: 0 auto 8px; border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, color-mix(in srgb, var(--wax) 80%, #fff), var(--wax) 70%, #5e1f19 100%);
  color: rgba(255,235,225,0.92); font-size: 15px; line-height: 30px; text-align: center;
  box-shadow: 0 3px 8px rgba(90,30,25,0.45), inset 0 1px 1px rgba(255,255,255,0.3);
}

/* ================================================================ OUTPUT ACTIONS */
.output-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.output-meta { font-size: 11px; color: var(--ink-mute); font-weight: 500; font-style: italic; }
.output-buttons { display: flex; gap: 8px; margin-left: auto; }
.btn-out {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 15px; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  background: var(--glass-strong); border: 1px solid var(--field-border); border-radius: 10px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); transition: all 0.18s ease;
}
.btn-out:hover { border-color: var(--green); color: var(--green); transform: translateY(-1px); }
.btn-out-primary {
  color: #3a1f02; border-color: transparent;
  background: linear-gradient(150deg, var(--gold-pale), var(--gold) 100%);
  box-shadow: 0 3px 10px rgba(200,134,10,0.34), inset 0 1px 0 rgba(255,255,255,0.5);
}
.btn-out-primary:hover { color: #3a1f02; transform: translateY(-2px); box-shadow: 0 6px 18px rgba(200,134,10,0.46); }

/* ================================================================ FOOTER */
.app-footer {
  background: rgba(22,40,12,0.55); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-top: 1px solid rgba(243,216,138,0.22); color: rgba(246,239,221,0.78);
  padding: 13px 28px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.footer-brand { font-family: 'Cinzel', serif; font-size: 11px; font-weight: 600; letter-spacing: 0.6px; color: var(--gold-pale); }
.footer-features { display: flex; align-items: center; gap: 7px; font-size: 11px; flex-wrap: wrap; }
.footer-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--gold); display: inline-block; box-shadow: 0 0 5px rgba(232,179,65,0.6); }
.footer-dot:first-child { display: none; }

/* ================================================================ TOAST */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000; max-width: 80vw; pointer-events: none;
  padding: 13px 22px; border-radius: 12px; font-size: 13.5px; font-weight: 600; color: #FBF3DF;
  background: linear-gradient(150deg, rgba(45,80,22,0.92), rgba(30,58,14,0.92));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(243,216,138,0.35);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.15);
  transform: translateY(120px); opacity: 0; transition: transform 0.38s cubic-bezier(.2,.8,.2,1), opacity 0.38s ease;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ================================================================ SCROLLBARS */
.prayer-stage::-webkit-scrollbar { width: 9px; }
.prayer-stage::-webkit-scrollbar-track { background: transparent; }
.prayer-stage::-webkit-scrollbar-thumb { background: rgba(123,63,0,0.30); border-radius: 5px; border: 2px solid transparent; background-clip: padding-box; }

/* ================================================================ RESPONSIVE */
@media (max-width: 1040px) { .sec-fields { grid-template-columns: 1fr; } }
@media (max-width: 960px) { .toolbar-badges { display: none; } .toolbar-inner { padding: 13px 18px; } }
@media (max-width: 860px) {
  /* one column + tab between Walk Through / My Prayer; toolbar scrolls away
     (not sticky) so it never double-stacks under the sticky tabs */
  .app-toolbar { position: static; }
  .workspace { grid-template-columns: 1fr; padding: 16px 12px; gap: 16px; }
  .panel-prayer { position: static; }
  .mobile-tool-tabs {
    display: grid; gap: 8px; grid-template-columns: 1fr 1fr; padding: 10px 12px; position: sticky; top: 0; z-index: 25;
    background: rgba(16,26,18,0.72); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(243,216,138,0.2);
    padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right));
  }
  .mobile-tool-tab {
    cursor: pointer; font-family: 'Cinzel', serif; font-weight: 700; font-size: 13px; min-height: 46px; letter-spacing: 0.5px;
    color: var(--gold-pale); background: var(--glass-strong); border: 1px solid var(--field-border); border-radius: 10px;
  }
  .mobile-tool-tab.active {
    color: #FBF3DF; border-color: transparent;
    background: linear-gradient(155deg, #3C6A1F, var(--green-dark));
    box-shadow: 0 0 0 1.5px var(--gold-light), 0 4px 12px var(--green-glow);
  }
  body.pv-build .panel-prayer, body.pv-prayer .panel-build { display: none; }
  .prayer-stage { max-height: none; }

  /* lighten the glass blur on phones for smoother scrolling */
  .panel, .sec-card { -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2); }
  /* comfortable tap targets */
  .btn-nav, .btn-out, .btn-ghost, .view-btn, .toggle-btn, .chip, .journey-station { min-height: 44px; }
  .journey-station { min-height: 0; }
  .journey-dot { width: 42px; height: 42px; }
  /* honour the iPhone home-indicator / notch */
  .app-footer { padding-bottom: max(13px, env(safe-area-inset-bottom)); }
  .workspace { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
}
/* 16px inputs stop iOS Safari from zooming in on focus */
@media (max-width: 860px) {
  .field textarea, .field input[type="text"], .field input[type="date"], #prayerName { font-size: 16px; }
}
@media (max-width: 560px) {
  .toolbar-inner { padding: 12px 14px; gap: 10px; }
  .toolbar-title { font-size: 18px; }
  .toolbar-logo-wrap { width: 46px; height: 46px; }
  .panel-body { padding: 15px; }
  .control-group-meta { flex-direction: column; }
  .field-date { max-width: none; }
  .journey-name { display: none; }
  .prayer-page { padding: 28px 22px; }
  .pr-body { font-size: 17.5px; }
  .chip { font-size: 11px; padding: 6px 11px; }
  .app-footer { flex-direction: column; text-align: center; gap: 4px; padding: 10px 12px; }
  .footer-features { justify-content: center; }
}

/* ================================================================ PRINT (clean parchment, no glass) */
.print-frame { display: none; }
@media print {
  body::before, body::after { display: none; }
  body * { visibility: hidden; }
  .print-frame, .print-frame * { visibility: visible; }
  .print-frame { display: block; position: absolute; inset: 0; margin: 0; background: #FFF; color: #1c150c; padding: 0; }
  @page { margin: 18mm 16mm; }
  .print-doc { max-width: 720px; margin: 0 auto; }
  .print-doc .pr-doc-head { text-align: center; margin-bottom: 22px; padding-bottom: 16px; border-bottom: 1.5px solid #c8a05a; }
  .print-doc .pr-doc-kicker { font-family: 'Cinzel', serif; font-size: 11px; font-weight: 700; letter-spacing: 2.5px; text-transform: uppercase; color: #7B3F00; }
  .print-doc .pr-doc-title { font-family: 'Cinzel','Playfair Display', serif; font-size: 30px; font-weight: 700; margin-top: 6px; }
  .print-doc .pr-doc-sub { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 16px; color: #5a4a34; margin-top: 6px; }
  .print-doc .pr-doc-meta { font-size: 12px; color: #6a5740; margin-top: 10px; }
  .print-doc .pr-guide-note { font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 14px; color: #6a5740; text-align: center; margin: 0 0 20px; padding-bottom: 14px; border-bottom: 1px solid #c8a05a; }
  .print-doc .pr-open { font-family: 'Playfair Display', serif; font-size: 21px; font-weight: 600; margin-bottom: 14px; }
  .print-doc .pr-body { font-family: 'Cormorant Garamond', serif; font-size: 18px; line-height: 1.85; margin-bottom: 16px; color: #2a2014; }
  .print-doc .pr-sec-title { font-family: 'Cinzel', serif; font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: #7B3F00; margin-bottom: 7px; }
  .print-doc .pr-action { font-family: 'Inter', sans-serif; font-style: italic; font-size: 11.5px; color: #6a5740; margin: 2px 0 16px; padding: 6px 12px; background: rgba(200,134,10,0.08); border-left: 2px solid #c8a05a; }
  .print-doc .pr-action::before { content: '\2726\00a0\00a0'; color: #c8a05a; }
  .print-doc .pr-close { font-family: 'Playfair Display', serif; font-style: italic; font-size: 19px; margin-top: 10px; }
  .print-doc .pr-signature { margin-top: 30px; padding-top: 16px; border-top: 1px solid #c8a05a; font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 13px; color: #6a5740; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
