.tree-entry {
  position: relative;
  min-height: 24rem;
  overflow: hidden;
  margin-top: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid rgba(218, 188, 112, 0.58);
  border-radius: 1.4rem;
  background:
    linear-gradient(130deg, rgba(5, 8, 13, 0.96), rgba(24, 11, 33, 0.94)),
    radial-gradient(circle at 78% 30%, rgba(125, 83, 155, 0.25), transparent 40%);
  box-shadow: inset 0 0 0 1px rgba(135, 226, 224, 0.07), 0 1.4rem 3.4rem rgba(0, 0, 0, 0.32);
  isolation: isolate;
}

.tree-entry::before,
.tree-entry::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.tree-entry::before {
  inset: 1rem;
  border: 1px solid rgba(218, 188, 112, 0.18);
  border-radius: 1rem;
  clip-path: polygon(0 0, 18% 0, 18% 1px, 82% 1px, 82% 0, 100% 0, 100% 100%, 82% 100%, 82% calc(100% - 1px), 18% calc(100% - 1px), 18% 100%, 0 100%);
}

.tree-entry::after {
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 26% 48%, rgba(69, 216, 222, 0.1), transparent 26%);
}

.tree-entry__content {
  position: relative;
  z-index: 2;
  width: min(62%, 44rem);
  padding: clamp(1.65rem, 5vw, 3rem);
}

.tree-entry__eyebrow,
.tree-result__eyebrow {
  margin: 0 0 0.55rem;
  color: #99edf0;
  font-family: var(--font-system);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
}

.tree-entry h3 {
  margin: 0;
  color: #fff4d5;
  font-size: clamp(1.7rem, 4.6vw, 2.7rem);
  text-shadow: 0 0 1.6rem rgba(218, 188, 112, 0.18);
}

.tree-entry__lead {
  margin: 0.8rem 0 0;
  color: rgba(244, 238, 221, 0.82);
  line-height: 1.9;
}

.tree-entry__status {
  display: block;
  min-height: 1.5rem;
  margin-top: 0.9rem;
  color: rgba(158, 234, 236, 0.8);
  font-size: 0.84rem;
}

.tree-entry__status[data-error="true"],
.tree-analysis-status[data-error="true"] {
  color: #e5a7ad;
}

.tree-entry__button,
.tree-primary-button,
.tree-secondary-button {
  min-height: 3.4rem;
  border: 1px solid rgba(224, 195, 119, 0.72);
  border-radius: 999px;
  color: #fff4d5;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.tree-entry__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.8rem 1.5rem;
  background: linear-gradient(120deg, rgba(64, 48, 23, 0.92), rgba(12, 56, 59, 0.88));
}

.tree-entry__button:disabled,
.tree-primary-button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.tree-entry__sigil {
  position: absolute;
  top: 50%;
  right: clamp(1rem, 8vw, 7rem);
  width: min(32%, 18rem);
  aspect-ratio: 0.66;
  translate: 0 -50%;
  opacity: 0.72;
  filter: drop-shadow(0 0 1rem rgba(116, 222, 220, 0.16));
}

.tree-entry__sigil::before,
.tree-entry__sigil::after {
  position: absolute;
  content: "";
  inset: 6% 12%;
  border: 1px solid rgba(220, 191, 116, 0.35);
}

.tree-entry__sigil::before {
  clip-path: polygon(50% 0, 100% 24%, 82% 68%, 50% 100%, 18% 68%, 0 24%);
}

.tree-entry__sigil::after {
  inset: 15% 19%;
  border-color: rgba(93, 220, 220, 0.26);
  transform: rotate(180deg);
  clip-path: polygon(50% 0, 100% 70%, 0 70%);
}

.tree-entry__sigil span {
  position: absolute;
  width: 1.8rem;
  aspect-ratio: 1;
  border: 1px solid rgba(232, 205, 134, 0.74);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(244, 227, 170, 0.65), rgba(63, 33, 77, 0.72) 38%, rgba(3, 7, 11, 0.94) 72%);
  box-shadow: 0 0 1rem rgba(216, 188, 112, 0.22);
}

.tree-entry__sigil span:nth-child(1) { left: 50%; top: 0; translate: -50%; }
.tree-entry__sigil span:nth-child(2) { right: 4%; top: 17%; }
.tree-entry__sigil span:nth-child(3) { left: 4%; top: 17%; }
.tree-entry__sigil span:nth-child(4) { right: 4%; top: 40%; }
.tree-entry__sigil span:nth-child(5) { left: 4%; top: 40%; }
.tree-entry__sigil span:nth-child(6) { left: 50%; top: 47%; translate: -50%; }
.tree-entry__sigil span:nth-child(7) { right: 4%; top: 67%; }
.tree-entry__sigil span:nth-child(8) { left: 4%; top: 67%; }
.tree-entry__sigil span:nth-child(9) { left: 50%; top: 77%; translate: -50%; }
.tree-entry__sigil span:nth-child(10) { left: 50%; bottom: 0; translate: -50%; }

.tree-screen {
  max-width: 1120px;
  margin-inline: auto;
}

.tree-toolbar {
  display: grid;
  grid-template-columns: 2.8rem 1fr 2.8rem;
  gap: 0.8rem;
  align-items: center;
  margin-bottom: 1.2rem;
  text-align: center;
}

.tree-toolbar .eyebrow {
  margin: 0;
}

.tree-opening__frame,
.tree-preparation__layout,
.tree-board,
.tree-analysis-card,
.tree-node-section {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(215, 184, 104, 0.46);
  background: linear-gradient(160deg, rgba(9, 7, 14, 0.97), rgba(20, 10, 28, 0.92));
  box-shadow: inset 0 0 0 1px rgba(142, 224, 222, 0.035), 0 1.6rem 4rem rgba(0, 0, 0, 0.32);
}

.tree-opening__frame {
  min-height: calc(100dvh - 9rem);
  padding: clamp(1.4rem, 5vw, 3.2rem);
  border-radius: 1.8rem;
  text-align: center;
}

.tree-opening__frame::before,
.tree-opening__frame::after,
.tree-board::before {
  position: absolute;
  content: "";
  pointer-events: none;
}

.tree-opening__frame::before {
  inset: 0.8rem;
  border: 1px solid rgba(218, 188, 112, 0.2);
  border-radius: 1.35rem;
  clip-path: polygon(0 0, 14% 0, 16% 2px, 84% 2px, 86% 0, 100% 0, 100% 100%, 86% 100%, 84% calc(100% - 2px), 16% calc(100% - 2px), 14% 100%, 0 100%);
}

.tree-opening__frame::after {
  inset: -20%;
  z-index: 0;
  opacity: 0.44;
  background: conic-gradient(from 20deg, transparent, rgba(129, 70, 151, 0.18), transparent 23%, rgba(78, 205, 206, 0.08), transparent 52%);
  animation: tree-ambient-turn 34s linear infinite;
}

.tree-opening__header,
.tree-opening__emblem,
.tree-opening__doctrine,
.tree-opening__frame > button,
.tree-opening__note {
  position: relative;
  z-index: 1;
}

.tree-opening__kicker {
  margin: 0;
  color: #8de2e5;
  font-family: var(--font-system);
  font-size: 0.7rem;
  letter-spacing: 0.25em;
}

.tree-opening__header h2,
.tree-preparation__layout h2,
.tree-result__header h2 {
  margin: 0.55rem 0;
  color: #fff2ce;
  font-size: clamp(2rem, 7vw, 4.4rem);
  line-height: 1.2;
  text-shadow: 0 0 2rem rgba(219, 183, 88, 0.24);
}

.tree-opening__header p:last-child,
.tree-preparation__layout header p:last-child,
.tree-result__header p:last-child {
  max-width: 47rem;
  margin-inline: auto;
  color: rgba(238, 231, 211, 0.76);
}

.tree-opening__emblem {
  width: min(74vw, 28rem);
  margin: 1.2rem auto;
}

.tree-opening__emblem svg {
  display: block;
  width: 100%;
  overflow: visible;
}

.tree-opening__paths path {
  fill: none;
  stroke: rgba(216, 184, 104, 0.56);
  stroke-width: 1.8;
}

.tree-opening__nodes circle {
  fill: rgba(12, 8, 19, 0.92);
  stroke: #d9b967;
  stroke-width: 2;
  filter: drop-shadow(0 0 0.7rem rgba(124, 218, 218, 0.24));
}

.tree-opening__nodes circle:nth-child(2n) { stroke: #77d6d8; }
.tree-opening__nodes circle:nth-child(3n) { stroke: #9668bd; }
.tree-opening__crown path { fill: rgba(222, 190, 105, 0.18); stroke: #e0c276; stroke-width: 2; }

.tree-opening__doctrine {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 auto 1.4rem;
}

.tree-opening__doctrine span {
  border: 1px solid rgba(115, 205, 208, 0.3);
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  color: rgba(207, 242, 241, 0.86);
  font-size: 0.8rem;
}

.tree-primary-button,
.tree-secondary-button {
  width: min(100%, 38rem);
  padding: 0.9rem 1.5rem;
}

.tree-primary-button {
  background: linear-gradient(120deg, rgba(78, 52, 21, 0.94), rgba(26, 45, 57, 0.94), rgba(55, 25, 70, 0.94));
  box-shadow: 0 0 2rem rgba(116, 212, 211, 0.1);
}

.tree-secondary-button {
  color: #bfecef;
  background: rgba(5, 11, 17, 0.82);
}

.tree-opening__note,
.tree-analysis-status {
  margin: 1rem 0 0;
  color: rgba(192, 182, 161, 0.78);
  font-size: 0.82rem;
}

.tree-preparation__layout {
  display: grid;
  gap: 1.4rem;
  padding: clamp(1.5rem, 5vw, 3.4rem);
  border-radius: 1.6rem;
  text-align: center;
}

.tree-topic-field {
  display: grid;
  gap: 0.5rem;
  width: min(100%, 34rem);
  margin-inline: auto;
  text-align: left;
}

.tree-topic-field > span {
  color: #d8bc78;
  font-family: var(--font-display);
}

.tree-preparation__nodes {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
  width: min(100%, 48rem);
  margin: 0 auto;
  padding: 0;
  list-style: none;
}

.tree-preparation__nodes li {
  border: 1px solid rgba(216, 188, 120, 0.2);
  border-radius: 0.65rem;
  padding: 0.65rem;
  color: rgba(235, 227, 207, 0.82);
  background: rgba(4, 7, 12, 0.45);
  font-size: 0.86rem;
}

.tree-result__header {
  max-width: 52rem;
  margin: 0 auto 1.5rem;
  text-align: center;
}

.tree-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.tree-metrics article {
  border: 1px solid rgba(217, 185, 104, 0.34);
  border-radius: 1rem;
  padding: 1rem;
  background: rgba(10, 7, 16, 0.82);
  text-align: center;
}

.tree-metrics span {
  display: block;
  color: #8bdcdf;
  font-family: var(--font-system);
  font-size: 0.65rem;
  letter-spacing: 0.12em;
}

.tree-metrics strong {
  display: block;
  margin: 0.35rem 0;
  color: #e7c769;
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 3.8rem);
  line-height: 1;
}

.tree-metrics p { margin: 0; color: rgba(237, 230, 210, 0.75); font-size: 0.8rem; }

.tree-board {
  padding: clamp(1rem, 3vw, 2rem);
  border-radius: 1.5rem;
}

.tree-board::before {
  inset: 0;
  background: radial-gradient(circle at 50% 38%, rgba(111, 73, 135, 0.18), transparent 40%);
}

.tree-board > * { position: relative; z-index: 1; }
.tree-board header { text-align: center; }
.tree-board h3 { margin: 0; color: #f1d586; font-size: clamp(1.4rem, 4vw, 2.3rem); }

.tree-result-diagram {
  display: block;
  width: min(100%, 46rem);
  margin: 0 auto;
  overflow: visible;
}

.tree-board-frame__outer,
.tree-board-frame__inner { fill: none; stroke: rgba(217, 185, 104, 0.22); }
.tree-board-frame__inner { stroke: rgba(93, 198, 199, 0.12); stroke-dasharray: 6 9; }

.tree-path line {
  stroke: rgba(225, 199, 130, calc(0.14 + var(--tree-path-score) * 0.58));
  stroke-width: calc(1.2px + var(--tree-path-score) * 3px);
}

.tree-path--clear line { stroke: rgba(135, 238, 232, 0.78); filter: drop-shadow(0 0 6px rgba(135, 238, 232, 0.32)); }
.tree-path--forming line { stroke: rgba(224, 197, 116, 0.65); }
.tree-path--adjusting line { stroke: rgba(158, 111, 183, 0.55); stroke-dasharray: 8 6; }
.tree-path--latent line { stroke: rgba(130, 126, 139, 0.28); stroke-dasharray: 3 8; }
.tree-path text { fill: rgba(225, 207, 161, 0.7); font: 12px var(--font-system); text-anchor: middle; paint-order: stroke; stroke: #0a0710; stroke-width: 4px; }

.tree-node { --tree-node-color: #e0c173; }
.tree-node__halo { fill: color-mix(in srgb, var(--tree-node-color) 12%, transparent); opacity: 0.42; }
.tree-node__ring { fill: rgba(7, 7, 12, 0.94); stroke: var(--tree-node-color); stroke-width: 2.4px; }
.tree-node__diamond { fill: color-mix(in srgb, var(--tree-node-color) 14%, #07070c); stroke: color-mix(in srgb, var(--tree-node-color) 82%, white); stroke-width: 1.4px; }
.tree-node--anchoring .tree-node__ring { filter: url(#tree-node-glow); stroke-width: 4px; }
.tree-node--available .tree-node__ring { stroke-width: 3px; }
.tree-node--latent { opacity: 0.7; }
.tree-node text { text-anchor: middle; pointer-events: none; }
.tree-node__number { fill: #fff1c7; font: 18px var(--font-display); }
.tree-node__score { fill: var(--tree-node-color); font: 16px var(--font-system); }
.tree-node__name { fill: #eee3c7; font: 17px var(--font-display); }
.tree-node__hebrew { fill: color-mix(in srgb, var(--tree-node-color) 75%, white); font: 15px var(--font-display); }
.tree-node__card { fill: rgba(207, 198, 182, 0.84); font: 12px var(--font-system); }

.tree-daat circle { fill: rgba(91, 40, 117, 0.32); stroke: rgba(216, 190, 121, 0.42); }
.tree-daat path { fill: rgba(130, 226, 223, 0.12); stroke: #8cdddd; }
.tree-daat text { fill: #d7c78e; text-anchor: middle; font: 13px var(--font-system); }
.tree-daat text:last-child { fill: #e6efdb; font-size: 18px; }
.tree-daat--clear { filter: url(#tree-node-glow); }

.tree-board__legend,
.tree-safety {
  max-width: 48rem;
  margin: 1rem auto 0;
  color: rgba(190, 180, 163, 0.8);
  font-size: 0.82rem;
  text-align: center;
}

.tree-analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.tree-analysis-card,
.tree-node-section {
  border-radius: 1rem;
  padding: clamp(1rem, 3vw, 1.6rem);
}

.tree-analysis-card h3,
.tree-node-section h3,
.tree-analysis-card h4 {
  color: #e0c277;
}

.tree-analysis-card p,
.tree-analysis-card li { color: rgba(238, 231, 211, 0.8); }
.tree-analysis-card ol { margin: 0; padding-left: 1.2rem; }
.tree-analysis-card section + section { margin-top: 1rem; }

.tree-node-section { margin-top: 1rem; }
.tree-node-section > h3 { text-align: center; }

.tree-node-reading {
  border-top: 1px solid rgba(216, 188, 120, 0.2);
}

.tree-node-reading:last-child { border-bottom: 1px solid rgba(216, 188, 120, 0.2); }
.tree-node-reading summary { display: flex; justify-content: space-between; gap: 1rem; padding: 1rem 0; color: #eee4ca; cursor: pointer; }
.tree-node-reading summary strong { color: #85dcdd; font-family: var(--font-system); }
.tree-node-reading h4 { margin: 0.25rem 0; color: #d9b967; }
.tree-node-reading p { color: rgba(238, 231, 211, 0.8); }
.tree-node-reading__role { color: #9de3e5 !important; }
.tree-node-reading__lens { border-left: 2px solid rgba(119, 214, 216, 0.48); padding-left: 0.8rem; }

.tree-result__actions {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  margin-top: 1rem;
}

@keyframes tree-ambient-turn { to { transform: rotate(1turn); } }

@media (max-width: 720px) {
  .tree-entry { min-height: 32rem; }
  .tree-entry__content { width: 100%; padding-bottom: 13rem; }
  .tree-entry__sigil { top: auto; right: 50%; bottom: 1rem; width: 10rem; translate: 50% 0; }
  .tree-preparation__nodes,
  .tree-metrics,
  .tree-analysis-grid { grid-template-columns: 1fr; }
  .tree-toolbar .eyebrow { font-size: 0.58rem; }
  .tree-result__actions { flex-direction: column; align-items: center; }
  .tree-opening__frame { padding-inline: 1rem; }
  .tree-node__card { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .tree-opening__frame::after { animation: none; }
}
