/* Heartlines product layer. Odyssey provides scoped tokens only; this file owns all UI. */
.rel-app[data-ody-foundation] {
  --rel-bg: var(--ody-bg, #0b0f0d);
  --rel-bg-deep: color-mix(in srgb, var(--rel-bg) 72%, #020403);
  --rel-panel: var(--ody-surface, #141a17);
  --rel-panel-2: var(--ody-surface-2, #1b221e);
  --rel-panel-3: var(--ody-surface-3, #232c27);
  --rel-ink: var(--ody-ink, #efede4);
  --rel-ink-2: var(--ody-ink-2, #c8c7bd);
  --rel-muted: var(--ody-ink-3, #9b9f96);
  --rel-faint: var(--ody-ink-4, #747b72);
  --rel-rule: var(--ody-border, #303a34);
  --rel-rule-strong: var(--ody-border-2, #465249);
  --rel-accent: var(--ody-accent, #e87352);
  --rel-accent-strong: var(--ody-accent-2, #ff8d6c);
  --rel-accent-soft: var(--ody-accent-soft, #35211c);
  --rel-focus: var(--ody-accent-ink, #ffad95);
  --rel-ring: var(--ody-ring, rgb(232 115 82 / 0.38));
  --rel-partner: var(--ody-accent, #e87352);
  --rel-dated: var(--ody-info, #67bfb4);
  --rel-affection: var(--ody-warn, #d7ad62);
  --rel-danger: var(--ody-down, #f06c61);
  --rel-danger-soft: var(--ody-down-soft, #301718);
  --rel-ok: var(--ody-ok, #57bd81);
  --rel-grid: var(--ody-grid-line, rgb(231 239 232 / 0.055));
  --rel-font: var(--ody-font, Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  --rel-mono: var(--ody-mono, "SFMono-Regular", Consolas, "Liberation Mono", monospace);
  --rel-ease: var(--ody-ease, cubic-bezier(.2, .65, .25, 1));
  --rel-dur: var(--ody-dur, 160ms);
  --rel-radius-xs: var(--ody-r-xs, 3px);
  --rel-radius-sm: var(--ody-r-sm, 5px);
  --rel-radius: var(--ody-r, 8px);
  --rel-shadow: 0 18px 60px rgb(0 0 0 / 0.28), 0 2px 10px rgb(0 0 0 / 0.22);
  --rel-topbar-h: 70px;
  color: var(--rel-ink);
  color-scheme: dark;
  font-family: var(--rel-font);
}

html,
body {
  width: 100%;
  min-width: 0;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: #0b0f0d;
}

.rel-app,
.rel-app *,
.rel-app *::before,
.rel-app *::after {
  box-sizing: border-box;
}

.rel-app {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(circle at 62% 20%, color-mix(in srgb, var(--rel-accent) 8%, transparent), transparent 30%),
    linear-gradient(145deg, var(--rel-bg-deep), var(--rel-bg));
  font-size: 14px;
  line-height: 1.5;
  isolation: isolate;
}

.rel-app button,
.rel-app input,
.rel-app select,
.rel-app textarea {
  color: inherit;
  font: inherit;
}

.rel-app button,
.rel-app select,
.rel-app input[type="range"],
.rel-app input[type="color"] {
  cursor: pointer;
}

.rel-app button {
  min-width: 44px;
  min-height: 44px;
}

.rel-app button:disabled {
  cursor: not-allowed;
  opacity: .42;
}

.rel-app :focus-visible {
  outline: 2px solid var(--rel-focus);
  outline-offset: 3px;
  box-shadow: 0 0 0 5px var(--rel-ring);
}

.rel-app ::selection {
  color: var(--rel-ink);
  background: color-mix(in srgb, var(--rel-accent) 42%, transparent);
}

.rel-app [hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  color: #101410;
  background: #fff6e8;
  border: 2px solid #101410;
  border-radius: 4px;
  font: 650 14px/1.2 system-ui, sans-serif;
  transform: translateY(-160%);
  transition: transform 120ms ease-out;
}

.skip-link:focus {
  transform: translateY(0);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.coordinate-label {
  margin: 0 0 5px;
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .17em;
  line-height: 1.2;
  text-transform: uppercase;
}

.topbar {
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  min-width: 0;
  height: var(--rel-topbar-h);
  padding: 0 18px;
  background: color-mix(in srgb, var(--rel-panel) 94%, transparent);
  border-bottom: 1px solid var(--rel-rule);
  box-shadow: 0 1px 0 rgb(255 255 255 / .025);
  backdrop-filter: saturate(1.15) blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 228px;
  padding: 0 10px 0 0;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--rel-radius-sm);
}

.brand__mark {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid color-mix(in srgb, var(--rel-accent) 38%, var(--rel-rule));
  border-radius: var(--rel-radius-sm);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--rel-accent) 18%, transparent);
}

.brand__copy,
.brand__name {
  display: block;
  min-width: 0;
}

.brand__eyebrow {
  display: block;
  margin-bottom: 1px;
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}

.brand__name {
  overflow: hidden;
  color: var(--rel-ink);
  font-size: 17px;
  font-weight: 760;
  letter-spacing: -.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__name span {
  margin-left: 5px;
  color: var(--rel-accent-strong);
  font-weight: 650;
}

.mode-switch,
.view-switch,
.segmented-control {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  background: var(--rel-bg-deep);
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius-sm);
  box-shadow: inset 0 1px 4px rgb(0 0 0 / .2);
}

.mode-switch__button,
.view-switch button,
.segmented-control button {
  min-height: 44px;
  padding: 0 13px;
  color: var(--rel-muted);
  background: transparent;
  border: 0;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 680;
  transition: color var(--rel-dur) var(--rel-ease), background var(--rel-dur) var(--rel-ease), box-shadow var(--rel-dur) var(--rel-ease);
}

.mode-switch__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.mode-switch__button:hover,
.view-switch button:hover,
.segmented-control button:hover {
  color: var(--rel-ink);
}

.mode-switch__button.is-active,
.mode-switch__button[aria-pressed="true"],
.view-switch button.is-active,
.view-switch button[aria-pressed="true"],
.segmented-control button.is-active,
.segmented-control button[aria-pressed="true"] {
  color: var(--rel-ink);
  background: var(--rel-panel-3);
  box-shadow: inset 2px 0 0 var(--rel-accent), 0 1px 4px rgb(0 0 0 / .26);
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-left: auto;
  color: var(--rel-muted);
  font-family: var(--rel-mono);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .04em;
  white-space: nowrap;
}

.save-status__signal {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  background: var(--rel-ok);
  border-radius: 50%;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--rel-ok) 12%, transparent);
}

.save-status[data-state="dirty"] .save-status__signal,
.save-status[data-state="saving"] .save-status__signal {
  background: var(--rel-affection);
}

.save-status[data-state="error"] .save-status__signal,
.save-status[data-state="conflict"] .save-status__signal {
  background: var(--rel-danger);
}

.save-status[data-state="saving"] .save-status__signal {
  animation: signal-pulse 1.2s ease-in-out infinite;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.topbar__divider,
.graph-toolbar__divider {
  width: 1px;
  height: 24px;
  margin: 0 3px;
  background: var(--rel-rule);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: var(--rel-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--rel-radius-sm);
  transition: color var(--rel-dur) var(--rel-ease), background var(--rel-dur) var(--rel-ease), border-color var(--rel-dur) var(--rel-ease), transform var(--rel-dur) var(--rel-ease);
}

.icon-button:hover:not(:disabled),
.icon-button[aria-pressed="true"] {
  color: var(--rel-ink);
  background: var(--rel-panel-3);
  border-color: var(--rel-rule);
}

.icon-button:active:not(:disabled) {
  transform: translateY(1px);
}

.icon-button svg,
.search-field svg,
.demo-disclaimer svg,
.mobile-dock svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.workspace {
  position: relative;
  display: grid;
  grid-template-columns: minmax(276px, 304px) minmax(0, 1fr) minmax(310px, 362px);
  width: 100%;
  min-width: 0;
  height: calc(100vh - var(--rel-topbar-h));
  height: calc(100dvh - var(--rel-topbar-h));
  overflow: hidden;
}

.control-rail,
.inspector {
  min-width: 0;
  background: color-mix(in srgb, var(--rel-panel) 96%, transparent);
  backdrop-filter: saturate(1.1) blur(16px);
}

.control-rail {
  position: relative;
  z-index: 20;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-right: 1px solid var(--rel-rule);
  scrollbar-color: var(--rel-rule-strong) transparent;
  scrollbar-width: thin;
}

.rail__header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 74px;
  padding: 16px 18px 14px;
  background: color-mix(in srgb, var(--rel-panel) 94%, transparent);
  border-bottom: 1px solid var(--rel-rule);
  backdrop-filter: blur(14px);
}

.rail__header h1,
.section-heading h2,
.graph-stage__header h2,
.inspector__header h2,
.dialog__header h2,
.a11y-view h2,
.a11y-view h3 {
  margin: 0;
  color: var(--rel-ink);
  font-weight: 700;
  letter-spacing: -.02em;
}

.rail__header h1 {
  font-size: 17px;
}

.live-chip,
.privacy-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 0 8px;
  color: var(--rel-dated);
  background: color-mix(in srgb, var(--rel-dated) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rel-dated) 28%, var(--rel-rule));
  border-radius: 999px;
  font-family: var(--rel-mono);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.live-chip span {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
  animation: signal-pulse 1.8s ease-in-out infinite;
}

.privacy-chip {
  color: var(--rel-affection);
  background: color-mix(in srgb, var(--rel-affection) 9%, transparent);
  border-color: color-mix(in srgb, var(--rel-affection) 28%, var(--rel-rule));
}

.rail-section {
  position: relative;
  padding: 17px 18px 18px;
  border-bottom: 1px solid var(--rel-rule);
}

.rail-section::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  width: 28px;
  height: 1px;
  content: "";
  background: var(--rel-accent);
  opacity: .42;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-heading h2 {
  font-size: 12px;
  letter-spacing: .01em;
}

.section-heading__meta,
.section-heading kbd {
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .1em;
}

.section-heading kbd {
  min-width: 24px;
  padding: 2px 6px;
  text-align: center;
  background: var(--rel-panel-3);
  border: 1px solid var(--rel-rule-strong);
  border-bottom-width: 2px;
  border-radius: 3px;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 13px;
  z-index: 1;
  width: 17px;
  color: var(--rel-faint);
  pointer-events: none;
}

.search-field input,
.field input:not([type="range"]):not([type="color"]),
.field select,
.field textarea,
.path-fields select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0 12px;
  color: var(--rel-ink);
  background: var(--rel-bg-deep);
  border: 1px solid var(--rel-rule-strong);
  border-radius: var(--rel-radius-sm);
  outline: 0;
  transition: border-color var(--rel-dur) var(--rel-ease), box-shadow var(--rel-dur) var(--rel-ease), background var(--rel-dur) var(--rel-ease);
}

.search-field input {
  padding-left: 40px;
}

.search-field input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: var(--rel-faint);
}

.search-field input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.path-fields select:focus {
  background: color-mix(in srgb, var(--rel-bg-deep) 78%, var(--rel-accent-soft));
  border-color: var(--rel-accent);
  box-shadow: inset 2px 0 0 var(--rel-accent), 0 0 0 4px var(--rel-ring);
}

.search-results {
  position: absolute;
  top: calc(100% - 8px);
  right: 18px;
  left: 18px;
  z-index: 40;
  max-height: 260px;
  padding: 6px;
  overflow-y: auto;
  background: var(--rel-panel-2);
  border: 1px solid var(--rel-rule-strong);
  border-radius: var(--rel-radius-sm);
  box-shadow: var(--rel-shadow);
}

.search-results [role="option"] {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  color: var(--rel-ink-2);
  border-radius: 3px;
  cursor: pointer;
}

.search-results [role="option"]:hover,
.search-results [role="option"][aria-selected="true"] {
  color: var(--rel-ink);
  background: var(--rel-panel-3);
}

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

.metric {
  position: relative;
  min-width: 0;
  padding: 12px;
  overflow: hidden;
  background: linear-gradient(145deg, var(--rel-panel-2), color-mix(in srgb, var(--rel-panel) 88%, transparent));
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius-sm);
}

.metric::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  content: "";
  background: var(--rel-accent);
  opacity: .62;
}

.metric:nth-child(2)::after { background: var(--rel-dated); }
.metric:nth-child(3)::after { background: var(--rel-affection); }
.metric:nth-child(4)::after { background: var(--rel-accent); }

.metric strong,
.metric span {
  display: block;
}

.metric strong {
  overflow: hidden;
  font-family: var(--rel-mono);
  font-size: 19px;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.05em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric span {
  margin-top: 2px;
  color: var(--rel-faint);
  font-size: 10px;
}

.source-note {
  margin: 10px 1px 0;
  color: var(--rel-faint);
  font-size: 9px;
  line-height: 1.55;
}

.source-note a {
  color: var(--rel-ink-2);
  text-underline-offset: 2px;
}

.source-note span {
  display: block;
}

.source-note code {
  font-family: var(--rel-mono);
  font-size: .95em;
}

.filter-stack {
  display: grid;
  gap: 5px;
}

.filter-button {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  color: var(--rel-muted);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--rel-radius-sm);
  transition: color var(--rel-dur) var(--rel-ease), background var(--rel-dur) var(--rel-ease), border-color var(--rel-dur) var(--rel-ease);
}

.filter-button:hover {
  color: var(--rel-ink);
  background: var(--rel-panel-2);
}

.filter-button.is-active,
.filter-button[aria-pressed="true"] {
  color: var(--rel-ink);
  background: var(--rel-panel-3);
  border-color: var(--rel-rule);
  box-shadow: inset 2px 0 0 var(--rel-accent);
}

.filter-button small {
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 8px;
  letter-spacing: .08em;
}

.filter-button__swatch {
  position: relative;
  display: block;
  width: 24px;
  height: 12px;
}

.filter-button__swatch::before,
.filter-button__swatch::after {
  position: absolute;
  top: 50%;
  content: "";
  transform: translateY(-50%);
}

.filter-button__swatch::before {
  right: 1px;
  left: 1px;
  height: 2px;
  background: currentColor;
}

.filter-button__swatch::after {
  right: 0;
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 7px currentColor;
}

.filter-button__swatch--all { color: var(--rel-ink-2); }
.filter-button__swatch--partner { color: var(--rel-partner); }
.filter-button__swatch--dated { color: var(--rel-dated); }
.filter-button__swatch--affection { color: var(--rel-affection); }
.filter-button__swatch--dated::before { background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
.filter-button__swatch--affection::before { height: 1px; background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 5px); }

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: 100%;
}

.segmented-control button {
  padding: 0 8px;
}

.path-fields {
  position: relative;
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 7px 9px;
}

.path-fields label {
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 9px;
  font-weight: 700;
}

.path-fields__line {
  position: absolute;
  top: 43px;
  bottom: 43px;
  left: 15px;
  width: 1px;
  background: linear-gradient(var(--rel-accent), var(--rel-dated));
  opacity: .65;
}

.path-fields__line::before,
.path-fields__line::after {
  position: absolute;
  left: 50%;
  width: 5px;
  height: 5px;
  content: "";
  background: var(--rel-panel);
  border: 1px solid currentColor;
  border-radius: 50%;
  transform: translateX(-50%);
}

.path-fields__line::before { top: -30px; color: var(--rel-accent); }
.path-fields__line::after { bottom: -30px; color: var(--rel-dated); }

.button-row,
.studio-actions,
.inspector__footer-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--rel-radius-sm);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: color var(--rel-dur) var(--rel-ease), background var(--rel-dur) var(--rel-ease), border-color var(--rel-dur) var(--rel-ease), box-shadow var(--rel-dur) var(--rel-ease), transform var(--rel-dur) var(--rel-ease);
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

.button--primary {
  color: #15100d;
  background: linear-gradient(120deg, var(--rel-accent), var(--rel-accent-strong));
  border-color: color-mix(in srgb, var(--rel-accent) 80%, #000);
  box-shadow: 3px 3px 0 color-mix(in srgb, var(--rel-accent) 22%, transparent);
}

.button--primary:hover:not(:disabled) {
  box-shadow: 4px 5px 0 color-mix(in srgb, var(--rel-accent) 22%, transparent);
}

.button--secondary,
.button--quiet {
  color: var(--rel-ink-2);
  background: var(--rel-panel-2);
  border-color: var(--rel-rule);
}

.button--quiet {
  background: transparent;
}

.button--secondary:hover:not(:disabled),
.button--quiet:hover:not(:disabled) {
  color: var(--rel-ink);
  background: var(--rel-panel-3);
  border-color: var(--rel-rule-strong);
}

.button--danger {
  color: var(--rel-danger);
  background: var(--rel-danger-soft);
  border-color: color-mix(in srgb, var(--rel-danger) 36%, var(--rel-rule));
}

.button-row .button--primary,
.studio-actions .button,
.inspector__footer .button--danger {
  flex: 1 1 auto;
}

.path-summary {
  min-height: 32px;
  margin: 10px 0 0;
  color: var(--rel-faint);
  font-size: 10px;
  line-height: 1.55;
}

.rail-section--studio {
  background: linear-gradient(145deg, color-mix(in srgb, var(--rel-accent-soft) 52%, transparent), transparent 65%);
}

.rel-app[data-mode="explore"] .rail-section--studio {
  display: none;
}

.studio-actions {
  flex-direction: column;
}

.demo-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  padding: 16px 18px 20px;
  color: var(--rel-faint);
  font-size: 10px;
  line-height: 1.6;
}

.demo-disclaimer svg {
  flex: 0 0 17px;
  width: 17px;
  margin-top: 1px;
  color: var(--rel-affection);
}

.graph-stage {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 68px minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--rel-bg-deep);
}

.graph-stage__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 11px 18px;
  background: color-mix(in srgb, var(--rel-panel) 82%, transparent);
  border-bottom: 1px solid var(--rel-rule);
  backdrop-filter: blur(12px);
}

.graph-stage__header h2 {
  font-size: 16px;
}

.view-switch button {
  min-width: 58px;
  min-height: 44px;
}

.graph-surface {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 28% 74%, color-mix(in srgb, var(--rel-dated) 8%, transparent), transparent 28%),
    radial-gradient(circle at 76% 28%, color-mix(in srgb, var(--rel-accent) 8%, transparent), transparent 30%),
    linear-gradient(150deg, var(--rel-bg-deep), color-mix(in srgb, var(--rel-bg) 74%, #050706));
}

.rel-app[data-view="list"] .graph-surface {
  display: none;
}

.rel-app[data-view="list"] #a11yView {
  display: block;
}

#relationCanvas {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

#relationCanvas:active {
  cursor: grabbing;
}

#relationCanvas.is-dragging {
  cursor: grabbing;
}

#relationCanvas.is-hovering {
  cursor: pointer;
}

.graph-grid {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image:
    linear-gradient(var(--rel-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--rel-grid) 1px, transparent 1px),
    radial-gradient(circle, color-mix(in srgb, var(--rel-ink) 14%, transparent) 1px, transparent 1.5px);
  background-position: center;
  background-size: 48px 48px, 48px 48px, 12px 12px;
  opacity: .72;
  pointer-events: none;
  mask-image: radial-gradient(ellipse at center, #000 22%, rgb(0 0 0 / .72) 58%, transparent 100%);
}

.graph-surface::before,
.graph-surface::after {
  position: absolute;
  z-index: 2;
  content: "";
  pointer-events: none;
}

.graph-surface::before {
  inset: 16px;
  border: 1px solid color-mix(in srgb, var(--rel-rule) 62%, transparent);
  clip-path: polygon(0 0, 68px 0, 68px 1px, calc(100% - 68px) 1px, calc(100% - 68px) 0, 100% 0, 100% 68px, calc(100% - 1px) 68px, calc(100% - 1px) calc(100% - 68px), 100% calc(100% - 68px), 100% 100%, calc(100% - 68px) 100%, calc(100% - 68px) calc(100% - 1px), 68px calc(100% - 1px), 68px 100%, 0 100%, 0 calc(100% - 68px), 1px calc(100% - 68px), 1px 68px, 0 68px);
  opacity: .8;
}

.graph-surface::after {
  inset: 0;
  background: linear-gradient(90deg, rgb(255 255 255 / .012), transparent 30%, rgb(255 255 255 / .01) 70%, transparent);
  mix-blend-mode: screen;
}

.coordinate {
  position: absolute;
  z-index: 8;
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .12em;
  pointer-events: none;
}

.coordinate--north { top: 26px; left: 28px; }
.coordinate--scale { right: 28px; bottom: 28px; }

.graph-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 15;
  display: grid;
  justify-items: center;
  width: min(280px, calc(100% - 48px));
  padding: 22px;
  color: var(--rel-ink-2);
  text-align: center;
  background: color-mix(in srgb, var(--rel-panel) 88%, transparent);
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius);
  box-shadow: var(--rel-shadow);
  transform: translate(-50%, -50%);
  backdrop-filter: blur(16px);
  transition: opacity 280ms var(--rel-ease), visibility 280ms var(--rel-ease), transform 280ms var(--rel-ease);
}

.graph-loading.is-hidden,
.rel-app.is-ready .graph-loading {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 7px));
}

.graph-loading strong,
.graph-loading > span:last-child {
  display: block;
}

.graph-loading strong {
  margin-top: 14px;
  color: var(--rel-ink);
  font-size: 13px;
}

.graph-loading > span:last-child {
  margin-top: 3px;
  color: var(--rel-faint);
  font-size: 10px;
}

.graph-loading__orbit {
  position: relative;
  display: block;
  width: 54px;
  height: 54px;
  border: 1px solid color-mix(in srgb, var(--rel-dated) 48%, transparent);
  border-radius: 50%;
  animation: orbit-spin 2.4s linear infinite;
}

.graph-loading__orbit::before {
  position: absolute;
  inset: 12px;
  content: "";
  border: 1px solid color-mix(in srgb, var(--rel-accent) 55%, transparent);
  border-radius: 50%;
}

.graph-loading__orbit i {
  position: absolute;
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 14px currentColor;
}

.graph-loading__orbit i:nth-child(1) { top: -3px; left: 22px; color: var(--rel-accent); }
.graph-loading__orbit i:nth-child(2) { right: 3px; bottom: 7px; color: var(--rel-dated); }
.graph-loading__orbit i:nth-child(3) { bottom: 6px; left: 4px; color: var(--rel-affection); }

.graph-toolbar {
  position: absolute;
  top: 22px;
  right: 22px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  background: color-mix(in srgb, var(--rel-panel) 90%, transparent);
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius-sm);
  box-shadow: var(--rel-shadow);
  backdrop-filter: blur(14px);
}

.graph-toolbar .icon-button {
  width: 44px;
  height: 44px;
}

.field-legend {
  position: absolute;
  bottom: 22px;
  left: 22px;
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 36px;
  padding: 0 11px;
  color: var(--rel-faint);
  background: color-mix(in srgb, var(--rel-panel) 86%, transparent);
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius-sm);
  font-family: var(--rel-mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .06em;
  backdrop-filter: blur(12px);
}

.field-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.field-legend__line {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
}

.field-legend__line--partner { color: var(--rel-partner); }
.field-legend__line--dated { color: var(--rel-dated); background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px); }
.field-legend__line--affection { color: var(--rel-affection); background: repeating-linear-gradient(90deg, currentColor 0 2px, transparent 2px 5px); }

.a11y-view {
  min-width: 0;
  min-height: 0;
  padding: 22px;
  overflow: auto;
  background: var(--rel-bg);
  scrollbar-color: var(--rel-rule-strong) transparent;
}

.a11y-view__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rel-rule);
}

.a11y-view h2 {
  font-size: 20px;
}

.a11y-view h3 {
  margin-bottom: 12px;
  font-size: 13px;
}

#graphSummary {
  max-width: 48ch;
  margin: 0;
  color: var(--rel-muted);
  text-align: right;
  font-size: 12px;
}

.a11y-view__columns {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(300px, 1.2fr);
  gap: 22px;
  padding-top: 20px;
}

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

.entity-list li,
.entity-list button {
  width: 100%;
  min-width: 0;
}

.entity-list li {
  padding: 11px 12px;
  color: var(--rel-ink-2);
  background: var(--rel-panel);
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius-sm);
}

.entity-list button {
  justify-content: flex-start;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.entity-list__button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  min-height: 48px;
  padding: 9px 10px;
  border-radius: 3px;
  transition: color var(--rel-dur) var(--rel-ease), background var(--rel-dur) var(--rel-ease), box-shadow var(--rel-dur) var(--rel-ease);
}

.entity-list__button strong,
.entity-list__button span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-list__button strong {
  color: var(--rel-ink);
  font-size: 12px;
}

.entity-list__button span {
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 9px;
}

.entity-list__button:hover,
.entity-list__button.is-selected {
  color: var(--rel-ink);
  background: var(--rel-panel-3);
  box-shadow: inset 2px 0 0 var(--rel-accent);
}

.field--range input {
  width: 100%;
  min-width: 0;
  accent-color: var(--rel-accent);
}

.inspector {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 0;
  border-left: 1px solid var(--rel-rule);
}

.inspector__handle {
  display: none;
}

.inspector__header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--rel-rule);
}

.inspector__header h2 {
  font-size: 22px;
}

.inspector__header > p:last-child {
  max-width: 34ch;
  margin: 8px 0 0;
  color: var(--rel-muted);
  font-size: 11px;
  line-height: 1.65;
}

.inspector__body {
  min-height: 0;
  padding: 20px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--rel-rule-strong) transparent;
}

.inspector-person {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--rel-accent-soft) 66%, transparent), var(--rel-panel-2));
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius-sm);
  box-shadow: inset 2px 0 0 var(--rel-accent);
}

.inspector-person__avatar {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  color: var(--rel-ink);
  background:
    radial-gradient(circle at 36% 28%, color-mix(in srgb, var(--rel-accent-strong) 76%, #fff), var(--rel-accent) 48%, color-mix(in srgb, var(--rel-accent) 62%, #111));
  border: 2px solid color-mix(in srgb, var(--rel-accent-strong) 62%, var(--rel-rule));
  border-radius: 50%;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--rel-accent) 10%, transparent), 0 0 28px color-mix(in srgb, var(--rel-accent) 22%, transparent);
  font-size: 25px;
}

.inspector-person__copy,
.inspector-person__copy span,
.inspector-person__copy strong {
  display: block;
  min-width: 0;
}

.inspector-person__copy span {
  color: var(--rel-affection);
  font-family: var(--rel-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .06em;
}

.inspector-person__copy strong {
  margin-top: 5px;
  color: var(--rel-ink);
  font-size: 12px;
}

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

.inspector-actions .button {
  min-width: 0;
  padding-right: 9px;
  padding-left: 9px;
}

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

.inspector-connections {
  margin-top: 22px;
}

.inspector-connections h3 {
  margin: 0 0 10px;
  color: var(--rel-muted);
  font-family: var(--rel-mono);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.inspector-connections > p {
  margin: 0;
  padding: 14px;
  color: var(--rel-faint);
  text-align: center;
  background: var(--rel-panel-2);
  border: 1px dashed var(--rel-rule-strong);
  border-radius: var(--rel-radius-sm);
  font-size: 10px;
}

.connection-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  margin-top: 6px;
  padding: 8px 10px;
  color: var(--rel-ink-2);
  text-align: left;
  background: var(--rel-panel-2);
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius-sm);
  transition: color var(--rel-dur) var(--rel-ease), background var(--rel-dur) var(--rel-ease), border-color var(--rel-dur) var(--rel-ease), transform var(--rel-dur) var(--rel-ease);
}

.connection-item:hover {
  color: var(--rel-ink);
  background: var(--rel-panel-3);
  border-color: var(--rel-rule-strong);
  transform: translateX(2px);
}

.connection-item span {
  overflow: hidden;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.connection-item small {
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 8px;
  letter-spacing: .06em;
}

.inspector-pairing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 16px 10px;
  background: var(--rel-panel-2);
  border: 1px solid var(--rel-rule);
  border-radius: var(--rel-radius-sm);
}

.inspector-pairing strong {
  min-width: 0;
  overflow: hidden;
  color: var(--rel-ink);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-glyph {
  display: grid;
  place-items: center;
  width: 48px;
  height: 32px;
  color: var(--rel-accent);
  border: 1px solid currentColor;
  border-radius: 999px;
  box-shadow: 0 0 16px color-mix(in srgb, currentColor 20%, transparent);
  font-family: var(--rel-mono);
  font-size: 16px;
}

.relation-glyph--dated { color: var(--rel-dated); border-style: dashed; }
.relation-glyph--affection { color: var(--rel-affection); border-style: dotted; }

.inspector-details {
  margin-top: 14px;
  border-top: 1px solid var(--rel-rule);
}

.inspector-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 45px;
  padding: 9px 3px;
  border-bottom: 1px solid var(--rel-rule);
}

.inspector-row span {
  color: var(--rel-faint);
  font-size: 10px;
}

.inspector-row strong {
  min-width: 0;
  overflow: hidden;
  color: var(--rel-ink-2);
  font-family: var(--rel-mono);
  font-size: 10px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inspector-note {
  position: relative;
  margin: 16px 0 0;
  padding: 13px 14px 13px 18px;
  color: var(--rel-ink-2);
  background: color-mix(in srgb, var(--rel-affection) 7%, var(--rel-panel-2));
  border: 1px solid var(--rel-rule);
  border-left: 3px solid var(--rel-affection);
  border-radius: 0 var(--rel-radius-sm) var(--rel-radius-sm) 0;
  font-size: 11px;
  line-height: 1.7;
}

.selection-empty {
  display: grid;
  justify-items: center;
  min-height: 260px;
  padding: 48px 10px;
  color: var(--rel-faint);
  text-align: center;
}

.selection-empty__orbit {
  position: relative;
  width: 112px;
  height: 112px;
  margin-bottom: 22px;
  border: 1px solid var(--rel-rule);
  border-radius: 50%;
}

.selection-empty__orbit::before,
.selection-empty__orbit::after,
.selection-empty__orbit span {
  position: absolute;
  content: "";
  border-radius: 50%;
}

.selection-empty__orbit::before {
  inset: 24px;
  border: 1px dashed color-mix(in srgb, var(--rel-accent) 54%, transparent);
}

.selection-empty__orbit::after {
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  background: var(--rel-accent);
  box-shadow: 0 0 25px color-mix(in srgb, var(--rel-accent) 65%, transparent);
  transform: translate(-50%, -50%);
}

.selection-empty__orbit span {
  top: 11px;
  left: 19px;
  width: 8px;
  height: 8px;
  color: var(--rel-dated);
  background: currentColor;
  box-shadow: 0 0 15px currentColor;
}

.selection-empty p {
  max-width: 28ch;
  margin: 0;
  line-height: 1.7;
}

.selection-empty small {
  display: block;
  max-width: 32ch;
  margin-top: 9px;
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 8px;
  line-height: 1.6;
}

.inspector__footer {
  padding: 14px 18px 18px;
  background: var(--rel-panel-2);
  border-top: 1px solid var(--rel-rule);
}

.inspector__footer-row .button {
  flex: 1 1 0;
}

.mobile-dock {
  display: none;
}

.dialog {
  width: min(520px, calc(100vw - 32px));
  max-width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: visible;
  color: var(--rel-ink);
  background: transparent;
  border: 0;
}

.dialog--wide {
  width: min(660px, calc(100vw - 32px));
}

.dialog::backdrop {
  background: color-mix(in srgb, var(--rel-bg-deep) 76%, transparent);
  backdrop-filter: blur(10px) saturate(.8);
}

.dialog__panel {
  width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow: hidden;
  background: var(--rel-panel);
  border: 1px solid var(--rel-rule-strong);
  border-radius: var(--rel-radius);
  box-shadow: var(--rel-shadow);
  animation: dialog-enter 240ms var(--rel-ease) both;
}

.dialog__header,
.dialog__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.dialog__header {
  border-bottom: 1px solid var(--rel-rule);
}

.dialog__header h2 {
  font-size: 20px;
}

.dialog__body {
  display: grid;
  gap: 16px;
  max-height: min(65vh, 610px);
  padding: 20px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: var(--rel-rule-strong) transparent;
}

.dialog__footer {
  justify-content: flex-end;
  background: var(--rel-panel-2);
  border-top: 1px solid var(--rel-rule);
}

.field,
.field > span,
.field > small {
  display: block;
  min-width: 0;
}

.field > span {
  margin-bottom: 6px;
  color: var(--rel-ink-2);
  font-size: 11px;
  font-weight: 680;
}

.field > span b {
  color: var(--rel-accent);
}

.field > small {
  margin-top: 5px;
  color: var(--rel-faint);
  font-size: 9px;
}

.field textarea {
  min-height: 92px;
  padding-top: 10px;
  resize: vertical;
}

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field--color {
  min-width: 120px;
}

.field--color input {
  width: 100%;
  min-height: 46px;
  padding: 5px;
  background: var(--rel-bg-deep);
  border: 1px solid var(--rel-rule-strong);
  border-radius: var(--rel-radius-sm);
}

.field--range > span {
  display: flex;
  justify-content: space-between;
}

.field--range output {
  color: var(--rel-accent-strong);
  font-family: var(--rel-mono);
  font-size: 10px;
}

.relationship-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px minmax(0, 1fr);
  align-items: end;
  gap: 8px;
}

.relationship-pair__link {
  display: grid;
  place-items: center;
  height: 46px;
  color: var(--rel-accent-strong);
  font-size: 21px;
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 300;
  display: grid;
  justify-items: end;
  gap: 8px;
  width: min(380px, calc(100vw - 36px));
  pointer-events: none;
}

.toast {
  width: fit-content;
  max-width: 100%;
  padding: 11px 14px;
  color: var(--rel-ink);
  background: var(--rel-panel-2);
  border: 1px solid var(--rel-rule-strong);
  border-left: 3px solid var(--rel-accent);
  border-radius: var(--rel-radius-sm);
  box-shadow: var(--rel-shadow);
  font-size: 11px;
  pointer-events: auto;
  animation: toast-enter 220ms var(--rel-ease) both;
  transition: opacity 180ms var(--rel-ease), transform 180ms var(--rel-ease);
}

.toast[data-tone="success"] { border-left-color: var(--rel-ok); }
.toast[data-tone="warning"] { border-left-color: var(--rel-affection); }
.toast[data-tone="error"] { border-left-color: var(--rel-danger); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); }

.search-result {
  display: grid !important;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px !important;
  padding: 7px 8px !important;
  color: var(--rel-ink-2);
  text-align: left;
  background: transparent;
  border: 0;
}

.search-result__avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--rel-ink);
  background: var(--rel-accent-soft);
  border: 1px solid color-mix(in srgb, var(--rel-accent) 36%, var(--rel-rule));
  border-radius: 50%;
}

.search-result strong {
  min-width: 0;
  overflow: hidden;
  color: var(--rel-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result small {
  color: var(--rel-faint);
  font-family: var(--rel-mono);
  font-size: 8px;
  white-space: nowrap;
}

.search-result.is-active,
.search-result[aria-selected="true"] {
  color: var(--rel-ink);
  background: var(--rel-panel-3);
  box-shadow: inset 2px 0 0 var(--rel-accent);
}

.search-results__empty {
  margin: 0;
  padding: 16px 10px;
  color: var(--rel-faint);
  text-align: center;
  font-size: 10px;
}

@keyframes signal-pulse {
  0%, 100% { opacity: .58; transform: scale(.88); }
  50% { opacity: 1; transform: scale(1.08); }
}

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

@keyframes dialog-enter {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
}

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

.rel-app[data-theme="light"] {
  --rel-bg: var(--ody-bg, #eeece4);
  --rel-bg-deep: #e5e2d8;
  --rel-panel: var(--ody-surface, #f8f6ef);
  --rel-panel-2: var(--ody-surface-2, #f0eee6);
  --rel-panel-3: var(--ody-surface-3, #e7e4db);
  --rel-ink: var(--ody-ink, #1d211d);
  --rel-ink-2: var(--ody-ink-2, #444b44);
  --rel-muted: var(--ody-ink-3, #626a62);
  --rel-faint: var(--ody-ink-4, #757d75);
  --rel-rule: var(--ody-border, #cbc7bc);
  --rel-rule-strong: var(--ody-border-2, #aaa69a);
  --rel-shadow: 0 18px 52px rgb(44 47 41 / .14), 0 2px 8px rgb(44 47 41 / .09);
  --rel-grid: rgb(29 33 29 / .07);
  color-scheme: light;
}

.rel-app[data-theme="light"] .button--primary {
  color: #fffaf2;
}

@media (max-width: 1260px) {
  .workspace {
    grid-template-columns: minmax(268px, 288px) minmax(0, 1fr) minmax(290px, 324px);
  }

  .brand {
    min-width: 206px;
  }

  .topbar {
    gap: 11px;
  }

  .field-legend {
    gap: 9px;
  }
}

@media (max-width: 1060px) {
  .workspace {
    grid-template-columns: minmax(260px, 280px) minmax(0, 1fr);
  }

  .inspector {
    position: absolute;
    top: 10px;
    right: 10px;
    bottom: 82px;
    width: min(340px, calc(100% - 300px));
    min-width: 300px;
    border: 1px solid var(--rel-rule-strong);
    border-radius: var(--rel-radius);
    box-shadow: var(--rel-shadow);
    transform: translateX(calc(100% + 24px));
    transition: transform 240ms var(--rel-ease);
  }

  .inspector.is-mobile-open {
    transform: translateX(0);
  }

  .brand {
    min-width: 190px;
  }

  .brand__eyebrow {
    display: none;
  }

  .save-status {
    font-size: 0;
  }

  .save-status__signal {
    width: 8px;
    height: 8px;
  }
}

@media (min-width: 821px) and (max-width: 1060px) {
  .rel-app.has-selection .inspector,
  .rel-app.is-inspector-open .inspector,
  .rel-app:has(#deleteSelectionButton:not(:disabled)) .inspector {
    transform: translateX(0);
  }
}

@media (max-width: 820px) {
  .rel-app[data-ody-foundation] {
    --rel-topbar-h: 60px;
  }

  .topbar {
    gap: 8px;
    padding: 0 10px;
  }

  .brand {
    min-width: 44px;
    width: 44px;
    padding: 0;
  }

  .brand__mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

  .brand__copy,
  #undoButton,
  #redoButton,
  .topbar__divider {
    display: none;
  }

  .save-status[data-state="error"] {
    max-width: 112px;
    color: var(--rel-danger);
    font-size: 9px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mode-switch {
    margin-right: auto;
  }

  .mode-switch__button {
    width: 44px;
    padding: 0;
  }

  .mode-switch__icon {
    font-size: 17px;
  }

  .mode-switch__label {
    display: none;
  }

  .workspace {
    display: block;
    height: calc(100vh - var(--rel-topbar-h));
    height: calc(100dvh - var(--rel-topbar-h));
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }

  .graph-stage {
    width: 100%;
    height: 100%;
    grid-template-rows: 58px minmax(0, 1fr);
  }

  .graph-stage__header {
    padding: 8px 12px;
  }

  .graph-stage__header .coordinate-label {
    display: none;
  }

  .graph-stage__header h2 {
    font-size: 14px;
  }

  .view-switch button {
    min-width: 54px;
    min-height: 44px;
    padding: 0 9px;
  }

  .control-rail,
  .inspector {
    position: fixed;
    top: auto;
    right: 8px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    left: 8px;
    z-index: 100;
    width: auto;
    min-width: 0;
    max-height: calc(100dvh - 148px);
    overflow-y: auto;
    background: color-mix(in srgb, var(--rel-panel) 97%, transparent);
    border: 1px solid var(--rel-rule-strong);
    border-radius: 10px 10px var(--rel-radius) var(--rel-radius);
    box-shadow: var(--rel-shadow);
    transform: translateY(calc(100% + 88px));
    transition: transform 260ms var(--rel-ease);
  }

  .control-rail::before,
  .inspector__handle {
    position: sticky;
    top: 7px;
    z-index: 10;
    display: block;
    width: 42px;
    height: 4px;
    margin: 7px auto 0;
    content: "";
    background: var(--rel-rule-strong);
    border-radius: 99px;
  }

  .rel-app.is-rail-open .control-rail {
    transform: translateY(0);
  }

  .control-rail.is-mobile-open {
    transform: translateY(0);
  }

  .rel-app .inspector:not(.is-mobile-open) {
    transform: translateY(calc(100% + 88px));
  }

  .inspector.is-mobile-open {
    transform: translateY(0);
  }

  .inspector {
    display: grid;
    grid-template-rows: auto minmax(120px, 1fr) auto;
  }

  .inspector__header {
    padding: 13px 16px 12px;
  }

  .inspector__header h2 {
    font-size: 18px;
  }

  .inspector__body {
    padding: 14px 16px;
  }

  .mobile-dock {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 120;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: end;
    min-width: 0;
    min-height: calc(64px + env(safe-area-inset-bottom));
    padding: 5px 5px env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--rel-panel) 96%, transparent);
    border-top: 1px solid var(--rel-rule);
    box-shadow: 0 -12px 34px rgb(0 0 0 / .24);
    backdrop-filter: blur(18px) saturate(1.1);
  }

  .mobile-dock button {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 1px;
    min-width: 0;
    min-height: 54px;
    padding: 3px;
    color: var(--rel-faint);
    background: transparent;
    border: 0;
    border-radius: var(--rel-radius-sm);
    font-size: 9px;
  }

  .mobile-dock button:hover,
  .mobile-dock button[aria-pressed="true"] {
    color: var(--rel-ink);
    background: var(--rel-panel-3);
  }

  .mobile-dock svg {
    width: 20px;
    height: 20px;
  }

  .mobile-dock__primary {
    position: relative;
    top: -11px;
    width: 54px;
    max-width: 54px;
    height: 54px;
    margin: 0 auto;
    color: #15100d !important;
    background: var(--rel-accent) !important;
    border: 1px solid color-mix(in srgb, var(--rel-accent) 75%, #000) !important;
    border-radius: 50% !important;
    box-shadow: 0 0 0 6px var(--rel-panel), 0 8px 22px color-mix(in srgb, var(--rel-accent) 26%, transparent);
    font-size: 24px !important;
  }

  .mobile-dock__primary small {
    position: absolute;
    top: 56px;
    color: var(--rel-faint);
    font-size: 9px;
  }

  .graph-toolbar {
    top: 12px;
    right: 10px;
    flex-direction: column;
    padding: 3px;
  }

  .graph-toolbar__divider {
    width: 24px;
    height: 1px;
    margin: 3px 0;
  }

  .graph-toolbar .icon-button {
    width: 44px;
    height: 44px;
  }

  .field-legend {
    right: 10px;
    bottom: 10px;
    left: 10px;
    justify-content: center;
    gap: 10px;
    min-height: 32px;
    padding: 0 7px;
  }

  .field-legend__line {
    width: 16px;
  }

  .coordinate {
    display: none;
  }

  .a11y-view {
    padding: 16px 12px;
  }

  .a11y-view__header,
  .a11y-view__columns {
    display: block;
  }

  #graphSummary {
    margin-top: 8px;
    text-align: left;
  }

  .a11y-view__columns > section + section {
    margin-top: 24px;
  }

  .dialog,
  .dialog--wide {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 12px);
    margin: auto 0 0;
  }

  .dialog__panel {
    max-height: calc(100dvh - 12px);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
  }

  .dialog__body {
    max-height: calc(100dvh - 158px);
    padding: 16px;
  }

  .relationship-pair,
  .field-row {
    grid-template-columns: 1fr;
  }

  .relationship-pair__link {
    height: 28px;
    transform: rotate(90deg);
  }

  .toast-region {
    right: 10px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 10px;
    width: auto;
  }

  .toast {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .topbar__actions {
    gap: 1px;
  }

  .topbar .icon-button {
    width: 44px;
    height: 44px;
  }

  .graph-stage {
    grid-template-rows: 54px minmax(0, 1fr);
  }

  .graph-stage__header {
    gap: 7px;
    padding-right: 8px;
    padding-left: 10px;
  }

  .view-switch button {
    min-width: 48px;
    padding: 0 6px;
    font-size: 11px;
  }

  .field-legend {
    font-size: 7px;
  }

  .field-legend span {
    gap: 4px;
  }

  .rail__header,
  .rail-section {
    padding-right: 15px;
    padding-left: 15px;
  }

  .search-results {
    right: 15px;
    left: 15px;
  }
}

@media (max-height: 660px) and (max-width: 820px) {
  .control-rail,
  .inspector {
    max-height: calc(100dvh - 102px);
  }

  .mobile-dock {
    min-height: calc(56px + env(safe-area-inset-bottom));
  }

  .mobile-dock button {
    min-height: 48px;
  }

  .mobile-dock__primary {
    top: -6px;
    width: 50px;
    height: 50px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .rel-app *,
  .rel-app *::before,
  .rel-app *::after,
  .dialog__panel,
  .toast {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }

  .live-chip span,
  .graph-loading__orbit,
  .save-status__signal {
    animation: none !important;
  }
}

.rel-app[data-motion="reduced"] *,
.rel-app[data-motion="reduced"] *::before,
.rel-app[data-motion="reduced"] *::after {
  scroll-behavior: auto !important;
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
}

@media (forced-colors: active) {
  .rel-app {
    --rel-bg: Canvas;
    --rel-bg-deep: Canvas;
    --rel-panel: Canvas;
    --rel-panel-2: Canvas;
    --rel-panel-3: Canvas;
    --rel-ink: CanvasText;
    --rel-ink-2: CanvasText;
    --rel-muted: CanvasText;
    --rel-faint: CanvasText;
    --rel-rule: CanvasText;
    --rel-rule-strong: CanvasText;
    --rel-accent: Highlight;
    --rel-accent-strong: Highlight;
    --rel-focus: Highlight;
    background: Canvas;
    forced-color-adjust: auto;
  }

  #relationCanvas,
  .graph-grid,
  .graph-surface,
  .field-legend,
  .coordinate,
  .graph-loading {
    display: none !important;
  }

  #a11yView {
    display: block !important;
  }

  .graph-stage {
    display: grid;
  }

  .button--primary,
  .mobile-dock__primary {
    color: HighlightText !important;
    background: Highlight !important;
  }

  .rel-app :focus-visible {
    outline: 3px solid Highlight;
    box-shadow: none;
  }
}
