/* ============================================================================
   Talent tree, teacher builder + student view (light + dark via CSS variables)
   ============================================================================ */

:root {
  --z-talent-tooltip: 20600;
}

.talents-management-modal {
  width: min(1440px, 96vw);
  max-height: 92dvh;
}

.talents-management-modal .modal-content.talents-modal-content {
  padding: 0;
  max-height: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.talents-management-modal .modal-content.talents-modal-content > .talents-layout,
.talents-management-modal .modal-content.talents-modal-content > .talents-talent-editor {
  flex: 1 1 auto;
  min-height: 0;
}

.talents-management-modal .modal-tabs.talents-class-tabs {
  padding: 0 16px;
  gap: 4px;
  flex-wrap: wrap;
}

.talents-management-modal .modal-tabs.talents-class-tabs .tab-btn {
  border-radius: 10px 10px 0 0;
  margin-bottom: 0;
  font-size: 0.9rem;
}

.talents-management-modal .modal-tabs.talents-class-tabs .tab-btn[data-class="defender"].active {
  color: var(--talent-class-defender);
  border-bottom-color: var(--talent-class-defender);
}

.talents-management-modal .modal-tabs.talents-class-tabs .tab-btn[data-class="wizard"].active {
  color: var(--talent-class-wizard);
  border-bottom-color: var(--talent-class-wizard);
}

.talents-management-modal .modal-tabs.talents-class-tabs .tab-btn[data-class="healer"].active {
  color: var(--talent-class-healer);
  border-bottom-color: var(--talent-class-healer);
}

.talents-management-modal .modal-tabs.talents-class-tabs .tab-btn[data-class="tinkerer"].active {
  color: var(--talent-class-tinkerer);
  border-bottom-color: var(--talent-class-tinkerer);
}

.talents-tier-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 4px 0 10px;
}

.talents-subheading {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--talent-panel-heading);
}

.talents-no-effects {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

.talents-file-input {
  margin-top: 6px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.talents-field--color.hidden,
.form-group.hidden {
  display: none;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.talents-layout {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px 16px 16px;
  min-height: min(72vh, 720px);
  max-height: calc(92vh - 148px);
  overflow: hidden;
}

.talents-panel__head--canvas {
  align-items: flex-start;
}

.talents-panel__head--canvas .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.talents-panel__head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.talents-layout--preview .talents-panel__head--canvas {
  align-items: center;
}

.talents-teacher-preview-points {
  margin: 0 10px 10px;
  flex-wrap: wrap;
}

.talents-teacher-preview-note {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  font-style: italic;
}

.talents-layout--canvas-only {
  grid-template-columns: 1fr;
  display: flex;
  flex-direction: column;
  min-height: min(72vh, 720px);
}

.talents-layout--canvas-only .talents-canvas-panel--full {
  flex: 1 1 auto;
  min-height: 0;
}

.talents-canvas-panel--full {
  min-height: min(72vh, 720px);
}

.talents-canvas-hint {
  margin: 4px 0 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  line-height: 1.35;
}

.talents-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--talent-panel-border);
  border-radius: 14px;
  background: var(--talent-panel-bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.talents-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--talent-panel-border);
  background: var(--color-modal-shell-header);
}

.talents-panel__head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--talent-panel-heading);
  display: flex;
  align-items: center;
  gap: 8px;
}

.talents-panel__head h3 i {
  opacity: 0.85;
}

.talents-panel__body {
  padding: 12px 14px 14px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.talents-panel__foot {
  padding: 12px 14px;
  border-top: 1px solid var(--talent-panel-border);
  background: var(--color-modal-shell-header);
}

.talents-panel__foot .btn {
  width: 100%;
}

/* ── Form controls (inherit data-management theming) ─────────────────── */

.talents-management-modal .form-group {
  margin-bottom: 12px;
}

.talents-management-modal .form-group > label,
.talents-management-modal .form-group > .talents-field > span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-primary-text);
}

.talents-management-modal .form-group input:not([type="checkbox"]):not([type="radio"]),
.talents-management-modal .form-group select,
.talents-management-modal .form-group textarea,
.talents-management-modal .talents-field input,
.talents-management-modal .talents-field select,
.talents-management-modal .talents-field textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--color-input-border);
  background: var(--color-input-bg);
  color: var(--color-input-text);
  font: inherit;
  font-size: 0.9rem;
}

.talents-management-modal .form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.talents-management-modal .form-group select:focus,
.talents-management-modal .form-group textarea:focus,
.talents-management-modal .talents-field input:not([type="checkbox"]):not([type="radio"]):focus,
.talents-management-modal .talents-field select:focus,
.talents-management-modal .talents-field textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 115, 255, 0.18);
}

.talents-field-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--color-text-secondary);
  text-transform: none;
  letter-spacing: normal;
}

.talents-management-modal input[type="color"] {
  height: 42px;
  padding: 4px;
  cursor: pointer;
}

.talents-field.hidden {
  display: none;
}

.talents-field--inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── Tier settings cards ─────────────────────────────────────────────── */

.talents-tier-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.talents-tier-card {
  border: 1px solid var(--talent-panel-border);
  border-radius: 12px;
  background: var(--color-surface);
  padding: 10px;
}

.talents-tier-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.talents-tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: var(--color-selection-muted);
  color: var(--color-primary-text);
  border: 1px solid var(--talent-panel-border);
}

.talents-tier-remove {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.65rem;
  pointer-events: auto;
}

.talents-tier-remove:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: rgba(239, 68, 68, 0.08);
}

.talents-tier-card .form-group {
  margin-bottom: 8px;
}

.talents-tier-card .form-group:last-child {
  margin-bottom: 0;
}

/* ── Canvas ───────────────────────────────────────────────────────────── */

.talents-canvas-panel .talents-panel__body {
  padding: 10px;
  display: flex;
  flex-direction: column;
}

.talents-canvas-frame {
  position: relative;
  flex: 1;
  min-height: 420px;
  border-radius: 12px;
  border: 2px solid var(--talent-canvas-border);
  overflow: auto;
  background:
    radial-gradient(circle at 50% 0%, var(--talent-canvas-overlay), transparent 55%),
    var(--talent-canvas-bg);
}

.talents-canvas {
  position: relative;
  min-height: auto;
  padding: 18px 14px 24px 10px;
  background-size: cover;
  background-position: center;
}

/* Teacher builder: canvas fills the scroll frame so the background covers the panel */
.talents-canvas-panel .talents-canvas-frame .talents-canvas {
  min-height: 100%;
  box-sizing: border-box;
}

.talents-management-modal .talents-canvas--teacher-customize {
  padding-top: 52px;
}

.talents-management-modal .talents-canvas--teacher-preview {
  padding-top: 18px;
}

.talents-canvas--theme-default {
  background-color: var(--talent-canvas-bg);
}

.talents-canvas--image {
  background-color: var(--talent-canvas-bg);
  background-image: var(--talents-bg-image);
}

.talents-canvas--image::before {
  content: '';
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--talent-canvas-bg) 58%, transparent);
  pointer-events: none;
  z-index: 0;
}

.talents-canvas-toolbar {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10;
  pointer-events: none;
}

.talents-max-points-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--talent-panel-bg) 92%, transparent);
  border: 1px solid var(--talent-panel-border);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--talent-panel-heading);
  box-shadow: var(--shadow-sm);
  pointer-events: auto;
}

.talents-field-info {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

.talents-field-info__btn {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--color-primary-text);
  color: var(--color-primary-text);
  font-size: 0.62rem;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, 'Times New Roman', serif;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  cursor: help;
  background: color-mix(in srgb, var(--talent-panel-bg) 85%, transparent);
}

.talents-field-info__tip {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: max-content;
  min-width: 210px;
  max-width: min(280px, calc(100vw - 24px));
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--talent-panel-bg);
  border: 1px solid var(--talent-panel-border);
  box-shadow: var(--shadow-md);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.4;
  color: var(--color-text);
  white-space: normal;
  overflow-wrap: anywhere;
  word-wrap: break-word;
  box-sizing: border-box;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 12;
}

.talents-field-info:hover .talents-field-info__tip,
.talents-field-info:focus-within .talents-field-info__tip {
  opacity: 1;
  visibility: visible;
}

.talents-max-points-inline > span:not(.talents-field-info) {
  white-space: nowrap;
}

.talents-max-points-inline input {
  width: 3.25rem;
  padding: 4px 6px;
  border-radius: 8px;
  border: 1px solid var(--color-input-border);
  background: var(--color-input-bg);
  color: var(--color-input-text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

.talents-canvas-bg-wrap {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
}

.talents-canvas-bg-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--talent-panel-border);
  background: color-mix(in srgb, var(--talent-panel-bg) 92%, transparent);
  color: var(--talent-panel-heading);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--transition-fast) var(--ease-out),
    box-shadow var(--transition-fast) var(--ease-out);
}

.talents-canvas-bg-btn:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-md);
}

.talents-canvas-bg-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 210px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--talent-panel-border);
  background: var(--talent-panel-bg);
  box-shadow: var(--shadow-lg);
}

.talents-canvas-bg-popover.hidden {
  display: none;
}

.talents-canvas-bg-popover__title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--talent-panel-heading);
}

.talents-canvas-bg-color,
.talents-canvas-bg-upload {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary-text);
}

.talents-canvas-bg-color input[type="color"] {
  width: 100%;
  height: 36px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--color-input-border);
  cursor: pointer;
}

.talents-bg-preview {
  display: block;
  width: 100%;
  max-height: 80px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--talent-panel-border);
}

.talents-bg-use-color {
  width: 100%;
  margin-bottom: 10px;
}

.talents-connections {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.talents-connection-line {
  stroke: var(--talent-connection);
  stroke-width: 2.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 4px var(--talent-connection-glow));
}

.talents-tier-row-display {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 84px;
  margin-bottom: 26px;
}

.talents-tier-row-display:has(.talents-node-wrap:hover),
.talents-tier-row-display:has(.talents-node-wrap:focus-within) {
  z-index: calc(var(--z-tooltip) + 1);
}

.talents-tier-row-display:last-child {
  margin-bottom: 0;
}

.talents-tier-row-display__head {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 6rem;
  margin-bottom: 0;
  pointer-events: none;
}

.talents-tier-meta {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  background: var(--talent-tier-badge-bg);
  color: var(--talent-tier-badge-text);
  border: 1px solid var(--talent-tier-badge-border);
  box-shadow: var(--shadow-md);
  pointer-events: auto;
}

.talents-tier-meta__row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
}

.talents-tier-meta__row .talents-tier-remove {
  margin-left: auto;
  flex-shrink: 0;
}

.talents-tier-meta small {
  opacity: 0.85;
  font-weight: 600;
  font-size: 0.72rem;
}

.talents-tier-min {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 600;
  pointer-events: auto;
}

.talents-tier-min input {
  width: 3rem;
  min-width: 3rem;
  padding: 2px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  text-align: center;
  border-radius: 6px;
  border: 1px solid var(--talent-tier-badge-border);
  background: var(--color-input-bg);
  color: var(--color-input-text);
  box-sizing: border-box;
}

.talents-tier-slots-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
}

.talents-tier-row-display--add-tier {
  justify-content: flex-start;
  min-height: auto;
  margin-top: 4px;
  margin-bottom: 0;
  padding-left: 6.5rem;
}

.talents-add-tier-btn {
  pointer-events: auto;
}

.talents-tier-slots {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 22px;
  justify-content: center;
  align-items: center;
}

/* ── Talent nodes ───────────────────────────────────────────────────────── */

.talents-node-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  z-index: 1;
}

.talents-node-wrap:hover,
.talents-node-wrap:focus-within {
  z-index: calc(var(--z-tooltip) + 1);
}

.talents-node-wrap:hover .talents-node-tooltip:not(.talents-node-tooltip--floating),
.talents-node-wrap:focus-within .talents-node-tooltip:not(.talents-node-tooltip--floating) {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.talents-canvas--js-tooltips .talents-node-tooltip:not(.talents-node-tooltip--visible) {
  opacity: 0 !important;
  visibility: hidden !important;
}

.talents-canvas--js-tooltips .talents-node-wrap:hover .talents-node-tooltip:not(.talents-node-tooltip--visible),
.talents-canvas--js-tooltips .talents-node-wrap:focus-within .talents-node-tooltip:not(.talents-node-tooltip--visible) {
  opacity: 0 !important;
  visibility: hidden !important;
  transform: none !important;
}

.talents-node {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--talent-node-border);
  background: var(--talent-node-bg);
  color: var(--talent-node-text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  transition:
    transform var(--transition-fast) var(--ease-out),
    box-shadow var(--transition-fast) var(--ease-out),
    border-color var(--transition-fast) var(--ease-out);
  box-shadow: var(--shadow-sm);
}

.talents-node--add-slot {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-color: color-mix(in srgb, var(--color-success) 50%, var(--talent-node-border));
  background: color-mix(in srgb, var(--color-success) 14%, var(--talent-node-bg));
  color: var(--color-success);
}

.talents-node--add-slot:hover {
  border-color: var(--color-success);
  background: color-mix(in srgb, var(--color-success) 22%, var(--talent-node-bg));
  transform: scale(1.08);
}

.talents-node--add-slot .talents-node-icon i {
  font-size: 0.8rem;
}

.talents-node-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.talents-node-icon i {
  font-size: 1.35rem;
  color: var(--color-primary);
}

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

.talents-node-tooltip {
  position: absolute;
  top: calc(100% + 10px);
  bottom: auto;
  left: 50%;
  z-index: 1;
  min-width: 220px;
  max-width: 300px;
  padding: 0;
  border-radius: 14px;
  border: 2px solid rgba(124, 115, 255, 0.45);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow:
    0 10px 28px rgba(15, 23, 42, 0.22),
    0 0 0 1px rgba(124, 115, 255, 0.12);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(-50%) translateY(4px);
  transition:
    opacity 0.15s ease,
    visibility 0.15s ease,
    transform 0.15s ease;
  text-align: left;
  overflow: hidden;
}

.talents-node-tooltip--floating {
  position: fixed;
  top: auto;
  left: auto;
  z-index: var(--z-talent-tooltip);
  pointer-events: none;
}

.talents-node-tooltip--visible {
  opacity: 1;
  visibility: visible;
}

.talents-node-tooltip--floating.talents-node-tooltip--visible {
  transform: translateX(-50%);
}

.talents-node-tooltip-header {
  display: block;
  padding: 10px 12px 9px;
  background: linear-gradient(135deg, rgba(124, 115, 255, 0.24) 0%, rgba(124, 115, 255, 0.08) 100%);
  border-bottom: 1px solid rgba(124, 115, 255, 0.22);
}

.talents-node-tooltip-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 10px 9px;
  background: var(--color-background-alt);
}

.talents-node-tooltip-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.talents-node-tooltip-chip--neutral {
  background: rgba(100, 116, 139, 0.14);
  color: var(--color-text-secondary);
  border: 1px solid rgba(100, 116, 139, 0.28);
}

.talents-node-tooltip-chip--cost {
  background: rgba(249, 115, 22, 0.14);
  color: #c2410c;
  border: 1px solid rgba(249, 115, 22, 0.32);
}

.talents-node-tooltip-chip--progress {
  background: rgba(124, 115, 255, 0.16);
  color: var(--color-primary-text);
  border: 1px solid rgba(124, 115, 255, 0.35);
}

.talents-node-tooltip-chip--level {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.talents-node-tooltip-chip--success {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.32);
}

.talents-node-tooltip-chip--warn {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.talents-node-tooltip-chip--danger {
  background: rgba(239, 68, 68, 0.14);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.talents-node-tooltip-chip--hint {
  background: transparent;
  color: var(--color-text-secondary);
  border: 1px dashed rgba(124, 115, 255, 0.35);
  font-weight: 600;
  font-size: 0.64rem;
  text-transform: none;
  letter-spacing: 0;
}

.talents-node-tooltip-body {
  display: block;
  padding: 8px 12px 11px;
  border-top: 1px dashed rgba(124, 115, 255, 0.22);
  background: var(--color-surface);
}

.talents-node-tooltip-body-label {
  display: block;
  margin: 0 0 5px;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.talents-node-tooltip::after {
  content: '';
  position: absolute;
  bottom: 100%;
  top: auto;
  left: 50%;
  margin-left: -6px;
  border: 6px solid transparent;
  border-bottom-color: rgba(124, 115, 255, 0.45);
  filter: none;
}

.talents-node-tooltip--above::after {
  bottom: auto;
  top: 100%;
  border-bottom-color: transparent;
  border-top-color: rgba(124, 115, 255, 0.45);
  filter: none;
}

.talents-node-tooltip-name {
  display: block;
  margin: 0;
  font-size: 0.94rem;
  font-weight: 800;
  color: var(--color-primary-text);
  line-height: 1.25;
}

.talents-node-tooltip-desc {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--color-text);
  font-weight: 500;
}

.talents-node-tooltip-desc--empty {
  font-style: italic;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.talents-node-name,
.talents-node-cost,
.talents-node-hint {
  display: none !important;
}

.talents-node--empty {
  border-style: dashed;
  background: var(--talent-node-empty-bg);
  color: var(--color-text-secondary);
}

.talents-node--empty .talents-node-icon i {
  color: inherit;
}

.talents-node--empty:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  transform: translateY(-2px);
}

.talents-node--selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 115, 255, 0.28), var(--shadow-md);
  transform: translateY(-2px);
}

.talents-management-modal .talents-node-remove {
  position: absolute;
  top: -2px;
  right: -2px;
  z-index: 3;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 0.58rem;
  cursor: pointer;
  opacity: 0.9;
  transition:
    opacity var(--transition-fast) var(--ease-out),
    color var(--transition-fast) var(--ease-out),
    border-color var(--transition-fast) var(--ease-out);
}

.talents-management-modal .talents-node-wrap:hover .talents-node-remove,
.talents-management-modal .talents-node-wrap:focus-within .talents-node-remove {
  opacity: 1;
}

.talents-management-modal .talents-node-remove:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
  background: color-mix(in srgb, var(--color-danger) 10%, var(--color-surface));
}

.talents-management-modal .talents-node-remove--slot {
  opacity: 0.75;
}

.talents-management-modal .talents-node-wrap:hover .talents-node-remove--slot {
  opacity: 1;
}

.talents-node--teacher-preview {
  cursor: default;
  pointer-events: none;
}

.talents-node-wrap:has(.talents-node--teacher-preview) {
  pointer-events: auto;
}

.talents-node--unlocked {
  border-color: var(--color-success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.talents-node--partial {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(124, 115, 255, 0.24);
}

.talents-node--partial:not(:disabled):hover,
.talents-node--unlocked:not(:disabled):hover {
  transform: translateY(-2px);
}

.talents-node-progress {
  position: absolute;
  right: -2px;
  bottom: -2px;
  min-width: 1.65rem;
  padding: 1px 5px;
  border-radius: 8px;
  border: 1px solid var(--color-modal-shell-border);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  box-shadow: var(--shadow-sm);
  pointer-events: none;
}

.talents-node--unlocked .talents-node-progress {
  border-color: var(--color-success);
  color: var(--color-success);
}

.talents-node--partial .talents-node-progress {
  border-color: var(--color-primary);
  color: var(--color-primary-text);
}

.talents-node--available {
  border-color: var(--color-warning);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.22);
}

.talents-node--available:not(:disabled):hover {
  transform: translateY(-3px) scale(1.03);
}

.talents-node--locked,
.talents-node--excluded {
  opacity: 0.55;
  filter: grayscale(0.35);
  cursor: default;
}

.talents-node-spacer {
  width: 72px;
  height: 72px;
}

/* ── Editor panel ─────────────────────────────────────────────────────── */

.talents-editor-empty {
  margin: 0;
  padding: 18px 8px;
  text-align: center;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.talents-icon-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0 0 10px;
  border-radius: 50%;
  border: 2px solid var(--talent-node-border);
  background: var(--talent-node-bg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.talents-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.talents-icon-preview-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--color-primary);
  font-size: 1.35rem;
}

.talents-icon-grid {
  --talent-icon-cell: 46px;
  display: grid;
  grid-template-columns: repeat(5, var(--talent-icon-cell));
  grid-auto-rows: var(--talent-icon-cell);
  gap: 6px;
  max-height: calc(var(--talent-icon-cell) * 4 + 6px * 3 + 16px);
  overflow-y: auto;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--talent-panel-border);
  background: var(--color-surface);
}

.talents-icon-pick {
  width: var(--talent-icon-cell);
  height: var(--talent-icon-cell);
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--color-background-alt);
  cursor: pointer;
}

.talents-icon-pick[hidden] {
  display: none;
}

.talents-icon-pick:hover {
  border-color: var(--color-primary-light);
}

.talents-icon-pick.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(124, 115, 255, 0.2);
}

.talents-icon-pick img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 5px;
}

.talents-exclude-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 140px;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--talent-panel-border);
  background: var(--color-surface);
}

.talents-exclude-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 4px 0;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  color: var(--color-text);
  cursor: pointer;
  line-height: 1.3;
}

.talents-exclude-opt input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.talents-effects-block {
  margin-top: 4px;
}

.talents-effect-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 8px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--talent-panel-border);
  background: var(--color-surface);
}

.talents-effect-row__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.talents-effect-row__fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.talents-effect-remove {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.talents-effect-remove:hover {
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.talents-editor-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.talents-bg-preview {
  display: block;
  width: 100%;
  max-height: 96px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 8px;
  border: 1px solid var(--talent-panel-border);
}

.talents-empty {
  padding: 24px;
  text-align: center;
  color: var(--color-text-secondary);
}

/* ── Student overlay (matches site modal shell) ───────────────────────── */

.talents-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: var(--modal-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.talents-student-modal {
  --student-talent-accent: var(--color-primary);
  width: min(760px, 100%);
  max-height: min(92vh, 900px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 2px solid var(--color-modal-shell-border);
  box-shadow: var(--shadow-2xl);
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
  color: var(--color-text);
  min-height: 0;
}

.talents-student-modal--defender { --student-talent-accent: var(--talent-class-defender); }
.talents-student-modal--wizard { --student-talent-accent: var(--talent-class-wizard); }
.talents-student-modal--healer { --student-talent-accent: var(--talent-class-healer); }
.talents-student-modal--tinkerer { --student-talent-accent: var(--talent-class-tinkerer); }
.talents-student-modal--rogue { --student-talent-accent: var(--talent-class-rogue, #f59e0b); }

.talents-student-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--color-modal-shell-border);
  background: var(--color-modal-shell-header);
  flex-shrink: 0;
}

.talents-student-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.talents-student-header__sigil {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--student-talent-accent);
  background: var(--color-selection-muted);
  border: 1px solid var(--color-modal-shell-border);
}

.talents-student-header h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--color-primary-text);
}

.talents-student-header__tagline {
  margin: 3px 0 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.talents-student-close-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--color-modal-shell-border);
  background: var(--color-surface);
  color: var(--color-primary);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.talents-student-close-btn:hover {
  background: var(--color-brand-hover-bg);
  border-color: var(--color-primary);
}

.talents-student-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 18px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--color-modal-shell-border);
  background: var(--color-modal-shell-header);
  flex-shrink: 0;
}

.talents-student-hud--busy {
  opacity: 0.75;
  pointer-events: none;
}

.talents-student-stat {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--color-modal-shell-border);
  background: var(--color-surface);
}

.talents-student-stat__icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.85rem;
  color: var(--student-talent-accent);
  background: var(--color-selection-muted);
}

.talents-student-stat__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.talents-student-stat__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.talents-student-stat__value {
  font-size: 1.2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary-text);
}

.talents-student-progress {
  flex: 1 1 200px;
  min-width: 180px;
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--color-modal-shell-border);
  background: var(--color-surface);
}

.talents-student-progress__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.talents-student-progress__label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text-secondary);
}

.talents-student-progress__nums {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--color-text);
}

.talents-student-progress__track {
  height: 10px;
  border-radius: 999px;
  background: var(--color-background-alt);
  border: 1px solid var(--color-modal-shell-border);
  overflow: hidden;
}

.talents-student-progress__fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--student-talent-accent), var(--color-primary-light));
  transition: width 0.35s ease;
}

.talents-student-respec-btn {
  margin-left: auto;
  white-space: nowrap;
}

.talents-student-hud-hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-align: center;
}

.talents-node--sheet-active {
  box-shadow:
    0 0 0 3px var(--student-talent-accent),
    0 0 18px color-mix(in srgb, var(--student-talent-accent) 45%, transparent);
}

.talents-node-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-modal) + 2);
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.talents-node-sheet-backdrop--visible {
  opacity: 1;
}

.talents-node-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: calc(var(--z-modal) + 3);
  display: flex;
  flex-direction: column;
  max-height: min(78vh, 640px);
  border-radius: 18px 18px 0 0;
  border: 2px solid var(--color-modal-shell-border);
  border-bottom: none;
  background: linear-gradient(180deg, var(--color-modal-shell-start) 0%, var(--color-modal-shell-end) 100%);
  box-shadow: 0 -12px 40px rgba(15, 23, 42, 0.28);
  transform: translateY(105%);
  transition: transform 0.28s ease;
  color: var(--color-text);
}

.talents-node-sheet--open {
  transform: translateY(0);
}

.talents-node-sheet--defender { --student-talent-accent: var(--talent-class-defender); }
.talents-node-sheet--wizard { --student-talent-accent: var(--talent-class-wizard); }
.talents-node-sheet--healer { --student-talent-accent: var(--talent-class-healer); }
.talents-node-sheet--tinkerer { --student-talent-accent: var(--talent-class-tinkerer); }
.talents-node-sheet--rogue { --student-talent-accent: var(--talent-class-rogue, #f59e0b); }

.talents-node-sheet__handle {
  width: 42px;
  height: 4px;
  margin: 10px auto 0;
  border-radius: 999px;
  background: var(--color-border);
  flex-shrink: 0;
}

.talents-node-sheet__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px 8px;
  border-bottom: 1px solid var(--color-modal-shell-border);
  flex-shrink: 0;
}

.talents-node-sheet__head-main {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.talents-node-sheet__icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid color-mix(in srgb, var(--student-talent-accent) 55%, transparent);
  background: var(--color-surface);
}

.talents-node-sheet__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.talents-node-sheet__icon i {
  font-size: 1.1rem;
  color: var(--student-talent-accent);
}

.talents-node-sheet__head-text {
  min-width: 0;
}

.talents-node-sheet__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--color-primary-text);
}

.talents-node-sheet__subtitle {
  margin: 2px 0 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.talents-node-sheet__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-modal-shell-border);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.talents-node-sheet__scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0;
}

.talents-node-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 14px 16px 10px;
}

.talents-node-sheet__alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.4;
}

.talents-node-sheet__alert i {
  flex-shrink: 0;
  margin-top: 2px;
  font-size: 0.9rem;
}

.talents-node-sheet__alert--warn {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #b45309;
}

.talents-node-sheet__alert--danger {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #b91c1c;
}

.talents-node-sheet__progress-card {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--color-modal-shell-border);
  background: var(--color-surface);
}

.talents-node-sheet__progress-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.talents-node-sheet__progress-label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.talents-node-sheet__progress-value {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1;
  color: var(--color-primary-text);
  font-variant-numeric: tabular-nums;
}

.talents-node-sheet__progress-sep {
  margin: 0 1px;
  font-weight: 600;
  color: var(--color-text-secondary);
  opacity: 0.65;
}

.talents-node-sheet__progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(124, 115, 255, 0.14);
  overflow: hidden;
}

.talents-node-sheet__progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--student-talent-accent) 75%, #7c73ff) 0%,
    var(--student-talent-accent) 100%
  );
  transition: width 0.25s ease;
}

.talents-node-sheet__progress-fill--complete {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
}

.talents-node-sheet__progress-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.talents-node-sheet__progress-status--success {
  color: var(--color-success, #16a34a);
}

.talents-node-sheet__progress-status--muted {
  font-weight: 500;
}

.talents-node-sheet__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.talents-node-sheet-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1.25;
}

.talents-node-sheet-chip--neutral {
  background: rgba(100, 116, 139, 0.14);
  color: var(--color-text-secondary);
  border: 1px solid rgba(100, 116, 139, 0.28);
}

.talents-node-sheet-chip--success {
  background: rgba(16, 185, 129, 0.16);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, 0.32);
}

.talents-node-sheet-chip--warn {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.talents-node-sheet__section {
  margin: 0;
}

.talents-node-sheet__section-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
}

.talents-node-sheet__description {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--color-text);
}

.talents-node-sheet__description--empty {
  font-style: italic;
  color: var(--color-text-secondary);
}

.talents-node-sheet__hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--color-text-secondary);
  background: rgba(124, 115, 255, 0.08);
  border: 1px dashed rgba(124, 115, 255, 0.28);
}

.talents-node-sheet__hint i {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--color-primary);
}

.talents-node-sheet__footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--color-modal-shell-border);
  flex-shrink: 0;
}

.talents-node-sheet__invest {
  width: 100%;
  justify-content: center;
  gap: 8px;
}

.talents-node-sheet__footer .btn-secondary,
.talents-node-sheet__footer .btn-primary.talents-node-sheet__dismiss {
  width: 100%;
  justify-content: center;
}

.talents-node-sheet__dismiss {
  width: 100%;
  justify-content: center;
}

.talents-canvas--busy {
  pointer-events: none;
  opacity: 0.88;
}

.talents-student-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 16px 16px;
  overflow: hidden;
}

.talents-student-tree-viewport {
  position: relative;
  flex: 1 1 auto;
  height: 0;
  min-height: 280px;
  border-radius: 14px;
  overflow: hidden;
  isolation: isolate;
}

.talents-student-tree-viewport--framed {
  border: 2px solid var(--talent-canvas-border);
  box-shadow: var(--shadow-sm);
}

.talents-student-tree-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-color: var(--talent-canvas-bg);
  background-size: cover;
  background-position: center;
  pointer-events: none;
}

.talents-student-tree-bg--theme-default {
  background:
    radial-gradient(circle at 50% 0%, var(--talent-canvas-overlay), transparent 55%),
    var(--talent-canvas-bg);
}

.talents-student-tree-bg--image {
  background-color: var(--talent-canvas-bg);
  background-image: var(--talents-bg-image);
}

.talents-student-tree-bg--image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--talent-canvas-bg) 42%, transparent);
}

.talents-student-tree-vignette {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, 0.2) 100%);
}

.talents-student-tree-scroll {
  position: relative;
  z-index: 2;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.talents-canvas--student-content {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  padding: 20px 16px 28px;
  background: transparent;
  box-sizing: border-box;
}

.talents-student-tier.talents-tier-row-display {
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: auto;
  margin-bottom: 20px;
  padding: 0 8px;
}

.talents-student-tier.talents-tier-row-display:last-child {
  margin-bottom: 0;
}

.talents-student-tier .talents-tier-row-display__head {
  position: static;
  transform: none;
  width: auto;
  justify-content: center;
}

.talents-student-tier__badge.talents-tier-meta {
  padding: 5px 14px;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--talent-tier-badge-bg);
  color: var(--talent-tier-badge-text);
  border-color: var(--talent-tier-badge-border);
  box-shadow: var(--shadow-sm);
}

.talents-student-tier__slots.talents-tier-slots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px 18px;
  width: 100%;
  max-width: 100%;
}

.talents-canvas--student-content .talents-node,
.talents-canvas--student-content .talents-node-spacer {
  width: 64px;
  height: 64px;
}

.talents-student-tier--slots-4 .talents-node,
.talents-student-tier--slots-4 .talents-node-spacer,
.talents-student-tier--slots-5 .talents-node,
.talents-student-tier--slots-5 .talents-node-spacer {
  width: 58px;
  height: 58px;
}

.talents-canvas--student-content .talents-node-icon i {
  font-size: 1.25rem;
}

.talents-canvas--student-content .talents-node {
  box-shadow: var(--shadow-sm);
}

.talents-canvas--student-content .talents-node--available {
  border-color: var(--color-warning);
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.22), var(--shadow-md);
}

.talents-canvas--student-content .talents-node--unlocked {
  border-color: var(--color-success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.22);
}

.talents-canvas--student-content .talents-node--locked,
.talents-canvas--student-content .talents-node--excluded {
  opacity: 0.55;
  filter: grayscale(0.35);
}

.talents-canvas--student-content .talents-node-progress {
  font-size: 0.62rem;
  background: var(--color-surface);
  color: var(--color-text);
}

.talents-connections--student .talents-connection-line {
  stroke: var(--talent-connection);
  stroke-width: 2.5;
  filter: drop-shadow(0 0 4px var(--talent-connection-glow));
}

.talents-student-body > .talents-student-empty {
  padding: 28px 18px;
  text-align: center;
  color: var(--color-text-secondary);
  overflow-y: auto;
}

@media (min-width: 769px) {
  .talents-student-modal {
    width: min(800px, 100%);
    min-height: min(86vh, 860px);
    max-height: 92dvh;
  }

  .talents-student-tree-viewport {
    min-height: min(62vh, 580px);
  }

  .talents-canvas--student-content {
    padding: 24px 20px 32px;
  }

  .talents-student-tier.talents-tier-row-display {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-height: 92px;
    margin-bottom: 32px;
    padding: 0 12px 0 0;
  }

  .talents-student-tier .talents-tier-row-display__head {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 5.5rem;
  }

  .talents-student-tier__slots.talents-tier-slots {
    gap: 16px 22px;
    padding-left: 5.75rem;
    padding-right: 0.5rem;
  }

  .talents-canvas--student-content .talents-node,
  .talents-canvas--student-content .talents-node-spacer {
    width: 72px;
    height: 72px;
  }

  .talents-student-tier--slots-4 .talents-node,
  .talents-student-tier--slots-4 .talents-node-spacer,
  .talents-student-tier--slots-5 .talents-node,
  .talents-student-tier--slots-5 .talents-node-spacer {
    width: 64px;
    height: 64px;
  }
}

/* Spellbook talent bonus chip */
.spellbook-talent-mods {
  margin-top: 0.5rem;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  background: var(--color-selection-muted);
  border: 1px solid var(--color-modal-shell-border);
  font-size: 0.82rem;
}

.spellbook-talent-mods-title {
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--color-primary-text);
}

.spellbook-talent-mod-line {
  color: var(--color-text-secondary);
}

/* Full talent editor sheet (spell-wizard style) */
.talents-talent-editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
  height: calc(92vh - 120px);
  max-height: calc(92vh - 120px);
}

.talents-talent-editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-modal-shell-border);
  background: var(--color-modal-shell-header);
  flex-shrink: 0;
}

.talents-talent-editor-header h3 {
  margin: 0;
  flex: 1;
  font-size: 1rem;
  color: var(--color-primary-text);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.talents-talent-editor-header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.talents-talent-editor-body {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.talents-talent-editor-meta {
  padding: 16px;
  overflow-y: auto;
  border-right: 1px solid var(--color-modal-shell-border);
  background: var(--color-surface);
}

.talents-talent-editor-effects {
  padding: 16px 18px;
  overflow-y: auto;
  min-width: 0;
}

.talents-talent-editor-effects h4 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: var(--color-primary-text);
}

.talent-effects-builder {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.talent-effects-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.talent-effect-row {
  border: 1px solid var(--color-modal-shell-border);
  border-radius: 12px;
  background: var(--color-surface);
}

.talent-effect-catalog {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.talent-effect-catalog-section h5 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

.talent-effect-flag-note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* Rich spell multi-select */
.talent-spell-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(124, 115, 255, 0.25);
  background: rgba(124, 115, 255, 0.05);
}

.talent-spell-picker-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.talent-spell-picker-head label {
  font-weight: 700;
  font-size: 0.88rem;
}

.talent-spell-picker-hint {
  font-size: 0.78rem;
  color: var(--color-text-secondary);
}

.talent-spell-picker-empty {
  margin: 0;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

.talent-spell-selected-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.talent-spell-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid rgba(124, 115, 255, 0.35);
  background: rgba(124, 115, 255, 0.12);
  font-size: 0.8rem;
}

.talent-spell-chip img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: cover;
}

.talent-spell-chip-remove {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  opacity: 0.7;
}

.talent-spell-chip-remove:hover {
  opacity: 1;
}

.talent-spell-search {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-modal-shell-border);
  background: var(--color-surface);
  color: inherit;
  font: inherit;
}

.talent-spell-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.talent-spell-option {
  display: block;
  cursor: pointer;
  margin: 0;
}

.talent-spell-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.talent-spell-option-card {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--color-modal-shell-border);
  border-radius: 10px;
  background: var(--color-surface);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.talent-spell-option:hover .talent-spell-option-card {
  border-color: rgba(124, 115, 255, 0.45);
  background: rgba(124, 115, 255, 0.06);
}

.talent-spell-option.is-selected .talent-spell-option-card {
  border-color: var(--color-primary);
  background: rgba(124, 115, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(124, 115, 255, 0.25);
}

.talent-spell-option-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.talent-spell-option-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.talent-spell-option-body strong {
  font-size: 0.88rem;
}

.talent-spell-option-meta {
  font-size: 0.74rem;
  color: var(--color-text-secondary);
}

.talent-spell-option-desc {
  margin: 4px 0 0;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--color-text-secondary);
}

.talent-potency-config-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.talent-potency-spell-panel {
  border: 1px solid var(--color-modal-shell-border);
  border-radius: 12px;
  background: var(--color-surface);
  overflow: hidden;
}

.talent-potency-spell-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-modal-shell-border);
  background: rgba(124, 115, 255, 0.06);
}

.talent-potency-spell-head img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
}

.talent-potency-spell-head strong {
  display: block;
  font-size: 0.9rem;
}

.talent-potency-spell-head span {
  font-size: 0.74rem;
  color: var(--color-text-secondary);
}

.talent-potency-effect-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
}

.talent-potency-effect-row {
  display: grid;
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(124, 115, 255, 0.18);
  background: rgba(124, 115, 255, 0.04);
}

.talent-potency-effect-label strong {
  display: block;
  font-size: 0.86rem;
}

.talent-potency-effect-label span {
  display: block;
  margin-top: 2px;
  font-size: 0.72rem;
  color: var(--color-text-secondary);
}

.talent-potency-effect-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(88px, 0.65fr);
  gap: 10px;
  align-items: end;
}

.talent-effect-modifier-values {
  margin-top: 2px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(124, 115, 255, 0.2);
  background: var(--color-surface);
}

.talent-effects-builder .effect-config-value-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) minmax(88px, 0.65fr);
  gap: 12px;
  align-items: end;
}

.talent-vt-control {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-width: 0;
}

.talent-vt-control .effect-value-type {
  display: none !important;
}

.talent-effects-builder .talent-vt-segmented,
.talent-effects-builder .talent-potency-vt-segmented {
  position: relative;
  z-index: 2;
  pointer-events: auto;
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid rgba(124, 115, 255, 0.3);
  background: var(--color-surface);
  overflow: hidden;
}

.talent-effects-builder .talent-vt-segmented .dm-segmented__opt,
.talent-effects-builder .talent-potency-vt-segmented .dm-segmented__opt {
  display: flex;
  flex: 1 1 50%;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  cursor: pointer;
  pointer-events: auto;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  opacity: 1;
  color: var(--color-text-secondary);
  border-right: 1px solid rgba(124, 115, 255, 0.22);
}

.talent-effects-builder .talent-vt-segmented .dm-segmented__opt:last-child,
.talent-effects-builder .talent-potency-vt-segmented .dm-segmented__opt:last-child {
  border-right: none;
}

.talent-effects-builder .talent-vt-segmented .dm-segmented__opt span,
.talent-effects-builder .talent-potency-vt-segmented .dm-segmented__opt span {
  display: block;
  width: 100%;
  padding: 8px 10px;
  text-align: center;
  line-height: 1.2;
}

.talent-effects-builder .talent-vt-segmented .dm-segmented__opt:hover,
.talent-effects-builder .talent-potency-vt-segmented .dm-segmented__opt:hover {
  background: rgba(124, 115, 255, 0.1);
  color: var(--color-primary-text);
}

.talent-effects-builder .talent-vt-segmented .dm-segmented__opt:has(input:checked),
.talent-effects-builder .talent-potency-vt-segmented .dm-segmented__opt:has(input:checked) {
  background: rgba(124, 115, 255, 0.22);
  color: var(--color-primary-text);
  font-weight: 700;
}

.talent-effects-builder .effect-config-field > label,
.talent-potency-effect-controls .effect-config-field > label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.talent-potency-no-effects {
  margin: 0;
  padding: 12px;
  font-size: 0.82rem;
  color: var(--color-text-secondary);
}

/* Talent effect editor - override data-management light-shell rules from spells.css */
.data-management-modal.talents-management-modal .effect-row,
.data-management-modal.talents-management-modal .talent-effect-row {
  background: var(--color-tool-inset, var(--color-surface));
  border-color: var(--color-modal-shell-border);
  color: var(--color-text);
}

.data-management-modal.talents-management-modal .effect-row input[type="number"],
.data-management-modal.talents-management-modal .effect-row input.effect-value,
.data-management-modal.talents-management-modal .effect-row input.effect-duration,
.data-management-modal.talents-management-modal .effect-row select.effect-type,
.data-management-modal.talents-management-modal .effect-row select.effect-gain-type,
.data-management-modal.talents-management-modal .effect-row select.effect-value-type {
  background: var(--color-input-bg);
  border-color: var(--color-input-border);
  color: var(--color-input-text);
  color-scheme: inherit;
}

.data-management-modal.talents-management-modal .effect-row select option {
  background: var(--color-input-bg);
  color: var(--color-input-text);
}

.data-management-modal.talents-management-modal .spell-effect-picker-lead,
.data-management-modal.talents-management-modal .talent-effects-builder .spell-effect-picker-lead {
  color: var(--color-text-secondary);
  opacity: 1;
}

.data-management-modal.talents-management-modal .spell-effect-option {
  background: var(--color-tool-card, rgba(124, 115, 255, 0.08));
  border-color: var(--color-modal-shell-border);
  color: var(--color-text);
}

.data-management-modal.talents-management-modal .spell-effect-option:hover {
  background: var(--color-selection-hover);
  border-color: var(--color-primary-light);
}

.data-management-modal.talents-management-modal .spell-effect-option-text strong {
  color: var(--color-text);
}

.data-management-modal.talents-management-modal .spell-effect-option-text span {
  color: var(--color-text-secondary);
  opacity: 1;
}

.data-management-modal.talents-management-modal .effect-selected-card {
  background: var(--color-tool-card, rgba(124, 115, 255, 0.08));
}

.data-management-modal.talents-management-modal .effect-field-label {
  color: var(--color-text-secondary);
}

.data-management-modal.talents-management-modal .talent-effect-catalog-section h5 {
  color: var(--color-text-secondary);
}

.data-management-modal.talents-management-modal .talent-effects-builder .effect-config-field > label,
.data-management-modal.talents-management-modal .talent-potency-effect-controls .effect-config-field > label {
  color: var(--color-text-secondary);
  opacity: 1;
}

.data-management-modal.talents-management-modal .talent-spell-picker {
  background: var(--color-tool-card, rgba(124, 115, 255, 0.08));
  border-color: var(--color-modal-shell-border);
}

.data-management-modal.talents-management-modal .talent-spell-picker-head label {
  color: var(--color-text);
}

.data-management-modal.talents-management-modal .talent-potency-spell-panel,
.data-management-modal.talents-management-modal .talent-potency-effect-row,
.data-management-modal.talents-management-modal .talent-effect-modifier-values {
  background: var(--color-tool-inset, var(--color-surface));
  border-color: var(--color-modal-shell-border);
  color: var(--color-text);
}

@media (max-width: 1100px) {
  .talents-talent-editor-body {
    grid-template-columns: 1fr;
  }

  .talents-talent-editor-meta {
    border-right: none;
    border-bottom: 1px solid var(--color-modal-shell-border);
    max-height: 40vh;
  }

  .talents-layout {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    min-height: min(56vh, 520px);
    max-height: none;
    overflow: hidden;
    flex: 1 1 auto;
  }

  .talents-panel {
    min-height: 0;
    max-height: none;
  }

  .talents-canvas-panel .talents-panel__body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .talents-canvas-frame {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
}

@media (max-width: 768px) {
  /* Teacher talents modal - use full viewport height */
  #modal-container:has(.talents-management-modal) {
    align-items: stretch;
    justify-content: stretch;
    min-height: 100dvh;
  }

  #modal-container:has(.talents-management-modal) > * {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    height: 100%;
    align-self: stretch;
  }

  .talents-management-modal {
    width: 100%;
    max-width: none;
    max-height: none;
    height: 100%;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .talents-management-modal .modal-header {
    padding: 12px 14px;
  }

  .talents-management-modal .modal-header h2 {
    font-size: 1.15rem;
  }

  .talents-management-modal .modal-tabs.talents-class-tabs {
    padding: 0 10px;
  }

  .talents-management-modal .modal-tabs.talents-class-tabs .tab-btn {
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    font-size: 0.82rem;
    padding: 8px 6px;
  }

  .talents-management-modal .modal-content.talents-modal-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .talents-layout {
    min-height: 0;
    padding: 10px 12px 12px;
    gap: 10px;
    flex: 1;
    overflow: hidden;
  }

  .talents-layout--canvas-only {
    display: flex;
    flex-direction: column;
  }

  .talents-layout--canvas-only .talents-canvas-panel--full {
    flex: 1;
    min-height: 0;
  }

  .talents-layout--canvas-only .talents-panel__body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .talents-layout--canvas-only .talents-canvas-frame {
    flex: 1;
    min-height: 0;
  }

  .talents-canvas-panel--full {
    min-height: 0;
  }

  .talents-panel__head--canvas {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .talents-panel__head--canvas h3 {
    font-size: 0.9rem;
  }

  .talents-panel__head-actions {
    justify-content: stretch;
    width: 100%;
  }

  .talents-panel__head-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
    white-space: normal;
    text-align: center;
  }

  .talents-canvas-frame {
    min-height: 260px;
  }

  .talents-canvas {
    padding: 14px 10px 20px;
  }

  .talents-management-modal .talents-canvas--teacher-customize {
    padding-top: 48px;
  }

  .talents-max-points-inline {
    flex-wrap: wrap;
    max-width: calc(100vw - 72px);
    font-size: 0.68rem;
  }

  /* Stack tier badge above slots so nodes fit narrow screens */
  .talents-tier-row-display {
    flex-direction: column;
    align-items: stretch;
    min-height: auto;
    gap: 8px;
    margin-bottom: 18px;
  }

  .talents-tier-row-display__head {
    position: static;
    transform: none;
    width: auto;
    justify-content: center;
  }

  .talents-tier-row-display--add-tier {
    padding-left: 0;
    justify-content: center;
  }

  .talents-tier-slots-row {
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
  }

  .talents-tier-slots {
    gap: 10px 12px;
  }

  .talents-node,
  .talents-node-spacer {
    width: 56px;
    height: 56px;
  }

  .talents-node-icon i {
    font-size: 1.1rem;
  }

  .talents-node-tooltip {
    min-width: min(220px, calc(100vw - 32px));
    max-width: min(280px, calc(100vw - 32px));
  }

  /* Talent editor sheet */
  .talents-talent-editor {
    height: auto;
    max-height: none;
    flex: 1;
    min-height: 0;
  }

  .talents-talent-editor-header {
    flex-wrap: wrap;
    gap: 8px;
    padding: 10px 12px;
  }

  .talents-talent-editor-header h3 {
    order: 3;
    flex: 1 1 100%;
    white-space: normal;
    font-size: 0.92rem;
  }

  .talents-talent-editor-header-actions {
    flex: 1 1 100%;
    justify-content: stretch;
  }

  .talents-talent-editor-header-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }

  .talents-talent-editor-body {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .talents-talent-editor-meta {
    max-height: none;
    padding: 12px;
  }

  .talents-talent-editor-effects {
    padding: 12px;
  }

  .talent-spell-picker-grid {
    grid-template-columns: 1fr;
    max-height: 220px;
  }

  .talents-icon-grid {
    --talent-icon-cell: 40px;
    grid-template-columns: repeat(5, var(--talent-icon-cell));
    max-height: calc(var(--talent-icon-cell) * 4 + 6px * 3 + 12px);
  }

  .talents-icon-preview {
    width: 56px;
    height: 56px;
  }

  /* Student talent overlay */
  .talents-overlay {
    padding: 0;
    align-items: stretch;
    min-height: 100dvh;
  }

  .talents-student-modal {
    width: 100%;
    max-width: none;
    max-height: none;
    height: 100%;
    min-height: 100dvh;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }

  .talents-student-header {
    padding: 12px 14px;
    padding-top: max(12px, env(safe-area-inset-top));
  }

  .talents-student-header h2 {
    font-size: 1rem;
  }

  .talents-student-header__tagline {
    font-size: 0.72rem;
  }

  .talents-student-hud {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 8px 10px;
    padding: 10px 12px;
  }

  .talents-student-stat--available {
    grid-column: 1;
  }

  .talents-student-progress {
    grid-column: 2;
    flex: none;
    min-width: 0;
    width: auto;
  }

  .talents-student-respec-btn {
    grid-column: 1 / -1;
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .talents-student-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    padding: 10px 12px max(14px, env(safe-area-inset-bottom));
  }

  .talents-student-tree-viewport {
    min-height: 260px;
  }

  .talents-canvas--student-content .talents-node,
  .talents-canvas--student-content .talents-node-spacer {
    width: 58px;
    height: 58px;
  }
}

@media (max-width: 640px) {
  .talent-potency-effect-row {
    grid-template-columns: 1fr;
  }

  .talent-potency-effect-controls,
  .talent-effects-builder .effect-config-value-row {
    grid-template-columns: 1fr;
  }

  .talents-tier-card .form-group,
  .talents-field--inline,
  .talents-effect-row__fields {
    grid-template-columns: 1fr;
  }

  .talents-editor-actions {
    grid-template-columns: 1fr;
  }

  .talents-node,
  .talents-node-spacer {
    width: 50px;
    height: 50px;
  }

  .talents-canvas--student-content .talents-node,
  .talents-canvas--student-content .talents-node-spacer {
    width: 56px;
    height: 56px;
  }

  .talents-tier-slots {
    gap: 8px 10px;
  }

  .talents-talent-editor-header .btn[data-back-to-tree] {
    flex: 1 1 100%;
    justify-content: center;
  }

  .talents-talent-editor-header-actions {
    flex-direction: column;
  }
}
