@import url("/assets/css/site.css");

:root {
      --black: #302E2F;
      --navy: #353E50;
      --gray: #787D86;
      --light-gray: #BBBCBC;
      --white: #F1F2F2;
      --panel: rgba(241, 242, 242, 0.82);
      --panel-strong: rgba(255, 255, 255, 0.78);
      --line: rgba(48, 46, 47, 0.18);
      --shadow: 0 18px 55px rgba(48, 46, 47, 0.12);
      --soft-shadow: 0 9px 26px rgba(48, 46, 47, 0.08);
      --node-width: 252px;
      --node-height: 76px;
      --footer-tile-size: 236px;
    }

    * { box-sizing: border-box; }

    html, body { min-height: 100%; }

    body {
      margin: 0;
      font-family: "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
      background: var(--white);
      color: var(--black);
      overflow: hidden;
    }

    button, input { font: inherit; }

    button { color: inherit; }

    .page {
      position: relative;
      isolation: isolate;
      min-height: 100svh;
      overflow: hidden;
      background:
        radial-gradient(circle at 48% 11%, rgba(255,255,255,0.9), rgba(255,255,255,0) 34%),
        linear-gradient(to bottom, rgba(255,255,255,0.24), rgba(255,255,255,0));
    }

    .page::after {
      content: "";
      position: absolute;
      z-index: 0;
      inset: auto 0 0;
      height: clamp(92px, 13vh, 148px);
      pointer-events: none;
      background-image:
        repeating-linear-gradient(90deg, rgba(120,125,134,0.15) 0 1px, transparent 1px 118px),
        repeating-linear-gradient(0deg, rgba(120,125,134,0.11) 0 1px, transparent 1px 118px);
      mask-image: linear-gradient(to bottom, transparent, black);
      -webkit-mask-image: linear-gradient(to bottom, transparent, black);
    }

    .topbar {
      position: relative;
      z-index: 10;
      display: grid;
      grid-template-columns: minmax(132px, 190px) minmax(280px, 660px) auto;
      align-items: start;
      gap: 20px;
      padding: var(--site-header-top) var(--site-gutter) 0;
      pointer-events: none;
    }

    .logo-link,
    .search-shell,
    .toolbar-actions,
    .tree-header-nav,
    .toggle-wrap { pointer-events: auto; }

    .logo-link {
      display: inline-flex;
      align-items: center;
      width: fit-content;
      min-height: var(--site-nav-height);
      text-decoration: none;
    }

    .logo {
      display: block;
      width: var(--site-logo-width);
      height: auto;
    }

    .search-shell {
      position: relative;
      justify-self: stretch;
    }

    .search-bar {
      height: 58px;
      display: flex;
      align-items: center;
      gap: 13px;
      border: 2.5px solid var(--light-gray);
      border-radius: 999px;
      background: rgba(241, 242, 242, 0.83);
      padding: 0 19px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78), var(--soft-shadow);
      backdrop-filter: blur(13px);
      -webkit-backdrop-filter: blur(13px);
      transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
    }

    .search-shell:focus-within .search-bar {
      border-color: rgba(53, 62, 80, 0.42);
      background: rgba(248, 249, 249, 0.9);
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82), 0 15px 36px rgba(48, 46, 47, 0.13);
    }

    .search-icon {
      flex: 0 0 auto;
      width: var(--site-icon-size);
      height: var(--site-icon-size);
      opacity: 0.72;
    }

    .search-input {
      width: 100%;
      min-width: 0;
      border: 0;
      outline: 0;
      background: transparent;
      color: var(--black);
      font-size: 1rem;
      font-weight: 700;
      letter-spacing: -0.035em;
    }

    .search-input::placeholder {
      color: var(--gray);
      opacity: 1;
    }

    .suggestions {
      position: absolute;
      z-index: 20;
      top: calc(100% + 10px);
      left: 0;
      right: 0;
      overflow: hidden;
      border: 2px solid rgba(187,188,188,0.74);
      border-radius: 24px;
      background: rgba(247, 248, 248, 0.94);
      box-shadow: var(--shadow);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      transform-origin: top;
      animation: pop-down 150ms ease both;
    }

    .suggestions[hidden] { display: none; }

    @keyframes pop-down {
      from { opacity: 0; transform: translateY(-5px) scale(0.985); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    .suggestion {
      width: 100%;
      border: 0;
      border-bottom: 1px solid rgba(120,125,134,0.12);
      display: grid;
      grid-template-columns: 34px 1fr auto;
      align-items: center;
      gap: 12px;
      padding: 12px 15px;
      background:
        linear-gradient(90deg, var(--node-color-soft, rgba(53,62,80,0.09)), rgba(255,255,255,0) 43%),
        transparent;
      text-align: left;
      cursor: pointer;
    }


    .suggestion-flag-cell {
      width: 32px;
      height: 32px;
      display: grid;
      place-items: center;
      background: transparent;
      box-shadow: none;
      border-radius: 0;
    }

    .suggestion-flag-cell .flag-frame {
      margin-left: 0;
    }

    .suggestion:last-child { border-bottom: 0; }

    .suggestion:hover,
    .suggestion.is-active {
      background:
        linear-gradient(90deg, var(--node-color-soft, rgba(53,62,80,0.12)), rgba(255,255,255,0) 48%),
        rgba(53, 62, 80, 0.065);
    }

    .suggestion-title {
      display: block;
      font-weight: 900;
      letter-spacing: -0.045em;
      line-height: 1.32;
      padding-bottom: 3px;
    }

    .suggestion-subtitle {
      display: block;
      margin-top: 1px;
      color: var(--gray);
      font-size: 0.79rem;
      font-weight: 700;
      letter-spacing: -0.025em;
      line-height: 1.3;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .type-pill {
      border-radius: 999px;
      padding: 6px 9px;
      background: rgba(48,46,47,0.065);
      color: var(--gray);
      font-size: 0.67rem;
      font-weight: 900;
      letter-spacing: -0.015em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .toolbar-actions {
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 10px;
      min-height: 58px;
    }

    .tree-map-link {
      min-height: var(--site-nav-height);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0 var(--site-nav-padding);
      border: 2px solid rgba(187,188,188,0.82);
      border-radius: 999px;
      background: rgba(241, 242, 242, 0.82);
      color: var(--black);
      font-size: var(--site-nav-font-size);
      font-weight: 850;
      letter-spacing: -0.025em;
      line-height: 1;
      text-decoration: none;
      box-shadow: var(--soft-shadow), inset 0 1px 0 rgba(255,255,255,0.7);
    }

    .toggle-wrap {
      position: relative;
      display: inline-flex;
      align-items: center;
      gap: 7px;
    }

    .toggle {
      display: inline-flex;
      align-items: center;
      gap: 10px;
      border: 2px solid rgba(187,188,188,0.82);
      border-radius: 999px;
      background: rgba(241, 242, 242, 0.82);
      box-shadow: var(--soft-shadow), inset 0 1px 0 rgba(255,255,255,0.7);
      padding: 9px 13px 9px 9px;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      cursor: pointer;
      user-select: none;
    }

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

    .switch {
      position: relative;
      width: 41px;
      height: 24px;
      border-radius: 999px;
      background: var(--navy);
      box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
      transition: background 180ms ease;
    }

    .switch::after {
      content: "";
      position: absolute;
      top: 4px;
      left: 21px;
      width: 16px;
      height: 16px;
      border-radius: 50%;
      background: var(--white);
      box-shadow: 0 2px 6px rgba(0,0,0,0.22);
      transition: left 180ms ease;
    }

    .toggle input:not(:checked) + .switch { background: rgba(120,125,134,0.46); }
    .toggle input:not(:checked) + .switch::after { left: 4px; }

    .toggle-text {
      font-size: 0.83rem;
      font-weight: 900;
      letter-spacing: -0.035em;
      white-space: nowrap;
    }

    .conlang-help {
      position: relative;
      width: 22px;
      height: 22px;
      border: 2px solid rgba(187,188,188,0.8);
      border-radius: 999px;
      display: inline-grid;
      place-items: center;
      background: rgba(241,242,242,0.86);
      color: var(--gray);
      box-shadow: var(--soft-shadow), inset 0 1px 0 rgba(255,255,255,0.72);
      font-size: 0.72rem;
      font-weight: 900;
      line-height: 1;
      cursor: help;
      user-select: none;
      outline: none;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .conlang-help:hover,
    .conlang-help:focus-visible {
      border-color: rgba(53,62,80,0.4);
      color: var(--black);
      background: rgba(255,255,255,0.92);
    }

    .conlang-help::after {
      content: attr(data-tip);
      position: absolute;
      z-index: 30;
      top: calc(100% + 10px);
      right: 0;
      width: min(236px, calc(100vw - 28px));
      border: 2px solid rgba(187,188,188,0.7);
      border-radius: 18px;
      background: rgba(247,248,248,0.96);
      box-shadow: var(--shadow);
      color: var(--black);
      padding: 10px 12px;
      font-size: 0.76rem;
      font-weight: 800;
      line-height: 1.32;
      letter-spacing: -0.025em;
      text-align: left;
      opacity: 0;
      transform: translateY(-4px) scale(0.98);
      pointer-events: none;
      transition: opacity 140ms ease, transform 140ms ease;
    }

    .conlang-help:hover::after,
    .conlang-help:focus-visible::after {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    .tree-card {
      position: absolute;
      z-index: 2;
      inset: 102px clamp(14px, 2.3vw, 34px) clamp(14px, 2.3vw, 30px);
      border: 2px solid rgba(187,188,188,0.52);
      border-radius: 34px;
      overflow: hidden;
      background:
        linear-gradient(to bottom, rgba(255,255,255,0.58), rgba(255,255,255,0.18)),
        rgba(241, 242, 242, 0.55);
      box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,0.76);
    }

    .tree-viewport {
      position: absolute;
      inset: 0;
      cursor: grab;
      overflow: hidden;
      touch-action: none;
      background-image:
        radial-gradient(circle at center, rgba(53,62,80,0.13) 1px, transparent 1.4px),
        linear-gradient(to bottom, rgba(255,255,255,0.35), rgba(255,255,255,0));
      background-size: 28px 28px, auto;
      background-position: center;
    }

    .tree-viewport.is-dragging { cursor: grabbing; }

    .tree-world {
      position: absolute;
      left: 0;
      top: 0;
      width: 1000px;
      height: 1000px;
      transform-origin: 0 0;
      will-change: transform;
    }

    .connector-layer,
    .node-layer {
      position: absolute;
      inset: 0;
    }

    .connector-layer { overflow: visible; }

    .node-layer { pointer-events: none; }

    .connector {
      fill: none;
      stroke-linecap: round;
      stroke-linejoin: round;
      opacity: 0.78;
      filter: drop-shadow(0 3px 3px rgba(48,46,47,0.04));
    }

    .language-node {
      position: absolute;
      width: var(--node-width);
      min-height: var(--node-height);
      border: 2px solid rgba(187,188,188,0.66);
      border-radius: 22px;
      padding: 12px 14px 11px 12px;
      display: grid;
      grid-template-columns: 28px 1fr;
      align-items: center;
      gap: 11px;
      background:
        linear-gradient(90deg, var(--node-color-soft), rgba(255,255,255,0) 38%),
        rgba(249, 250, 250, 0.88);
      box-shadow: 0 10px 24px rgba(48,46,47,0.09), inset 0 1px 0 rgba(255,255,255,0.74);
      color: var(--black);
      text-align: left;
      cursor: pointer;
      pointer-events: auto;
      transform: translate(-50%, -50%);
      transition:
        border-color 150ms ease,
        box-shadow 150ms ease,
        background 150ms ease,
        filter 150ms ease,
        transform 150ms ease;
    }


    .language-node:hover {
      border-color: color-mix(in srgb, var(--node-color) 42%, var(--light-gray));
      box-shadow: 0 14px 34px rgba(48,46,47,0.13), 0 0 0 5px var(--node-color-glow), inset 0 1px 0 rgba(255,255,255,0.82);
      filter: saturate(1.03);
      transform: translate(-50%, -50%) translateY(-1px);
    }

    .language-node.is-selected {
      border-color: var(--node-color);
      box-shadow:
        0 17px 42px rgba(48,46,47,0.16),
        0 0 0 7px var(--node-color-glow),
        inset 0 1px 0 rgba(255,255,255,0.84);
      background:
        linear-gradient(90deg, var(--node-color-soft), rgba(255,255,255,0.16) 47%),
        rgba(255, 255, 255, 0.93);
    }

    .language-node.is-selected::after {
      content: "";
      position: absolute;
      inset: -2px;
      border-radius: inherit;
      pointer-events: none;
      border: 2px solid color-mix(in srgb, var(--node-color) 38%, transparent);
    }

    .language-node.is-selected .flag-frame,
    .language-node.is-selected .node-name {
      cursor: pointer;
    }

    .language-node.is-selected .flag-frame:hover {
      filter: brightness(1.05) saturate(1.08);
      transform: scale(1.06);
    }

    .language-node.is-selected .node-name:hover {
      text-decoration: underline;
      text-decoration-thickness: 2px;
      text-underline-offset: 3px;
    }

    .language-node.is-lineage:not(.is-selected) {
      border-color: color-mix(in srgb, var(--node-color) 35%, var(--light-gray));
      box-shadow: 0 12px 30px rgba(48,46,47,0.12), 0 0 0 4px var(--node-color-glow), inset 0 1px 0 rgba(255,255,255,0.78);
      background:
        linear-gradient(90deg, var(--node-color-soft), rgba(255,255,255,0.08) 42%),
        rgba(255, 255, 255, 0.9);
    }


    .connector.is-lineage {
      opacity: 0.95;
      filter: drop-shadow(0 4px 5px rgba(48,46,47,0.08));
    }


    .flag-frame {
      position: relative;
      z-index: 1;
      width: 26px;
      height: 26px;
      display: grid;
      place-items: center;
      margin-left: 3px;
      background: transparent;
      box-shadow: none;
      overflow: visible;
    }

    .flag-frame.has-flag {
      display: block;
      background: transparent;
      border: 0;
      border-radius: 0;
      box-shadow: none;
      overflow: hidden;
      -webkit-mask-image: url("/assets/flags/flag-cutout.svg");
      mask-image: url("/assets/flags/flag-cutout.svg");
      -webkit-mask-repeat: no-repeat;
      mask-repeat: no-repeat;
      -webkit-mask-position: center;
      mask-position: center;
      -webkit-mask-size: contain;
      mask-size: contain;
      -webkit-mask-mode: alpha;
      mask-mode: alpha;
    }

    .flag-frame.has-flag img {
      position: absolute;
      inset: 0;
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      border: 0;
      border-radius: 0;
      background: transparent;
      box-shadow: none;
    }

    .fallback-dot {
      width: 13px;
      height: 13px;
      border-radius: 999px;
      background: var(--node-color);
      box-shadow: 0 0 0 5px var(--node-color-glow);
    }

    .node-copy {
      min-width: 0;
      padding-block: 4px 2px;
    }

    .node-name {
      display: block;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      font-size: 0.98rem;
      font-weight: 900;
      letter-spacing: -0.052em;
      line-height: 1.34;
      padding-bottom: 3px;
    }

    .node-native {
      display: block;
      margin-top: 1px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      color: var(--gray);
      font-size: 0.75rem;
      font-weight: 700;
      letter-spacing: -0.018em;
      line-height: 1.32;
      padding-bottom: 2px;
    }

    .node-native.is-unknown,
    .suggestion-subtitle.is-unknown {
      overflow: visible;
      white-space: normal;
    }

    .native-name-help {
      position: relative;
      width: 19px;
      height: 19px;
      border: 2px solid rgba(187,188,188,0.8);
      border-radius: 999px;
      display: inline-grid;
      place-items: center;
      background: rgba(241,242,242,0.86);
      color: var(--gray);
      box-shadow: var(--soft-shadow), inset 0 1px 0 rgba(255,255,255,0.72);
      font-size: 0.62rem;
      font-weight: 900;
      line-height: 1;
      cursor: help;
      user-select: none;
      outline: none;
      vertical-align: middle;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .native-name-help:hover,
    .native-name-help:focus-visible {
      border-color: rgba(53,62,80,0.4);
      color: var(--black);
      background: rgba(255,255,255,0.92);
    }

    .native-name-help::after {
      content: attr(data-tip);
      position: absolute;
      z-index: 30;
      top: calc(100% + 10px);
      left: 0;
      width: max-content;
      max-width: min(236px, calc(100vw - 28px));
      border: 2px solid rgba(187,188,188,0.7);
      border-radius: 18px;
      background: rgba(247,248,248,0.96);
      box-shadow: var(--shadow);
      color: var(--black);
      padding: 10px 12px;
      font-size: 0.76rem;
      font-weight: 800;
      line-height: 1.32;
      letter-spacing: -0.025em;
      text-align: left;
      opacity: 0;
      transform: translateY(-4px) scale(0.98);
      pointer-events: none;
      transition: opacity 140ms ease, transform 140ms ease;
    }

    .native-name-help:hover::after,
    .native-name-help:focus-visible::after {
      opacity: 1;
      transform: translateY(0) scale(1);
    }

    .suggestion .native-name-help {
      width: 17px;
      height: 17px;
      font-size: 0.57rem;
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.72);
    }

    .suggestion .native-name-help::after {
      top: calc(100% + 8px);
      left: 50%;
      transform: translate(-50%, -4px) scale(0.98);
    }

    .suggestion .native-name-help:hover::after,
    .suggestion .native-name-help:focus-visible::after {
      transform: translate(-50%, 0) scale(1);
    }

    .node-meta {
      display: flex;
      align-items: center;
      gap: 6px;
      margin-top: 7px;
      min-width: 0;
    }

    .node-type {
      display: inline-flex;
      align-items: center;
      border-radius: 999px;
      padding: 3px 7px;
      background: rgba(48,46,47,0.06);
      color: var(--gray);
      font-size: 0.57rem;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.02em;
      line-height: 1;
    }


    .viewport-tools {
      position: absolute;
      z-index: 4;
      right: 18px;
      bottom: 18px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .tool-button {
      width: var(--site-icon-button-size);
      height: var(--site-icon-button-size);
      border: 2px solid rgba(187,188,188,0.75);
      border-radius: 999px;
      background: rgba(241,242,242,0.86);
      box-shadow: var(--soft-shadow), inset 0 1px 0 rgba(255,255,255,0.72);
      display: grid;
      place-items: center;
      font-size: 1.1rem;
      line-height: 1;
      font-weight: 900;
      cursor: pointer;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .tool-button.wide {
      width: auto;
      min-width: 66px;
      padding-inline: 14px;
      font-size: 0.77rem;
      letter-spacing: -0.02em;
      text-transform: uppercase;
    }

    .tool-button:hover {
      border-color: rgba(53,62,80,0.38);
      background: rgba(255,255,255,0.91);
    }

    .status-card {
      position: absolute;
      z-index: 4;
      left: 18px;
      bottom: 18px;
      max-width: min(360px, calc(100% - 136px));
      border: 2px solid rgba(187,188,188,0.62);
      border-radius: 24px;
      background: rgba(241,242,242,0.86);
      box-shadow: var(--soft-shadow), inset 0 1px 0 rgba(255,255,255,0.7);
      padding: 8px;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .status-toggle {
      width: 100%;
      min-width: 0;
      border: 0;
      border-radius: 18px;
      display: grid;
      grid-template-columns: 1fr auto;
      align-items: center;
      gap: 10px;
      padding: 5px 7px;
      background: transparent;
      color: inherit;
      text-align: left;
      cursor: pointer;
    }

    .status-toggle:hover,
    .status-toggle:focus-visible {
      outline: none;
      background: rgba(255,255,255,0.44);
    }

    .status-heading {
      min-width: 0;
      display: block;
    }

    .status-chevron {
      width: 24px;
      height: 24px;
      border-radius: 999px;
      display: grid;
      place-items: center;
      background: rgba(48,46,47,0.055);
      color: var(--gray);
      font-size: 0.78rem;
      font-weight: 900;
      transform: rotate(0deg);
      transition: transform 160ms ease, background 160ms ease;
    }

    .status-card.is-collapsed .status-chevron {
      transform: rotate(-90deg);
    }

    .status-body {
      padding: 0 7px 6px;
    }

    .status-card.is-collapsed .status-body {
      display: none;
    }

    .status-eyebrow {
      display: block;
      color: var(--gray);
      font-size: 0.67rem;
      font-weight: 900;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .status-title {
      display: block;
      margin-top: 3px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      font-size: 1.04rem;
      font-weight: 900;
      letter-spacing: -0.052em;
    }

    .status-subtitle {
      display: block;
      margin-top: 2px;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
      color: var(--gray);
      font-size: 0.78rem;
      font-weight: 700;
      letter-spacing: -0.02em;
    }

    .ancestry-list {
      display: block;
      margin-top: 10px;
      max-height: 138px;
      overflow: auto;
      padding: 2px 2px 1px;
      scrollbar-width: thin;
      scrollbar-color: rgba(120,125,134,0.28) transparent;
    }

    .ancestry-list[hidden] { display: none; }

    .ancestry-stack {
      display: grid;
      gap: 3px;
      margin: 0;
      padding: 0;
      list-style: none;
    }

    .ancestry-item {
      --depth-pad: calc(var(--depth, 0) * 13px);
      position: relative;
      min-width: 0;
      margin: 0;
      padding-left: var(--depth-pad);
    }

    .ancestry-item::before {
      content: "";
      position: absolute;
      left: calc(var(--depth-pad) - 7px);
      top: 50%;
      width: 7px;
      height: 1px;
      background: rgba(120,125,134,0.32);
      transform: translateY(-50%);
      opacity: calc(var(--depth, 0) * 1);
    }

    .ancestry-name {
      display: inline-flex;
      align-items: center;
      max-width: 100%;
      min-width: 0;
      border: 1px solid rgba(120,125,134,0.13);
      border-radius: 999px;
      background: rgba(255,255,255,0.48);
      color: var(--black);
      padding: 4px 8px 5px;
      font-size: 0.66rem;
      font-weight: 900;
      line-height: 1.1;
      letter-spacing: -0.018em;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .ancestry-item.is-current .ancestry-name {
      border-color: color-mix(in srgb, var(--node-color, var(--navy)) 34%, rgba(187,188,188,0.7));
      background: var(--node-color-soft, rgba(53,62,80,0.1));
      box-shadow: 0 0 0 3px var(--node-color-glow, rgba(53,62,80,0.1));
    }


    .empty-message {
      position: absolute;
      left: 50%;
      top: 50%;
      transform: translate(-50%, -50%);
      width: min(480px, calc(100% - 48px));
      text-align: center;
      color: var(--gray);
      font-weight: 800;
      letter-spacing: -0.03em;
    }

    .empty-message[hidden] { display: none; }

    @media (max-width: 980px) {
      body { overflow: hidden; }

      .topbar {
        grid-template-columns: 1fr auto;
        align-items: center;
        padding-top: var(--site-header-top);
      }

      .search-shell {
        grid-column: 1 / -1;
        grid-row: 2;
      }

      .toolbar-actions { min-height: auto; }

      .tree-card { inset-top: 154px; }
    }

    @media (max-width: 620px) {
      .topbar {
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 10px 12px;
        padding-inline: var(--site-gutter);
      }

      .logo { width: var(--site-logo-width); }

      .logo-link {
        grid-column: 1;
        grid-row: 1;
        min-height: var(--site-nav-height);
      }

      .search-shell {
        grid-column: 1 / -1;
        grid-row: 2;
      }

      .toolbar-actions {
        display: contents;
        position: static;
      }

      .tree-header-nav {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
      }

      .toggle-wrap {
        grid-column: 2;
        grid-row: 3;
        justify-self: end;
        gap: 5px;
      }
      .toggle { padding: 7px 9px 7px 7px; gap: 7px; }
      .toggle-text { display: inline; font-size: 0.74rem; }
      .conlang-help { width: 20px; height: 20px; font-size: 0.66rem; }

      .search-bar {
        height: 54px;
        border-width: 2px;
      }

      .tree-card {
        inset: 198px 10px 10px;
        border-radius: 25px;
      }

      .language-node {
        --node-width: 226px;
        padding-right: 12px;
      }

      .status-card {
        left: 0;
        right: 0;
        bottom: 0;
        width: auto;
        max-width: none;
        max-height: min(38svh, 242px);
        overflow: auto;
        border-inline: 0;
        border-bottom: 0;
        border-radius: 25px 25px 0 0;
        padding: 20px 12px 11px;
        background: rgba(247,248,248,0.93);
        box-shadow: 0 -18px 45px rgba(48,46,47,0.14), inset 0 1px 0 rgba(255,255,255,0.78);
        transform: translateY(0);
        animation: mobile-sheet-rise 220ms ease both;
      }

      .status-card::before {
        content: "";
        position: absolute;
        top: 9px;
        left: 50%;
        width: 42px;
        height: 5px;
        border-radius: 999px;
        background: rgba(120,125,134,0.35);
        transform: translateX(-50%);
      }

      .status-title,
      .status-subtitle {
        white-space: normal;
      }

      .ancestry-list {
        max-height: 112px;
        padding-bottom: 3px;
      }

      .ancestry-item {
        --depth-pad: calc(var(--depth, 0) * 10px);
      }

      .ancestry-name {
        max-width: calc(100vw - 44px - var(--depth-pad));
      }

      .viewport-tools {
        right: 12px;
        top: 12px;
        bottom: auto;
        gap: 6px;
      }

      .tool-button { width: 36px; height: 36px; }
      .tool-button.wide { display: none; }
    }

    @media (max-width: 440px) {
      .toggle-text { display: none; }
    }

    @keyframes mobile-sheet-rise {
      from { opacity: 0; transform: translateY(18px); }
      to { opacity: 1; transform: translateY(0); }
    }

    @media (prefers-reduced-motion: reduce) {
      *, *::before, *::after {
        animation: none !important;
        scroll-behavior: auto !important;
        transition: none !important;
      }
    }
