.academy-tree {
  --at-accent: #efb055;
  --at-line: #bb8446;
  --at-glow: #6d3c2d;
  --at-ground: #28202a;
  margin-block: .65rem;
  color: #fff9e9;
  background: var(--at-ground);
  border: 1px solid #514552;
  border-radius: 12px;
  padding: .5rem .35rem;
  font-variant-numeric: tabular-nums;
}
.academy-tree.at-marksman { --at-accent: #ff9a87; --at-line: #bc7169; --at-glow: #773c39; --at-lit: #ffad52; }
.academy-tree.at-lancer { --at-accent: #87d3ff; --at-line: #6bafd1; --at-glow: #2c4a61; }
.academy-tree.at-infantry { --at-accent: #b0e292; --at-line: #77a969; --at-glow: #324e42; }
.at-guide { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem .5rem; padding: .15rem .45rem .55rem; }
.at-guide strong { font-size: .9rem; color: var(--at-accent); }
.at-guide > span, .academy-tree .at-legend { color: #d9ced4; font-size: .76rem; }
.at-board { position: relative; max-width: 34rem; margin-inline: auto; width: 100%; height: var(--at-height); }
.at-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.at-lines path { fill: none; stroke: var(--at-line); opacity: .48; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.at-lines .at-lit { stroke: var(--at-lit, var(--at-accent)); opacity: 1; }
.at-lines .at-after-unlock { stroke-dasharray: 3 4; stroke-width: 1.5; }
.academy-tree .at-node {
  position: absolute;
  transform: translateX(-50%);
  width: max-content; max-width: min(26%, 94px); min-width: 0; min-height: 48px;
  background: transparent; color: #fff9e9; border: 1px solid transparent; border-radius: 7px;
  display: grid; justify-items: center; align-content: start; gap: 2px;
  margin: 0; padding: 3px;
  font-family: inherit; cursor: pointer; touch-action: manipulation;
}
.at-infantry .at-node { max-width: min(18%, 94px); }
.at-icon {
  position: relative; display: block; width: 44px; max-width: 100%; height: 34px;
  border: 1.5px solid var(--at-line); border-radius: 5px; background: var(--at-glow);
}
.at-node[data-goal=true] .at-icon { width: 49px; height: 38px; outline: 1px solid var(--at-accent); outline-offset: 2px; }
.at-icon img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 3px; }
.at-node[data-state=zero] .at-icon img { filter: saturate(.62) brightness(.8); }
.at-node[data-state=full] .at-icon { border-color: var(--at-accent); box-shadow: 0 0 5px var(--at-accent); }
.at-badge {
  position: absolute; right: -2px; bottom: -2px; color: white; background: #2b2225;
  border-radius: 3px; padding: 1px 3px; font-size: 10px; font-weight: 700; line-height: 1.12;
}
.at-node[data-state=full] .at-badge { color: #1e2225; background: var(--at-accent); }
.at-node[data-state=partial] .at-badge { color: var(--at-accent); }
.at-name { display: block; font-size: .74rem; font-weight: 600; line-height: 1.15; padding: 1px 0; overflow-wrap: anywhere; }
.at-node[data-goal=true] .at-name { color: var(--at-accent); }
.at-node:focus-visible { outline: 2px solid var(--at-accent); outline-offset: 1px; }
.academy-tree .at-legend { margin: .3rem .45rem 0; line-height: 1.4; }
.at-editor {
  box-sizing: border-box; width: min(22rem, calc(100% - 2rem));
  max-height: 90vh; max-height: 90dvh; padding: 1rem; border: 0; border-radius: 14px;
  color: #233941; background: #fff; margin: auto; box-shadow: 0 12px 40px #0004;
}
.at-editor .at-editor-head { display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.at-editor-head h3 { color: inherit; font-size: 1.1rem; margin: 0; }
.at-editor .at-close { min-height: 44px; border: 0; padding-inline: .5rem; background: transparent; color: #215361; }
.at-editor .at-editor-info { font-size: .9rem; margin: 0 0 .6rem; color: #4e6870; }
.at-scale { position: relative; min-height: 56px; margin-block: 4px; }
.at-ruler { position: absolute; inset: 0 10px; pointer-events: none; }
.at-ruler::before { content: ''; position: absolute; top: 16px; width: 100%; height: 4px; border-radius: 2px; background: linear-gradient(to right, #215361 var(--at-position), #d5e1e2 var(--at-position)); }
.at-knob { position: absolute; left: var(--at-position); top: 18px; width: 20px; height: 20px; border: 2px solid #215361; background: white; border-radius: 50%; transform: translate(-50%, -50%); }
.at-tick { position: absolute; top: 29px; transform: translateX(-50%); text-align: center; font-size: .75rem; color: #536970; }
.at-tick::before { content: ''; display: block; width: 1px; height: 4px; background: #889fa3; margin: 0 auto 2px; }
.at-tick.is-current { color: #184653; font-weight: 700; }
.at-scale .at-slider { position: absolute; inset: 0; width: 100%; height: 100%; min-width: 0; margin: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; touch-action: pan-y; appearance: none; -webkit-appearance: none; }
.at-slider::-webkit-slider-thumb { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; }
.at-slider::-moz-range-thumb { width: 20px; height: 20px; border: 0; }
.at-scale:has(:focus-visible) { outline: 2px solid #31718d; outline-offset: 2px; border-radius: 6px; }
:root:has(.academy-tree) { scrollbar-gutter: stable; }
:root:has(.at-editor[open]) { overflow: hidden; }
