/* Árvores de golpes — catálogo virtualizado + DAG. */

:root {
  --st-bg: #070b12;
  --st-panel: rgba(12, 18, 28, 0.94);
  --st-line: rgba(148, 163, 184, 0.18);
  --st-card: #0d1520;
  --st-card-hover: #121c2a;
  --st-text: #e8eef6;
  --st-dim: #8b9bb0;
  --st-accent: #5eead4;
  --st-accent-soft: rgba(94, 234, 212, 0.12);
  --st-yours: #f5c518;
  --st-official: #7dd3fc;
  --st-new: #f9a8d4;
  --st-font: "Figtree", "Segoe UI", system-ui, sans-serif;
  --st-display: "Syne", "Figtree", system-ui, sans-serif;
  --st-row: 56px;
  --st-nav-w: 220px;
  --st-insp-w: 390px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body.st {
  color: var(--st-text);
  font: 500 13px/1.45 var(--st-font);
  background:
    radial-gradient(ellipse 70% 40% at 12% -8%, rgba(56, 189, 248, 0.08), transparent),
    radial-gradient(ellipse 45% 28% at 92% 0%, rgba(94, 234, 212, 0.07), transparent),
    var(--st-bg);
  -webkit-font-smoothing: antialiased;
}

.st-app {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100vh;
  max-height: 100vh;
  padding: 12px;
  gap: 10px;
}

.st-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 20px;
  padding: 14px 18px;
  background: var(--st-panel);
  border: 1px solid var(--st-line);
  border-radius: 14px;
}

.st-kicker {
  margin: 0 0 2px;
  font: 700 11px/1 var(--st-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--st-accent);
}

.st-header__title {
  margin: 0;
  font: 800 22px/1.1 var(--st-display);
}

.st-header__lead {
  margin: 6px 0 0;
  max-width: 42rem;
  color: var(--st-dim);
}

.st-header__stats {
  display: flex;
  gap: 16px;
  margin-left: auto;
}

.st-stat {
  display: flex;
  flex-direction: column;
  min-width: 64px;
}

.st-stat__n {
  font: 800 20px/1 var(--st-display);
}

.st-stat__l {
  color: var(--st-dim);
  font-size: 11px;
}

.st-header__tools {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
}

.st-search {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 240px;
  min-width: 180px;
}

.st-search__label {
  font-size: 11px;
  color: var(--st-dim);
}

.st-input {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--st-line);
  border-radius: 8px;
  background: var(--st-card);
  color: var(--st-text);
  font: inherit;
  outline: none;
}

.st-input:focus {
  border-color: var(--st-accent);
}

.st-tabs,
.st-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.st-tab,
.st-pill {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--st-line);
  border-radius: 999px;
  background: transparent;
  color: var(--st-dim);
  font: 600 12px/32px var(--st-font);
  cursor: pointer;
}

.st-tab.is-on,
.st-pill.is-on {
  background: var(--st-accent-soft);
  border-color: var(--st-accent);
  color: var(--st-accent);
}

.st-btn {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--st-line);
  color: var(--st-text);
  text-decoration: none;
  font: 600 12px/1 var(--st-font);
  background: var(--st-card);
  cursor: pointer;
}

.st-btn--ghost {
  background: transparent;
}

.st-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 0 4px;
}

.st-body {
  display: grid;
  grid-template-columns: var(--st-nav-w) minmax(0, 1fr) var(--st-insp-w);
  gap: 10px;
  min-height: 0;
}

.st-nav,
.st-inspector,
.st-main {
  min-height: 0;
  background: var(--st-panel);
  border: 1px solid var(--st-line);
  border-radius: 14px;
}

.st-nav {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.st-nav__head {
  display: flex;
  justify-content: space-between;
  padding: 12px 14px 8px;
  color: var(--st-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.st-nav__list {
  overflow: auto;
  padding: 0 8px 10px;
  overscroll-behavior: contain;
}

.st-nav__item {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--st-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.st-nav__item:hover,
.st-nav__item.is-on {
  background: var(--st-card-hover);
}

.st-nav__item.is-on {
  outline: 1px solid var(--st-accent);
}

.st-nav__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--st-accent);
}

.st-nav__n {
  color: var(--st-dim);
  font-size: 11px;
}

.st-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.st-canvas-wrap,
.st-catalogo {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.st-canvas-wrap[hidden],
.st-catalogo[hidden] {
  display: none;
}

.st-canvas-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--st-line);
}

.st-canvas-bar__title {
  margin: 0;
  font: 700 15px/1.2 var(--st-display);
}

.st-canvas-bar__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.st-hint {
  color: var(--st-dim);
  font-size: 11px;
}

.st-canvas {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  cursor: grab;
  contain: strict;
  touch-action: none;
}

.st-canvas:active {
  cursor: grabbing;
}

.st-canvas svg {
  display: block;
  width: 100%;
  height: 100%;
}

.st-no {
  cursor: pointer;
}

.st-no__box {
  fill: var(--st-card);
  stroke: #334155;
  stroke-width: 1.2;
}

.st-no.is-yours .st-no__box {
  fill: #3a3110;
  stroke: var(--st-yours);
}

.st-no.is-new .st-no__box {
  fill: #3a2030;
  stroke: var(--st-new);
}

.st-no.is-official .st-no__box {
  fill: #152433;
  stroke: #4a6a80;
}

.st-no.is-dim .st-no__box {
  opacity: 0.28;
}

.st-no.is-path .st-no__box {
  stroke: var(--st-accent);
  stroke-width: 1.8;
  opacity: 1;
}

.st-no.is-sel .st-no__box {
  stroke: var(--st-accent);
  stroke-width: 2.2;
  fill: #134e4a;
}

.st-no__nome {
  fill: var(--st-text);
  font: 650 12px var(--st-font);
}

.st-no__sub {
  fill: var(--st-dim);
  font: 500 10px var(--st-font);
}

.st-edge {
  fill: none;
  stroke: #475569;
  stroke-width: 1.35;
}

.st-edge.is-path {
  stroke: var(--st-accent);
  stroke-width: 2;
}

.st-edge.is-dim {
  opacity: 0.2;
}

.st-catalogo__head {
  padding: 10px 14px;
  color: var(--st-dim);
  border-bottom: 1px solid var(--st-line);
  font-size: 12px;
}

.st-catalogo__viewport {
  position: relative;
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
}

.st-catalogo__rows {
  position: absolute;
  left: 0;
  right: 0;
  contain: layout style;
}

.st-row {
  display: grid;
  grid-template-columns: 52px 1fr 88px 72px 90px;
  align-items: center;
  gap: 8px;
  height: var(--st-row);
  padding: 0 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  cursor: pointer;
}

.st-row:hover,
.st-row.is-on {
  background: var(--st-card-hover);
}

.st-row__id {
  color: var(--st-dim);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.st-row__nome {
  font-weight: 650;
}

.st-row__sub {
  color: var(--st-dim);
  font-size: 11px;
}

.st-tipo {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0b1220;
}

.st-origem {
  font-size: 11px;
  font-weight: 650;
}

.st-origem--yours {
  color: var(--st-yours);
}

.st-origem--new {
  color: var(--st-new);
}

.st-origem--official {
  color: var(--st-official);
}

.st-inspector {
  padding: 16px;
  overflow: auto;
  overscroll-behavior: contain;
}

.st-inspector__vazio {
  color: var(--st-dim);
}

.st-inspector h2 {
  margin: 0 0 8px;
  font: 800 20px/1.15 var(--st-display);
}

.st-inspector__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.st-inspector p {
  margin: 0 0 12px;
  color: var(--st-dim);
}

.st-inspector h3 {
  margin: 16px 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--st-dim);
}

.st-linklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.st-damage-preview {
  margin-top: 22px;
  padding-top: 14px;
  border-top: 1px solid var(--st-line);
}

.st-damage-preview h3 {
  margin-top: 0;
}

.st-damage-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 8px;
  color: var(--st-dim);
  font-size: 11px;
}

.st-select {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--st-line);
  border-radius: 7px;
  background: var(--st-card);
  color: var(--st-text);
  font: inherit;
}

.st-select:focus {
  border-color: var(--st-accent);
  outline: none;
}

.st-damage-note {
  margin: 10px 0 8px !important;
  font-size: 11px;
}

.st-damage-plot-head {
  display: flex;
  justify-content: space-between;
  width: 300px;
  margin: 10px 0 4px 32px;
  color: var(--st-dim);
  font-size: 10px;
}

.st-damage-plot-layout {
  display: grid;
  grid-template-columns: 28px 300px;
  gap: 4px;
  align-items: stretch;
}

.st-damage-plot-y-labels {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 2px 0 0;
  color: var(--st-dim);
  font-size: 10px;
  line-height: 1;
}

.st-damage-plot {
  display: block;
  width: 300px;
  height: 300px;
  border: 1px solid var(--st-line);
  image-rendering: pixelated;
  cursor: crosshair;
}

.st-damage-canvas-wrap {
  position: relative;
  width: 300px;
  height: 300px;
}

.st-damage-tooltip {
  position: absolute;
  z-index: 1;
  width: 220px;
  padding: 5px 7px;
  border: 1px solid var(--st-accent);
  border-radius: 5px;
  background: #071018;
  color: var(--st-text);
  font-size: 10px;
  line-height: 1.25;
  pointer-events: none;
  white-space: normal;
}

.st-damage-plot-x-labels {
  display: flex;
  justify-content: space-between;
  width: 300px;
  margin: 4px 0 0 32px;
  color: var(--st-dim);
  font-size: 10px;
  line-height: 1;
}

.st-damage-plot-axis {
  width: 300px;
  margin: 7px 0 10px 32px !important;
  color: var(--st-dim);
  font-size: 10px;
  text-align: center;
}

.st-damage-scale {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 300px;
  margin-left: 32px;
  color: var(--st-dim);
  font-size: 10px;
}

.st-damage-scale i {
  display: block;
  flex: 1;
  height: 8px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    #0b1220 0%,
    #2dd4bf 25%,
    #facc15 50%,
    #fb923c 75%,
    #f87171 100%
  );
}

.st-chip {
  border: 1px solid var(--st-line);
  background: var(--st-card);
  color: var(--st-text);
  border-radius: 999px;
  padding: 4px 10px;
  font: 600 12px var(--st-font);
  cursor: pointer;
}

.st-chip:hover {
  border-color: var(--st-accent);
}

.st-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--st-line);
  color: var(--st-dim);
  font-size: 12px;
}

.st-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

@media (max-width: 1100px) {
  .st-body {
    grid-template-columns: 180px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 240px;
  }

  .st-inspector {
    grid-column: 1 / -1;
  }
}

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