/* In-game skill tree HUD + unlock toasts */

.sth-open {
  overflow: hidden;
}

.sth {
  position: fixed;
  inset: 0;
  /* Above party status (7200), mode picker (7300), and other in-game HUD. */
  z-index: 7620;
  display: grid;
  place-items: stretch;
  font: 500 13px/1.45 "Figtree", "Segoe UI", system-ui, sans-serif;
  color: #e8eef6;
}

.sth[hidden] {
  display: none;
}

.sth__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 8, 14, 0.72);
  backdrop-filter: blur(6px);
}

.sth__panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  margin: 18px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background:
    radial-gradient(ellipse 60% 40% at 10% 0%, rgba(56, 189, 248, 0.08), transparent),
    radial-gradient(ellipse 40% 30% at 100% 0%, rgba(94, 234, 212, 0.07), transparent),
    rgba(8, 14, 22, 0.96);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  min-height: 0;
}

.sth__header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}

.sth__brand {
  min-width: 0;
}

.sth__kicker {
  margin: 0 0 2px;
  font: 700 10px/1 "Syne", system-ui, sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5eead4;
}

.sth__title {
  margin: 0;
  font: 800 18px/1.15 "Syne", system-ui, sans-serif;
}

.sth__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  height: 36px;
  padding: 0 12px 0 8px;
  border-radius: 10px;
  border: 1px solid rgba(94, 234, 212, 0.32);
  background: rgba(94, 234, 212, 0.08);
  color: #ecfeff;
  font: 700 12px/1 "Figtree", system-ui, sans-serif;
  cursor: pointer;
}

.sth__back[hidden] {
  display: none;
}

.sth__back:hover,
.sth__back:focus-visible {
  border-color: #5eead4;
  background: rgba(94, 234, 212, 0.16);
  outline: none;
}

.sth__back-icon {
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
}

.sth__back-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.sth__points {
  margin: 4px 0 0;
  font: 600 12px/1.2 "Syne", system-ui, sans-serif;
  color: #99f6e4;
}

.sth-insp__rank {
  margin: 0 0 8px;
  font: 600 13px/1.3 system-ui, sans-serif;
}

.sth-xp {
  display: block;
  height: 5px;
  margin: 0 0 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.22);
  overflow: hidden;
}

.sth-xp > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #5eead4, #67e8f9);
}

.sth__slots {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

.sth-slot {
  display: grid;
  grid-template-columns: 28px 18px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  min-width: 132px;
  height: 44px;
  padding: 0 10px 0 6px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--sth-slot-type, #64748b) 55%, transparent);
  background: color-mix(in srgb, var(--sth-slot-type, #334155) 18%, #0d1520);
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.sth-slot.is-empty {
  border-style: dashed;
  opacity: 0.75;
}

.sth-slot__icon,
.sth-insp__icon,
.sth-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.22);
  flex-shrink: 0;
}

.sth-slot__icon img,
.sth-insp__icon img,
.sth-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
  pointer-events: none;
}

.sth-slot__icon--empty,
.sth-insp__icon--empty,
.sth-icon--empty {
  background:
    linear-gradient(135deg, rgba(148, 163, 184, 0.08), transparent 55%),
    rgba(15, 23, 42, 0.45);
  border-style: dashed;
  border-color: rgba(148, 163, 184, 0.35);
}

.sth-slot__key {
  font: 800 11px/1 "Syne", system-ui, sans-serif;
  color: #94a3b8;
}

.sth-slot__name {
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.sth__close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #94a3b8;
  font-size: 22px;
  cursor: pointer;
}

.sth__close:hover {
  color: #fff;
  background: rgba(148, 163, 184, 0.12);
}

.sth__body {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 300px;
  min-height: 0;
}

.sth__nav {
  overflow: auto;
  padding: 10px;
  border-right: 1px solid rgba(148, 163, 184, 0.14);
  overscroll-behavior: contain;
}

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

.sth-nav__item:hover,
.sth-nav__item.is-on {
  background: rgba(18, 28, 42, 0.95);
}

.sth-nav__item.is-on {
  outline: 1px solid #5eead4;
}

.sth-nav__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.sth-nav__n {
  color: #8b9bb0;
  font-size: 11px;
}

.sth__canvas-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.sth__canvas-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.14);
}

.sth__canvas-bar h3 {
  margin: 0;
  font: 700 14px/1.2 "Syne", system-ui, sans-serif;
}

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

.sth__search {
  width: min(220px, 40vw);
  height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0d1520;
  color: inherit;
  font: inherit;
}

.sth__btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0d1520;
  color: inherit;
  font: 600 12px "Figtree", system-ui, sans-serif;
  cursor: pointer;
}

.sth__btn[hidden] {
  display: none !important;
}

.sth__btn--primary {
  background: rgba(94, 234, 212, 0.14);
  border-color: #5eead4;
  color: #5eead4;
}

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

.sth__canvas:active {
  cursor: grabbing;
}

.sth__canvas svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sth-no {
  cursor: pointer;
}

.sth-no__box {
  fill: #121a26;
  stroke: #3b4a5e;
  stroke-width: 1.2;
}

.sth-no.is-unlocked .sth-no__box {
  fill: #14352f;
  stroke: #5eead4;
}

.sth-no.is-ready .sth-no__box {
  fill: #3a3110;
  stroke: #fbbf24;
}

.sth-no.is-new:not(.is-unlocked) .sth-no__box {
  fill: #2a1a28;
  stroke: #f9a8d4;
}

.sth-no.is-sel .sth-no__box {
  stroke: #5eead4;
  stroke-width: 2.2;
  filter: drop-shadow(0 0 7px rgba(94, 234, 212, 0.55));
}

.sth-no.is-focus-in .sth-no__box {
  animation: sth-sel-pulse 0.85s ease-out 2;
}

@keyframes sth-sel-pulse {
  0% {
    stroke-width: 3.4;
    filter: drop-shadow(0 0 12px rgba(94, 234, 212, 0.85));
  }
  100% {
    stroke-width: 2.2;
    filter: drop-shadow(0 0 7px rgba(94, 234, 212, 0.55));
  }
}

.sth-no.is-path .sth-no__box {
  stroke: #67e8f9;
}

.sth-no.is-dim {
  opacity: 0.28;
}

.sth-no__icon {
  pointer-events: none;
}

.sth-no__icon-ph {
  fill: rgba(15, 23, 42, 0.55);
  stroke: rgba(148, 163, 184, 0.4);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  pointer-events: none;
}

.sth-no__nome {
  fill: #e8eef6;
  font: 650 12px "Figtree", system-ui, sans-serif;
}

.sth-no__sub {
  fill: #8b9bb0;
  font: 500 10px "Figtree", system-ui, sans-serif;
}

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

.sth-edge.is-path {
  stroke: #5eead4;
  stroke-width: 2;
}

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

.sth__inspector {
  overflow: auto;
  padding: 16px;
  border-left: 1px solid rgba(148, 163, 184, 0.14);
  overscroll-behavior: contain;
}

.sth-insp__empty {
  color: #8b9bb0;
}

.sth-insp__head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.sth-insp__icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
}

.sth-insp__head-text {
  min-width: 0;
  flex: 1;
}

.sth-insp__type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  color: #0b1220;
}

.sth-insp__name {
  margin: 6px 0 4px;
  font: 800 20px/1.15 "Syne", system-ui, sans-serif;
}

.sth-insp__meta,
.sth-insp__blurb,
.sth-insp__tip,
.sth-insp__locked {
  color: #8b9bb0;
  margin: 0 0 10px;
}

.sth__inspector h4 {
  margin: 14px 0 8px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b9bb0;
}

.sth-insp__reqs {
  margin: 0;
  padding-left: 18px;
}

.sth-insp__reqs li {
  cursor: help;
  border-radius: 6px;
  outline: none;
  transition: background 0.12s ease;
}

.sth-insp__reqs li:hover,
.sth-insp__reqs li:focus-visible {
  background: rgba(148, 163, 184, 0.12);
}

.sth-insp__tip--hint {
  margin: -2px 0 8px;
  font-size: 11px;
  color: #94a3b8;
}

.sth-insp__reqs li.is-ok {
  color: #5eead4;
}

.sth-insp__reqs li.is-no {
  color: #f87171;
}

.sth-insp__or {
  margin: 8px 0;
  text-align: center;
  color: #64748b;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.sth-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sth-chip {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0d1520;
  color: inherit;
  border-radius: 999px;
  padding: 4px 10px;
  font: 600 12px "Figtree", system-ui, sans-serif;
  cursor: pointer;
}

.sth-chip.is-ok {
  border-color: #5eead4;
  color: #5eead4;
}

.sth-insp__actions {
  margin-top: 16px;
}

.sth-legend {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
  color: #8b9bb0;
  font-size: 12px;
}

.sth-legend i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 8px;
  background: #64748b;
}

.sth-legend i.is-unlocked {
  background: #5eead4;
}
.sth-legend i.is-ready {
  background: #fbbf24;
}
.sth-legend i.is-new {
  background: #f9a8d4;
}

/* Unlock toasts */
.skill-unlock-toasts {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 7700;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  width: min(360px, calc(100vw - 24px));
  pointer-events: none;
}

.skill-unlock-toast {
  pointer-events: auto;
  padding: 14px 14px 12px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--sut-accent, #5eead4) 45%, transparent);
  background: rgba(10, 16, 24, 0.96);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.skill-unlock-toast.is-in {
  transform: translateY(0);
  opacity: 1;
}

.skill-unlock-toast.is-out {
  transform: translateY(8px);
  opacity: 0;
}

.skill-unlock-toast__title {
  margin: 0 0 4px;
  font: 800 13px/1.2 "Syne", system-ui, sans-serif;
  color: var(--sut-accent, #5eead4);
}

.skill-unlock-toast__body {
  margin: 0 0 4px;
  font-weight: 650;
}

.skill-unlock-toast__hint {
  margin: 0 0 10px;
  color: #8b9bb0;
  font-size: 12px;
}

.skill-unlock-toast__actions {
  display: flex;
  gap: 8px;
}

.skill-unlock-toast__btn {
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: transparent;
  color: #e8eef6;
  font: 600 12px "Figtree", system-ui, sans-serif;
  cursor: pointer;
}

.skill-unlock-toast__btn--primary {
  background: color-mix(in srgb, var(--sut-accent, #5eead4) 16%, transparent);
  border-color: var(--sut-accent, #5eead4);
  color: var(--sut-accent, #5eead4);
}

@media (max-width: 900px) {
  .sth__back [data-sth-back-label] {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .sth__back {
    width: 36px;
    padding: 0;
    justify-content: center;
  }
}

@media (max-width: 1100px) {
  .sth__body {
    grid-template-columns: 160px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 240px;
  }
  .sth__inspector {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skill-unlock-toast {
    transition: none;
  }

  .sth-no.is-focus-in .sth-no__box {
    animation: none;
  }
}
