:root {
  --bg: #0d0f14;
  --panel: #151826;
  --panel2: #10131d;
  --text: #e9ecf2;
  --muted: #a7afc2;
  --line: rgba(255,255,255,.10);
  --good: rgba(120,255,180,.35);
  --bad: rgba(255,120,120,.35);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: transparent;
  color: var(--text);
}



.topbar {
position: sticky;
    top: 0;
    background: linear-gradient(180deg, #1e1e1e, #000000);
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    z-index: 10;
    z-index: 10;
}

.row {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 1400px;
  margin: 0 auto;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
select, input {
  height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b0d13;
  color: var(--text);
}
button {
  height: 32px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #0b0d13;
  color: var(--text);
  cursor: pointer;
}
button:hover { border-color: rgba(255,255,255,.25); }

.summary {
  margin-left: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d13;
  font-size: 13px;
  color: var(--text);
}

.tabs {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tabBtn {
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b0d13;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.tabBtn.active {
  border-color: rgba(255,255,255,.30);
  box-shadow: 0 0 0 2px rgba(255,255,255,.06) inset;
}

.main { padding: 16px; }

.gridWrap {
  max-width: 1100px;
  margin: 0 auto;
}

.grid {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.03);

  /* D2 trees are typically 6 rows x 4 cols visually,
     but your data may differ. We compute columns in JS and set it inline. */
}

.skill {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(0,0,0,.25);
  overflow: hidden;
  cursor: pointer;
  user-select: none;
}

.skill img {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

.skill.locked {
  cursor: not-allowed;
}

.skill.locked img {
  filter: grayscale(1) brightness(.65);
}

.skill .pts {
  position: absolute;
    right: -28px;
    top: 36px;
  height: 20px;
  width: 20px;
  text-align: center;
  padding: 0;
  line-height: 20px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,.15);
  background: rgba(0,0,0,.35);
  color: #f2f2f2;
  text-shadow: 0 1px 1px rgba(0,0,0,.8);
  box-sizing: border-box;
  z-index: 3;
}

.skill .badge {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: transparent;
  box-shadow: 0 0 0 1px rgba(255,255,255,.18);
}
.skill.available .badge { background: var(--good); }
.skill.blocked .badge { background: var(--bad); }

.tooltip {
  position: fixed;
  max-width: 340px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(0,0,.96);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
  pointer-events: none;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.tooltip .t { font-weight: 700; margin-bottom: 6px; }
.tooltip .m { color: var(--muted); font-size: 12px; }
.tooltip ul { margin: 6px 0 0; padding-left: 18px; }

.questToggle {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b0d13;
  height: 32px;
}
.questToggle span { color: var(--text); font-size: 13px; }
.questToggle input { width: 16px; height: 16px; }

/* Tooltip: in-game style blocks */
.tooltip .desc {
  margin: 6px 0 10px;
  text-transform: uppercase;
  letter-spacing: .2px;
  font-size: 12px;
  color: rgba(255,255,255,.85);
}
.tooltip .h {
  margin-top: 10px;
  font-weight: 700;

}
.tooltip .sep {
  height: 1px;
  margin: 10px 0;
  background: rgba(255,255,255,.12);
}
.tooltip .line {
  margin-top: 2px;
}
.tooltip .k {
  color: rgba(255,255,255,.92);
}
.tooltip .v {
      color: rgb(233 194 12 / 95%);
}



/* =========================
   Side-by-side trees layout
   ========================= */
.treesWrap{
    display: flex;
    gap: 0px;
    align-items: flex-start;
    justify-content: center;
    padding: 0px;
    flex-wrap: wrap;
}

.treePanel{
  flex: 0 1 auto;
  max-width: 410px;
}

.treeTitle{
  text-align:center;
  font-family: inherit;
  font-weight: 700;
  margin: 6px 0 10px;
  letter-spacing: 0.2px;
  opacity: 0.95;
}

/* Background canvas */
.gridWrap{
  overflow:hidden;
}

/* Make grid a positioned canvas with background */
.grid.treeGrid{
  position: relative;
  display: block;
  padding: 0;
  gap: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  width: 538px;
  height: 625px;
  transform-origin: top left;
}

.grid.treeGrid.hasTreeBg{
  background-repeat:no-repeat;
  background-position: 0 0;
  background-size: 538px 625px;
}

/* Absolute positioned skill tiles */
.grid.treeGrid .skill{
  position:absolute;
  width:56px;
  height:56px;
  border-radius: 10px;
  overflow: visible;
}

/* Scale icons slightly so they fit nicely in the frames */
.grid.treeGrid .skill img{
  transform: scale(var(--icon-scale, 0.92));
  transform-origin:center center;
}

.treeAlloc{
    width: 406px;
    margin: 0px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, .1);
}

.treeAllocEmpty{
  font-size: 12px;
  color: var(--muted);
  opacity: .9;
}

.treeAllocRow{
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 4px 0;
}

.treeAllocRow + .treeAllocRow{
  border-top: 1px solid rgba(255,255,255,.08);
}

.treeAllocIcon{
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.2);
  display: block;
}

.treeAllocName{
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.treeAllocPts{
  min-width: 26px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
      color: rgb(233 194 12 / 95%);
  border: 1px solid rgba(120, 185, 255, .35);
  border-radius: 999px;
  padding: 2px 6px;
}

.totalsPanel{
  max-width: 600px;
  margin: 6px auto 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.03);
}

.totalsTitle{
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.2px;
  margin-bottom: 8px;
}

.totalsEmpty{
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.totalsTableWrap{
  overflow-x: auto;
}

.totalsTable{
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.totalsTable th,
.totalsTable td{
  text-align: left;
  padding: 6px 8px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.totalsTable thead th{
  border-top: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2px;
}

.totalsTable td:last-child{
  font-weight: 700;
  color: rgb(233 194 12 / 95%);
  white-space: nowrap;
}
