/* ════════════════════════════════════════════════════════════════
   Icarus talent calculator — the in-game talent screen, rebuilt.
   Loaded AFTER main.css + guide.css on /icarus-talent-calculator/ only.
   ⛔ Override sheet: no :root palette, no reset, no html font ramp.
   The panel is a GAME SCREEN, so it stays dark in both themes, like a terminal
   window does: it uses the fixed --win-* family, never the flipping tokens.
   Node, link and tooltip geometry comes from the game's own talent positions and sizes,
   laid out in % of each tree's canvas by assets/js/icarus-talents.js.
   ⭐ THE TIGHT LOOK (his call 2026-10-03, an experiment): square corners, 1px rules,
   small uppercase labels, no pill shapes. A dense tool reads clearer squared off;
   if it earns its keep it moves into shared CSS for every dense tool, not page by page.
   ════════════════════════════════════════════════════════════════ */

.ict {
  --ict-ground: var(--win-bg);
  --ict-bar: var(--win-bar);
  --ict-line: var(--win-bar-line);
  --ict-cell: #12161a;
  --ict-ink: #e6e9ec;
  --ict-muted: #a9b3be;         /* a step above --win-title: the small labels read grey at 0.66rem */
  --ict-off: #3a414a;          /* a line or frame nothing reaches yet */
  --ict-open: #cfd5dc;         /* reachable, not taken */
  --ict-on: var(--orange);     /* taken */
  --ict-path: #4fb3ff;         /* the lit way to a locked talent */
  position: relative;
  background: var(--ict-ground);
  color: var(--ict-ink);
  border: 1px solid var(--ict-line);
  border-radius: 0;
  margin: 0 0 1.4rem;
  font-size: 0.84rem;
  line-height: 1.4;
  -webkit-user-select: none;
  user-select: none;
}
.ict *, .ict *::before, .ict *::after { border-radius: 0; }
.ict-loading { padding: 2rem 1.2rem; color: var(--ict-muted); }
.ict-label, .ict-stat > span, .ict-crepick > span, .ict-bonus > summary {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ict-muted);
}

/* ── row 1: player tabs · creature pickers ───────────────────────── */
.ict-bar {
  display: flex; flex-wrap: wrap; align-items: stretch; gap: 0;
  background: var(--ict-bar); border-bottom: 1px solid var(--ict-line);
}
.ict-cats { display: flex; flex-wrap: wrap; flex: 1 1 auto; }
.ict-cat, .ict-treetab {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: transparent; color: var(--ict-muted);
  border: 0; border-right: 1px solid var(--ict-line); border-bottom: 2px solid transparent;
  padding: 0.6rem 0.85rem; font: inherit; font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer;
}
.ict-cat img { width: 1.05rem; height: 1.05rem; object-fit: contain; opacity: 0.65; }
.ict-cat:hover, .ict-treetab:hover { color: var(--ict-ink); background: rgba(255,255,255,0.03); }
.ict-cat[aria-selected="true"], .ict-treetab[aria-selected="true"] {
  color: var(--ict-on); border-bottom-color: var(--ict-on);
  background: color-mix(in srgb, var(--ict-on) 9%, transparent);
}
.ict-cat[aria-selected="true"] img { opacity: 1; }
.ict-n {
  font-size: 0.66rem; letter-spacing: 0; padding: 0 0.3rem; margin-left: 0.3rem;
  background: var(--ict-path); color: #071018; font-weight: 800;
}
.ict-cres { display: flex; flex-wrap: wrap; border-left: 1px solid var(--ict-line); }
.ict-crepick {
  display: flex; flex-direction: column; justify-content: center; gap: 0.15rem;
  padding: 0.3rem 0.6rem; border-right: 1px solid var(--ict-line); border-bottom: 2px solid transparent; cursor: pointer;
}
.ict-crepick:last-child { border-right: 0; }
.ict-crepick.is-cur { border-bottom-color: var(--ict-on); background: color-mix(in srgb, var(--ict-on) 9%, transparent); }
.ict-crepick.is-cur > span { color: var(--ict-on); }
.ict select, .ict input[type="number"], .ict-search, .ict textarea {
  background: var(--ict-cell); color: var(--ict-ink); border: 1px solid var(--ict-line);
  font: inherit; font-size: 0.84rem; padding: 0.25rem 0.45rem;
}
.ict select { min-width: 8.5rem; cursor: pointer; }
.ict select:focus, .ict input:focus, .ict textarea:focus { outline: 1px solid var(--ict-on); outline-offset: 0; border-color: var(--ict-on); }

/* ── row 2: the numbers ──────────────────────────────────────────── */
.ict-stats { display: flex; flex-wrap: wrap; align-items: stretch; border-bottom: 1px solid var(--ict-line); }
.ict-stat {
  display: flex; flex-direction: column; justify-content: center; gap: 0.1rem;
  padding: 0.35rem 0.75rem; min-width: 7.5rem; border-right: 1px solid var(--ict-line);
}
.ict-stat b { font-size: 1rem; font-weight: 800; color: var(--ict-ink); font-variant-numeric: tabular-nums; }
.ict-stat b i { font-style: normal; color: var(--ict-on); }
.ict-stat b i.is-over { color: var(--red); }
.ict-stat.is-cur { background: color-mix(in srgb, var(--ict-on) 7%, transparent); }
.ict-stat.is-cur > span { color: var(--ict-on); }
.ict-stat-in input { width: 4.2rem; font-size: 0.95rem; font-weight: 700; padding: 0.1rem 0.35rem; }
.ict-stat-cre { display: none; }
.ict.is-creature .ict-stat-cre { display: flex; }
.ict-bonus { flex: 1 1 18rem; padding: 0.35rem 0.75rem; align-self: center; }
.ict-bonus > summary { cursor: pointer; list-style: none; display: inline-flex; gap: 0.4rem; align-items: center; }
.ict-bonus > summary::-webkit-details-marker { display: none; }
.ict-bonus > summary::before { content: "+"; width: 0.9rem; text-align: center; border: 1px solid var(--ict-line); color: var(--ict-ink); line-height: 0.9rem; }
.ict-bonus[open] > summary::before { content: "−"; }
.ict-bonus > summary b { color: var(--ict-on); letter-spacing: 0; }
.ict-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.4rem; }
.ict-chip {
  display: inline-flex; align-items: center; gap: 0.35rem; cursor: pointer;
  border: 1px solid var(--ict-line); background: var(--ict-cell); padding: 0.2rem 0.45rem;
}
.ict-chip input { margin: 0; accent-color: var(--ict-on); }
.ict-chip i { font-style: normal; color: var(--ict-muted); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; }
.ict-chip b { color: var(--ict-muted); font-weight: 700; }
.ict-chip:has(input:checked) { border-color: var(--ict-on); }
.ict-chip:has(input:checked) b { color: var(--ict-on); }

/* ── row 3: search · saves · share ───────────────────────────────── */
.ict-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0.4rem 0.6rem; border-bottom: 1px solid var(--ict-line); }
.ict-search { flex: 1 1 12rem; min-width: 0; max-width: 22rem; }
.ict-search::placeholder { color: var(--ict-muted); }
.ict-saves { display: inline-flex; gap: 0; }
.ict-saves select { border-right: 0; min-width: 10rem; }
.ict-saves select.is-clean { color: var(--status-ok); }
.ict-saves select.is-dirty { color: #e6c35c; }
.ict-saves .ict-btn + .ict-btn { border-left: 0; }
.ict-btn {
  background: var(--ict-cell); color: var(--ict-ink); border: 1px solid var(--ict-line);
  padding: 0.28rem 0.65rem; font: inherit; font-size: 0.76rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; cursor: pointer; white-space: nowrap;
}
.ict-btn:hover { border-color: var(--ict-on); color: var(--ict-on); }
.ict-btn-on { background: var(--ict-path); border-color: var(--ict-path); color: #071018; }
.ict-btn-on:hover { color: #071018; filter: brightness(1.1); }
.ict-io { display: grid; gap: 0.35rem; padding: 0.45rem 0.6rem; border-bottom: 1px solid var(--ict-line); }
.ict-io[hidden] { display: none; }
.ict-io textarea { width: 100%; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 0.72rem; -webkit-user-select: text; user-select: text; }
.ict-io div { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.ict-io-msg { color: var(--ict-muted); }
.ict-hint { margin: 0; padding: 0.35rem 0.6rem 0; color: var(--ict-muted); font-size: 0.78rem; }

/* ── the trees ───────────────────────────────────────────────────── */
.ict-treetabs { display: none; flex-wrap: wrap; padding: 0.4rem 0.6rem 0; }
.ict-treetab { border: 1px solid var(--ict-line); border-bottom-width: 2px; margin: 0 -1px 0 0; padding: 0.35rem 0.6rem; }
.ict.is-narrow .ict-treetabs { display: flex; }
.ict-trees { display: flex; justify-content: center; align-items: flex-start; gap: 0.75rem; padding: 0.6rem; }
.ict-tree { flex: 0 0 auto; min-width: 0; }   /* width set by icarus-talents.js: one scale for every tab */
.ict.is-narrow .ict-tree:not(.is-shown) { display: none; }
.ict.is-narrow.is-creature .ict-tree { display: block; }

.ict-tree-h { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.4rem; margin: 0 0 0.4rem; }
.ict-tree-h img { width: 1.4rem; height: 1.4rem; object-fit: contain; }
.ict-tree-h .ict-tier-next { opacity: 0.35; }
.ict-tree-title { min-width: 0; text-align: center; }
.ict-tree-h h3 {
  margin: 0; padding: 0.22rem 0.4rem; background: var(--ict-bar); border: 1px solid var(--ict-line);
  font-size: 0.72rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ict-ink); font-family: 'Manrope', sans-serif;
}
.ict-tree-h h3 small { color: var(--ict-on); font-size: 0.72rem; letter-spacing: 0; margin-left: 0.35rem; }
.ict-cre-h { grid-template-columns: 1fr; }
.ict-cre-h h3 { text-align: left; }
.ict-cre-h h3 small { color: var(--ict-muted); text-transform: none; font-weight: 600; }
.ict-rankbar { height: 4px; background: var(--ict-off); margin-top: 2px; position: relative; }
.ict-rankbar i { position: absolute; inset: 0 auto 0 0; background: var(--ict-on); }

/* a creature: the tree beside its bloodline list */
.ict-trees.is-creature { display: grid; grid-template-columns: minmax(0, 38rem) minmax(16rem, 28rem); justify-content: center; align-items: start; }
.ict-cre-tree { width: 100%; }

.ict-canvas {
  position: relative; width: 100%; container-type: inline-size;
  background-size: cover; background-position: center top;
  background-color: rgba(0,0,0,0.18); border: 1px solid var(--ict-line);
}
.ict-canvas::before { content: ""; position: absolute; inset: 0; background: rgba(12,15,18,0.62); pointer-events: none; }
.ict-canvas.is-creature { background-size: 92% auto; background-position: center; background-repeat: no-repeat; background-color: #0e1215; }
.ict-canvas.is-creature::before { background: rgba(12,15,18,0.55); }
.ict-links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.ict-links path { fill: none; stroke: var(--ict-off); stroke-width: 2; vector-effect: non-scaling-stroke; }
.ict-links path.is-open { stroke: var(--ict-open); }
.ict-links path.is-on { stroke: var(--ict-on); stroke-width: 3; }
.ict-links path.is-path { stroke: var(--ict-path); stroke-width: 3; stroke-dasharray: 6 4; }

.ict-node {
  position: absolute; aspect-ratio: 1; padding: 0; margin: 0;
  background: #0c0f12; border: 2px solid var(--ict-off);
  cursor: pointer; font: inherit; color: inherit;
}
.ict-node img.ict-icon { width: 100%; height: 100%; object-fit: contain; display: block; filter: grayscale(1) brightness(0.45); }
.ict-node.is-open { border-color: var(--ict-open); }
.ict-node.is-open img.ict-icon, .ict-node.is-on img.ict-icon, .ict-node.is-path img.ict-icon { filter: none; }
.ict-node.is-on { border-color: var(--ict-on); box-shadow: 0 0 0 1px var(--ict-on), 0 0 10px color-mix(in srgb, var(--ict-on) 40%, transparent); }
.ict-node.is-path { border-color: var(--ict-path); box-shadow: 0 0 0 1px var(--ict-path), 0 0 10px color-mix(in srgb, var(--ict-path) 45%, transparent); }
.ict-node.is-free { cursor: default; }
.ict-node:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.ict-node .ict-rank {
  position: absolute; left: -12%; top: -24%;
  padding: 0 0.3em; min-width: 2.6em; text-align: center;
  font-size: clamp(0.5rem, 2.6cqw, 0.78rem); line-height: 1.45; font-weight: 700;
  background: #111519; color: var(--ict-muted); border: 1px solid var(--ict-off);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.ict-node.is-open .ict-rank { color: var(--ict-ink); border-color: var(--ict-open); }
.ict-node.is-on .ict-rank { background: var(--ict-on); color: #111; border-color: var(--ict-on); }
.ict-node.is-path .ict-rank { background: var(--ict-path); color: #071018; border-color: var(--ict-path); }
.ict-node .ict-tier { position: absolute; right: -16%; top: -18%; width: 36%; height: 36%; object-fit: contain; background: #111519; }
.ict-node.is-hit { outline: 3px solid var(--ict-path); outline-offset: 3px; }
.ict-trees.is-searching .ict-node:not(.is-hit) { opacity: 0.28; }

/* bloodlines */
.ict-lins { border: 1px solid var(--ict-line); background: var(--ict-cell); }
.ict-lins h4 {
  margin: 0; padding: 0.4rem 0.55rem; border-bottom: 1px solid var(--ict-line); background: var(--ict-bar);
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ict-ink); font-family: 'Manrope', sans-serif;
}
.ict-lins h4 small { color: var(--ict-muted); letter-spacing: 0; text-transform: none; font-weight: 600; margin-left: 0.3rem; }
.ict-lin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(12.5rem, 1fr)); gap: 1px; background: var(--ict-line); }
.ict-lin {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-content: start; column-gap: 0.4rem; width: 100%; text-align: left;
  background: var(--ict-cell); color: var(--ict-ink); border: 0; border-left: 3px solid transparent;
  padding: 0.35rem 0.55rem; font: inherit; font-size: 0.8rem; cursor: pointer;
}
.ict-lin:hover { background: #171c21; }
.ict-lin b { color: var(--ict-on); font-size: 0.76rem; letter-spacing: 0.08em; text-transform: uppercase; }
.ict-lin em { font-style: normal; color: var(--ict-muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; }
.ict-lin span { grid-column: 1 / -1; }
.ict-lin .ict-lin-fx { color: #c3cbd3; }
.ict-lin .ict-lin-gr { color: var(--ict-ink); }
.ict-lin.is-sel { border-left-color: var(--ict-on); background: color-mix(in srgb, var(--ict-on) 10%, transparent); }

/* ── the tooltip (hover) / card (tap) ────────────────────────────── */
.ict-tip {
  position: absolute; z-index: 20; width: min(21rem, calc(100% - 1rem));
  background: #0b0e11; border: 1px solid var(--ict-line); box-shadow: 0 8px 28px rgba(0,0,0,0.55);
  color: var(--ict-ink); pointer-events: auto;
}
.ict-tip[hidden] { display: none; }
.ict-tip h4 {
  margin: 0; padding: 0.45rem 0.7rem; text-align: center; font-family: 'Manrope', sans-serif;
  font-size: 0.86rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ict-on);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ict-on) 22%, #0b0e11), #0b0e11);
  border-bottom: 1px solid var(--ict-on);
}
.ict-tip-body { padding: 0.5rem 0.7rem 0.6rem; }
.ict-tip p { margin: 0 0 0.45rem; text-align: center; }
.ict-tip .ict-req { color: var(--ict-muted); font-size: 0.72rem; text-align: center; }
.ict-tip .ict-req.is-unmet { color: var(--red); }
.ict-path { border: 1px solid var(--ict-path); background: color-mix(in srgb, var(--ict-path) 10%, transparent); padding: 0.4rem 0.5rem; margin: 0.2rem 0 0.4rem; text-align: center; }
.ict-path p { margin: 0 0 0.35rem; font-size: 0.74rem; }
.ict-path b { color: var(--ict-path); }
.ict-tip ol { list-style: none; margin: 0.35rem 0 0.15rem; padding: 0.35rem 0 0; border-top: 1px solid var(--ict-line); }
.ict-tip li { color: var(--ict-muted); padding: 0.08rem 0; }
.ict-tip li b { color: var(--ict-ink); font-weight: 600; margin-right: 0.35rem; }
.ict-tip li.is-now { color: var(--ict-ink); }
.ict-tip li.is-now b { color: var(--ict-on); }
.ict-tip-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.45rem 0.7rem 0.55rem; border-top: 1px solid var(--ict-line); color: var(--ict-muted); font-size: 0.7rem; }
.ict-tip-foot button { min-width: 2.2rem; }
.ict-tip-foot .ict-btn[disabled] { opacity: 0.35; cursor: default; border-color: var(--ict-line); color: var(--ict-muted); }

/* ── effects + your build: a card in the rail, so it wears the page theme, not the game panel ── */
.ict-rail-build { font-size: 0.8rem; }
.ict-rail-build h5 { font-family: 'Manrope', sans-serif; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin: 0.6rem 0 0.2rem; }
.ict-rail-build .ict-empty { margin: 0.2rem 0; color: var(--text-muted); }
.ict-fx-note { margin: 0 0 0.4rem; color: var(--text-muted); font-size: 0.74rem; }
.ict-fx-solo { display: flex; gap: 0.4rem; align-items: center; margin: 0 0 0.45rem; color: var(--text-muted); font-size: 0.74rem; cursor: pointer; }
.ict-fx-solo input { accent-color: var(--orange); margin: 0; }
.ict-fx { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.ict-fx li { padding: 0.18rem 0; border-bottom: 1px solid var(--border); color: var(--text); font-variant-numeric: tabular-nums; }
.ict-fx-u li { color: var(--text-muted); }
.ict-sum { margin-top: 0.7rem; border-top: 1px solid var(--border); padding-top: 0.4rem; }
.ict-sum > summary { cursor: pointer; font-family: 'Manrope', sans-serif; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--orange-ink); }
.ict-sum-tree { margin: 0.45rem 0 0; }
.ict-sum-tree h5 { margin: 0 0 0.15rem; }
.ict-sum-tree h5 button { background: none; border: 0; padding: 0; font: inherit; color: var(--orange-ink); cursor: pointer; text-transform: inherit; letter-spacing: inherit; }
.ict-sum-tree h5 button:hover { text-decoration: underline; }
.ict-rail-build ul:not(.ict-fx) { list-style: none; margin: 0; padding: 0; }
.ict-sum-tree li { display: grid; grid-template-columns: 1.35rem minmax(0, 1fr); gap: 0.4rem; align-items: center; padding: 0.08rem 0; color: var(--text); }
.ict-sum-tree li img { width: 1.35rem; height: 1.35rem; object-fit: contain; background: var(--win-bg); }
.ict-sum-tree li b { color: var(--text-muted); font-weight: 600; }

/* ── the crawlable reference under the tool (plain page theme) ───── */
.ict-ref-tree { border-top: 1px solid var(--border); padding: 0.45rem 0; }
.ict-ref-tree > summary { cursor: pointer; font-weight: 700; padding: 0.2rem 0; }
.ict-ref-tree > summary span { color: var(--text-muted); font-weight: 600; margin-left: 0.4rem; }
.ict-ref-tree .ict-ref-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(24rem, 100%), 1fr)); gap: 0.55rem 1.1rem; }
.ict-ref-list li { display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 0.6rem; align-items: start; }
.ict-ref-list img { width: 48px; height: 48px; object-fit: contain; background: var(--win-bg); border-radius: 4px; }
.ict-ref-list strong { display: block; }
.ict-ref-list .ict-ref-meta { color: var(--text-muted); font-size: 0.85em; }
.ict-ref-h { margin: 1.1rem 0 0.2rem; font-size: 1rem; }

@media (max-width: 900px) {
  .ict-trees.is-creature { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .ict-cres { border-left: 0; border-top: 1px solid var(--ict-line); width: 100%; }
  .ict-crepick { flex: 1 1 0; min-width: 0; }
  .ict select { min-width: 0; width: 100%; }
  .ict-stat { min-width: 0; flex: 1 1 33%; padding: 0.3rem 0.5rem; }
  .ict-hint { display: none; }
  .ict-trees { padding: 0.45rem; }
  .ict-saves select { min-width: 0; }
}
