@font-face {
  font-family: "Exo 2";
  src: url("/fonts/exo-2-cyrillic-variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Russo One";
  src: url("/fonts/russo-one-cyrillic-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #050605;
  --panel: #0a0c0a;
  --panel-raised: #0f120f;
  --ink: #f1f2ec;
  --ink-inverse: #080a08;
  --muted: #8b9188;
  --muted-2: #5d635b;
  --line: rgba(230, 236, 224, 0.16);
  --line-strong: rgba(230, 236, 224, 0.28);
  --accent: #d6a760;
  --accent-rgb: 214, 167, 96;
  --accent-soft: rgba(var(--accent-rgb), 0.11);
  --branch: #927453;
  --error: #ef8c7c;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --cursor-x: -80px;
  --cursor-y: -80px;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
  font-family: "Exo 2", sans-serif;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 15% 34%, rgba(145, 105, 61, 0.09), transparent 29rem),
    radial-gradient(circle at 90% 76%, rgba(var(--accent-rgb), 0.055), transparent 25rem),
    var(--bg);
  color: var(--ink);
  font-size: 16px;
}

body::before {
  position: fixed;
  z-index: 0;
  inset: 42px 0 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.027) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.027) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:not(:disabled),
a {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

.system-chrome {
  position: fixed;
  z-index: 100;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  height: 42px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 4, 3, 0.94);
  backdrop-filter: blur(18px);
}

.system-brand,
.system-chrome-center,
.system-network,
.roots-accessibility-toggle {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  text-decoration: none;
}

.system-brand-mark {
  width: 14px;
  height: 14px;
}

.system-chrome-center {
  color: var(--muted-2);
}

.system-chrome-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 14px;
}

.roots-accessibility-toggle {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: transparent;
}

.roots-accessibility-toggle svg {
  width: 14px;
  height: 14px;
}

.roots-accessibility-toggle[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink-inverse);
}

.system-network {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
}

.system-network i,
.module-state i,
.module-index i,
.save-state i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(var(--accent-rgb), 0.52);
}

.system-network[data-state="error"] i,
.save-state[data-state="error"] i {
  background: var(--error);
  box-shadow: 0 0 12px rgba(239, 140, 124, 0.46);
}

.roots-shell {
  position: relative;
  z-index: 1;
  width: min(1380px, calc(100% - 64px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: 72px 0 60px;
}

.service-switcher {
  display: flex;
  width: fit-content;
  margin: 0 0 22px auto;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(6, 6, 6, 0.98);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.26);
}

.service-switcher a {
  position: relative;
  display: grid;
  width: 166px;
  min-height: 58px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: var(--muted);
  text-decoration: none;
  transition: transform 180ms var(--ease), color 180ms ease, background-color 180ms ease;
}

.service-switcher a + a {
  border-left: 1px solid var(--line);
}

.service-switcher a::after {
  position: absolute;
  right: 12px;
  bottom: 0;
  left: 12px;
  height: 2px;
  content: "";
  background: currentColor;
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 180ms ease, transform 180ms var(--ease);
}

.service-switcher a:hover,
.service-switcher a:focus-visible {
  background: rgba(255, 255, 255, 0.045);
  color: var(--ink);
  transform: translateY(-1px);
}

.service-switcher a:hover::after,
.service-switcher a:focus-visible::after,
.service-switcher a.is-current::after {
  opacity: 1;
  transform: scaleX(1);
}

.service-switcher a.is-current {
  background: var(--ink);
  color: var(--ink-inverse);
}

.service-index {
  font-family: "Russo One", sans-serif;
  font-size: 10px;
}

.service-copy {
  display: grid;
  gap: 3px;
}

.service-copy strong {
  font-family: "Russo One", sans-serif;
  font-size: 14px;
}

.service-copy small {
  color: currentColor;
  font-size: 10px;
  font-weight: 750;
  opacity: 0.58;
  text-transform: uppercase;
}

.service-switcher svg {
  width: 16px;
  height: 16px;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.roots-entry {
  display: grid;
  min-height: 590px;
  grid-template-columns: minmax(0, 1.15fr) minmax(390px, 0.75fr);
  border: 1px solid var(--line);
  background: rgba(5, 6, 5, 0.82);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.32);
}

.roots-intro {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 42px 54px 38px;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.roots-intro::before {
  position: absolute;
  right: -120px;
  bottom: -210px;
  width: 520px;
  height: 520px;
  border: 1px solid var(--line);
  border-radius: 50%;
  content: "";
  box-shadow:
    inset 0 0 0 58px rgba(255, 255, 255, 0.014),
    inset 0 0 0 118px rgba(255, 255, 255, 0.009);
}

.module-row,
.console-heading,
.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.module-row {
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.module-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.roots-title-lockup {
  position: relative;
  display: flex;
  align-items: center;
  gap: 26px;
  margin: 52px 0 24px;
}

.roots-title-lockup h1 {
  display: grid;
  margin: 0;
  font-family: "Russo One", sans-serif;
  font-size: clamp(52px, 6.6vw, 92px);
  line-height: 0.78;
  letter-spacing: -0.055em;
}

.roots-title-lockup h1 span {
  color: transparent;
  -webkit-text-stroke: 1px var(--muted);
}

.roots-title-lockup h1 strong {
  color: var(--ink);
}

.roots-mark {
  position: relative;
  width: 92px;
  height: 132px;
  flex: 0 0 auto;
}

.roots-mark::before {
  position: absolute;
  top: 4px;
  bottom: 6px;
  left: 50%;
  width: 1px;
  content: "";
  background: linear-gradient(to bottom, transparent, var(--ink) 14%, var(--ink) 78%, transparent);
}

.roots-mark span {
  position: absolute;
  width: 28px;
  height: 17px;
  border: 1px solid var(--accent);
  border-radius: 100% 0 100% 0;
  background: var(--accent-soft);
  box-shadow: 0 0 18px rgba(var(--accent-rgb), 0.08);
}

.roots-mark span:nth-child(1) { top: 18px; left: 16px; transform: rotate(16deg); }
.roots-mark span:nth-child(2) { top: 42px; right: 14px; transform: scaleX(-1) rotate(12deg); }
.roots-mark span:nth-child(3) { top: 64px; left: 9px; transform: rotate(12deg); }
.roots-mark span:nth-child(4) { top: 88px; right: 7px; transform: scaleX(-1) rotate(20deg); }
.roots-mark span:nth-child(5) { top: 106px; left: 22px; transform: rotate(-6deg); }

.roots-lede {
  position: relative;
  max-width: 680px;
  margin: 0;
  color: #abb0a7;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.55;
}

.privacy-ledger {
  position: relative;
  display: grid;
  margin-top: auto;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--line);
}

.privacy-ledger > div {
  display: grid;
  min-width: 0;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  padding: 22px 18px 0 0;
}

.privacy-ledger > div + div {
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.privacy-ledger svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.privacy-ledger span {
  display: grid;
  gap: 4px;
}

.privacy-ledger strong {
  font-size: 13px;
  text-transform: uppercase;
}

.privacy-ledger small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.create-console {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 42px 34px 30px;
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.035), transparent 45%),
    var(--panel);
}

.owner-entry-seal {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-left-color: var(--accent);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.1), transparent 64%),
    #070807;
}

.owner-entry-seal-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.58);
  color: var(--accent);
}

.owner-entry-seal-mark svg {
  width: 25px;
  height: 25px;
}

.owner-entry-seal > span:last-child {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.owner-entry-seal small {
  color: var(--accent);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.owner-entry-seal strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.owner-entry-seal em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
}

.guest-entry-seal {
  margin-bottom: 18px;
  padding-block: 22px;
}

.guest-entry-seal strong {
  white-space: normal;
}

.guest-access-note {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.018);
}

.guest-access-note > svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.guest-access-note > span {
  display: grid;
  gap: 3px;
}

.guest-access-note strong {
  font-size: 13px;
  text-transform: uppercase;
}

.guest-access-note small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.guest-owner-button {
  margin-top: 24px;
}

.console-heading {
  position: relative;
  margin-bottom: 32px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.console-heading > span {
  position: absolute;
  top: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.console-heading > strong {
  padding-top: 18px;
  font-family: "Russo One", sans-serif;
  font-size: clamp(26px, 3vw, 42px);
  text-transform: uppercase;
}

.console-heading > svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.roots-field {
  display: grid;
  gap: 8px;
  margin-bottom: 20px;
}

.roots-field > span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.roots-field em {
  color: var(--accent);
  font-size: 10px;
  font-style: normal;
}

.roots-field input,
.roots-field textarea,
.roots-field select,
.people-search input,
#treeTitleInput,
#shareUrlInput {
  width: 100%;
  min-height: 56px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  background: #070807;
  color: var(--ink);
  font-size: 15px;
  font-weight: 650;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.roots-field textarea {
  min-height: 112px;
  padding-block: 13px;
  line-height: 1.45;
  resize: vertical;
}

.roots-field input:focus,
.roots-field textarea:focus,
.roots-field select:focus,
.people-search input:focus,
#treeTitleInput:focus {
  border-color: var(--accent);
  background: #0b0e0a;
}

.create-tree-button,
.last-tree-button {
  display: grid;
  width: 100%;
  min-height: 70px;
  grid-template-columns: 28px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  text-align: left;
  transition: transform 180ms var(--ease), border-color 180ms ease, background-color 180ms ease;
}

.create-tree-button {
  margin-top: 4px;
  border-color: var(--ink);
  background: var(--ink);
  color: var(--ink-inverse);
}

.last-tree-button {
  margin-top: 10px;
  background: var(--accent-soft);
  color: var(--ink);
}

.create-tree-button:hover,
.last-tree-button:hover {
  transform: translateY(-2px);
}

.create-tree-button > svg,
.last-tree-button > svg {
  width: 22px;
  height: 22px;
}

.create-tree-button > span,
.last-tree-button > span {
  display: grid;
  gap: 3px;
}

.create-tree-button strong,
.last-tree-button strong {
  font-size: 15px;
}

.create-tree-button small,
.last-tree-button small {
  font-size: 11px;
  opacity: 0.58;
}

.create-tree-button b {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(0, 0, 0, 0.25);
}

.create-tree-button b svg {
  width: 16px;
  height: 16px;
}

.create-warning {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  margin: auto 0 0;
  padding-top: 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.create-warning svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}

.form-error {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--error);
  font-size: 13px;
  font-weight: 700;
}

.roots-loading {
  display: grid;
  min-height: 520px;
  place-items: center;
  align-content: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.roots-loading strong {
  font-family: "Russo One", sans-serif;
  font-size: 22px;
  text-transform: uppercase;
}

.roots-loading small {
  color: var(--muted);
}

.loading-orbit {
  width: 64px;
  height: 64px;
  margin-bottom: 12px;
  border: 1px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: orbit 850ms linear infinite;
}

@keyframes orbit {
  to { transform: rotate(1turn); }
}

.roots-workspace {
  border: 1px solid var(--line);
  background: rgba(5, 6, 5, 0.88);
  box-shadow: 0 40px 90px rgba(0, 0, 0, 0.3);
}

.workspace-header {
  display: flex;
  min-height: 102px;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  padding: 16px 22px 16px 28px;
  border-bottom: 1px solid var(--line);
}

.workspace-identity {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.module-index {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

#treeTitleInput {
  min-width: min(440px, 55vw);
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: "Russo One", sans-serif;
  font-size: clamp(24px, 3vw, 40px);
  text-transform: uppercase;
}

.workspace-identity p {
  display: flex;
  gap: 14px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.workspace-identity p span {
  color: var(--accent);
}

.workspace-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.save-state {
  display: inline-flex;
  min-width: 96px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.workspace-button,
.square-button,
.tree-toolbar button,
.dialog-heading button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  transition: transform 170ms var(--ease), border-color 170ms ease, background-color 170ms ease;
}

.workspace-button:hover,
.square-button:hover,
.tree-toolbar button:hover,
.dialog-heading button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.workspace-button svg,
.square-button svg,
.tree-toolbar button svg,
.dialog-heading button svg {
  width: 15px;
  height: 15px;
}

.workspace-grid {
  display: grid;
  height: clamp(700px, 80dvh, 880px);
  min-height: 700px;
  grid-template-columns: 260px minmax(560px, 1fr) 350px;
}

.people-panel,
.person-panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: rgba(8, 10, 8, 0.92);
}

.people-panel {
  display: grid;
  grid-template-rows: 74px auto minmax(0, 1fr);
  border-right: 1px solid var(--line);
}

.person-panel {
  display: grid;
  grid-template-rows: 74px minmax(0, 1fr);
  border-left: 1px solid var(--line);
}

.panel-heading {
  min-height: 74px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > span:first-child {
  display: grid;
  gap: 4px;
}

.panel-heading small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.panel-heading strong {
  font-family: "Russo One", sans-serif;
  font-size: 21px;
  text-transform: uppercase;
}

.square-button {
  width: 40px;
  padding: 0;
}

.people-search {
  position: relative;
  display: block;
  margin: 14px;
}

.people-search svg {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 13px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  transform: translateY(-50%);
}

.people-search input {
  min-height: 42px;
  padding-left: 38px;
  font-size: 14px;
}

.people-list {
  display: grid;
  min-height: 0;
  padding: 0 10px 18px;
  gap: 5px;
  overflow: auto;
}

.person-list-button {
  display: grid;
  min-height: 66px;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: transform 160ms var(--ease), border-color 160ms ease, background-color 160ms ease;
}

.person-list-button:hover {
  background: rgba(255, 255, 255, 0.035);
  transform: translateX(2px);
}

.person-list-button.is-selected {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.person-list-avatar,
.tree-card-avatar {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: #0c0f0b;
  color: var(--accent);
  font-family: "Russo One", sans-serif;
}

.person-list-avatar img,
.tree-card-avatar img {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: cover;
}

.person-list-avatar {
  width: 42px;
  height: 42px;
  font-size: 13px;
}

.person-list-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.person-list-copy strong,
.person-list-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person-list-copy strong {
  font-size: 13px;
}

.person-list-copy small {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.tree-panel {
  position: relative;
  display: grid;
  min-width: 0;
  grid-template-rows: 64px minmax(0, 1fr);
  overflow: hidden;
  background:
    radial-gradient(circle at center, rgba(var(--accent-rgb), 0.04), transparent 45%),
    #060706;
}

.tree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  text-transform: uppercase;
}

.tree-toolbar > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tree-toolbar > span svg {
  width: 14px;
  height: 14px;
}

.tree-toolbar > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.tree-toolbar button {
  width: 44px;
  min-height: 44px;
  padding: 0;
}

.tree-toolbar .tree-mode-button {
  width: auto;
  padding-inline: 11px;
}

.tree-toolbar .tree-fullscreen-button {
  margin-left: 5px;
  border-color: rgba(var(--accent-rgb), 0.72);
  background: rgba(var(--accent-rgb), 0.08);
  color: var(--accent);
}

.tree-toolbar .tree-fullscreen-button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--ink-inverse);
}

.tree-fullscreen-button [hidden] {
  display: none;
}

.tree-mode-button span {
  font-size: 10px;
}

.tree-toolbar button:disabled {
  opacity: 0.38;
  pointer-events: none;
}

.tree-toolbar output {
  min-width: 44px;
  text-align: center;
  font-size: 11px;
}

.tree-viewport {
  position: relative;
  min-height: 636px;
  overflow: auto;
  overscroll-behavior: contain;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.024) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.024) 1px, transparent 1px);
  background-size: 32px 32px;
  cursor: grab;
  scrollbar-color: rgba(var(--accent-rgb), 0.32) transparent;
}

.tree-viewport:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.tree-viewport.is-panning {
  cursor: grabbing;
  user-select: none;
}

.tree-panel.is-tree-fullscreen,
.tree-panel:fullscreen {
  width: 100dvw;
  height: 100dvh;
  min-height: 0;
  grid-template-rows: 58px minmax(0, 1fr);
  background:
    radial-gradient(circle at center, rgba(var(--accent-rgb), 0.055), transparent 52%),
    #060706;
}

.tree-panel:fullscreen::backdrop {
  background: #060706;
}

.tree-panel.is-tree-fullscreen .tree-toolbar {
  padding-right: max(clamp(12px, 2vw, 28px), env(safe-area-inset-right));
  padding-left: max(clamp(12px, 2vw, 28px), env(safe-area-inset-left));
  background: rgba(7, 8, 7, 0.97);
}

.tree-panel.is-tree-fullscreen .tree-viewport {
  min-height: 0;
}

.tree-panel.is-tree-fullscreen .tree-person-card:hover {
  transform: none;
}

.fullscreen-person-card {
  position: absolute;
  z-index: 8;
  top: 74px;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  display: grid;
  width: min(390px, calc(100% - 32px));
  grid-template-rows: 64px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(var(--accent-rgb), 0.72);
  background:
    linear-gradient(145deg, rgba(var(--accent-rgb), 0.08), transparent 38%),
    rgba(7, 9, 7, 0.97);
  box-shadow: -24px 28px 70px rgba(0, 0, 0, 0.58);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(calc(100% + 32px), 0, 0);
  transition:
    opacity 220ms ease,
    transform 260ms var(--ease),
    visibility 0s linear 260ms;
  visibility: hidden;
}

.tree-panel.is-tree-fullscreen .fullscreen-person-card.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0);
  transition-delay: 0s;
  visibility: visible;
}

.fullscreen-person-card-heading {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 0 18px;
  border-bottom: 1px solid var(--line);
}

.fullscreen-person-card-heading > span {
  display: grid;
  gap: 3px;
}

.fullscreen-person-card-heading small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
}

.fullscreen-person-card-heading strong {
  font-family: "Russo One", sans-serif;
  font-size: 21px;
  text-transform: uppercase;
}

.fullscreen-person-card-heading button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
}

.fullscreen-person-card-heading button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.fullscreen-person-card-heading svg {
  width: 16px;
  height: 16px;
}

.fullscreen-person-card-content {
  min-height: 0;
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(var(--accent-rgb), 0.4) transparent;
}

.fullscreen-person-summary {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.fullscreen-person-portrait {
  position: relative;
  display: grid;
  width: 96px;
  height: 112px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(circle at 50% 36%, rgba(var(--accent-rgb), 0.18), transparent 62%),
    #090b09;
  color: var(--accent);
  font-family: "Russo One", sans-serif;
  font-size: 28px;
}

button.fullscreen-person-portrait:not(:disabled) {
  padding: 0;
  cursor: zoom-in;
}

button.fullscreen-person-portrait:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.fullscreen-person-portrait img {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: cover;
}

.fullscreen-person-copy {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.fullscreen-person-copy > small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fullscreen-person-copy h2 {
  margin: 0;
  font-family: "Russo One", sans-serif;
  font-size: clamp(22px, 2.6vw, 30px);
  line-height: 1.04;
  overflow-wrap: anywhere;
}

.fullscreen-person-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.fullscreen-person-photo-section {
  display: grid;
  margin-top: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}

.fullscreen-person-photo-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fullscreen-person-photo-heading strong {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fullscreen-person-photo-heading span {
  min-width: 30px;
  padding: 3px 6px;
  border: 1px solid rgba(var(--accent-rgb), 0.44);
  color: var(--accent);
  font-family: "Russo One", sans-serif;
  font-size: 10px;
  text-align: center;
}

.fullscreen-person-photo-strip {
  display: grid;
  grid-auto-columns: 72px;
  grid-auto-flow: column;
  justify-content: start;
  gap: 7px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-color: rgba(var(--accent-rgb), 0.52) transparent;
  scrollbar-width: thin;
  scroll-snap-type: inline mandatory;
}

.fullscreen-person-photo-strip button {
  position: relative;
  display: grid;
  width: 72px;
  aspect-ratio: 4 / 5;
  place-items: end start;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: #070807;
  color: var(--ink);
  scroll-snap-align: start;
}

.fullscreen-person-photo-strip button::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  content: "";
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.3);
  transition: opacity 150ms ease, transform 180ms var(--ease);
}

.fullscreen-person-photo-strip button:is(:hover, :focus-visible) {
  border-color: rgba(var(--accent-rgb), 0.76);
}

.fullscreen-person-photo-strip button.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.18);
}

.fullscreen-person-photo-strip button.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.fullscreen-person-photo-strip img {
  position: absolute;
  width: 100%;
  height: 100%;
  inset: 0;
  object-fit: cover;
}

.fullscreen-person-photo-strip button > span {
  position: relative;
  z-index: 1;
  margin: 5px;
  padding: 3px 4px;
  background: rgba(3, 4, 3, 0.82);
  color: var(--ink);
  font-family: "Russo One", sans-serif;
  font-size: 9px;
}

.fullscreen-person-details {
  display: grid;
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.fullscreen-person-detail {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  min-height: 48px;
  align-items: center;
  padding: 9px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  gap: 12px;
}

.fullscreen-person-detail dt,
.fullscreen-person-section-title {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.fullscreen-person-section-title {
  margin-top: 18px;
}

.fullscreen-person-detail dd {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.fullscreen-person-facts {
  display: grid;
  margin: 18px 0 0;
  padding: 0;
  gap: 7px;
  list-style: none;
}

.fullscreen-person-facts li {
  display: grid;
  padding: 11px 12px;
  border: 1px solid var(--line);
  gap: 4px;
}

.fullscreen-person-facts strong {
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
}

.fullscreen-person-facts span,
.fullscreen-person-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.fullscreen-person-note {
  margin: 8px 0 0;
  padding: 12px;
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

body.tree-fullscreen-fallback {
  overflow: hidden;
}

body.tree-fullscreen-fallback .tree-panel.is-tree-fullscreen {
  position: fixed;
  z-index: 1000;
  inset: 0;
}

.tree-canvas {
  position: relative;
  width: 100%;
  min-width: 100%;
  min-height: 100%;
}

.tree-world {
  position: relative;
  width: max-content;
  padding: 94px 88px 132px;
  transform: scale(var(--tree-zoom, 1));
  transform-origin: top left;
  transition: transform 220ms var(--ease);
}

.tree-world.is-wheel-zooming {
  transition: none;
}

.generation-grid {
  position: relative;
  z-index: 2;
  display: grid;
  width: max-content;
  gap: 138px;
}

.generation-row {
  display: grid;
  min-width: 100%;
  grid-template-columns: 74px minmax(max-content, 1fr);
  align-items: center;
  gap: 30px;
}

.generation-label {
  position: sticky;
  left: 10px;
  z-index: 3;
  display: grid;
  width: 70px;
  gap: 4px;
  padding: 9px 6px;
  border-left: 1px solid var(--accent);
  background: rgba(6, 7, 6, 0.88);
  color: var(--muted);
  text-transform: uppercase;
}

.generation-label span {
  color: var(--accent);
  font-family: "Russo One", sans-serif;
  font-size: 15px;
}

.generation-label strong {
  font-size: 12px;
  letter-spacing: 0.08em;
}

.generation-track {
  display: flex;
  min-width: max-content;
  align-items: center;
  justify-content: flex-start;
  gap: 34px;
}

.family-unit {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  transform: translate3d(var(--generation-offset, 0px), 0, 0);
}

.tree-person-card {
  position: relative;
  display: grid;
  width: 236px;
  min-height: 112px;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  padding: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(9, 11, 9, 0.98);
  color: var(--ink);
  text-align: left;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.24);
  transition: transform 180ms var(--ease), border-color 180ms ease, box-shadow 180ms ease;
}

.tree-person-card::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  content: "";
  background: var(--accent);
  opacity: 0;
  transform: scaleX(0.35);
  transition: opacity 180ms ease, transform 180ms var(--ease);
}

.tree-person-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.34);
}

.tree-person-card.is-selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(var(--accent-rgb), 0.24), 0 20px 42px rgba(0, 0, 0, 0.36);
}

.tree-person-card.is-selected::after {
  opacity: 1;
  transform: scaleX(1);
}

.tree-person-card.is-focus::before {
  position: absolute;
  top: -19px;
  left: 50%;
  padding: 3px 6px;
  content: "ФОКУС";
  background: var(--accent);
  color: var(--ink-inverse);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.08em;
  transform: translateX(-50%);
}

.tree-card-avatar {
  width: 58px;
  height: 58px;
  font-size: 17px;
}

.tree-card-copy {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.tree-card-copy strong {
  display: -webkit-box;
  overflow: hidden;
  font-family: "Russo One", sans-serif;
  font-size: 16px;
  line-height: 1.15;
  text-transform: uppercase;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tree-card-copy small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
}

.relationship-lines {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.relationship-lines path {
  fill: none;
  stroke: rgba(218, 228, 208, 0.72);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  shape-rendering: geometricPrecision;
  opacity: 0.68;
  transition: opacity 150ms ease, stroke 150ms ease;
}

.relationship-lines path.partner {
  stroke: var(--accent);
  stroke-width: 1.75;
  opacity: 0.76;
}

.relationship-lines path.parent-family {
  stroke: rgba(218, 228, 208, 0.72);
}

.relationship-lines path.is-active {
  opacity: 1;
}

.relationship-lines path.parent-family.is-active {
  stroke: var(--accent);
  stroke-width: 2.4;
}

.relationship-lines .family-junction,
.relationship-lines .family-bus-junction {
  fill: var(--accent);
  stroke: #070807;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  opacity: 0.88;
  transition: opacity 150ms ease;
}

.relationship-lines .family-bus-junction {
  stroke-width: 1.5;
}

.relationship-lines :is(.family-junction, .family-bus-junction).is-active {
  opacity: 1;
}

.person-panel form {
  display: grid;
  min-height: 0;
  padding: 18px;
  overflow: auto;
}

.person-photo-stage {
  display: grid;
  margin-bottom: 18px;
  gap: 9px;
}

.person-photo-hero {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 50% 40%, rgba(var(--accent-rgb), 0.12), transparent 56%),
    #080a08;
  color: var(--accent);
  font-family: "Russo One", sans-serif;
  font-size: 46px;
}

.person-photo-hero-button {
  position: absolute;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  inset: 0;
}

.person-photo-hero-button:not(:disabled) {
  cursor: zoom-in;
}

.person-photo-hero-button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -3px;
}

.person-photo-hero-button:disabled {
  cursor: default;
}

.person-photo-hero-button img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.photo-zoom-hint {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  padding: 6px 8px;
  background: rgba(5, 6, 5, 0.84);
  color: var(--ink);
  font-family: Inter, sans-serif;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 160ms ease, transform 160ms var(--ease);
}

:is(.person-photo-hero-button, .fullscreen-person-portrait):is(:hover, :focus-visible) .photo-zoom-hint {
  opacity: 1;
  transform: translateY(0);
}

.person-photo-gallery {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
}

.person-photo-gallery button {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #070807;
}

.person-photo-gallery button.is-active {
  border-color: var(--accent);
  box-shadow: inset 0 -2px var(--accent);
}

.person-photo-gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.add-photo-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.add-photo-button:hover {
  border-color: var(--accent);
}

.add-photo-button svg {
  width: 15px;
  height: 15px;
}

.person-facts {
  display: grid;
  margin: 0 0 16px;
  padding: 0;
  gap: 1px;
  list-style: none;
  border: 1px solid var(--line);
}

.person-facts li {
  display: grid;
  padding: 10px 11px;
  gap: 3px;
  background: rgba(255, 255, 255, 0.018);
}

.person-facts li + li {
  border-top: 1px solid var(--line);
}

.person-facts strong {
  color: var(--accent);
  font-size: 10px;
  text-transform: uppercase;
}

.person-facts span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.history-notes-button {
  display: grid;
  width: 100%;
  min-height: 86px;
  grid-template-columns: 38px minmax(0, 1fr) auto 18px;
  align-items: center;
  gap: 12px;
  margin: 0 0 14px;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.08), transparent 58%),
    #070807;
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease);
}

.history-notes-button:hover,
.history-notes-button:focus-visible {
  border-color: var(--accent);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.14), transparent 68%),
    #090b09;
}

.history-notes-button:hover {
  transform: translateY(-1px);
}

.history-notes-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
}

.history-notes-icon svg,
.history-notes-button > svg {
  width: 17px;
  height: 17px;
}

.history-notes-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.history-notes-copy small {
  color: var(--accent);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.07em;
}

.history-notes-copy strong {
  font-size: 13px;
  text-transform: uppercase;
}

.history-notes-copy > span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-notes-count {
  display: grid;
  min-width: 30px;
  height: 30px;
  place-items: center;
  padding-inline: 7px;
  border: 1px solid var(--line-strong);
  color: var(--accent);
  font-family: "Russo One", sans-serif;
  font-size: 12px;
}

.person-panel .roots-field {
  margin-bottom: 14px;
}

.person-panel .roots-field input {
  min-height: 44px;
  font-size: 15px;
}

.access-chip {
  padding: 5px 7px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
}

.date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.relative-actions {
  display: grid;
  gap: 9px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.relative-actions > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.relative-actions > div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.relative-actions button,
.delete-person-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 0 7px;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  transition: transform 160ms var(--ease), border-color 160ms ease, background-color 160ms ease;
}

.relative-actions button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.relative-actions svg,
.delete-person-button svg {
  width: 13px;
  height: 13px;
}

.delete-person-button {
  margin-top: 14px;
  border-color: rgba(239, 140, 124, 0.35);
  color: var(--error);
}

.delete-person-button:hover {
  border-color: var(--error);
  background: rgba(239, 140, 124, 0.08);
}

.roots-workspace[data-access="viewer"] .owner-only {
  display: none !important;
}

.share-dialog[data-access="viewer"] .owner-only {
  display: none !important;
}

.history-dialog[data-access="viewer"] .owner-only {
  display: none !important;
}

.roots-workspace[data-access="viewer"] input:not(#peopleSearchInput),
.roots-workspace[data-access="viewer"] textarea,
.roots-workspace[data-access="viewer"] select {
  border-color: transparent;
  background: transparent;
  color: var(--ink);
}

.fullscreen-history-button {
  display: grid;
  width: 100%;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  background: var(--accent-soft);
  color: var(--ink);
  text-align: left;
}

.fullscreen-history-button:hover,
.fullscreen-history-button:focus-visible {
  border-color: var(--accent);
}

.fullscreen-history-button > svg {
  width: 19px;
  height: 19px;
  color: var(--accent);
}

.fullscreen-history-button > span {
  display: grid;
  gap: 3px;
}

.fullscreen-history-button strong {
  font-size: 12px;
  text-transform: uppercase;
}

.fullscreen-history-button small {
  color: var(--muted);
  font-size: 11px;
}

.share-dialog {
  width: min(610px, calc(100% - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.68);
}

.roots-auth-dialog {
  width: min(520px, calc(100% - 28px));
  max-height: min(820px, calc(100dvh - 28px));
  padding: 0;
  overflow: auto;
  border: 1px solid var(--accent);
  border-radius: 0;
  background:
    linear-gradient(rgba(230, 236, 224, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(230, 236, 224, 0.025) 1px, transparent 1px),
    #050605;
  background-size: 36px 36px;
  color: var(--ink);
  box-shadow: 0 42px 140px rgba(0, 0, 0, 0.82);
}

.roots-auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(7px);
}

.roots-auth-dialog[open] {
  animation: photo-lightbox-in 180ms var(--ease) both;
}

.roots-auth-dialog.is-invalid {
  animation: roots-auth-shake 220ms ease both;
}

.roots-auth-shell {
  display: grid;
  min-height: 0;
}

.roots-auth-heading {
  display: flex;
  min-height: 88px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px 16px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 7, 0.92);
}

.roots-auth-heading > span {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.roots-auth-heading small {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.roots-auth-heading strong {
  overflow: hidden;
  font-family: "Russo One", sans-serif;
  font-size: clamp(22px, 5vw, 30px);
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.roots-auth-heading button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.roots-auth-heading button:hover,
.roots-auth-heading button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.roots-auth-heading svg {
  width: 17px;
  height: 17px;
}

.roots-owner-chooser {
  display: grid;
  padding: 22px;
  gap: 10px;
}

.roots-owner-option {
  display: grid;
  width: 100%;
  min-height: 78px;
  grid-template-columns: 48px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.075), transparent 66%),
    #070807;
  color: var(--ink);
  text-align: left;
  transition: border-color 160ms ease, transform 180ms var(--ease), background-color 160ms ease;
}

.roots-owner-option:hover,
.roots-owner-option:focus-visible {
  border-color: var(--accent);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.14), transparent 72%),
    #090b09;
}

.roots-owner-option:hover {
  transform: translateX(3px);
}

.roots-owner-avatar {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: "Russo One", sans-serif;
  font-size: 20px;
}

.roots-owner-option > span:nth-child(2) {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.roots-owner-option strong {
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.roots-owner-option small {
  overflow: hidden;
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roots-owner-option > svg {
  width: 17px;
  height: 17px;
  color: var(--accent);
}

.roots-auth-error {
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(239, 140, 124, 0.42);
  color: var(--error);
  font-size: 13px;
}

.roots-auth-code-stage {
  display: grid;
  padding: 18px 22px 24px;
}

.roots-auth-back {
  display: inline-flex;
  width: max-content;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.roots-auth-back:hover,
.roots-auth-back:focus-visible {
  color: var(--accent);
}

.roots-auth-back svg {
  width: 15px;
  height: 15px;
}

.roots-auth-console {
  position: relative;
  display: grid;
  min-height: 110px;
  align-content: center;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-left-color: var(--accent);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.08), transparent 72%),
    #070807;
}

.roots-auth-console-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.roots-auth-dialog.is-invalid .roots-auth-console-meta > span:first-child {
  color: var(--error);
}

.roots-auth-hidden-input {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  opacity: 0;
  color: transparent;
  caret-color: transparent;
}

.roots-auth-slots {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 9px;
  pointer-events: none;
}

.roots-auth-slots span {
  position: relative;
  height: 38px;
  border: 1px solid var(--line-strong);
  background: #050605;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.roots-auth-slots span::after {
  position: absolute;
  inset: 50% auto auto 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.3);
  transition: opacity 140ms ease, transform 160ms var(--ease);
}

.roots-auth-slots span.is-filled {
  border-color: rgba(var(--accent-rgb), 0.66);
  background: var(--accent-soft);
}

.roots-auth-slots span.is-filled::after {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.roots-auth-slots span.is-current {
  border-color: var(--accent);
}

.roots-auth-dialog.is-invalid .roots-auth-slots span {
  border-color: rgba(239, 140, 124, 0.48);
}

.roots-auth-keypad {
  display: grid;
  width: min(100%, 330px);
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin: 12px auto;
}

.roots-auth-keypad button {
  display: grid;
  min-height: 50px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  background: rgba(7, 8, 7, 0.94);
  color: var(--ink);
  font-family: "Russo One", sans-serif;
  font-size: 17px;
}

.roots-auth-keypad button:hover,
.roots-auth-keypad button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.roots-auth-keypad .roots-auth-key-action {
  color: var(--muted);
}

.roots-auth-keypad svg {
  width: 17px;
  height: 17px;
}

.roots-auth-submit {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 18px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--ink-inverse);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.roots-auth-submit:disabled {
  border-color: var(--line);
  background: #101210;
  color: var(--muted-2);
  cursor: not-allowed;
}

.roots-auth-dialog.is-verifying .roots-auth-submit {
  opacity: 0.62;
}

.roots-auth-submit svg {
  width: 17px;
  height: 17px;
}

.share-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(5px);
}

.photo-lightbox {
  width: min(1500px, calc(100vw - 32px));
  height: min(1060px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: #050605;
  color: var(--ink);
  box-shadow: 0 42px 140px rgba(0, 0, 0, 0.82);
}

.photo-lightbox::backdrop {
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(8px);
}

.history-dialog {
  width: min(1280px, calc(100vw - 32px));
  height: min(880px, calc(100dvh - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--accent);
  border-radius: 0;
  background: #050605;
  color: var(--ink);
  box-shadow: 0 42px 140px rgba(0, 0, 0, 0.82);
}

.history-dialog::backdrop {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
}

.history-dialog[open] {
  animation: photo-lightbox-in 180ms var(--ease) both;
}

.history-dialog-shell {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.history-dialog-heading {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 16px 12px 24px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(var(--accent-rgb), 0.11), transparent 40%),
    #070807;
}

.history-dialog-heading > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.history-dialog-heading small,
.history-section-heading small,
.history-event-editor-heading small {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.history-dialog-heading strong {
  overflow: hidden;
  font-family: "Russo One", sans-serif;
  font-size: clamp(19px, 2.4vw, 27px);
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.history-dialog-heading em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.history-dialog-heading button,
.history-event-editor-heading button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.history-dialog-heading button:hover,
.history-event-editor-heading button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.history-dialog-heading button svg,
.history-event-editor-heading button svg {
  width: 18px;
  height: 18px;
}

.history-dialog-body {
  position: relative;
  display: grid;
  min-height: 0;
  grid-template-columns: minmax(300px, 0.85fr) minmax(390px, 1.15fr);
}

.history-biography-panel,
.history-timeline-panel {
  min-width: 0;
  min-height: 0;
  padding: 22px;
  overflow: auto;
}

.history-biography-panel {
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgba(190, 169, 137, 0.018) 1px, transparent 1px),
    #060706;
  background-size: 100% 32px;
}

.history-section-heading {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.history-section-heading > span:first-child {
  display: grid;
  gap: 3px;
}

.history-section-heading strong,
.history-event-editor-heading strong {
  font-family: "Russo One", sans-serif;
  font-size: 18px;
  text-transform: uppercase;
}

.history-character-count {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.history-note-field textarea {
  min-height: 430px;
  padding: 16px;
  background: rgba(4, 5, 4, 0.94);
  font-size: 15px;
  line-height: 1.62;
}

.history-dialog[data-access="viewer"] .history-note-field textarea {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.016);
}

.history-field-help {
  margin: -5px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.history-add-event {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.history-add-event:hover {
  background: rgba(var(--accent-rgb), 0.18);
}

.history-add-event svg {
  width: 14px;
  height: 14px;
}

.history-empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  align-content: center;
  gap: 9px;
  padding: 30px;
  border: 1px dashed var(--line-strong);
  color: var(--muted);
  text-align: center;
}

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

.history-empty-state svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.history-empty-state strong {
  color: var(--ink);
  font-size: 13px;
  text-transform: uppercase;
}

.history-empty-state span {
  max-width: 340px;
  font-size: 12px;
  line-height: 1.55;
}

.history-event-list {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 9px;
  list-style: none;
}

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

.history-event-item {
  display: grid;
  border: 1px solid var(--line);
  background: #070807;
}

.history-event-card {
  display: grid;
  width: 100%;
  gap: 8px;
  padding: 15px;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

.history-event-card:hover,
.history-event-card:focus-visible {
  background: rgba(var(--accent-rgb), 0.07);
  box-shadow: inset 3px 0 var(--accent);
}

.history-event-card-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.history-event-card-heading strong {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-event-card-heading time {
  flex: 0 0 auto;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
}

.history-event-card-meta,
.history-event-card-details {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.history-event-card-details {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.history-event-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.history-event-badge {
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 9px;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-event-badge.has-source {
  border-color: rgba(var(--accent-rgb), 0.46);
  color: var(--accent);
}

.history-event-badge.has-warning {
  border-color: rgba(239, 140, 124, 0.5);
  color: var(--error);
}

.history-event-source-link {
  padding: 10px 15px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-decoration: none;
  text-transform: uppercase;
}

.history-event-source-link:hover,
.history-event-source-link:focus-visible {
  background: var(--accent-soft);
}

.history-event-editor {
  position: absolute;
  z-index: 5;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(500px, 100%);
  border-left: 1px solid var(--accent);
  background: #070807;
  box-shadow: -32px 0 80px rgba(0, 0, 0, 0.72);
}

.history-event-editor[hidden] {
  display: none;
}

.history-event-editor form {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.history-event-editor-heading {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px 12px 20px;
  border-bottom: 1px solid var(--line);
}

.history-event-editor-heading > span {
  display: grid;
  gap: 3px;
}

.history-event-fields {
  min-height: 0;
  padding: 18px 20px 28px;
  overflow: auto;
}

.history-event-date-grid {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 10px;
}

.history-source-fields {
  display: grid;
  margin: 7px 0 0;
  padding: 16px;
  gap: 0;
  border: 1px solid var(--line-strong);
}

.history-source-fields legend {
  padding: 0 7px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.history-source-fields .roots-field:last-child {
  margin-bottom: 0;
}

.history-event-error {
  min-height: 18px;
  margin: 14px 0 0;
  color: var(--error);
  font-size: 12px;
  line-height: 1.45;
}

.history-event-actions {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
  background: #060706;
}

.history-event-actions button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.history-event-actions button svg {
  width: 15px;
  height: 15px;
}

.history-event-actions .history-save-event {
  margin-left: auto;
  border-color: var(--accent);
  background: var(--accent-soft);
}

.history-event-actions .history-delete-event:hover {
  border-color: var(--error);
  color: var(--error);
}

.photo-lightbox[open] {
  animation: photo-lightbox-in 180ms var(--ease) both;
}

.photo-lightbox-shell {
  display: grid;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.photo-lightbox-heading {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 16px 12px 20px;
  border-bottom: 1px solid var(--line);
}

.photo-lightbox-heading > span {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.photo-lightbox-heading small {
  color: var(--accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.photo-lightbox-heading strong {
  overflow: hidden;
  font-family: "Russo One", sans-serif;
  font-size: 20px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.photo-lightbox-heading button {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.photo-lightbox-heading button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.photo-lightbox-heading svg {
  width: 18px;
  height: 18px;
}

.photo-lightbox figure {
  display: grid;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
  margin: 0;
}

.photo-lightbox-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 20px;
  background:
    linear-gradient(rgba(190, 169, 137, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(190, 169, 137, 0.025) 1px, transparent 1px),
    #030403;
  background-size: 32px 32px;
}

.photo-lightbox-stage img {
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 160px);
  object-fit: contain;
  opacity: 0;
  transition: opacity 160ms ease;
}

.photo-lightbox-stage[data-state="ready"] img {
  opacity: 1;
}

.photo-lightbox-status {
  position: absolute;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.photo-lightbox-stage[data-state="ready"] .photo-lightbox-status {
  display: none;
}

.photo-lightbox-stage[data-state="error"] .photo-lightbox-status {
  color: var(--error);
}

.photo-lightbox figcaption {
  min-height: 52px;
  padding: 16px 20px;
  overflow: hidden;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes photo-lightbox-in {
  from {
    opacity: 0;
    transform: scale(0.985);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes roots-auth-shake {
  0%,
  100% {
    transform: translateX(0);
  }

  35% {
    transform: translateX(-7px);
  }

  70% {
    transform: translateX(7px);
  }
}

.dialog-shell {
  padding: 24px;
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-heading > span {
  display: grid;
  gap: 5px;
}

.dialog-heading small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.dialog-heading strong {
  font-family: "Russo One", sans-serif;
  font-size: 24px;
  text-transform: uppercase;
}

.dialog-heading button {
  width: 44px;
  padding: 0;
}

.share-seal {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  margin: 20px 0;
  padding: 16px;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
}

.share-seal > svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
}

.share-seal span {
  display: grid;
  gap: 4px;
}

.share-seal strong {
  font-size: 14px;
}

.share-seal small {
  color: var(--muted);
  font-size: 12px;
}

#shareUrlInput {
  font-family: ui-monospace, "Cascadia Mono", monospace;
  font-size: 13px;
}

.copy-share-button,
.rotate-share-button {
  display: inline-flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--ink-inverse);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
  transition: transform 170ms var(--ease);
}

.copy-share-button:hover,
.rotate-share-button:hover {
  transform: translateY(-2px);
}

.copy-share-button svg,
.rotate-share-button svg {
  width: 16px;
  height: 16px;
}

.share-caveat {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 11px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.share-caveat svg {
  width: 20px;
  height: 20px;
  color: var(--accent);
}

.share-caveat p {
  margin: 0;
}

.share-caveat strong {
  color: var(--ink);
}

.rotate-share-button {
  min-height: 58px;
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.rotate-share-button > span {
  display: grid;
  gap: 2px;
}

.rotate-share-button small {
  color: var(--muted);
  font-size: 10px;
}

.roots-toast {
  position: fixed;
  z-index: 160;
  right: 24px;
  bottom: 24px;
  max-width: min(380px, calc(100% - 48px));
  padding: 13px 16px;
  border: 1px solid var(--accent);
  background: #0c100a;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate3d(0, 14px, 0);
  transition: opacity 170ms ease, transform 220ms var(--ease);
}

.roots-toast.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.roots-toast.is-error {
  border-color: var(--error);
}

.custom-cursor-layer {
  position: fixed;
  z-index: 999;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  pointer-events: none;
}

.custom-cursor {
  position: fixed;
  top: 0;
  left: 0;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(var(--accent-rgb), 0.55);
  border-radius: 50%;
  opacity: 0;
  transform: translate3d(var(--cursor-x), var(--cursor-y), 0) translate(-50%, -50%);
  will-change: transform;
}

.custom-cursor img {
  width: 13px;
  height: 13px;
}

body.has-custom-cursor,
body.has-custom-cursor :is(a, button, input, textarea, label) {
  cursor: none !important;
}

body.has-custom-cursor .custom-cursor {
  opacity: 1;
}

@media (max-width: 1120px) {
  .roots-shell {
    width: min(100% - 32px, 1020px);
  }

  .roots-entry {
    grid-template-columns: 1fr 380px;
  }

  .roots-intro {
    padding-inline: 34px;
  }

  .privacy-ledger {
    grid-template-columns: 1fr;
    margin-top: 34px;
  }

  .privacy-ledger > div {
    padding: 13px 0;
  }

  .privacy-ledger > div + div {
    padding-left: 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .workspace-grid {
    height: auto;
    min-height: 0;
    grid-template-columns: 230px minmax(0, 1fr);
    grid-template-rows: clamp(640px, 76dvh, 780px) auto;
  }

  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .save-state {
    margin-right: auto;
  }

  .people-panel,
  .tree-panel {
    height: 100%;
    min-height: 0;
  }

  .tree-viewport {
    min-height: 0;
  }

  .person-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .person-panel form {
    max-height: none;
    grid-template-columns: repeat(2, 1fr);
    gap: 0 14px;
  }

  .person-panel .relative-actions,
  .person-panel .delete-person-button,
  .person-panel .person-facts,
  .person-panel .history-notes-button {
    grid-column: 1 / -1;
  }

  .person-panel .person-photo-stage {
    width: min(100%, 760px);
    grid-column: 1 / -1;
    grid-template-columns: minmax(240px, 340px) minmax(0, 1fr);
    align-items: start;
    gap: 10px 14px;
  }

  .person-panel .person-photo-hero {
    max-width: 340px;
    grid-row: 1 / span 3;
  }

  .person-panel .person-photo-gallery,
  .person-panel .add-photo-button {
    grid-column: 2;
  }
}

@media (max-width: 820px) {
  .roots-shell {
    width: calc(100% - 24px);
    padding-top: 56px;
  }

  .service-switcher {
    width: 100%;
    margin-bottom: 12px;
  }

  .service-switcher a {
    width: 25%;
    min-width: 0;
    padding-inline: 10px;
  }

  .roots-entry {
    grid-template-columns: 1fr;
  }

  .roots-intro {
    min-height: 520px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .workspace-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .save-state {
    margin-right: auto;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .people-panel {
    grid-row: 2;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .people-list {
    max-height: 220px;
  }

  .tree-panel {
    grid-row: 1;
    height: clamp(560px, 76dvh, 720px);
    min-height: 0;
  }

  .tree-viewport {
    min-height: 0;
  }

  .person-panel {
    grid-row: 3;
  }

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

  .person-photo-gallery {
    grid-auto-columns: 64px;
    grid-auto-flow: column;
    grid-template-columns: none;
    justify-content: start;
    padding-bottom: 7px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
  }

  .person-photo-gallery button {
    width: 64px;
    scroll-snap-align: start;
  }

  .person-panel .relative-actions,
  .person-panel .delete-person-button,
  .person-panel .person-photo-stage,
  .person-panel .person-facts,
  .person-panel .history-notes-button {
    grid-column: auto;
  }

  .person-panel .person-photo-stage {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .person-panel .person-photo-hero {
    max-width: none;
    grid-row: auto;
  }

  .person-panel .person-photo-gallery,
  .person-panel .add-photo-button {
    grid-column: auto;
  }

  .history-dialog {
    width: calc(100vw - 16px);
    height: calc(100dvh - 16px);
  }

  .history-dialog-body {
    display: block;
    overflow: auto;
  }

  .history-biography-panel,
  .history-timeline-panel {
    overflow: visible;
  }

  .history-biography-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .history-note-field textarea {
    min-height: 280px;
  }

  .history-timeline-panel {
    min-height: 420px;
  }

  .history-event-editor {
    position: fixed;
    width: min(500px, 100vw);
    height: 100dvh;
    border-left: 1px solid var(--accent);
  }
}

@media (max-width: 560px) {
  .system-chrome {
    grid-template-columns: 1fr auto;
    padding-inline: 10px;
  }

  .system-chrome-center,
  .system-network {
    display: none;
  }

  .system-brand span {
    font-size: 9px;
  }

  .roots-accessibility-toggle {
    min-width: 44px;
  }

  .roots-accessibility-toggle span {
    display: none;
  }

  .service-switcher a {
    min-height: 52px;
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 6px;
    padding-inline: 7px;
  }

  .service-switcher a > svg,
  .service-copy small {
    display: none;
  }

  .service-copy strong {
    font-size: 10px;
  }

  .roots-intro {
    min-height: 500px;
    padding: 26px 22px;
  }

  .roots-title-lockup {
    gap: 16px;
    margin-top: 40px;
  }

  .roots-title-lockup h1 {
    font-size: clamp(44px, 15vw, 64px);
  }

  .roots-mark {
    width: 62px;
    transform: scale(0.82);
  }

  .roots-lede {
    font-size: 15px;
  }

  .create-console {
    padding: 28px 20px 22px;
  }

  .owner-entry-seal {
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
  }

  .owner-entry-seal-mark {
    width: 46px;
    height: 46px;
  }

  .roots-auth-dialog {
    width: 100vw;
    height: 100dvh;
    max-height: none;
    border: 0;
  }

  .roots-auth-heading {
    min-height: 72px;
    padding: 10px 10px 10px 16px;
  }

  .roots-auth-heading strong {
    font-size: 20px;
  }

  .roots-owner-chooser {
    padding: 14px 12px;
  }

  .roots-auth-code-stage {
    padding: 14px 12px max(18px, env(safe-area-inset-bottom));
  }

  .roots-auth-console {
    min-height: 98px;
    padding: 14px;
  }

  .roots-auth-slots {
    gap: 6px;
  }

  .roots-auth-keypad {
    width: min(100%, 360px);
  }

  .roots-auth-keypad button {
    min-height: 48px;
  }

  .workspace-header {
    padding: 18px;
  }

  #treeTitleInput {
    min-width: 0;
    width: 100%;
  }

  .workspace-button span {
    display: none;
  }

  .workspace-button {
    width: 44px;
    padding: 0;
  }

  .tree-toolbar > span {
    display: none;
  }

  .tree-toolbar {
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: thin;
  }

  .tree-toolbar > div {
    min-width: max-content;
  }

  .tree-panel.is-tree-fullscreen .tree-toolbar {
    padding-right: max(6px, env(safe-area-inset-right));
    padding-left: max(6px, env(safe-area-inset-left));
    overflow-x: auto;
  }

  .tree-panel.is-tree-fullscreen .tree-toolbar > div {
    gap: 4px;
  }

  .tree-panel.is-tree-fullscreen .tree-mode-button {
    width: 44px;
    padding: 0;
  }

  .tree-panel.is-tree-fullscreen .tree-mode-button span {
    display: none;
  }

  .tree-panel.is-tree-fullscreen .fullscreen-person-card {
    top: auto;
    right: max(8px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    left: max(8px, env(safe-area-inset-left));
    width: auto;
    max-height: min(68dvh, 610px);
    transform: translate3d(0, calc(100% + 20px), 0);
  }

  .tree-panel.is-tree-fullscreen .fullscreen-person-card.is-open {
    transform: translate3d(0, 0, 0);
  }

  .fullscreen-person-card-content {
    padding: 14px;
  }

  .fullscreen-person-summary {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 12px;
  }

  .fullscreen-person-portrait {
    width: 74px;
    height: 88px;
    font-size: 22px;
  }

  .fullscreen-person-copy h2 {
    font-size: 21px;
  }

  .fullscreen-person-photo-strip {
    grid-auto-columns: 64px;
  }

  .fullscreen-person-photo-strip button {
    width: 64px;
  }

  .fullscreen-person-detail {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .tree-world {
    padding-inline: 38px;
  }

  .generation-row {
    grid-template-columns: 60px minmax(max-content, 1fr);
    gap: 18px;
  }

  .generation-label {
    width: 54px;
  }

  .generation-track {
    gap: 40px;
  }

  .family-unit {
    gap: 12px;
  }

  .tree-person-card {
    width: 200px;
    min-height: 96px;
    grid-template-columns: 48px minmax(0, 1fr);
    padding: 13px;
  }

  .tree-card-avatar {
    width: 48px;
    height: 48px;
  }

  .date-grid {
    grid-template-columns: 1fr;
  }

  .dialog-shell {
    padding: 18px;
  }

  .dialog-heading strong {
    font-size: 20px;
  }

  .photo-lightbox {
    width: 100vw;
    height: 100dvh;
    border: 0;
  }

  .photo-lightbox-heading {
    min-height: 60px;
    padding: 8px 10px 8px 14px;
  }

  .photo-lightbox-heading strong {
    font-size: 17px;
  }

  .photo-lightbox-stage {
    padding: 8px;
  }

  .photo-lightbox-stage img {
    max-height: calc(100dvh - 122px);
  }

  .photo-lightbox figcaption {
    min-height: 46px;
    padding: 13px 14px;
    font-size: 12px;
  }

  .history-dialog {
    width: 100vw;
    height: 100dvh;
    border: 0;
  }

  .history-dialog-heading {
    min-height: 66px;
    padding: 8px 9px 8px 14px;
  }

  .history-dialog-heading strong {
    font-size: 17px;
  }

  .history-biography-panel,
  .history-timeline-panel {
    padding: 16px 12px;
  }

  .history-note-field textarea {
    min-height: 230px;
  }

  .history-event-card-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .history-event-editor {
    border-left: 0;
  }

  .history-event-editor-heading {
    min-height: 62px;
    padding: 8px 9px 8px 14px;
  }

  .history-event-fields {
    padding: 14px 12px 24px;
  }

  .history-event-date-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .history-source-fields {
    padding: 13px 11px;
  }

  .history-event-actions {
    padding: 10px 12px;
  }

  .history-event-actions button {
    min-height: 44px;
  }
}

html.a11y-mode {
  font-size: 18px;
}

html.a11y-mode body {
  font-size: 18px;
}

html.a11y-mode :is(.system-brand, .system-chrome-center, .system-network, .module-row, .module-index, .service-index, .service-copy strong, .service-copy small, .panel-heading small, .roots-field > span, .workspace-identity p, .people-list-copy small, .tree-card-copy small, .save-state, .history-notes-copy small, .history-section-heading small, .history-event-editor-heading small, .roots-auth-heading small, .roots-auth-console-meta) {
  font-size: 14px;
  letter-spacing: 0;
}

html.a11y-mode :is(
  .people-list-copy strong,
  .tree-card-copy strong,
  .generation-label span,
  .generation-label strong,
  .tree-toolbar,
  .tree-toolbar output,
  .tree-mode-button span
) {
  font-size: 18px;
  letter-spacing: 0;
}

html.a11y-mode .generation-label {
  width: 82px;
}

html.a11y-mode .generation-row {
  grid-template-columns: 92px minmax(max-content, 1fr);
}

html.a11y-mode .service-switcher a {
  min-height: 66px;
}

html.a11y-mode .roots-lede {
  font-size: 21px;
}

html.a11y-mode .privacy-ledger strong,
html.a11y-mode .privacy-ledger small,
html.a11y-mode .create-warning,
html.a11y-mode .share-caveat {
  font-size: 15px;
}

html.a11y-mode :is(.roots-field input, .roots-field textarea, .roots-field select, .people-search input, #treeTitleInput, .roots-auth-keypad button) {
  min-height: 54px;
  font-size: 18px;
}

html.a11y-mode :is(button, a, input, textarea):focus-visible {
  outline-width: 3px;
  outline-offset: 4px;
}

html.a11y-mode :is(
  .fullscreen-person-card-heading small,
  .fullscreen-person-copy > small,
  .fullscreen-person-photo-heading strong,
  .fullscreen-person-detail dt,
  .fullscreen-person-section-title,
  .fullscreen-person-facts strong
) {
  font-size: 13px;
  letter-spacing: 0;
}

html.a11y-mode :is(
  .fullscreen-person-copy p,
  .fullscreen-person-detail dd,
  .fullscreen-person-facts span,
  .fullscreen-person-note
) {
  font-size: 17px;
}

html.a11y-mode .custom-cursor-layer {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .custom-cursor-layer {
    display: none;
  }

  .photo-zoom-hint {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .custom-cursor-layer {
    display: none;
  }
}
