:root {
  color-scheme: dark;
  --bg: #0d1015;
  --panel: rgba(19, 24, 33, 0.9);
  --panel-strong: rgba(26, 31, 42, 0.96);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text: #f5f1ea;
  --muted: rgba(245, 241, 234, 0.68);
  --faint: rgba(245, 241, 234, 0.42);
  --accent: #b3893d;
  --accent-2: #917035;
  --danger: #d15d57;
  --success: #7fc06b;
  --shadow: 0 24px 56px rgba(0, 0, 0, 0.4);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --tree-base: #3c3429;
  --tree-accent: #917035;
  --tree-highlight: #b3893d;
  --line: rgba(179, 137, 61, 0.38);
  --line-muted: rgba(255, 255, 255, 0.13);
  --board-grid: rgba(255, 255, 255, 0.04);
  --board-node-fill: rgba(18, 22, 30, 0.92);
  font-family: Inter, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 16% 20%, rgba(179, 137, 61, 0.12), transparent 30%),
    radial-gradient(circle at 84% 18%, rgba(145, 112, 53, 0.12), transparent 28%),
    linear-gradient(160deg, #080a0e 0%, #10151c 50%, #151b23 100%);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0));
}

body.has-modal {
  overflow: hidden;
}

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

.app-shell {
  max-width: 1880px;
  margin: 0 auto;
  padding: 24px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--tree-highlight);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 12px;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 0.96;
  letter-spacing: -0.05em;
}

.hero__status {
  display: grid;
  gap: 10px;
  min-width: 260px;
}

.status-chip {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--panel-border);
  background: rgba(16, 19, 27, 0.78);
  box-shadow: var(--shadow);
}

.status-chip__label {
  color: var(--faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.panel {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.rail,
.stage {
  display: grid;
  gap: 14px;
}

.rail {
  padding: 16px 0 18px;
}

.rail-nav {
  margin: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  text-align: left;
}

.rail-nav__icon {
  opacity: 0.8;
}

.rail-section {
  padding: 0 16px;
}

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

.section-head h2,
.section-head h3,
.panel__header h2,
.panel__header h3,
.footer-grid h3 {
  margin: 0;
}

.meta-pill {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  color: var(--muted);
  font-size: 12px;
}

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

.tree-select {
  display: grid;
  gap: 8px;
}

.tree-select span {
  color: var(--muted);
  font-size: 0.84rem;
}

.tree-select select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 13, 18, 0.9);
  color: var(--text);
}

.family-tab {
  display: grid;
  gap: 2px;
  padding: 12px 12px 11px;
  border-radius: 16px;
  border: 1px solid transparent;
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.family-tab:hover {
  transform: translateY(-1px);
}

.family-tab strong {
  font-size: 0.94rem;
}

.family-tab span {
  color: var(--muted);
  font-size: 0.84rem;
}

.family-tab.is-active {
  border-color: color-mix(in srgb, var(--tree-highlight) 70%, white 8%);
  background: linear-gradient(135deg, rgba(179, 137, 61, 0.2), rgba(145, 112, 53, 0.1));
}

.selected-tree-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.02)),
    linear-gradient(135deg, color-mix(in srgb, var(--tree-base) 78%, black 22%), rgba(15, 18, 25, 0.96));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.selected-tree-card__badge {
  color: var(--faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.selected-tree-card__title {
  font-size: 1.15rem;
  font-weight: 800;
}

.selected-tree-card__meta {
  color: var(--muted);
  line-height: 1.45;
}

.tree-list,
.build-rows,
.core-panel,
.summary-cards,
.validation-list,
.derived-totals,
.detail-card {
  display: grid;
  gap: 10px;
}

.tree-card {
  appearance: none;
  display: grid;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 12px 12px 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.tree-card:hover,
.build-row:hover,
.core-card:hover {
  transform: translateY(-1px);
}

.tree-card__title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.tree-card__name {
  font-weight: 700;
}

.tree-card__meta,
.tree-card__row,
.build-row__content,
.build-row__subtext {
  color: var(--muted);
  font-size: 0.85rem;
}

.tree-card__badge {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(179, 137, 61, 0.18);
  color: #f7e7bf;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tree-card.is-active {
  border-color: color-mix(in srgb, var(--tree-highlight) 66%, white 12%);
  background: linear-gradient(135deg, rgba(179, 137, 61, 0.18), rgba(145, 112, 53, 0.08));
}

.build-row {
  appearance: none;
  display: block;
  width: 100%;
  color: var(--text);
  text-align: left;
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.build-row__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.build-row__label {
  display: grid;
  gap: 4px;
}

.build-row__label strong {
  font-size: 0.92rem;
}

.build-row__label span {
  color: var(--faint);
  font-size: 0.8rem;
}

.build-row__slot {
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.build-row__slot-title {
  font-size: 0.94rem;
  font-weight: 700;
}

.build-row__slot-badge {
  color: var(--muted);
  font-size: 0.83rem;
}

.build-row.is-empty {
  border-style: dashed;
}

.build-row.is-valid {
  border-color: color-mix(in srgb, var(--row-highlight, var(--success)) 62%, white 10%);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--row-base, #24301f) 76%, black 24%), rgba(12, 15, 20, 0.88)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--row-accent, var(--success)) 34%, transparent), transparent 64%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035);
}

.build-row.is-invalid {
  border-color: rgba(208, 94, 87, 0.44);
}

.build-row.is-selected {
  border-color: color-mix(in srgb, var(--row-highlight, var(--tree-highlight)) 78%, white 14%);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--row-highlight, var(--tree-highlight)) 42%, transparent), 0 0 22px color-mix(in srgb, var(--row-highlight, var(--tree-highlight)) 22%, transparent);
}

.utility-tile {
  margin: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.utility-tile__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  opacity: 0.82;
}

.stage {
  min-width: 0;
}

.panel__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  padding: 20px 20px 0;
}

.panel__header--split {
  align-items: center;
}

.panel__header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.panel-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.level-control {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.level-control input {
  width: 96px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 13, 18, 0.9);
  color: var(--text);
}

.board-search {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.board-search__input {
  min-width: min(340px, 42vw);
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(10, 13, 18, 0.9);
  color: var(--text);
}

.board-search .button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--tree-highlight) 64%, white 12%);
  background: linear-gradient(135deg, rgba(179, 137, 61, 0.22), rgba(255, 255, 255, 0.06));
  color: #ffe8ad;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 410px);
  gap: 12px;
  padding: 20px;
}

.summary-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.summary-card__label {
  display: block;
  color: var(--faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.summary-card__value {
  display: block;
  margin-top: 8px;
  font-size: 1.3rem;
  font-weight: 800;
}

.summary-card__meta {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.progress-meter {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.progress-meter__head,
.progress-meter__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.progress-meter__head strong {
  font-size: 0.96rem;
}

.progress-meter__head span,
.progress-meter__foot span {
  color: var(--muted);
  font-size: 0.86rem;
}

.progress-meter__track {
  margin: 10px 0 8px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-meter__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--tree-accent), var(--tree-highlight));
  box-shadow: 0 0 18px rgba(179, 137, 61, 0.3);
}

.board-shell {
  padding: 0 20px 20px;
}

.expanded-descriptions {
  margin-top: 16px;
  padding: 16px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(18, 22, 30, 0.94), rgba(11, 14, 20, 0.98)),
    radial-gradient(circle at top left, color-mix(in srgb, var(--tree-highlight) 18%, transparent), transparent 42%);
}

.expanded-descriptions[hidden] {
  display: none;
}

.expanded-descriptions__head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.expanded-descriptions__head h3 {
  margin: 0;
  font-size: 1rem;
}

.expanded-descriptions__head p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.expanded-descriptions__head span {
  flex: 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.78rem;
}

.expanded-descriptions__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.expanded-node-card {
  min-width: 0;
  padding: 13px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.035);
}

.expanded-node-card.is-locked {
  opacity: 0.68;
}

.expanded-node-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.expanded-node-card__head strong {
  font-size: 0.94rem;
  line-height: 1.2;
}

.expanded-node-card__head span {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 0.76rem;
}

.expanded-node-card p {
  margin: 10px 0 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.core-panel {
  padding: 0 20px 20px;
}

.core-slot {
  padding: 14px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

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

.core-slot__head strong {
  font-size: 0.96rem;
}

.core-slot__head span {
  color: var(--muted);
  font-size: 0.84rem;
}

.core-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.core-card {
  padding: 12px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.core-card.is-locked {
  opacity: 0.56;
}

.core-card.is-selected {
  border-color: color-mix(in srgb, var(--tree-highlight) 72%, white 12%);
}

.core-card__head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.core-card__name {
  font-weight: 700;
}

.core-card__meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

.core-card__foot {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.button,
.core-card__button,
.node-action {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: linear-gradient(135deg, var(--tree-accent), var(--tree-highlight));
  color: #fff7e8;
  cursor: pointer;
}

.button {
  padding: 11px 14px;
  font-weight: 700;
}

.button--ghost,
.core-card__button {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.button:disabled,
.core-card__button:disabled,
.tree-picker-tile__select:disabled {
  cursor: not-allowed;
  opacity: 0.46;
}

.board {
  position: relative;
  min-height: min(82vh, 900px);
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: visible;
  background:
    linear-gradient(180deg, rgba(17, 20, 27, 0.92), rgba(13, 15, 21, 0.98)),
    radial-gradient(circle at top left, rgba(179, 137, 61, 0.12), transparent 34%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.board.is-expanded-all {
  display: grid;
  grid-template-columns: repeat(7, minmax(126px, 1fr));
  grid-auto-rows: minmax(188px, auto);
  gap: 14px;
  min-height: auto;
  overflow-x: auto;
  padding: 38px 18px 18px;
}

.tree-picker-board {
  position: absolute;
  inset: 22px;
  display: grid;
  grid-template-columns: repeat(6, minmax(118px, 1fr));
  gap: 18px;
}

.tree-picker-board--modal {
  position: static;
  inset: auto;
  min-height: min(68vh, 720px);
}

.tree-family-column {
  display: grid;
  grid-template-rows: repeat(5, minmax(92px, 1fr));
  gap: 12px;
  min-width: 0;
}

.tree-picker-tile {
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  align-items: center;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  padding: 12px 8px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--family-highlight) 42%, black 30%);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--family-base) 70%, black 30%), rgba(12, 15, 20, 0.95)),
    radial-gradient(circle at top, color-mix(in srgb, var(--family-accent) 35%, transparent), transparent 62%);
  color: var(--text);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: transform 140ms ease, border-color 140ms ease, filter 140ms ease;
}

.tree-picker-tile:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--family-highlight) 76%, white 10%);
}

.tree-picker-tile.is-base {
  min-height: 122px;
}

.tree-picker-tile.is-invalid {
  opacity: 0.42;
  filter: grayscale(0.35);
}

.tree-picker-tile.is-active-row,
.tree-picker-tile.is-selected-tree {
  border-color: color-mix(in srgb, var(--family-highlight) 82%, white 14%);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1), 0 0 22px color-mix(in srgb, var(--family-highlight) 36%, transparent);
}

.tree-picker-tile__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--family-highlight) 70%, white 8%);
  background: color-mix(in srgb, var(--family-accent) 46%, black 54%);
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
}

.tree-picker-tile__name {
  display: block;
  max-width: 100%;
  text-align: center;
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.tree-picker-tile__meta {
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  line-height: 1.25;
}

.tree-picker-tile__select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--family-highlight) 64%, white 10%);
  border-radius: 10px;
  background: linear-gradient(135deg, var(--family-accent), var(--family-highlight));
  color: #fff7e8;
  cursor: pointer;
  font-weight: 800;
}

.tree-picker-modal[hidden] {
  display: none;
}

.tree-picker-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 28px;
}

.tree-picker-modal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(3, 5, 8, 0.76);
  cursor: default;
}

.tree-picker-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(1560px, 96vw);
  max-height: 92vh;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 30px;
  background:
    radial-gradient(circle at 16% 10%, rgba(179, 137, 61, 0.14), transparent 30%),
    linear-gradient(180deg, rgba(22, 27, 36, 0.98), rgba(10, 12, 17, 0.98));
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
}

.tree-picker-modal__header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 24px 16px;
}

.tree-picker-modal__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tree-picker-modal__header h2,
.tree-picker-modal__header p {
  margin: 0;
}

.tree-picker-modal__header p:not(.eyebrow) {
  margin-top: 6px;
  color: var(--muted);
}

.tree-picker-modal__grid {
  padding: 0 24px 24px;
}

.board::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--board-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--board-grid) 1px, transparent 1px);
  background-size: calc(100% / 7) calc(100% / 5);
  pointer-events: none;
}

.board-axis {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-axis span {
  position: absolute;
  transform: translate(-50%, -50%);
}

.board-axis--rows span {
  left: 10px;
  transform: translateY(-50%);
}

.board-axis--cols span {
  top: 10px;
}

.board-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.board.is-expanded-all .board-axis {
  display: none;
}

.board.is-expanded-all .board-lines {
  z-index: 1;
}

.board-lines line {
  stroke-width: 0.4;
  stroke-linecap: round;
}

.line--pending {
  stroke: var(--line-muted);
  stroke-dasharray: 1.5 1.4;
  opacity: 0.72;
}

.line--satisfied {
  stroke: var(--line);
  filter: drop-shadow(0 0 4px rgba(179, 137, 61, 0.18));
}

.board-node {
  position: absolute;
  transform: translate(-50%, -50%);
  width: clamp(76px, 9vw, 116px);
  min-height: clamp(76px, 9vw, 116px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(33, 39, 51, 0.95), rgba(18, 22, 30, 0.98));
  color: var(--text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.32);
  padding: 9px;
  text-align: left;
  cursor: pointer;
  z-index: 2;
}

.board-node.is-description-expanded {
  position: static;
  transform: none;
  width: auto;
  min-width: 0;
  min-height: 188px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2;
}

.board-node:focus-visible,
.tree-card:focus-visible,
.tree-picker-tile:focus-visible,
.tree-picker-tile__select:focus-visible,
.family-tab:focus-visible,
.button:focus-visible,
.core-card__button:focus-visible,
.build-row:focus-visible,
.node-action:focus-visible,
.rail-nav:focus-visible,
.utility-tile:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--tree-highlight) 82%, white 10%);
  outline-offset: 2px;
}

.board-node.is-selected {
  border-color: color-mix(in srgb, var(--tree-highlight) 68%, white 10%);
  box-shadow: 0 0 0 1px rgba(179, 137, 61, 0.22), 0 14px 32px rgba(0, 0, 0, 0.34);
  z-index: 3;
}

.board-node.is-locked {
  opacity: 0.62;
}

.board-node.is-maxed {
  border-color: rgba(127, 192, 107, 0.36);
}

.board-node.is-invalid {
  border-color: rgba(208, 94, 87, 0.56);
}

.board-node.is-search-dim {
  opacity: 0.2;
  filter: grayscale(0.75);
}

.board-node.is-search-match {
  border-color: #f2d36c;
  box-shadow: 0 0 0 2px rgba(242, 211, 108, 0.22), 0 0 28px rgba(242, 211, 108, 0.28);
}

.board-node__top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}

.board-node__name {
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.12;
}

.board-node__badge {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(179, 137, 61, 0.18);
  color: #ffe8ad;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.board-node__foot {
  margin-top: auto;
  display: grid;
  gap: 6px;
}

.board-node__description {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.42;
}

.node-popover {
  position: absolute;
  z-index: 6;
  width: min(320px, 34vw);
  padding: 14px 15px;
  border-radius: 18px;
  border: 1px solid color-mix(in srgb, var(--tree-highlight) 60%, white 10%);
  background:
    linear-gradient(180deg, rgba(28, 33, 44, 0.98), rgba(13, 16, 23, 0.98)),
    radial-gradient(circle at top left, rgba(179, 137, 61, 0.18), transparent 48%);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}

.node-popover.is-hover {
  opacity: 0.96;
  border-color: rgba(255, 255, 255, 0.16);
}

.node-popover.is-right {
  transform: translate(28px, -50%);
}

.node-popover.is-left {
  transform: translate(calc(-100% - 28px), -50%);
}

.node-popover.is-center.is-down {
  transform: translate(-50%, 66px);
}

.node-popover.is-center.is-up {
  transform: translate(-50%, calc(-100% - 66px));
}

.node-popover.is-right.is-down,
.node-popover.is-left.is-down {
  transform: translate(28px, 24px);
}

.node-popover.is-left.is-down {
  transform: translate(calc(-100% - 28px), 24px);
}

.node-popover.is-right.is-up {
  transform: translate(28px, calc(-100% - 24px));
}

.node-popover.is-left.is-up {
  transform: translate(calc(-100% - 28px), calc(-100% - 24px));
}

.node-popover__head {
  display: grid;
  gap: 4px;
}

.node-popover__head strong {
  font-size: 0.98rem;
}

.node-popover__head span {
  color: var(--faint);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.node-popover__body {
  margin-top: 10px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.45;
}

.board-node__state {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.board-node__state--locked {
  background: rgba(208, 94, 87, 0.16);
  color: #ffd0cb;
}

.board-node__state--ready {
  background: rgba(127, 192, 107, 0.16);
  color: #d9efd1;
}

.board-node__state--maxed {
  background: rgba(179, 137, 61, 0.16);
  color: #ffe3a8;
}

.node-controls {
  display: flex;
  gap: 6px;
}

.node-action {
  width: 100%;
  padding: 6px 8px;
  font-weight: 800;
}

.stack-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 11px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 20px;
}

.footer-grid > div {
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}

.detail-row,
.validation-item,
.derived-row {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.detail-row:last-child,
.validation-item:last-child,
.derived-row:last-child {
  border-bottom: 0;
}

.detail-row strong,
.validation-item strong,
.derived-row strong {
  font-size: 0.9rem;
}

.detail-row span,
.validation-item span,
.derived-row span {
  color: var(--muted);
  line-height: 1.45;
}

.validation-item.is-ok strong {
  color: #d9efd1;
}

.validation-item.is-error strong {
  color: #ffd0cb;
}

.notice {
  margin: 0 20px 20px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  min-height: 48px;
}

.notice.is-warning {
  border-color: rgba(208, 94, 87, 0.4);
  color: #ffd4cf;
}

.site-footer {
  margin-top: 18px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025)),
    rgba(12, 15, 21, 0.86);
  box-shadow: var(--shadow);
}

.site-footer__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-footer__brand img {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #fff;
}

.site-footer__brand div {
  display: grid;
  gap: 3px;
}

.site-footer__brand strong {
  font-size: 0.96rem;
}

.site-footer__brand span {
  color: var(--muted);
  font-size: 0.84rem;
}

.site-footer__brand small {
  color: var(--faint);
  font-size: 0.78rem;
}

.site-footer a {
  color: #f5d891;
  text-decoration: none;
  font-weight: 800;
}

.site-footer a:hover {
  text-decoration: underline;
}

@media (max-width: 1320px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .summary-row,
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 16px;
  }

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

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .summary-cards,
  .core-group,
  .family-tabs {
    grid-template-columns: 1fr;
  }

  .tree-picker-modal {
    padding: 12px;
  }

  .tree-picker-modal__header {
    display: grid;
  }

  .tree-picker-board--modal {
    grid-template-columns: 1fr;
    min-height: 0;
  }
}
