.talent-sim-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.talent-sim-page .portal-card {
    border: 1px solid rgba(148, 163, 184, .32);
    background: rgba(255,255,255,.86);
    border-radius: 20px;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .08);
}

.talent-sim-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    padding: 24px;
}

.talent-sim-kicker {
    color: #4f46e5;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.talent-sim-title-block h1 {
    margin: 6px 0 8px;
    font-size: clamp(28px, 4vw, 44px);
    line-height: 1;
    font-weight: 900;
    color: #0f172a;
}

.talent-sim-title-block p {
    max-width: 760px;
    color: #64748b;
    font-size: 14px;
    line-height: 1.7;
}

.talent-sim-actions,
.talent-import-row,
.talent-search-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.talent-sim-btn {
    border: 1px solid rgba(148, 163, 184, .45);
    background: #fff;
    color: #334155;
    border-radius: 999px;
    padding: 9px 14px;
    font-size: 13px;
    font-weight: 800;
    transition: transform .15s ease, border-color .15s ease, background .15s ease;
}

.talent-sim-btn:hover { transform: translateY(-1px); border-color: rgba(79, 70, 229, .5); }
.talent-sim-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.talent-sim-btn--primary { background: #1d4ed8; color: #eff6ff; border-color: #1d4ed8; }
.talent-sim-btn--ghost { background: rgba(255,255,255,.74); }
.talent-hero-switcher-label {
    color: #92400e;
    font-size: 12px;
    font-weight: 900;
}

.talent-sim-toolbar {
    display: grid;
    grid-template-columns: 150px 150px 120px minmax(420px, 1fr);
    gap: 14px;
    margin-top: 16px;
    padding: 16px;
    align-items: end;
}

.talent-sim-field label,
.talent-code-output label {
    display: block;
    margin-bottom: 7px;
    color: #475569;
    font-size: 12px;
    font-weight: 800;
}

.talent-sim-field select,
.talent-import-row input,
.talent-search-row input {
    width: 100%;
    height: 40px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: rgba(255,255,255,.92);
    color: #0f172a;
    padding: 0 12px;
    outline: none;
}

.talent-import-row input { flex: 1 1 0; min-width: 0; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 12px; }

.talent-tree-search { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-width: 0; }
.talent-search-row { flex-wrap: nowrap; gap: 6px; width: 326px; max-width: 100%; }
.talent-search-row input { flex: 1 1 240px; min-width: 0; height: 32px; padding: 0 10px; border-radius: 8px; font-size: 12px; }
.talent-search-row .talent-sim-btn { flex: 0 0 auto; height: 32px; padding: 4px 10px; font-size: 12px; }
.talent-search-row input:focus-visible { outline: 2px solid #4f46e5; outline-offset: 2px; }
.talent-search-status { color: #64748b; font-size: 12px; }

.talent-sim-summary {
    margin-top: 16px;
    padding: 16px;
    display: grid;
    grid-template-columns: minmax(260px, 360px) minmax(260px, 420px) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}

.talent-spec-chip {
    display: flex;
    align-items: center;
    gap: 12px;
}

.talent-spec-chip img,
.talent-inspector-head img {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    object-fit: cover;
    background: #0f172a;
    box-shadow: 0 10px 22px rgba(15,23,42,.18);
}

.talent-spec-title { color: #0f172a; font-size: 18px; font-weight: 900; }
.talent-spec-subtitle { color: #64748b; font-size: 12px; margin-top: 3px; }

.talent-point-groups {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.talent-point-groups div {
    padding: 10px 12px;
    border-radius: 14px;
    background: linear-gradient(180deg, #f8fbff, #eef6ff);
    border: 1px solid #dbeafe;
    text-align: center;
}

.talent-point-groups span {
    display: block;
    color: #1d4ed8;
    font-size: 20px;
    line-height: 1;
    font-weight: 900;
}

.talent-point-groups small {
    display: block;
    margin-top: 4px;
    color: #64748b;
    font-size: 11px;
}

.talent-code-output code {
    display: block;
    inline-size: 100%;
    height: 72px;
    box-sizing: border-box;
    overflow: auto;
    padding: 10px 12px;
    border-radius: 12px;
    background: #0f172a;
    color: #bfdbfe;
    font-size: 11px;
    line-height: 1.45;
    word-break: break-all;
}

.talent-code-output-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.talent-code-output-head label { margin-bottom: 0; }
.talent-code-output-head .talent-sim-btn { flex: 0 0 auto; padding: 6px 12px; font-size: 12px; }

.talent-sim-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    margin-top: 16px;
    align-items: start;
}

.talent-stage-scroll {
    min-height: 720px;
    overflow: auto;
    padding: 18px;
}

.talent-loading {
    min-height: 620px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    font-weight: 700;
}

.talent-stage-scale-wrapper { transform-origin: top left; }
.talent-render-stage { position: relative; min-width: 100%; border-radius: 20px; transform-origin: top left; }
.talent-stage-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.talent-path { fill: none; stroke: rgba(71,85,105,.22); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 4px rgba(15,23,42,.08)); transition: stroke .14s ease, opacity .14s ease, filter .14s ease, stroke-width .14s ease; }
.talent-path.is-locked { opacity: .38; }
.talent-path.is-unlocked { stroke: rgba(250,204,21,.62); opacity: .82; filter: drop-shadow(0 0 6px rgba(250,204,21,.22)); }
.talent-path.is-active { stroke: rgba(37,99,235,.82); opacity: 1; filter: drop-shadow(0 0 7px rgba(37,99,235,.28)); }
.talent-path.is-related { stroke-width: 7; opacity: 1; filter: drop-shadow(0 0 10px rgba(245,158,11,.32)); }

.talent-panel {
    position: absolute;
    z-index: 1;
    border-radius: 24px;
    background: linear-gradient(180deg, #ffffff 0, #ffffff 64px, #f8fbff 100%);
    border: 1px solid #dbeafe;
    box-shadow: 0 14px 34px rgba(37,99,235,.08);
}

.talent-panel--hero {
    background: linear-gradient(180deg, #fff7ed 0, #fff 70px, #fffbeb 100%);
    border-color: #fde68a;
}

.talent-hero-choice-panel {
    position: absolute;
    z-index: 8;
    width: 360px;
    padding: 18px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255,251,235,.98), rgba(255,247,237,.96));
    border: 1px solid rgba(245,158,11,.45);
    box-shadow: 0 18px 42px rgba(120,53,15,.18);
    text-align: center;
}
.talent-hero-choice-kicker {
    color: #b45309;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}
.talent-hero-choice-title {
    margin-top: 5px;
    color: #78350f;
    font-size: 18px;
    font-weight: 950;
}
.talent-hero-choice-desc {
    margin-top: 6px;
    color: #92400e;
    font-size: 12px;
    line-height: 1.55;
}
.talent-hero-choice-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}
.talent-hero-choice-card {
    min-height: 74px;
    padding: 11px 10px;
    border-radius: 14px;
    border: 1px solid rgba(217,119,6,.34);
    background: rgba(255,255,255,.82);
    color: #78350f;
    box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
    transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.talent-hero-choice-card:hover {
    transform: translateY(-2px);
    border-color: rgba(217,119,6,.75);
    box-shadow: 0 10px 22px rgba(217,119,6,.18);
}
.talent-hero-choice-card span {
    display: block;
    font-size: 13px;
    font-weight: 950;
    line-height: 1.25;
}
.talent-hero-choice-card small {
    display: block;
    margin-top: 6px;
    color: #b45309;
    font-size: 11px;
    font-weight: 800;
}

.talent-panel-head { padding: 18px 20px 0; }
.talent-panel-title { font-size: 14px; font-weight: 900; color: #1d4ed8; }
.talent-panel--hero .talent-panel-title { color: #b45309; }

.talent-node-card--tree {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    background: transparent;
    border: none;
    box-shadow: none;
    overflow: visible;
    cursor: pointer;
    transition: transform .12s ease, opacity .12s ease;
}

.talent-node-card--tree:hover { transform: translateY(-2px) scale(1.04); }
.talent-node-card--tree.is-locked { opacity: .32; cursor: not-allowed; }
.talent-node-card--tree.is-available { opacity: 1; }
.talent-node-card--tree.is-selected { z-index: 4; }
.talent-node-card--tree.is-related { z-index: 5; opacity: 1; }

/* Keep the search ring outside the icon's grayscale/choice/apex styling. */
.talent-node-card--tree.is-search-match {
    z-index: 6;
    opacity: 1;
    outline: 3px solid #06b6d4;
    outline-offset: 5px;
    box-shadow: 0 0 0 7px rgba(6,182,212,.16), 0 0 18px rgba(6,182,212,.5);
}

.talent-node-icon {
    position: relative;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(51,65,85,.92);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e1;
}

.talent-panel--hero .talent-node-icon { width: 30px; height: 30px; }
.talent-node-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.talent-node-card--tree.is-locked .talent-node-icon img { filter: grayscale(1) saturate(.2) brightness(.58); opacity: .82; }
.talent-node-card--tree.is-available .talent-node-icon { box-shadow: 0 0 0 2.5px rgba(245,158,11,.95), 0 0 0 6px rgba(245,158,11,.14), 0 0 16px rgba(245,158,11,.38); }
.talent-node-card--tree.is-selected .talent-node-icon { box-shadow: 0 0 0 1.5px rgba(96,165,250,.95), 0 0 10px rgba(37,99,235,.42); }
.talent-node-card--tree.is-apex-talent .talent-node-icon { box-shadow: 0 0 0 2px rgba(168,85,247,.92), 0 0 0 6px rgba(168,85,247,.16), 0 0 18px rgba(168,85,247,.36); }
.talent-node-card--tree.is-apex-talent.is-selected .talent-node-icon { box-shadow: 0 0 0 2px rgba(216,180,254,.98), 0 0 18px rgba(147,51,234,.46); }
.talent-node-card--tree.is-apex-talent .talent-node-points { background: #7e22ce; box-shadow: 0 4px 12px rgba(126,34,206,.34); }
.talent-node-card--tree.is-related .talent-node-icon { box-shadow: 0 0 0 2px rgba(250,204,21,.95), 0 0 16px rgba(250,204,21,.42); }
.talent-node-card--tree.is-choice-node::before,
.talent-node-card--tree.is-choice-node::after {
    content: '';
    position: absolute;
    top: 50%;
    z-index: -1;
    width: 0;
    height: 0;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
    transform: translateY(-50%);
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.28));
}
.talent-node-card--tree.is-choice-node::before { left: -7px; border-right: 8px solid #facc15; }
.talent-node-card--tree.is-choice-node::after { right: -7px; border-left: 8px solid #facc15; }

.talent-node-points {
    position: absolute;
    right: 0;
    bottom: 0;
    min-width: 14px;
    height: 13px;
    line-height: 13px;
    padding: 0 3px;
    border-radius: 999px;
    background: #2563eb;
    color: #eff6ff;
    font-size: 7px;
    font-weight: 800;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.talent-node-card--tree.is-locked .talent-node-points { background: #64748b; color: #e2e8f0; box-shadow: none; }
.talent-node-card--tree.is-available .talent-node-points { background: #d97706; box-shadow: 0 4px 12px rgba(217,119,6,.32); }

.talent-node-state-badge {
    position: absolute;
    left: 50%;
    top: calc(100% + 3px);
    transform: translateX(-50%);
    padding: 1px 5px;
    border-radius: 999px;
    background: rgba(15,23,42,.78);
    color: #cbd5e1;
    font-size: 7px;
    line-height: 12px;
    font-weight: 900;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s ease;
}
.talent-node-card--tree:hover .talent-node-state-badge,
.talent-node-card--tree.is-related .talent-node-state-badge { opacity: 1; }
.talent-node-card--tree.is-available .talent-node-state-badge { background: rgba(217,119,6,.9); color: #fff7ed; }
.talent-node-card--tree.is-selected .talent-node-state-badge { background: rgba(37,99,235,.9); color: #eff6ff; }

.talent-icon-split { display: flex; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.talent-icon-split-half { width: 50%; height: 100%; overflow: hidden; }
.talent-icon-split-half img { width: 200%; max-width: none; height: 100%; object-fit: cover; filter: grayscale(1) saturate(.4) brightness(.82); }
.talent-icon-split-half.is-right img { transform: translateX(-50%); }

.talent-floating-tooltip {
    position: fixed;
    z-index: 9999;
    width: max-content;
    min-width: 190px;
    max-width: 430px;
    padding: 11px 13px;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(2,6,23,.98));
    border: 1px solid rgba(250,204,21,.42);
    box-shadow: 0 16px 36px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.08);
    color: #e2e8f0;
    pointer-events: auto;
    text-align: left;
}
.talent-floating-tooltip[hidden] { display: none; }
.talent-floating-tooltip-name { color: #bfdbfe; font-weight: 900; font-size: 13px; }
.talent-floating-tooltip-state { margin-top: 4px; color: #facc15; font-size: 11px; font-weight: 800; }
.talent-floating-tooltip-desc { margin-top: 7px; color: #cbd5e1; font-size: 12px; line-height: 1.48; white-space: normal; }
.talent-floating-tooltip-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(148,163,184,.22);
}
.talent-floating-tooltip-option {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-width: 0;
    border: 1px solid rgba(148,163,184,.28);
    border-radius: 10px;
    padding: 8px;
    background: rgba(15,23,42,.72);
    color: #cbd5e1;
    text-align: left;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.talent-floating-tooltip-option:hover,
.talent-floating-tooltip-option:focus-visible {
    border-color: rgba(250,204,21,.72);
    background: rgba(30,41,59,.92);
    transform: translateY(-1px);
    outline: none;
}
.talent-floating-tooltip-option.is-active {
    border-color: rgba(96,165,250,.9);
    background: rgba(30,64,175,.34);
}
.talent-floating-tooltip-option img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 1px rgba(255,255,255,.2);
}
.talent-choice-unresolved-mark {
    display: inline-flex;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border: 1px dashed #94a3b8;
    border-radius: 50%;
    color: #94a3b8;
    font-size: 16px;
}
.talent-floating-tooltip-option:disabled,
.talent-inspector-option:disabled { opacity: .6; cursor: not-allowed; }
.talent-floating-tooltip-option strong {
    display: block;
    color: #bfdbfe;
    font-size: 12px;
    line-height: 1.25;
}
.talent-floating-tooltip-option small {
    display: block;
    margin-top: 4px;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.35;
}

.talent-floating-tooltip-options--apex {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
}

.talent-floating-tooltip-option.is-apex-entry {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 9px;
    cursor: default;
    background: linear-gradient(135deg, rgba(30,41,59,.82), rgba(15,23,42,.9));
    border-color: rgba(168,85,247,.34);
}

.talent-floating-tooltip-option.is-apex-entry:hover,
.talent-floating-tooltip-option.is-apex-entry:focus-visible {
    transform: none;
    border-color: rgba(168,85,247,.48);
    background: linear-gradient(135deg, rgba(30,41,59,.82), rgba(15,23,42,.9));
}

.talent-floating-tooltip-option.is-apex-entry img {
    width: 28px;
    height: 28px;
    margin-top: 1px;
}

.talent-floating-tooltip-option.is-apex-entry strong {
    color: #e9d5ff;
    font-size: 12px;
}

.talent-floating-tooltip-option.is-apex-entry small {
    margin-top: 5px;
    color: #c4b5fd;
    font-size: 11.5px;
    line-height: 1.55;
}

.talent-inspector {
    position: sticky;
    top: 78px;
    padding: 18px;
    min-height: 420px;
}

.talent-inspector-empty {
    min-height: 360px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-weight: 800;
    text-align: center;
}

.talent-inspector-head {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.talent-inspector-head h2 {
    margin: 0;
    color: #0f172a;
    font-size: 18px;
    line-height: 1.2;
    font-weight: 900;
}

#talent-inspector-meta { margin-top: 6px; color: #64748b; font-size: 12px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.talent-inspector-status { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 900; }
.talent-inspector-status--selected { background: #2563eb; }
.talent-inspector-status--available { background: #d97706; }
.talent-inspector-status--locked { background: #64748b; }
.talent-inspector-meta-text { color: #64748b; }
#talent-inspector-desc { color: #334155; font-size: 13px; line-height: 1.7; white-space: pre-wrap; }
.talent-inspector-desc-hint { color: #94a3b8 !important; font-style: italic; }

.talent-inspector-options { display: grid; gap: 8px; margin-top: 14px; }
.talent-inspector-option {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 9px;
    background: #fff;
    text-align: left;
}
.talent-inspector-option.is-active { border-color: #2563eb; background: #eff6ff; }
.talent-inspector-option img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.talent-inspector-option .talent-choice-unresolved-mark { display: inline-flex; margin-top: 0; flex: 0 0 30px; }
.talent-inspector-option strong { display: block; color: #0f172a; font-size: 13px; }
.talent-inspector-option span { display: block; color: #64748b; font-size: 11px; margin-top: 2px; }

.talent-inspector-help {
    margin-top: 18px;
    border-radius: 14px;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    color: #64748b;
    padding: 12px;
    font-size: 12px;
    line-height: 1.6;
}

.talent-toast-root { position: fixed; top: 16px; right: 16px; z-index: 1000; display: grid; gap: 8px; }
.talent-toast { padding: 10px 14px; border-radius: 12px; background: rgba(15,23,42,.94); color: #fff; font-size: 13px; font-weight: 800; box-shadow: 0 12px 30px rgba(15,23,42,.24); }

@media (max-width: 1100px) {
    .talent-sim-hero { align-items: flex-start; flex-direction: column; }
    .talent-sim-toolbar { grid-template-columns: 1fr 1fr; }
    .talent-sim-field--code { grid-column: 1 / -1; }
    .talent-sim-summary { grid-template-columns: 1fr; }
    .talent-sim-workspace { grid-template-columns: 1fr; }
    .talent-inspector { position: static; }
}

@media (max-width: 700px) {
    .talent-sim-toolbar { grid-template-columns: 1fr; }
    .talent-point-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .talent-stage-scroll { padding: 10px; }
}
