/* Planejador do mapa de talentos: o mapa imita a aba Saber do jogo (Game/UI/TalentMapView.cs, Game.uss → .rf-tmap*). */

.planner-page { min-height: 100vh; display: flex; flex-direction: column; }
.planner-title { font-size: 1.25rem; margin: 0; color: var(--gold); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); }

.planner {
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  grid-template-rows: minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 64px);
  min-height: 560px;
}

.map-wrap { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.tools { display: flex; gap: 6px; flex-wrap: wrap; }
.search { position: relative; flex: 1 1 220px; max-width: 420px; }
.search input { width: 100%; }
.results {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px; list-style: none;
  max-height: 320px; overflow: auto; background: var(--parchment); color: var(--text-dark); border: 3px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow);
}
.results li { padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.results li[aria-selected="true"], .results li:hover { background: var(--parchment-dark); }
.results .dot { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid var(--border); }
.results small { color: #6b4a2a; margin-left: auto; white-space: nowrap; }

.map {
  position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; cursor: grab;
  background: radial-gradient(ellipse at center, #3d2716 0%, var(--panel-dark) 55%, #241509 100%);
  border: 4px solid var(--border); border-radius: var(--radius);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.55), var(--shadow);
  user-select: none; -webkit-user-select: none;
}
.map.dragging { cursor: grabbing; }
.map:focus-visible { outline-offset: -4px; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; --z: 1; }
.under { position: absolute; left: 0; top: 0; overflow: visible; }
.nodes { position: absolute; left: 0; top: 0; }

.wedge { opacity: 0.1; }
.wedge.tavern { fill: var(--tavern); }
.wedge.combat { fill: var(--combat); }
.wedge.workshop { fill: var(--workshop); }
.divider { stroke: var(--border); stroke-width: 4; opacity: 0.8; }
.cluster { fill: rgba(255, 240, 210, 0.05); stroke: rgba(255, 240, 210, 0.1); stroke-width: 2; }
.cluster.lit { fill: rgba(255, 240, 210, 0.1); }

.edge { stroke-linecap: round; fill: none; }
.edge.locked { stroke: var(--text-muted); stroke-width: 4; opacity: 0.3; }
.edge.open { stroke: var(--success); stroke-width: 5; opacity: 0.85; }
.edge.learned { stroke: var(--gold); stroke-width: 8; }
.edge.path { stroke: #fff; stroke-width: 7; opacity: 0.95; stroke-dasharray: 14 10; }
.dim .edge { opacity: 0.12; }
.dim .edge.path { opacity: 0.95; }

.hub {
  position: absolute; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  background: var(--panel); border: 4px solid var(--accent); box-shadow: 0 0 0 6px rgba(240, 180, 69, 0.18), 0 6px 0 rgba(0, 0, 0, 0.35);
}
.hub img { width: 54px; height: 54px; }

.sector-title {
  position: absolute; transform: translate(-50%, -50%); text-align: center; pointer-events: none; white-space: nowrap;
  font: 400 calc(30px / var(--z)) var(--font-title); text-shadow: 0 3px 0 rgba(0, 0, 0, 0.5);
  padding: 2px 14px 4px; border-radius: 10px; background: rgba(15, 9, 4, 0.55);
}
.sector-title small { display: block; font: 600 calc(14px / var(--z)) var(--font-body); color: var(--text); }
.sector-title.tavern { color: var(--tavern); }
.sector-title.combat { color: var(--combat); }
.sector-title.workshop { color: var(--workshop); }

/* ------------------------------------------------ nós */

.node {
  position: absolute; padding: 0; margin: 0; display: grid; place-items: center;
  background: #2c1b0f; border: 3px solid var(--c, var(--text-muted)); border-radius: 50%;
  color: var(--text); cursor: pointer; transition: transform 0.15s, opacity 0.2s, box-shadow 0.2s, background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.node.tavern { --c: var(--tavern); }
.node.combat { --c: var(--combat); }
.node.workshop { --c: var(--workshop); }
.node.k-key { border-width: 4px; }
.node.k-automation { border-radius: 10px; }
.node.k-bridge { border-width: 6px; border-color: var(--c) var(--c2) var(--c2) var(--c); }
.node.k-notable, .node.k-keystone { border-radius: 6px; transform: rotate(45deg); }
.node.k-keystone { border-width: 6px; box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.45); }
.node.k-notable > *, .node.k-keystone > * { transform: rotate(-45deg); }
.node img { width: var(--icon); height: var(--icon); pointer-events: none; image-rendering: auto; }
.node .glyph {
  width: var(--icon); height: var(--icon); background-color: var(--text); pointer-events: none;
  -webkit-mask: var(--mask) center / contain no-repeat; mask: var(--mask) center / contain no-repeat;
}

.node.locked { opacity: 0.62; border-color: color-mix(in srgb, var(--c) 55%, #000); }
.node.locked img { filter: grayscale(0.65) brightness(0.7); }
.node.locked .glyph { background-color: var(--text-muted); }
.node.available { box-shadow: 0 0 0 4px rgba(134, 184, 75, 0.85), 0 0 18px 4px rgba(134, 184, 75, 0.45); }
.node.k-keystone.available { box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.45), 0 0 0 8px rgba(134, 184, 75, 0.85); }
.node.learned { background: var(--c); border-color: #fff8e0; }
.node.learned .glyph { background-color: var(--text-dark); }
.node.learned::after {
  content: "✓"; position: absolute; right: -6px; bottom: -6px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font: 700 14px/1 var(--font-body); color: var(--text-dark); background: var(--success); border: 2px solid var(--border);
}
.node.k-notable.learned::after, .node.k-keystone.learned::after { right: 50%; bottom: -16px; transform: translateX(50%) rotate(-45deg); }
.node.excluded { opacity: 0.35; }
/* Daria para aprender, mas o rank não tem mais vaga (a árvore nunca se completa). */
.node.full { opacity: 0.7; border-style: dashed; }
.node.in-path { box-shadow: 0 0 0 5px #fff, 0 0 22px 6px rgba(255, 255, 255, 0.5); opacity: 1; }
.node.hit { box-shadow: 0 0 0 5px var(--gold), 0 0 24px 8px rgba(246, 197, 68, 0.7); opacity: 1; }
.dim .node:not(.hit):not(.in-path):not(.learned) { opacity: 0.25; }
.node:hover, .node:focus-visible { z-index: 5; filter: brightness(1.15); }
.node:focus-visible { outline: 4px solid #fff; outline-offset: 4px; }

.label {
  position: absolute; transform: translate(-50%, 0); pointer-events: none; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis;
  font: 600 calc(13px / var(--z)) var(--font-body); color: var(--text); padding: 1px 7px 2px; border-radius: 6px;
  background: rgba(20, 12, 5, 0.78); border: 1px solid rgba(255, 255, 255, 0.12);
}
.world.far .label { display: none; }
.dim .label { opacity: 0.35; }
.label.hit { opacity: 1; color: var(--gold); }

.zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; }
.zoom .btn { width: 44px; padding: 0; font-size: 1.3rem; }
.map-hint {
  position: absolute; left: 10px; bottom: 10px; right: 70px; margin: 0; pointer-events: none; font-size: 0.85rem; color: var(--text-muted);
  text-shadow: 0 1px 2px #000;
}

/* ------------------------------------------------ cartão do nó */

.card {
  position: absolute; z-index: 20; width: min(360px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto;
  padding: 12px 14px; font-size: 0.92rem; line-height: 1.45; pointer-events: auto;
}
.card h3 { font-size: 1.25rem; margin: 0 0 2px; color: #4a240d; }
.card .kind { font-weight: 600; color: #7a4a22; font-size: 0.85rem; }
.card .row { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin: 4px 0; }
.card .chip { display: inline-block; padding: 1px 8px; border-radius: 999px; background: rgba(43, 26, 14, 0.12); border: 1px solid rgba(43, 26, 14, 0.25); font-size: 0.82rem; }
.card .chip.ok { background: #cfe3a8; }
.card .chip.no { background: #f2c2b4; }
.card .eff { margin: 2px 0; padding-left: 14px; position: relative; font-weight: 500; }
.card .eff::before { content: "◆"; position: absolute; left: 0; font-size: 0.7em; top: 0.35em; color: #8a3b1c; }
.card .label-line { font-weight: 700; color: #6b2f12; }
.card .missing { color: #8a1f12; margin: 0 0 0 10px; }
.card .hint { margin-top: 8px; font-style: italic; color: #5a3a1a; }
.card .actions { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }
.card .close { position: absolute; right: 6px; top: 6px; background: transparent; border: 0; font-size: 1.4rem; line-height: 1; color: #4a240d; cursor: pointer; min-width: 36px; min-height: 36px; }
.card .world-note { font-size: 0.85rem; color: #5a3a1a; border-top: 1px dashed rgba(43, 26, 14, 0.35); margin-top: 8px; padding-top: 6px; }

.toast {
  position: absolute; z-index: 25; left: 50%; bottom: 64px; transform: translateX(-50%); max-width: min(520px, calc(100% - 24px));
  background: var(--parchment); color: var(--text-dark); border: 3px solid var(--border); border-radius: 12px; padding: 8px 12px;
  box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; font-size: 0.92rem;
}
.toast.error { background: #f2c2b4; }

.banner {
  margin: 12px 12px 0; padding: 10px 14px; border: 3px solid var(--border); border-radius: 12px; background: #f2d27a; color: var(--text-dark);
}
.banner button { margin-left: 8px; }

/* ------------------------------------------------ resumo */

.side { overflow: auto; padding: 12px 14px; min-height: 0; }
.side h2 { font-size: 1.3rem; color: var(--gold); text-shadow: 0 2px 0 rgba(0, 0, 0, 0.4); margin-bottom: 8px; }
.block { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 2px dashed rgba(201, 167, 122, 0.35); }
.block:last-child { border-bottom: 0; }
.points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 8px; }
.pt {
  border: 3px solid var(--border); border-radius: 10px; padding: 6px 6px 4px; text-align: center; background: rgba(0, 0, 0, 0.25);
  border-top-color: var(--c);
}
.pt.tavern { --c: var(--tavern); } .pt.combat { --c: var(--combat); } .pt.workshop { --c: var(--workshop); }
.pt b { display: block; font: 400 1.6rem/1.1 var(--font-title); color: var(--c); }
.pt span { font-size: 0.8rem; color: var(--text-muted); }
.pt small { display: block; font-size: 0.75rem; color: var(--text-muted); }
.check { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; margin: 6px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--gold); }
.rank-row { display: flex; gap: 10px; align-items: center; margin: 8px 0; }
.needs { font-size: 0.9rem; color: var(--text-muted); margin: 4px 0 8px; }
.needs b { color: var(--gold); }
.needs .over { color: var(--danger, #e06a5a); font-weight: 700; }
.rings table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.rings th, .rings td { padding: 4px 4px; text-align: center; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.rings th { color: var(--text-muted); font-weight: 600; }
.rings td.tavern { color: var(--tavern); } .rings td.combat { color: var(--combat); } .rings td.workshop { color: var(--workshop); }
.rings th[scope="row"] { text-align: left; }

.share-row { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.share-row input { flex: 1 1 160px; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 0.85rem; }

.effects h3 { font: 600 0.95rem var(--font-body); color: var(--gold); margin: 10px 0 4px; text-transform: uppercase; letter-spacing: 0.06em; }
.effects ul { margin: 0; padding: 0; list-style: none; }
.effects li { padding: 3px 0 3px 18px; position: relative; font-size: 0.92rem; }
.effects li::before { content: ""; position: absolute; left: 2px; top: 0.75em; width: 8px; height: 8px; border-radius: 2px; transform: rotate(45deg); background: var(--c, var(--text-muted)); }
.effects li.tavern { --c: var(--tavern); } .effects li.combat { --c: var(--combat); } .effects li.workshop { --c: var(--workshop); }
.effects li button { all: unset; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.effects li button:focus-visible { outline: 2px solid var(--gold); }
.effects .num { color: var(--gold); font-weight: 600; }
.effects .muted { color: var(--text-muted); font-size: 0.85rem; }
.empty { color: var(--text-muted); font-style: italic; }
.help p, .help li { font-size: 0.88rem; color: var(--text-muted); }
.help ul { padding-left: 18px; margin: 0 0 8px; }
.noscript { padding: 16px; }

@media (max-width: 960px) {
  .planner { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; }
  .map-wrap { height: min(78vh, 720px); min-height: 440px; }
  .side { overflow: visible; }
  .planner-title { font-size: 1.05rem; }
  .topbar .brand span { display: none; }
  .card { position: fixed; left: 8px; right: 8px; bottom: 8px; top: auto !important; width: auto; max-height: 55vh; }
  .map-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .node, .world { transition: none !important; }
}
