/* ===== Reset & Base ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  background: transparent;
  color: #ccc;
  font-family: 'Segoe UI', Arial, sans-serif;
  overflow-x: hidden;
}

/* ===== Main Container ===== */
.main-container {
  position: relative;
  max-width: 1700px;
  margin: 0 auto;
  min-height: 100vh;
  overflow: hidden;
}

/* ===== Spec Background ===== */
.spec-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: 100% auto;
  background-position: center top;
  background-repeat: no-repeat;
  z-index: 0;
  pointer-events: none;
}

/* ===== Error ===== */
.error-msg {
  position: relative;
  z-index: 10;
  color: #ff4444;
  text-align: center;
  padding: 10px;
  font-size: 14px;
}
.error-msg:empty {
  display: none;
}

/* ===== Trees Container ===== */
.trees-container {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12px 4px 0;
  gap: 4px;
}

.trees-container.single-view .tree-panel {
  display: none;
}
.trees-container.single-view .tree-panel.visible {
  display: block;
}

/* ===== Tree Panel ===== */
.tree-panel {
  flex: 1 1 0;
  overflow: visible;
  min-width: 0;
}

.tree-panel[data-tree="class"],
.tree-panel[data-tree="spec"] {
  max-width: 440px;
}

.tree-panel-hero {
  max-width: 300px;
  align-self: center;
  position: relative;
}

/* ===== SVG base ===== */
.tree-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* ===== Hero Tree Icon ===== */
.hero-tree-icon {
  display: block;
  width: 64px;
  height: 64px;
  margin: 0 auto 4px;
  border-radius: 50%;
  border: 3px solid #c8a84e;
  overflow: hidden;
  background: #1a1a2e;
  box-shadow: 0 0 12px rgba(200, 168, 78, 0.5);
  z-index: 5;
}

.hero-tree-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* ===== SVG Connection Lines ===== */
.talent-connection {
  stroke: #3a3520;
  stroke-width: 1.5;
  fill: none;
}

.talent-connection.connection-active {
  stroke: #ffb300;
  stroke-width: 2;
}

/* ===== SVG Node Shapes ===== */
.talent-node {
  cursor: default;
}

.node-shape.node-square {
  fill: #111;
  stroke: #555;
  stroke-width: 1.5;
}

.node-selected .node-shape.node-square {
  stroke: #ffd100;
  stroke-width: 2;
}

.node-unselected .node-shape.node-square {
  stroke: #333;
  stroke-width: 1;
  fill: #0a0a0a;
}

.node-shape.node-circle {
  fill: #111;
  stroke: #555;
  stroke-width: 1.5;
}

.node-selected .node-shape.node-circle {
  stroke: #ffd100;
  stroke-width: 2;
}

.node-unselected .node-shape.node-circle {
  stroke: #333;
  stroke-width: 1;
  fill: #0a0a0a;
}

.node-shape.node-octagon {
  fill: #111;
  stroke: #555;
  stroke-width: 1.5;
}

.node-selected .node-shape.node-octagon {
  stroke: #ffd100;
  stroke-width: 2;
}

.node-unselected .node-shape.node-octagon {
  stroke: #333;
  stroke-width: 1;
  fill: #0a0a0a;
}

.node-unselected .node-icon {
  opacity: 0.35;
  filter: grayscale(100%);
}

.rank-badge {
  fill: #fff;
  font-size: 10px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-weight: 700;
  pointer-events: none;
  paint-order: stroke;
  stroke: #000;
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ===== Copy Bar ===== */
.copy-bar {
  display: none;
  position: relative;
  z-index: 10;
  text-align: center;
  margin-top: -38px;
  padding: 0 0 20px;
}
.copy-bar.visible {
  display: block;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 24px;
  background: rgba(20, 20, 40, 0.8);
  border: 1px solid rgba(255, 209, 0, 0.3);
  border-radius: 6px;
  color: #ffd100;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.copy-btn:hover {
  background: rgba(40, 40, 70, 0.9);
  border-color: #ffd100;
}
.copy-btn.copied {
  border-color: #4a9;
  color: #4a9;
}

/* ===== Custom Tooltip ===== */
.wh-tooltip {
  display: none;
  position: fixed;
  z-index: 99999;
  max-width: 340px;
  min-width: 200px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #1a1a2e 0%, #0d0d1a 100%);
  border: 1px solid #4a4a6a;
  border-radius: 6px;
  color: #ddd;
  font-size: 13px;
  line-height: 1.5;
  font-family: 'Segoe UI', Arial, sans-serif;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.8), 0 0 1px rgba(255, 209, 0, 0.2);
  pointer-events: none;
  word-wrap: break-word;
}

.wh-tooltip table {
  border-collapse: collapse;
  width: 100%;
}

.wh-tooltip td {
  padding: 2px 0;
  vertical-align: top;
}

.wh-tooltip b {
  color: #fff;
}

.wh-tooltip .q {
  color: #ffd100;
}

.wh-tooltip a {
  color: #4488ff;
  text-decoration: none;
}

.wh-tooltip-loading {
  color: #888;
  font-style: italic;
  padding: 8px;
  text-align: center;
}

.wh-tooltip-simple b {
  color: #ffd100;
  font-size: 14px;
}

.talent-link {
  cursor: pointer;
}
.talent-link * {
  cursor: pointer;
}

/* =============================================
   RESPONSIVE
   =============================================

   > 1240px  — desktop, full size row
   1024–1240 — tablet landscape, row but squeezed
   768–1023  — tablet portrait, row but smaller
   < 768     — mobile, stacked column
   ============================================= */

@media (max-width: 1550px) {
  .spec-background {
    display: none;
  }
}

/* --- Tablet landscape: stay in row, shrink panels --- */
@media (max-width: 1240px) {
  .trees-container {
    gap: 2px;
    padding: 8px 2px 0;
  }

  .tree-panel[data-tree="class"],
  .tree-panel[data-tree="spec"] {
    max-width: 380px;
  }

  .tree-panel-hero {
    max-width: 260px;
  }

  .hero-tree-icon {
    width: 52px;
    height: 52px;
  }

  .copy-bar,
  .copy-bar.visible {
    display: none !important;
  }
}

/* --- Tablet portrait: still row, tighter --- */
@media (max-width: 1024px) {
  .trees-container {
    gap: 0;
    padding: 4px 0 0;
  }

  .tree-panel[data-tree="class"],
  .tree-panel[data-tree="spec"] {
    max-width: 340px;
  }

  .tree-panel-hero {
    max-width: 230px;
  }

  .hero-tree-icon {
    width: 44px;
    height: 44px;
  }
}

/* --- Mobile: stack vertically --- */
@media (max-width: 768px) {
  .trees-container {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 8px 0 0;
  }

  .tree-panel {
    flex: 0 0 auto;
    width: 100%;
  }

  .tree-panel[data-tree="class"],
  .tree-panel[data-tree="spec"] {
    max-width: 480px;
  }

  .tree-panel-hero {
    max-width: 360px;
  }

  /* Reorder: class → hero → spec */
  .tree-panel[data-tree="class"] { order: 1; }
  .tree-panel-hero               { order: 2; }
  .tree-panel[data-tree="spec"]  { order: 3; }

  .hero-tree-icon {
    width: 56px;
    height: 56px;
  }
}

/* --- Small mobile --- */
@media (max-width: 480px) {
  .tree-panel[data-tree="class"],
  .tree-panel[data-tree="spec"] {
    max-width: 100%;
    padding: 0 4px;
  }

  .tree-panel-hero {
    max-width: 85%;
  }

  .hero-tree-icon {
    width: 48px;
    height: 48px;
  }
}
