/* ===== Outriders Worldslayer — Technomancer planner theme ===== */
:root {
  --bg: #0a0b0d;
  --bg-panel: #131419;
  --bg-panel-2: #1a1c23;
  --bg-elev: #20232c;
  --line: #2b2f3a;
  --line-soft: #23262f;
  --txt: #d7dae0;
  --txt-dim: #8d93a0;
  --txt-faint: #5d626e;
  --accent: #e8a33d;      /* amber — Worldslayer gold */
  --accent-2: #f0c070;
  --tech: #5bd6c9;        /* technomancer teal */
  --legendary: #d8762a;   /* legendary orange */
  --good: #6fcf6f;
  --bad: #e0625a;
  --t1: #6f86d6;
  --t2: #c06fd6;
  --t3: #e8a33d;
  --radius: 4px;
  --shadow: 0 4px 18px rgba(0,0,0,.55);
}

* { box-sizing: border-box; scrollbar-width: thin; scrollbar-color: #3a3f4d transparent; }
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2f3441; border-radius: 5px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); background-clip: content-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(232,163,61,.06), transparent 60%),
    radial-gradient(900px 500px at 0% 100%, rgba(91,214,201,.05), transparent 55%),
    var(--bg);
  color: var(--txt);
  font-family: "Segoe UI", "Inter", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  min-height: 100vh;
}

#app { max-width: 1600px; margin: 0 auto; padding: 0 18px 40px; }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 4px 16px; border-bottom: 1px solid var(--line);
}
.brand { display: flex; flex-direction: column; line-height: 1.05; }
.brand-class {
  font-size: 26px; font-weight: 800; letter-spacing: .14em;
  color: var(--tech); text-shadow: 0 0 18px rgba(91,214,201,.35);
}
.brand-sub { font-size: 12px; letter-spacing: .25em; color: var(--txt-faint); text-transform: uppercase; }
.topbar-actions { display: flex; gap: 10px; }

.class-switch { display: flex; gap: 4px; flex-wrap: wrap; }
.class-btn {
  font: inherit; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: 8px 13px; cursor: pointer; border-radius: var(--radius);
  background: var(--bg-panel); color: var(--txt-dim); border: 1px solid var(--line-soft);
  transition: .14s;
}
.class-btn:hover { color: var(--txt); border-color: var(--line); }
.class-btn.active { color: #fff; border-color: var(--tech); background: var(--bg-elev); box-shadow: inset 0 0 0 1px rgba(91,214,201,.3); }

.btn {
  font: inherit; font-size: 12.5px; font-weight: 600; letter-spacing: .04em;
  padding: 9px 16px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: var(--bg-elev); color: var(--txt);
  transition: .15s; text-transform: uppercase;
}
.btn:hover { border-color: var(--accent); color: #fff; }
.btn-accent { background: linear-gradient(180deg, var(--accent), #c9842a); border-color: #b9791f; color: #1a1206; }
.btn-accent:hover { filter: brightness(1.1); color: #1a1206; }
.btn-ghost { background: transparent; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.btn-ico { width: 14px; height: 14px; margin-right: 7px; flex: 0 0 auto; }

/* feedback nudge (bottom-right) */
.fb-toast { position: fixed; bottom: 18px; right: 18px; max-width: 320px; z-index: 200;
  background: var(--bg-panel); border: 1px solid var(--line); border-left: 3px solid var(--accent);
  border-radius: 8px; padding: 13px 32px 14px 15px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: fb-in .35s ease; }
@keyframes fb-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fb-toast-h { font-size: 13px; font-weight: 700; color: var(--accent-2); margin-bottom: 4px; }
.fb-toast-body { font-size: 12.5px; color: var(--txt-dim); line-height: 1.5; }
.fb-toast-body a { color: var(--accent-2); text-decoration: none; font-weight: 600; }
.fb-toast-body a:hover { text-decoration: underline; }
.fb-close { position: absolute; top: 5px; right: 8px; background: none; border: none; color: var(--txt-faint); font-size: 19px; line-height: 1; cursor: pointer; padding: 2px 4px; }
.fb-close:hover { color: #fff; }
.footnote a { color: var(--accent-2); text-decoration: none; }
.footnote a:hover { text-decoration: underline; }

/* ---- Tabs ---- */
.tabs { display: flex; gap: 2px; margin: 16px 0 18px; flex-wrap: wrap; }
.tab {
  font: inherit; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  font-size: 12.5px; padding: 11px 20px; cursor: pointer;
  background: var(--bg-panel); color: var(--txt-dim);
  border: 1px solid var(--line-soft); border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--txt); }
.tab.is-active { color: var(--accent-2); background: var(--bg-panel-2); border-bottom-color: var(--accent); }

/* ---- Layout ---- */
.layout { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
/* Class Tree tab: give the (wide) tree the full row */
.layout.full-tree { grid-template-columns: minmax(0, 1fr); }
.layout.full-tree .summary { display: none; }
.panel { background: var(--bg-panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 18px; }
.panel.hidden { display: none; }

/* ---- Summary sidebar ---- */
.summary {
  position: sticky; top: 14px;
  background: linear-gradient(180deg, var(--bg-panel-2), var(--bg-panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.summary-title {
  margin: 0 0 12px; font-size: 13px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); border-bottom: 1px solid var(--line); padding-bottom: 10px;
}
.sum-section { margin-bottom: 16px; }
.sum-section h3 {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--txt-faint); margin: 0 0 7px;
}
.budget-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.budget-row b { color: var(--tech); font-variant-numeric: tabular-nums; }
.stat-line { display: flex; justify-content: space-between; font-size: 12.5px; padding: 2px 0; border-bottom: 1px dashed var(--line-soft); }
.stat-line .v { color: var(--accent-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-list { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  font-size: 11px; padding: 3px 8px; border-radius: 3px;
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--txt-dim);
}
.chip.on { color: var(--tech); border-color: rgba(91,214,201,.4); }
.chip.has-tip { cursor: help; }
.chip.has-tip:hover { border-color: var(--accent); color: var(--accent-2); }
.empty-note { color: var(--txt-faint); font-size: 12px; font-style: italic; }

/* ---- Section heading inside panels ---- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 16px; letter-spacing: .04em; }
.section-head .hint { font-size: 12px; color: var(--txt-faint); }
.points-pill {
  font-size: 12px; font-weight: 700; letter-spacing: .04em;
  padding: 5px 12px; border-radius: 999px; background: var(--bg-elev);
  border: 1px solid var(--line); color: var(--tech); font-variant-numeric: tabular-nums;
}

/* ---- Skill / PAX trees ---- */
.branches { display: grid; gap: 14px; }
.branches.cols-3 { grid-template-columns: repeat(3, 1fr); }
.branches.cols-2 { grid-template-columns: repeat(2, 1fr); }
.branch { background: var(--bg-panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; }
.branch-head { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); margin-bottom: 3px; }
.branch-theme { font-size: 11px; color: var(--txt-faint); margin-bottom: 10px; }
.path-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--txt-faint); margin: 10px 0 5px; }

.node {
  display: block; width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 3px; padding: 8px 10px; margin-bottom: 6px; color: var(--txt); transition: .12s;
}
.node:hover:not(:disabled) { border-color: var(--accent); transform: translateX(2px); }
.node:disabled { opacity: .38; cursor: not-allowed; }
.node.sel { border-left-color: var(--accent); background: linear-gradient(90deg, rgba(232,163,61,.14), var(--bg-elev) 65%); box-shadow: inset 0 0 0 1px rgba(232,163,61,.25); }
.node-name { font-size: 12.5px; font-weight: 600; }
.node.sel .node-name { color: var(--accent-2); }
.node-bonus { font-size: 11px; color: var(--txt-dim); margin-top: 2px; }
.node-core { border-left-color: var(--tech); }
.node-core .node-name { color: var(--tech); }

/* ---- Ascension ---- */
.asc-cats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.asc-cat { background: var(--bg-panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; }
.asc-cat h3 { margin: 0 0 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-2); }
.asc-node { margin-bottom: 11px; }
.asc-node-top { display: flex; justify-content: space-between; align-items: baseline; }
.asc-node-name { font-size: 12.5px; font-weight: 600; }
.asc-node-val { font-size: 11.5px; color: var(--tech); font-variant-numeric: tabular-nums; }
.stepper { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.stepper button {
  width: 24px; height: 24px; border-radius: 3px; cursor: pointer;
  background: var(--bg-elev); border: 1px solid var(--line); color: var(--txt); font-size: 15px; line-height: 1;
}
.stepper button:hover:not(:disabled) { border-color: var(--accent); color: #fff; }
.stepper button:disabled { opacity: .3; cursor: not-allowed; }
.stepper-bar { flex: 1; height: 7px; border-radius: 4px; background: var(--bg); overflow: hidden; border: 1px solid var(--line-soft); }
.stepper-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); width: 0; transition: .15s; }
.stepper-count { width: 38px; text-align: right; font-size: 12px; color: var(--txt-dim); font-variant-numeric: tabular-nums; }

/* ---- Firepower calculator ---- */
.fp-controls { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 22px; }
.fp-field { flex: 1 1 200px; display: flex; flex-direction: column; gap: 6px; }
.fp-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--txt-faint); }
.fp-input { width: 100%; font: inherit; font-size: 13px; padding: 9px 10px; background: var(--bg-elev); color: var(--txt); border: 1px solid var(--line); border-radius: 5px; }
.fp-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(232,163,61,.18); }
.fp-section { margin-top: 24px; }
.fp-section-h { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-2); border-bottom: 1px solid var(--line); padding-bottom: 9px; margin-bottom: 14px; }
.fp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.fp-card { --rc: var(--line); position: relative; background: linear-gradient(180deg, color-mix(in srgb, var(--rc) 13%, var(--bg-panel-2)), var(--bg-panel-2) 75%); border: 1px solid var(--line-soft); border-top: 3px solid var(--rc); border-radius: var(--radius); padding: 14px 10px 13px; text-align: center; transition: transform .15s, box-shadow .15s, border-color .15s; }
.fp-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--rc) 45%, var(--line)); box-shadow: 0 5px 16px rgba(0,0,0,.32); }
.fp-card.sel { border-color: var(--rc); box-shadow: 0 0 0 1px var(--rc), 0 4px 14px color-mix(in srgb, var(--rc) 30%, transparent); }
.fp-card.unusual { --rc: #8f9d8a; }
.fp-card.rare { --rc: #5b9bd6; }
.fp-card.epic { --rc: #b06fd6; }
.fp-card.legendary { --rc: var(--accent); }
.fp-rarity { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-faint); margin-bottom: 7px; }
.fp-rarity::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--rc); margin-right: 6px; vertical-align: middle; box-shadow: 0 0 5px var(--rc); }
.fp-val { font-size: 25px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.05; text-shadow: 0 1px 2px rgba(0,0,0,.45); }
.fp-sub { font-size: 11px; color: var(--txt-dim); margin-top: 4px; font-variant-numeric: tabular-nums; }
.fp-empty { grid-column: 1 / -1; color: var(--txt-faint); font-size: 12.5px; font-style: italic; padding: 6px 0; }
/* quality gauge */
.fp-gauge { position: relative; display: flex; height: 12px; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); margin-top: 18px; }
.fp-seg { height: 100%; opacity: .5; }
.fp-cursor { position: absolute; top: -4px; bottom: -4px; width: 3px; background: #fff; border-radius: 2px; box-shadow: 0 0 7px rgba(255,255,255,.9); transform: translateX(-1.5px); transition: left .18s ease; }
.fp-tier-line { display: flex; align-items: center; gap: 11px; margin-top: 12px; }
.fp-tier { font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 5px 13px; border-radius: 5px; border: 1px solid; }
.fp-tier.bad { color: #e0726a; border-color: rgba(224,114,106,.5); background: rgba(224,114,106,.1); }
.fp-tier.ok { color: var(--accent-2); border-color: rgba(232,163,61,.4); background: rgba(232,163,61,.08); }
.fp-tier.good { color: #5bd6c9; border-color: rgba(91,214,201,.5); background: rgba(91,214,201,.1); }
.fp-tier.god { color: #1a1206; border-color: #b9791f; background: linear-gradient(180deg, var(--accent), #c9842a); box-shadow: 0 0 12px rgba(232,163,61,.4); }
.fp-tier-sub { font-size: 11.5px; color: var(--txt-dim); }

/* ---- Loadout / gear ---- */
.loadout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gear-slot { background: var(--bg-panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 12px; }
.gear-slot-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.gear-slot-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--txt-faint); }
.gear-select { width: 100%; font: inherit; font-size: 12.5px; padding: 8px; background: var(--bg-elev); color: var(--txt); border: 1px solid var(--line); border-radius: 3px; }
.gear-select:focus { outline: none; border-color: var(--accent); }
.gear-detail { margin-top: 9px; font-size: 12px; }
.gear-detail .row { display: flex; justify-content: space-between; padding: 2px 0; color: var(--txt-dim); }
.gear-detail .row .k { color: var(--txt-faint); }
.tag { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 3px; margin: 3px 4px 0 0; background: var(--bg-elev); border: 1px solid var(--line); color: var(--tech); }
.tag.mod { color: var(--accent-2); border-color: rgba(232,163,61,.35); }
.set-active { color: var(--good); font-size: 11.5px; margin-top: 6px; font-weight: 600; }
.set-bonus-text { font-size: 11px; color: var(--txt-dim); margin-top: 3px; }
.skills-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.skill-card {
  flex: 1 1 calc(33% - 8px); min-width: 180px; cursor: pointer; text-align: left;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: 3px; padding: 10px; color: var(--txt); transition: .12s;
}
.skill-card:hover { border-color: var(--accent); }
.skill-card.sel { border-color: var(--tech); box-shadow: inset 0 0 0 1px rgba(91,214,201,.35); }
.skill-card .sk-name { font-weight: 600; font-size: 12.5px; }
.skill-card.sel .sk-name { color: var(--tech); }
.skill-card .sk-desc { font-size: 11px; color: var(--txt-dim); margin-top: 4px; }

.tier-badge { font-size: 9.5px; font-weight: 800; padding: 1px 5px; border-radius: 2px; margin-right: 5px; }
.tier-1 { background: rgba(111,134,214,.2); color: var(--t1); }
.tier-2 { background: rgba(192,111,214,.2); color: var(--t2); }
.tier-3 { background: rgba(232,163,61,.2); color: var(--t3); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev); border: 1px solid var(--accent); color: var(--accent-2);
  padding: 11px 20px; border-radius: var(--radius); font-size: 13px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.footnote { margin-top: 28px; text-align: center; font-size: 11px; color: var(--txt-faint); line-height: 1.6; }

/* ---- Visual skill tree ---- */
.tree-legend { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--txt-dim); }
.legend-item i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.tree-stage {
  position: relative; width: 100%; line-height: 0;
  border: 1px solid var(--line-soft); border-radius: var(--radius); background-color: #08090b; overflow: hidden;
}
.tree-bg { display: block; width: 100%; height: auto; }
.tree-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.tree-edges .edge { stroke: #3a3f4d; stroke-width: 2; }
.tree-edges .edge.on { stroke: var(--accent); stroke-width: 3; filter: drop-shadow(0 0 3px rgba(232,163,61,.6)); }
.tree-node {
  position: absolute; transform: translate(-50%, -50%);
  aspect-ratio: 1; border-radius: 50%; cursor: pointer; padding: 0;
  background: transparent; border: 0; transition: box-shadow .1s, background .1s;
}
.tree-node:hover { z-index: 5; box-shadow: inset 0 0 0 2px var(--accent), 0 0 14px 2px rgba(232,163,61,.55); }
.tree-node.locked { background: rgba(2,3,5,.5); }
.tree-node.locked:hover { box-shadow: none; cursor: not-allowed; }
.tree-node.sel { background: color-mix(in srgb, var(--c, var(--accent)) 28%, transparent); box-shadow: inset 0 0 0 3px var(--c, var(--accent)), 0 0 16px 3px var(--c, var(--accent)); }
.tree-node.core.sel { box-shadow: inset 0 0 0 3px var(--tech), 0 0 18px 3px var(--tech); }
.tree-tip {
  position: fixed; z-index: 100; pointer-events: none; max-width: 280px;
  background: var(--bg-elev); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 9px 12px; font-size: 12px; box-shadow: var(--shadow); opacity: 0; transition: opacity .1s;
}
.tree-tip.show { opacity: 1; }
.head-right { display: flex; align-items: center; gap: 10px; }
.btn-sm { padding: 7px 12px; font-size: 11.5px; }
.btn.on { border-color: var(--tech); color: var(--tech); }
.tree-stats {
  position: absolute; top: 10px; right: 10px; width: 264px; max-height: calc(100% - 20px); overflow-y: auto;
  background: #0c0e13; border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.7); z-index: 6;
}
.tree-stats-h { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.tree-stats .stat-line {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  font-size: 12.5px; line-height: 1.35; padding: 5px 0; border-bottom: 1px solid var(--line-soft);
}
.tree-stats .stat-line span:first-child { flex: 1; min-width: 0; color: var(--txt); }
.tree-stats .stat-line .v { flex: 0 0 auto; white-space: nowrap; color: var(--accent-2); font-weight: 700; }
.tree-stats-note { font-size: 10px; color: var(--txt-faint); margin-top: 10px; font-style: italic; }
.tip-name { font-weight: 700; color: var(--accent-2); font-size: 13px; }
.tip-branch { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-faint); margin-bottom: 5px; }
.tip-bonus { color: var(--txt-dim); line-height: 1.5; }
.tip-bonus b { color: var(--tech); }

/* ---- PAX interactive tree ---- */
.pax-stage { margin-bottom: 16px; }

/* ---- PAX reference image ---- */
.pax-ref { margin: 0 0 16px; }
.pax-ref img { width: 100%; max-width: 1100px; display: block; margin: 0 auto; border: 1px solid var(--line-soft); border-radius: var(--radius); }
.pax-ref figcaption { text-align: center; font-size: 11px; color: var(--txt-faint); margin-top: 6px; font-style: italic; }

/* ---- PAX node icon ---- */
.pax-row { display: flex; align-items: center; gap: 9px; }
.pax-icon { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 5px; object-fit: contain; background: var(--bg-panel); }
.pax-icon.ph { background: var(--bg-elev); border: 1px dashed var(--line); }
.pax-text { min-width: 0; }

/* ---- Skill card icon ---- */
.sk-head { display: flex; align-items: center; gap: 8px; }
.sk-icon { width: 28px; height: 28px; border-radius: 4px; background: var(--bg-panel); flex: 0 0 auto; object-fit: contain; }

/* ---- Searchable mod picker ---- */
.mod-picker { position: relative; margin-top: 6px; }
.mp-trigger {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: inherit; font-size: 11.5px; padding: 6px 8px; text-align: left; cursor: pointer;
  background: var(--bg-elev); color: var(--txt); border: 1px solid var(--line); border-radius: 3px;
}
.mp-trigger:hover { border-color: var(--accent); }
.mp-trigger span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-caret { color: var(--txt-faint); flex: 0 0 auto; }
.mod-picker.disabled .mp-trigger { opacity: .55; cursor: not-allowed; }
.mod-picker.dup .mp-trigger { border-color: var(--bad); color: var(--bad); }
.mod-picker.swapped .mp-trigger { border-color: var(--accent); color: var(--accent-2); }
.mp-pop {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 2px);
  background: var(--bg-panel-2); border: 1px solid var(--accent); border-radius: 4px; box-shadow: var(--shadow); padding: 6px;
}
.mp-pop.hidden { display: none; }
.mp-search {
  width: 100%; box-sizing: border-box; font: inherit; font-size: 11.5px; padding: 6px 8px; margin-bottom: 6px;
  background: var(--bg); color: var(--txt); border: 1px solid var(--line); border-radius: 3px;
}
.mp-search:focus { outline: none; border-color: var(--accent); }
.mp-list { max-height: 230px; overflow-y: auto; }
.mp-group { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-faint); padding: 7px 4px 3px; }
.mp-opt { display: block; width: 100%; text-align: left; font: inherit; font-size: 11.5px; padding: 5px 8px; cursor: pointer; background: none; border: 0; color: var(--txt-dim); border-radius: 3px; }
.mp-opt:hover { background: var(--bg-elev); color: var(--txt); }
.mp-opt.sel { color: var(--accent-2); }
.mp-opt.mp-none { color: var(--txt-faint); font-style: italic; }

/* ---- Epic gear editor ---- */
.gear-select.sm { margin-top: 6px; font-size: 11.5px; padding: 6px 8px; }
.epic-editor { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line-soft); }
.epic-label { font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent-2); margin: 8px 0 2px; }
.epic-label:first-child { margin-top: 0; }
.gear-select.swapped { border-color: var(--accent); color: var(--accent-2); }
.gear-select:disabled { opacity: .55; cursor: not-allowed; }
.gear-select.dup { border-color: var(--bad); color: var(--bad); box-shadow: inset 0 0 0 1px rgba(224,98,90,.4); }

/* duplicate-mod warning in the summary */
.sum-section.warn h3 { color: var(--bad); }
.chip.dup { color: var(--bad); border-color: rgba(224,98,90,.5); background: rgba(224,98,90,.1); }
.warn-note { font-size: 10.5px; color: var(--bad); margin-top: 6px; font-style: italic; }

/* ---- What's-new modal ---- */
.modal-back {
  position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center;
  background: rgba(4,5,7,.72); backdrop-filter: blur(3px); padding: 20px;
}
.modal {
  max-width: 460px; width: 100%; background: linear-gradient(180deg, var(--bg-panel-2), var(--bg-panel));
  border: 1px solid var(--accent); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.modal-head { display: flex; align-items: baseline; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 18px; letter-spacing: .04em; color: var(--accent); }
.modal-ver { font-size: 12px; color: var(--txt-faint); font-variant-numeric: tabular-nums; }
.cl-log { max-height: 60vh; overflow-y: auto; margin: -2px -4px 4px; padding: 0 4px; }
.cl-entry { border-bottom: 1px solid var(--line-soft); }
.cl-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: none; border: 0; cursor: pointer; padding: 9px 0; text-align: left; color: var(--tech); font: inherit;
}
.cl-head:hover { color: var(--accent-2); }
.cl-ver { font-size: 11.5px; letter-spacing: .04em; font-weight: 600; }
.cl-caret { font-size: 11px; color: var(--txt-faint); transition: transform .15s; }
.cl-entry.open .cl-caret { transform: rotate(180deg); }
.cl-body { display: none; padding-bottom: 8px; }
.cl-entry.open .cl-body { display: block; }
.cl-list { margin: 0; padding-left: 18px; }
.cl-list li { font-size: 12.5px; color: var(--txt-dim); margin-bottom: 5px; line-height: 1.45; }
.cl-note { border: 1px solid rgba(232,163,61,.45); border-left: 3px solid var(--accent); background: rgba(232,163,61,.08); border-radius: 6px; padding: 10px 12px; margin-bottom: 12px; font-size: 12.5px; line-height: 1.5; color: var(--accent-2); }
.cl-note strong { display: block; text-transform: uppercase; letter-spacing: .06em; font-size: 11px; color: var(--accent); margin-bottom: 4px; }
.cl-patch { border-left: 2px solid var(--line); padding-left: 10px; margin-bottom: 8px; }
.cl-patch-ver { font-size: 10.5px; letter-spacing: .04em; color: var(--accent-2); margin-bottom: 4px; font-weight: 600; }
.modal .btn { width: 100%; margin-top: 12px; }
.modal.wide { max-width: 720px; }

/* ---- Build recap ---- */
.recap-body { max-height: 64vh; overflow: hidden auto; display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; align-items: start; padding-right: 4px; }
.rc-col { min-width: 0; }
.rc-sec { margin-bottom: 14px; min-width: 0; }
.rc-sec h3 { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 7px; border-bottom: 1px solid var(--line); padding-bottom: 5px; }
.rc-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; padding: 2px 0; }
.rc-line b { color: var(--accent-2); font-variant-numeric: tabular-nums; }
.rc-empty { font-size: 12px; color: var(--txt-faint); font-style: italic; }
.rc-grp { margin-bottom: 7px; }
.rc-grp-h { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--tech); margin-bottom: 3px; }
.rc-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.rc-chip { font-size: 10.5px; padding: 2px 7px; border-radius: 3px; background: var(--bg-elev); border: 1px solid var(--line); color: var(--txt-dim); }
.rc-skills { display: flex; flex-direction: column; gap: 5px; }
.rc-skill { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--txt); }
.rc-skill img { width: 22px; height: 22px; border-radius: 4px; background: var(--bg-panel); }
.rc-gear { margin-bottom: 7px; }
.rc-gear-h { font-size: 12px; color: var(--txt); }
.rc-slot { font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--txt-faint); margin-right: 4px; }
.rc-gear-attrs { font-size: 11px; color: var(--tech); margin-top: 1px; }
.rc-gear-mods { font-size: 11px; color: var(--accent-2); margin-top: 1px; }
.rc-sec.full { grid-column: 1 / -1; }
.rc-sub { font-size: 11px; color: var(--tech); font-weight: 600; letter-spacing: 0; text-transform: none; }
.rc-svg { height: 150px; width: auto; max-width: 100%; display: block; margin: 0 auto; background: #0c0e13; border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 6px; box-sizing: border-box; }
.rc-edge { stroke: #2b2f3a; }
.rc-edge.on { stroke: var(--accent); }
.rc-node { fill: #14161c; stroke: #4a5060; }
.rc-node.on { fill: var(--accent); stroke: #fff; }
.rc-node.core { stroke: var(--tech); }
.rc-node.core.on { fill: var(--tech); stroke: #fff; }
.recap-actions { display: flex; gap: 10px; margin-top: 14px; }
.recap-actions .btn { margin-top: 0; }
@media (max-width: 620px) { .recap-body { grid-template-columns: 1fr; } }

@media (max-width: 940px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
  .branches.cols-3, .branches.cols-2 { grid-template-columns: 1fr; }
  .asc-cats, .loadout-grid { grid-template-columns: 1fr; }
}

/* ---- Phone ---- */
@media (max-width: 600px) {
  body { font-size: 13.5px; }
  #app { padding: 0 10px 34px; }

  /* topbar stacks: brand, class switch, actions on their own rows */
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 0 12px; }
  .brand { align-items: center; text-align: center; }
  .brand-class { font-size: 20px; letter-spacing: .1em; }
  .brand-sub { letter-spacing: .18em; }
  .class-switch { gap: 5px; }
  .class-btn { flex: 1 1 auto; text-align: center; padding: 9px 6px; font-size: 11px; }
  .topbar-actions { flex-wrap: wrap; gap: 7px; }
  .topbar-actions .btn { flex: 1 1 auto; justify-content: center; padding: 9px 10px; }

  /* tabs wrap, full-width-ish */
  .tabs { gap: 4px; margin: 12px 0 14px; }
  .tab { flex: 1 1 auto; text-align: center; padding: 10px 6px; font-size: 11px; letter-spacing: .03em; }

  .panel { padding: 13px; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 5px; }
  .section-head h2 { font-size: 15px; }

  /* upgrade cards: 2 per row */
  .fp-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .fp-card { padding: 12px 8px 11px; }
  .fp-val { font-size: 20px; }
  .fp-controls { gap: 10px; }

  /* trees: scroll horizontally so nodes stay tappable (also pinch-zoomable) */
  #panel-tree, #panel-pax { overflow-x: auto; }
  #panel-tree .tree-stage, #panel-pax .tree-stage { min-width: 680px; }

  /* modals + recap */
  .modal { padding: 16px; max-height: 88vh; }
  .modal-head h2 { font-size: 16px; }
  .recap-body { max-height: 70vh; }
  .recap-actions { flex-wrap: wrap; }

  /* feedback nudge spans the width */
  .fb-toast { left: 10px; right: 10px; bottom: 10px; max-width: none; }
}
