/* =============================================================================
   SCALE — light studio theme
   ========================================================================== */
:root {
  --bg: #eef3fa;
  --ink: #16202e;
  --ink-2: #46586b;
  --ink-3: #7b8a9c;
  --line: rgba(22, 32, 46, .10);
  --card: rgba(255, 255, 255, .76);
  --accent: #2f6bff;
  --tone-a: #2f6bff;
  --tone-b: #12a594;
  --tone-c: #e0503f;
  --shadow: 0 18px 50px -20px rgba(24, 44, 80, .32), 0 2px 10px rgba(24, 44, 80, .06);
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#gl {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: none;
  cursor: grab;
}
#gl:active { cursor: grabbing; }

/* --------------------------------------------------------------- warp flash */
#warp {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  opacity: 0;
  background:
    radial-gradient(120% 90% at 50% 50%, rgba(255,255,255,.98) 0%, rgba(226,238,255,.92) 42%, rgba(176,204,246,.55) 78%, rgba(150,185,240,0) 100%);
  transition: opacity .08s linear;
}

/* ----------------------------------------------------------------- vignette */
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 3;
  background: radial-gradient(135% 105% at 50% 44%,
    rgba(255,255,255,0) 40%,
    rgba(74,106,160,.055) 76%,
    rgba(52,84,140,.105) 100%);
}

/* ------------------------------------------------------------- annotations */
#anno-layer { position: fixed; inset: 0; pointer-events: none; z-index: 4; }

.anno {
  position: absolute; left: 0; top: 0; width: 0; height: 0;
  will-change: transform, opacity;
  transition: opacity .2s linear;
}
.anno-dot {
  position: absolute; left: -4px; top: -4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff;
  border: 2px solid var(--tone-a);
  box-shadow: 0 0 0 3px rgba(47, 107, 255, .14);
}
.anno.tone-b .anno-dot { border-color: var(--tone-b); box-shadow: 0 0 0 3px rgba(18,165,148,.14); }
.anno.tone-c .anno-dot { border-color: var(--tone-c); box-shadow: 0 0 0 3px rgba(224,80,63,.14); }

.anno-text {
  position: absolute; left: 16px; top: 0;
  transform: translateY(-50%);
  white-space: nowrap;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  color: var(--ink);
  background: rgba(255,255,255,.86);
  border: 1px solid rgba(255,255,255,.95);
  box-shadow: 0 4px 14px -6px rgba(24,44,80,.35);
  padding: 3px 9px; border-radius: 999px;
  backdrop-filter: blur(8px);
}
.anno-text::before {
  content: ""; position: absolute; left: -16px; top: 50%;
  width: 16px; height: 1.5px; background: rgba(22,32,46,.28);
}
.anno.flip .anno-text { left: auto; right: 16px; }
.anno.flip .anno-text::before { left: auto; right: -16px; }

/* ------------------------------------------------------------------ topbar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 68px; z-index: 6;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 26px;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: conic-gradient(from 210deg, #2f6bff, #12a594, #e0503f, #7a6bd8, #2f6bff);
  box-shadow: 0 6px 16px -6px rgba(47,107,255,.7);
}
.brand-title {
  font-size: 15px; font-weight: 800; letter-spacing: .18em; line-height: 1;
}
.brand-sub { font-size: 10.5px; color: var(--ink-3); letter-spacing: .06em; margin-top: 3px; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.counter {
  font-variant-numeric: tabular-nums;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  background: var(--card); border: 1px solid rgba(255,255,255,.9);
  box-shadow: var(--shadow);
  padding: 7px 13px; border-radius: 999px;
  backdrop-filter: blur(14px);
}
.counter .sep { color: var(--ink-3); margin: 0 2px; font-weight: 500; }
.counter #lv-total { color: var(--ink-3); font-weight: 600; }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.9);
  background: var(--card); color: var(--ink-2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  font-size: 15px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
  transition: transform .16s ease, color .16s ease, background .16s ease;
}
.icon-btn:hover { transform: translateY(-1px); color: var(--ink); }
.icon-btn:active { transform: translateY(0) scale(.95); }
.icon-btn.on { color: #fff; background: var(--accent); border-color: transparent; }

/* --------------------------------------------------------- language switch
   A two-segment pill: the inactive segment is plain ink, the active one takes
   the brand blue. main.js fills the inner spans and toggles `.on`. */
.lang-switch {
  display: flex; align-items: center; gap: 2px;
  height: 36px; padding: 3px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.9);
  background: var(--card); color: var(--ink-2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  cursor: pointer;
  transition: transform .16s ease, color .16s ease;
}
.lang-switch:hover { transform: translateY(-1px); }
.lang-switch:active { transform: translateY(0) scale(.97); }
.lang-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.lang-switch span {
  display: grid; place-items: center;
  min-width: 34px; height: 28px; padding: 0 9px;
  border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  color: var(--ink-3);
  white-space: nowrap;
  transition: background .18s ease, color .18s ease;
}
.lang-switch span:hover { color: var(--ink); }
.lang-switch span.on {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 14px -7px color-mix(in srgb, var(--accent) 85%, transparent);
}

/* ------------------------------------------------------------------- panel */
.panel {
  position: fixed; left: 24px; top: 88px; width: 344px; z-index: 6;
  background: var(--card);
  border: 1px solid rgba(255,255,255,.92);
  border-top: 3px solid var(--accent);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.5);
  padding: 20px 22px 18px;
  max-height: calc(100vh - 250px);
  overflow-y: auto;
  overscroll-behavior: contain;
  transition: opacity .3s ease, transform .3s ease;
}
.panel.hidden { opacity: 0; transform: translateX(-16px); pointer-events: none; }
.panel::-webkit-scrollbar { width: 6px; }
.panel::-webkit-scrollbar-thumb { background: rgba(22,32,46,.16); border-radius: 3px; }

.panel-kind {
  display: inline-block;
  font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 4px 9px; border-radius: 6px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.panel-toggle {
  display: none; align-items: center; gap: 5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.56); color: var(--ink-2);
  padding: 5px 8px; font: inherit; font-size: 10px; font-weight: 700;
  cursor: pointer;
}
.panel-toggle-icon { font-size: 14px; line-height: .7; transition: transform .2s ease; }
.panel-name {
  font-size: 27px; font-weight: 800; letter-spacing: -.02em;
  margin: 12px 0 8px; line-height: 1.08;
}
.panel-scale {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  margin-bottom: 14px;
}
.panel-scale .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.panel-blurb { font-size: 13.5px; line-height: 1.62; color: var(--ink-2); margin: 0 0 14px; }
.compare {
  font-size: 12.5px; line-height: 1.5; font-style: italic; color: var(--ink-3);
  border-left: 2px solid var(--accent);
  padding: 2px 0 2px 11px; margin-bottom: 16px;
}
.facts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.facts li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding: 8px 0; border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.facts li span { color: var(--ink-3); flex: none; }
.facts li b {
  font-weight: 600; color: var(--ink); text-align: right;
  font-variant-numeric: tabular-nums;
}
.panel.swap { animation: swapIn .42s cubic-bezier(.22,.9,.3,1); }
@keyframes swapIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.panel.swap .panel-name,
.panel.swap .panel-kind { animation: none; }

/* -------------------------------------------------------------------- rail */
.rail {
  position: fixed; right: 26px; top: 50%; transform: translateY(-50%);
  z-index: 6;
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 12px 0;
}
.rail::before {
  content: ""; position: absolute; right: 4px; top: 22px; bottom: 22px;
  width: 1.5px; background: linear-gradient(180deg,
      rgba(47,107,255,.05), rgba(22,32,46,.16) 18%, rgba(22,32,46,.16) 82%, rgba(122,107,216,.05));
  border-radius: 2px;
}
.rail-item {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: flex-end; gap: 11px;
  background: none; border: 0; padding: 6px 0; margin: 0;
  cursor: pointer; font-family: inherit;
}
.rail-dot {
  width: 9px; height: 9px; border-radius: 50%; flex: none;
  background: #c2cfdd; border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(24,44,80,.2);
  transition: transform .22s ease, background .22s ease, box-shadow .22s ease;
}
.rail-item.passed .rail-dot { background: #93a7bd; }
.rail-item:hover .rail-dot { transform: scale(1.28); background: #8fa8c8; }
.rail-item.active .rail-dot {
  background: var(--accent); transform: scale(1.42);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent);
}
.rail-label {
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  opacity: 0; transform: translateX(7px);
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
}
.rail-item:hover .rail-label,
.rail-item.active .rail-label { opacity: 1; transform: none; }
.rail-label b { font-size: 11.5px; font-weight: 650; color: var(--ink); }
.rail-label i {
  font-style: normal; font-size: 10px; color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}
.rail-item.active .rail-label b { color: var(--accent); }

/* -------------------------------------------------------------------- dock */
.dock {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 6;
  display: flex; align-items: center; gap: 12px;
  background: var(--card);
  border: 1px solid rgba(255,255,255,.92);
  border-radius: 999px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(1.5);
  padding: 7px 9px;
}
.nav-btn {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; border-radius: 999px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 650;
  padding: 9px 17px;
  background: rgba(22,32,46,.05); color: var(--ink-2);
  transition: background .16s ease, color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.nav-btn:hover:not(:disabled) { background: rgba(22,32,46,.09); color: var(--ink); }
.nav-btn:active:not(:disabled) { transform: scale(.97); }
.nav-btn:disabled { opacity: .35; cursor: default; }
.nav-btn .arrow { font-size: 13px; line-height: 1; }
.nav-btn.primary {
  background: linear-gradient(180deg, #3d78ff, var(--accent));
  color: #fff;
  box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.nav-btn.primary:hover { filter: brightness(1.06); background: linear-gradient(180deg, #4a83ff, var(--accent)); color: #fff; }
.hint {
  font-size: 11px; color: var(--ink-3); letter-spacing: .01em;
  padding: 0 6px; max-width: 260px; text-align: center; line-height: 1.35;
}

/* --------------------------------------------------------------- scale bar */
.scalebar {
  position: fixed; left: 26px; bottom: 30px; z-index: 6;
  pointer-events: none;
}
.scalebar-line {
  height: 10px; width: 120px;
  border: 1.5px solid var(--ink-2);
  border-top: 0;
  transition: width .1s linear;
  position: relative;
}
.scalebar-line::before,
.scalebar-line::after {
  content: ""; position: absolute; top: 0; width: 1.5px; height: 5px;
  background: var(--ink-2);
}
.scalebar-line::before { left: 0; }
.scalebar-line::after { right: 0; }
.scalebar-label {
  margin-top: 5px; font-size: 11px; font-weight: 700; color: var(--ink-2);
  font-variant-numeric: tabular-nums; letter-spacing: .02em;
}

/* ------------------------------------------------------------------- toast */
#toast {
  position: fixed; left: 50%; bottom: 92px; transform: translate(-50%, 10px);
  z-index: 8;
  background: rgba(22,32,46,.92); color: #fff;
  font-size: 12.5px; font-weight: 500;
  padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  box-shadow: 0 12px 30px -10px rgba(24,44,80,.5);
  max-width: 78vw; text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- fallback */
#fallback {
  position: fixed; inset: 0; z-index: 20; display: none;
  place-items: center; text-align: center;
  background: var(--bg); padding: 40px;
}
#fallback.show { display: grid; }
#fallback h1 { font-size: 20px; margin: 0 0 10px; }
#fallback p { font-size: 13.5px; color: var(--ink-2); max-width: 520px; line-height: 1.6; margin: 0 auto 8px; }
#fallback code {
  display: inline-block; margin-top: 12px; padding: 10px 14px; border-radius: 10px;
  background: #fff; border: 1px solid var(--line); font-size: 12.5px;
}

/* -------------------------------------------------------------- responsive */
@media (max-width: 1120px) {
  .panel { width: 312px; }
  .hint { display: none; }
}
@media (max-width: 900px) {
  .rail { right: 14px; }
  .rail-label { display: none; }
  .rail-item.active .rail-label {
    display: flex; position: absolute; right: 22px; top: 50%;
    transform: translateY(-50%);
  }
}
@media (max-width: 760px) {
  .panel {
    left: 12px; right: 12px; top: auto;
    bottom: calc(80px + env(safe-area-inset-bottom)); width: auto;
    max-height: min(38dvh, 320px); padding: 14px 16px 12px;
  }
  .panel-name { font-size: 20px; margin: 8px 0 5px; }
  .panel-toggle { display: inline-flex; }
  .panel.collapsed .panel-toggle-icon { transform: rotate(180deg); }
  .panel.collapsed #panel-content { display: none; }
  .panel-scale { margin-bottom: 10px; }
  .panel-blurb { font-size: 12px; line-height: 1.5; margin-bottom: 10px; }
  .compare { margin-bottom: 10px; }
  .links { gap: 5px; margin-bottom: 10px; }
  .link-row { padding: 6px 8px; }
  .facts li { padding: 6px 0; }
  .brand-sub { display: none; }
  .dock {
    bottom: calc(10px + env(safe-area-inset-bottom));
    gap: 6px; padding: 6px;
  }
  .nav-btn { padding: 9px 11px; font-size: 12px; white-space: nowrap; }
  .scalebar { display: none; }
  .rail { display: none; }
  .anno-text { font-size: 10.5px; padding: 2px 7px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =============================================================================
   Connections between adjacent levels
   The door ring (canvas), its pill, the containment trail, the transition
   ribbon, the panel link rows, and the ratio rungs on the rail.
   ========================================================================== */

/* ------------------------------------------------------- containment trail */
.trail {
  position: fixed; top: 19px; left: 50%; transform: translateX(-50%);
  z-index: 6;
  display: flex; align-items: center;
  max-width: min(680px, 44vw);
  pointer-events: none;
}
.trail > * { pointer-events: auto; }

.trail-chip {
  border: 1px solid rgba(255,255,255,.9);
  background: rgba(255,255,255,.68);
  box-shadow: 0 4px 14px -9px rgba(24,44,80,.45);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 5px 11px; margin: 0;
  font-family: inherit; font-size: 11.5px; font-weight: 650;
  color: var(--ink-3); white-space: nowrap; cursor: pointer;
  transition: color .16s ease, transform .16s ease, background .16s ease;
}
.trail-chip.up { color: var(--ink-2); }
.trail-chip.down { color: var(--ink-3); border-style: dashed; }
.trail-chip.cur {
  color: #fff; font-weight: 700;
  background: var(--accent); border-color: transparent;
  box-shadow: 0 8px 18px -9px color-mix(in srgb, var(--accent) 85%, transparent);
}
.trail-chip:hover { transform: translateY(-1px); color: var(--ink); }
.trail-chip.cur:hover { color: #fff; }

.trail-sep {
  font-size: 9.5px; font-weight: 800; letter-spacing: .03em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  background: rgba(255,255,255,.6);
  border-radius: 999px;
  padding: 2px 7px; margin: 0 3px;
  white-space: nowrap;
}
.trail-more {
  font-size: 9.5px; font-weight: 700; font-style: italic;
  color: var(--ink-3);
  padding: 0 7px 0 2px;
  white-space: nowrap;
}

/* ------------------------------------------------------------- door pill */
#door-layer { position: fixed; inset: 0; pointer-events: none; z-index: 4; }

#door-pill {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; gap: 9px;
  border: 1px solid rgba(255,255,255,.95);
  border-left: 3px solid var(--door-accent, var(--accent));
  border-radius: 12px;
  background: rgba(255,255,255,.9);
  box-shadow: 0 10px 26px -13px rgba(24,44,80,.55);
  backdrop-filter: blur(12px);
  padding: 7px 12px 7px 10px;
  cursor: pointer; font-family: inherit; text-align: left;
  opacity: 0; pointer-events: none;
  will-change: transform;
  transition: opacity .22s ease, box-shadow .16s ease, filter .16s ease;
}
#door-pill.show { opacity: 1; pointer-events: auto; }
#door-pill:hover { filter: brightness(1.03); box-shadow: 0 15px 32px -13px rgba(24,44,80,.62); }
#door-pill.flip {
  border-left: 1px solid rgba(255,255,255,.95);
  border-right: 3px solid var(--door-accent, var(--accent));
}

.dp-ico {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 12px; line-height: 1; color: #fff;
  background: var(--door-accent, var(--accent));
  animation: doorNudge 1.7s ease-in-out infinite;
}
@keyframes doorNudge {
  0%, 100% { transform: translateY(-1px); }
  50% { transform: translateY(1.5px); }
}
.dp-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.dp-name { font-size: 12.5px; font-weight: 750; color: var(--ink); line-height: 1.15; }
.dp-hook { font-style: normal; font-size: 10.5px; color: var(--ink-3); line-height: 1.2; }
.dp-ratio {
  flex: none; font-size: 10px; font-weight: 750;
  color: var(--door-accent, var(--accent));
  background: color-mix(in srgb, var(--door-accent, var(--accent)) 12%, transparent);
  padding: 3px 7px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* --------------------------------------------------------- transition ribbon */
#ribbon {
  position: fixed; left: 50%; bottom: 106px;
  transform: translate(-50%, 14px);
  z-index: 7; pointer-events: none;
  text-align: center;
  max-width: min(780px, 88vw);
  opacity: 0;
  transition: opacity .34s ease, transform .34s cubic-bezier(.22,.9,.3,1);
}
#ribbon.show { opacity: 1; transform: translate(-50%, 0); }

.rb-line {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(255,255,255,.95);
  border-radius: 999px;
  box-shadow: 0 14px 34px -17px rgba(24,44,80,.55);
  backdrop-filter: blur(14px);
  padding: 7px 14px;
}
.rb-side { font-size: 12.5px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.rb-mid {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; color: #fff;
  background: var(--door-accent, var(--accent));
  padding: 3px 9px; border-radius: 999px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.rb-mid i { font-style: normal; }
.rb-rel {
  display: inline-block; margin-top: 8px;
  font-size: 11.5px; line-height: 1.5; color: var(--ink-2);
  background: rgba(255,255,255,.84);
  border: 1px solid rgba(255,255,255,.9);
  border-radius: 10px;
  padding: 6px 13px;
  box-shadow: 0 8px 22px -15px rgba(24,44,80,.5);
  backdrop-filter: blur(10px);
}

/* ------------------------------------------------------------ panel links */
.links { display: flex; flex-direction: column; gap: 6px; margin: 0 0 16px; }

.link-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255,255,255,.5);
  padding: 7px 9px; margin: 0;
  cursor: pointer; font-family: inherit; text-align: left;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}
.link-row:hover:not(.off) {
  background: #fff;
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  transform: translateX(1px);
}
.link-row.off { cursor: default; opacity: .48; }

.lr-key {
  flex: none; width: 47px;
  font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3);
}
.link-row.down .lr-key { color: var(--accent); }

.lr-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.lr-body b {
  font-size: 12px; font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lr-body i {
  font-style: normal; font-size: 10.5px; color: var(--ink-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lr-ratio {
  flex: none; font-size: 10px; font-weight: 750; color: var(--ink-2);
  background: rgba(22,32,46,.06);
  padding: 2px 6px; border-radius: 6px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.link-row.down .lr-ratio { color: var(--accent); }

/* -------------------------------------------------------------- rail rungs */
.rail-edge {
  position: relative; z-index: 1;
  display: flex; justify-content: flex-end;
  padding: 2px 0;
}
.rail-edge span {
  font-size: 8.5px; font-weight: 800; letter-spacing: .03em;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 5px;
  white-space: nowrap;
  /* sit the chip centred on the ladder line */
  transform: translateX(calc(50% - 4.5px));
  transition: color .18s ease, border-color .18s ease;
}
.rail-edge.passed span { color: #93a7bd; }
.rail-edge:hover span {
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

/* -------------------------------------------------------- connections: narrow */
@media (max-width: 1240px) {
  .trail { max-width: 40vw; }
  .trail-more { display: none; }
}
@media (max-width: 980px) {
  .trail { display: none; }
}
@media (max-width: 760px) {
  #door-pill { padding: 6px 10px 6px 8px; gap: 7px; border-radius: 10px; }
  .dp-hook { display: none; }
  #ribbon { bottom: 92px; }
  .rb-rel { font-size: 10.5px; padding: 5px 10px; }
  .lr-key { width: 40px; }
}

/* --------------------------------------------------- language switch: narrow */
@media (max-width: 620px) {
  .topbar { padding: 0 14px; }
  .topbar-right { gap: 7px; }
  .lang-switch { height: 34px; padding: 2px; }
  .lang-switch span { min-width: 30px; height: 28px; padding: 0 7px; font-size: 10.5px; }
  .icon-btn { width: 34px; height: 34px; font-size: 14px; }
}

@media (max-width: 760px) and (max-height: 680px) {
  .panel { max-height: min(36dvh, 245px); }
  .panel-blurb { display: none; }
  .compare { margin-bottom: 8px; }
}

@media (max-width: 900px) and (max-height: 600px) {
  .panel {
    left: 12px; right: 12px; top: auto; bottom: 62px; width: auto;
    max-height: min(40dvh, 220px); padding: 12px 14px 10px;
  }
  .panel-blurb { display: none; }
  .rail, .scalebar { display: none; }
  .brand-sub { display: none; }
  .dock { bottom: 8px; }
}

