/* ========== Talent Tree Planner ========== */

.talent-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 15px 60px;
}

.talent-header {
  text-align: center;
  margin-bottom: 20px;
}
.talent-header h1 {
  font-family: 'Cinzel Decorative', serif;
  font-size: 2rem;
  color: #e3cc86;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0,0,0,.6);
}
.talent-subtitle {
  color: #a09880;
  font-size: 0.9rem;
  margin-top: 4px;
}

/* --- Controls Bar --- */
.talent-controls {
  background: linear-gradient(135deg, rgba(30,20,10,.95), rgba(45,30,15,.95));
  border: 1px solid #5a3e1e;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}

.talent-class-select label,
.talent-sub-select label,
.talent-tier3-select label,
.talent-inputs label {
  display: block;
  font-size: 0.7rem;
  color: #a09880;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 4px;
}

.class-tabs, .sub-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.class-tabs .tab-btn, .sub-tabs .tab-btn {
  background: rgba(60,40,20,.7);
  border: 1px solid #4a3518;
  color: #c8b080;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  font-family: 'Cinzel', serif;
  transition: all .2s;
  white-space: nowrap;
}
.class-tabs .tab-btn:hover, .sub-tabs .tab-btn:hover {
  background: rgba(100,70,30,.6);
  border-color: #8a6830;
}
.class-tabs .tab-btn.active, .sub-tabs .tab-btn.active {
  background: linear-gradient(135deg, #8a3030, #aa4040);
  border-color: #cc5555;
  color: #ffe8c8;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}

.talent-inputs {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  margin-left: auto;
  flex-wrap: wrap;
}
.input-group {
  display: flex;
  flex-direction: column;
}
.input-group input {
  width: 70px;
  background: rgba(20,15,10,.8);
  border: 1px solid #4a3518;
  color: #e3cc86;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
  text-align: center;
  font-family: 'Cinzel', serif;
}
.input-group input:focus {
  outline: none;
  border-color: #aa6630;
}

.point-display {
  display: flex;
  gap: 6px;
}
.point-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(20,15,10,.6);
  border: 1px solid #3a2a15;
  border-radius: 4px;
  padding: 4px 10px;
  min-width: 55px;
}
.point-label {
  font-size: 0.6rem;
  color: #807060;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.point-value {
  font-size: 1.1rem;
  font-family: 'Cinzel', serif;
  color: #e3cc86;
  font-weight: 700;
}
.point-value.spent { color: #cc8844; }
.point-value.remaining { color: #88cc88; }
.point-value.remaining.over-budget { color: #cc4444; }

.btn-reset {
  background: linear-gradient(135deg, #5a2020, #7a3030);
  border: 1px solid #8a3030;
  color: #e8c8c8;
  padding: 6px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  transition: all .2s;
}
.btn-reset:hover {
  background: linear-gradient(135deg, #7a3030, #aa4040);
  border-color: #cc5555;
}

/* --- Talent Tree Grid --- */
.talent-tree-wrapper {
  overflow-x: auto;
  padding-bottom: 10px;
}

.talent-tree-container {
  position: relative;
  margin: 0 auto;
  /* Grid: 6 cols x 12 rows; cell size 72px, gap 12px */
  width: 504px; /* 6 * 84 */
  min-height: 100px;
}

/* Each talent node */
.talent-node {
  position: absolute;
  width: 52px;
  height: 52px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

.talent-icon-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  border: 2px solid #3a3020;
  border-radius: 4px;
  overflow: hidden;
  background: #1a1510;
  transition: border-color .2s, box-shadow .2s;
}

.talent-node.unlocked .talent-icon-wrap {
  border-color: #6a5530;
}
.talent-node.has-points .talent-icon-wrap {
  border-color: #88aa44;
  box-shadow: 0 0 8px rgba(136,170,68,.4);
}
.talent-node.maxed .talent-icon-wrap {
  border-color: #ccaa33;
  box-shadow: 0 0 12px rgba(204,170,51,.5);
}
.talent-node.locked .talent-icon-wrap {
  border-color: #2a2520;
  opacity: 0.6;
}
.talent-node.locked {
  cursor: not-allowed;
}

.talent-icon {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

/* Level badge */
.talent-level-badge {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,8,5,.9);
  border: 1px solid #4a3a20;
  border-radius: 3px;
  padding: 0px 5px;
  font-size: 0.65rem;
  color: #b0a080;
  white-space: nowrap;
  font-family: 'Cinzel', serif;
  z-index: 2;
  pointer-events: none;
}
.talent-node.has-points .talent-level-badge {
  color: #88cc44;
  border-color: #557722;
}
.talent-node.maxed .talent-level-badge {
  color: #ffdd44;
  border-color: #aa8822;
}

/* Talent name below icon */
.talent-name-label {
  position: absolute;
  top: 65px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.55rem;
  color: #908070;
  text-align: center;
  width: 80px;
  line-height: 1.2;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- Arrow Connectors --- */
.talent-arrow {
  position: absolute;
  pointer-events: none;
  z-index: 0;
}
.talent-arrow.vertical {
  width: 2px;
  background: #3a3020;
}
.talent-arrow.vertical.active {
  background: linear-gradient(to bottom, #88aa44, #669933);
  box-shadow: 0 0 6px rgba(136,170,68,.3);
}

/* Arrow head (downward triangle) */
.talent-arrow-head {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #3a3020;
}
.talent-arrow-head.active {
  border-top-color: #88aa44;
  filter: drop-shadow(0 0 3px rgba(136,170,68,.4));
}

/* --- Tooltip --- */
.talent-tooltip {
  position: fixed;
  z-index: 9999;
  background: linear-gradient(135deg, rgba(25,18,10,.97), rgba(35,25,12,.97));
  border: 1px solid #6a5530;
  border-radius: 6px;
  padding: 12px 16px;
  max-width: 320px;
  min-width: 200px;
  pointer-events: none;
  box-shadow: 0 4px 20px rgba(0,0,0,.7);
}
.tt-name {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: #e3cc86;
  margin-bottom: 4px;
  font-weight: 600;
}
.tt-level {
  font-size: 0.8rem;
  color: #88cc44;
  margin-bottom: 6px;
}
.tt-req {
  font-size: 0.75rem;
  color: #cc8844;
  margin-bottom: 6px;
}
.tt-req.met { color: #88aa66; }
.tt-desc {
  font-size: 0.8rem;
  color: #c8b898;
  line-height: 1.4;
  margin-bottom: 4px;
}
.tt-next {
  font-size: 0.75rem;
  color: #8899aa;
  margin-bottom: 6px;
  font-style: italic;
}
.tt-hint {
  font-size: 0.65rem;
  color: #605840;
  border-top: 1px solid #3a2a15;
  padding-top: 4px;
  margin-top: 4px;
}

/* --- Responsive --- */
@media (max-width: 700px) {
  .talent-controls {
    flex-direction: column;
    gap: 10px;
  }
  .talent-inputs {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
  .talent-header h1 {
    font-size: 1.4rem;
  }
  .talent-tree-container {
    transform-origin: top left;
  }
}
