.poe2-shell {
    --poe2-gold: #e7bd68;
    --poe2-blue: #6dd6ff;
    --poe2-panel: rgba(5, 14, 28, 0.84);
}

/* The planner needs more room than the site's 1180px reading column. */
.page-shell.poe2-shell {
    width: min(1760px, calc(100% - 32px));
}

.poe2-page {
    gap: clamp(1rem, 3vw, 1.6rem);
}

.poe2-hero,
.poe2-panel,
.poe2-credits {
    border: 1px solid var(--surface-edge-strong);
    border-radius: 8px;
    background: linear-gradient(145deg, rgba(231, 189, 104, 0.08), transparent 42%), var(--poe2-panel);
    box-shadow: 0 20px 45px -32px rgba(0, 0, 0, 0.9), inset 0 1px 0 var(--surface-highlight);
}

.poe2-notice {
    margin: 0;
    padding: 0.8rem 1rem;
    border-left: 4px solid var(--poe2-gold);
    background: rgba(231, 189, 104, 0.1);
    color: var(--ink-soft);
    font-weight: 750;
}

.poe2-notice--error {
    border-left-color: #fb7185;
    background: rgba(251, 113, 133, 0.1);
}

.poe2-workspace {
    --poe2-workspace-height: clamp(560px, calc(100vh - 7rem), 1100px);
    display: grid;
    grid-template-columns: minmax(240px, 290px) minmax(0, 1fr) minmax(240px, 310px);
    gap: 1rem;
    align-items: stretch;
    height: var(--poe2-workspace-height);
}

/* Side panels scroll on their own so the tree stays in view. */
.poe2-controls,
.poe2-details {
    align-content: start;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.poe2-panel-title {
    margin: 0;
    font-size: 1.15rem;
}

.poe2-more summary,
.poe2-section > summary {
    cursor: pointer;
    color: var(--ink-soft);
}

.poe2-more summary {
    font-size: 0.82rem;
    font-weight: 750;
}

.poe2-more p {
    margin: 0.5rem 0 0;
}

.poe2-section {
    padding-top: 1rem;
    border-top: 1px solid var(--surface-edge);
}

.poe2-section > summary h3 {
    display: inline;
    color: var(--ink);
    font-size: 1rem;
}

.poe2-section[open] > summary {
    margin-bottom: 0.75rem;
}

.poe2-panel {
    min-width: 0;
    padding: 1rem;
}

.poe2-panel h2,
.poe2-panel p {
    margin-top: 0;
}

.poe2-controls,
.poe2-details {
    display: grid;
    gap: 1rem;
}

.poe2-controls fieldset {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.poe2-controls label,
.poe2-search label {
    display: grid;
    gap: 0.35rem;
    color: var(--ink-soft);
    font-size: 0.82rem;
    font-weight: 850;
    text-transform: uppercase;
}

.poe2-controls select,
.poe2-search input,
.poe2-panel button {
    min-height: 44px;
    border: 1px solid var(--surface-edge-strong);
    border-radius: 6px;
    background: rgba(4, 12, 24, 0.92);
    color: var(--ink);
    font: inherit;
}

.poe2-controls select,
.poe2-search input {
    width: 100%;
    padding: 0.65rem 0.7rem;
}

.poe2-panel button {
    padding: 0.6rem 0.75rem;
    font-weight: 850;
    cursor: pointer;
}

.poe2-panel button:hover:not(:disabled),
.poe2-panel button:focus-visible:not(:disabled),
.poe2-controls select:focus-visible,
.poe2-search input:focus-visible,
.poe2-tree:focus-visible {
    outline: 3px solid rgba(109, 214, 255, 0.55);
    outline-offset: 2px;
    border-color: var(--poe2-blue);
}

.poe2-panel button:disabled,
.poe2-controls select:disabled,
.poe2-search input:disabled {
    opacity: 0.48;
    cursor: not-allowed;
}

.poe2-search,
.poe2-search > div,
.poe2-actions,
.poe2-zoom,
.poe2-totals {
    display: grid;
    gap: 0.5rem;
}

.poe2-search > div {
    grid-template-columns: minmax(0, 1fr) auto;
}

.poe2-actions {
    grid-template-columns: 1fr;
}

.poe2-totals {
    grid-template-columns: 1fr 1fr;
}

.poe2-totals span {
    padding: 0.65rem;
    border: 1px solid var(--surface-edge);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.22);
    color: var(--ink-soft);
    text-align: center;
}

.poe2-totals__estimate {
    grid-column: 1 / -1;
}

.poe2-totals strong {
    display: block;
    color: var(--poe2-gold);
    font-size: 1.25rem;
}

.poe2-help,
.poe2-node-meta {
    color: var(--muted);
    font-size: 0.86rem;
}

.poe2-tree-panel {
    position: relative;
    display: flex;
    min-height: 0;
    padding: 0;
    overflow: hidden;
}

/* Positioned by planner.js inside the tree panel; never intercepts the pointer. */
.poe2-tooltip {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: max-content;
    max-width: min(22rem, calc(100% - 16px));
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--poe2-gold);
    border-radius: 6px;
    background: rgba(5, 11, 22, 0.96);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    color: var(--ink-soft);
    font-size: 0.85rem;
    line-height: 1.4;
    pointer-events: none;
}

.poe2-tooltip[hidden] {
    display: none;
}

.poe2-tooltip__title {
    margin: 0;
    color: var(--poe2-gold);
    font-weight: 700;
}

.poe2-tooltip__meta {
    margin: 0.15rem 0 0.45rem;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    opacity: 0.8;
}

.poe2-tooltip__stats {
    display: grid;
    gap: 0.2rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.poe2-tooltip__empty {
    font-style: italic;
    opacity: 0.75;
}

.poe2-tree-toolbar {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 1;
    display: flex;
    gap: 0.4rem;
}

.poe2-panel .poe2-tree-toolbar button {
    min-width: 44px;
    padding: 0 0.8rem;
    background: rgba(5, 11, 22, 0.88);
    backdrop-filter: blur(4px);
}

.poe2-tree {
    display: block;
    flex: 1;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: radial-gradient(circle at center, rgba(231, 189, 104, 0.07), transparent 55%), var(--poe2-tile, none) repeat, #07090d;
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.poe2-tree.is-dragging {
    cursor: grabbing;
}

.poe2-edge {
    fill: none;
    stroke: rgba(168, 160, 140, 0.5);
    stroke-width: calc(var(--poe2-edge-stroke, 0.35) * 2.2);
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.poe2-edge.is-allocated {
    stroke: var(--poe2-gold);
    stroke-width: calc(var(--poe2-edge-stroke, 0.35) * 4.4);
    filter: drop-shadow(0 0 2px rgba(231, 189, 104, 0.75));
}

.poe2-tree.is-art .poe2-edge {
    stroke: #4a4436;
    stroke-width: 16;
    vector-effect: none;
}

.poe2-tree.is-art .poe2-edge.is-allocated {
    stroke: #d9ad5a;
    stroke-width: 22;
    filter: none;
}

#poe2-backdrop {
    pointer-events: none;
}

.poe2-class-art {
    opacity: 0.9;
}

.poe2-ascendancy-art {
    opacity: 0.75;
}

.poe2-node {
    --poe2-kind-fill: #15243a;
    --poe2-kind-colour: #8494aa;
    cursor: pointer;
    outline: none;
}

/* Kind colours and the inner outline persist independently of state. The
   renderer also gives each kind a distinct radius at every zoom level. */
.poe2-node.is-notable {
    --poe2-kind-fill: #805424;
    --poe2-kind-colour: #ffce70;
}

.poe2-node.is-keystone {
    --poe2-kind-fill: #853d36;
    --poe2-kind-colour: #ff998c;
}

.poe2-node.is-jewel-socket {
    --poe2-kind-fill: #176859;
    --poe2-kind-colour: #7ff5ce;
}

.poe2-node-body {
    fill: var(--poe2-kind-fill);
    stroke: var(--poe2-kind-colour);
    stroke-width: calc(var(--poe2-node-stroke, 0.4) * 1.6);
    vector-effect: non-scaling-stroke;
}

.poe2-node-kind {
    fill: none;
    stroke: var(--poe2-kind-colour);
    stroke-width: calc(var(--poe2-node-stroke, 0.4) * 1.6);
    vector-effect: non-scaling-stroke;
    pointer-events: none;
}

.poe2-node.is-ascendancy .poe2-node-body {
    stroke: #c084fc;
}

.poe2-node.is-available .poe2-node-body {
    fill: #123445;
    stroke: var(--poe2-blue);
}

.poe2-node.is-allocated .poe2-node-body,
.poe2-node.is-root .poe2-node-body {
    fill: #6d4f1d;
    stroke: var(--poe2-gold);
    stroke-width: calc(var(--poe2-node-stroke, 0.4) * 2.6);
    filter: drop-shadow(0 0 2.5px rgba(231, 189, 104, 0.8));
}

.poe2-node text {
    fill: #ffffff;
    font-size: 28px;
    font-weight: 850;
    paint-order: stroke;
    pointer-events: none;
    stroke: #050b16;
    stroke-width: 7px;
    text-anchor: middle;
}

.poe2-node-stats {
    display: grid;
    gap: 0.5rem;
    margin: 0;
    padding-left: 1.15rem;
    color: var(--ink-soft);
}

.poe2-node-stats li::marker {
    color: var(--poe2-gold);
}

.poe2-details button {
    border-color: var(--poe2-gold);
}

.poe2-detail-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
    gap: 0.5rem;
}

.poe2-details #poe2-toggle-must-have {
    border-color: #f472b6;
}

.poe2-node.is-must-have .poe2-node-body {
    stroke: #f472b6;
    stroke-width: calc(var(--poe2-node-stroke, 0.4) * 2.6);
}

/* Drawn behind the node, so allocated must-haves keep their gold body. */
.poe2-node-halo {
    fill: rgba(255, 79, 163, 0.32);
    stroke: #ff4fa3;
    stroke-width: 3px;
    vector-effect: non-scaling-stroke;
    pointer-events: none;
    animation: poe2-halo-pulse 1.8s ease-in-out infinite;
}

/* Considered passives: a quieter teal dashed ring that does not pulse. */
.poe2-node-halo.is-considered {
    fill: rgba(45, 212, 191, 0.16);
    stroke: #2dd4bf;
    stroke-dasharray: 6 4;
    animation: none;
}

@keyframes poe2-halo-pulse {
    50% {
        fill-opacity: 0.55;
        stroke-opacity: 0.6;
    }
}

@media (prefers-reduced-motion: reduce) {
    .poe2-node-halo {
        animation: none;
    }
}

/* Official art replaces the dots once the icons are legible. The body circle
   stays as the hit target and becomes the selection ring outside the frame. */
.poe2-node-art {
    display: none;
}

.poe2-tree.is-art .poe2-node-art {
    display: inline;
}

.poe2-tree.is-art .poe2-node.has-art .poe2-node-kind {
    display: none;
}

.poe2-tree.is-art .poe2-node.has-art .poe2-node-body {
    fill: transparent;
    stroke: none;
    filter: none;
}

.poe2-tree.is-art .poe2-node.has-art:hover .poe2-node-body,
.poe2-tree.is-art .poe2-node.has-art:focus-visible .poe2-node-body,
.poe2-tree.is-art .poe2-node.has-art.is-selected .poe2-node-body {
    stroke: #ffffff;
    stroke-width: 2.5px;
}

.poe2-tree.is-art .poe2-node.has-art.is-considered .poe2-node-body {
    stroke: #2dd4bf;
    stroke-width: 2px;
}

.poe2-tree.is-art .poe2-node.has-art.is-must-have .poe2-node-body {
    stroke: #ff4fa3;
    stroke-width: 2.5px;
}

.poe2-node:hover .poe2-node-body,
.poe2-node:focus-visible .poe2-node-body,
.poe2-node.is-selected .poe2-node-body {
    stroke: #ffffff;
    stroke-width: calc(var(--poe2-node-stroke, 0.4) * 3);
    filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.85));
}

.poe2-must-haves {
    display: grid;
    gap: 0.6rem;
    padding-top: 1rem;
    border-top: 1px solid var(--surface-edge);
}

.poe2-must-haves h3,
.poe2-must-haves p {
    margin: 0;
}

.poe2-must-haves h3 {
    color: var(--ink);
    font-size: 1rem;
}

.poe2-must-have-details > summary {
    cursor: pointer;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 750;
}

.poe2-must-have-details[open] > summary,
.poe2-must-have-details .poe2-must-have-list {
    margin-bottom: 0.6rem;
}

.poe2-must-have-details[hidden] {
    display: none;
}

.poe2-must-have-empty {
    color: var(--muted);
    font-size: 0.86rem;
    font-style: italic;
}

.poe2-must-have-list {
    display: grid;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.poe2-must-have-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.4rem;
}

.poe2-panel .poe2-must-have-focus {
    overflow: hidden;
    border-left: 4px solid #f472b6;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* The name gets its own row so two actions fit the narrow panel. */
.poe2-considered-details .poe2-must-have-list li {
    grid-template-columns: 1fr 1fr;
}

.poe2-panel .poe2-considered-details .poe2-must-have-focus {
    grid-column: 1 / -1;
}

.poe2-must-have-details > button {
    width: 100%;
}

.poe2-panel .poe2-considered-details .poe2-must-have-focus {
    border-left-color: #2dd4bf;
}

.poe2-details #poe2-toggle-considered {
    border-color: #2dd4bf;
}

.poe2-panel .poe2-must-have-remove {
    color: var(--ink-soft);
    font-size: 0.85rem;
}

.poe2-route-summary {
    display: grid;
    gap: 0.3rem;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--poe2-gold);
    border-radius: 6px;
    background: rgba(231, 189, 104, 0.1);
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.poe2-must-have-list[hidden],
.poe2-route-summary[hidden] {
    display: none;
}

.poe2-route-summary__title {
    color: var(--poe2-gold);
    font-weight: 850;
}

.poe2-route-summary.is-stale {
    border-color: var(--surface-edge-strong);
    background: rgba(0, 0, 0, 0.22);
    opacity: 0.85;
}

.poe2-route-summary.is-stale .poe2-route-summary__title {
    color: var(--muted);
}

.poe2-route-summary__note {
    color: var(--muted);
    font-size: 0.82rem;
}

.poe2-credits {
    padding: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.poe2-credits p {
    margin: 0.35rem 0;
}

@media (max-width: 1120px) {
    .poe2-workspace {
        grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
        grid-template-rows: var(--poe2-workspace-height) auto;
        height: auto;
    }

    .poe2-details {
        grid-column: 1 / -1;
        overflow: visible;
    }
}

@media (max-width: 760px) {
    .poe2-workspace {
        grid-template-columns: 1fr;
        grid-template-rows: none;
    }

    .poe2-controls,
    .poe2-details {
        overflow: visible;
    }

    .poe2-tree-panel {
        height: min(75vh, 640px);
    }

    .poe2-details {
        grid-column: auto;
    }
}

.poe2-bonuses {
    display: grid;
    min-width: 0;
    gap: 0.6rem;
    padding-top: 1rem;
    border-top: 1px solid var(--surface-edge);
}

.poe2-bonuses h3,
.poe2-bonuses h4,
.poe2-bonuses p {
    margin: 0;
}

.poe2-bonuses h3 {
    color: var(--ink);
    font-size: 1rem;
}

.poe2-bonus-summary,
.poe2-bonus-group {
    display: grid;
    min-width: 0;
    gap: 0.45rem;
}

.poe2-bonus-group h4 {
    color: var(--poe2-gold);
    font-size: 0.86rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.poe2-bonus-list {
    display: grid;
    min-width: 0;
    gap: 0.35rem;
    margin: 0;
    padding-left: 1.15rem;
    color: var(--ink-soft);
    font-size: 0.86rem;
}

.poe2-bonus-list li,
.poe2-bonus-text {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.poe2-bonus-count {
    margin-left: 0.4rem;
    color: var(--muted);
    white-space: nowrap;
}

.poe2-bonus-empty {
    color: var(--muted);
    font-size: 0.86rem;
    font-style: italic;
}

@media (max-width: 480px) {
    .poe2-bonus-list {
        padding-left: 1rem;
    }
}

.poe2-saved-builds,
.poe2-saved-build-form {
    display: grid;
    min-width: 0;
    gap: 0.6rem;
}

.poe2-saved-builds h3,
.poe2-saved-builds p {
    margin: 0;
}

.poe2-saved-builds h3 {
    color: var(--ink);
    font-size: 1rem;
}

.poe2-share {
    display: grid;
    gap: 0.6rem;
}

.poe2-share textarea {
    width: 100%;
    min-height: 4.5rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--surface-edge-strong);
    border-radius: 6px;
    background: rgba(5, 11, 22, 0.8);
    color: var(--ink);
    font: 0.8rem/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-transform: none;
    resize: vertical;
    word-break: break-all;
}

.poe2-share textarea:focus-visible {
    outline: 2px solid var(--poe2-gold);
    outline-offset: 1px;
}

.poe2-saved-build-form input {
    width: 100%;
    min-height: 44px;
    padding: 0.65rem 0.7rem;
    border: 1px solid var(--surface-edge-strong);
    border-radius: 6px;
    background: rgba(4, 12, 24, 0.92);
    color: var(--ink);
    font: inherit;
}

.poe2-saved-build-form input:focus-visible {
    outline: 3px solid rgba(109, 214, 255, 0.55);
    outline-offset: 2px;
    border-color: var(--poe2-blue);
}

.poe2-saved-build-actions {
    grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
}

.poe2-saved-build-status,
.poe2-saved-build-empty {
    color: var(--muted);
    font-size: 0.86rem;
}

.poe2-saved-build-status.is-error {
    color: #fb7185;
}

.poe2-saved-build-empty {
    font-style: italic;
}

.poe2-saved-build-list {
    display: grid;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.poe2-saved-build-list[hidden],
.poe2-saved-build-actions button[hidden] {
    display: none;
}

.poe2-saved-build-list li {
    display: grid;
    min-width: 0;
    gap: 0.45rem;
    padding: 0.65rem;
    border: 1px solid var(--surface-edge);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.22);
}

.poe2-saved-build-title,
.poe2-saved-build-meta {
    min-width: 0;
    overflow-wrap: anywhere;
}

.poe2-saved-build-title {
    color: var(--ink-soft);
    font-weight: 850;
}

.poe2-saved-build-meta {
    color: var(--muted);
    font-size: 0.8rem;
}

.poe2-saved-build-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.poe2-panel .poe2-saved-build-delete {
    color: #fb7185;
}

@media (max-width: 480px) {
    .poe2-saved-build-buttons {
        grid-template-columns: 1fr;
    }
}
