/* ═════ DMZ Trait Planner (/traits) ═════ */
.tp-page, .tp-tip, .tp-picker {
  --tp-red: #e2445c; --tp-red-2: #7d1e2f;
  --tp-gold: #e4c23a; --tp-gold-2: #7a6413;
  --tp-teal: #3fd0dc; --tp-teal-2: #0f5d66;
  --tp-panel: #141716; --tp-line: rgba(220, 225, 215, .12); --tp-text: #ece9e2; --tp-muted: #a8aaa4;
}
.tp-red { --c: var(--tp-red); --c2: var(--tp-red-2); }
.tp-gold { --c: var(--tp-gold); --c2: var(--tp-gold-2); }
.tp-teal { --c: var(--tp-teal); --c2: var(--tp-teal-2); }

.tp-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 24px; align-items: start; margin-top: 8px; }
@media (max-width: 1100px) { .tp-layout { grid-template-columns: 1fr; } }

/* trees */
.tp-trees { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.tp-tree {
  position: relative; padding: 18px 10px 14px; border: 1px solid var(--tp-line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 9%, #101211) 0%, #101211 55%, color-mix(in srgb, var(--c) 14%, #101211) 100%);
  display: flex; flex-direction: column; gap: 6px; isolation: isolate; transition: border-color .25s, box-shadow .25s;
}
.tp-shape-circle { border-radius: 160px 160px 6px 6px; padding-top: 30px; }
.tp-shape-hex { clip-path: polygon(10% 0, 90% 0, 100% 4%, 100% 100%, 0 100%, 0 4%); }
.tp-tree.has-picks { border-color: color-mix(in srgb, var(--c) 45%, transparent); box-shadow: 0 0 40px -18px var(--c); }
.tp-links { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: visible; }
.tp-links path { fill: none; stroke: var(--c); stroke-width: 2; opacity: .9; filter: drop-shadow(0 0 4px var(--c)); }

.tp-row { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-evenly; min-height: 74px; }
.tp-major { min-height: 104px; }
.tp-bn { position: absolute; left: 2px; top: 50%; transform: translateY(-50%); font: 600 .72rem/1 system-ui, sans-serif; color: var(--tp-muted); opacity: .55; }
.tp-pip { width: 8px; height: 8px; border-radius: 50%; background: color-mix(in srgb, var(--c) 25%, #2a2d2b); opacity: .6; }

/* nodes */
.tp-node {
  --s: 60px; position: relative; width: var(--s); height: var(--s); display: grid; place-items: center; padding: 0; cursor: pointer;
  color: var(--tp-text); background: #1b1e1d; border: 2px solid #3a3e3c; transition: background .18s, border-color .18s, box-shadow .18s, opacity .18s;
  -webkit-tap-highlight-color: transparent;
}
.tp-major .tp-node { --s: 84px; }
.tp-shape-hex .tp-node { clip-path: polygon(25% 3%, 75% 3%, 100% 50%, 75% 97%, 25% 97%, 0 50%); border: 0; background: #2c302e; }
.tp-shape-hex .tp-node::before { content: ""; position: absolute; inset: 2px; clip-path: inherit; background: #191c1b; z-index: -1; }
.tp-shape-circle .tp-node { border-radius: 50%; }
.tp-shape-square .tp-node { border-radius: 4px; }
.tp-node img { width: 62%; height: 62%; object-fit: contain; opacity: .5; transition: opacity .18s, transform .18s; pointer-events: none; image-rendering: auto; }
.tp-slot img { width: 58%; height: 58%; }
.tp-node img[hidden] { display: none; }
.tp-plus { font: 300 1.9rem/1 system-ui, sans-serif; color: var(--c); opacity: .75; pointer-events: none; }
.tp-slot { border-style: dashed; border-color: color-mix(in srgb, var(--c) 40%, #3a3e3c); }

/* states */
.tp-node.is-open img { opacity: .9; }
.tp-node.is-open { border-color: color-mix(in srgb, var(--c) 55%, #3a3e3c); }
.tp-shape-hex .tp-node.is-open { background: color-mix(in srgb, var(--c) 55%, #2c302e); }
.tp-node.is-locked { opacity: .45; cursor: not-allowed; }
.tp-node.is-locked .tp-plus { opacity: .35; }
.tp-node:hover:not(.is-locked), .tp-node:focus-visible { border-color: var(--c); }
.tp-node:hover:not(.is-locked) img { opacity: 1; }
.tp-node:focus-visible { outline: 2px solid var(--c); outline-offset: 3px; }
.tp-node.is-on { background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 92%, #fff) 0%, var(--c) 48%, var(--c2) 100%); border-color: var(--c); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 30%, transparent), 0 0 26px -2px var(--c); }
.tp-shape-hex .tp-node.is-on { background: var(--c); box-shadow: none; filter: drop-shadow(0 0 10px var(--c)); }
.tp-shape-hex .tp-node.is-on::before { background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--c) 85%, #fff), var(--c2)); }
.tp-node.is-on img { opacity: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .55)); }
.tp-node.is-on .tp-plus { display: none; }
.tp-node.is-off img { opacity: .28; }
.tp-node.shake { animation: tpShake .35s; }
@keyframes tpShake { 20%, 60% { translate: -4px 0; } 40%, 80% { translate: 4px 0; } }

.tp-tree-name { margin-top: 8px; text-align: center; font: 600 1.05rem/1.2 var(--display, sans-serif); letter-spacing: .08em; text-transform: uppercase; color: var(--c); }
.tp-tree-name small { display: block; margin-top: 4px; font: 400 .82rem/1.3 system-ui, sans-serif; letter-spacing: 0; text-transform: none; color: var(--tp-muted); }

/* tabs (mobile only) */
.tp-tabs { display: none; }
@media (max-width: 760px) {
  .tp-tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
  .tp-tab { flex: 1 0 auto; min-height: 44px; padding: 8px 12px; border: 1px solid var(--tp-line); background: #161918; color: var(--tp-text); font: 600 .95rem/1 system-ui, sans-serif; cursor: pointer; }
  .tp-tab b { margin-left: 4px; color: var(--c); }
  .tp-tab[aria-selected="true"] { border-color: var(--c); background: color-mix(in srgb, var(--c) 18%, #161918); }
  .tp-trees { grid-template-columns: 1fr; }
  .tp-tree { display: none; max-width: 420px; margin: 0 auto; width: 100%; }
  .tp-tree.is-tab { display: flex; }
}

.tp-note { margin: 14px 2px 0; font-size: .92rem; line-height: 1.5; color: var(--tp-muted); }

/* sidebar */
.tp-side { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 90px; }
@media (max-width: 1100px) { .tp-side { position: static; } }
.tp-points .tp-big { display: flex; align-items: baseline; gap: 10px; }
.tp-big span { font: 400 3rem/1 var(--display, sans-serif); color: var(--tp-text); font-variant-numeric: tabular-nums; }
.tp-big small { color: var(--tp-muted); font-size: .95rem; }
.tp-counts { display: flex; gap: 8px; margin: 12px 0 14px; }
.tp-count { flex: 1; text-align: center; padding: 8px 4px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); }
.tp-count b { display: block; font: 600 1.4rem/1.1 system-ui, sans-serif; color: var(--c); }
.tp-count small { font-size: .78rem; color: var(--tp-muted); }
.tp-actions .btn { flex: 1; }
.tp-msg { min-height: 1.3em; margin: 8px 0 0; font-size: .9rem; color: var(--tp-muted); }

.tp-summary { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 520px; overflow: auto; }
.tp-summary li { display: grid; grid-template-columns: 34px 1fr; gap: 10px; align-items: center; padding: 6px 8px; border-left: 3px solid var(--c, transparent); background: rgba(255, 255, 255, .025); }
.tp-summary li.muted { display: block; border: 0; background: none; padding: 0; line-height: 1.5; }
.tp-summary img { width: 30px; height: 30px; padding: 3px; background: var(--c2); border-radius: 4px; }
.tp-summary b { display: block; font: 600 .95rem/1.25 system-ui, sans-serif; color: var(--tp-text); }
.tp-summary span { display: block; font-size: .86rem; line-height: 1.35; color: var(--tp-muted); }

.tp-presets { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.tp-preset { text-align: left; padding: 10px 12px; border: 1px solid var(--tp-line); background: #171a19; color: var(--tp-text); cursor: pointer; transition: border-color .15s; }
.tp-preset:hover, .tp-preset:focus-visible { border-color: var(--orange, #ff7a1a); }
.tp-preset b { display: block; font: 600 1rem/1.3 system-ui, sans-serif; }
.tp-preset span { font-size: .88rem; line-height: 1.4; color: var(--tp-muted); }

.tp-save { display: flex; gap: 8px; margin: 8px 0 10px; }
.tp-save input[type=text] { flex: 1; min-width: 0; }
.tp-saved { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tp-saved li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px; background: rgba(255, 255, 255, .03); }
.tp-saved a { color: var(--tp-text); font-weight: 600; }
.tp-saved form { margin: 0; }
.tp-del { background: none; border: 0; color: var(--tp-muted); cursor: pointer; min-width: 36px; min-height: 36px; font-size: 1rem; }
.tp-del:hover { color: #ff5a5a; }

/* tooltip */
.tp-tip {
  position: fixed; z-index: 90; max-width: 320px; display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 12px 14px;
  background: rgba(12, 14, 13, .97); border: 1px solid var(--c, #555); border-left-width: 4px; box-shadow: 0 16px 40px -10px rgba(0, 0, 0, .8);
  pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.tp-tip.show { opacity: 1; transform: none; }
.tp-tip img { width: 44px; height: 44px; padding: 6px; background: var(--c2, #222); border-radius: 4px; }
.tp-tip b { display: block; font: 700 1rem/1.25 system-ui, sans-serif; color: #fff; letter-spacing: .02em; text-transform: uppercase; }
.tp-tip p { margin: 4px 0 6px; font-size: .95rem; line-height: 1.45; color: #e3e1da; }
.tp-tip small { font-size: .8rem; color: var(--c, #aaa); }

/* minor picker */
.tp-picker { width: min(560px, 94vw); max-height: 86vh; padding: 18px; border: 1px solid var(--c, #444); background: #121514; color: var(--tp-text, #eee); }
.tp-picker::backdrop { background: rgba(0, 0, 0, .65); }
.tp-picker-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tp-picker-head h2 { margin: 0; font-size: 1.3rem; }
.tp-x { background: none; border: 0; color: inherit; font-size: 1.2rem; min-width: 44px; min-height: 44px; cursor: pointer; }
.tp-picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin: 12px 0; }
.tp-opt { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; text-align: left; padding: 10px; min-height: 56px; border: 1px solid #2c302e; background: #181b1a; color: inherit; cursor: pointer; }
.tp-opt img { width: 40px; height: 40px; padding: 5px; background: var(--c2, #333); border-radius: 4px; }
.tp-opt b { display: block; font: 600 .98rem/1.25 system-ui, sans-serif; }
.tp-opt span { font-size: .86rem; line-height: 1.35; color: #b2b4ae; }
.tp-opt:hover, .tp-opt:focus-visible { border-color: var(--c); }
.tp-opt.is-current { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, #181b1a); }
.tp-opt:disabled { opacity: .4; cursor: not-allowed; }

@media (max-width: 420px) { .tp-node { --s: 54px; } .tp-major .tp-node { --s: 74px; } .tp-row { min-height: 66px; } .tp-major { min-height: 92px; } }
@media (prefers-reduced-motion: reduce) { .tp-node, .tp-tip { transition: none; } .tp-node.shake { animation: none; } }
.tp-slot.is-on { border-style: solid; }
