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

:root,
:root[data-theme="classic"][data-mode="light"] {
  color-scheme: light;
  --page-bg: #ffffff;
  --text-color: #212529;
  --header-bg: #ffffff;
  --header-text: #007bff;
  --header-border: rgba(59,153,224,0.2);
  --header-shadow: rgba(59,153,224,0.14);
  --button-bg: rgba(0,123,255,0.08);
  --button-hover-bg: rgba(0,123,255,0.16);
  --button-primary-bg: #007bff;
  --button-primary-hover-bg: #0069d9;
  --button-primary-text: #ffffff;
  --chip-bg: #eef7ff;
  --chip-text: #0f4c81;
  --subheader-bg: #f8fbff;
  --position-text: #3b99e0;
  --pane-border: #d6e9f8;
  --surface-border: #e4f0fa;
  --control-muted: #5d7891;
  --control-active-bg: #007bff;
  --control-active-text: #ffffff;
  --reader-accent: #007bff;
  --verse-ref: #3b99e0;
  --split-hover-bg: rgba(0,123,255,0.05);
  --loader-pill-bg: rgba(255,255,255,0.96);
  --loader-pill-shadow: rgba(59,153,224,0.14);
  --error-text: #b42318;
  --popup-bg: #ffffff;
  --popup-border: rgba(59,153,224,0.28);
  --popup-shadow: rgba(59,153,224,0.2);
  --modal-backdrop: rgba(15,76,129,0.28);
  --modal-bg: #ffffff;
  --modal-text: #212529;
  --modal-muted: #526a7f;
  --modal-hover-bg: #eef7ff;
  --input-bg: #ffffff;
  --focus-ring: rgba(0,123,255,0.22);
  --focus-border: #007bff;
  --danger-bg: #fff0f0;
  --danger-border: #e3a5a5;
  --danger-text: #8b1e1e;
  --accent-bg: #007bff;
  --accent-hover-bg: #0069d9;
  --accent-text: #ffffff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-mode]) {
    color-scheme: dark;
    --page-bg: #071522;
    --text-color: #e7f1fb;
    --header-bg: #0b1f33;
    --header-text: #67b7ff;
    --header-border: #1d4f78;
    --header-shadow: rgba(0,0,0,0.45);
    --button-bg: rgba(103,183,255,0.12);
    --button-hover-bg: rgba(103,183,255,0.22);
    --button-primary-bg: #2f9bff;
    --button-primary-hover-bg: #67b7ff;
    --button-primary-text: #04111f;
    --chip-bg: rgba(103,183,255,0.12);
    --chip-text: #d7ecff;
    --subheader-bg: #0f2740;
    --position-text: #8bc8ff;
    --pane-border: #183a58;
    --surface-border: #1d4f78;
    --control-muted: #9cb7cc;
    --control-active-bg: #2f9bff;
    --control-active-text: #04111f;
    --reader-accent: #67b7ff;
    --verse-ref: #8bc8ff;
    --split-hover-bg: rgba(103,183,255,0.07);
    --loader-pill-bg: rgba(7,21,34,0.94);
    --loader-pill-shadow: rgba(0,0,0,0.34);
    --error-text: #ffb4ab;
    --popup-bg: #0b1f33;
    --popup-border: #1d4f78;
    --popup-shadow: rgba(0,0,0,0.52);
    --modal-backdrop: rgba(2,8,15,0.72);
    --modal-bg: #0f2740;
    --modal-text: #e7f1fb;
    --modal-muted: #b8d4ea;
    --modal-hover-bg: #173b5d;
    --input-bg: #071522;
    --focus-ring: rgba(103,183,255,0.28);
    --focus-border: #67b7ff;
    --danger-bg: #3a1717;
    --danger-border: #8f3f3f;
    --danger-text: #ffc4c4;
    --accent-bg: #2f9bff;
    --accent-hover-bg: #67b7ff;
    --accent-text: #04111f;
  }
}

:root[data-theme="classic"][data-mode="dark"] {
  color-scheme: dark;
  --page-bg: #071522;
  --text-color: #e7f1fb;
  --header-bg: #0b1f33;
  --header-text: #67b7ff;
  --header-border: #1d4f78;
  --header-shadow: rgba(0,0,0,0.45);
  --button-bg: rgba(103,183,255,0.12);
  --button-hover-bg: rgba(103,183,255,0.22);
  --button-primary-bg: #2f9bff;
  --button-primary-hover-bg: #67b7ff;
  --button-primary-text: #04111f;
  --chip-bg: rgba(103,183,255,0.12);
  --chip-text: #d7ecff;
  --subheader-bg: #0f2740;
  --position-text: #8bc8ff;
  --pane-border: #183a58;
  --surface-border: #1d4f78;
  --control-muted: #9cb7cc;
  --control-active-bg: #2f9bff;
  --control-active-text: #04111f;
  --reader-accent: #67b7ff;
  --verse-ref: #8bc8ff;
  --split-hover-bg: rgba(103,183,255,0.07);
  --loader-pill-bg: rgba(7,21,34,0.94);
  --loader-pill-shadow: rgba(0,0,0,0.34);
  --error-text: #ffb4ab;
  --popup-bg: #0b1f33;
  --popup-border: #1d4f78;
  --popup-shadow: rgba(0,0,0,0.52);
  --modal-backdrop: rgba(2,8,15,0.72);
  --modal-bg: #0f2740;
  --modal-text: #e7f1fb;
  --modal-muted: #b8d4ea;
  --modal-hover-bg: #173b5d;
  --input-bg: #071522;
  --focus-ring: rgba(103,183,255,0.28);
  --focus-border: #67b7ff;
  --danger-bg: #3a1717;
  --danger-border: #8f3f3f;
  --danger-text: #ffc4c4;
  --accent-bg: #2f9bff;
  --accent-hover-bg: #67b7ff;
  --accent-text: #04111f;
}

:root[data-theme="parchment"][data-mode="light"] {
  color-scheme: light;
  --page-bg: #f7f2e9;
  --text-color: #2c1a0e;
  --header-bg: #1c0f00;
  --header-text: #d4a054;
  --header-border: #5a3a10;
  --header-shadow: rgba(0,0,0,0.4);
  --button-bg: rgba(212,160,84,0.15);
  --button-hover-bg: rgba(212,160,84,0.3);
  --button-primary-bg: #d4a054;
  --button-primary-hover-bg: #e0b36c;
  --button-primary-text: #1c0f00;
  --chip-bg: rgba(247,228,195,0.08);
  --chip-text: #f7e4c3;
  --subheader-bg: #2a1500;
  --position-text: #c8922a;
  --pane-border: #c8a878;
  --surface-border: #e0d0b8;
  --control-muted: #8a6030;
  --control-active-bg: #d4a054;
  --control-active-text: #1c0f00;
  --reader-accent: #8a4000;
  --verse-ref: #b8860b;
  --split-hover-bg: rgba(180,130,60,0.06);
  --loader-pill-bg: rgba(247,242,233,0.94);
  --loader-pill-shadow: rgba(44,26,14,0.12);
  --error-text: #9f1d1d;
  --popup-bg: #1c0f00;
  --popup-border: #5a3a10;
  --popup-shadow: rgba(0,0,0,0.5);
  --modal-backdrop: rgba(28,15,0,0.58);
  --modal-bg: #fffaf2;
  --modal-text: #2c1a0e;
  --modal-muted: #5f4526;
  --modal-hover-bg: #f1e2ca;
  --input-bg: #ffffff;
  --focus-ring: rgba(31,111,104,0.28);
  --focus-border: #1f6f68;
  --danger-bg: #fff0f0;
  --danger-border: #e3a5a5;
  --danger-text: #8b1e1e;
  --accent-bg: #1f6f68;
  --accent-hover-bg: #185a54;
  --accent-text: #fffaf2;
}

:root[data-theme="parchment"][data-mode="dark"] {
  color-scheme: dark;
  --page-bg: #16110b;
  --text-color: #f2dfc0;
  --header-bg: #0d0905;
  --header-text: #ddb56f;
  --header-border: #6f512a;
  --header-shadow: rgba(0,0,0,0.58);
  --button-bg: rgba(221,181,111,0.13);
  --button-hover-bg: rgba(221,181,111,0.24);
  --button-primary-bg: #ddb56f;
  --button-primary-hover-bg: #ecc887;
  --button-primary-text: #120c06;
  --chip-bg: rgba(246,222,184,0.1);
  --chip-text: #f7e4c3;
  --subheader-bg: #130d07;
  --position-text: #d0a15a;
  --pane-border: #49351f;
  --surface-border: #4d3820;
  --control-muted: #a98655;
  --control-active-bg: #ddb56f;
  --control-active-text: #120c06;
  --reader-accent: #e0a85b;
  --verse-ref: #d6a34d;
  --split-hover-bg: rgba(221,181,111,0.08);
  --loader-pill-bg: rgba(22,17,11,0.94);
  --loader-pill-shadow: rgba(0,0,0,0.36);
  --error-text: #ff9b9b;
  --popup-bg: #0d0905;
  --popup-border: #6f512a;
  --popup-shadow: rgba(0,0,0,0.62);
  --modal-backdrop: rgba(5,3,2,0.72);
  --modal-bg: #21170e;
  --modal-text: #f2dfc0;
  --modal-muted: #d2b27f;
  --modal-hover-bg: #332515;
  --input-bg: #130d07;
  --focus-ring: rgba(72,178,166,0.28);
  --focus-border: #48b2a6;
  --danger-bg: #3a1717;
  --danger-border: #8f3f3f;
  --danger-text: #ffc4c4;
  --accent-bg: #2f8f84;
  --accent-hover-bg: #3aa99d;
  --accent-text: #fffaf2;
}

body { background: var(--page-bg); font-family: 'Georgia','Times New Roman',serif; color: var(--text-color); height: 100vh; overflow: hidden; }

#app { display: flex; flex-direction: column; height: 100vh; }

.global-header {
  background: var(--header-bg); color: var(--header-text);
  padding: 0.48rem 0.75rem;
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0.8rem;
  flex-shrink: 0;
  box-shadow: 0 2px 8px var(--header-shadow); z-index: 10;
}
.global-brand {
  min-width: 0; display: inline-flex; align-items: center;
  padding-right: 0.75rem; border-right: 1px solid var(--header-border);
}
.global-title {
  letter-spacing: 0.18em; font-size: 0.86rem; text-transform: uppercase;
  min-width: 0; white-space: nowrap; font-weight: 850;
}
.reader-header .global-brand { border-right: 0; padding-right: 0; gap: 0.55rem; }
.reader-history-controls {
  display: inline-flex; align-items: center; gap: 0.12rem;
  border-left: 1px solid var(--header-border); padding-left: 0.55rem;
}
.reader-history-button {
  display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem;
  border: 0; border-radius: 5px; background: transparent;
  color: var(--control-muted); opacity: 0.6; cursor: pointer;
}
.reader-history-button svg { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.reader-history-button:hover:not(:disabled), .reader-history-button:focus-visible { opacity: 1; background: var(--button-hover-bg); }
.reader-history-button:focus-visible { outline: 2px solid var(--focus-border); outline-offset: 2px; }
.reader-history-button:disabled { opacity: 0.2; cursor: default; }
.mobile-nav-toggle {
  display: none;
  width: 2rem; height: 2rem;
  border: 1px solid var(--header-border); border-radius: 6px;
  background: color-mix(in srgb, var(--button-bg) 70%, transparent);
  color: var(--header-text); cursor: pointer;
  padding: 0; flex-shrink: 0;
}
.mobile-nav-toggle:hover,
.mobile-nav-toggle:focus-visible,
.mobile-nav-toggle.active {
  background: var(--button-hover-bg); outline: none;
}
.mobile-nav-icon {
  position: relative; display: block;
  width: 0.92rem; height: 2px; margin: 0 auto;
  border-radius: 999px; background: currentColor;
  transition: background 0.14s ease;
}
.mobile-nav-icon::before,
.mobile-nav-icon::after {
  content: ''; position: absolute; left: 0;
  width: 0.92rem; height: 2px; border-radius: 999px;
  background: currentColor; transition: transform 0.14s ease, top 0.14s ease;
}
.mobile-nav-icon::before { top: -0.34rem; }
.mobile-nav-icon::after { top: 0.34rem; }
.mobile-nav-toggle.active .mobile-nav-icon { background: transparent; }
.mobile-nav-toggle.active .mobile-nav-icon::before {
  top: 0; transform: rotate(45deg);
}
.mobile-nav-toggle.active .mobile-nav-icon::after {
  top: 0; transform: rotate(-45deg);
}
.header-actions {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.42rem; min-width: 0; flex-wrap: wrap;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.header-group {
  display: inline-flex; align-items: center; gap: 0.32rem; min-width: 0;
  padding: 0.12rem;
  border: 1px solid color-mix(in srgb, var(--header-border) 58%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--button-bg) 58%, transparent);
  opacity: 0.18;
  transition: opacity 0.16s ease;
}
.header-theme-group,
.header-social-group,
.header-reader-group,
.header-account-group { flex-shrink: 0; }
.global-header:hover .header-group,
.global-header:focus-within .header-group {
  opacity: 1;
}
.header-account-group {
  opacity: 1;
}
.header-account-group .login-btn,
.header-account-group .account-link {
  opacity: 0;
  pointer-events: none;
}
.header-account-group .account-link {
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  border-width: 0;
}
.header-account-group:hover .login-btn,
.header-account-group:focus-within .login-btn,
.header-account-group:hover .account-link,
.header-account-group:focus-within .account-link {
  opacity: 1;
  pointer-events: auto;
}
.header-account-group:hover .account-link,
.header-account-group:focus-within .account-link {
  max-width: 5rem;
  padding-left: 0.45rem;
  padding-right: 0.45rem;
  border-width: 1px;
}
.add-pane-btn,
.login-btn,
.search-toggle-btn,
.friends-toggle-btn {
  background: transparent; border: 1px solid transparent;
  color: var(--header-text); padding: 0.3rem 0.62rem; cursor: pointer;
  border-radius: 4px; font-size: 0.76rem;
  opacity: 0.52;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
  white-space: nowrap;
}
.add-pane-btn:hover,
.add-pane-btn:focus-visible,
.login-btn:hover,
.login-btn:focus-visible,
.search-toggle-btn:hover,
.search-toggle-btn:focus-visible,
.search-toggle-btn.active,
.friends-toggle-btn:hover,
.friends-toggle-btn:focus-visible,
.friends-toggle-btn.active {
  background: var(--button-hover-bg); opacity: 1;
}
.login-btn {
  background: var(--button-primary-bg); color: var(--button-primary-text); border-color: var(--button-primary-bg);
  font-weight: 700;
}
.login-btn:hover { background: var(--button-primary-hover-bg); }
.account-chip {
  display: flex; align-items: center; gap: 0.45rem; min-width: 0;
  max-width: min(42vw, 17rem);
  border: 0; border-radius: 999px;
  background: transparent; color: var(--chip-text);
  padding: 0.08rem 0.08rem 0.08rem 0.45rem;
  font-size: 0.76rem;
}
.account-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-profile-link {
  color: inherit; text-decoration: none;
}
.account-profile-link:hover { text-decoration: underline; }
.account-link {
  flex-shrink: 0; border: 1px solid transparent;
  background: transparent; color: var(--header-text);
  border-radius: 999px; padding: 0.16rem 0.45rem;
  font-size: 0.7rem; cursor: pointer; opacity: 0.52;
  max-width: 5rem; overflow: hidden; white-space: nowrap;
  transition: background 0.15s, opacity 0.15s, max-width 0.16s ease, padding 0.16s ease, border-width 0.16s ease;
}
.account-link:hover,
.account-link:focus-visible { background: var(--button-hover-bg); opacity: 1; }
.reader-link,
.features-brand {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 1.75rem; border: 1px solid transparent;
  border-radius: 4px; background: transparent; color: var(--header-text);
  padding: 0.28rem 0.65rem; font-size: 0.76rem; font-weight: 700;
  text-decoration: none; line-height: 1.1; white-space: nowrap;
  font-family: inherit; cursor: pointer; opacity: 0.52;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}
.reader-link:hover,
.reader-link:focus-visible,
.reader-link.active,
.features-brand:hover,
.features-brand:focus-visible { background: var(--button-hover-bg); opacity: 1; }
.icon-reader-link {
  width: 1.85rem; min-width: 1.85rem; padding-inline: 0;
  font-size: 0.86rem; line-height: 1;
}
.page-fullscreen-btn.active {
  background: var(--control-active-bg); color: var(--control-active-text);
}
.reader-link-primary {
  background: var(--button-primary-bg); border-color: var(--button-primary-bg);
  color: var(--button-primary-text);
}
.reader-link-primary:hover { background: var(--button-primary-hover-bg); }

.layer-menu {
  position: relative; flex-shrink: 0;
}
.layer-dropdown {
  position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 82;
  width: min(15rem, 84vw); overflow: hidden;
  border: 1px solid var(--header-border); border-radius: 6px;
  background: var(--popup-bg); color: var(--text-color);
  box-shadow: 0 8px 24px var(--popup-shadow);
}
.layer-dropdown-section + .layer-dropdown-section {
  border-top: 1px solid var(--surface-border);
}
.layer-dropdown-title {
  padding: 0.52rem 0.65rem 0.28rem;
  color: var(--control-muted); font-size: 0.68rem; font-weight: 850; text-transform: uppercase;
}
.layer-dropdown-item {
  width: 100%; min-height: 2.1rem; border: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 0.7rem;
  background: transparent; color: inherit; padding: 0.42rem 0.65rem;
  cursor: pointer; font: inherit; font-size: 0.76rem; text-align: left;
}
.layer-dropdown-item:hover,
.layer-dropdown-item.active { background: var(--button-bg); color: var(--header-text); }
.layer-dropdown-item span:last-child {
  flex-shrink: 0; color: var(--control-muted); font-size: 0.66rem; font-weight: 800;
}
.layer-dropdown-item.active span:last-child { color: var(--header-text); }

.tool-menu {
  position: relative; flex-shrink: 0;
}
.friends-menu {
  position: relative; flex-shrink: 0;
}
.friends-dropdown {
  position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 85;
  width: min(18rem, 88vw); max-height: min(26rem, 78vh); overflow: auto;
  border: 1px solid var(--header-border); border-radius: 6px;
  background: var(--popup-bg); color: var(--text-color);
  box-shadow: 0 8px 24px var(--popup-shadow);
  padding: 0.55rem;
}
.friends-search-input {
  width: 100%; min-height: 2rem; border: 1px solid var(--pane-border);
  border-radius: 4px; background: var(--input-bg); color: var(--text-color);
  padding: 0.35rem 0.45rem; font: inherit; font-size: 0.76rem;
}
.friend-row {
  width: 100%; min-height: 2.1rem; border: 0; border-bottom: 1px solid var(--surface-border);
  display: flex; align-items: center; justify-content: space-between; gap: 0.7rem;
  background: transparent; color: inherit; padding: 0.42rem 0.15rem;
  cursor: pointer; font: inherit; font-size: 0.76rem; text-align: left;
}
.friend-row:hover { background: var(--button-bg); color: var(--header-text); }
.friend-row:disabled { cursor: default; opacity: 0.65; }
.friend-row-static {
  cursor: default; display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto;
}
.friend-row-static:hover { background: transparent; color: inherit; }
.friend-row span:last-child {
  flex-shrink: 0; color: var(--control-muted); font-size: 0.66rem; font-weight: 750;
}
.friend-profile-link {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: inherit; text-decoration: none; font-weight: 750;
}
.friend-profile-link:hover { text-decoration: underline; }
.friend-action {
  flex-shrink: 0; border: 1px solid var(--pane-border); border-radius: 4px;
  background: var(--button-bg); color: var(--header-text);
  padding: 0.22rem 0.45rem; cursor: pointer;
  font: inherit; font-size: 0.66rem; font-weight: 800;
}
.friend-action:hover { background: var(--button-hover-bg); }
.friend-action:disabled { opacity: 0.6; cursor: wait; }
.friend-session-action {
  display: inline-flex; align-items: center; gap: 0.3rem;
  border-color: color-mix(in srgb, var(--reader-accent) 55%, var(--pane-border));
  color: var(--reader-accent);
}
.friend-session-action .sessions-live-dot { width: 0.4rem; height: 0.4rem; }
.friend-highlight-toggle {
  min-width: 4.25rem; border-color: var(--surface-border);
  color: var(--control-muted);
}
.friend-highlight-toggle.active {
  border-color: var(--accent-bg); background: var(--button-bg); color: var(--header-text);
}
.friends-section-title {
  margin-top: 0.7rem; padding-top: 0.55rem; border-top: 1px solid var(--surface-border);
  color: var(--control-muted); font-size: 0.68rem; font-weight: 800; text-transform: uppercase;
}
.friends-message {
  padding: 0.55rem 0.1rem; color: var(--control-muted);
  font-size: 0.74rem; line-height: 1.35;
}
.friends-message.error { color: var(--error-text); }
.tool-dropdown {
  position: absolute; right: 0; top: calc(100% + 0.35rem); z-index: 80;
  width: min(13rem, 82vw); overflow: hidden;
  border: 1px solid var(--header-border); border-radius: 6px;
  background: var(--popup-bg); color: var(--text-color);
  box-shadow: 0 8px 24px var(--popup-shadow);
}
.tool-dropdown-item {
  width: 100%; min-height: 2.25rem; border: 0; border-bottom: 1px solid var(--surface-border);
  display: flex; align-items: center; justify-content: space-between; gap: 0.7rem;
  background: transparent; color: inherit; padding: 0.45rem 0.6rem;
  cursor: pointer; font: inherit; font-size: 0.76rem; text-align: left;
}
.tool-dropdown-item:last-child { border-bottom: 0; }
.tool-dropdown-item:hover,
.tool-dropdown-item.active { background: var(--button-bg); color: var(--header-text); }
.tool-dropdown-state {
  flex-shrink: 0; color: var(--control-muted); font-size: 0.66rem; font-weight: 750;
}

.theme-picker {
  display: flex; align-items: center; gap: 0.28rem; min-width: 0;
}
.theme-select {
  min-height: 1.75rem; max-width: 7rem;
  border: 1px solid var(--header-border); border-radius: 4px;
  background: var(--button-bg); color: var(--header-text);
  padding: 0.2rem 0.35rem; font: inherit; font-size: 0.74rem;
  opacity: 0.56; transition: opacity 0.15s, background 0.15s;
}
.theme-select:disabled { opacity: 0.72; cursor: default; }
.theme-select:hover,
.theme-select:focus { opacity: 1; }
.theme-select:focus {
  outline: 2px solid var(--button-hover-bg);
  outline-offset: 1px;
}
.theme-select-mode { max-width: 5.8rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.panes-container { position: relative; display: flex; flex: 1; overflow: hidden; min-height: 0; }

.profile-page {
  min-height: 100vh; background: var(--page-bg); color: var(--text-color);
  padding: clamp(1rem, 3vw, 2rem); overflow: auto;
}
.profile-header {
  max-width: 1120px; margin: 0 auto 1rem;
  display: grid; gap: 1rem;
}
.profile-back {
  width: fit-content; min-height: 1.75rem; display: inline-flex; align-items: center;
  border: 1px solid var(--header-border); border-radius: 4px;
  background: var(--button-bg); color: var(--header-text);
  padding: 0.28rem 0.65rem; font-size: 0.76rem; font-weight: 750;
  text-decoration: none;
}
.profile-back:hover { background: var(--button-hover-bg); }
.profile-identity {
  display: flex; align-items: center; gap: 1rem; min-width: 0;
}
.profile-avatar {
  width: clamp(3.25rem, 8vw, 5rem); aspect-ratio: 1; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--reader-accent); color: var(--accent-text);
  font-size: clamp(1.7rem, 4vw, 2.5rem); font-weight: 900;
}
.profile-heading { min-width: 0; }
.profile-heading h1 {
  margin: 0; color: var(--header-text);
  font-size: clamp(2rem, 5vw, 4rem); line-height: 0.95; letter-spacing: 0;
}
.profile-heading p {
  margin: 0.35rem 0 0; color: var(--control-muted);
  font-size: clamp(0.95rem, 2vw, 1.2rem); font-weight: 750;
}
.profile-description {
  max-width: 52rem; margin: 0; color: var(--text-color);
  line-height: 1.55; font-size: 0.96rem;
}
.profile-edit-band {
  max-width: 1120px; margin: 0 auto 1rem;
  display: grid; grid-template-columns: minmax(12rem, 1fr) minmax(16rem, 2fr) auto auto;
  gap: 0.7rem; align-items: end;
  border: 1px solid var(--pane-border); border-radius: 8px;
  background: var(--subheader-bg); padding: 0.8rem;
}
.profile-edit-field { display: grid; gap: 0.25rem; min-width: 0; }
.profile-edit-field span {
  color: var(--control-muted); font-size: 0.7rem; font-weight: 850; text-transform: uppercase;
}
.profile-edit-field input,
.profile-edit-field textarea {
  width: 100%; min-width: 0; border: 1px solid var(--pane-border); border-radius: 4px;
  background: var(--input-bg); color: var(--text-color);
  padding: 0.42rem 0.5rem; font: inherit; font-size: 0.82rem;
}
.profile-edit-field textarea { resize: vertical; line-height: 1.45; }
.profile-save-btn {
  min-height: 2rem; border: 0; border-radius: 4px;
  background: var(--accent-bg); color: var(--accent-text);
  padding: 0.42rem 0.75rem; cursor: pointer; font: inherit; font-size: 0.76rem; font-weight: 850;
}
.profile-save-message {
  color: var(--control-muted); font-size: 0.72rem; font-weight: 750;
}
.profile-status {
  max-width: 1120px; margin: 1rem auto; padding: 1rem;
  border: 1px solid var(--pane-border); border-radius: 8px;
  background: var(--subheader-bg); color: var(--control-muted); text-align: center;
}
.profile-status-error { color: var(--error-text); }
.profile-stats-grid {
  max-width: 1120px; margin: 0 auto 1rem;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.75rem;
}
.profile-stat {
  min-width: 0; border: 1px solid var(--pane-border); border-radius: 8px;
  background: var(--subheader-bg); padding: 0.85rem;
}
.profile-stat span {
  display: block; color: var(--control-muted); font-size: 0.7rem; font-weight: 850; text-transform: uppercase;
}
.profile-stat strong {
  display: block; margin-top: 0.28rem; color: var(--header-text);
  font-size: clamp(1.25rem, 3vw, 2rem); line-height: 1; overflow-wrap: anywhere;
}
.profile-stat em {
  display: block; margin-top: 0.15rem; color: var(--control-muted); font-size: 0.72rem; font-style: normal;
}
.profile-activity-layout {
  max-width: 1120px; margin: 0 auto 1rem;
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(18rem, 0.75fr); gap: 0.75rem;
}
.profile-panel {
  min-width: 0; border: 1px solid var(--pane-border); border-radius: 8px;
  background: var(--subheader-bg); padding: 0.9rem;
}
.profile-panel-header {
  display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; margin-bottom: 0.75rem;
}
.profile-panel-header h2 {
  margin: 0; color: var(--header-text); font-size: 1rem; letter-spacing: 0;
}
.profile-panel-header span {
  color: var(--control-muted); font-size: 0.72rem; font-weight: 750; white-space: nowrap;
}
.profile-contribution-panel {
  --contribution-cell: 0.72rem;
  --contribution-gap: 0.22rem;
  --contribution-level-0: var(--button-bg);
  --contribution-level-1: color-mix(in srgb, var(--reader-accent) 22%, var(--page-bg));
  --contribution-level-2: color-mix(in srgb, var(--reader-accent) 45%, var(--page-bg));
  --contribution-level-3: color-mix(in srgb, var(--reader-accent) 72%, var(--page-bg));
  --contribution-level-4: var(--reader-accent);
  --contribution-border-1: color-mix(in srgb, var(--reader-accent) 35%, var(--surface-border));
  --contribution-border-2: color-mix(in srgb, var(--reader-accent) 58%, var(--surface-border));
  --contribution-border-3: color-mix(in srgb, var(--reader-accent) 78%, var(--surface-border));
  max-width: 1120px; margin: 0 auto 1rem;
}
.contribution-board {
  overflow-x: auto; padding-bottom: 0.15rem;
}
.contribution-months {
  display: grid;
  grid-template-columns: repeat(var(--contribution-weeks), var(--contribution-cell));
  gap: var(--contribution-gap);
  min-width: max-content;
  margin-left: 2.55rem; margin-bottom: 0.32rem;
  color: var(--control-muted); font-size: 0.74rem; font-weight: 750;
}
.contribution-months span {
  min-width: 0; overflow: visible; white-space: nowrap;
}
.contribution-body {
  display: flex; align-items: flex-start; gap: 0.55rem; min-width: max-content;
}
.contribution-weekdays {
  width: 2rem; flex: 0 0 2rem;
  display: grid; grid-template-rows: repeat(7, var(--contribution-cell));
  gap: var(--contribution-gap);
  color: var(--control-muted); font-size: 0.72rem; font-weight: 750; line-height: var(--contribution-cell);
}
.contribution-grid {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(7, var(--contribution-cell));
  gap: var(--contribution-gap);
  min-width: max-content;
}
.contribution-cell {
  width: var(--contribution-cell); height: var(--contribution-cell);
  border-radius: 3px; border: 1px solid var(--surface-border);
  background: var(--contribution-level-0); flex: 0 0 var(--contribution-cell);
}
.contribution-cell.level-1 { background: var(--contribution-level-1); border-color: var(--contribution-border-1); }
.contribution-cell.level-2 { background: var(--contribution-level-2); border-color: var(--contribution-border-2); }
.contribution-cell.level-3 { background: var(--contribution-level-3); border-color: var(--contribution-border-3); }
.contribution-cell.level-4 { background: var(--contribution-level-4); border-color: var(--contribution-level-4); }
.contribution-cell.future { opacity: 0.35; }
.contribution-footer {
  display: flex; justify-content: flex-end; align-items: center; gap: 0.32rem;
  min-width: max-content; margin-top: 0.65rem;
  color: var(--control-muted); font-size: 0.76rem; font-weight: 750;
}
.book-activity-row { display: grid; gap: 0.28rem; margin-top: 0.6rem; }
.book-activity-meta {
  display: flex; justify-content: space-between; gap: 1rem;
  color: var(--text-color); font-size: 0.82rem; font-weight: 750;
}
.book-activity-bar,
.visibility-meter,
.color-strip {
  width: 100%; height: 0.6rem; overflow: hidden; border-radius: 999px;
  background: var(--button-bg);
}
.book-activity-bar span,
.visibility-meter span,
.color-strip span {
  display: block; height: 100%;
}
.book-activity-bar span { background: var(--reader-accent); }
.visibility-meter { display: flex; margin-top: 0.5rem; }
.visibility-public { background: var(--accent-bg); }
.visibility-private { background: var(--control-muted); }
.visibility-legend {
  display: flex; justify-content: space-between; gap: 1rem;
  margin: 0.45rem 0 0.8rem; color: var(--control-muted); font-size: 0.74rem; font-weight: 750;
}
.color-strip { display: flex; }
.profile-recent-panel { max-width: 1120px; margin: 0 auto; }
.profile-highlight-row {
  display: grid; grid-template-columns: 0.55rem minmax(0, 1fr); gap: 0.65rem;
  padding: 0.75rem 0; border-top: 1px solid var(--surface-border);
}
.profile-highlight-row:first-of-type { border-top: 0; }
.profile-highlight-swatch { width: 0.55rem; border-radius: 999px; }
.profile-highlight-row strong { display: block; color: var(--header-text); font-size: 0.82rem; }
.profile-highlight-row p {
  margin: 0.18rem 0; color: var(--text-color); font-size: 0.84rem; line-height: 1.45;
}
.profile-highlight-row div > span {
  color: var(--control-muted); font-size: 0.7rem; font-weight: 750; text-transform: capitalize;
}
.profile-empty {
  padding: 0.75rem 0; color: var(--control-muted); font-size: 0.82rem;
}

@media (max-width: 760px) {
  .profile-edit-band,
  .profile-stats-grid,
  .profile-activity-layout {
    grid-template-columns: 1fr;
  }
  .profile-edit-band { align-items: stretch; }
  .profile-panel-header {
    align-items: flex-start; flex-direction: column; gap: 0.25rem;
  }
  .profile-panel-header span { white-space: normal; }
  .profile-contribution-panel {
    --contribution-cell: 0.64rem;
    --contribution-gap: 0.18rem;
  }
}

.pane-shell {
  position: relative; flex: 1 1 0; min-width: 0; min-height: 0;
  display: flex; border-right: 1px solid var(--pane-border);
}
.pane-shell:last-child { border-right: none; }
.pane-shell.target-pane-shell {
  z-index: 1;
}
.pane-shell.target-locked-pane-shell {
  z-index: 1;
}
.pane-shell.target-pane-shell .pane-header { border-bottom: 2px solid var(--focus-border); }
.pane-shell.target-locked-pane-shell .pane-header { border-bottom-color: var(--reader-accent); }
.pane-shell.dragging { opacity: 0.58; }
.pane-shell.drag-over::before {
  content: ''; position: absolute; top: 0; bottom: 0; left: 0;
  width: 3px; z-index: 20; background: var(--button-primary-bg);
  box-shadow: 0 0 0 1px var(--button-primary-text);
}
.pane-shell.drag-over.drop-after::before { left: auto; right: 0; }
.pane-shell.fullscreen-pane-shell {
  position: absolute; inset: 0; z-index: 700; width: 100%; min-width: 0;
  flex: none; border-right: 0; background: var(--page-bg);
  box-shadow: 0 0 0 1px var(--pane-border);
}
.bible-pane { flex: 1; width: 100%; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.pane-shell:last-child .bible-pane { border-right: none; }
.passage-image-pane { background: var(--page-bg); }
.passage-image-pane-header { gap: 0; }
.passage-image-pane-heading {
  min-width: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 0.4rem;
}
.passage-image-pane-actions { display: flex; align-items: center; gap: 0.25rem; }
.passage-image-pane-actions .close-btn { position: static; }
.passage-image-pane-stage {
  flex: 1; min-width: 0; min-height: 0; display: grid; place-items: center;
  overflow: hidden; padding: 0.75rem; background: var(--page-bg);
}
.passage-image-pane-stage > img,
.passage-image-pane-stage > video {
  display: block; width: 100%; height: 100%; min-width: 0; min-height: 0;
  object-fit: contain;
}
.passage-media-audio {
  width: min(34rem, 100%); min-width: 0; display: grid; justify-items: center; gap: 0.8rem;
  padding: clamp(1rem, 5vw, 3rem); border: 1px solid var(--surface-border); border-radius: 8px;
  background: var(--subheader-bg); color: var(--text-color); text-align: center;
}
.passage-media-audio > span { color: var(--reader-accent); font-size: clamp(2.4rem, 8vw, 5rem); line-height: 1; }
.passage-media-audio > strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.passage-media-audio > audio { display: block; width: 100%; max-width: 30rem; }
.passage-image-unavailable {
  color: var(--control-muted); padding: 1rem; text-align: center; font-size: 0.82rem;
}

.search-pane-shell {
  flex: 0 0 clamp(22rem, 30vw, 30rem); min-width: 20rem; min-height: 0;
  display: flex;
  background: var(--page-bg);
}
.passage-list-shell {
  flex-basis: clamp(17rem, 22vw, 22rem);
  min-width: 16rem;
}
.notes-pane-shell {
  flex-basis: clamp(20rem, 27vw, 28rem);
  min-width: 18rem;
}

.text-search-pane {
  flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column;
  color: var(--text-color); background: var(--page-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.text-search-header {
  display: flex; align-items: center; justify-content: flex-start; gap: 0.75rem;
  padding: 0.72rem 0.85rem; border-bottom: 1px solid var(--surface-border);
  background: var(--subheader-bg); color: var(--header-text); flex-shrink: 0;
}
.text-search-title-group { flex: 1; min-width: 0; display: grid; gap: 0.15rem; }
.text-search-title-group h2 { font-size: 0.95rem; line-height: 1.1; letter-spacing: 0; color: var(--header-text); }
.text-search-title-group p { font-size: 0.72rem; color: var(--control-muted); }
.text-search-drag-handle { flex-shrink: 0; }
.text-search-header-btn,
.text-search-close {
  width: 1.9rem; height: 1.9rem; border: 1px solid var(--header-border);
  border-radius: 4px; background: var(--button-bg); color: var(--header-text);
  cursor: pointer; line-height: 1; flex-shrink: 0;
}
.text-search-header-btn {
  font-size: 0.8rem;
}
.text-search-header-btn.active {
  background: var(--control-active-bg); color: var(--control-active-text);
}
.text-search-header-btn:hover,
.text-search-close:hover { background: var(--button-hover-bg); }
.text-search-form {
  display: grid; gap: 0.65rem; padding: 0.85rem; flex-shrink: 0;
  border-bottom: 1px solid var(--surface-border); background: var(--page-bg);
}
.text-search-input-row { display: flex; gap: 0.35rem; min-width: 0; }
.text-search-input {
  width: 100%; min-width: 0; height: 2.2rem; border: 1px solid var(--surface-border);
  border-radius: 4px; background: var(--input-bg); color: var(--text-color);
  padding: 0.35rem 0.55rem; font: inherit; font-size: 0.86rem;
}
.text-search-input:focus {
  outline: 2px solid var(--focus-ring); border-color: var(--focus-border);
}
.text-search-submit,
.text-search-load-more {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.38rem;
  min-height: 2.2rem; border: 1px solid var(--button-primary-bg); border-radius: 4px;
  background: var(--button-primary-bg); color: var(--button-primary-text);
  padding: 0 0.7rem; font-size: 0.78rem; font-weight: 750; cursor: pointer;
}
.text-search-submit:hover,
.text-search-load-more:hover { background: var(--button-primary-hover-bg); }
.text-search-submit:disabled,
.text-search-load-more:disabled { opacity: 0.58; cursor: default; }
.text-search-mode {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  position: relative; border: 1px solid var(--surface-border); border-radius: 4px; overflow: visible;
}
.text-search-segment {
  position: relative; min-height: 2rem; border: 0; border-right: 1px solid var(--surface-border);
  background: var(--input-bg); color: var(--control-muted); cursor: pointer;
  font: inherit; font-size: 0.78rem; font-weight: 700;
}
.text-search-segment:first-child { border-radius: 3px 0 0 3px; }
.text-search-segment:last-child { border-radius: 0 3px 3px 0; }
.text-search-segment:last-child { border-right: 0; }
.text-search-segment.active { background: var(--control-active-bg); color: var(--control-active-text); }
.text-search-segment[data-tooltip]::after {
  content: attr(data-tooltip); position: absolute; z-index: 30; top: calc(100% + 0.42rem); left: 50%;
  width: max-content; max-width: min(18rem, calc(100vw - 2rem)); padding: 0.48rem 0.56rem;
  border: 1px solid var(--surface-border); border-radius: 4px; background: var(--header-bg);
  color: var(--header-text); box-shadow: 0 4px 14px rgb(0 0 0 / 18%); font-size: 0.68rem;
  font-weight: 600; line-height: 1.4; text-align: left; white-space: normal;
  opacity: 0; pointer-events: none; transform: translate(-50%, -0.2rem);
  transition: opacity 100ms ease, transform 100ms ease;
}
.text-search-segment[data-tooltip]:hover,
.text-search-segment[data-tooltip]:focus-visible { z-index: 31; }
.text-search-segment[data-tooltip]:hover::after,
.text-search-segment[data-tooltip]:focus-visible::after {
  opacity: 1; transform: translate(-50%, 0);
}
.text-search-option-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.7rem;
}
.text-search-advanced-toggle {
  display: inline-flex; align-items: center; gap: 0.35rem; min-height: 1.75rem;
  border: 1px solid var(--surface-border); border-radius: 4px; background: var(--button-bg);
  color: var(--header-text); padding: 0.2rem 0.48rem; cursor: pointer;
  font: inherit; font-size: 0.72rem; font-weight: 750;
}
.text-search-advanced-toggle:hover { background: var(--button-hover-bg); }
.text-search-advanced-toggle:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}
.text-search-advanced-toggle small {
  color: var(--control-muted); font-size: 0.65rem; font-weight: 650;
}
.text-search-advanced-chevron {
  color: var(--control-muted); font-size: 0.68rem; transition: transform 120ms ease;
}
.text-search-advanced-toggle[aria-expanded='true'] .text-search-advanced-chevron {
  transform: rotate(90deg);
}
.text-search-case-toggle {
  display: inline-flex; align-items: center; margin-left: auto; gap: 0.45rem;
  color: var(--control-muted); cursor: pointer; font-size: 0.72rem; font-weight: 700;
}
.text-search-case-toggle input {
  position: absolute; width: 1px; height: 1px; opacity: 0;
}
.text-search-switch {
  position: relative; width: 1.9rem; height: 1.05rem; border: 1px solid var(--surface-border);
  border-radius: 999px; background: var(--input-bg); transition: background 120ms ease;
}
.text-search-switch::after {
  content: ''; position: absolute; top: 0.12rem; left: 0.14rem; width: 0.68rem; height: 0.68rem;
  border-radius: 50%; background: var(--control-muted); transition: transform 120ms ease, background 120ms ease;
}
.text-search-case-toggle input:checked + .text-search-switch { background: var(--control-active-bg); }
.text-search-case-toggle input:checked + .text-search-switch::after {
  background: var(--control-active-text); transform: translateX(0.76rem);
}
.text-search-case-toggle input:focus-visible + .text-search-switch {
  outline: 2px solid var(--focus-ring); outline-offset: 2px;
}
.text-search-hint {
  margin: -0.25rem 0 0; color: var(--control-muted); font-size: 0.7rem; line-height: 1.35;
}
.text-search-advanced-panel {
  display: grid; gap: 0.55rem; padding: 0.6rem; border: 1px solid var(--surface-border);
  border-radius: 4px; background: var(--input-bg);
}
.book-filter,
.translation-filter { display: grid; gap: 0.45rem; }
.book-filter + .regex-helper,
.book-filter + .translation-filter,
.regex-helper + .translation-filter {
  padding-top: 0.6rem; border-top: 1px solid var(--surface-border);
}
.book-filter-heading h3,
.translation-filter-heading h3 {
  margin: 0; color: var(--header-text); font-size: 0.76rem; line-height: 1.2;
}
.book-filter-heading p,
.translation-filter-heading p {
  margin: 0.18rem 0 0; color: var(--control-muted); font-size: 0.67rem; line-height: 1.35;
}
.book-filter-tags { display: flex; flex-wrap: wrap; gap: 0.32rem; }
.book-filter-tag {
  display: inline-flex; align-items: center; gap: 0.34rem; min-height: 1.65rem;
  border: 1px solid var(--control-active-bg); border-radius: 999px;
  background: var(--button-bg); color: var(--header-text); padding: 0.15rem 0.46rem;
  cursor: pointer; font: inherit; font-size: 0.68rem; font-weight: 750;
}
.book-filter-tag:hover { background: var(--button-hover-bg); }
.book-filter-tag span:last-child { color: var(--control-muted); font-size: 0.58rem; }
.book-filter-combobox { position: relative; }
.book-filter-combobox > input {
  width: 100%; height: 2rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--page-bg); color: var(--text-color); padding: 0.3rem 0.5rem;
  font: inherit; font-size: 0.74rem;
}
.book-filter-combobox > input:focus {
  outline: 2px solid var(--focus-ring); border-color: var(--focus-border);
}
.book-filter-suggestions {
  position: absolute; z-index: 40; top: calc(100% + 0.25rem); left: 0; right: 0;
  display: grid; max-height: 11rem; overflow-y: auto; border: 1px solid var(--surface-border);
  border-radius: 4px; background: var(--header-bg); box-shadow: 0 5px 16px rgb(0 0 0 / 18%);
}
.book-filter-suggestion {
  min-height: 1.9rem; border: 0; border-bottom: 1px solid var(--surface-border);
  background: transparent; color: var(--header-text); padding: 0.3rem 0.52rem;
  cursor: pointer; font: inherit; font-size: 0.73rem; font-weight: 700; text-align: left;
}
.book-filter-suggestion:last-of-type { border-bottom: 0; }
.book-filter-suggestion:hover,
.book-filter-suggestion.active { background: var(--button-hover-bg); }
.book-filter-no-results {
  margin: 0; padding: 0.52rem; color: var(--control-muted); font-size: 0.7rem;
}
.regex-helper { display: grid; gap: 0.45rem; }
.regex-helper-heading h3 {
  margin: 0; color: var(--header-text); font-size: 0.76rem; line-height: 1.2;
}
.regex-helper-heading p {
  margin: 0.18rem 0 0; color: var(--control-muted); font-size: 0.67rem; line-height: 1.35;
}
.regex-helper-list {
  display: grid; max-height: 16rem; overflow-y: auto; border: 1px solid var(--surface-border);
  border-radius: 4px; background: var(--page-bg);
}
.regex-helper-item {
  display: grid; grid-template-columns: minmax(7.5rem, auto) 1fr; gap: 0.12rem 0.55rem;
  border: 0; border-bottom: 1px solid var(--surface-border); background: transparent;
  color: var(--text-color); padding: 0.48rem 0.52rem; text-align: left; cursor: pointer;
}
.regex-helper-item:last-child { border-bottom: 0; }
.regex-helper-item:hover { background: var(--button-hover-bg); }
.regex-helper-item:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: -2px;
}
.regex-helper-item code {
  grid-row: 1 / span 2; align-self: center; color: var(--header-text); font-size: 0.68rem;
  overflow-wrap: anywhere;
}
.regex-helper-item > span { font-size: 0.68rem; font-weight: 700; line-height: 1.25; }
.regex-helper-item small { color: var(--control-muted); font-size: 0.63rem; line-height: 1.25; }
.text-search-translations { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.translation-chip {
  min-height: 1.8rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--input-bg); color: var(--control-muted); cursor: pointer;
  padding: 0.22rem 0.48rem; font-size: 0.72rem; font-weight: 750;
}
.translation-chip.active {
  border-color: var(--control-active-bg); background: var(--button-bg); color: var(--header-text);
}
.text-search-presets { display: flex; gap: 0.35rem; }
.text-search-presets button {
  min-height: 1.75rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--button-bg); color: var(--header-text); cursor: pointer;
  padding: 0.2rem 0.55rem; font-size: 0.72rem; font-weight: 700;
}
.text-search-presets button:hover { background: var(--button-hover-bg); }
.text-search-results {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start;
}
.text-search-message {
  padding: 1.25rem 0.85rem; color: var(--control-muted); font-size: 0.82rem; line-height: 1.4;
}
.text-search-loading {
  display: flex; align-items: center; gap: 0.52rem;
}
.text-search-spinner {
  width: 0.9rem; height: 0.9rem; flex: 0 0 0.9rem;
  border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: biblify-spin 0.72s linear infinite;
}
.text-search-error { color: var(--error-text); }
.text-search-result {
  display: grid; gap: 0.38rem; width: 100%; min-width: 0; text-align: left;
  border: 0; border-bottom: 1px solid var(--surface-border); background: transparent;
  color: var(--text-color); cursor: pointer; padding: 0.72rem 0.85rem; font: inherit;
}
.text-search-result:hover { background: var(--split-hover-bg); }
.text-search-result-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  color: var(--reader-accent); font-size: 0.78rem; font-weight: 800; line-height: 1.2;
}
.result-translation {
  flex-shrink: 0; border: 1px solid var(--surface-border); border-radius: 4px;
  color: var(--control-muted); padding: 0.1rem 0.32rem; font-size: 0.65rem;
}
.text-search-result-text { color: var(--text-color); font-family: Georgia, 'Times New Roman', serif; line-height: 1.55; }
.text-search-result-text mark,
.strongs-occurrence-text mark {
  border-radius: 2px; padding: 0 0.08rem;
}
.text-search-result-text mark.match-strong,
.strongs-occurrence-text mark.match-strong {
  background: var(--reader-accent); color: var(--accent-text);
}
.text-search-result-text mark.match-subtle,
.strongs-occurrence-text mark.match-subtle {
  background: var(--button-bg); color: var(--reader-accent);
  box-shadow: inset 0 -1px 0 var(--reader-accent);
}
.text-search-score { color: var(--control-muted); font-size: 0.68rem; font-weight: 700; }
.text-search-footer {
  padding: 0.7rem 0.85rem; border-top: 1px solid var(--surface-border);
  background: var(--subheader-bg); flex-shrink: 0;
}
.text-search-load-more { width: 100%; }

.passage-list-form { gap: 0.55rem; }
.passage-list-lesson-actions {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem;
  padding: 0.48rem 0.65rem; border-bottom: 1px solid var(--surface-border);
  background: var(--page-bg);
}
.passage-list-lessons-toggle,
.passage-list-save-lesson-btn {
  min-width: 0; min-height: 1.85rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--button-bg); color: var(--header-text); cursor: pointer; font: inherit;
  font-size: 0.7rem; font-weight: 800;
}
.passage-list-lessons-toggle {
  display: grid; grid-template-columns: 1rem auto auto 1fr; align-items: center; gap: 0.35rem;
  padding: 0.25rem 0.45rem; text-align: left;
}
.passage-list-lessons-toggle:hover,
.passage-list-save-lesson-btn:hover { background: var(--button-hover-bg); }
.passage-list-lessons-toggle.active { border-color: var(--reader-accent); }
.passage-list-lessons-toggle > svg {
  width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6;
  stroke-linecap: round; stroke-linejoin: round;
}
.passage-list-lesson-count {
  min-width: 1.15rem; border-radius: 999px; padding: 0.08rem 0.28rem;
  background: var(--input-bg); color: var(--control-muted); text-align: center;
  font-size: 0.61rem; line-height: 1.15;
}
.passage-list-lesson-chevron {
  justify-self: end; color: var(--control-muted); font-size: 1rem; line-height: 1;
  transform: rotate(0deg); transition: transform 150ms ease;
}
.passage-list-lessons-toggle.active .passage-list-lesson-chevron { transform: rotate(90deg); }
.passage-list-save-lesson-btn { padding: 0.25rem 0.55rem; }
.passage-list-save-lesson-btn:disabled { opacity: 0.45; cursor: default; }
.passage-list-lesson-library {
  display: grid; gap: 0.5rem; padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--surface-border); background: var(--subheader-bg);
}
.passage-list-lesson-save-form { display: grid; gap: 0.35rem; }
.passage-list-lesson-save-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
  color: var(--control-muted); font-size: 0.68rem;
}
.passage-list-lesson-save-heading button {
  border: 0; background: transparent; color: var(--reader-accent); cursor: pointer;
  font: inherit; font-size: 0.64rem; font-weight: 800;
}
.passage-list-lesson-save-heading button:hover { text-decoration: underline; }
.passage-list-lesson-save-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.35rem;
}
.passage-list-lesson-save-row button {
  min-width: 3.7rem; border: 1px solid var(--button-primary-bg); border-radius: 4px;
  background: var(--button-primary-bg); color: var(--button-primary-text); cursor: pointer;
  font: inherit; font-size: 0.7rem; font-weight: 800; padding: 0.25rem 0.5rem;
}
.passage-list-lesson-save-row button:disabled { opacity: 0.45; cursor: default; }
.passage-list-lesson-visibility {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.5rem;
  color: var(--control-muted); font-size: 0.64rem; font-weight: 800;
}
.passage-list-lesson-visibility select {
  min-height: 1.65rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--input-bg); color: var(--text-color); font: inherit; padding: 0.1rem 1.4rem 0.1rem 0.4rem;
}
.passage-list-lesson-visibility-help {
  color: var(--control-muted); font-size: 0.58rem; line-height: 1.3;
}
.passage-list-lesson-message {
  color: var(--control-muted); font-size: 0.63rem; font-weight: 700; line-height: 1.3;
}
.passage-list-lesson-message.error { color: var(--error-text); }
.passage-list-lesson-signin {
  display: grid; gap: 0.25rem; justify-items: start; padding: 0.15rem;
  color: var(--control-muted); font-size: 0.63rem; line-height: 1.35;
}
.passage-list-lesson-signin strong { color: var(--header-text); font-size: 0.7rem; }
.passage-list-lesson-signin button {
  margin-top: 0.15rem; border: 1px solid var(--button-primary-bg); border-radius: 4px;
  background: var(--button-primary-bg); color: var(--button-primary-text); cursor: pointer;
  font: inherit; font-weight: 800; padding: 0.25rem 0.65rem;
}
.passage-list-lesson-tabs {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--surface-border); border-radius: 4px; overflow: hidden;
}
.passage-list-lesson-tabs button {
  min-height: 1.7rem; border: 0; border-right: 1px solid var(--surface-border);
  background: var(--input-bg); color: var(--control-muted); cursor: pointer;
  font: inherit; font-size: 0.64rem; font-weight: 800;
}
.passage-list-lesson-tabs button:last-child { border-right: 0; }
.passage-list-lesson-tabs button.active { background: var(--control-active-bg); color: var(--control-active-text); }
.passage-list-lesson-tabs button span { opacity: 0.72; }
.passage-list-lesson-list {
  display: grid; gap: 0.3rem; max-height: 10rem; overflow: auto;
}
.passage-list-lesson-card {
  min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) 1.8rem;
  border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--input-bg); overflow: hidden;
}
.passage-list-lesson-card.shared { grid-template-columns: minmax(0, 1fr); }
.passage-list-lesson-card.active {
  border-color: var(--reader-accent); box-shadow: inset 3px 0 0 var(--reader-accent);
}
.passage-list-lesson-open {
  min-width: 0; display: grid; gap: 0.14rem; border: 0; background: transparent;
  color: var(--text-color); cursor: pointer; padding: 0.42rem 0.5rem;
  font: inherit; text-align: left;
}
.passage-list-lesson-open:hover { background: var(--button-bg); }
.passage-list-lesson-open strong,
.passage-list-lesson-open span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.passage-list-lesson-open strong { color: var(--reader-accent); font-size: 0.72rem; }
.passage-list-lesson-open span { color: var(--control-muted); font-size: 0.6rem; }
.passage-list-lesson-title-line {
  display: flex; align-items: center; gap: 0.35rem; color: inherit !important; font-size: inherit !important;
}
.passage-list-lesson-title-line strong {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.passage-list-lesson-title-line em {
  flex-shrink: 0; border-radius: 999px; padding: 0.08rem 0.32rem;
  background: var(--button-bg); color: var(--control-muted); font-size: 0.52rem; font-style: normal; font-weight: 800;
}
.passage-list-lesson-remove {
  border: 0; border-left: 1px solid var(--surface-border); background: transparent;
  color: var(--control-muted); cursor: pointer; font: inherit; font-size: 0.65rem;
}
.passage-list-lesson-remove:hover { background: var(--danger-bg); color: var(--danger-text); }
.passage-list-lesson-empty {
  color: var(--control-muted); font-size: 0.65rem; line-height: 1.35; text-align: center;
  padding: 0.3rem;
}
.passage-list-entry-mode {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--surface-border); border-radius: 4px; overflow: hidden;
}
.passage-list-entry-mode button {
  min-height: 1.9rem; border: 0; border-right: 1px solid var(--surface-border);
  background: var(--input-bg); color: var(--control-muted); cursor: pointer;
  font: inherit; font-size: 0.72rem; font-weight: 800;
}
.passage-list-entry-mode button:last-child { border-right: 0; }
.passage-list-entry-mode button.active {
  background: var(--control-active-bg); color: var(--control-active-text);
}
.passage-list-single-input-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 0.35rem;
}
.passage-list-reference-field { position: relative; min-width: 0; }
.passage-list-reference-field .text-search-input { padding-right: 1.8rem; }
.passage-list-reference-field input[type="search"]::-webkit-search-cancel-button { display: none; }
.passage-list-reference-field.is-valid .text-search-input {
  border-color: color-mix(in srgb, var(--reader-accent) 62%, var(--surface-border));
  background: color-mix(in srgb, var(--reader-accent) 3%, var(--input-bg));
}
.passage-list-reference-field.is-invalid .text-search-input {
  border-color: var(--error-text);
  background: color-mix(in srgb, var(--error-text) 3%, var(--input-bg));
}
.passage-list-validation-status {
  position: absolute; top: 50%; right: 0.5rem; transform: translateY(-50%);
  display: grid; place-items: center; width: 1rem; height: 1rem;
  color: var(--control-muted); pointer-events: none;
  font-size: 0.78rem; font-weight: 900; line-height: 1;
}
.passage-list-reference-field.is-valid .passage-list-validation-status { color: var(--reader-accent); }
.passage-list-reference-field.is-invalid .passage-list-validation-status { color: var(--error-text); }
.passage-list-validation-status .text-search-spinner {
  width: 0.72rem; height: 0.72rem; flex-basis: 0.72rem; border-width: 1.5px;
}
.passage-list-validation-message {
  margin: -0.18rem 0 0; color: var(--error-text);
  font-size: 0.66rem; font-weight: 700; line-height: 1.3;
}
.passage-list-translation-select {
  min-width: 4.65rem; min-height: 2rem; border: 1px solid var(--surface-border);
  border-radius: 4px; background: var(--input-bg); color: var(--text-color);
  font: inherit; font-size: 0.7rem; font-weight: 800; padding: 0 1.35rem 0 0.4rem;
}
.passage-list-group-name-field { display: grid; gap: 0.25rem; }
.passage-list-group-name-field > span {
  color: var(--control-muted); font-size: 0.68rem; font-weight: 800;
}
.passage-list-group-builder { display: grid; gap: 0.35rem; }
.passage-list-group-row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto 2rem; gap: 0.3rem;
}
.passage-list-group-image-editor {
  grid-column: 1 / 3; min-width: 0; display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr); gap: 0.38rem;
  padding: 0.28rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--subheader-bg);
}
.passage-list-group-image-preview {
  width: 2.6rem; height: 2.6rem; border-radius: 3px;
  object-fit: cover; background: var(--button-bg);
}
.passage-list-media-placeholder {
  width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 3px;
  background: var(--button-bg); color: var(--reader-accent); font-size: 1.1rem; font-weight: 900;
}
.passage-list-group-image-fields { min-width: 0; display: grid; gap: 0.25rem; }
.passage-list-image-name-input { height: 1.45rem; font-size: 0.7rem; padding-block: 0.1rem; }
.passage-list-group-validation-message { grid-column: 1 / -1; padding: 0 0.15rem; }
.passage-list-group-remove,
.passage-list-add-row {
  border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--button-bg); color: var(--text-color); cursor: pointer; font: inherit;
}
.passage-list-group-remove { width: 2rem; padding: 0; }
.passage-list-group-remove:disabled,
.passage-list-add-row:disabled { opacity: 0.4; cursor: default; }
.passage-list-group-actions {
  display: flex; align-items: stretch; justify-content: space-between; gap: 0.4rem;
}
.passage-list-group-add-buttons { display: flex; align-items: stretch; gap: 0.3rem; }
.passage-list-add-row { padding: 0.35rem 0.55rem; font-size: 0.72rem; font-weight: 800; }
.passage-list-image-picker {
  min-width: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 1px dashed var(--focus-border); border-radius: 4px;
  background: var(--button-bg); color: var(--reader-accent); cursor: pointer;
  font-size: 0.72rem; font-weight: 800;
}
.passage-list-image-picker:hover { background: var(--button-hover-bg); }
.passage-list-image-picker:focus-within {
  outline: 2px solid var(--focus-ring); outline-offset: 1px;
}
.passage-list-image-picker-main { min-height: 3rem; padding: 0.55rem; }
.passage-list-image-picker-compact {
  justify-content: flex-start; min-height: 1.25rem; width: fit-content;
  border-style: solid; padding: 0.18rem 0.38rem; font-size: 0.62rem;
}
.passage-list-image-picker-icon {
  width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor;
  stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.passage-list-image-picker .text-search-spinner {
  width: 0.72rem; height: 0.72rem; flex-basis: 0.72rem; border-width: 1.5px;
}
.passage-list-media-login {
  min-height: 3rem; padding: 0.55rem; border: 1px dashed var(--focus-border); border-radius: 4px;
  background: var(--button-bg); color: var(--reader-accent); cursor: pointer;
  font: inherit; font-size: 0.72rem; font-weight: 800;
}
.passage-list-media-login:hover { background: var(--button-hover-bg); }
.passage-list-image-draft {
  min-width: 0; display: grid; grid-template-columns: 3.6rem minmax(0, 1fr) 2rem;
  align-items: center; gap: 0.4rem; padding: 0.35rem;
  border: 1px solid var(--surface-border); border-radius: 4px; background: var(--subheader-bg);
}
.passage-list-image-draft > img,
.passage-list-image-draft > .passage-list-media-placeholder {
  width: 3.6rem; height: 3.2rem; border-radius: 3px; object-fit: contain; background: var(--button-bg);
}
.passage-list-image-draft-details { min-width: 0; display: grid; gap: 0.2rem; }
.passage-list-image-draft-details > span {
  color: var(--control-muted); font-size: 0.61rem; font-weight: 700;
}
.passage-list-add-image-submit { justify-self: end; }
.passage-list-options {
  display: flex; align-items: center; padding: 0.5rem 0.85rem;
  border-bottom: 1px solid var(--surface-border); background: var(--subheader-bg);
}
.passage-list-clean-toggle {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 1.35rem; border: 0;
  background: transparent; color: var(--control-muted); cursor: pointer;
  font: inherit; font-size: 0.72rem; font-weight: 800; line-height: 1; padding: 0;
}
.passage-list-clean-toggle.active { color: var(--reader-accent); }
.passage-list-clean-toggle:hover { color: var(--header-text); }
.passage-list-clean-toggle:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 3px; border-radius: 3px;
}
.passage-list-switch-track {
  position: relative; width: 2.1rem; height: 1.15rem; flex: 0 0 auto;
  border: 1px solid var(--surface-border); border-radius: 999px;
  background: var(--button-bg);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}
.passage-list-switch-track > span {
  position: absolute; top: 0.14rem; left: 0.15rem; width: 0.74rem; height: 0.74rem;
  border-radius: 50%; background: var(--control-muted);
  box-shadow: 0 1px 2px rgb(0 0 0 / 22%);
  transition: transform 160ms ease, background 160ms ease;
}
.passage-list-clean-toggle.active .passage-list-switch-track {
  border-color: var(--reader-accent); background: var(--reader-accent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--reader-accent) 35%, transparent);
}
.passage-list-clean-toggle.active .passage-list-switch-track > span {
  background: var(--input-bg); transform: translateX(0.95rem);
}
.passage-list-error {
  color: var(--error-text); font-size: 0.78rem; line-height: 1.35;
}
.passage-list-items {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start;
}
.passage-list-item {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: stretch; min-width: 0; border-bottom: 1px solid var(--surface-border);
  background: transparent;
}
.passage-list-item:hover { background: var(--split-hover-bg); }
.passage-list-item.active {
  background: var(--split-hover-bg);
  box-shadow: inset 3px 0 0 var(--reader-accent);
}
.passage-list-item.dragging { opacity: 0.58; }
.passage-list-item.drag-over::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  height: 3px; z-index: 5; background: var(--button-primary-bg);
}
.passage-list-item.drag-over.drop-after::before { top: auto; bottom: 0; }
.passage-list-drag-handle,
.passage-list-remove {
  width: 2.15rem; border: 0; background: transparent; color: var(--control-muted);
  cursor: pointer; font: inherit; font-size: 0.72rem;
}
.passage-list-drag-handle {
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.passage-list-drag-handle:active { cursor: grabbing; }
.passage-list-remove:hover,
.passage-list-drag-handle:hover { color: var(--header-text); background: var(--button-bg); }
.passage-list-entry-content {
  min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; column-gap: 0.35rem;
}
.passage-list-group-item .passage-list-entry-content {
  grid-template-columns: minmax(0, 1fr); gap: 0.35rem;
  padding: 0.45rem 0.2rem 0.55rem 0;
}
.passage-list-image-item .passage-list-entry-content { grid-template-columns: minmax(0, 1fr); }
.passage-list-group-item > .passage-list-drag-handle,
.passage-list-group-item > .passage-list-remove {
  align-self: start; height: 2.4rem;
}
.passage-list-group-item .passage-list-open {
  padding: 0.08rem 0.2rem 0.28rem;
}
.passage-list-open {
  min-width: 0; border: 0; background: transparent; color: var(--text-color);
  display: grid; gap: 0.18rem; align-content: center;
  padding: 0.68rem 0.2rem; cursor: pointer; font: inherit; text-align: left;
}
.passage-list-single-translation { padding-right: 0.2rem; }
.passage-list-single-translation .passage-list-translation-select { min-height: 1.75rem; }
.passage-list-group-heading {
  min-width: 0; display: flex; align-items: center; gap: 0.45rem;
}
.passage-list-group-heading .passage-list-label { flex: 1 1 auto; }
.passage-list-group-count {
  flex: 0 0 auto; border: 1px solid var(--surface-border); border-radius: 999px;
  background: var(--button-bg); color: var(--control-muted);
  padding: 0.1rem 0.38rem; font-size: 0.61rem; font-weight: 800; line-height: 1.15;
}
.passage-list-group-summary {
  min-width: 0; display: grid; gap: 0.28rem; padding: 0 0.2rem;
}
.passage-list-group-summary-row {
  min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: center; gap: 0.35rem; min-height: 2rem;
  border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--input-bg); color: var(--control-muted);
  padding: 0.16rem 0.2rem 0.16rem 0.48rem; font-size: 0.68rem;
}
.passage-list-group-summary-row > span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.passage-list-group-entry-label {
  min-width: 0; display: flex; align-items: center; gap: 0.35rem; font-weight: 700;
}
.passage-list-group-entry-label > span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.passage-list-group-entry-label > img {
  width: 1.35rem; height: 1.35rem; flex: 0 0 auto; border-radius: 2px;
  object-fit: cover; background: var(--button-bg);
}
.passage-list-media-summary-icon {
  width: 1.35rem; height: 1.35rem; flex: 0 0 auto; display: grid; place-items: center;
  border-radius: 2px; background: var(--button-bg); color: var(--reader-accent); font-size: 0.68rem;
}
.passage-list-group-summary-row .passage-list-translation-select {
  min-height: 1.55rem; border-color: transparent; background: var(--button-bg);
}
.passage-list-image-badge {
  border: 1px solid var(--surface-border); border-radius: 999px;
  background: var(--button-bg); color: var(--control-muted);
  padding: 0.12rem 0.38rem; font-size: 0.58rem; font-weight: 800;
}
.passage-list-image-list-heading {
  min-width: 0; display: grid; grid-template-columns: 2.65rem minmax(0, 1fr);
  align-items: center; gap: 0.5rem;
}
.passage-list-image-list-heading > img,
.passage-list-image-list-heading > .passage-list-media-placeholder {
  width: 2.65rem; height: 2.35rem; border-radius: 3px;
  object-fit: cover; background: var(--button-bg);
}
.passage-list-image-list-copy { min-width: 0; display: grid; gap: 0.18rem; }
.passage-list-label {
  min-width: 0; color: var(--reader-accent); font-size: 0.86rem;
  font-weight: 800; line-height: 1.2; overflow: hidden; text-overflow: ellipsis;
}
.passage-list-subtitle {
  min-width: 0; color: var(--control-muted); font-size: 0.72rem; line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis;
}
.passage-list-image-viewer {
  position: fixed; top: 0; left: 0; z-index: 1200; display: grid;
  width: 100vw; height: 100vh; height: 100dvh; max-width: 100vw;
  grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--page-bg) 94%, black 6%);
  color: var(--text-color);
}
.passage-list-image-viewer-header {
  min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 3.4rem; padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--surface-border); background: var(--subheader-bg);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.passage-list-image-viewer-header > div { min-width: 0; display: grid; gap: 0.16rem; }
.passage-list-image-viewer-header strong {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--header-text); font-size: 0.9rem;
}
.passage-list-image-viewer-header span { color: var(--control-muted); font-size: 0.66rem; }
.passage-list-image-viewer-header button {
  width: 2rem; height: 2rem; flex: 0 0 auto; border: 1px solid var(--surface-border);
  border-radius: 5px; background: var(--button-bg); color: var(--header-text);
  cursor: pointer; font: inherit;
}
.passage-list-image-viewer-header button:hover { background: var(--button-hover-bg); }
.passage-list-image-viewer-stage {
  min-width: 0; min-height: 0; display: grid; place-items: center; overflow: hidden;
  padding: clamp(0.5rem, 2vw, 1.5rem);
}
.passage-list-image-viewer-stage > img,
.passage-list-image-viewer-stage > video {
  display: block; width: 100%; height: 100%; min-width: 0; min-height: 0;
  object-fit: contain;
}
.passage-list-media-audio { align-self: center; }

.notes-form {
  display: grid; gap: 0.65rem; padding: 0.85rem; flex-shrink: 0;
  border-bottom: 1px solid var(--surface-border); background: var(--page-bg);
}
.notes-scope-row {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--surface-border); border-radius: 4px; overflow: hidden;
}
.notes-scope-btn {
  min-width: 0; min-height: 2rem; border: 0; border-right: 1px solid var(--surface-border);
  background: var(--input-bg); color: var(--control-muted); cursor: pointer;
  font: inherit; font-size: 0.72rem; font-weight: 750; padding: 0 0.25rem;
}
.notes-scope-btn:last-child { border-right: 0; }
.notes-scope-btn.active { background: var(--control-active-bg); color: var(--control-active-text); }
.notes-scope-btn:disabled { opacity: 0.45; cursor: default; }
.notes-target {
  display: grid; gap: 0.18rem; min-width: 0;
  padding: 0.58rem 0.62rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--subheader-bg);
}
.notes-target strong {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--reader-accent); font-size: 0.82rem; line-height: 1.2;
}
.notes-target span {
  color: var(--control-muted); font-size: 0.72rem; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.notes-markdown-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.22rem;
  padding: 0.32rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--subheader-bg);
}
.notes-markdown-btn {
  min-width: 1.75rem; height: 1.55rem; border: 1px solid var(--surface-border); border-radius: 3px;
  background: var(--input-bg); color: var(--header-text);
  padding: 0 0.38rem; font: inherit; font-size: 0.68rem; font-weight: 850; cursor: pointer;
}
.notes-markdown-btn:hover,
.notes-markdown-btn:focus-visible {
  background: var(--button-hover-bg); outline: none; border-color: var(--focus-border);
}
.notes-markdown-btn-italic { font-style: italic; }
.notes-textarea {
  width: 100%; min-width: 0; resize: vertical; min-height: 7rem; max-height: 18rem;
  border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--input-bg); color: var(--text-color);
  padding: 0.58rem 0.62rem; font: inherit; font-size: 0.92rem; line-height: 1.5;
}
.notes-textarea:focus,
.notes-select:focus {
  outline: 2px solid var(--focus-ring); border-color: var(--focus-border);
}
.notes-markdown-preview {
  max-height: 12rem; overflow-y: auto;
  border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--input-bg); padding: 0.58rem 0.62rem;
}
.notes-controls {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.45rem; min-width: 0;
}
.notes-select-label { min-width: 0; margin-right: auto; }
.notes-select {
  height: 2.2rem; min-width: 6.6rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--input-bg); color: var(--text-color);
  padding: 0 0.45rem; font: inherit; font-size: 0.78rem; font-weight: 750;
}
.notes-secondary-btn,
.notes-login-btn {
  min-height: 2rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--button-bg); color: var(--header-text);
  padding: 0.32rem 0.62rem; font: inherit; font-size: 0.74rem; font-weight: 750; cursor: pointer;
}
.notes-secondary-btn:hover,
.notes-login-btn:hover { background: var(--button-hover-bg); }
.notes-secondary-btn:disabled { opacity: 0.58; cursor: default; }
.notes-save-btn { min-width: 4.6rem; }
.notes-login-btn { width: 100%; min-height: 2.25rem; }
.notes-list {
  flex: 1; min-height: 0; overflow-y: auto; display: grid; align-content: start;
}
.notes-item {
  display: grid; gap: 0.45rem; min-width: 0;
  padding: 0.78rem 0.85rem; border-bottom: 1px solid var(--surface-border);
  border-left: 3px solid transparent;
  background: transparent; cursor: pointer;
}
.notes-item:hover { background: var(--split-hover-bg); }
.notes-item:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: -2px;
  background: var(--split-hover-bg);
}
.notes-item-mine { border-left-color: var(--reader-accent); }
.notes-item-friend { border-left-color: #14b8a6; }
.notes-item-heading {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.5rem;
  min-width: 0;
}
.notes-item-meta {
  display: flex; align-items: center; gap: 0.4rem; min-width: 0;
}
.notes-reference {
  min-width: 0; border: 0; background: transparent; color: var(--reader-accent);
  padding: 0; text-align: left; font: inherit; font-size: 0.82rem; font-weight: 850;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer;
}
.notes-reference:disabled { cursor: default; opacity: 0.8; }
.notes-owner-chip {
  min-width: 0; max-width: 7.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--surface-border); border-radius: 999px;
  padding: 0.16rem 0.45rem; font-size: 0.66rem; line-height: 1.1; font-weight: 850;
}
.notes-owner-chip-mine {
  background: var(--button-bg); border-color: color-mix(in srgb, var(--reader-accent) 42%, var(--surface-border));
  color: var(--reader-accent);
}
.notes-owner-chip-friend {
  background: color-mix(in srgb, #14b8a6 12%, var(--page-bg)); border-color: color-mix(in srgb, #14b8a6 42%, var(--surface-border));
  color: color-mix(in srgb, #0f766e 82%, var(--text-color));
}
.notes-item-meta span {
  color: var(--control-muted); font-size: 0.68rem; font-weight: 750;
  text-transform: capitalize; white-space: nowrap;
}
.notes-item-body {
  color: var(--text-color); font-size: 0.92rem; line-height: 1.55;
  overflow-wrap: anywhere;
}
.notes-item-body.collapsed {
  max-height: 8.8rem; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent);
  mask-image: linear-gradient(to bottom, #000 72%, transparent);
}
.notes-rendered {
  color: var(--text-color); font-size: 0.92rem; line-height: 1.55;
}
.notes-rendered > * + * { margin-top: 0.48rem; }
.notes-rendered h1,
.notes-rendered h2,
.notes-rendered h3,
.notes-rendered h4,
.notes-rendered h5,
.notes-rendered h6 {
  color: var(--header-text); line-height: 1.25; font-weight: 850;
}
.notes-rendered h1 { font-size: 1.15rem; }
.notes-rendered h2 { font-size: 1.08rem; }
.notes-rendered h3,
.notes-rendered h4,
.notes-rendered h5,
.notes-rendered h6 { font-size: 1rem; }
.notes-rendered ul,
.notes-rendered ol {
  padding-left: 1.15rem;
}
.notes-rendered li + li { margin-top: 0.2rem; }
.notes-rendered blockquote {
  border-left: 3px solid var(--surface-border);
  padding-left: 0.68rem; color: var(--control-muted);
}
.notes-rendered code {
  border: 1px solid var(--surface-border); border-radius: 3px;
  background: var(--subheader-bg); color: var(--text-color);
  padding: 0.04rem 0.22rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86em;
}
.notes-rendered pre {
  overflow-x: auto; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--subheader-bg); padding: 0.58rem;
}
.notes-rendered pre code {
  display: block; border: 0; background: transparent; padding: 0; white-space: pre;
}
.notes-rendered a {
  color: var(--reader-accent); font-weight: 750; text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 0.16em;
}
.notes-expand-btn {
  justify-self: start; border: 0; background: transparent; color: var(--reader-accent);
  padding: 0.1rem 0; font: inherit; font-size: 0.72rem; font-weight: 850; cursor: pointer;
}
.notes-expand-btn:hover { color: var(--header-text); text-decoration: underline; }
.notes-item-actions {
  display: flex; justify-content: flex-end; gap: 0.42rem;
}
.notes-danger-btn {
  color: var(--danger-text);
}
.notes-modal-backdrop {
  position: fixed; inset: 0; z-index: 900;
  display: grid; place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: var(--modal-backdrop);
}
.notes-modal {
  width: min(54rem, 100%); max-height: min(82vh, 48rem);
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto;
  border: 1px solid var(--surface-border); border-radius: 8px;
  background: var(--modal-bg); color: var(--modal-text);
  box-shadow: 0 1.25rem 3rem var(--popup-shadow);
  overflow: hidden;
}
.notes-modal-header {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.9rem; align-items: start;
  padding: 1rem 1.15rem; border-bottom: 1px solid var(--surface-border);
  background: var(--subheader-bg);
}
.notes-modal-title-group {
  display: grid; gap: 0.42rem; min-width: 0;
}
.notes-modal-reference {
  font-size: 1rem;
}
.notes-modal-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem;
  color: var(--control-muted); font-size: 0.78rem; font-weight: 750;
  text-transform: capitalize;
}
.notes-modal-close {
  width: 2rem; height: 2rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--button-bg); color: var(--header-text);
  font: inherit; font-size: 0.9rem; line-height: 1; cursor: pointer;
}
.notes-modal-close:hover,
.notes-modal-close:focus-visible {
  background: var(--button-hover-bg); outline: none; border-color: var(--focus-border);
}
.notes-modal-body {
  min-height: 0; overflow-y: auto;
  padding: clamp(1.1rem, 3vw, 1.8rem);
}
.notes-modal-body.notes-rendered {
  font-size: 1.06rem; line-height: 1.7;
}
.notes-modal-body.notes-rendered > * + * { margin-top: 0.72rem; }
.notes-modal-body.notes-rendered h1 { font-size: 1.55rem; }
.notes-modal-body.notes-rendered h2 { font-size: 1.36rem; }
.notes-modal-body.notes-rendered h3,
.notes-modal-body.notes-rendered h4,
.notes-modal-body.notes-rendered h5,
.notes-modal-body.notes-rendered h6 { font-size: 1.14rem; }
.notes-modal-actions {
  display: flex; justify-content: flex-end; gap: 0.45rem;
  padding: 0.82rem 1.15rem; border-top: 1px solid var(--surface-border);
  background: var(--page-bg);
}

.session-sync-banner {
  min-height: 1.8rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; gap: 0.42rem;
  border: 0; border-bottom: 1px solid var(--surface-border);
  background: color-mix(in srgb, var(--reader-accent) 7%, var(--page-bg));
  color: var(--control-muted); padding: 0.28rem 0.75rem;
  font: 750 0.7rem/1.2 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  cursor: pointer;
}
.session-sync-banner:hover,
.session-sync-banner:focus-visible {
  background: color-mix(in srgb, var(--reader-accent) 13%, var(--page-bg));
  color: var(--reader-accent); outline: none;
}
.session-sync-banner.connected { color: var(--reader-accent); }
.sessions-live-dot {
  display: inline-block; width: 0.5rem; height: 0.5rem; flex: 0 0 auto;
  border-radius: 999px; background: #ef4444;
  box-shadow: 0 0 0 3px color-mix(in srgb, #ef4444 16%, transparent);
}
.session-sync-banner:not(.connected) .sessions-live-dot {
  background: var(--control-muted);
  box-shadow: none;
}

.sessions-pane-shell {
  flex-basis: clamp(22rem, 30vw, 31rem);
}
.sessions-pane {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--page-bg); color: var(--text-color);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.sessions-pane-header {
  display: flex; align-items: center; justify-content: space-between; gap: 0.7rem;
  padding: 0.72rem 0.85rem; border-bottom: 1px solid var(--surface-border);
  background: var(--subheader-bg); color: var(--header-text); flex-shrink: 0;
}
.sessions-pane-header > div:first-child {
  min-width: 0; display: grid; gap: 0.15rem;
}
.sessions-pane-header h2 {
  font-size: 0.95rem; line-height: 1.1;
}
.sessions-pane-header p {
  color: var(--control-muted); font-size: 0.7rem; line-height: 1.3;
}
.sessions-pane-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.sessions-pane-actions button,
.sessions-icon-btn {
  width: 1.9rem; height: 1.9rem; border: 1px solid var(--header-border);
  border-radius: 4px; background: var(--button-bg); color: var(--header-text);
  cursor: pointer; line-height: 1;
}
.sessions-pane-actions button:hover,
.sessions-icon-btn:hover { background: var(--button-hover-bg); }
.sessions-pane-body {
  min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 0.8rem;
  padding: 0.85rem;
}
.sessions-empty-state {
  margin: auto; width: min(100% - 2rem, 24rem);
  display: grid; justify-items: start; gap: 0.65rem;
  padding: 1.1rem; border: 1px solid var(--surface-border);
  border-radius: 8px; background: var(--subheader-bg);
}
.sessions-empty-state strong { color: var(--header-text); font-size: 0.9rem; }
.sessions-empty-state p { color: var(--control-muted); font-size: 0.78rem; line-height: 1.45; }
.sessions-section,
.sessions-status-card {
  display: grid; gap: 0.8rem; padding: 0.85rem;
  border: 1px solid var(--surface-border); border-radius: 8px;
  background: var(--subheader-bg);
}
.sessions-status-live {
  border-color: color-mix(in srgb, #ef4444 40%, var(--surface-border));
}
.sessions-section-heading {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem;
}
.sessions-section-heading > div { min-width: 0; display: grid; gap: 0.22rem; }
.sessions-section h3 { color: var(--header-text); font-size: 0.86rem; }
.sessions-section p,
.sessions-status-card p {
  color: var(--control-muted); font-size: 0.73rem; line-height: 1.4;
}
.sessions-primary-btn,
.sessions-secondary-btn,
.sessions-danger-btn {
  width: fit-content; min-height: 2rem; border-radius: 5px;
  padding: 0.35rem 0.7rem; font: inherit; font-size: 0.74rem; font-weight: 800;
  cursor: pointer;
}
.sessions-primary-btn {
  border: 1px solid var(--button-primary-bg);
  background: var(--button-primary-bg); color: var(--button-primary-text);
}
.sessions-primary-btn:hover { background: var(--button-primary-hover-bg); }
.sessions-secondary-btn {
  border: 1px solid var(--surface-border);
  background: var(--button-bg); color: var(--header-text);
}
.sessions-secondary-btn:hover { background: var(--button-hover-bg); }
.sessions-danger-btn {
  border: 1px solid var(--danger-border);
  background: var(--danger-bg); color: var(--danger-text);
}
.sessions-primary-btn:disabled,
.sessions-secondary-btn:disabled,
.sessions-danger-btn:disabled,
.sessions-icon-btn:disabled { opacity: 0.58; cursor: wait; }
.sessions-live-heading {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: center; gap: 0.6rem;
}
.sessions-live-heading > div { min-width: 0; display: grid; gap: 0.12rem; }
.sessions-live-heading strong { color: var(--header-text); font-size: 0.84rem; }
.sessions-live-heading span:not(.sessions-live-dot) {
  color: var(--control-muted); font-size: 0.68rem;
}
.sessions-message {
  padding: 0.6rem; color: var(--control-muted); font-size: 0.74rem; line-height: 1.4;
  border: 1px dashed var(--surface-border); border-radius: 6px;
}
.sessions-message.error {
  border-style: solid; border-color: var(--danger-border);
  background: var(--danger-bg); color: var(--danger-text);
}
.sessions-list { display: grid; gap: 0.35rem; }
.sessions-list-row {
  width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center; gap: 0.55rem; border: 1px solid var(--surface-border);
  border-radius: 6px; background: var(--page-bg); color: var(--text-color);
  padding: 0.55rem; font: inherit; text-align: left; cursor: pointer;
}
.sessions-list-row:hover,
.sessions-list-row.selected {
  border-color: color-mix(in srgb, var(--reader-accent) 55%, var(--surface-border));
  background: var(--button-bg);
}
.sessions-list-copy { min-width: 0; display: grid; gap: 0.1rem; }
.sessions-list-copy strong {
  overflow: hidden; color: var(--header-text); font-size: 0.78rem;
  text-overflow: ellipsis; white-space: nowrap;
}
.sessions-list-copy small,
.sessions-list-row > span:last-child {
  color: var(--control-muted); font-size: 0.64rem;
}
.sessions-join-options {
  display: grid; gap: 0.65rem; margin-top: 0.65rem; padding-top: 0.75rem;
  border-top: 1px solid var(--surface-border);
}
.sessions-option-group { display: grid; gap: 0.35rem; }
.sessions-option-label,
.sessions-field > span {
  color: var(--control-muted); font-size: 0.67rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.sessions-segmented {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0.16rem; border: 1px solid var(--surface-border);
  border-radius: 6px; background: var(--page-bg);
}
.sessions-segmented button {
  min-height: 1.9rem; border: 0; border-radius: 4px;
  background: transparent; color: var(--control-muted);
  font: inherit; font-size: 0.72rem; font-weight: 800; cursor: pointer;
}
.sessions-segmented button:hover { background: var(--button-bg); color: var(--header-text); }
.sessions-segmented button.active {
  background: var(--control-active-bg); color: var(--control-active-text);
}
.sessions-field { display: grid; gap: 0.35rem; }
.sessions-field select {
  width: 100%; min-height: 2rem; border: 1px solid var(--surface-border);
  border-radius: 5px; background: var(--input-bg); color: var(--text-color);
  padding: 0.3rem 0.45rem; font: inherit; font-size: 0.74rem;
}
.sessions-check {
  display: flex; align-items: flex-start; gap: 0.48rem;
  color: var(--text-color); font-size: 0.72rem; line-height: 1.35; cursor: pointer;
}
.sessions-check input { margin-top: 0.12rem; accent-color: var(--reader-accent); }

.graphics-pane-shell {
  flex-basis: clamp(34rem, 52vw, 64rem);
  min-width: 30rem;
}
.graphics-pane {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--page-bg); color: var(--text-color);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.graphics-pane-header {
  display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
  flex: 0 0 auto; min-height: 3.45rem;
  padding: 0.68rem 0.8rem; border-bottom: 1px solid var(--surface-border);
  background: var(--subheader-bg);
}
.graphics-pane-header > div:first-child { min-width: 0; display: grid; gap: 0.16rem; }
.graphics-pane-header h2 { color: var(--header-text); font-size: 0.96rem; line-height: 1; }
.graphics-pane-header p {
  color: var(--control-muted); font-size: 0.68rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.graphics-header-actions { display: flex; align-items: center; gap: 0.3rem; }
.graphics-header-actions button {
  width: 1.9rem; height: 1.9rem; border: 1px solid var(--header-border);
  border-radius: 4px; background: var(--button-bg); color: var(--header-text);
  cursor: pointer; line-height: 1;
}
.graphics-header-actions button:hover { background: var(--button-hover-bg); }
.graphics-header-actions button:disabled { opacity: 0.45; cursor: default; }
.graphics-pane-body {
  flex: 1; min-width: 0; min-height: 0; overflow-y: auto;
  display: grid; align-content: start; gap: 0.8rem; padding: 0.8rem;
}
.graphics-preview-panel {
  display: grid; gap: 0.45rem; min-width: 0;
  padding: 0.6rem; border: 1px solid var(--surface-border);
  border-radius: 8px; background: var(--subheader-bg);
}
.graphics-stage {
  position: relative; isolation: isolate;
  width: 100%; aspect-ratio: 16 / 9; min-height: 12rem; overflow: hidden;
  display: flex; background-color: var(--graphics-canvas, #000000);
  color: var(--graphics-text); font-family: var(--graphics-font);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.graphics-stage.graphics-canvas-grid {
  background-color: #0a0d12;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.035) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}
.graphics-stage:fullscreen,
.graphics-stage:-webkit-full-screen {
  width: 100vw; height: 100vh; aspect-ratio: auto; min-height: 100vh;
}
.graphics-composition {
  position: relative; z-index: 1; width: 100%; min-height: 100%;
  overflow: hidden;
}
.graphics-background-layer {
  position: absolute; z-index: 1;
  left: calc(50% + var(--graphics-background-x));
  top: calc(50% + var(--graphics-background-y));
  width: var(--graphics-background-width);
  height: var(--graphics-background-height);
  background: var(--graphics-background);
  opacity: var(--graphics-background-opacity);
  transform: translate(-50%, -50%) rotate(var(--graphics-background-rotation));
  transform-origin: center;
}
.graphics-layout-lower-third .graphics-background-layer {
  border-radius: 0.22rem;
  box-shadow: 0 1rem 3rem rgba(0,0,0,0.24);
}
.graphics-scripture-layer {
  position: absolute; z-index: 2;
  left: calc(50% + var(--graphics-scripture-x));
  top: calc(50% + var(--graphics-scripture-y));
  width: var(--graphics-scripture-width);
  height: var(--graphics-scripture-height);
  box-sizing: border-box; display: grid; align-content: center; gap: 0.55em;
  padding: clamp(0.7rem, 3vw, 3rem);
  color: var(--graphics-text); text-align: center;
  opacity: var(--graphics-scripture-opacity);
  transform: translate(-50%, -50%) rotate(var(--graphics-scripture-rotation));
  transform-origin: center;
}
.graphics-layout-lower-third .graphics-scripture-layer {
  padding: 1.1rem 1.5rem; text-align: left;
}
.graphics-reference {
  color: var(--graphics-accent); font-family: system-ui, sans-serif;
  font-size: calc(0.73rem * var(--graphics-font-scale));
  font-weight: 850; letter-spacing: 0.09em; line-height: 1.1; text-transform: uppercase;
}
.graphics-scripture-copy {
  font-size: calc(1.55rem * var(--graphics-font-scale));
  font-weight: 650; line-height: 1.35; text-wrap: balance;
}
.graphics-layout-lower-third .graphics-scripture-copy {
  font-size: calc(1.18rem * var(--graphics-font-scale)); line-height: 1.28;
}
.graphics-verse { margin-right: 0.34em; }
.graphics-verse sup {
  margin-right: 0.25em; color: var(--graphics-accent);
  font-family: system-ui, sans-serif; font-size: 0.5em; font-weight: 900;
}
.graphics-translation {
  color: color-mix(in srgb, var(--graphics-text) 72%, transparent);
  font-family: system-ui, sans-serif; font-size: calc(0.58rem * var(--graphics-font-scale));
  font-weight: 800; letter-spacing: 0.11em;
}
.graphics-stage:fullscreen .graphics-reference,
.graphics-stage:-webkit-full-screen .graphics-reference {
  font-size: calc(1.25vw * var(--graphics-font-scale));
}
.graphics-stage:fullscreen .graphics-scripture-copy,
.graphics-stage:-webkit-full-screen .graphics-scripture-copy {
  font-size: calc(3.2vw * var(--graphics-font-scale));
}
.graphics-stage:fullscreen.graphics-layout-lower-third .graphics-scripture-copy,
.graphics-stage:-webkit-full-screen.graphics-layout-lower-third .graphics-scripture-copy {
  font-size: calc(2.4vw * var(--graphics-font-scale));
}
.graphics-stage:fullscreen .graphics-translation,
.graphics-stage:-webkit-full-screen .graphics-translation {
  font-size: calc(0.9vw * var(--graphics-font-scale));
}
.graphics-stage-status {
  position: absolute; z-index: 3; inset: 0;
  display: grid; place-items: center; max-width: 24rem; margin: auto; padding: 1rem;
  color: rgba(255,255,255,0.72); font-family: system-ui, sans-serif;
  font-size: 0.8rem; line-height: 1.4; text-align: center;
}
.graphics-stage-status[hidden],
.graphics-background-layer[hidden],
.graphics-scripture-layer[hidden] { display: none; }
.graphics-stage-error { color: #fecaca; }
.graphics-preview-meta {
  min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.8rem;
}
.graphics-preview-meta > span {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--control-muted); font-size: 0.7rem; font-weight: 750;
}
.graphics-preview-actions {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end;
  gap: 0.35rem; flex-wrap: wrap;
}
.graphics-present-btn {
  flex: 0 0 auto; min-height: 1.9rem; border: 1px solid var(--surface-border);
  border-radius: 4px; background: var(--button-bg); color: var(--header-text);
  padding: 0.3rem 0.55rem; cursor: pointer; font: inherit; font-size: 0.7rem; font-weight: 800;
}
.graphics-present-btn:hover { background: var(--button-hover-bg); }
.graphics-present-btn:disabled { opacity: 0.45; cursor: default; }
.graphics-output-help {
  color: var(--control-muted); font-size: 0.66rem; line-height: 1.4;
}
.graphics-controls { display: grid; gap: 0.7rem; min-width: 0; }
.graphics-control-section {
  display: grid; gap: 0.65rem; min-width: 0;
  padding: 0.75rem; border: 1px solid var(--surface-border);
  border-radius: 8px; background: var(--subheader-bg);
}
.graphics-control-heading {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 0.7rem;
}
.graphics-control-heading > div { min-width: 0; display: grid; gap: 0.18rem; }
.graphics-control-heading h3 { color: var(--header-text); font-size: 0.82rem; }
.graphics-control-heading p {
  color: var(--control-muted); font-size: 0.68rem; line-height: 1.35;
}
.graphics-control-heading p .sessions-live-dot {
  width: 0.38rem; height: 0.38rem; margin-right: 0.3rem;
}
.graphics-collapsible-section.collapsed { gap: 0; }
.graphics-collapsible-header {
  min-width: 0; display: flex; align-items: flex-start; gap: 0.5rem;
}
.graphics-collapsible-toggle {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 0.7rem;
  border: 0; background: transparent; color: inherit; padding: 0;
  cursor: pointer; font: inherit; text-align: left;
}
.graphics-collapsible-toggle > span:first-child {
  min-width: 0; display: grid; gap: 0.18rem;
}
.graphics-collapsible-toggle strong {
  color: var(--header-text); font-size: 0.82rem;
}
.graphics-collapsible-toggle small {
  color: var(--control-muted); font-size: 0.68rem; line-height: 1.35;
}
.graphics-collapsible-toggle small .sessions-live-dot {
  width: 0.38rem; height: 0.38rem; margin-right: 0.3rem;
}
.graphics-collapsible-toggle:focus-visible {
  outline: 2px solid var(--focus-border); outline-offset: 4px; border-radius: 2px;
}
.graphics-collapsible-chevron {
  flex: 0 0 auto; color: var(--control-muted); font-size: 0.72rem;
  transform: rotate(90deg); transition: transform 0.15s ease;
}
.graphics-collapsible-section.collapsed .graphics-collapsible-chevron {
  transform: rotate(0deg);
}
.graphics-collapsible-body {
  min-width: 0; display: grid; gap: 0.65rem;
}
.graphics-field { min-width: 0; display: grid; gap: 0.32rem; }
.graphics-field > span,
.graphics-color-field > span {
  color: var(--control-muted); font-size: 0.65rem; font-weight: 800;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.graphics-field select,
.graphics-field input[type="number"] {
  width: 100%; min-width: 0; min-height: 2rem;
  border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--input-bg); color: var(--text-color);
  padding: 0.3rem 0.42rem; font: inherit; font-size: 0.72rem;
}
.graphics-field input[type="range"] { width: 100%; accent-color: var(--reader-accent); }
.graphics-range-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.graphics-range-note {
  padding: 0.5rem; border-radius: 5px;
  background: color-mix(in srgb, var(--reader-accent) 9%, var(--page-bg));
  color: var(--reader-accent); font-size: 0.68rem; line-height: 1.35;
}
.graphics-canvas-control {
  display: grid; gap: 0.55rem; padding: 0.55rem;
  border: 1px solid var(--surface-border); border-radius: 6px;
  background: var(--page-bg);
}
.graphics-canvas-control > span { min-width: 0; display: grid; gap: 0.12rem; }
.graphics-canvas-control strong { color: var(--header-text); font-size: 0.74rem; }
.graphics-canvas-control small { color: var(--control-muted); font-size: 0.65rem; line-height: 1.3; }
.graphics-local-source-card {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: start; gap: 0.55rem; padding: 0.65rem;
  border: 1px solid color-mix(in srgb, var(--reader-accent) 30%, var(--surface-border));
  border-radius: 6px;
  background: color-mix(in srgb, var(--reader-accent) 8%, var(--page-bg));
}
.graphics-local-source-card > span:first-child {
  color: var(--reader-accent); font-size: 1rem; line-height: 1;
}
.graphics-local-source-card > span:last-child,
.graphics-optional-source-heading {
  min-width: 0; display: grid; gap: 0.14rem;
}
.graphics-local-source-card strong,
.graphics-optional-source-heading strong {
  color: var(--header-text); font-size: 0.74rem;
}
.graphics-local-source-card small,
.graphics-optional-source-heading small {
  color: var(--control-muted); font-size: 0.65rem; line-height: 1.35;
}
.graphics-optional-source-heading {
  margin-top: 0.2rem; padding-top: 0.7rem;
  border-top: 1px solid var(--surface-border);
}
.graphics-layer-transform-card {
  display: grid; gap: 0.65rem; padding: 0.65rem;
  border: 1px solid var(--surface-border); border-radius: 7px;
  background: var(--page-bg);
}
.graphics-layer-transform-header {
  min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: start; gap: 0.55rem;
}
.graphics-layer-transform-header .graphics-layer-row {
  border: 0; border-radius: 0; background: transparent; padding: 0;
}
.graphics-layer-transform-header > button {
  min-height: 1.75rem; border: 1px solid var(--surface-border); border-radius: 4px;
  background: var(--button-bg); color: var(--control-muted);
  padding: 0.2rem 0.48rem; cursor: pointer; font: inherit;
  font-size: 0.63rem; font-weight: 800;
}
.graphics-layer-transform-header > button:hover {
  background: var(--button-hover-bg); color: var(--header-text);
}
.graphics-layer-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr);
  align-items: start; gap: 0.55rem; padding: 0.55rem;
  border: 1px solid var(--surface-border); border-radius: 6px;
  background: var(--page-bg); cursor: pointer;
}
.graphics-layer-row input { margin-top: 0.18rem; accent-color: var(--reader-accent); }
.graphics-layer-row > span { min-width: 0; display: grid; gap: 0.12rem; }
.graphics-layer-row strong { color: var(--header-text); font-size: 0.74rem; }
.graphics-layer-row small { color: var(--control-muted); font-size: 0.65rem; line-height: 1.3; }
.graphics-transform-grid {
  min-width: 0; margin: 0; padding: 0; border: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.65rem 0.8rem;
  transition: opacity 0.15s;
}
.graphics-transform-grid:disabled { opacity: 0.42; }
.graphics-transform-field { min-width: 0; display: grid; gap: 0.28rem; }
.graphics-transform-field > span {
  min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 0.45rem;
  color: var(--control-muted); font-size: 0.63rem; font-weight: 800;
  letter-spacing: 0.025em; text-transform: uppercase;
}
.graphics-transform-field output {
  color: var(--header-text); font-variant-numeric: tabular-nums; letter-spacing: 0;
}
.graphics-transform-field input[type="range"] {
  width: 100%; min-width: 0; margin: 0; accent-color: var(--reader-accent);
}
.graphics-color-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.graphics-color-field { min-width: 0; display: grid; gap: 0.3rem; }
.graphics-color-field input[type="color"] {
  width: 100%; height: 2.1rem; border: 1px solid var(--surface-border);
  border-radius: 4px; background: var(--input-bg); padding: 0.18rem; cursor: pointer;
}

.graphics-output-page {
  width: 100vw; height: 100vh; margin: 0; overflow: hidden;
  background: #000;
}
.graphics-output-page .graphics-output-stage {
  position: fixed; inset: 0; width: 100vw; height: 100vh;
  min-height: 100vh; aspect-ratio: auto;
}
.graphics-output-page .graphics-reference {
  font-size: calc(1.25vw * var(--graphics-font-scale));
}
.graphics-output-page .graphics-scripture-copy {
  font-size: calc(3.2vw * var(--graphics-font-scale));
}
.graphics-output-page .graphics-layout-lower-third .graphics-scripture-copy {
  font-size: calc(2.4vw * var(--graphics-font-scale));
}
.graphics-output-page .graphics-translation {
  font-size: calc(0.9vw * var(--graphics-font-scale));
}
@media (max-width: 760px) {
  .graphics-pane-shell { min-width: 0; }
  .graphics-pane { height: 100vh; }
  .graphics-pane-body { padding: 0.55rem; }
  .graphics-stage { min-height: 10rem; }
  .graphics-scripture-copy { font-size: calc(1.12rem * var(--graphics-font-scale)); }
  .graphics-layout-lower-third .graphics-scripture-copy {
    font-size: calc(0.94rem * var(--graphics-font-scale));
  }
  .graphics-layout-lower-third .graphics-scripture-layer { padding: 0.7rem 0.8rem; }
  .graphics-transform-grid { grid-template-columns: 1fr; }
  .graphics-color-grid { grid-template-columns: 1fr; }
  .graphics-preview-meta { align-items: flex-start; flex-direction: column; }
  .graphics-preview-actions { width: 100%; justify-content: stretch; }
  .graphics-preview-actions .graphics-present-btn { flex: 1 1 auto; }
}


/* Custom compositions keep their ratio in previews and on any output display. */
.graphics-layout-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.graphics-stage.graphics-layout-custom {
  aspect-ratio: var(--graphics-aspect-ratio, 1.777778); min-height: 0;
}
.graphics-layout-custom .graphics-composition {
  container-type: inline-size;
}
.graphics-output-page .graphics-layout-custom,
.graphics-layout-custom:fullscreen,
.graphics-layout-custom:-webkit-full-screen {
  width: 100vw; height: 100vh; min-height: 0; aspect-ratio: auto;
  align-items: center; justify-content: center;
  background: #000;
}
.graphics-output-page .graphics-layout-custom .graphics-composition,
.graphics-layout-custom:fullscreen .graphics-composition,
.graphics-layout-custom:-webkit-full-screen .graphics-composition {
  flex: none;
  width: min(100vw, calc(100vh * var(--graphics-aspect-ratio, 1.777778)));
  height: min(100vh, calc(100vw / var(--graphics-aspect-ratio, 1.777778)));
  min-height: 0;
  background-color: var(--graphics-canvas, #000000);
}
.graphics-output-page .graphics-layout-custom.graphics-canvas-grid .graphics-composition,
.graphics-layout-custom.graphics-canvas-grid:fullscreen .graphics-composition,
.graphics-layout-custom.graphics-canvas-grid:-webkit-full-screen .graphics-composition {
  background-color: #0a0d12;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255,255,255,0.035) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.035) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.035) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}
.graphics-stage.graphics-layout-custom .graphics-scripture-layer {
  padding: 4cqw;
}
.graphics-stage.graphics-layout-custom .graphics-reference {
  font-size: calc(2.5cqw * var(--graphics-font-scale));
}
.graphics-stage.graphics-layout-custom .graphics-scripture-copy {
  font-size: calc(5cqw * var(--graphics-font-scale));
}
.graphics-stage.graphics-layout-custom .graphics-translation {
  font-size: calc(2cqw * var(--graphics-font-scale));
}

@keyframes biblify-spin {
  to { transform: rotate(360deg); }
}

.pane-header {
  background: var(--subheader-bg); color: var(--header-text);
  padding: 0.35rem 0.5rem;
  display: grid; gap: 0.32rem; flex-shrink: 0;
  position: relative;
}
.pane-location-row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(7rem, 12rem);
  align-items: center; gap: 0.35rem; min-width: 0;
}
.pane-drag-handle {
  width: 1.55rem; height: 1.55rem; border: 1px solid var(--header-border);
  border-radius: 3px; background: var(--button-bg); color: var(--control-muted);
  cursor: grab; font-size: 0.72rem; line-height: 1; padding: 0;
  user-select: none;
}
.pane-drag-handle:hover { background: var(--button-hover-bg); color: var(--header-text); }
.pane-drag-handle:active { cursor: grabbing; }
.pane-position { font-size: 0.68rem; color: var(--position-text); font-style: italic; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.passage-search {
  display: flex; align-items: center; gap: 0.2rem;
  min-width: 0;
}
.passage-search-input {
  width: 100%; min-width: 0; height: 1.65rem;
  border: 1px solid var(--header-border); border-radius: 4px;
  background: var(--input-bg); color: var(--text-color);
  padding: 0.18rem 0.4rem; font: inherit; font-size: 0.72rem;
}
.passage-search-input:focus {
  outline: 2px solid var(--focus-ring);
  border-color: var(--focus-border);
}
.passage-search-btn {
  height: 1.65rem; min-width: 2.15rem;
  border: 1px solid var(--button-primary-bg); border-radius: 4px;
  background: var(--button-primary-bg); color: var(--button-primary-text);
  padding: 0 0.45rem; font-size: 0.7rem; font-weight: 700;
  cursor: pointer;
}
.passage-search-btn:hover { background: var(--button-primary-hover-bg); }
.passage-search-btn:disabled { opacity: 0.55; cursor: default; }
.pane-controls {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.34rem; flex-wrap: wrap; min-width: 0;
  align-content: center;
}
.pane-control-group {
  min-width: 0; min-height: 1.86rem;
  display: inline-flex; align-items: center; gap: 0.08rem;
  padding: 0.12rem;
  border: 1px solid color-mix(in srgb, var(--header-border) 72%, transparent);
  border-radius: 6px;
  background: color-mix(in srgb, var(--button-bg) 44%, transparent);
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--page-bg) 62%, transparent);
}
.pane-control-group:focus-within {
  border-color: color-mix(in srgb, var(--focus-border) 62%, var(--header-border));
  box-shadow: 0 0 0 2px var(--focus-ring);
}
.pane-translation-control {
  padding: 0;
  overflow: hidden;
}
.pane-font-controls,
.pane-sync-controls {
  gap: 0.06rem;
}
.pane-font-controls {
  gap: 0; overflow: hidden;
}
.font-controls-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; list-style: none;
}
.font-controls-trigger::-webkit-details-marker { display: none; }
.font-controls-icon {
  color: currentColor; font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.72rem; font-weight: 800; letter-spacing: -0.08em;
}
.font-controls-options {
  display: inline-flex; align-items: center; gap: 0.06rem;
  max-width: 0; margin-left: 0; overflow: hidden;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: max-width 0.18s ease, margin-left 0.18s ease, opacity 0.14s ease, visibility 0.14s ease;
}
.pane-font-controls:hover .font-controls-options,
.pane-font-controls:focus-within .font-controls-options,
.pane-font-controls[open] .font-controls-options {
  max-width: 12rem; margin-left: 0.06rem;
  opacity: 1; visibility: visible; pointer-events: auto;
}
.pane-font-controls:hover .font-controls-trigger,
.pane-font-controls:focus-within .font-controls-trigger,
.pane-font-controls[open] .font-controls-trigger {
  background: var(--button-bg); color: var(--header-text);
}

.translation-select {
  height: 1.78rem; min-width: 4rem;
  border: 0; border-radius: 5px;
  background: transparent; color: var(--header-text);
  padding: 0 0.46rem; font: inherit; font-size: 0.68rem; font-weight: 750;
  cursor: pointer;
}
.translation-select:focus {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
.translation-fixed {
  display: inline-flex; align-items: center; justify-content: center;
  cursor: default; color: var(--control-muted); font-weight: 800;
}

.ctrl-btn {
  background: transparent; border: 0; color: var(--control-muted);
  width: 1.68rem; min-width: 1.68rem; height: 1.58rem;
  padding: 0; cursor: pointer; border-radius: 4px;
  font-size: 0.72rem; line-height: 1;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.ctrl-btn:hover,
.ctrl-btn:focus-visible {
  background: var(--button-bg); color: var(--header-text); outline: none;
}
.ctrl-btn.active {
  background: var(--control-active-bg); color: var(--control-active-text);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--header-shadow) 70%, transparent);
}
.ctrl-btn.chapter-toolbar-active {
  box-shadow: inset 0 -2px 0 var(--accent-text);
}
.chapter-heading-btn {
  display: inline-grid; place-items: center;
}
.chapter-heading-icon {
  display: block; width: 1rem; height: 1rem;
  fill: none; stroke: currentColor; stroke-width: 1.4;
  stroke-linecap: round; stroke-linejoin: round;
}
.chapter-heading-icon-frame { opacity: 0.68; }
.chapter-heading-icon-copy { opacity: 0.42; }
.chapter-heading-icon-bar { fill: currentColor; stroke: none; }
.chapter-heading-icon-pin { stroke-width: 1.7; }
.chapter-heading-icon-toolbar { opacity: 0.95; }
.target-btn {
  display: inline-grid; place-items: center;
}
.target-lock-icon {
  display: block; width: 0.94rem; height: 0.94rem;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}
.target-lock-icon-dot { fill: currentColor; stroke: none; }
.target-btn.locked {
  border-color: var(--reader-accent);
  box-shadow: inset 0 -2px 0 var(--reader-accent);
}
.strongs-toggle-btn {
  font-weight: 850;
}
.container-toggle-btn {
  display: inline-grid; place-items: center;
}
.container-width-icon {
  position: relative; display: block; width: 0.92rem; height: 0.68rem;
  border-left: 2px solid currentColor; border-right: 2px solid currentColor;
}
.container-width-icon::before {
  content: ''; position: absolute; inset: 0.12rem 0.08rem;
  border-radius: 1px; background: currentColor; opacity: 0.72;
  transition: left 0.16s ease, right 0.16s ease;
}
.container-width-icon.margins-medium::before {
  left: 0.2rem; right: 0.2rem;
}
.container-width-icon.margins-large::before {
  left: 0.28rem; right: 0.28rem;
}
.toolbar-chapter-heading {
  position: absolute; inset: 0; z-index: 6;
  display: grid; place-items: center;
  background: var(--subheader-bg); color: var(--reader-accent);
  border-bottom: 1px solid var(--surface-border);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 0.88rem; font-weight: 800; letter-spacing: 0.22em;
  line-height: 1.1; text-transform: uppercase;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
}
.pane-header:hover .toolbar-chapter-heading,
.pane-header:has(.passage-search-input:focus) .toolbar-chapter-heading {
  opacity: 0; visibility: hidden;
}

.ctrl-sep { width: 1px; height: 14px; background: var(--header-border); flex-shrink: 0; margin: 0 0.04rem; }
.font-label {
  min-width: 1.8rem; height: 1.42rem;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--control-muted); font-size: 0.6rem; font-weight: 800;
  border-inline: 1px solid color-mix(in srgb, var(--header-border) 74%, transparent);
}
.close-btn {
  width: 1.76rem; min-width: 1.76rem; height: 1.76rem;
  border: 1px solid color-mix(in srgb, var(--header-border) 72%, transparent);
  border-radius: 6px; background: color-mix(in srgb, var(--button-bg) 34%, transparent);
  color: var(--control-muted); cursor: pointer; font-size: 0.86rem; line-height: 1;
  padding: 0; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.close-btn:hover,
.close-btn:focus-visible {
  background: var(--button-hover-bg); border-color: var(--header-border);
  color: var(--header-text); outline: none;
}

.sync-btn {
  background: transparent; border: 0; color: var(--control-muted);
  width: 1.48rem; min-width: 1.48rem; height: 1.58rem;
  padding: 0; cursor: pointer; border-radius: 4px;
  font-size: 0.65rem; font-weight: bold; line-height: 1;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}
.sync-btn:hover,
.sync-btn:focus-visible {
  background: var(--button-bg); color: var(--header-text); outline: none;
}
.sync-btn.active {
  box-shadow: 0 1px 2px color-mix(in srgb, var(--header-shadow) 70%, transparent);
}
.sync-btn.sync-A.active { background: #3b82f6; color: white; }
.sync-btn.sync-B.active { background: #22c55e; color: white; }
.sync-btn.sync-C.active { background: #f97316; color: white; }
.sync-btn.sync-none.active { background: color-mix(in srgb, var(--header-border) 82%, transparent); color: var(--header-text); }

@media (max-width: 760px) {
  .pane-location-row { grid-template-columns: minmax(0, 1fr); }
  .pane-drag-handle { display: none; }
  .passage-search { grid-column: 1 / -1; }
  .pane-controls { justify-content: flex-start; }
  .pane-action-controls,
  .pane-sync-controls {
    display: none;
  }
  .container-toggle-btn {
    display: none;
  }
  .toolbar-chapter-heading {
    pointer-events: auto;
    cursor: text;
    touch-action: manipulation;
  }
  .search-pane-shell {
    position: fixed; inset: 0; z-index: 450; width: 100%; min-width: 0;
    height: 100vh; border-right: 0; flex: none;
  }
  .text-search-drag-handle { display: none; }
  .text-search-pane { height: 100vh; }
}

.scroll-container {
  flex: 1; min-height: 0; overflow-y: scroll; overflow-anchor: none;
  position: relative;
  padding: 0 1.5rem; font-size: 0.97rem; line-height: 1.9;
}
.scroll-container.container-mode-container {
  padding-left: max(1.5rem, calc((100% - 50rem) / 2));
  padding-right: max(1.5rem, calc((100% - 50rem) / 2));
}
.scroll-container.container-mode-medium {
  padding-left: max(1.5rem, calc((100% - 64rem) / 2));
  padding-right: max(1.5rem, calc((100% - 64rem) / 2));
}
.chapter-heading {
  text-align: center; padding: 1.2rem 0 0.6rem;
  color: var(--reader-accent); font-size: 0.8rem; letter-spacing: 0.3em;
  text-transform: uppercase; font-weight: bold; display: block;
}
.sticky-chapter-headings .chapter-heading {
  position: sticky; top: 0; z-index: 3;
  background: var(--page-bg);
  box-shadow: 0 1px 0 var(--surface-border);
}
.verse { display: inline; }
.verse.note-selected-verse .verse-ref {
  color: var(--reader-accent);
}
.verse-note-stack {
  display: inline-flex; align-items: center;
  position: relative; margin: 0 0.28rem 0 0.06rem;
  vertical-align: 0.12em; isolation: isolate;
}
.verse-note-stack-single { height: 0.98rem; }
.verse-note-stack-multiple {
  display: inline-grid; height: 1.16rem; z-index: 4;
}
.verse-note-badge {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.18rem;
  min-width: 2.15rem; max-width: 7.4rem; height: 1.02rem; margin: 0;
  border: 1px solid color-mix(in srgb, var(--surface-border) 68%, var(--page-bg));
  border-radius: 999px;
  background: var(--page-bg); color: var(--control-muted);
  padding: 0 0.42rem;
  font: 850 0.52rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  white-space: nowrap;
  cursor: pointer; opacity: 0.96;
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--page-bg) 86%, transparent),
    0 0.08rem 0.2rem color-mix(in srgb, var(--header-shadow) 42%, transparent);
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.18s ease;
}
.verse-note-badge-label {
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.verse-note-badge-count {
  display: inline-grid; place-items: center;
  min-width: 0.66rem; height: 0.66rem; padding: 0 0.12rem;
  border-radius: 999px; background: color-mix(in srgb, var(--page-bg) 92%, transparent); color: currentColor;
  font-size: 0.44rem; line-height: 1;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
}
.verse-note-stack-multiple .verse-note-badge {
  grid-area: 1 / 1;
  transform: translateX(var(--note-badge-stack-x)) translateY(var(--note-badge-stack-y));
}
.verse-note-stack-multiple:hover,
.verse-note-stack-multiple:focus-within {
  z-index: 40;
}
.verse-note-stack-multiple:hover .verse-note-badge,
.verse-note-stack-multiple:focus-within .verse-note-badge {
  opacity: 1;
  transform: translateX(0) translateY(var(--note-badge-list-y));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--page-bg) 86%, transparent),
    0 0.35rem 0.85rem color-mix(in srgb, var(--header-shadow) 70%, transparent);
}
.verse-note-badge:hover,
.verse-note-badge:focus-visible {
  opacity: 1; outline: none; border-color: var(--focus-border);
  color: var(--header-text); background: var(--button-hover-bg);
}
.verse-note-badge-mine {
  background: color-mix(in srgb, var(--reader-accent) 13%, var(--page-bg));
  border-color: color-mix(in srgb, var(--reader-accent) 58%, var(--surface-border));
  color: var(--reader-accent);
}
.verse-note-badge-friend {
  border-color: color-mix(in srgb, #14b8a6 58%, var(--surface-border));
  color: color-mix(in srgb, #0f766e 90%, var(--text-color));
  background: color-mix(in srgb, #14b8a6 16%, var(--page-bg));
}
.strongs-annotations-visible .verse-note-stack {
  display: inline-grid;
  grid-template-rows: minmax(1.05em, auto) auto;
  align-items: end;
  vertical-align: baseline;
  height: auto;
  margin: 0 0.34em 0.12em 0.08em;
}
.strongs-annotations-visible .verse-note-stack::before {
  content: '';
  grid-area: 1 / 1;
  min-height: 1.05em;
}
.strongs-annotations-visible .verse-note-stack .verse-note-badge {
  grid-area: 2 / 1;
}
.strongs-annotations-visible .verse-note-stack-multiple .verse-note-badge {
  grid-area: 2 / 1;
}
.strongs-annotations-visible .verse-note-stack-multiple:hover .verse-note-badge,
.strongs-annotations-visible .verse-note-stack-multiple:focus-within .verse-note-badge {
  transform: translateX(var(--note-badge-stack-x)) translateY(var(--note-badge-stack-y));
}
.verse-ref {
  font-size: 0.72em; color: var(--verse-ref); font-weight: bold;
  vertical-align: super; letter-spacing: 0.03em;
  margin-left: 0.4em; margin-right: 0.1em;
}
.verse-text { display: inline; }
.verse-text em { font-style: italic; }
.strongs-mode {
  line-height: 2.35;
}
.strongs-verse-text {
  display: inline;
}
.strongs-token {
  display: inline-grid; grid-template-rows: auto auto; align-items: end;
  justify-items: center; row-gap: 0.16em;
  vertical-align: baseline; max-width: min(100%, 12rem);
  margin: 0 0.1em 0.12em;
  line-height: 1.18;
  text-align: center;
}
.strongs-token-meta {
  display: inline-flex; flex-direction: column; align-items: center; gap: 0.36em;
  max-width: 100%;
  color: var(--reader-accent);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.48em; line-height: 1.08;
  text-align: center;
  white-space: normal;
}
.strongs-token-word,
.strongs-token-number {
  display: block; max-width: 9rem; overflow-wrap: anywhere;
  letter-spacing: 0;
}
.strongs-token-word {
  color: var(--control-muted); font-size: 1.14em; font-style: italic; font-weight: 650;
}
.strongs-token-number {
  color: var(--reader-accent); font-weight: 850;
}
.strongs-token-definition {
  display: block; max-width: 12rem;
  color: var(--control-muted); font-size: 0.92em; font-weight: 400;
  line-height: 1.45; letter-spacing: 0;
  white-space: normal; overflow-wrap: anywhere;
}
.strongs-definition {
  display: block; text-align: left;
}
.strongs-definition-section {
  display: block;
}
.strongs-definition-section + .strongs-definition-section {
  margin-top: 0.6em;
}
.strongs-definition-label {
  display: block; color: var(--reader-accent); font-weight: 750;
}
.strongs-definition-meaning {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.4em;
}
.strongs-definition-copy {
  white-space: pre-line; overflow-wrap: anywhere;
}
.strongs-definition-translations,
.strongs-definition-roots {
  border-top: 1px solid var(--surface-border); padding-top: 0.5em;
}
.strongs-token-text {
  display: block;
  color: var(--text-color);
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1em; line-height: 1.45;
}
.strongs-token-placeholder {
  visibility: hidden;
}
.strongs-token-button {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.strongs-token-button:hover .strongs-token-text,
.strongs-token-button:focus-visible .strongs-token-text,
.strongs-token-button.selected .strongs-token-text {
  color: var(--reader-accent);
  text-decoration: underline;
  text-underline-offset: 0.12em;
}
.strongs-token-button:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 3px;
}

.strongs-detail-panel {
  flex: 0 0 auto;
  min-height: 0;
  max-height: min(52vh, 31rem);
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--surface-border);
  background: var(--subheader-bg);
  color: var(--text-color);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.strongs-detail-header {
  flex: 0 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  padding: 0.62rem 0.75rem 0.52rem;
}
.strongs-word-navigation {
  display: flex; align-items: center; gap: 0.65rem;
  flex: 0 0 auto; padding: 0.55rem 0.75rem 0;
  font-size: 0.75rem;
}
.strongs-breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  min-width: 0; margin: 0; padding: 0; list-style: none;
}
.strongs-breadcrumbs li {
  display: flex; align-items: center; gap: 0.4rem;
}
.strongs-breadcrumbs [aria-current="page"] {
  font-weight: 750;
}
.strongs-breadcrumb-word {
  margin-inline-start: 0.3em; color: var(--control-muted);
  font-size: 0.88em; font-weight: 400; font-style: italic;
}
.strongs-reference-link {
  appearance: none; padding: 0; border: 0; background: transparent;
  color: var(--reader-accent); font: inherit; font-weight: 650;
  text-decoration: underline; text-underline-offset: 0.15em; cursor: pointer;
}
.strongs-reference-link:focus-visible {
  outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: 2px;
}
.strongs-word-status {
  font-size: 0.75rem; line-height: 1.4;
}
.strongs-detail-title-group {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.18rem;
}
.strongs-detail-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
  min-width: 0;
}
.strongs-selected-text {
  color: var(--text-color);
  font-size: 0.92rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}
.strongs-selected-number {
  color: var(--reader-accent);
  font-size: 0.82rem;
  font-weight: 850;
}
.strongs-selected-word {
  color: var(--control-muted);
  font-size: 0.8rem;
  font-style: italic;
  font-weight: 650;
}
.strongs-detail-definition {
  color: var(--control-muted);
  font-size: 0.72rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.strongs-detail-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.strongs-search-locations {
  justify-self: start; margin-top: 0.4rem;
}
.strongs-search-locations:disabled {
  opacity: 0.6; cursor: wait;
}
.strongs-detail-action,
.strongs-detail-close {
  border: 1px solid var(--header-border);
  background: var(--button-bg);
  color: var(--header-text);
  font: inherit;
  font-size: 0.72rem;
  line-height: 1;
  min-height: 1.7rem;
  border-radius: 4px;
  cursor: pointer;
}
.strongs-detail-action {
  padding: 0.35rem 0.55rem;
  font-weight: 750;
}
.strongs-detail-close {
  width: 1.7rem;
  padding: 0;
}
.strongs-detail-action:hover,
.strongs-detail-close:hover {
  background: var(--button-hover-bg);
}
.strongs-detail-status {
  padding: 0.75rem;
  color: var(--control-muted);
  font-size: 0.76rem;
  line-height: 1.35;
}
.strongs-detail-error {
  color: var(--error-text);
}
.strongs-detail-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0.52rem;
  padding: 0 0.75rem 0.75rem;
  overflow: hidden;
}
.strongs-finder-grid {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(2.65rem, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--surface-border);
  background: var(--surface-border);
}
.strongs-finder-book-btn {
  min-width: 0;
  min-height: 1.48rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.12rem;
  border: 0;
  background: var(--page-bg);
  color: var(--control-muted);
  font: inherit;
  font-size: 0.66rem;
  line-height: 1;
  padding: 0.18rem 0.18rem;
}
.strongs-finder-book-btn.filled {
  color: var(--text-color);
  cursor: pointer;
  font-weight: 750;
}
.strongs-finder-book-btn:disabled {
  cursor: default;
  opacity: 0.58;
}
.strongs-finder-book-btn.active {
  background: var(--control-active-bg);
  color: var(--control-active-text);
}
.strongs-finder-book-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.strongs-finder-count {
  flex: 0 0 auto;
  color: var(--danger-text);
  font-size: 0.62rem;
  font-weight: 850;
}
.strongs-finder-book-btn.active .strongs-finder-count {
  color: var(--control-active-text);
}
.strongs-chapter-strip {
  flex: 0 0 auto;
  display: flex;
  gap: 0.3rem;
  overflow-x: auto;
  padding-bottom: 0.06rem;
}
.strongs-chip-button {
  flex: 0 0 auto;
  min-height: 1.7rem;
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  border: 1px solid var(--header-border);
  border-radius: 4px;
  background: var(--page-bg);
  color: var(--header-text);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 750;
  padding: 0.28rem 0.45rem;
  cursor: pointer;
}
.strongs-chip-button.active {
  background: var(--control-active-bg);
  border-color: var(--control-active-bg);
  color: var(--control-active-text);
}
.strongs-chip-count {
  color: var(--danger-text);
  font-size: 0.66rem;
}
.strongs-chip-button.active .strongs-chip-count {
  color: var(--control-active-text);
}
.strongs-occurrence-summary {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  color: var(--control-muted);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.2;
}
.strongs-occurrence-list {
  flex: 1 1 auto;
  min-height: 4.5rem;
  overflow-y: auto;
  display: grid;
  gap: 0.34rem;
  padding-right: 0.12rem;
}
.strongs-occurrence-item {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(5rem, 0.42fr) minmax(3.4rem, 0.28fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 0.55rem;
  border: 1px solid var(--surface-border);
  border-radius: 4px;
  background: var(--page-bg);
  color: var(--text-color);
  font: inherit;
  font-size: 0.76rem;
  line-height: 1.28;
  padding: 0.45rem 0.52rem;
  text-align: left;
  cursor: pointer;
}
.strongs-occurrence-item:hover,
.strongs-occurrence-item:focus-visible {
  border-color: var(--focus-border);
  outline: none;
  background: var(--button-bg);
}
.strongs-occurrence-ref {
  color: var(--reader-accent);
  font-weight: 800;
  white-space: nowrap;
}
.strongs-occurrence-fragment {
  color: var(--control-muted);
  font-style: italic;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.strongs-occurrence-text {
  min-width: 0;
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  .strongs-detail-panel {
    max-height: 56vh;
  }
  .strongs-occurrence-item {
    grid-template-columns: 1fr;
    gap: 0.18rem;
  }
}

.split-mode.container-mode-fluid { padding: 0; }
.split-mode.container-mode-container {
  padding-left: max(1.5rem, calc((100% - 50rem) / 2));
  padding-right: max(1.5rem, calc((100% - 50rem) / 2));
}
.split-mode.container-mode-medium {
  padding-left: max(1.5rem, calc((100% - 64rem) / 2));
  padding-right: max(1.5rem, calc((100% - 64rem) / 2));
}
.split-mode .verse { display: block; padding: 0.28rem 1.5rem; }
.split-mode.container-mode-container .verse,
.split-mode.container-mode-medium .verse { padding-left: 0; padding-right: 0; }
.split-mode .verse:hover { background: var(--split-hover-bg); }
.split-mode .verse-ref { font-size: 0.72em; vertical-align: baseline; margin-left: 0; margin-right: 0.4rem; }
.split-mode.strongs-mode .verse { padding-top: 0.58rem; padding-bottom: 0.58rem; }

.align-left { text-align: left; }
.align-center { text-align: center; }
.align-right { text-align: right; }

.verse-text mark {
  position: relative; background: var(--hl); color: #111111; border-radius: 2px;
}
.saved-highlight-mark {
  cursor: pointer; outline-offset: 2px;
  box-shadow: inset 0 -2px 0 rgba(17,17,17,0.22);
}
.saved-highlight-mark.own-highlight-mark {
  box-shadow: inset 0 -2px 0 var(--header-text), 0 0 0 1px rgba(17,17,17,0.16);
}
.saved-highlight-mark.friend-highlight-mark {
  opacity: 0.68;
  box-shadow: inset 0 -1px 0 rgba(17,17,17,0.14);
}
.saved-highlight-mark.friend-highlight-mark:hover,
.saved-highlight-mark.friend-highlight-mark:focus-visible {
  opacity: 0.92;
}
.saved-highlight-mark::after {
  content: attr(data-owner);
  position: absolute; left: 0; bottom: calc(100% + 0.16rem); z-index: 8;
  max-width: min(12rem, 70vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0.12rem 0.34rem;
  border: 1px solid var(--pane-border); border-radius: 999px;
  background: var(--popup-bg); color: var(--header-text);
  box-shadow: 0 4px 14px var(--popup-shadow);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.68rem; font-weight: 850; line-height: 1.15;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.12rem);
  transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s ease;
}
.saved-highlight-mark.own-highlight-mark::after {
  border-color: var(--accent-bg); background: var(--accent-bg); color: var(--accent-text);
}
.saved-highlight-mark:hover::after,
.saved-highlight-mark:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.saved-highlight-mark:hover { outline: 1px solid rgba(17,17,17,0.35); }

.load-indicator { text-align: center; padding: 1rem; color: var(--control-muted); font-size: 0.75rem; letter-spacing: 0.1em; }
.load-indicator::after {
  content: ''; display: inline-block; width: 7px; height: 7px;
  border: 2px solid var(--verse-ref); border-top-color: transparent;
  border-radius: 50%; margin-left: 6px;
  animation: spin 0.7s linear infinite; vertical-align: middle;
}
.top-load-indicator {
  position: sticky; top: 0.35rem; z-index: 4;
  height: 0; padding: 0; overflow: visible; pointer-events: none;
  text-align: center;
}
.top-load-indicator .load-pill {
  display: inline-block; padding: 0.28rem 0.7rem;
  background: var(--loader-pill-bg); border: 1px solid var(--surface-border);
  border-radius: 999px; box-shadow: 0 2px 8px var(--loader-pill-shadow);
  color: var(--control-muted); font-size: 0.72rem; letter-spacing: 0.1em;
}
.top-load-indicator .load-pill::after {
  content: ''; display: inline-block; width: 7px; height: 7px;
  border: 2px solid var(--verse-ref); border-top-color: transparent;
  border-radius: 50%; margin-left: 6px;
  animation: spin 0.7s linear infinite; vertical-align: middle;
}
.measure-container {
  position: fixed; left: -10000px; top: 0;
  visibility: hidden; pointer-events: none;
  padding: 0 1.5rem; font-size: inherit; line-height: 1.9;
}
.error-indicator { text-align: center; padding: 1rem; color: var(--error-text); font-size: 0.8rem; line-height: 1.4; }
.end-indicator { text-align: center; padding: 1rem; color: var(--control-muted); font-size: 0.7rem; letter-spacing: 0.15em; opacity: 0.6; }
@keyframes spin { to { transform: rotate(360deg); } }

.highlight-popup {
  position: fixed; background: var(--popup-bg); border: 1px solid var(--popup-border);
  border-radius: 8px; padding: 0.4rem 0.55rem;
  display: flex; gap: 0.35rem; align-items: center;
  z-index: 300; box-shadow: 0 4px 16px var(--popup-shadow);
  transform: translateX(-50%); user-select: none;
  opacity: 0.55; transition: opacity 0.15s ease;
}
.highlight-popup:hover,
.highlight-popup:focus-within { opacity: 1; }
.highlight-popup-editor {
  width: 2.4rem; min-height: 1.75rem; box-sizing: border-box;
  flex-direction: column; align-items: stretch; gap: 0.5rem;
  padding: 0.24rem 0.45rem;
  transform: translate(-50%, -100%);
  transition: width 0.18s ease, padding 0.18s ease, opacity 0.15s ease;
}
.highlight-popup-editor.highlight-popup-below { transform: translate(-50%, 1rem); }
.highlight-popup-editor::before {
  content: '\2022\2022\2022'; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--header-text); font-family: system-ui, sans-serif;
  font-size: 0.78rem; font-weight: 900; letter-spacing: 0.12em;
  line-height: 1; pointer-events: none;
  transition: opacity 0.08s ease, visibility 0.08s ease;
}
.highlight-popup-content {
  display: flex; flex-direction: column; align-items: stretch; gap: 0.45rem;
  min-width: 0; max-height: 0; overflow: hidden;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: max-height 0.18s ease, opacity 0.1s ease, visibility 0.1s ease;
}
.highlight-popup-section { display: grid; gap: 0.4rem; min-width: 0; }
.highlight-popup-section-title {
  margin: 0; color: var(--control-muted);
  font: 800 0.62rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.highlight-popup-section-heading {
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.highlight-popup-highlight-section {
  gap: 0.48rem; padding-bottom: 0.55rem;
  border-bottom: 1px solid color-mix(in srgb, var(--pane-border) 72%, transparent);
}
.highlight-popup-editor:hover,
.highlight-popup-editor:focus-within {
  width: min(15rem, calc(100vw - 1rem));
  padding: 0.4rem 0.55rem;
}
.highlight-popup-editor:hover::before,
.highlight-popup-editor:focus-within::before {
  opacity: 0; visibility: hidden;
}
.highlight-popup-editor:hover .highlight-popup-content,
.highlight-popup-editor:focus-within .highlight-popup-content {
  max-height: 22rem; opacity: 1; visibility: visible; pointer-events: auto;
  transition-delay: 0.06s;
}
.highlight-popup::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--popup-border);
}
.highlight-popup-below::after {
  top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--popup-border);
}
.highlight-clear-btn {
  border: 0; border-radius: 4px; padding: 0.18rem 0.3rem;
  background: transparent; color: var(--control-muted); cursor: pointer;
  font: 750 0.62rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.highlight-clear-btn:hover {
  background: color-mix(in srgb, var(--error-text) 9%, transparent); color: var(--error-text);
}
.highlight-popup-control-row {
  display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); align-items: center; gap: 0.45rem;
  min-width: 0;
}
.highlight-popup-control-label {
  color: var(--control-muted);
  font: 750 0.65rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.highlight-popup-color-options { display: flex; align-items: center; justify-content: space-between; gap: 0.32rem; }
.highlight-popup-temporary-hint {
  margin: -0.16rem 0 -0.04rem; color: var(--control-muted); opacity: 0.72;
  text-align: right;
  font: 600 0.53rem/1.25 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.color-swatch {
  width: 20px; height: 20px; flex: 0 0 auto; border-radius: 50%; cursor: pointer;
  border: 2px solid var(--popup-bg); box-shadow: 0 0 0 1px color-mix(in srgb, var(--pane-border) 82%, transparent);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.color-swatch:hover { transform: translateY(-1px); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent-bg) 55%, transparent); }
.color-swatch.active { box-shadow: 0 0 0 2px var(--accent-bg); }
.color-swatch:focus-visible { outline: 2px solid var(--header-text); outline-offset: 2px; }
.highlight-visibility-options {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: hidden;
  border: 1px solid var(--pane-border); border-radius: 5px; background: var(--input-bg);
}
.highlight-visibility-option {
  min-width: 0; min-height: 1.75rem; border: 0; padding: 0.28rem 0.4rem;
  background: transparent; color: var(--control-muted); cursor: pointer;
  font: 750 0.65rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.highlight-visibility-option + .highlight-visibility-option {
  border-left: 1px solid var(--pane-border);
}
.highlight-visibility-option:hover { background: var(--button-hover-bg); color: var(--header-text); }
.highlight-visibility-option.active { background: var(--button-bg); color: var(--header-text); box-shadow: inset 0 -2px 0 var(--accent-bg); }
.highlight-visibility-option:focus-visible { outline: 2px solid var(--accent-bg); outline-offset: -2px; }
.highlight-popup-actions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: center; gap: 0.45rem;
}
.highlight-save-btn {
  min-height: 1.95rem; border: 1px solid var(--accent-bg); border-radius: 5px; padding: 0.35rem 0.7rem;
  background: var(--accent-bg); color: var(--accent-text); cursor: pointer;
  font: 800 0.72rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.highlight-save-btn:hover { background: var(--accent-hover-bg); }
.highlight-save-btn-wide { grid-column: 1 / -1; }
.highlight-save-btn:disabled { opacity: 0.65; cursor: wait; }
.highlight-remove-btn {
  min-height: 1.95rem; border: 1px solid color-mix(in srgb, var(--error-text) 55%, var(--pane-border));
  border-radius: 5px; padding: 0.34rem 0.62rem;
  background: transparent; color: var(--error-text); cursor: pointer;
  font: 800 0.72rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.highlight-remove-btn:hover { background: color-mix(in srgb, var(--error-text) 10%, transparent); }
.highlight-remove-btn:disabled { opacity: 0.65; cursor: wait; }
.highlight-popup-passage-context {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0.45rem; min-width: 0;
  padding: 0.42rem 0.5rem; border: 1px solid var(--pane-border); border-radius: 5px;
  background: color-mix(in srgb, var(--button-bg) 42%, transparent);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.highlight-popup-passage-context strong {
  min-width: 0; color: var(--header-text); font-size: 0.7rem; line-height: 1.25;
}
.highlight-popup-passage-btn {
  min-height: 1.72rem; border: 1px solid var(--pane-border); border-radius: 4px;
  padding: 0.3rem 0.42rem; background: var(--button-bg); color: var(--header-text);
  cursor: pointer; white-space: nowrap;
  font: 800 0.62rem/1 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.highlight-popup-passage-btn:hover { background: var(--button-hover-bg); }
.highlight-popup-passage-btn:disabled { opacity: 0.55; cursor: default; }
.highlight-popup-action-sections {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid color-mix(in srgb, var(--pane-border) 72%, transparent);
}
.highlight-popup-action-section { display: grid; gap: 0.3rem; min-width: 0; }
.highlight-popup-action-section > .highlight-popup-section-title {
  display: flex; align-items: flex-end; min-height: 1.28rem;
}
#highlight-popup-note-heading {
  font-size: 0.55rem; line-height: 1.15; letter-spacing: 0.04em;
}
.highlight-popup-action-btn {
  min-width: 0; min-height: 1.8rem; border-radius: 4px; padding: 0.35rem 0.3rem;
  cursor: pointer; font-size: 0.7rem; font-weight: 800; white-space: nowrap;
}
.highlight-popup-note-btn {
  border: 1px solid var(--pane-border); background: var(--button-bg); color: var(--header-text);
}
.highlight-popup-note-btn:hover { background: var(--button-hover-bg); }
.highlight-popup-search-btn { border: 1px solid var(--accent-bg); background: var(--accent-bg); color: var(--accent-text); }
.highlight-popup-search-btn:hover { background: var(--accent-hover-bg); }
.highlight-popup-action-btn:disabled { opacity: 0.55; cursor: default; }
.highlight-error {
  grid-column: 1 / -1; min-width: 0; color: var(--error-text);
  font-size: 0.68rem; font-weight: 700; line-height: 1.25;
}

.highlight-auth-backdrop {
  position: fixed; inset: 0; z-index: 610;
  display: grid; place-items: center; padding: 1rem;
  background: var(--modal-backdrop);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.highlight-auth-modal {
  width: min(100%, 390px); overflow: hidden;
  background: var(--modal-bg); color: var(--modal-text);
  border: 1px solid var(--pane-border); border-radius: 8px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.38);
}
.highlight-auth-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--surface-border);
}
.highlight-auth-header h2 {
  font-size: 1rem; line-height: 1.2; font-weight: 750;
  letter-spacing: 0; color: var(--modal-text);
}
.highlight-auth-close {
  width: 2rem; height: 2rem; border: 1px solid transparent;
  border-radius: 50%; background: transparent; color: var(--control-muted);
  cursor: pointer; line-height: 1;
}
.highlight-auth-close:hover { background: var(--modal-hover-bg); color: var(--modal-text); }
.highlight-auth-body {
  display: grid; gap: 1rem; padding: 1rem;
}
.highlight-auth-body p {
  color: var(--modal-muted); font-size: 0.88rem; line-height: 1.45;
}
.highlight-auth-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem;
}
.highlight-auth-actions button {
  min-height: 40px; border-radius: 6px; padding: 0.45rem 0.7rem;
  font-size: 0.84rem; font-weight: 750; cursor: pointer;
}
.highlight-auth-primary {
  border: 1px solid var(--accent-bg); background: var(--accent-bg); color: var(--accent-text);
}
.highlight-auth-primary:hover { background: var(--accent-hover-bg); }
.highlight-auth-secondary {
  border: 1px solid var(--pane-border); background: var(--button-bg); color: var(--modal-text);
}
.highlight-auth-secondary:hover { background: var(--button-hover-bg); }

.update-toast {
  position: fixed; right: 1rem; bottom: 1rem; z-index: 500;
  display: flex; align-items: center; gap: 0.75rem;
  background: var(--popup-bg); border: 1px solid var(--popup-border); color: var(--chip-text);
  padding: 0.75rem 0.85rem; border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.update-toast p { font-size: 0.82rem; line-height: 1.3; }
.update-toast button {
  border: 1px solid var(--button-primary-bg); background: var(--button-primary-bg); color: var(--button-primary-text);
  border-radius: 4px; padding: 0.35rem 0.65rem; cursor: pointer;
  font-size: 0.78rem; font-weight: 700;
}
.update-toast button:disabled { opacity: 0.65; cursor: wait; }

.login-backdrop {
  position: fixed; inset: 0; z-index: 600;
  display: grid; place-items: center; padding: 1rem;
  background: var(--modal-backdrop);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.login-modal {
  width: min(100%, 360px); max-height: calc(100vh - 2rem);
  overflow-x: hidden; overflow-y: auto;
  background: var(--modal-bg); color: var(--modal-text);
  border: 1px solid var(--pane-border); border-radius: 8px;
  box-shadow: 0 16px 44px rgba(0,0,0,0.38);
}
.login-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--surface-border);
}
.login-modal-header h2 {
  font-size: 1rem; line-height: 1.2; font-weight: 750;
  letter-spacing: 0; color: var(--modal-text);
}
.login-close {
  width: 2rem; height: 2rem; border: 1px solid transparent;
  border-radius: 50%; background: transparent; color: var(--control-muted);
  cursor: pointer; line-height: 1;
}
.login-close:hover { background: var(--modal-hover-bg); color: var(--modal-text); }
.login-close:disabled { opacity: 0.5; cursor: wait; }
.login-form { padding: 1rem; }
.login-field { display: grid; gap: 0.35rem; margin-bottom: 0.85rem; }
.login-field span {
  color: var(--modal-muted); font-size: 0.78rem; font-weight: 700;
}
.login-hint {
  color: var(--modal-muted); font-size: 0.7rem; line-height: 1.35;
}
.login-input {
  width: 100%; min-height: 42px; border: 1px solid var(--pane-border);
  border-radius: 6px; background: var(--input-bg); color: var(--modal-text);
  padding: 0.48rem 0.6rem; font: inherit;
}
.login-input:focus {
  outline: 2px solid var(--focus-ring);
  border-color: var(--focus-border);
}
.login-error {
  margin-bottom: 0.85rem; padding: 0.58rem 0.65rem;
  border: 1px solid var(--danger-border); border-radius: 6px;
  background: var(--danger-bg); color: var(--danger-text);
  font-size: 0.78rem; line-height: 1.35;
}
.login-submit {
  width: 100%; min-height: 42px; border: 1px solid var(--accent-bg);
  border-radius: 6px; background: var(--accent-bg); color: var(--accent-text);
  font-size: 0.86rem; font-weight: 750; cursor: pointer;
}
.login-submit:hover { background: var(--accent-hover-bg); }
.login-submit:disabled { opacity: 0.65; cursor: wait; }
.share-reader-dialog {
  margin: auto; padding: 0; width: min(560px, calc(100vw - 2rem));
  max-height: calc(100dvh - 2rem);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.share-reader-dialog::backdrop { background: var(--modal-backdrop); }
.share-reader-body { padding: 1rem; display: grid; gap: 1rem; font-size: 0.88rem; line-height: 1.45; }
.share-reader-options { border: 1px solid var(--pane-border); border-radius: 6px; padding: 0.75rem; min-width: 0; }
.share-reader-options legend { padding: 0 0.35rem; font-weight: 700; }
.share-reader-option { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.4rem 0; cursor: pointer; overflow-wrap: anywhere; }
.share-reader-option input { flex: 0 0 auto; width: 1rem; height: 1rem; margin-top: 0.15rem; accent-color: var(--accent-bg); }
.share-reader-option small { display: block; color: var(--modal-muted); }
.share-reader-hint { color: var(--modal-muted); font-size: 0.8rem; }
.share-reader-status { min-height: 1.45em; color: var(--modal-muted); }
.share-reader-body .login-field, .share-reader-body .login-error { margin-bottom: 0; }
.share-reader-error { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.6rem 1rem; background: var(--danger-bg); color: var(--danger-text); }
.login-switch {
  margin-top: 0.9rem; color: var(--modal-muted);
  font-size: 0.78rem; line-height: 1.4; text-align: center;
}
.login-switch button {
  border: 0; padding: 0; background: transparent; color: var(--reader-accent);
  font: inherit; font-weight: 750; cursor: pointer; text-decoration: underline;
  text-underline-offset: 0.15rem;
}
.login-switch button:hover { color: var(--modal-text); }
.signup-panel { display: grid; gap: 0.9rem; padding: 1rem; }
.signup-copy {
  color: var(--modal-muted); font-size: 0.82rem; line-height: 1.55;
}
.signup-steps {
  display: grid; gap: 0.5rem; margin: 0; padding-left: 1.25rem;
  color: var(--modal-text); font-size: 0.78rem; line-height: 1.45;
}
.signup-launch {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem;
  padding: 0.6rem; text-align: center; text-decoration: none;
}
.login-secondary {
  width: 100%; min-height: 42px; border: 1px solid var(--pane-border);
  border-radius: 6px; background: var(--button-bg); color: var(--modal-text);
  font-size: 0.82rem; font-weight: 700; cursor: pointer;
}
.login-secondary:hover { background: var(--button-hover-bg); }

.features-page {
  height: 100vh; overflow-y: auto; overflow-x: hidden;
  background: var(--page-bg); color: var(--text-color);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.features-header { position: sticky; top: 0; flex-wrap: wrap; }
.features-header .header-actions {
  flex: 0 1 auto; flex-wrap: wrap; max-width: 100%;
}
.features-brand {
  flex: 1 1 8rem; justify-content: flex-start; border-color: transparent;
  background: transparent; padding-left: 0; letter-spacing: 0.2em;
  text-transform: uppercase; font-size: 0.9rem;
}
.features-main {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto; padding: 2.25rem 0 3.5rem;
}
.features-intro {
  display: grid; gap: 1rem; padding-bottom: 2rem;
  border-bottom: 1px solid var(--surface-border);
}
.features-kicker,
.feature-eyebrow {
  color: var(--reader-accent); font-size: 0.72rem; font-weight: 800;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.features-intro h1 {
  max-width: 760px; font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1; letter-spacing: 0; color: var(--text-color);
}
.features-lede {
  max-width: 780px; color: var(--control-muted);
  font-size: clamp(1rem, 2vw, 1.22rem); line-height: 1.55;
}
.features-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 0.6rem;
  margin-top: 0.2rem;
}
.features-overview-image {
  width: 100%; aspect-ratio: 16 / 7; object-fit: cover; object-position: left top;
  border: 1px solid var(--surface-border); border-radius: 8px;
  box-shadow: 0 10px 30px var(--header-shadow); background: var(--subheader-bg);
}
.feature-gallery {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem; padding: 2rem 0;
}
.feature-card {
  display: grid; grid-template-rows: auto 1fr;
  overflow: hidden; border: 1px solid var(--surface-border);
  border-radius: 8px; background: var(--subheader-bg);
  box-shadow: 0 8px 22px var(--header-shadow);
}
.feature-card-image {
  width: 100%; aspect-ratio: 16 / 9; object-fit: cover; object-position: left top;
  border-bottom: 1px solid var(--surface-border); background: var(--page-bg);
}
.feature-card-copy {
  display: grid; gap: 0.7rem; align-content: start; padding: 1rem;
}
.feature-card h2,
.feature-band h2 {
  color: var(--text-color); font-size: 1.28rem; line-height: 1.18; letter-spacing: 0;
}
.feature-card p:not(.feature-eyebrow) {
  color: var(--control-muted); line-height: 1.5; font-size: 0.95rem;
}
.feature-card ul,
.supporting-feature-list {
  list-style: none; display: grid; gap: 0.45rem;
}
.feature-card li,
.supporting-feature-list li {
  position: relative; padding-left: 1.1rem; color: var(--text-color);
  line-height: 1.4; font-size: 0.9rem;
}
.feature-card li::before,
.supporting-feature-list li::before {
  content: ''; position: absolute; left: 0; top: 0.54em;
  width: 0.42rem; height: 0.42rem; border-radius: 50%;
  background: var(--reader-accent);
}
.feature-band {
  display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 1.25rem; align-items: start;
  padding: 1.25rem; border: 1px solid var(--surface-border);
  border-radius: 8px; background: var(--subheader-bg);
}
.supporting-feature-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1200px) {
  .features-brand { flex-basis: 100%; min-height: auto; }
  .features-header .header-actions {
    flex: 1 1 100%; justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .global-header {
    grid-template-columns: 1fr; align-items: start; gap: 0.42rem;
    padding: 0.45rem 0.65rem;
  }
  .global-brand {
    width: 100%; justify-content: space-between; padding-right: 0;
    border-right: 0; padding-bottom: 0.32rem; border-bottom: 1px solid var(--header-border);
  }
  .global-title { flex: 0 1 auto; letter-spacing: 0.14em; }
  .header-actions { justify-content: flex-start; gap: 0.35rem; }
  .header-group { gap: 0.22rem; }
  .reader-header {
    gap: 0;
  }
  .reader-header .global-brand {
    align-items: center;
    justify-content: flex-start;
    padding-bottom: 0;
    border-bottom: 0;
  }
  .mobile-nav-toggle {
    display: inline-grid; place-items: center;
    margin-left: auto;
  }
  .reader-main-nav {
    display: none;
    width: 100%; min-width: 0;
    padding-top: 0.48rem;
  }
  .reader-main-nav.open {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.42rem;
  }
  .reader-main-nav .header-group {
    width: 100%; opacity: 1;
    padding: 0.28rem; gap: 0.3rem;
    align-items: stretch; justify-content: flex-start;
  }
  .reader-main-nav .header-theme-group .theme-picker {
    width: 100%;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.32rem;
  }
  .reader-main-nav .theme-select {
    width: 100%; max-width: none; opacity: 1;
  }
  .reader-main-nav .header-social-group,
  .reader-main-nav .header-reader-group {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .reader-main-nav .header-reader-group {
    grid-template-columns: minmax(0, 1fr) 2rem;
  }
  .reader-main-nav .friends-menu,
  .reader-main-nav .layer-menu,
  .reader-main-nav .tool-menu {
    width: 100%; min-width: 0;
  }
  .reader-main-nav .friends-menu-open,
  .reader-main-nav .layer-menu-open,
  .reader-main-nav .tool-menu-open {
    grid-column: 1 / -1;
  }
  .reader-main-nav .reader-link,
  .reader-main-nav .add-pane-btn,
  .reader-main-nav .login-btn,
  .reader-main-nav .search-toggle-btn,
  .reader-main-nav .friends-toggle-btn {
    width: 100%; opacity: 1;
  }
  .reader-main-nav .icon-reader-link {
    width: 2rem; min-width: 2rem; padding-inline: 0;
  }
  .reader-main-nav .add-pane-btn {
    display: none;
  }
  .reader-main-nav .tool-dropdown,
  .reader-main-nav .friends-dropdown,
  .reader-main-nav .layer-dropdown {
    position: static;
    width: 100%; max-width: 100%;
    margin-top: 0.32rem;
    box-shadow: none;
  }
  .reader-main-nav .header-account-group .login-btn,
  .reader-main-nav .header-account-group .account-link {
    opacity: 1; pointer-events: auto;
  }
  .reader-main-nav .header-account-group .account-link {
    max-width: 5rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
    border-width: 1px;
  }
  .reader-main-nav .account-chip {
    width: 100%; max-width: none;
  }
  .add-pane-btn,
  .login-btn,
  .reader-link,
  .search-toggle-btn { padding: 0.3rem 0.5rem; font-size: 0.74rem; }
  .theme-select { max-width: 4.9rem; font-size: 0.7rem; }
  .theme-select-mode { max-width: 5.25rem; }
  .account-chip { max-width: 38vw; padding-left: 0.5rem; }
  .account-link { padding-inline: 0.35rem; }
  .features-main { width: min(100% - 1rem, 1180px); padding-top: 1.4rem; }
  .features-header .header-actions { justify-content: flex-start; }
  .features-overview-image { aspect-ratio: 4 / 3; }
  .feature-gallery,
  .feature-band,
  .supporting-feature-list { grid-template-columns: 1fr; }
  .feature-band { padding: 1rem; }
}
