:root {
  color-scheme: light dark;
  --brand: #5fa9c8;
  --brand-strong: #287fa5;
  --brand-soft: #e8f5fa;
  --brand-ink: #123d50;
  --bookmark-topic-color: var(--brand);
  --bookmark-topic-foreground: #172027;
  --danger: #c33f4c;
  --success: #2f8b67;
  --page: var(--tg-theme-bg-color, #f5f7f9);
  --surface: var(--tg-theme-secondary-bg-color, #ffffff);
  --surface-raised: var(--tg-theme-section-bg-color, #ffffff);
  --text: var(--tg-theme-text-color, #172027);
  --muted: var(--tg-theme-subtitle-text-color, #66747e);
  --hint: var(--tg-theme-hint-color, #81909a);
  --link: var(--tg-theme-link-color, #287fa5);
  --button: var(--tg-theme-button-color, #287fa5);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --separator: var(--tg-theme-section-separator-color, rgba(23, 32, 39, 0.1));
  --destructive: var(--tg-theme-destructive-text-color, #c33f4c);
  --header-height: 66px;
  --nav-height: 68px;
  --nav-handle-height: 22px;
  --content-width: 780px;
  --fullscreen-control-height: 32px;
  --fullscreen-control-hit-size: 44px;
  --fullscreen-control-clearance: clamp(72px, 20vw, 120px);
  --fullscreen-translation-max-width: min(48vw, 248px);
  --fullscreen-topbar-height: 66px;
  --fullscreen-control-safe-inline: max(var(--safe-left), var(--safe-right));
  --bridge-safe-area-inset-top: 0px;
  --bridge-safe-area-inset-right: 0px;
  --bridge-safe-area-inset-bottom: 0px;
  --bridge-safe-area-inset-left: 0px;
  --bridge-content-safe-area-inset-top: 0px;
  --bridge-content-safe-area-inset-right: 0px;
  --bridge-content-safe-area-inset-bottom: 0px;
  --bridge-content-safe-area-inset-left: 0px;
  --device-safe-top: max(
    env(safe-area-inset-top, 0px),
    var(--tg-safe-area-inset-top, 0px),
    var(--bridge-safe-area-inset-top)
  );
  --safe-top: max(
    env(safe-area-inset-top, 0px),
    var(--tg-safe-area-inset-top, 0px),
    var(--tg-content-safe-area-inset-top, 0px),
    var(--bridge-safe-area-inset-top),
    var(--bridge-content-safe-area-inset-top)
  );
  --safe-right: max(
    env(safe-area-inset-right, 0px),
    var(--tg-safe-area-inset-right, 0px),
    var(--tg-content-safe-area-inset-right, 0px),
    var(--bridge-safe-area-inset-right),
    var(--bridge-content-safe-area-inset-right)
  );
  --safe-bottom: max(
    env(safe-area-inset-bottom, 0px),
    var(--tg-safe-area-inset-bottom, 0px),
    var(--tg-content-safe-area-inset-bottom, 0px),
    var(--bridge-safe-area-inset-bottom),
    var(--bridge-content-safe-area-inset-bottom)
  );
  --safe-left: max(
    env(safe-area-inset-left, 0px),
    var(--tg-safe-area-inset-left, 0px),
    var(--tg-content-safe-area-inset-left, 0px),
    var(--bridge-safe-area-inset-left),
    var(--bridge-content-safe-area-inset-left)
  );
  --safe-inline-end: var(--safe-right);
  --app-height: var(--tg-viewport-stable-height, 100dvh);
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme="dark"] {
  --brand: #72bfdf;
  --brand-strong: #72bfdf;
  --brand-soft: rgba(95, 169, 200, 0.15);
  --brand-ink: #d8f3ff;
  --page: var(--tg-theme-bg-color, #11161a);
  --surface: var(--tg-theme-secondary-bg-color, #1a2228);
  --surface-raised: var(--tg-theme-section-bg-color, #202a31);
  --text: var(--tg-theme-text-color, #f2f6f8);
  --muted: var(--tg-theme-subtitle-text-color, #a7b2b9);
  --hint: var(--tg-theme-hint-color, #7f8b93);
  --link: var(--tg-theme-link-color, #72bfdf);
  --button: var(--tg-theme-button-color, #5fa9c8);
  --button-text: var(--tg-theme-button-text-color, #0b242e);
  --separator: var(--tg-theme-section-separator-color, rgba(255, 255, 255, 0.1));
  --destructive: var(--tg-theme-destructive-text-color, #ff707c);
}

/*
 * Bookmark colors are deliberately allowlisted here. Runtime code only sets a
 * data token, which keeps user-created topics compatible with the Mini App's
 * no-inline-style Content Security Policy.
 */
[data-bookmark-color="f9a8b8"] { --bookmark-topic-color: #f9a8b8; }
[data-bookmark-color="93c5fd"] { --bookmark-topic-color: #93c5fd; }
[data-bookmark-color="7dd3fc"] { --bookmark-topic-color: #7dd3fc; }
[data-bookmark-color="f9a8d4"] { --bookmark-topic-color: #f9a8d4; }
[data-bookmark-color="a16207"] {
  --bookmark-topic-color: #a16207;
  --bookmark-topic-foreground: #ffffff;
}
[data-bookmark-color="fde68a"] { --bookmark-topic-color: #fde68a; }
[data-bookmark-color="d8b4fe"] { --bookmark-topic-color: #d8b4fe; }
[data-bookmark-color="a5b4fc"] { --bookmark-topic-color: #a5b4fc; }
[data-bookmark-color="fca5a5"] { --bookmark-topic-color: #fca5a5; }
[data-bookmark-color="fdba74"] { --bookmark-topic-color: #fdba74; }
[data-bookmark-color="f0abfc"] { --bookmark-topic-color: #f0abfc; }
[data-bookmark-color="bef264"] { --bookmark-topic-color: #bef264; }
[data-bookmark-color="fcd34d"] { --bookmark-topic-color: #fcd34d; }
[data-bookmark-color="67e8f9"] { --bookmark-topic-color: #67e8f9; }
[data-bookmark-color="c4b5fd"] { --bookmark-topic-color: #c4b5fd; }
[data-bookmark-color="fda4af"] { --bookmark-topic-color: #fda4af; }
[data-bookmark-color="fed7aa"] { --bookmark-topic-color: #fed7aa; }
[data-bookmark-color="fecdd3"] { --bookmark-topic-color: #fecdd3; }
[data-bookmark-color="99f6e4"] { --bookmark-topic-color: #99f6e4; }
[data-bookmark-color="fb7185"] { --bookmark-topic-color: #fb7185; }
[data-bookmark-color="bbf7d0"] { --bookmark-topic-color: #bbf7d0; }
[data-bookmark-color="86efac"] { --bookmark-topic-color: #86efac; }
[data-bookmark-color="bfdbfe"] { --bookmark-topic-color: #bfdbfe; }
[data-bookmark-color="c7d2fe"] { --bookmark-topic-color: #c7d2fe; }
[data-bookmark-color="fecaca"] { --bookmark-topic-color: #fecaca; }
[data-bookmark-color="a7f3d0"] { --bookmark-topic-color: #a7f3d0; }
[data-bookmark-color="d9f99d"] { --bookmark-topic-color: #d9f99d; }
[data-bookmark-color="bae6fd"] { --bookmark-topic-color: #bae6fd; }
[data-bookmark-color="f5b7d2"] { --bookmark-topic-color: #f5b7d2; }
[data-bookmark-color="e9d5ff"] { --bookmark-topic-color: #e9d5ff; }
[data-bookmark-color="fdc4a8"] { --bookmark-topic-color: #fdc4a8; }
[data-bookmark-color="fda4a4"] { --bookmark-topic-color: #fda4a4; }
[data-bookmark-color="a7f3e8"] { --bookmark-topic-color: #a7f3e8; }
[data-bookmark-color="ddd6fe"] { --bookmark-topic-color: #ddd6fe; }
[data-bookmark-color="fde047"] { --bookmark-topic-color: #fde047; }
[data-bookmark-color="cbd5e1"] { --bookmark-topic-color: #cbd5e1; }
[data-bookmark-color="818cf8"] { --bookmark-topic-color: #818cf8; }
[data-bookmark-color="60a5fa"] { --bookmark-topic-color: #60a5fa; }
[data-bookmark-color="a78bfa"] { --bookmark-topic-color: #a78bfa; }
[data-bookmark-color="b7e4c7"] { --bookmark-topic-color: #b7e4c7; }
[data-bookmark-color="67d6e8"] { --bookmark-topic-color: #67d6e8; }
[data-bookmark-color="c4a7a7"] { --bookmark-topic-color: #c4a7a7; }
[data-bookmark-color="8dd3c7"] { --bookmark-topic-color: #8dd3c7; }
[data-bookmark-color="a5f3fc"] { --bookmark-topic-color: #a5f3fc; }
[data-bookmark-color="fbbf8a"] { --bookmark-topic-color: #fbbf8a; }
[data-bookmark-color="f59e9e"] { --bookmark-topic-color: #f59e9e; }
[data-bookmark-color="c084fc"] { --bookmark-topic-color: #c084fc; }
[data-bookmark-color="f0c36e"] { --bookmark-topic-color: #f0c36e; }
[data-bookmark-color="6ee7b7"] { --bookmark-topic-color: #6ee7b7; }
[data-bookmark-color="5eead4"] { --bookmark-topic-color: #5eead4; }
[data-bookmark-color="e8a0bf"] { --bookmark-topic-color: #e8a0bf; }
[data-bookmark-color="fef08a"] { --bookmark-topic-color: #fef08a; }
[data-bookmark-color="fbbf24"] { --bookmark-topic-color: #fbbf24; }
[data-bookmark-color="fbcfe8"] { --bookmark-topic-color: #fbcfe8; }
[data-bookmark-color="d6d3d1"] { --bookmark-topic-color: #d6d3d1; }

:root[dir="rtl"] {
  --safe-inline-end: var(--safe-left);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--page);
}

body {
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

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

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 68%, transparent);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.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;
}

.gate-screen {
  display: flex;
  width: min(100%, 520px);
  min-height: var(--app-height);
  margin: 0 auto;
  padding:
    calc(var(--safe-top) + 42px)
    calc(var(--safe-right) + 28px)
    calc(var(--safe-bottom) + 38px)
    calc(var(--safe-left) + 28px);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 20px;
  text-align: center;
}

.gate-screen__mark {
  width: 68px;
  height: auto;
}

.gate-screen__book {
  width: min(42vw, 170px);
  height: auto;
  filter: drop-shadow(0 18px 22px rgba(0, 0, 0, 0.22));
}

.gate-screen__copy {
  max-width: 390px;
}

.gate-screen h1 {
  margin: 4px 0 8px;
  font-size: clamp(1.65rem, 6vw, 2.2rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
}

.gate-screen p {
  margin: 0;
  color: var(--muted);
}

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid var(--separator);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.app-shell {
  --topbar-row-height: calc(var(--header-height) + var(--safe-top));
  display: grid;
  width: 100%;
  height: var(--app-height);
  min-height: 420px;
  grid-template-rows:
    var(--topbar-row-height)
    auto
    minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(circle at 98% 0%, color-mix(in srgb, var(--brand) 10%, transparent), transparent 30%),
    var(--page);
  transition: grid-template-rows 180ms ease;
}

.topbar {
  z-index: 10;
  grid-row: 1;
  display: flex;
  min-width: 0;
  padding:
    calc(var(--safe-top) + 9px)
    calc(var(--safe-right) + 16px)
    9px
    calc(var(--safe-left) + 16px);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--separator);
  background: color-mix(in srgb, var(--page) 92%, transparent);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
}

.brand__icon {
  width: 30px;
  height: 40px;
  flex: 0 0 auto;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
}

.brand__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1;
}

.brand__name {
  font-size: 0.92rem;
  font-weight: 780;
  letter-spacing: -0.025em;
}

.brand__name span {
  color: var(--brand-strong);
}

.brand__tagline {
  margin-top: 4px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.translation-chip {
  min-width: 52px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 40%, var(--separator));
  border-radius: 999px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.045em;
}

.translation-chip__full {
  display: none;
}

:root[data-telegram-fullscreen="true"] .app-shell {
  --topbar-row-height: calc(
    var(--device-safe-top) + var(--fullscreen-topbar-height)
  );
}

:root[data-telegram-fullscreen="true"]
  .app-shell.is-header-condensed {
  --topbar-row-height: calc(var(--device-safe-top) + 36px);
}

:root[data-telegram-fullscreen="true"]
  .app-shell
  .topbar {
  display: grid;
  padding:
    calc(var(--device-safe-top) + 4px)
    calc(
      var(--fullscreen-control-safe-inline) +
        var(--fullscreen-control-clearance)
    )
    0
    calc(
      var(--fullscreen-control-safe-inline) +
        var(--fullscreen-control-clearance)
    );
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 28px var(--fullscreen-control-height);
  align-content: start;
  justify-items: center;
  gap: 2px;
  border-bottom-color: transparent;
  background: transparent;
  backdrop-filter: none;
  transition:
    padding 180ms ease,
    grid-template-rows 180ms ease,
    gap 180ms ease;
}

:root[data-telegram-fullscreen="true"]
  .app-shell
  .brand {
  grid-row: 1;
  justify-content: center;
  opacity: 1;
  transform: translateY(0) scale(1);
  transform-origin: center top;
  transition:
    opacity 120ms ease,
    transform 180ms ease,
    visibility 0s linear;
}

:root[data-telegram-fullscreen="true"]
  .app-shell
  .brand__icon {
  width: 21px;
  height: 28px;
}

:root[data-telegram-fullscreen="true"]
  .app-shell
  .brand__copy {
  display: none;
}

:root[data-telegram-fullscreen="true"]
  .app-shell
  .translation-chip {
  position: relative;
  grid-row: 2;
  display: grid;
  width: fit-content;
  min-width: 52px;
  min-inline-size: 52px;
  max-width: min(100%, var(--fullscreen-translation-max-width));
  max-inline-size: min(100%, var(--fullscreen-translation-max-width));
  min-height: var(--fullscreen-control-height);
  height: var(--fullscreen-control-height);
  padding: 0 clamp(10px, 2.5vw, 14px);
  overflow: visible;
  border: 0;
  color: var(--text);
  background: color-mix(in srgb, var(--text) 16%, transparent);
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--page) 20%, transparent) inset,
    0 2px 10px rgba(0, 0, 0, 0.12);
  font-size: 0.72rem;
  font-weight: 640;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  appearance: none;
  place-items: center;
  backdrop-filter: blur(18px);
}

:root[data-telegram-fullscreen="true"]
  .app-shell
  .translation-chip::before {
  position: absolute;
  inset-block: calc(
    (var(--fullscreen-control-height) - var(--fullscreen-control-hit-size)) / 2
  );
  inset-inline: 0;
  content: "";
}

:root[data-telegram-fullscreen="true"]
  .app-shell
  .translation-chip__short {
  display: none;
}

:root[data-telegram-fullscreen="true"]
  .app-shell
  .translation-chip__full {
  display: block;
  min-width: 0;
  max-width: 100%;
  max-inline-size: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

:root[data-telegram-fullscreen="true"]
  .app-shell.is-header-condensed
  .topbar {
  grid-template-rows: 0 var(--fullscreen-control-height);
  gap: 0;
}

:root[data-telegram-fullscreen="true"]
  .app-shell.is-header-condensed
  .brand {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.82);
  transition:
    opacity 120ms ease,
    transform 180ms ease,
    visibility 0s linear 180ms;
}

.app-shell:is(
    [data-active-route="home"],
    [data-active-route="history"],
    [data-active-route="selection"],
    [data-active-route="bookmarks"]
  ) .topbar {
  justify-content: center;
}

.app-shell:is(
    [data-active-route="home"],
    [data-active-route="history"],
    [data-active-route="selection"],
    [data-active-route="bookmarks"]
  ) .brand {
  justify-content: center;
}

.app-shell:is(
    [data-active-route="home"],
    [data-active-route="history"],
    [data-active-route="selection"],
    [data-active-route="bookmarks"]
  ) .brand__copy,
.app-shell:is(
    [data-active-route="home"],
    [data-active-route="history"],
    [data-active-route="selection"],
    [data-active-route="bookmarks"]
  ) .translation-chip {
  display: none;
}

:root[data-telegram-fullscreen="true"]
  .app-shell:is(
    [data-active-route="home"],
    [data-active-route="history"],
    [data-active-route="selection"],
    [data-active-route="bookmarks"]
  ) {
  --topbar-row-height: max(
    calc(var(--device-safe-top) + 36px),
    calc(var(--safe-top) + 4px)
  );
}

:root[data-telegram-fullscreen="true"]
  .app-shell:is(
    [data-active-route="home"],
    [data-active-route="history"],
    [data-active-route="selection"],
    [data-active-route="bookmarks"]
  )
  .topbar {
  grid-template-rows: 28px;
  gap: 0;
}

:root[data-telegram-fullscreen="true"]
  .app-shell:is(
    [data-active-route="home"],
    [data-active-route="history"],
    [data-active-route="selection"],
    [data-active-route="bookmarks"]
  )
  .translation-chip {
  display: none;
}

:root[data-telegram-fullscreen="true"]
  .app-shell.is-header-condensed:is(
    [data-active-route="home"],
    [data-active-route="history"],
    [data-active-route="selection"],
    [data-active-route="bookmarks"]
  )
  .brand {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

/* Keep the History route explicit for older clients and static guarantees. */
.app-shell[data-active-route="history"] .translation-chip {
  display: none;
}

:root[data-telegram-fullscreen="true"]
  .app-shell[data-active-route="history"] {
  --topbar-row-height: max(
    calc(var(--device-safe-top) + 36px),
    calc(var(--safe-top) + 4px)
  );
}

.connection-banner {
  z-index: 9;
  grid-row: 2;
  padding: 7px 16px;
  border-bottom: 1px solid color-mix(in srgb, #d99029 35%, transparent);
  color: #5f3907;
  background: #fff1d8;
  font-size: 0.78rem;
  font-weight: 640;
  text-align: center;
}

:root[data-theme="dark"] .connection-banner {
  color: #ffdfa7;
  background: #4d3412;
}

.workspace {
  grid-row: 3;
  min-height: 0;
  overflow: hidden;
}

.view {
  width: min(100%, var(--content-width));
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding:
    22px
    calc(var(--safe-right) + 16px)
    calc(var(--safe-bottom) + var(--nav-height) + var(--nav-handle-height) + 24px)
    calc(var(--safe-left) + 16px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--separator) transparent;
}

.view--home {
  padding-top: 16px;
}

.home-hero {
  position: relative;
  display: flex;
  min-height: clamp(330px, 53vh, 480px);
  padding: 20px;
  justify-content: space-between;
  flex-direction: column;
  border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  border-radius: 24px;
  color: #13252e;
  background:
    radial-gradient(ellipse at 52% 10%, rgba(255, 252, 225, 0.95), transparent 28%),
    linear-gradient(175deg, #b8ced3 0%, #edf0e8 42%, #8fa3a6 43%, #a6a79a 63%, #bda878 100%);
  box-shadow: 0 16px 38px rgba(22, 48, 60, 0.13);
  isolation: isolate;
  overflow: hidden;
}

.home-hero.has-image {
  background-image:
    linear-gradient(180deg, rgba(11, 24, 31, 0.08) 28%, rgba(8, 22, 29, 0.76) 100%),
    url("./assets/ocean-light-hero.webp");
  background-position: center;
  background-size: cover;
  color: #ffffff;
}

.home-hero::before {
  position: absolute;
  z-index: -1;
  inset: 40% 0 0;
  background:
    linear-gradient(180deg, rgba(255, 240, 195, 0.04), rgba(76, 74, 64, 0.32)),
    repeating-linear-gradient(
      178deg,
      transparent 0,
      transparent 9px,
      rgba(255, 255, 255, 0.08) 10px,
      transparent 11px
    );
  content: "";
}

.home-hero.has-image::before {
  background: linear-gradient(180deg, transparent, rgba(8, 22, 29, 0.2));
}

.home-hero__light {
  position: absolute;
  z-index: -1;
  top: -28%;
  left: 31%;
  width: 42%;
  height: 92%;
  background: linear-gradient(
    172deg,
    rgba(255, 255, 235, 0.72),
    rgba(255, 240, 184, 0.08) 82%,
    transparent
  );
  clip-path: polygon(38% 0, 72% 0, 100% 100%, 0 100%);
  filter: blur(5px);
  opacity: 0.8;
}

.home-hero.has-image .home-hero__light {
  display: none;
}

.home-hero__brand {
  display: flex;
  width: fit-content;
  padding: 8px 11px 8px 8px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 14px;
  color: #25353d;
  background: rgba(250, 252, 249, 0.7);
  box-shadow: 0 7px 20px rgba(24, 42, 50, 0.08);
  backdrop-filter: blur(12px);
}

.home-hero__brand img {
  width: 42px;
  height: auto;
}

.home-hero__brand > span {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.home-hero__brand strong {
  font-size: 0.8rem;
  font-weight: 820;
  letter-spacing: -0.02em;
}

.home-hero__brand strong span {
  color: #287fa5;
}

.home-hero__brand small {
  margin-top: 4px;
  color: #4f5b61;
  font-size: 0.56rem;
  font-weight: 560;
}

.home-hero__copy {
  width: min(100%, 520px);
  padding: 19px 18px 17px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background: rgba(246, 249, 247, 0.7);
  box-shadow: 0 12px 34px rgba(11, 26, 33, 0.12);
  backdrop-filter: blur(14px);
}

.has-image .home-hero__copy {
  background: rgba(11, 27, 35, 0.52);
}

.home-hero__copy .eyebrow {
  color: #287fa5 !important;
}

.has-image .home-hero__copy .eyebrow {
  color: #9ed9f1 !important;
}

.home-hero__copy h1 {
  max-width: 450px;
  margin: 0;
  font-size: clamp(1.75rem, 7.5vw, 2.7rem);
  line-height: 1.03;
  letter-spacing: -0.052em;
}

.home-hero__copy p:last-child {
  max-width: 450px;
  margin: 9px 0 0;
  color: #3c4b52;
  font-size: 0.88rem;
  line-height: 1.45;
}

.has-image .home-hero__copy p:last-child {
  color: rgba(255, 255, 255, 0.83);
}

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

.home-actions > :last-child:nth-child(odd) {
  grid-column: 1 / -1;
}

.home-action {
  display: grid;
  min-height: 74px;
  padding: 11px 13px;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--separator);
  border-radius: 16px;
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: 0 6px 20px rgba(20, 37, 48, 0.035);
  text-align: left;
}

.home-action__icon {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  font-size: 1.25rem;
  font-weight: 720;
}

.home-action strong,
.home-action small {
  display: block;
}

.home-action strong {
  font-size: 0.83rem;
}

.home-action small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.67rem;
}

.home-action > span:last-child {
  color: var(--hint);
  font-size: 1.35rem;
}

.home-summaries {
  display: grid;
  margin-top: 10px;
  gap: 8px;
}

.home-summary,
.home-selection {
  display: flex;
  min-height: 58px;
  padding: 9px 10px 9px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 38%, var(--separator));
  border-radius: 15px;
  background: var(--brand-soft);
}

.home-summary--bookmarks {
  border-color: color-mix(in srgb, #a78bfa 38%, var(--separator));
  background: color-mix(in srgb, #a78bfa 12%, var(--surface-raised));
}

.home-summary > div {
  min-width: 0;
}

.home-summary strong,
.home-summary span,
.home-selection strong,
.home-selection span {
  display: block;
}

.home-summary strong,
.home-selection strong {
  font-size: 0.79rem;
}

.home-summary span,
.home-selection span {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.67rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-summary button,
.home-selection button {
  flex: 0 0 auto;
  min-height: 40px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  color: var(--button-text);
  background: var(--button);
  font-size: 0.74rem;
  font-weight: 720;
}

.view__intro {
  margin-bottom: 18px;
}

.view__intro--compact {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--brand-strong) !important;
  font-size: 0.7rem;
  font-weight: 780;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.view h1,
.selection-heading h1 {
  margin: 0;
  font-size: clamp(1.55rem, 6vw, 2.1rem);
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.view__intro > p:last-child,
.selection-heading p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.91rem;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.search-box {
  display: flex;
  min-width: 0;
  min-height: 52px;
  align-items: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--separator);
  border-radius: 15px;
  background: var(--surface-raised);
  box-shadow: 0 7px 24px rgba(20, 37, 48, 0.05);
}

.search-box:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.search-box__icon {
  color: var(--brand-strong);
  font-size: 1.45rem;
  line-height: 1;
  transform: rotate(-18deg);
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 1rem;
}

.search-box input::placeholder {
  color: var(--hint);
}

.button {
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 13px;
  font-size: 0.91rem;
  font-weight: 720;
  transition:
    transform 120ms ease,
    filter 120ms ease,
    opacity 120ms ease;
}

.button:active:not(:disabled) {
  transform: scale(0.98);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.button--primary {
  color: var(--button-text);
  background: var(--button);
  box-shadow: 0 8px 20px color-mix(in srgb, var(--button) 22%, transparent);
}

.button--primary:hover:not(:disabled) {
  filter: brightness(1.04);
}

.button--secondary {
  border: 1px solid var(--separator);
  color: var(--text);
  background: var(--surface-raised);
}

.search-form__submit {
  min-height: 52px;
}

.toolbar {
  display: flex;
  margin: 11px 0 16px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.filter-button,
.text-button,
.icon-button {
  border: 0;
  color: var(--link);
  background: transparent;
}

.filter-button {
  display: flex;
  min-height: 44px;
  padding: 0 5px;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 690;
}

.filter-button > span:first-child {
  font-size: 1.12rem;
}

.filter-button__count {
  display: grid;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  place-items: center;
  border-radius: 999px;
  color: var(--button-text);
  background: var(--button);
  font-size: 0.68rem;
}

.text-button {
  min-height: 40px;
  padding: 4px 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.text-button--danger {
  color: var(--destructive);
}

.select-control {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.select-control > span,
.field-control > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 690;
}

.select-control select,
.field-control input {
  width: 100%;
  min-height: 48px;
  padding: 0 36px 0 13px;
  border: 1px solid var(--separator);
  border-radius: 12px;
  color: var(--text);
  background: var(--surface-raised);
}

.select-control select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--hint) 50%),
    linear-gradient(135deg, var(--hint) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-repeat: no-repeat;
  background-size: 5px 5px;
}

.select-control select:disabled {
  color: var(--hint);
  opacity: 0.7;
}

.select-control--compact select {
  min-height: 42px;
  padding-left: 10px;
  border-color: transparent;
  background-color: transparent;
  font-size: 0.8rem;
  font-weight: 650;
}

.result-summary,
.chapter-heading {
  display: flex;
  min-height: 47px;
  margin: 0 0 8px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.result-summary strong {
  display: block;
  font-size: 0.9rem;
}

.result-summary span {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.74rem;
}

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

.verse-result {
  display: grid;
}

.verse-context {
  min-height: 36px;
  margin: 2px 5px 0 auto;
  padding: 3px 8px;
  border: 0;
  border-radius: 9px;
  color: var(--link);
  background: transparent;
  font-size: 0.72rem;
  font-weight: 700;
}

.verse-context:hover,
.verse-context:focus-visible {
  background: var(--brand-soft);
}

.verse-card {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 76px;
  padding: 15px 46px 15px 16px;
  border: 1px solid var(--separator);
  border-radius: 16px;
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: 0 6px 20px rgba(20, 37, 48, 0.035);
  text-align: left;
  transition:
    transform 120ms ease,
    border-color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.verse-card::after {
  position: absolute;
  top: 16px;
  right: 15px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1.5px solid color-mix(in srgb, var(--hint) 60%, transparent);
  border-radius: 50%;
  color: transparent;
  content: "✓";
  font-size: 0.78rem;
  font-weight: 850;
}

.verse-card:hover {
  border-color: color-mix(in srgb, var(--brand) 54%, var(--separator));
}

.verse-card:active {
  transform: scale(0.992);
}

.verse-card.is-selected {
  border-color: var(--brand);
  background:
    linear-gradient(var(--brand-soft), var(--brand-soft)),
    var(--surface-raised);
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--brand) 14%, transparent),
    0 7px 22px rgba(20, 37, 48, 0.05);
}

.verse-card.is-selected::after {
  border-color: var(--button);
  color: var(--button-text);
  background: var(--button);
}

.verse-card__reference {
  display: flex;
  margin-bottom: 8px;
  align-items: center;
  gap: 8px;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 760;
  letter-spacing: 0.01em;
}

.verse-card__translation {
  padding: 2px 6px;
  border-radius: 6px;
  color: var(--muted);
  background: color-mix(in srgb, var(--separator) 65%, transparent);
  font-size: 0.61rem;
  letter-spacing: 0.055em;
}

.verse-card__text {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.04rem;
  line-height: 1.53;
  overflow-wrap: anywhere;
}

.verse-card mark {
  padding: 0 2px;
  border-radius: 3px;
  color: inherit;
  background: color-mix(in srgb, #f0c84d 36%, transparent);
}

.state-panel {
  min-height: 126px;
  padding: 23px 19px;
  border: 1px dashed color-mix(in srgb, var(--separator) 85%, transparent);
  border-radius: 16px;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface) 68%, transparent);
  text-align: center;
}

.state-panel__icon {
  display: grid;
  width: 39px;
  height: 39px;
  margin: 0 auto 10px;
  place-items: center;
  border-radius: 12px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  font-size: 1.15rem;
  font-weight: 760;
}

.state-panel h2 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 0.95rem;
}

.state-panel p {
  margin: 0 auto;
  max-width: 410px;
  font-size: 0.82rem;
}

.state-panel .button {
  margin-top: 15px;
}

.skeleton-card {
  min-height: 118px;
  border: 1px solid var(--separator);
  border-radius: 16px;
  background: var(--surface-raised);
  overflow: hidden;
}

.skeleton-card::before {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 118px;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, var(--brand) 10%, transparent),
    transparent
  );
  content: "";
  animation: shimmer 1.35s ease-in-out infinite;
  transform: translateX(-100%);
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

/*
 * Long result lists grow while the reader scrolls; a card that is far off
 * screen keeps its place but is not laid out or painted until it is near.
 */
#search-results > .verse-result {
  content-visibility: auto;
  contain-intrinsic-size: auto 132px;
}

.search-more {
  display: grid;
  min-height: 72px;
  margin-top: 4px;
  padding: 16px 12px 4px;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.search-more__spinner {
  width: 22px;
  height: 22px;
  border-width: 2px;
}

.search-more__line,
.search-more__title {
  margin: 0;
}

.search-more__title {
  color: var(--text);
  font-weight: 650;
}

.search-more__button {
  width: 100%;
  margin-top: 4px;
}

.view--reader {
  padding:
    0
    0
    calc(var(--safe-bottom) + var(--nav-height) + var(--nav-handle-height) + 24px);
}

.reader-toolbar {
  position: sticky;
  z-index: 7;
  top: 0;
  display: grid;
  min-height: 48px;
  padding:
    4px
    calc(var(--safe-right) + 6px)
    4px
    calc(var(--safe-left) + 6px);
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  align-items: center;
  border-bottom: 1px solid var(--separator);
  background: var(--page);
  backdrop-filter: blur(18px);
  transition:
    transform 180ms ease,
    opacity 160ms ease;
}

.reader-toolbar.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-110%);
}

.reader-toolbar__arrow {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--brand-strong);
  background: transparent;
  font-size: 1.75rem;
  line-height: 1;
}

.reader-toolbar__arrow:hover:not(:disabled),
.reader-toolbar__arrow:focus-visible {
  background: var(--brand-soft);
}

.reader-toolbar__arrow:disabled {
  color: var(--hint);
  cursor: default;
  opacity: 0.38;
}

.reader-toolbar__passage {
  min-width: 0;
  min-height: 40px;
  padding: 3px 8px;
  border: 0;
  border-radius: 11px;
  color: var(--text);
  background: transparent;
  text-align: center;
}

.reader-toolbar__passage:hover,
.reader-toolbar__passage:focus-visible {
  background: var(--brand-soft);
}

.reader-toolbar__passage strong,
.reader-toolbar__passage > span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reader-toolbar__passage strong {
  font-size: 0.93rem;
  line-height: 1.1;
}

.reader-toolbar__passage > span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 650;
}

.reader-return {
  display: flex;
  min-height: 38px;
  margin: 8px calc(var(--safe-right) + 10px) 2px calc(var(--safe-left) + 10px);
  padding: 4px 8px;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 10px;
  color: var(--link);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 690;
}

.reader-return:hover,
.reader-return:focus-visible {
  background: var(--brand-soft);
}

.view--reader > .state-panel {
  margin: 14px calc(var(--safe-right) + 16px) 0 calc(var(--safe-left) + 16px);
}

.reader-scripture {
  width: 100%;
  padding: 10px var(--safe-right) 2px var(--safe-left);
}

.reader-scripture .skeleton-card {
  margin: 10px calc(var(--safe-right) + 12px) 0 calc(var(--safe-left) + 12px);
}

.reader-verse-row {
  position: relative;
  isolation: isolate;
}

.reader-verse-row.has-bookmark-popover {
  z-index: 8;
}

.reader-verse {
  display: grid;
  width: 100%;
  min-height: 44px;
  padding: 4px 12px 4px 5px;
  grid-template-columns: 31px minmax(0, 1fr);
  align-items: start;
  border: 0;
  border-radius: 0;
  color: var(--text);
  background: transparent;
  text-align: start;
  transition:
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.reader-verse:hover {
  background: color-mix(in srgb, var(--brand-soft) 58%, transparent);
}

.reader-verse__number {
  display: grid;
  width: 26px;
  min-height: 30px;
  place-items: start center;
  padding-top: 4px;
  border-radius: 9px;
  color: var(--brand-strong);
  font-size: 0.7rem;
  font-weight: 780;
  line-height: 1;
}

.reader-verse__text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.03rem, 3.8vw, 1.12rem);
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.reader-verse mark {
  padding: 0 2px;
  border-radius: 3px;
  color: inherit;
  background: color-mix(in srgb, #f0c84d 36%, transparent);
}

.reader-verse.is-selected {
  background: var(--brand-soft);
}

.reader-verse.is-selected .reader-verse__number {
  color: var(--button-text);
  background: var(--button);
}

.reader-verse.is-selection-start {
  border-radius: 13px 13px 0 0;
}

.reader-verse.is-selection-end {
  border-radius: 0 0 13px 13px;
}

.reader-verse.is-selection-start.is-selection-end {
  border-radius: 13px;
}

.reader-verse.is-focused {
  box-shadow: inset 3px 0 0 var(--brand-strong);
  background: color-mix(in srgb, var(--brand-soft) 72%, transparent);
}

.reader-verse-row.has-bookmark-trigger .reader-verse {
  padding-inline-end: 40px;
}

.reader-verse-row[data-bookmark-color] .reader-verse {
  background: color-mix(
    in srgb,
    var(--bookmark-topic-color) 27%,
    transparent
  );
  box-shadow: inset 3px 0 0 var(--bookmark-topic-color);
}

:root[dir="rtl"] .reader-verse-row[data-bookmark-color] .reader-verse {
  box-shadow: inset -3px 0 0 var(--bookmark-topic-color);
}

.reader-verse-row[data-bookmark-color] .reader-verse__number {
  color: color-mix(in srgb, var(--text) 78%, #000000);
  background: color-mix(
    in srgb,
    var(--bookmark-topic-color) 76%,
    var(--surface-raised)
  );
}

.reader-verse-row[data-bookmark-color] .reader-verse.is-selected {
  background:
    linear-gradient(
      color-mix(in srgb, var(--bookmark-topic-color) 31%, transparent),
      color-mix(in srgb, var(--bookmark-topic-color) 31%, transparent)
    ),
    var(--brand-soft);
}

.reader-verse-row[data-bookmark-color] .reader-verse.is-selected .reader-verse__number {
  color: var(--bookmark-topic-foreground);
  background: var(--bookmark-topic-color);
}

.reader-bookmark-trigger {
  position: absolute;
  z-index: 3;
  inset-block-end: 4px;
  inset-inline-end: 7px;
  display: grid;
  width: 30px;
  height: 24px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 8px;
  color: color-mix(in srgb, var(--bookmark-topic-color) 72%, var(--text));
  background: color-mix(in srgb, var(--surface-raised) 70%, transparent);
  box-shadow: none;
  font-size: 0.62rem;
  font-weight: 850;
  letter-spacing: 0.09em;
  line-height: 0.7;
}

.reader-bookmark-trigger::before {
  position: absolute;
  inset: -10px -7px;
  border-radius: 13px;
  content: "";
}

.reader-bookmark-trigger:hover,
.reader-bookmark-trigger:focus-visible,
.reader-bookmark-trigger[aria-expanded="true"] {
  color: var(--bookmark-topic-foreground);
  background: var(--bookmark-topic-color);
}

.bookmark-popover {
  position: absolute;
  z-index: 12;
  inset-inline-start: max(8px, var(--safe-left));
  width: min(
    calc(100% - max(16px, var(--safe-left)) - max(8px, var(--safe-right))),
    560px
  );
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--brand) 26%, var(--separator));
  border-radius: 16px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-raised) 97%, transparent);
  box-shadow: 0 18px 44px rgba(5, 18, 25, 0.24);
  backdrop-filter: blur(20px);
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: bookmark-popover-in 150ms ease-out;
}

.bookmark-popover[data-available-height="large"] { max-height: 360px; }
.bookmark-popover[data-available-height="medium"] { max-height: 280px; }
.bookmark-popover[data-available-height="compact"] { max-height: 200px; }
.bookmark-popover[data-available-height="tight"] { max-height: 120px; }

.bookmark-popover[data-placement="above"] {
  bottom: calc(100% + 9px);
  transform-origin: bottom center;
}

.bookmark-popover[data-placement="below"] {
  top: calc(100% + 9px);
  transform-origin: top center;
}

.bookmark-popover::after {
  position: absolute;
  inset-inline-end: 19px;
  width: 12px;
  height: 12px;
  border-right: 1px solid color-mix(in srgb, var(--brand) 26%, var(--separator));
  border-bottom: 1px solid color-mix(in srgb, var(--brand) 26%, var(--separator));
  background: var(--surface-raised);
  content: "";
}

.bookmark-popover[data-placement="above"]::after {
  bottom: -7px;
  transform: rotate(45deg);
}

.bookmark-popover[data-placement="below"]::after {
  top: -7px;
  transform: rotate(225deg);
}

.bookmark-popover__context {
  display: flex;
  min-width: 0;
  padding: 1px 5px 8px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
}

.bookmark-popover__context strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-popover__icon {
  color: var(--brand-strong);
  font-size: 1rem;
}

.bookmark-popover__actions {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: stretch;
  gap: 6px;
}

.bookmark-assigned-topic__open,
.bookmark-assigned-topic__remove,
.bookmark-popover__close,
.bookmark-topic-picker select {
  min-height: 44px;
  border: 1px solid var(--separator);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface);
  font-size: 0.75rem;
  font-weight: 700;
}

.bookmark-assigned-topics {
  display: grid;
  min-width: 0;
  max-height: min(40vh, 260px);
  grid-column: 1 / -1;
  gap: 5px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.bookmark-assigned-topic {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 44px;
}

.bookmark-assigned-topic__open {
  display: flex;
  min-width: 0;
  padding: 0 11px;
  align-items: center;
  gap: 8px;
  border-radius: 11px 0 0 11px;
  text-align: start;
}

.bookmark-assigned-topic__open > span:nth-child(2) {
  overflow: hidden;
  flex: 1 1 auto;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-assigned-topic__global {
  display: grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border-radius: 7px;
  color: color-mix(in srgb, var(--bookmark-topic-color) 76%, var(--text));
  background: color-mix(in srgb, var(--bookmark-topic-color) 16%, transparent);
  font-size: 0.64rem;
  font-weight: 850;
}

.bookmark-assigned-topic__remove {
  display: grid;
  width: 44px;
  padding: 0;
  place-items: center;
  border-inline-start: 0;
  border-radius: 0 11px 11px 0;
  color: var(--destructive);
  font-size: 1.05rem;
}

:root[dir="rtl"] .bookmark-assigned-topic__open {
  border-radius: 0 11px 11px 0;
}

:root[dir="rtl"] .bookmark-assigned-topic__remove {
  border-radius: 11px 0 0 11px;
}

.bookmark-topic-picker {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.bookmark-topic-picker label {
  display: block;
  min-width: 0;
}

.bookmark-topic-picker select {
  width: 100%;
  padding: 0 30px 0 10px;
  color: var(--link);
}

.bookmark-topic-picker select:disabled {
  color: var(--muted);
  cursor: default;
}

.bookmark-topic-picker__clear {
  min-height: 32px;
  padding: 3px 7px;
  justify-self: end;
  border: 0;
  border-radius: 8px;
  color: var(--link);
  background: transparent;
  font-size: 0.68rem;
  font-weight: 690;
}

.bookmark-topic-picker__clear:hover,
.bookmark-topic-picker__clear:focus-visible {
  background: var(--brand-soft);
}

.bookmark-popover__close {
  display: grid;
  width: 44px;
  padding: 0;
  place-items: center;
  color: var(--muted);
  font-size: 1.35rem;
  font-weight: 400;
  align-self: start;
}

.bookmark-assigned-topic__open:hover,
.bookmark-assigned-topic__open:focus-visible,
.bookmark-assigned-topic__remove:hover,
.bookmark-assigned-topic__remove:focus-visible,
.bookmark-popover__close:hover,
.bookmark-popover__close:focus-visible,
.bookmark-topic-picker select:hover,
.bookmark-topic-picker select:focus-visible {
  background: var(--brand-soft);
}

@keyframes bookmark-popover-in {
  from {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
}

.reader-continue {
  display: block;
  width: calc(100% - var(--safe-left) - var(--safe-right) - 24px);
  min-height: 48px;
  margin: 18px calc(var(--safe-right) + 12px) 0 calc(var(--safe-left) + 12px);
  padding: 0 14px;
  border: 1px solid var(--separator);
  border-radius: 13px;
  color: var(--link);
  background: var(--surface-raised);
  font-size: 0.84rem;
  font-weight: 720;
}

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

.selection-heading > div {
  min-width: 0;
}

.empty-selection {
  display: flex;
  min-height: 320px;
  padding: 28px 22px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px dashed var(--separator);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  text-align: center;
}

.empty-selection__icon {
  display: grid;
  width: 50px;
  height: 50px;
  margin-bottom: 15px;
  place-items: center;
  border-radius: 16px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  font-size: 1.25rem;
  font-weight: 850;
}

.empty-selection h2 {
  max-width: 310px;
  margin: 0 0 8px;
  font-size: 1.06rem;
}

.empty-selection p {
  max-width: 330px;
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.86rem;
}

.selection-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 9px;
  list-style: none;
}

.selection-item {
  display: grid;
  min-width: 0;
  padding: 13px;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--separator);
  border-radius: 14px;
  background: var(--surface-raised);
}

.selection-item__number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 10px;
  color: var(--brand-ink);
  background: var(--brand-soft);
  font-size: 0.75rem;
  font-weight: 780;
}

.selection-item__copy {
  min-width: 0;
}

.selection-item__copy strong {
  display: block;
  color: var(--brand-strong);
  font-size: 0.78rem;
}

.selection-item__copy p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.82rem;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.selection-item__actions {
  display: grid;
  grid-template-columns: repeat(4, 38px);
  gap: 3px;
}

.selection-action {
  display: grid;
  width: 38px;
  height: 38px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  font-size: 1rem;
}

.selection-action:hover {
  background: var(--brand-soft);
}

.selection-action--remove {
  color: var(--destructive);
}

.selection-action:disabled {
  opacity: 0.28;
}

.bookmarks-heading {
  margin-bottom: 16px;
}

.bookmark-storage-warning {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, #d99029 36%, var(--separator));
  border-radius: 12px;
  color: color-mix(in srgb, #8b560e 82%, var(--text));
  background: color-mix(in srgb, #fff1d8 72%, var(--surface-raised));
  font-size: 0.76rem;
  font-weight: 620;
}

:root[data-theme="dark"] .bookmark-storage-warning {
  color: #ffdfa7;
  background: color-mix(in srgb, #4d3412 74%, var(--surface-raised));
}

.bookmark-search {
  display: grid;
  margin-bottom: 12px;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 690;
}

.bookmark-search input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--separator);
  border-radius: 13px;
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: 0 6px 20px rgba(20, 37, 48, 0.035);
}

.bookmark-search input::placeholder {
  color: var(--hint);
}

.bookmark-search input:focus {
  border-color: var(--brand);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 14%, transparent);
}

.bookmark-group-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 9px;
}

.bookmark-group-card {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 68px;
  padding: 10px 12px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid color-mix(
    in srgb,
    var(--bookmark-topic-color) 44%,
    var(--separator)
  );
  border-radius: 14px;
  color: var(--text);
  background:
    linear-gradient(
      color-mix(in srgb, var(--bookmark-topic-color) 11%, transparent),
      color-mix(in srgb, var(--bookmark-topic-color) 11%, transparent)
    ),
    var(--surface-raised);
  box-shadow: 0 6px 20px rgba(20, 37, 48, 0.035);
  text-align: start;
  transition:
    transform 120ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.bookmark-group-card:hover,
.bookmark-group-card:focus-visible {
  border-color: var(--bookmark-topic-color);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--bookmark-topic-color) 14%, transparent);
}

.bookmark-group-card:active {
  transform: scale(0.99);
}

.bookmark-dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, var(--bookmark-topic-color) 64%, var(--text));
  border-radius: 50%;
  background: var(--bookmark-topic-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bookmark-topic-color) 19%, transparent);
}

.bookmark-group-card > .bookmark-dot {
  width: 20px;
  height: 20px;
  justify-self: center;
}

.bookmark-group-card__copy {
  min-width: 0;
}

.bookmark-group-card__name > strong,
.bookmark-group-card__count,
.bookmark-group-card__copy > small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-group-card__name > strong {
  min-width: 0;
  font-size: 0.8rem;
}

.bookmark-group-card__copy > small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
}

.bookmark-group-card__count {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
}

.bookmark-group-card__name {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.bookmark-group-card > span:last-child {
  color: var(--hint);
  font-size: 1.25rem;
  line-height: 1;
}

.bookmark-empty-copy {
  margin: 20px 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.bookmark-disclosure {
  margin-bottom: 12px;
  border: 1px solid var(--separator);
  border-radius: 15px;
  background: var(--surface-raised);
  overflow: hidden;
}

.bookmark-disclosure[hidden] {
  display: none;
}

.bookmark-disclosure > summary {
  display: flex;
  min-height: 50px;
  padding: 9px 14px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--link);
  font-size: 0.79rem;
  font-weight: 720;
  list-style: none;
}

.bookmark-disclosure > summary::-webkit-details-marker {
  display: none;
}

.bookmark-disclosure > summary::after {
  color: var(--hint);
  content: "⌄";
  font-size: 1rem;
  transition: transform 160ms ease;
}

.bookmark-disclosure[open] > summary::after {
  transform: rotate(180deg);
}

.bookmark-disclosure > summary:hover,
.bookmark-disclosure > summary:focus-visible {
  background: var(--brand-soft);
}

.bookmark-contribution-manager {
  border-color: color-mix(in srgb, var(--brand) 32%, var(--separator));
}

.bookmark-contribution-manager__body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--separator);
}

.bookmark-contribution-manager__guidance {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-inline-start: 3px solid var(--brand);
  border-radius: 8px;
  color: var(--muted);
  background: var(--brand-soft);
  font-size: 0.7rem;
  line-height: 1.45;
}

.bookmark-topic-add {
  --bookmark-topic-color: var(--brand);
  min-width: 0;
  min-height: 68px;
  border: 1px dashed color-mix(in srgb, var(--brand) 56%, var(--separator));
  border-radius: 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--brand-soft) 34%, var(--surface-raised));
  overflow: hidden;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.bookmark-topic-add[open] {
  grid-column: 1 / -1;
}

.bookmark-topic-add > summary {
  display: grid;
  min-height: 66px;
  padding: 10px 12px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  color: var(--link);
  font-size: 0.8rem;
  list-style: none;
  cursor: pointer;
}

.bookmark-topic-add > summary::-webkit-details-marker {
  display: none;
}

.bookmark-topic-add > summary::after {
  color: var(--hint);
  content: "›";
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 160ms ease;
}

.bookmark-topic-add[open] > summary::after {
  transform: rotate(90deg);
}

.bookmark-topic-add:hover,
.bookmark-topic-add:focus-within {
  border-color: var(--brand);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--brand) 12%, transparent);
}

.bookmark-topic-add__icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  justify-self: center;
  border: 1px solid color-mix(in srgb, var(--brand) 48%, var(--separator));
  border-radius: 50%;
  color: var(--brand-strong);
  background: var(--brand-soft);
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1;
}

.bookmark-topic-form {
  display: grid;
  padding: 14px;
  grid-template-columns: minmax(0, 1.25fr) minmax(120px, 0.75fr) auto;
  align-items: end;
  gap: 9px;
  border-top: 1px solid var(--separator);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}

.bookmark-topic-form label {
  display: grid;
  min-width: 0;
  gap: 5px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 690;
}

.bookmark-topic-form input,
.bookmark-topic-form select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 11px;
  border: 1px solid var(--separator);
  border-radius: 11px;
  color: var(--text);
  background: var(--surface-raised);
}

.bookmark-topic-form .button {
  min-height: 44px;
}

.contributor-sync {
  display: grid;
  margin: 10px 0 0;
  padding: 11px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--brand) 24%, var(--separator));
  border-radius: 12px;
  background: color-mix(in srgb, var(--brand-soft) 62%, var(--surface));
}

.contributor-sync[hidden] {
  display: none;
}

.contributor-sync[data-state="success"] {
  border-color: color-mix(in srgb, #16a34a 38%, var(--separator));
}

.contributor-sync[data-state="error"] {
  border-color: color-mix(in srgb, var(--destructive) 42%, var(--separator));
}

.contributor-sync__copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.contributor-sync__copy h3,
.contributor-sync__copy p {
  margin: 0;
}

.contributor-sync__copy h3 {
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 760;
}

.contributor-sync__copy p {
  color: var(--muted);
  font-size: 0.69rem;
  line-height: 1.42;
}

.contributor-sync__copy .contributor-sync__details {
  color: var(--text);
  font-size: 0.65rem;
  font-weight: 690;
}

.contributor-sync__button {
  min-height: 44px;
  white-space: nowrap;
}

.bookmark-contribution-badge {
  display: inline-grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--bookmark-topic-color) 38%, transparent);
  border-radius: 7px;
  color: color-mix(in srgb, var(--bookmark-topic-color) 72%, var(--text));
  background: color-mix(in srgb, var(--bookmark-topic-color) 14%, transparent);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0;
  line-height: 1;
  margin: 0;
  overflow: visible;
  text-align: center;
}

.bookmark-group-card__copy .bookmark-contribution-badge {
  display: inline-grid;
  margin: 0;
  place-items: center;
  color: color-mix(in srgb, var(--bookmark-topic-color) 72%, var(--text));
  font-size: 0.64rem;
}

.bookmark-topic-form input[type="color"] {
  padding: 4px;
}

.bookmark-global {
  display: grid;
  margin-bottom: 12px;
  padding: 10px;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--brand) 36%, var(--separator));
  border-radius: 13px;
  background: color-mix(in srgb, var(--brand-soft) 58%, var(--surface-raised));
}

.bookmark-global h2 {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: -0.015em;
}

.bookmark-global__controls {
  display: grid;
  align-items: start;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr)) 44px;
}

.bookmark-global__controls > .button {
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  font-size: 0.76rem;
  white-space: nowrap;
}

.bookmark-global__remove {
  color: var(--destructive);
}

.bookmark-global__info {
  position: relative;
  min-width: 44px;
}

.bookmark-global__info > summary {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  list-style: none;
  place-items: center;
  border: 1px solid var(--separator);
  border-radius: 12px;
  color: var(--brand-strong);
  background: var(--surface-raised);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.bookmark-global__info > summary::-webkit-details-marker {
  display: none;
}

.bookmark-global__info > summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 68%, transparent);
  outline-offset: 2px;
}

.bookmark-global__info > p {
  position: absolute;
  z-index: 4;
  top: calc(100% + 7px);
  inset-inline-end: 0;
  width: min(286px, calc(100vw - 48px));
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--separator);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-raised);
  box-shadow: 0 10px 28px rgba(7, 21, 29, 0.14);
  font-size: 0.75rem;
  line-height: 1.45;
}

.bookmark-global__info:not([open]) > p {
  display: none;
}

.bookmark-global__status {
  width: 100%;
  min-height: 1.1em;
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
  overflow-wrap: anywhere;
}

.bookmark-backup {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid var(--separator);
  border-radius: 15px;
  background: var(--surface-raised);
}

.bookmark-backup h2 {
  margin: 0;
  font-size: 0.94rem;
  letter-spacing: -0.015em;
}

.bookmark-backup > p {
  margin: 5px 0 12px;
  color: var(--muted);
  font-size: 0.75rem;
}

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

.bookmark-backup__actions .button {
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.78rem;
}

.bookmark-backup > .bookmark-backup__status {
  min-height: 1.1em;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.bookmark-detail__navigation {
  display: flex;
  min-width: 0;
  margin: -6px 0 8px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.bookmark-back {
  display: flex;
  min-height: 44px;
  padding: 0 7px;
  align-items: center;
  gap: 5px;
  border: 0;
  border-radius: 11px;
  color: var(--link);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 720;
}

.bookmark-back > span:first-child {
  font-size: 1.45rem;
  line-height: 1;
}

:root[dir="rtl"] .bookmark-back > span:first-child {
  transform: scaleX(-1);
}

.bookmark-back:hover,
.bookmark-back:focus-visible {
  background: var(--brand-soft);
}

.bookmark-detail__heading {
  display: grid;
  min-height: 68px;
  margin-bottom: 13px;
  padding: 11px 14px;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid color-mix(
    in srgb,
    var(--bookmark-topic-color) 42%,
    var(--separator)
  );
  border-radius: 15px;
  background: color-mix(in srgb, var(--bookmark-topic-color) 11%, var(--surface-raised));
}

.bookmark-detail__color-control {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  cursor: pointer;
}

.bookmark-detail__color-control:hover {
  background: color-mix(in srgb, var(--bookmark-topic-color) 14%, transparent);
}

.bookmark-detail__color-control:focus-within {
  outline: 3px solid color-mix(in srgb, var(--bookmark-topic-color) 42%, transparent);
  outline-offset: 1px;
}

.bookmark-detail__color-control .bookmark-dot {
  width: 23px;
  height: 23px;
}

.bookmark-detail__color-control input {
  position: absolute;
  inset: 0;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: pointer;
}

.bookmark-detail__heading h2,
.bookmark-detail__heading p {
  margin: 0;
}

.bookmark-detail__heading h2 {
  font-size: 1.06rem;
  letter-spacing: -0.02em;
}

.bookmark-detail__heading h2[hidden] {
  display: none;
}

.bookmark-detail__title--editable {
  display: flex;
  min-height: 44px;
  margin: -6px 0;
  align-items: center;
}

.bookmark-detail__title-button {
  display: flex;
  min-width: 0;
  min-height: 44px;
  padding: 6px;
  align-items: center;
  border: 0;
  border-radius: 9px;
  color: inherit;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  text-align: start;
  cursor: text;
}

.bookmark-detail__title-button[hidden] {
  display: none;
}

.bookmark-detail__title-button:hover,
.bookmark-detail__title-button:focus-visible {
  color: var(--link);
  background: color-mix(in srgb, var(--bookmark-topic-color) 12%, transparent);
}

.bookmark-detail__title-button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--bookmark-topic-color) 42%, transparent);
  outline-offset: 1px;
}

.bookmark-detail__name-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px 44px;
  align-items: center;
  gap: 5px;
}

.bookmark-detail__name-form[hidden] {
  display: none;
}

.bookmark-detail__name-form input {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid var(--separator);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-raised);
}

.bookmark-detail__name-form input:focus {
  border-color: var(--bookmark-topic-color);
  outline: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--bookmark-topic-color) 18%, transparent);
}

.bookmark-detail__name-form button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 10px;
  color: var(--link);
  background: transparent;
  font-size: 1.05rem;
  font-weight: 780;
}

.bookmark-detail__name-form button:first-of-type {
  color: var(--destructive);
}

.bookmark-detail__name-form button:hover,
.bookmark-detail__name-form button:focus-visible {
  background: var(--brand-soft);
}

.bookmark-detail__name-form button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--bookmark-topic-color) 42%, transparent);
  outline-offset: 1px;
}

.bookmark-detail__heading p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.72rem;
}

.bookmark-detail__copy {
  min-width: 0;
}

.bookmark-detail__global-status {
  min-height: 1em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.bookmark-detail__actions {
  display: flex;
  max-width: 230px;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.bookmark-detail__actions .button {
  min-height: 44px;
  padding: 0 10px;
  font-size: 0.68rem;
}

#clear-topic-global-bookmarks {
  color: var(--destructive);
}

.bookmark-detail__delete {
  color: var(--destructive);
}

.bookmark-detail__empty {
  min-height: 260px;
}

.bookmark-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 9px;
  list-style: none;
}

.bookmark-list__item {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 48px;
  align-items: stretch;
  border: 1px solid color-mix(
    in srgb,
    var(--bookmark-topic-color) 42%,
    var(--separator)
  );
  border-radius: 14px;
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--bookmark-topic-color) 16%, transparent),
      transparent 42%
    ),
    var(--surface-raised);
  overflow: hidden;
}

:root[dir="rtl"] .bookmark-list__item {
  background:
    linear-gradient(
      -90deg,
      color-mix(in srgb, var(--bookmark-topic-color) 16%, transparent),
      transparent 42%
    ),
    var(--surface-raised);
}

.bookmark-list__open {
  display: grid;
  min-width: 0;
  min-height: 78px;
  padding: 11px 13px;
  align-content: center;
  gap: 5px;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: start;
}

.bookmark-list__open:hover,
.bookmark-list__open:focus-visible {
  background: color-mix(in srgb, var(--bookmark-topic-color) 13%, transparent);
}

.bookmark-list__reference {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-list__reference > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bookmark-list__text {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.83rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.bookmark-list__remove {
  display: grid;
  width: 48px;
  min-height: 48px;
  padding: 0;
  place-items: center;
  border: 0;
  border-inline-start: 1px solid var(--separator);
  color: var(--destructive);
  background: transparent;
  font-size: 1.2rem;
}

.bookmark-list__remove:hover,
.bookmark-list__remove:focus-visible {
  background: color-mix(in srgb, var(--destructive) 9%, transparent);
}

.bookmark-list__global-badge {
  display: inline-grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--bookmark-topic-color) 38%, transparent);
  border-radius: 7px;
  color: color-mix(in srgb, var(--bookmark-topic-color) 72%, var(--text));
  background: color-mix(in srgb, var(--bookmark-topic-color) 14%, transparent);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.04em;
}

.post-button {
  position: sticky;
  bottom: 0;
  width: 100%;
  margin-top: 14px;
  box-shadow:
    0 -12px 24px var(--page),
    0 8px 20px color-mix(in srgb, var(--button) 22%, transparent);
}

.bottom-nav {
  --bottom-nav-icon-size: 24px;
  position: fixed;
  z-index: 20;
  right: auto;
  bottom: 0;
  left: 50%;
  width: min(100%, 620px);
  padding:
    0
    var(--safe-right)
    var(--safe-bottom)
    var(--safe-left);
  border: 1px solid var(--separator);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 -10px 30px rgba(7, 21, 29, 0.08);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}

.bottom-nav.is-collapsed {
  transform: translateX(-50%);
}

.bottom-nav__handle {
  display: grid;
  width: 100%;
  height: var(--nav-handle-height);
  min-height: var(--nav-handle-height);
  padding: 0;
  place-items: center;
  border: 0;
  color: var(--hint);
  background: transparent;
  font-size: 0.8rem;
  line-height: 1;
}

.bottom-nav__handle span {
  transition: transform 180ms ease;
}

.bottom-nav.is-collapsed .bottom-nav__handle span {
  transform: rotate(180deg);
}

:root[dir="rtl"] .reader-toolbar__arrow {
  transform: scaleX(-1);
}

.bottom-nav__items {
  display: grid;
  max-height: var(--nav-height);
  padding:
    0
    12px
    5px
    12px;
  overflow: hidden;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  opacity: 1;
  transition:
    max-height 190ms ease,
    padding 190ms ease,
    opacity 120ms ease;
}

.bottom-nav.is-collapsed .bottom-nav__items {
  visibility: hidden;
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

.bottom-nav__item {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 56px;
  padding: 5px 4px 3px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
  border: 0;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  font-size: 0.66rem;
  font-weight: 670;
}

.bottom-nav__item.is-active {
  color: var(--brand-strong);
}

.bottom-nav__item > span:not(.bottom-nav__icon):not(.bottom-nav__badge) {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav__icon {
  display: block;
  width: var(--bottom-nav-icon-size);
  height: var(--bottom-nav-icon-size);
  flex: 0 0 var(--bottom-nav-icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav__badge {
  position: absolute;
  top: 3px;
  inset-inline-start: calc(50% + 8px);
  display: grid;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 999px;
  color: var(--button-text);
  background: var(--button);
  font-size: 0.6rem;
  line-height: 1;
}

.sheet {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
}

.sheet::backdrop {
  background: rgba(4, 12, 17, 0.48);
  backdrop-filter: blur(3px);
}

.sheet[open] {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet__surface {
  display: grid;
  width: min(100%, 680px);
  max-height: calc(var(--app-height) - max(var(--safe-top), 12px));
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-radius: 22px 22px 0 0;
  background: var(--page);
  box-shadow: 0 -20px 60px rgba(5, 18, 25, 0.2);
  overflow: hidden;
}

.sheet__surface--translation {
  max-height: min(
    420px,
    calc(var(--app-height) - max(var(--safe-top), 12px))
  );
  grid-template-rows: auto minmax(0, 1fr);
}

.history-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 9px;
  list-style: none;
}

.history-item {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: stretch;
  border: 1px solid var(--separator);
  border-radius: 14px;
  background: var(--surface-raised);
  overflow: hidden;
}

.history-item__open {
  display: grid;
  min-width: 0;
  min-height: 68px;
  padding: 11px 14px;
  align-content: center;
  gap: 3px;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: start;
}

.history-item__open:hover,
.history-item__open:focus-visible {
  background: var(--brand-soft);
}

.history-item__open:focus-visible,
.history-item__remove:focus-visible {
  outline-offset: -3px;
}

.history-item__open:focus-visible {
  outline-color: var(--brand-strong);
}

.history-item__remove:focus-visible {
  outline-color: var(--destructive);
}

.history-item__open strong,
.history-item__open span,
.history-item__open small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-item__open strong {
  color: var(--brand-strong);
  font-size: 0.9rem;
}

.history-item__open span {
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 650;
}

.history-item__open small {
  color: var(--muted);
  font-size: 0.67rem;
}

.history-item__open .history-item__text {
  display: -webkit-box;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.8rem;
  font-weight: 400;
  line-height: 1.4;
  overflow-wrap: anywhere;
  text-overflow: clip;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.history-item__open .history-item__text[hidden] {
  display: none;
}

.history-item__remove {
  display: grid;
  width: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 0;
  border-inline-start: 1px solid var(--separator);
  color: var(--destructive);
  background: transparent;
  font-size: 1.25rem;
}

.history-item__remove:hover,
.history-item__remove:focus-visible {
  background: color-mix(in srgb, var(--destructive) 9%, transparent);
}

.sheet--passage[open] {
  padding-top: calc(var(--header-height) + var(--safe-top));
  padding-inline-end: max(
    var(--safe-inline-end),
    calc((100vw - var(--content-width)) / 2)
  );
  align-items: flex-start;
  justify-content: flex-end;
}

.sheet--passage::backdrop {
  background: rgba(4, 12, 17, 0.58);
  backdrop-filter: none;
}

.sheet__surface--passage {
  width: min(82vw, 520px);
  min-width: min(300px, 100%);
  height: calc(var(--app-height) - var(--header-height) - var(--safe-top));
  max-height: none;
  grid-template-rows: auto minmax(0, 1fr);
  border-radius: 0;
  border-start-start-radius: 18px;
  border-end-start-radius: 18px;
  box-shadow: -18px 0 56px rgba(5, 18, 25, 0.24);
}

[dir="rtl"] .sheet__surface--passage {
  box-shadow: 18px 0 56px rgba(5, 18, 25, 0.24);
}

.passage-picker__header {
  display: grid;
  min-height: 54px;
  padding:
    5px
    calc(var(--safe-right) + 12px)
    5px
    calc(var(--safe-left) + 12px);
  grid-template-columns: minmax(64px, auto) minmax(0, 1fr) 44px;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--separator);
  background: color-mix(in srgb, var(--page) 96%, transparent);
  backdrop-filter: blur(18px);
}

.passage-picker__back {
  display: inline-flex;
  min-height: 44px;
  padding: 0 8px;
  align-items: center;
  gap: 3px;
  border: 0;
  border-radius: 11px;
  color: var(--link);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 700;
}

.passage-picker__back > span:first-child {
  font-size: 1.45rem;
  line-height: 1;
}

[dir="rtl"] .passage-picker__back > span:first-child {
  transform: scaleX(-1);
}

.passage-picker__back:hover,
.passage-picker__back:focus-visible {
  background: var(--brand-soft);
}

.passage-picker__heading {
  min-width: 0;
  text-align: center;
}

.passage-picker__heading .eyebrow {
  display: none;
}

.passage-picker__heading h2 {
  margin: 0;
  overflow: hidden;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passage-picker__content {
  min-height: 0;
  padding: 0 0 var(--safe-bottom);
  background: var(--page);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.passage-picker__state {
  display: grid;
  min-height: 170px;
  padding: 28px 20px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.passage-picker__state p {
  margin: 0;
  overflow-wrap: anywhere;
}

.passage-picker__book-group h3 {
  position: sticky;
  z-index: 1;
  top: 0;
  margin: 0;
  padding: 8px 14px 7px;
  border-bottom: 1px solid var(--separator);
  color: var(--muted);
  background: color-mix(in srgb, var(--page) 96%, transparent);
  font-size: 0.69rem;
  font-weight: 730;
  letter-spacing: 0.045em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.passage-picker__book-grid {
  display: grid;
  padding: 6px;
  grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
  gap: 5px;
  border-bottom: 1px solid var(--separator);
  background: var(--surface);
}

.passage-picker__book,
.passage-picker__chapter {
  min-width: 0;
  min-height: 48px;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  font-weight: 720;
}

.passage-picker__book {
  overflow: hidden;
  font-size: 0.78rem;
  letter-spacing: 0.015em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.passage-picker__chapters {
  display: grid;
  padding: 6px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 5px;
  background: var(--surface);
}

.passage-picker__chapter {
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
}

.passage-picker__book:hover,
.passage-picker__book:focus-visible,
.passage-picker__chapter:hover,
.passage-picker__chapter:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 42%, var(--separator));
  background: var(--brand-soft);
}

.passage-picker__book.is-active,
.passage-picker__chapter.is-active {
  border-color: var(--brand);
  color: var(--brand-ink);
  background: var(--brand-soft);
}

.sheet__content--translation {
  align-content: start;
}

.translation-details {
  display: grid;
  min-height: 72px;
  padding: 14px 15px;
  gap: 5px;
  border: 1px solid var(--separator);
  border-radius: 14px;
  background: var(--surface);
}

.translation-details strong,
.translation-details span {
  overflow-wrap: anywhere;
}

.translation-details strong {
  font-size: 0.95rem;
  line-height: 1.35;
}

.translation-details span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 620;
}

.sheet__header {
  display: flex;
  padding: 18px calc(var(--safe-right) + 18px) 14px calc(var(--safe-left) + 18px);
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--separator);
}

.sheet__header h2 {
  margin: 0;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  color: var(--text);
  background: var(--surface);
  font-size: 1.6rem;
  font-weight: 350;
}

.sheet__content {
  display: grid;
  padding: 18px calc(var(--safe-right) + 18px) 24px calc(var(--safe-left) + 18px);
  gap: 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet__footer {
  display: grid;
  padding:
    12px
    calc(var(--safe-right) + 18px)
    calc(var(--safe-bottom) + 12px)
    calc(var(--safe-left) + 18px);
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
  border-top: 1px solid var(--separator);
  background: var(--surface);
}

.choice-group {
  display: flex;
  margin: 0;
  padding: 0;
  flex-wrap: wrap;
  gap: 7px;
  border: 0;
}

.choice-group legend {
  width: 100%;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 690;
}

.choice-group label {
  position: relative;
  flex: 1 0 auto;
}

.choice-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-group span {
  display: grid;
  min-height: 43px;
  padding: 0 13px;
  place-items: center;
  border: 1px solid var(--separator);
  border-radius: 11px;
  background: var(--surface-raised);
  font-size: 0.8rem;
  font-weight: 640;
}

.choice-group input:checked + span {
  border-color: var(--brand);
  color: var(--brand-ink);
  background: var(--brand-soft);
}

.choice-group input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--brand) 68%, transparent);
  outline-offset: 2px;
}

.book-filter {
  margin: 0;
  padding: 0;
  border: 0;
}

.book-filter legend {
  display: flex;
  width: 100%;
  margin: 0 0 2px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 690;
}

.book-filter legend .text-button {
  min-height: 32px;
  font-size: 0.68rem;
}

.book-filter > p {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 0.68rem;
}

.book-filter__list {
  display: grid;
  max-height: 180px;
  padding: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  border: 1px solid var(--separator);
  border-radius: 13px;
  background: var(--surface);
  overflow-y: auto;
}

.book-filter__list > p {
  grid-column: 1 / -1;
  margin: 12px;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: center;
}

.book-filter__option {
  position: relative;
}

.book-filter__option input {
  position: absolute;
  opacity: 0;
}

.book-filter__option span {
  display: flex;
  min-height: 40px;
  padding: 7px 9px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.72rem;
  font-weight: 620;
}

.book-filter__option input:checked + span {
  border-color: var(--brand);
  color: var(--brand-ink);
  background: var(--brand-soft);
}

.book-filter__option input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--brand) 68%, transparent);
  outline-offset: 1px;
}

.toggle-grid {
  display: grid;
  gap: 8px;
}

.toggle-control {
  display: flex;
  min-height: 58px;
  padding: 10px 12px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--separator);
  border-radius: 12px;
  background: var(--surface-raised);
}

.toggle-control strong,
.toggle-control small {
  display: block;
}

.toggle-control strong {
  font-size: 0.82rem;
}

.toggle-control small,
.field-control small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.toggle-control input {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  accent-color: var(--button);
}

.field-control {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-control input {
  padding-right: 13px;
}

.toast-region {
  position: fixed;
  z-index: 100;
  top: calc(var(--safe-top) + 12px);
  right: calc(var(--safe-right) + 14px);
  left: calc(var(--safe-left) + 14px);
  display: grid;
  justify-items: center;
  pointer-events: none;
}

.toast {
  width: fit-content;
  max-width: min(100%, 430px);
  padding: 11px 15px;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--separator));
  border-radius: 999px;
  color: var(--text);
  background: color-mix(in srgb, var(--surface-raised) 96%, transparent);
  box-shadow: 0 12px 30px rgba(7, 21, 29, 0.18);
  font-size: 0.78rem;
  font-weight: 660;
  text-align: center;
  backdrop-filter: blur(14px);
  animation: toast-in 160ms ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

@media (max-width: 520px) {
  .view:not(.view--reader) {
    padding-top: 18px;
  }

  .search-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-actions > :last-child:nth-child(odd) {
    grid-column: auto;
  }

  .bookmark-group-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .bookmark-topic-form {
    grid-template-columns: minmax(0, 1fr);
  }

  .bookmark-topic-form .button {
    width: 100%;
  }

  .contributor-sync {
    grid-template-columns: minmax(0, 1fr);
  }

  .contributor-sync__button {
    width: 100%;
  }

  .bookmark-backup__actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .bookmark-detail__heading {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .bookmark-detail__actions {
    max-width: none;
    grid-column: 2;
    justify-content: flex-start;
  }

  .search-form__submit {
    width: 100%;
  }

  .selection-item {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .selection-item__actions {
    grid-column: 2;
    justify-content: start;
    grid-template-columns: repeat(4, 40px);
  }
}

@media (max-width: 367px) {
  .passage-picker__chapters {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 760px) {
  .view:not(.view--reader) {
    padding-top: 30px;
  }

  .bookmark-group-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .verse-card {
    padding: 18px 52px 18px 19px;
  }

  .verse-card__text {
    font-size: 1.08rem;
  }

  .bottom-nav__item {
    min-height: 48px;
    padding-top: 2px;
  }

  .reader-scripture {
    padding-top: 14px;
  }

  .reader-verse {
    padding-right: 18px;
    padding-left: 11px;
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .sheet__surface--translation {
    width: min(100%, 520px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
