:root {
  --ink: #f4efe3;
  --muted: #cdb9da;
  --paper: #08070d;
  --surface: #15111d;
  --surface-2: #211529;
  --line: #4d365d;
  --green: #62d4bd;
  --green-2: #86f2d6;
  --gold: #fec630;
  --red: #fe69a5;
  --blue: #9a8eff;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.32);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background: linear-gradient(135deg, #08070d 0, #17101f 46%, #110612 100%);
  font-family: Arial, Helvetica, sans-serif;
}

body.has-open-modal {
  overflow: hidden;
}

[hidden] {
  display: none !important;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 18;
  display: grid;
  grid-template-columns: auto minmax(280px, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 8px 18px;
  background: rgba(10, 6, 14, 0.94);
  border-bottom: 1px solid rgba(244, 239, 227, 0.12);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: max-content;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(215, 168, 75, 0.55);
  border-radius: var(--radius);
  background: rgba(215, 168, 75, 0.12);
  color: var(--gold);
  box-shadow: 0 0 18px rgba(254, 198, 48, 0.18);
  font-family: "Times New Roman", serif;
  font-size: 24px;
  font-weight: 700;
}

.brand strong,
.brand small {
  display: block;
}

.brand small,
.app-header label,
.control-line span,
.entry-meta,
.factor-line,
.source-note {
  color: var(--muted);
}

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

.search-box {
  display: grid;
  gap: 7px;
  width: min(720px, 100%);
  min-width: 0;
  justify-self: stretch;
}

.search-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 44px;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14101b;
  box-shadow: inset 0 0 0 1px rgba(244, 239, 227, 0.02);
}

.search-row input,
.advanced-panel select,
.filters select,
.filter-controls input,
.filter-controls select,
.transliteration input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #14101b;
  color: var(--ink);
}

.search-row input {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.search-assist {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-height: 30px;
  padding: 5px 8px;
  border: 1px solid rgba(134, 242, 214, 0.34);
  border-radius: var(--radius);
  background: rgba(72, 162, 142, 0.12);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.search-assist-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(254, 198, 48, 0.18);
  color: var(--gold);
}

.search-assist-variants {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.search-assist-variants b {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  min-height: 24px;
  padding: 2px 6px;
  border: 1px solid rgba(134, 242, 214, 0.28);
  border-radius: 999px;
  color: var(--green-2);
  background: rgba(10, 6, 14, 0.52);
  font-size: 1rem;
}

.search-icon {
  display: grid;
  place-items: center;
  color: var(--green-2);
}

.search-row:focus-within,
.advanced-panel select:focus,
.filters select:focus,
.filter-controls input:focus,
.filter-controls select:focus,
.transliteration input:focus,
.calculator-pad textarea:focus {
  outline: 2px solid rgba(215, 168, 75, 0.45);
  outline-offset: 2px;
}

.search-row button,
.advanced-toggle,
.filter-toggle,
.ghost-button,
.transliteration button,
.drawer-close {
  border: 0;
  border-radius: var(--radius);
  background: var(--gold);
  color: #171611;
  font-weight: 800;
}

.nav-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.nav-tab,
.advanced-toggle,
.filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(244, 239, 227, 0.14);
  border-radius: var(--radius);
  color: rgba(244, 239, 227, 0.84);
  background: rgba(244, 239, 227, 0.06);
  box-shadow: 0 0 0 rgba(254, 105, 165, 0);
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(244, 239, 227, 0.14);
  border-radius: var(--radius);
  background: rgba(244, 239, 227, 0.06);
  color: var(--ink);
}

.filter-toggle {
  color: #171611;
  background: var(--green-2);
  border-color: rgba(134, 242, 214, 0.82);
}

.filter-toggle.has-active-filters {
  background: var(--gold);
  border-color: var(--gold);
}

.filter-toggle small {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  background: #171611;
  color: var(--gold);
  font-size: 0.72rem;
}

.icon {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-tab.is-active {
  color: #171611;
  background: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(254, 198, 48, 0.25);
}

.advanced-menu {
  position: relative;
}

.advanced-toggle {
  width: 38px;
  padding: 0;
}

.advanced-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 28;
  display: grid;
  gap: 12px;
  width: 270px;
  padding: 12px;
  border: 1px solid rgba(244, 239, 227, 0.14);
  border-radius: var(--radius);
  background: #14101b;
  box-shadow: var(--shadow);
}

.control-line {
  display: flex;
  align-items: center;
  gap: 9px;
}

.workspace {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  padding: 10px clamp(12px, 1.7vw, 24px) 24px;
}

.filter-panel {
  position: fixed;
  top: 58px;
  right: 22px;
  z-index: 34;
  display: grid;
  gap: 14px;
  width: min(980px, calc(100vw - 44px));
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 10, 20, 0.97);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.filter-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.filter-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(150px, 1fr)) repeat(2, minmax(100px, 0.6fr));
  gap: 10px;
}

.filter-controls label {
  display: grid;
  gap: 6px;
}

.filter-controls label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.filter-flags,
.filter-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-flags label,
.filter-chip,
.filter-empty {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(244, 239, 227, 0.06);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
}

.filter-flags label {
  gap: 7px;
}

.filter-chip {
  border-color: rgba(134, 242, 214, 0.48);
  color: var(--green-2);
  background: rgba(72, 162, 142, 0.15);
}

.filter-empty {
  color: var(--muted);
}

.top-strip,
.view-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(21, 17, 29, 0.92);
  box-shadow: var(--shadow);
}

.top-strip {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  opacity: 0.92;
}

.top-strip > div,
.panel-header > div,
.entry-main {
  min-width: 0;
}

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

h1,
h2,
h3 {
  overflow-wrap: anywhere;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.6rem, 2.5vw, 2.35rem);
  line-height: 1.1;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.hint {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border: 1px solid rgba(215, 168, 75, 0.5);
  border-radius: 50%;
  color: var(--gold);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 10px;
  min-width: min(468px, 100%);
}

.stat {
  min-height: 54px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14101b;
}

.stat-divine {
  border-color: rgba(215, 168, 75, 0.65);
  background: linear-gradient(180deg, rgba(215, 168, 75, 0.16), #191711);
}

.stat span {
  display: block;
  color: var(--green-2);
  font-size: 1.12rem;
  font-weight: 900;
}

.stat-divine span {
  color: var(--gold);
}

.view-panel {
  display: none;
  padding: 10px;
}

.view-panel.is-active {
  display: block;
}

.panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.map-panel-header {
  align-items: center;
}

.map-panel-header h1 {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 800;
}

.segmented {
  display: inline-grid;
  grid-template-columns: repeat(2, 92px);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14101b;
}

.segmented button {
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.segmented button.is-active {
  color: #171611;
  background: var(--green-2);
  box-shadow: 0 0 14px rgba(134, 242, 214, 0.22);
}

.map-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.value-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 8px;
  max-height: 72vh;
  overflow: auto;
  padding-right: 4px;
}

.value-chip {
  position: relative;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
}

.value-chip.has-entries {
  border-color: rgba(72, 162, 142, 0.58);
  background: linear-gradient(180deg, #26352f, #20261f);
}

.value-chip.is-selected {
  color: #171611;
  background: var(--gold);
  border-color: var(--gold);
}

.value-chip span {
  display: block;
  font-weight: 900;
}

.value-chip small {
  display: block;
  color: inherit;
  opacity: 0.72;
  font-size: 0.7rem;
}

.spiral-wrap {
  position: relative;
  height: clamp(520px, calc(100svh - 140px), 920px);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #050509;
  overflow: hidden;
  box-shadow: inset 0 0 36px rgba(254, 198, 48, 0.08), 0 0 22px rgba(254, 105, 165, 0.08);
}

#spiral-canvas {
  width: 100%;
  height: clamp(520px, calc(100svh - 140px), 920px);
  display: block;
  cursor: pointer;
}

.map-tools {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: inline-grid;
  grid-template-columns: 38px auto 38px 38px;
  gap: 6px;
  align-items: center;
  padding: 6px;
  border: 1px solid rgba(244, 239, 227, 0.12);
  border-radius: var(--radius);
  background: rgba(10, 6, 14, 0.72);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(12px);
}

.map-tools .icon-button {
  color: var(--green-2);
  background: rgba(244, 239, 227, 0.06);
}

.map-tools .icon-button:hover {
  color: #171611;
  background: var(--green-2);
}

.zoom-readout {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid rgba(244, 239, 227, 0.12);
  border-radius: var(--radius);
  color: var(--gold);
  background: rgba(244, 239, 227, 0.05);
  font-size: 0.86rem;
  font-weight: 900;
}

.selection-panel,
.calculator-results {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14101b;
  padding: 14px;
}

.selection-panel {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.selection-panel .same-value-list {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.same-value-list {
  display: grid;
  gap: 9px;
}

.mini-entry,
.entry-row,
.corpus-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--ink);
}

.mini-entry {
  display: grid;
  gap: 5px;
  width: 100%;
  padding: 10px;
  text-align: left;
}

.mini-entry:hover,
.mini-entry:focus-visible,
.entry-row:hover,
.entry-row:focus-visible,
.value-chip:hover,
.value-chip:focus-visible {
  border-color: rgba(134, 242, 214, 0.72);
  outline: none;
  box-shadow: 0 0 0 2px rgba(134, 242, 214, 0.12);
}

.hebrew {
  direction: rtl;
  unicode-bidi: isolate;
  font-family: "Times New Roman", "Noto Sans Hebrew", serif;
}

.mini-entry .hebrew,
.entry-row .hebrew {
  font-size: 1.65rem;
  font-weight: 800;
}

.entry-row {
  display: grid;
  grid-template-columns: 90px minmax(110px, 180px) minmax(0, 1fr) 34px;
  gap: 14px;
  align-items: center;
  padding: 12px;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.entry-row:hover {
  transform: translateY(-1px);
}

.entry-divine {
  border-color: rgba(215, 168, 75, 0.82);
  background: linear-gradient(90deg, rgba(254, 198, 48, 0.18), var(--surface-2) 44%);
  box-shadow: 0 0 12px rgba(254, 198, 48, 0.12);
}

.entry-kabbalistic:not(.entry-divine) {
  border-color: rgba(72, 162, 142, 0.62);
  background: linear-gradient(90deg, rgba(254, 105, 165, 0.14), var(--surface-2) 44%);
}

.entry-transliteration-match:not(.entry-divine) {
  border-color: rgba(254, 198, 48, 0.54);
}

.entries-table {
  display: grid;
  gap: 10px;
}

.value-pill,
.tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(72, 162, 142, 0.17);
  color: var(--green-2);
  font-weight: 900;
}

.entry-open {
  display: grid;
  place-items: center;
  justify-self: end;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(134, 242, 214, 0.34);
  border-radius: var(--radius);
  background: rgba(134, 242, 214, 0.08);
  color: var(--green-2);
}

.match-line {
  display: block;
  margin-top: 5px;
  color: var(--gold);
  font-weight: 800;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.entry-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(215, 168, 75, 0.16);
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 800;
}

.entry-kabbalistic:not(.entry-divine) .entry-badge {
  background: rgba(72, 162, 142, 0.18);
  color: var(--green-2);
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
}

.calculator-pad textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #14101b;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1.45;
}

.ghost-button {
  min-height: 36px;
  padding: 8px 12px;
  background: #211529;
  color: var(--gold);
}

.keyboard {
  display: grid;
  grid-template-columns: repeat(11, minmax(36px, 1fr));
  gap: 7px;
  margin-top: 12px;
}

.keyboard button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--green-2);
  font-size: 1.25rem;
  font-weight: 800;
}

.transliteration {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 98px;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
}

.transliteration button {
  min-height: 40px;
}

.result-number {
  display: grid;
  place-items: center;
  min-height: 136px;
  border-radius: var(--radius);
  color: #171611;
  background: linear-gradient(135deg, var(--gold), var(--green-2));
}

.result-number span {
  font-size: 3rem;
  font-weight: 900;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.metric {
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14101b;
}

.metric strong {
  display: block;
  color: var(--green-2);
}

.breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 12px;
}

.letter-token {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.letter-token strong {
  font-size: 1.25rem;
}

.corpus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.corpus-card {
  padding: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.tag {
  min-height: 24px;
  background: rgba(215, 168, 75, 0.16);
  color: var(--gold);
  font-size: 0.75rem;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(3, 2, 5, 0.72);
  backdrop-filter: blur(4px);
}

.detail-drawer {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 36;
  width: min(780px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #14101b;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.62);
  transform: translate(-50%, -50%);
}

.drawer-close {
  position: sticky;
  top: 0;
  float: right;
  width: 38px;
  height: 38px;
  font-size: 1.25rem;
}

.drawer-word {
  margin-top: 22px;
  color: var(--gold);
  font-size: 3rem;
}

.drawer-head {
  display: grid;
  gap: 4px;
  max-width: calc(100% - 50px);
}

.drawer-section {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid rgba(244, 239, 227, 0.12);
}

.relation-list {
  display: grid;
  gap: 14px;
}

.detail-drawer .same-value-list {
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.relation-block h4 {
  margin: 0 0 4px;
  color: var(--green-2);
  font-size: 0.95rem;
}

.relation-block > small {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
}

.source-link {
  color: var(--blue);
  font-weight: 800;
}

.corpus-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 12px;
}

.corpus-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(244, 239, 227, 0.06);
  font-size: 0.78rem;
  font-weight: 800;
}

.corpus-chip.is-hit {
  border-color: rgba(72, 162, 142, 0.6);
  color: var(--green-2);
  background: rgba(72, 162, 142, 0.16);
}

.empty-state {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(244, 239, 227, 0.06);
}

@media (max-width: 980px) {
  .app-header,
  .map-layout,
  .calculator-layout {
    grid-template-columns: 1fr;
  }

  .app-header {
    position: static;
    align-items: stretch;
  }

  .brand {
    justify-self: start;
  }

  .nav-tabs {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .filter-toggle {
    justify-self: stretch;
  }

  .filter-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-panel {
    top: 14px;
    right: 14px;
    left: 14px;
    width: auto;
    max-height: calc(100vh - 28px);
  }

  .advanced-menu {
    position: absolute;
    top: 12px;
    right: 16px;
  }

  .top-strip {
    flex-direction: column;
  }

  .stat-row,
  .corpus-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .entry-row {
    grid-template-columns: 72px minmax(100px, 1fr) 34px;
  }

  .entry-row .entry-main {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .workspace,
  .app-header {
    padding: 14px;
  }

  .nav-tabs {
    gap: 6px;
  }

  .nav-tab {
    min-width: max-content;
  }

  .panel-header {
    flex-direction: column;
    align-items: stretch;
  }

  .segmented {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }

  .brand small {
    display: none;
  }

  .top-strip h1 {
    max-width: calc(100vw - 88px);
  }

  .top-strip h1 span {
    display: block;
  }

  .search-row {
    grid-template-columns: 38px minmax(0, 1fr) 40px;
  }

  .filter-controls {
    grid-template-columns: 1fr;
  }

  .map-tools {
    top: 10px;
    right: 10px;
    grid-template-columns: 38px auto 38px 38px;
  }

  .map-tools .icon-button {
    width: 38px;
    height: 38px;
  }

  .zoom-readout {
    min-width: 50px;
    min-height: 38px;
  }

  .selection-panel {
    grid-template-columns: 1fr;
  }

  .value-grid {
    grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
  }

  .stat-row,
  .corpus-grid,
  .metric-grid,
  .transliteration {
    grid-template-columns: 1fr;
  }

  .keyboard {
    grid-template-columns: repeat(6, minmax(34px, 1fr));
  }

  .detail-drawer {
    width: calc(100vw - 20px);
    max-height: calc(100vh - 20px);
    padding: 18px;
  }
}
