:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-alt: #f8f8fa;
  --ink: #1d1d1f;
  --muted: #76767d;
  --line: rgba(0, 0, 0, 0.1);
  --accent: #0066cc;
  --accent-strong: #1d1d1f;
  --gold: #b7791f;
  --danger: #9f2f2f;
  --accent-soft: rgba(0, 102, 204, 0.1);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.06);
  --font-heading: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --shell-gutter: clamp(12px, 2.3vw, 32px);
  --shell-top-pad: clamp(0.55rem, 1.35vw, 2.25rem);
  --panel-pad: clamp(0.8rem, 1.2vw, 2rem);
  --panel-pad-tight: clamp(0.55rem, 0.85vw, 1.35rem);
  --panel-radius: clamp(16px, 1.45vw, 22px);
  --reader-gap: clamp(0.7rem, 1.05vw, 1.5rem);
  --reader-sidebar: clamp(280px, 20vw, 330px);
  --control-size: clamp(36px, 2.8vw, 48px);
  --control-radius: clamp(11px, 1vw, 16px);
  --control-pad-y: clamp(0.42rem, 0.9vw, 0.85rem);
  --control-pad-x: clamp(0.7rem, 1.1vw, 1rem);
  --word-gap: clamp(0.42rem, 0.9vw, 0.85rem);
  --word-min: clamp(110px, 8vw, 138px);
  --word-min-height: clamp(108px, 8.9vw, 154px);
  --word-pad-y: clamp(0.58rem, 0.82vw, 1.05rem);
  --word-pad-x: clamp(0.62rem, 0.72vw, 1rem);
}

html.dark {
  color-scheme: dark;
  --bg: #030303;
  --surface: #121214;
  --surface-alt: #1c1c1e;
  --ink: #f5f5f7;
  --muted: #a1a1a6;
  --line: rgba(255, 255, 255, 0.14);
  --accent: #66aaff;
  --accent-strong: #f5f5f7;
  --gold: #e0b15a;
  --danger: #f09a9a;
  --accent-soft: rgba(102, 170, 255, 0.16);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 102, 204, 0.055), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.47059;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

.header {
  height: 44px;
  background-color: rgba(255, 255, 255, 0.72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.header .container {
  height: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.logo {
  color: var(--ink);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: rgba(0, 0, 0, 0.8);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  color: #000;
  opacity: 0.7;
}

html.dark .header {
  background-color: rgba(3, 3, 3, 0.74);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}

@media (min-width: 821px) {
  .header.mobile-header {
    height: 4.5rem;
    background-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom: 0;
    isolation: isolate;
    overflow: visible;
  }

  .header.mobile-header > .container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    width: 100%;
    max-width: none;
    height: 4.5rem;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
  }

  .header.mobile-header .logo {
    color: var(--ink) !important;
    font-size: 1.45rem;
    justify-self: start;
  }

  .header.mobile-header nav {
    justify-self: center;
  }

  .header.mobile-header .nav-links a {
    color: var(--ink) !important;
    font-size: 0.95rem;
  }

  .header.mobile-header .header-actions {
    justify-self: end;
    margin-left: 0;
  }

  .desktop-header-blur {
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.84) 0%,
      rgba(255, 255, 255, 0.72) 58%,
      rgba(255, 255, 255, 0.1) 86%,
      transparent 100%
    );
    display: grid;
    inset: 0;
    pointer-events: none;
    position: absolute;
    z-index: -1;
  }

  .desktop-header-blur span {
    backface-visibility: hidden;
    grid-area: 1 / 1;
    transform: translateZ(0);
  }

  .desktop-header-blur span:nth-child(1),
  .desktop-header-blur span:nth-child(2) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(1px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(1px);
    -webkit-mask: linear-gradient(0deg, transparent, #000 8%);
    mask: linear-gradient(0deg, transparent, #000 8%);
  }

  .desktop-header-blur span:nth-child(3) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(4px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(4px);
    -webkit-mask: linear-gradient(0deg, transparent 8%, #000 16%);
    mask: linear-gradient(0deg, transparent 8%, #000 16%);
  }

  .desktop-header-blur span:nth-child(4) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(8px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(8px);
    -webkit-mask: linear-gradient(0deg, transparent 16%, #000 24%);
    mask: linear-gradient(0deg, transparent 16%, #000 24%);
  }

  .desktop-header-blur span:nth-child(5) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(16px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(16px);
    -webkit-mask: linear-gradient(0deg, transparent 24%, #000 36%);
    mask: linear-gradient(0deg, transparent 24%, #000 36%);
  }

  .desktop-header-blur span:nth-child(6) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(24px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(24px);
    -webkit-mask: linear-gradient(0deg, transparent 36%, #000 48%);
    mask: linear-gradient(0deg, transparent 36%, #000 48%);
  }

  .desktop-header-blur span:nth-child(7) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(32px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(32px);
    -webkit-mask: linear-gradient(0deg, transparent 48%, #000 60%);
    mask: linear-gradient(0deg, transparent 48%, #000 60%);
  }

  html.dark .desktop-header-blur {
    background: linear-gradient(
      180deg,
      rgba(3, 3, 3, 0.84) 0%,
      rgba(3, 3, 3, 0.72) 58%,
      rgba(3, 3, 3, 0.1) 86%,
      transparent 100%
    );
  }
}

html.dark .logo,
html.dark .nav-links a,
html.dark .nav-links a:hover,
html.dark .nav-links a.active {
  color: #f5f5f7;
}

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

h1,
h2 {
  margin: 0;
  font-family: var(--font-heading);
  letter-spacing: -0.015em;
}

h1 {
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  font-weight: 650;
  line-height: 1.05;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.2;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.nav-buttons {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.icon-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(248, 248, 250, 0.82);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.88rem;
}

.icon-button:hover {
  background: #fff;
  border-color: var(--accent);
}

html.dark .icon-button {
  background: rgba(255, 255, 255, 0.08);
}

.header.mobile-header .icon-button,
.header.mobile-header .mobile-menu-toggle {
  background: rgba(248, 248, 250, 0.82) !important;
  border-color: rgba(0, 0, 0, 0.1) !important;
  color: var(--ink) !important;
}

html.dark .header.mobile-header .icon-button,
html.dark .header.mobile-header .mobile-menu-toggle {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #f5f5f7 !important;
}

@media (max-width: 1180px), (max-height: 760px) {
  .header {
    height: clamp(2rem, 5.4vh, 2.25rem);
    padding: 0;
  }

  .header .container {
    height: 100%;
    padding: 0 clamp(0.65rem, 2vw, 1rem);
  }

  .logo {
    font-size: clamp(0.92rem, 2.7vw, 1.08rem);
  }

  .nav-links {
    gap: clamp(0.75rem, 2.8vw, 1.35rem);
  }

  .nav-links a {
    font-size: clamp(0.58rem, 1.7vw, 0.68rem);
  }
}

.app-shell {
  width: min(1280px, calc(100% - var(--shell-gutter)));
  margin: 0 auto;
  padding: var(--shell-top-pad) 0 4rem;
}

.interlinear-title {
  margin: 0 auto 1rem;
  max-width: 980px;
  text-align: center;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1.7fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) auto;
  gap: clamp(0.34rem, 0.7vw, 0.55rem);
  align-items: end;
  padding: var(--panel-pad-tight);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

html.dark .toolbar {
  background: var(--surface);
}

html.dark .toolbar .nav-button,
html.dark .search-button {
  background: #f5f5f7;
  color: #1d1d1f;
}

label {
  display: grid;
  gap: 5px;
  min-width: 0;
}

label span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: var(--control-size);
  padding: var(--control-pad-y) 2.45rem var(--control-pad-y) var(--control-pad-x);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  appearance: none;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%),
    var(--surface);
  background-position:
    calc(100% - 18px) 54%,
    calc(100% - 12px) 54%,
    0 0;
  background-repeat: no-repeat;
  background-size: 6px 6px, 6px 6px, 100% 100%;
  color: var(--ink);
  outline: none;
}

input {
  width: 100%;
  min-height: var(--control-size);
  padding: var(--control-pad-y) var(--control-pad-x);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--surface);
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.toolbar .nav-button {
  width: var(--control-size);
  height: var(--control-size);
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  background: var(--accent-strong);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.toolbar .nav-button:hover {
  box-shadow: 0 10px 22px rgba(52, 40, 25, 0.12);
  transform: translateY(-1px);
}

.search-panel {
  margin-top: clamp(0.45rem, 1vw, 1rem);
  padding: var(--panel-pad-tight);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow);
}

.search-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(132px, 0.42fr) minmax(150px, 0.5fr) auto;
  gap: clamp(0.36rem, 0.8vw, 12px);
  align-items: end;
}

.search-actions {
  display: flex;
  gap: 0.55rem;
}

.search-button,
.plain-button {
  min-height: var(--control-size);
  padding: clamp(0.42rem, 0.8vw, 0.75rem) var(--control-pad-x);
  border: 1px solid var(--line);
  border-radius: var(--control-radius);
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.search-button {
  background: var(--accent-strong);
  color: #fff;
}

.plain-button {
  background: var(--surface);
  color: var(--ink);
}

.search-button:hover,
.plain-button:hover {
  box-shadow: 0 10px 22px rgba(52, 40, 25, 0.12);
  transform: translateY(-1px);
}

.search-results {
  margin-top: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}

.search-summary {
  margin: 0 0 10px;
  color: var(--muted);
  font-weight: 700;
}

.search-result-list {
  display: grid;
  gap: 0.42rem;
  max-height: min(48vh, 420px);
  overflow: auto;
  padding-right: 4px;
}

.search-result {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr;
  gap: 0.18rem;
  column-gap: 0.65rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-alt);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  font-size: 0.92rem;
}

.search-result:hover,
.search-result:focus {
  border-color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}

.search-result-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  line-height: 1.2;
}

.search-result-meta {
  align-self: center;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.search-result-text {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ink);
  line-height: 1.38;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 0.76rem;
}

.reader-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--reader-sidebar);
  gap: var(--reader-gap);
  align-items: start;
  margin-top: var(--reader-gap);
}

.passage-panel,
.detail-panel,
.versions-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  box-shadow: var(--shadow);
}

.passage-panel {
  padding: var(--panel-pad);
}

.detail-panel {
  position: sticky;
  top: 112px;
  padding: var(--panel-pad-tight);
}

.passage-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.passage-heading h2,
.detail-panel h2,
.versions-heading h2 {
  font-size: clamp(1.45rem, 3vw, 2.05rem);
  font-weight: 650;
}

.language-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.35rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent);
  font-weight: 700;
  background: var(--surface-alt);
}

.verse-line {
  margin: clamp(0.55rem, 1.2vw, 1.35rem) 0 clamp(0.55rem, 1vw, 1.15rem);
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.22rem);
  line-height: 1.62;
}

.word-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--word-gap);
}

.word-card {
  flex: 0 1 auto;
  width: max-content;
  min-width: var(--word-min);
  max-width: 100%;
  min-height: var(--word-min-height);
  padding: var(--word-pad-y) var(--word-pad-x);
  border: 1px solid var(--line);
  border-radius: var(--panel-radius);
  background: var(--surface-alt);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.word-card:hover,
.word-card:focus {
  border-color: var(--accent);
  outline: none;
  transform: translateY(-1px);
}

.word-card.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent), 0 12px 28px rgba(0, 102, 204, 0.12);
  background: #fff;
}

html.dark .word-card.is-selected {
  background: #171719;
}

.textual-note {
  margin: 16px 0 0;
  padding: 12px;
  border-left: 4px solid var(--gold);
  border-radius: 0 16px 16px 0;
  background: var(--surface-alt);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 700;
}

.word-original {
  display: block;
  min-height: 42px;
  font-size: clamp(1.55rem, 2.8vw, 2rem);
  line-height: 1.2;
  direction: auto;
  unicode-bidi: plaintext;
  white-space: nowrap;
}

.word-translation {
  min-height: 36px;
  margin: clamp(0.28rem, 0.7vw, 0.65rem) 0;
  color: var(--ink);
  font-weight: 700;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.word-morphology {
  display: block;
  min-height: 20px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.strong-number {
  display: inline-flex;
  min-height: clamp(21px, 2vw, 28px);
  align-items: center;
  justify-content: center;
  padding: 2px clamp(7px, 0.7vw, 9px);
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

html.dark .strong-number {
  background: #f5f5f7;
  color: #1d1d1f;
}

.status-text,
.muted {
  color: var(--muted);
}

.status-text {
  min-height: 24px;
  margin: 16px 0 0;
}

.strong-details {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.detail-row {
  display: grid;
  gap: 3px;
}

.detail-row span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.detail-row p {
  margin: 0;
}

.definition {
  padding: 12px;
  border-left: 4px solid var(--accent);
  background: var(--surface-alt);
  border-radius: 0 16px 16px 0;
}

.versions-panel {
  margin-top: var(--reader-gap);
  padding: var(--panel-pad);
}

.versions-panel.is-compact {
  display: block;
  padding: 0.62rem 0.8rem;
}

.versions-panel.is-compact .versions-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 0.8rem;
}

.versions-panel.is-compact .versions-heading > div {
  min-width: 0;
}

.versions-panel.is-compact .eyebrow {
  display: none;
}

.versions-panel.is-compact h2 {
  font-size: 1.05rem;
  white-space: nowrap;
}

.versions-panel.is-compact .search-button {
  min-height: 34px;
  padding: 0.35rem 0.75rem;
  width: max-content;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  justify-self: end;
}

.versions-panel.is-compact #versionsSummary {
  margin: 0.45rem 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  min-width: 0;
}

.versions-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.versions-list {
  display: grid;
  gap: 0.7rem;
  margin-top: 1rem;
}

.version-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  gap: 14px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-alt);
}

.version-name {
  display: grid;
  gap: 4px;
  align-content: start;
  color: var(--ink);
  font-weight: 700;
}

.version-short {
  width: fit-content;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  font-size: 0.76rem;
}

html.dark .version-short {
  background: #f5f5f7;
  color: #1d1d1f;
}

.version-text {
  margin: 0;
  direction: auto;
  unicode-bidi: plaintext;
}

.error {
  color: var(--danger);
  font-weight: 700;
}

@media (max-width: 860px) {
  .header {
    height: auto;
  }

  .header .container {
    min-height: 44px;
    flex-wrap: wrap;
    gap: 0.55rem 1rem;
    padding-bottom: 0.45rem;
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 0.45rem;
  }

  .nav-links {
    gap: 1rem;
  }

  .nav-links a {
    font-size: 0.75rem;
  }

  .header-actions {
    margin-left: auto;
  }

  .app-shell {
    width: min(100% - 24px, 1280px);
  }

  .toolbar,
  .search-form,
  .reader-layout {
    grid-template-columns: 1fr;
  }

  .search-actions {
    justify-content: stretch;
  }

  .search-actions button {
    flex: 1 1 0;
  }

  .versions-heading,
  .version-row {
    grid-template-columns: 1fr;
  }

  .versions-heading {
    display: grid;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 1500px) {
  :root {
    --shell-top-pad: clamp(0.35rem, 1vw, 1.15rem);
    --panel-pad: clamp(0.75rem, 1vw, 1rem);
    --panel-pad-tight: clamp(0.38rem, 0.8vw, 0.75rem);
    --reader-gap: clamp(0.7rem, 0.9vw, 1rem);
    --reader-sidebar: clamp(280px, 20vw, 300px);
    --control-size: clamp(34px, 2.8vw, 40px);
    --word-gap: clamp(0.42rem, 0.65vw, 0.65rem);
    --word-min: clamp(106px, 8vw, 122px);
    --word-min-height: clamp(104px, 8.5vw, 124px);
  }

  .app-shell {
    padding-bottom: 1.5rem;
  }

  .interlinear-title {
    margin-bottom: 0.3rem;
  }

  .interlinear-title .eyebrow {
    display: none;
  }

  h1 {
    font-size: clamp(1.45rem, 3vw, 1.85rem);
  }

  label {
    gap: 0;
  }

  label span {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  .search-results {
    margin-top: 0.38rem;
    padding-top: 0.38rem;
  }

  .search-result-list {
    max-height: min(34vh, 230px);
  }

  .detail-panel {
    top: 58px;
  }

  .passage-heading {
    padding-bottom: 0.5rem;
  }

  .passage-heading h2,
  .detail-panel h2,
  .versions-heading h2 {
    font-size: 1.25rem;
  }

  .language-badge {
    min-height: 24px;
    padding: 0.16rem 0.55rem;
  }

  .word-original {
    font-size: 1.34rem;
    min-height: 28px;
  }

  .word-morphology {
    font-size: 0.6rem;
    margin-bottom: 0.28rem;
    min-height: 14px;
  }

  .detail-panel {
    font-size: 0.86rem;
  }

  .strong-details {
    gap: 0.55rem;
    margin-top: 0.7rem;
  }

  .definition {
    padding: 0.55rem;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 1rem;
  }

  .container {
    padding: 0 1rem;
  }

  .header .container {
    align-items: center;
  }

  .logo {
    font-size: 1.08rem;
  }

  .nav-links {
    order: 0;
    width: auto;
    gap: 1rem;
    overflow-x: visible;
    padding-bottom: 0;
  }

  .nav-links a {
    white-space: nowrap;
  }

  .toolbar {
    padding: 0.65rem;
    border-radius: 18px;
  }

  .search-panel,
  .passage-panel,
  .detail-panel,
  .versions-panel {
    border-radius: 18px;
  }

  .passage-panel,
  .detail-panel {
    padding: 1rem;
  }

  .word-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .word-card {
    width: 100%;
  }
}

.mobile-menu-toggle {
  display: none;
}

@media (max-width: 820px) {
  body {
    padding-top: calc(clamp(3.75rem, 15vw, 4.25rem) + env(safe-area-inset-top, 0px));
  }

  .header.mobile-header {
    background-color: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-bottom-color: rgba(0, 0, 0, 0.08) !important;
    height: calc(clamp(3.9rem, 15vw, 4.8rem) + env(safe-area-inset-top, 0px));
    isolation: isolate;
    min-height: calc(3.75rem + env(safe-area-inset-top, 0px));
    left: 0;
    overflow: visible;
    padding: env(safe-area-inset-top, 0px) 0 0;
    position: fixed;
    right: 0;
    top: 0;
    width: 100%;
  }

  .header.mobile-header > .mobile-header-blur {
    background: linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.84) 0%,
      rgba(255, 255, 255, 0.72) 58%,
      rgba(255, 255, 255, 0.1) 86%,
      transparent 100%
    );
    display: grid;
    inset: 0 0 -0.75rem;
    pointer-events: none;
    position: absolute;
    z-index: -1;
  }

  .header.mobile-header > .mobile-header-blur span {
    backface-visibility: hidden;
    grid-area: 1 / 1;
    transform: translateZ(0);
  }

  .header.mobile-header > .mobile-header-blur span:nth-child(1),
  .header.mobile-header > .mobile-header-blur span:nth-child(2) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(1px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(1px);
    -webkit-mask: linear-gradient(0deg, transparent, #000 8%);
    mask: linear-gradient(0deg, transparent, #000 8%);
  }

  .header.mobile-header > .mobile-header-blur span:nth-child(3) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(3px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(3px);
    -webkit-mask: linear-gradient(0deg, transparent 8%, #000 16%);
    mask: linear-gradient(0deg, transparent 8%, #000 16%);
  }

  .header.mobile-header > .mobile-header-blur span:nth-child(4) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(6px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(6px);
    -webkit-mask: linear-gradient(0deg, transparent 16%, #000 24%);
    mask: linear-gradient(0deg, transparent 16%, #000 24%);
  }

  .header.mobile-header > .mobile-header-blur span:nth-child(5) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(9px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(9px);
    -webkit-mask: linear-gradient(0deg, transparent 24%, #000 36%);
    mask: linear-gradient(0deg, transparent 24%, #000 36%);
  }

  .header.mobile-header > .mobile-header-blur span:nth-child(6) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(12px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(12px);
    -webkit-mask: linear-gradient(0deg, transparent 36%, #000 48%);
    mask: linear-gradient(0deg, transparent 36%, #000 48%);
  }

  .header.mobile-header > .mobile-header-blur span:nth-child(7) {
    -webkit-backdrop-filter: saturate(112%) brightness(1.20) blur(15px);
    backdrop-filter: saturate(112%) brightness(1.20) blur(15px);
    -webkit-mask: linear-gradient(0deg, transparent 48%, #000 60%);
    mask: linear-gradient(0deg, transparent 48%, #000 60%);
  }

  .header.mobile-header .container {
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.55rem;
    height: 100%;
    max-width: 100%;
    min-width: 0;
    padding: 0 0.75rem;
    position: relative;
    width: 100%;
    z-index: 1;
  }

  .header.mobile-header .logo {
    color: var(--ink) !important;
    flex: 1 1 auto;
    font-size: clamp(0.98rem, 4.45vw, 1.2rem) !important;
    max-width: none;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header.mobile-header nav {
    position: static;
  }

  .header.mobile-header .header-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 0.45rem;
    margin-left: auto;
  }

  .header.mobile-header .icon-button,
  .header.mobile-header .mobile-menu-toggle {
    height: 2.65rem;
    width: 2.65rem;
  }

  .header.mobile-header .mobile-menu-toggle {
    align-items: center;
    background: rgba(248, 248, 250, 0.92);
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
    padding: 0;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .header.mobile-header .mobile-menu-toggle span,
  .header.mobile-header .mobile-menu-toggle span::before,
  .header.mobile-header .mobile-menu-toggle span::after {
    background: currentColor;
    border-radius: 999px;
    content: "";
    display: block;
    height: 2px;
    transition: transform 0.2s ease, top 0.2s ease;
    width: 1.15rem;
  }

  .header.mobile-header .mobile-menu-toggle span {
    position: relative;
  }

  .header.mobile-header .mobile-menu-toggle span::before,
  .header.mobile-header .mobile-menu-toggle span::after {
    left: 0;
    position: absolute;
  }

  .header.mobile-header .mobile-menu-toggle span::before {
    top: -6px;
  }

  .header.mobile-header .mobile-menu-toggle span::after {
    top: 6px;
  }

  .header.mobile-header .mobile-menu-toggle[aria-expanded="true"] span {
    background: transparent;
  }

  .header.mobile-header .mobile-menu-toggle[aria-expanded="true"] span::before {
    top: 0;
    transform: rotate(45deg);
  }

  .header.mobile-header .mobile-menu-toggle[aria-expanded="true"] span::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .header.mobile-header .nav-links {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.14);
    display: grid;
    gap: 0.25rem;
    min-width: min(14rem, calc(100vw - 1.5rem));
    opacity: 0;
    padding: 0.45rem;
    pointer-events: none;
    position: absolute;
    right: 0.75rem;
    top: calc(100% + 0.45rem);
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    width: auto;
    z-index: 150;
  }

  .header.mobile-header.menu-open .nav-links {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .header.mobile-header .nav-links a {
    border-radius: 10px;
    color: var(--ink) !important;
    display: block;
    font-size: 0.88rem;
    padding: 0.75rem 0.85rem;
    text-align: left;
    white-space: nowrap;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .header.mobile-header .nav-links a.active {
    background: rgba(0, 102, 204, 0.1);
    color: var(--accent);
    opacity: 1;
  }

  html.dark .header.mobile-header .mobile-menu-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
  }

  html.dark .header.mobile-header {
    border-bottom-color: rgba(255, 255, 255, 0.12) !important;
  }

  html.dark .header.mobile-header > .mobile-header-blur {
    background: linear-gradient(
      180deg,
      rgba(3, 3, 3, 0.84) 0%,
      rgba(3, 3, 3, 0.72) 58%,
      rgba(3, 3, 3, 0.1) 86%,
      transparent 100%
    );
  }

  html.dark .header.mobile-header .nav-links {
    background: rgba(24, 24, 26, 0.98);
    border-color: rgba(255, 255, 255, 0.13);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.38);
  }
}

@media (min-width: 821px) and (max-width: 1440px),
       (min-width: 821px) and (max-height: 850px) {
  .header.mobile-header {
    height: 3.25rem;
    min-height: 3.25rem;
    padding: 0;
    position: sticky;
  }

  .header.mobile-header .container {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: 3.25rem;
    padding: 0 1rem;
  }

  .header.mobile-header .logo {
    grid-column: 1;
    grid-row: 1;
    font-size: 1.08rem;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .header.mobile-header nav {
    grid-column: 2;
    grid-row: 1;
    position: static;
  }

  .header.mobile-header .header-actions {
    display: flex;
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
  }

  .header.mobile-header .mobile-menu-toggle {
    align-items: center;
    background: rgba(248, 248, 250, 0.92);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 999px;
    color: var(--ink);
    cursor: pointer;
    display: inline-flex;
    height: 2.35rem;
    justify-content: center;
    padding: 0;
    width: 2.35rem;
  }

  .header.mobile-header .mobile-menu-toggle span,
  .header.mobile-header .mobile-menu-toggle span::before,
  .header.mobile-header .mobile-menu-toggle span::after {
    background: currentColor;
    border-radius: 999px;
    content: "";
    display: block;
    height: 2px;
    transition: transform 0.2s ease, top 0.2s ease;
    width: 1rem;
  }

  .header.mobile-header .mobile-menu-toggle span {
    position: relative;
  }

  .header.mobile-header .mobile-menu-toggle span::before,
  .header.mobile-header .mobile-menu-toggle span::after {
    left: 0;
    position: absolute;
  }

  .header.mobile-header .mobile-menu-toggle span::before {
    top: -6px;
  }

  .header.mobile-header .mobile-menu-toggle span::after {
    top: 6px;
  }

  .header.mobile-header .mobile-menu-toggle[aria-expanded="true"] span {
    background: transparent;
  }

  .header.mobile-header .mobile-menu-toggle[aria-expanded="true"] span::before {
    top: 0;
    transform: rotate(45deg);
  }

  .header.mobile-header .mobile-menu-toggle[aria-expanded="true"] span::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .header.mobile-header .nav-links {
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.14);
    display: grid;
    gap: 0.25rem;
    min-width: min(15rem, calc(100vw - 3rem));
    opacity: 0;
    padding: 0.45rem;
    pointer-events: none;
    position: absolute;
    right: 1rem;
    top: calc(100% + 0.45rem);
    transform: translateY(-6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 150;
  }

  .header.mobile-header.menu-open .nav-links {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .header.mobile-header .nav-links a {
    font-size: 0.88rem;
    border-radius: 10px;
    display: block;
    padding: 0.62rem 0.75rem;
    text-align: left;
    white-space: nowrap;
  }

  .header.mobile-header .nav-links a.active {
    background: rgba(0, 102, 204, 0.1);
    color: var(--accent);
    opacity: 1;
  }

  html.dark .header.mobile-header .mobile-menu-toggle {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.14);
  }

  html.dark .header.mobile-header .nav-links {
    background: transparent;
    border-color: transparent;
  }

  .header.mobile-header .container {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .header.mobile-header nav {
    grid-column: 2;
    justify-self: center;
  }

  .header.mobile-header .header-actions {
    grid-column: 3;
  }

  .header.mobile-header .mobile-menu-toggle {
    display: none;
  }

  .header.mobile-header .nav-links {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    gap: clamp(0.8rem, 2vw, 1.4rem);
    min-width: 0;
    opacity: 1;
    padding: 0;
    pointer-events: auto;
    position: static;
    transform: none;
  }

  .header.mobile-header .nav-links a {
    background: transparent;
    border-radius: 0;
    display: inline;
    font-size: 0.78rem;
    padding: 0;
    text-align: center;
  }

  .header.mobile-header .nav-links a.active {
    background: transparent;
    color: inherit;
  }
}
