/* Level / skill-point summary: a sticky bar pinned to the bottom of the tree
 * so it stays visible while scrolling, instead of plain text floating over
 * the grid. */
.tree-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  margin-top: 0.75rem;
  padding: 10px 16px;
  border-radius: 1rem;
  background: var(--color-base-200);
  border: 1px solid var(--color-base-300);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.1);
}

.tree-footer__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.tree-footer__stat--right {
  align-items: flex-end;
  text-align: right;
}

.tree-footer__divider {
  width: 1px;
  align-self: stretch;
  background: var(--color-base-300);
  margin: 0 16px;
}

.tree-footer__label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-base-content);
  opacity: 0.55;
}

.tree-footer__value {
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.2;
}

.tree-footer__value--available {
  color: var(--color-secondary);
}

/* The tree is an always-dark "game" panel (like the item tooltips), so the
 * stone and gold stay the same whatever the app theme. `--accent` is the
 * tree's element color. */
.tree-container {
  position: relative;
  /* The lines sit at z-index -1: in its own stacking context they draw over
   * this panel's background instead of vanishing behind it */
  isolation: isolate;
  min-height: 100%;
  width: 100%;
  max-width: 620px;
  margin: auto;
  --stone: #14110f;
  --stone-2: #1d1916;
  --bronze: #6b5636;
  --gold: #e0b44c;
  --ink: #e9e2d6;
  padding: 0.75rem 0.75rem 1rem;
  border-radius: 0.5rem;
  border: 1px solid var(--bronze);
  background:
    radial-gradient(120% 60% at 50% 0%, color-mix(in oklch, var(--accent, #888) 14%, transparent), transparent 70%),
    linear-gradient(180deg, var(--stone-2), var(--stone));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 0 40px rgba(0, 0, 0, 0.55),
    0 8px 24px -10px rgba(0, 0, 0, 0.6);
  color: var(--ink);
}

.tree-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid color-mix(in oklch, var(--bronze) 70%, transparent);
}

.tree-header__title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 1px 0 #000;
}

.tree-header__level {
  margin-left: 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
  opacity: 0.6;
}

.tree-header__points {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.tree-header__count {
  min-width: 2rem;
  padding: 0.1rem 0.5rem;
  text-align: center;
  font-size: 1.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  background: #0b0908;
  border: 1px solid var(--bronze);
  color: #8f877f;
}

.tree-header__count--available {
  color: var(--gold);
  border-color: var(--gold);
  box-shadow: 0 0 10px -2px color-mix(in oklch, var(--gold) 60%, transparent);
}

.tree-header__label {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.6;
}

.tree-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}

.tree-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 4px 8px;
  border-radius: 3px 3px 0 0;
  border: 1px solid #2c261f;
  border-bottom: 2px solid #2c261f;
  background: linear-gradient(180deg, #1b1714, #110e0c);
  color: #8f877f;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.tree-tab:hover {
  color: var(--ink);
}

.tree-tab[aria-selected='true'] {
  color: var(--ink);
  border-color: var(--bronze);
  border-bottom-color: var(--tab);
  background: linear-gradient(180deg, color-mix(in oklch, var(--tab) 22%, #1d1916), #14110f);
  box-shadow: 0 6px 12px -8px var(--tab);
}

.tree-tab__name {
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  letter-spacing: 0.03em;
}

.tree-tab__count {
  font-size: 0.6rem;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

.tree {
  display: grid;
  gap: clamp(10px, 3.5vw, 28px);
  grid-template-rows: repeat(auto, minmax(0, 1fr));
  grid-template-columns: repeat(3, 1fr);
}

/* A skill: a square stone frame with a beveled bronze edge. The state (locked,
 * open to learn, learned, maxed) is in the frame's edge and glow. */
.skill-container {
  position: relative;
  margin: auto;
  padding: 3px;
  border-radius: 4px;
  background: linear-gradient(145deg, #8a6f45, #3a2d1b 55%, #6b5636);
  box-shadow:
    0 0 0 1px #000,
    0 6px 14px -6px rgba(0, 0, 0, 0.8);
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    filter 0.15s ease;
}

.skill-container--unlocked,
.skill-container--active,
.skill-container--maxed {
  cursor: pointer;
}

.skill-container--unlocked:hover,
.skill-container--active:hover,
.skill-container--maxed:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.skill-container--locked {
  background: linear-gradient(145deg, #3a352f, #1f1c19);
  filter: grayscale(0.8);
}

.skill-container--active {
  background: linear-gradient(145deg, var(--accent), #3a2d1b 60%, var(--accent));
  box-shadow:
    0 0 0 1px #000,
    0 0 14px -2px color-mix(in oklch, var(--accent) 70%, transparent);
}

.skill-container--maxed {
  background: linear-gradient(145deg, #f3d35b, #8a6a1c 55%, #f3d35b);
  box-shadow:
    0 0 0 1px #000,
    0 0 18px -2px rgba(243, 211, 91, 0.7);
}

.skill-badge {
  position: relative;
  border-radius: 2px;
  background:
    radial-gradient(circle at 50% 35%, #2b241e, #0e0c0a 80%);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.9),
    inset 0 0 12px rgba(0, 0, 0, 0.8);
  transition: opacity 0.2s ease;
}

.skill-badge__icon {
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.6));
}

.skill-badge--locked {
  opacity: 0.45;
}

/* Open to learn: the frame breathes, inviting the click */
.skill-container--unlocked {
  animation: badge-invite 2.4s ease-in-out infinite;
}

.skill-badge--maxed {
  background: radial-gradient(circle at 50% 35%, #4a3a14, #17120a 80%);
}

@keyframes badge-invite {
  0%,
  100% {
    box-shadow:
      0 0 0 1px #000,
      0 6px 14px -6px rgba(0, 0, 0, 0.8);
  }
  50% {
    box-shadow:
      0 0 0 1px #000,
      0 0 12px -1px color-mix(in oklch, var(--accent) 65%, transparent);
  }
}

/* The rank, a small plaque on the frame's corner */
.skill-point {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 4px;
  right: -5px;
  bottom: -5px;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  border-radius: 3px;
  background: #0b0908;
  border: 1px solid var(--bronze);
  color: var(--gold);
  pointer-events: none;
}

/* What a locked skill waits for */
.skill-req {
  position: absolute;
  left: 50%;
  bottom: -8px;
  transform: translateX(-50%);
  padding: 0 6px;
  font-size: 0.6rem;
  font-weight: 700;
  line-height: 1.2rem;
  white-space: nowrap;
  border-radius: 3px;
  background: #0b0908;
  border: 1px solid #3a352f;
  color: #8f877f;
  pointer-events: none;
}

/* The connections: a groove, with a line lit in it once the skill it leads
 * from is learned (brighter once the one it leads to is too) */
.svg {
  top: 0;
  left: 0;
  position: absolute;
  z-index: -1;
  path {
    fill: none;
    stroke-linejoin: round;
    stroke-linecap: round;
    &.groove {
      stroke: #000;
      stroke-width: 7px;
    }
    &.line {
      stroke: #6b5636;
      stroke-width: 3px;
      &.open {
        stroke: color-mix(in oklch, var(--accent) 55%, #6b5636);
      }
      &.taken {
        stroke: var(--accent);
        filter: drop-shadow(0 0 3px color-mix(in oklch, var(--accent) 70%, transparent));
      }
    }
    &.active {
      stroke: #fff;
      stroke-width: 2px;
      opacity: 0.55;
      stroke-dashoffset: 500;
      stroke-dasharray: 500;
      animation: draw 5s linear forwards;
      animation-delay: var(--delay);
    }
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

/* Skill tooltip: a small "item card" -- accent-colored header matching the
 * skill's damage type, a level-progress bar, a stat grid, and an inline
 * upgrade CTA, instead of a plain stack of unstyled text rows. */
.skill-tooltip {
  padding: 0 !important;
  overflow: hidden;
  border-color: color-mix(in oklch, var(--accent, var(--color-secondary)) 45%, var(--color-base-300)) !important;
}

.skill-tooltip__inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.skill-tooltip__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -12px -12px 0;
  padding: 12px;
  background: linear-gradient(
    135deg,
    color-mix(in oklch, var(--accent) 22%, var(--color-base-100)),
    var(--color-base-100)
  );
  border-bottom: 1px solid color-mix(in oklch, var(--accent) 35%, var(--color-base-300));
}

.skill-tooltip__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.4rem;
  border-radius: 0.75rem;
  background: color-mix(in oklch, var(--accent) 20%, var(--color-base-100));
  box-shadow: inset 0 0 0 1.5px color-mix(in oklch, var(--accent) 55%, transparent);
}

.skill-tooltip__name {
  font-weight: 800;
  font-size: 0.95rem;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.skill-tooltip__type {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: color-mix(in oklch, var(--accent) 75%, var(--color-base-content));
}

.skill-tooltip__badge {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  white-space: nowrap;
  color: color-mix(in oklch, var(--accent) 80%, var(--color-base-content));
  background: color-mix(in oklch, var(--accent) 16%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in oklch, var(--accent) 40%, transparent);
}

.skill-tooltip__progress {
  height: 5px;
  border-radius: 9999px;
  background: var(--color-base-200);
  overflow: hidden;
}

.skill-tooltip__progress-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.skill-tooltip__stats {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.skill-tooltip__stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.skill-tooltip__stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-base-content);
  opacity: 0.55;
}

.skill-tooltip__stat-value {
  font-size: 0.85rem;
  font-weight: 700;
}

.skill-tooltip__stat-next {
  font-size: 0.75rem;
  font-weight: 600;
  color: color-mix(in oklch, var(--accent) 80%, var(--color-base-content));
}

.skill-tooltip__delta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.skill-tooltip__stat-value--next {
  color: color-mix(in oklch, var(--accent) 80%, var(--color-base-content));
}

.skill-tooltip__dot {
  font-size: 0.75rem;
  color: color-mix(in oklch, var(--accent) 85%, var(--color-base-content));
  background: color-mix(in oklch, var(--accent) 10%, transparent);
  border-radius: 0.5rem;
  padding: 6px 8px;
}

.skill-tooltip__note {
  font-size: 0.75rem;
  border-radius: 0.5rem;
  padding: 6px 8px;
}

.skill-tooltip__note--locked {
  color: var(--color-error);
  background: color-mix(in oklch, var(--color-error) 12%, transparent);
}


