:root {
    color-scheme: light;
    --canvas: #f4f1e7;
    --canvas-deep: #ebe5d7;
    --surface: #fffdf8;
    --surface-muted: #f7f2e7;
    --ink: #2f2a25;
    --ink-soft: #6b625a;
    --ink-faint: #8d8379;
    --line: #d8d0c1;
    --line-strong: #bdb2a2;
    --header: #332f2b;
    --header-soft: #474039;
    --orange: #e4572e;
    --orange-dark: #b93e1e;
    --orange-soft: #fff0e8;
    --gold: #b67a18;
    --gold-soft: #fff5d9;
    --green: #3e765b;
    --green-soft: #eaf5ee;
    --danger: #a83232;
    --danger-soft: #fff0ef;
    --focus: #087ea4;
    --shadow: 0 10px 28px rgb(69 55 39 / 0.09);
    --shadow-high: 0 24px 70px rgb(30 24 18 / 0.22);
    --radius: 10px;
    --radius-small: 6px;
    --skill-separator: "、";
    --font-sans: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Microsoft YaHei", "PingFang SC", sans-serif;
    --font-serif: "Noto Serif SC", SimSun, "Songti SC", STSong, serif;
    font-family: var(--font-sans);
}

html:lang(zh-TW) {
    --font-sans: "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Microsoft JhengHei", "PingFang TC", sans-serif;
    --font-serif: "Noto Serif TC", "Songti TC", PMingLiU, MingLiU, serif;
}

html:lang(en-US) {
    --skill-separator: ", ";
    --font-sans: "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    --font-serif: "Noto Serif", Georgia, "Times New Roman", serif;
}

html:lang(ja-JP) {
    --font-sans: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo,
        sans-serif;
    --font-serif: "Noto Serif JP", "Yu Mincho", "Hiragino Mincho ProN", serif;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--canvas);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 92% 4%, rgb(228 87 46 / 0.09), transparent 24rem),
        linear-gradient(180deg, var(--canvas) 0%, #f8f5ed 55%, var(--canvas) 100%);
    color: var(--ink);
    line-height: 1.55;
    text-rendering: optimizeLegibility;
}

button,
input,
select {
    color: inherit;
    font: inherit;
}

button,
select {
    cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
.skill-slot:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
    outline-offset: 2px;
}

h1,
h2,
h3,
p {
    margin-block-start: 0;
}

h1,
h2,
h3 {
    line-height: 1.2;
}

.skip-link {
    position: fixed;
    z-index: 100;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.65rem 0.9rem;
    transform: translateY(-160%);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink);
}

.skip-link:focus {
    transform: none;
    box-shadow: var(--shadow-high);
}

.app-shell {
    min-height: 100vh;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 104px;
    padding: 1.25rem max(1.25rem, calc((100vw - 1500px) / 2));
    border-bottom: 4px solid var(--orange);
    background:
        linear-gradient(112deg, transparent 60%, rgb(228 87 46 / 0.13)),
        var(--header);
    color: #fffaf1;
}

.site-title {
    min-width: 0;
}

.site-header h1 {
    margin-bottom: 0;
    font-family: var(--font-serif);
    font-size: clamp(1.55rem, 3vw, 2.2rem);
    font-weight: 700;
    letter-spacing: 0.01em;
}

.language-picker {
    position: relative;
    flex: 0 0 auto;
    min-width: 9rem;
}

.language-trigger {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    justify-content: flex-start;
    padding: 0.55rem 0.75rem;
    border: 1px solid rgb(255 250 241 / 0.42);
    border-radius: var(--radius-small);
    background: #fffaf1;
    color: var(--ink);
    text-align: left;
    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        color 120ms ease;
}

.language-trigger.open {
    border-color: var(--orange);
    box-shadow: 0 0 0 2px rgb(228 87 46 / 0.2);
}

.language-options {
    position: absolute;
    z-index: 40;
    top: calc(100% + 0.35rem);
    right: 0;
    display: grid;
    width: 100%;
    min-width: 9rem;
    gap: 0.12rem;
    padding: 0.35rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    box-shadow: var(--shadow-high);
}

.language-option {
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    padding: 0.5rem 0.6rem;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    white-space: nowrap;
    transition:
        background-color 120ms ease,
        color 120ms ease;
}

.language-option:hover,
.language-option.active {
    background: var(--orange-soft);
    color: var(--orange-dark);
}

.language-option.selected {
    border-color: var(--orange);
    background: var(--orange-soft);
    color: var(--orange-dark);
}

.language-trigger[lang="en-US"],
.language-option[lang="en-US"] {
    font-family: "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
}

.language-trigger[lang="zh-CN"],
.language-option[lang="zh-CN"] {
    font-family: "Noto Sans SC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Microsoft YaHei", "PingFang SC", sans-serif;
}

.language-trigger[lang="zh-TW"],
.language-option[lang="zh-TW"] {
    font-family: "Noto Sans TC", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        "Microsoft JhengHei", "PingFang TC", sans-serif;
}

.language-trigger[lang="ja-JP"],
.language-option[lang="ja-JP"] {
    font-family: "Noto Sans JP", "Yu Gothic", "Hiragino Kaku Gothic ProN", Meiryo,
        sans-serif;
    font-weight: 450;
}

.title-ornament {
    display: block;
    width: 38px;
    height: 3px;
    margin-bottom: 0.7rem;
    border-radius: 2px;
    background: #ff9a73;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(290px, 360px) minmax(0, 1fr);
    gap: 1.5rem;
    width: min(1500px, 100%);
    margin: 0 auto;
    padding: 1.5rem;
}

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.search-panel {
    position: sticky;
    top: 1rem;
    align-self: start;
    max-height: calc(100vh - 2rem);
    padding: 1.2rem;
    overflow-y: auto;
    scrollbar-gutter: stable;
}

.node-topline,
.option-titleline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.search-panel > .field-group:first-child {
    margin-top: 0;
}

.field-group {
    min-width: 0;
    margin: 1.2rem 0 0;
    padding: 0;
    border: 0;
}

.field-group > label,
.field-label,
.field-group legend {
    display: block;
    margin-bottom: 0.48rem;
    padding: 0;
    color: var(--ink);
    font-size: 0.88rem;
    font-weight: 750;
}

.text-input,
.select-input {
    display: block;
    width: 100%;
    height: 44px;
    min-height: 44px;
    padding: 0.62rem 0.72rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: #fff;
}

.target-combobox {
    position: relative;
}

.target-input {
    padding-right: 2.2rem;
}

.target-options {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.35rem);
    right: 0;
    left: 0;
    display: grid;
    max-height: min(360px, 52vh);
    padding: 0.35rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
    background: var(--surface);
    box-shadow: var(--shadow-high);
}

.target-option {
    display: grid;
    width: 100%;
    min-height: 48px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    text-align: left;
}

.target-option strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.target-option span {
    color: var(--ink-soft);
    font-size: 0.72rem;
    white-space: nowrap;
}

.target-option:hover,
.target-option.active,
.target-option[aria-selected="true"] {
    background: var(--orange-soft);
    color: var(--orange-dark);
}

.empty-targets {
    margin: 0;
    padding: 1.2rem 0.8rem;
    color: var(--ink-soft);
    font-size: 0.8rem;
    text-align: center;
}

.text-input::placeholder {
    color: var(--ink-faint);
}

.check-row {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    min-height: 40px;
    margin-bottom: 0 !important;
    font-weight: 520 !important;
}

.check-row input {
    width: 19px;
    height: 19px;
    margin: 0;
    accent-color: var(--orange);
}

.skill-slots {
    display: grid;
    gap: 0.4rem;
    margin-top: 0.7rem;
}

.skill-slot {
    display: flex;
    width: 100%;
    height: 48px;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    padding: 0.22rem 0.36rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
    text-align: left;
}

.skill-slot.filled {
    border-left-width: 4px;
}

.skill-slot.filled[class*="kind-"] {
    border-left-color: var(--kind-color);
}

.skill-slot > div {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.32rem;
}

.skill-slot strong {
    overflow: hidden;
    font-size: 1.08rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.skill-slot.empty {
    justify-content: flex-start;
    gap: 0.45rem;
    color: var(--ink-faint);
    font-size: 1.06rem;
    line-height: 1.15;
}

.skill-slot.empty:disabled {
    opacity: 1;
}

.skill-slot .icon-button {
    width: 34px;
    height: 34px;
}

.slot-number {
    flex: 0 0 auto;
    color: var(--ink-faint);
    font-family: var(--font-sans);
    font-size: 0.86rem;
    font-variant-numeric: tabular-nums;
}

.skill-kind,
.skill-badge {
    border-radius: 3px;
    background: #eee9df;
    color: var(--ink-soft);
}

.skill-kind {
    flex: 0 0 auto;
    padding: 0.04rem 0.26rem;
    font-size: 0.83rem;
    line-height: 1.2;
}

.button,
.icon-button,
.picker-item {
    border: 0;
    transition:
        background-color 120ms ease,
        border-color 120ms ease,
        color 120ms ease,
        transform 120ms ease,
        box-shadow 120ms ease;
}

.button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.58rem 0.85rem;
    border-radius: var(--radius-small);
    font-size: 0.84rem;
    font-weight: 740;
}

.button:not(:disabled):active,
.picker-item:not(:disabled):active {
    transform: translateY(1px);
}

.search-submit:not(:disabled):active {
    transform: none;
}

.button-primary {
    background: var(--orange);
    color: white;
    box-shadow: 0 5px 12px rgb(228 87 46 / 0.24);
}

.button-primary:hover:not(:disabled) {
    background: var(--orange-dark);
}

.button-secondary {
    border: 1px solid var(--line-strong);
    background: var(--surface);
    color: var(--ink);
}

.button-secondary:hover:not(:disabled),
.button-quiet:hover:not(:disabled) {
    background: var(--orange-soft);
    color: var(--orange-dark);
}

.button-quiet {
    background: transparent;
    color: var(--ink-soft);
}

.icon-button {
    display: grid;
    flex: 0 0 auto;
    width: 40px;
    height: 40px;
    place-items: center;
    border-radius: 50%;
    background: transparent;
    color: var(--ink-soft);
    font-size: 1.28rem;
}

.icon-button:hover:not(:disabled) {
    background: var(--orange-soft);
    color: var(--orange-dark);
}

.depth-slider {
    margin-top: 0.55rem;
    padding: 0 0.15rem;
}

.depth-slider input[type="range"] {
    width: 100%;
    height: 30px;
    margin: 0;
    appearance: none;
    background: transparent;
    accent-color: var(--orange);
    cursor: pointer;
}

.depth-slider input[type="range"]::-webkit-slider-runnable-track {
    height: 5px;
    border-radius: 999px;
    background: var(--line-strong);
}

.depth-slider input[type="range"]::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
    margin-top: -8.5px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    appearance: none;
    background: var(--orange);
    box-shadow: 0 2px 7px rgb(69 55 39 / 0.25);
}

.depth-slider input[type="range"]::-moz-range-track {
    height: 5px;
    border-radius: 999px;
    background: var(--line-strong);
}

.depth-slider input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--orange);
    box-shadow: 0 2px 7px rgb(69 55 39 / 0.25);
}

.depth-ticks {
    display: flex;
    justify-content: space-between;
    padding: 0 0.23rem;
    color: var(--ink-soft);
    font-family: var(--font-sans);
    font-size: 0.67rem;
    font-weight: 700;
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.3rem;
}

.search-actions .button-primary {
    flex: 1;
}

.inline-status,
.panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    padding: 1rem;
    color: var(--ink-soft);
    font-size: 0.84rem;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--line);
    border-top-color: var(--orange);
    border-radius: 50%;
    animation: spin 700ms linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.result-panel {
    min-width: 0;
}

.result-placeholder {
    display: grid;
    min-height: 420px;
    place-items: center;
    align-content: center;
    padding: 2rem;
    color: var(--ink-soft);
    text-align: center;
}

.result-placeholder h2,
.result-placeholder h3 {
    margin: 1rem 0 0.45rem;
    color: var(--ink);
    font-family: var(--font-serif);
}

.result-placeholder p {
    max-width: 45ch;
    margin-bottom: 0;
}

.route-glyph {
    color: var(--orange);
    font-family: var(--font-sans);
    font-size: 2rem;
    letter-spacing: 0.25em;
}

.result-content {
    display: grid;
    gap: 1rem;
}

.result-summary {
    padding: 1.15rem 1.25rem;
}

.result-summary-layout {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.45rem;
    margin-left: auto;
}

.result-actions .button {
    min-height: 36px;
    padding: 0.42rem 0.68rem;
    font-size: 0.76rem;
}

.stale-notice {
    margin: 0 0 0.85rem;
    padding: 0.5rem 0.65rem;
    border-left: 3px solid var(--gold);
    background: var(--gold-soft);
    color: #704e13;
    font-size: 0.77rem;
}

.result-metrics {
    display: grid;
    min-width: min(100%, 360px);
    flex: 1 1 460px;
    grid-template-columns: minmax(0, 1fr) minmax(120px, 0.2fr);
    gap: 1rem;
}

.result-metrics > div {
    min-width: 0;
}

.result-metrics span,
.result-metrics strong {
    display: block;
}

.result-metrics span {
    margin-bottom: 0.18rem;
    color: var(--ink-soft);
    font-size: 0.7rem;
}

.result-metrics strong {
    overflow-wrap: anywhere;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

.depth-metric {
    padding-left: 1rem;
    border-left: 1px solid var(--line);
}

.count-note {
    max-width: 72ch;
    margin: 0.35rem 0 0;
    color: var(--ink-soft);
    font-size: 0.72rem;
}

.route-count {
    color: var(--orange-dark);
    font-family: var(--font-sans);
}

.tree-wrap {
    min-width: 0;
    padding: 0.25rem 0 3rem;
}

.route-tree {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.route-branch {
    position: relative;
    min-width: 0;
}

.source-tree {
    --tree-junction: 1.35rem;
    --tree-line-color: color-mix(in srgb, var(--orange) 48%, var(--line-strong));
    --tree-line-offset: 1.15rem;
    gap: 0.65rem;
    margin-top: 0.7rem;
    padding-left: 1.75rem;
}

.source-tree > .route-branch::before,
.source-tree > .route-branch::after {
    position: absolute;
    left: calc(-1 * var(--tree-line-offset));
    content: "";
    pointer-events: none;
}

.source-tree > .route-branch::before {
    top: -0.7rem;
    bottom: -0.65rem;
    border-left: 2px solid var(--tree-line-color);
}

.source-tree > .route-branch::after {
    top: var(--tree-junction);
    width: var(--tree-line-offset);
    border-top: 2px solid var(--tree-line-color);
}

.source-tree > .route-branch:last-child::before {
    bottom: auto;
    height: calc(0.7rem + var(--tree-junction));
}

.route-node {
    position: relative;
    min-width: 0;
    padding: 0.75rem 0.78rem;
    border-left-width: 4px;
}

.route-node.direct-node {
    border-left-color: var(--green);
}

.route-node.normal-node {
    border-left-color: var(--orange);
}

.route-node.special-node {
    border-left-color: var(--gold);
}

.route-node:hover {
    box-shadow: 0 12px 30px rgb(69 55 39 / 0.12);
}

.demon-heading {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.4rem;
}

.demon-heading h3 {
    margin-bottom: 0;
    font-family: var(--font-sans);
    font-size: 1.39rem;
    line-height: 1.1;
}

.demon-name {
    font-family: var(--font-sans);
}

.race-label {
    color: var(--orange-dark);
    font-size: 0.89rem;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: 0.06em;
}

.dlc-badge {
    padding-left: 0.28rem;
    border-left: 2px solid var(--gold);
    color: #725015;
    font-size: 0.83rem;
    line-height: 1.15;
    font-weight: 700;
}

.collapse-button {
    width: 36px;
    height: 36px;
}

.node-method {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.32rem;
    margin-top: 0.42rem;
    color: var(--ink-soft);
    font-size: 0.96rem;
}

.method-label {
    display: inline-flex;
    align-items: center;
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1.2;
}

.method-label.direct {
    color: var(--green);
}

.method-label.normal {
    color: var(--orange-dark);
}

.method-label.special {
    color: #755014;
}

.level-flow {
    display: inline-flex;
    align-items: center;
    gap: 0.18rem;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 700;
    line-height: 1.2;
}

.level-arrow {
    color: var(--orange);
    font-size: 1.08rem;
    font-weight: 900;
}

.state-flow {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: stretch;
    gap: 0.38rem;
    margin-top: 0.52rem;
    padding: 0.42rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface-muted);
}

.state-card {
    display: grid;
    align-content: start;
    gap: 0.1rem;
    min-width: 0;
    padding: 0.34rem 0.38rem;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 0.9rem;
    line-height: 1.2;
}

.state-card strong {
    overflow: hidden;
    color: var(--ink);
    font-size: 1.08rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.state-card-heading {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 0.35rem;
}

.state-card-heading strong {
    min-width: 0;
}

.state-label {
    color: var(--orange-dark);
    font-size: 0.82rem;
    line-height: 1.15;
    font-weight: 850;
    letter-spacing: 0.06em;
}

.state-source {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.26rem;
}

.state-arrow {
    align-self: center;
    color: var(--orange);
    font-size: 1.32rem;
    font-weight: 900;
}

.level-skills {
    display: grid;
    gap: 0.14rem;
    margin-top: 0.28rem;
    padding-top: 0.25rem;
    border-top: 1px dashed var(--line);
}

.level-skills .meta-label {
    margin-bottom: 0;
}

.level-skill {
    display: flex;
    min-width: 0;
    align-items: baseline;
    gap: 0.24rem;
    color: var(--ink);
    font-size: 0.89rem;
    line-height: 1.2;
}

.level-skill b {
    flex: 0 0 auto;
    color: var(--orange-dark);
    font-family: var(--font-sans);
    font-size: 0.83rem;
}

.skill-block {
    margin-top: 0.65rem;
}

.meta-label {
    display: block;
    margin-bottom: 0.18rem;
    color: var(--ink-soft);
    font-size: 0.88rem;
    line-height: 1.2;
    font-weight: 700;
}

.skill-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.28rem;
}

.skill-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
    padding: 0.16rem 0.36rem;
    font-size: 0.84rem;
    line-height: 1.2;
}

.skill-badge strong {
    color: var(--ink);
    font-size: 0.9rem;
}

.node-action-wrap {
    position: relative;
    margin-top: 0.52rem;
}

.node-action {
    width: 100%;
    min-height: 42px;
    padding-block: 0.36rem;
    font-size: 1.01rem;
}

.modal-backdrop {
    position: fixed;
    z-index: 30;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgb(40 34 28 / 0.5);
    backdrop-filter: blur(2px);
}

.picker-panel,
.node-options-popover {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-high);
}

.picker-panel {
    width: min(620px, 100%);
    max-height: min(780px, calc(100vh - 2rem));
}

.node-options-backdrop {
    position: fixed;
    z-index: 24;
    inset: 0;
    background: transparent;
}

.node-options-popover {
    position: absolute;
    z-index: 25;
    top: calc(100% + 0.4rem);
    right: 0;
    left: 0;
    width: auto;
    max-height: min(560px, 72vh);
}

.node-options-popover.opens-upward {
    top: auto;
    bottom: calc(100% + 0.4rem);
}

.node-options-heading {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.35rem 0.45rem 0.35rem 0.7rem;
    border-bottom: 1px solid var(--line);
}

.node-options-heading strong {
    overflow: hidden;
    font-family: var(--font-serif);
    font-size: 0.9rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.node-options-heading .icon-button {
    width: 34px;
    height: 34px;
}

.source-search {
    width: calc(100% - 0.9rem);
    flex: 0 0 auto;
    margin: 0.45rem;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-small);
}

.skill-picker-filters {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: 1.5fr 1fr;
    gap: 0.45rem;
    padding: 0.45rem;
    border-bottom: 1px solid var(--line);
}

.skill-picker-list {
    min-height: 120px;
}

.picker-item {
    min-width: 0;
    min-height: 52px;
    border: 1px solid var(--line);
    border-radius: var(--radius-small);
    background: #fff;
    text-align: left;
}

.picker-item:hover:not(:disabled) {
    border-color: var(--orange);
    background: var(--orange-soft);
    box-shadow: 0 5px 12px rgb(68 51 37 / 0.08);
}

.skill-option {
    display: flex;
    min-height: 52px;
    flex: 0 0 auto;
    align-items: center;
    padding: 0.34rem 0.5rem;
    border-left-width: 4px;
}

.skill-option[class*="kind-"] {
    border-left-color: var(--kind-color);
}

.skill-option-copy {
    display: grid;
    min-width: 0;
    line-height: 1.18;
}

.material-row > div {
    display: grid;
    min-width: 0;
    flex: 1 1 auto;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 0 0.3rem;
    line-height: 1.18;
}

.skill-option strong,
.material-row strong {
    overflow: hidden;
    font-size: 1.08rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.skill-option small,
.material-row small,
.option-content small {
    color: var(--ink-soft);
    font-size: 0.89rem;
}

.material-row small {
    white-space: nowrap;
}

.empty-list {
    grid-column: 1 / -1;
    margin: auto;
    padding: 2rem;
    color: var(--ink-soft);
    text-align: center;
}

.node-option-list {
    display: flex;
    min-height: 80px;
    flex: 1 1 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0.38rem;
    padding: 0.45rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.option-card {
    display: grid;
    min-height: 0;
    flex: 0 0 auto;
    grid-template-columns: minmax(0, 1fr) 4.5rem;
    align-items: center;
    gap: 0.34rem;
    padding: 0.3rem 0.42rem;
    border-left-width: 4px;
}

.option-card.active:not(.selected) {
    border-color: var(--line);
    background: var(--orange-soft);
    box-shadow: inset 0 0 0 1px var(--orange);
}

.option-card.selected {
    border-color: var(--line);
    background: var(--green-soft);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 45%, transparent);
}

.option-card.selected:disabled {
    cursor: default;
    opacity: 1;
}

.option-card.direct-option {
    min-height: 72px;
    border-left-color: var(--green);
}

.option-card.normal-option {
    border-left-color: var(--orange);
}

.option-card.special-option {
    border-left-color: var(--gold);
}

.option-content {
    display: grid;
    min-width: 0;
    gap: 0.18rem;
}

.option-titleline {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.36rem;
    color: var(--ink-soft);
    font-size: 0.91rem;
}

.material-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(145px, 100%), 1fr));
    gap: 0.18rem;
}

.material-entry {
    display: flex;
    min-width: 0;
    align-items: stretch;
    gap: 0.16rem;
}

.material-row {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    gap: 0.2rem;
    padding: 0.12rem 0.22rem;
    border-radius: var(--radius-small);
    background: var(--surface-muted);
}

.material-plus {
    align-self: center;
    flex: 0 0 auto;
    color: var(--orange);
    font-size: 0.94rem;
    font-weight: 800;
}

.compact-skills {
    grid-column: 1 / -1;
    margin-top: 0.04rem;
    color: var(--orange-dark);
    font-size: 0.83rem;
    line-height: 1.18;
}

.compact-skills span:not(:last-child)::after {
    content: var(--skill-separator);
    color: var(--ink-soft);
}

.option-action {
    width: 100%;
    color: var(--orange-dark);
    font-size: 0.86rem;
    line-height: 1.15;
    text-align: right;
    font-weight: 800;
    white-space: nowrap;
}

.error-notice {
    position: fixed;
    z-index: 50;
    right: max(1rem, env(safe-area-inset-right));
    bottom: max(1rem, env(safe-area-inset-bottom));
    display: grid;
    width: min(540px, calc(100vw - 2rem));
    max-height: calc(100vh - 2rem);
    gap: 0.8rem;
    padding: 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid #d7a09a;
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    background: var(--danger-soft);
    box-shadow: var(--shadow-high);
}

.error-content {
    min-width: 0;
}

.error-title {
    color: var(--danger);
    font-size: 1.02rem;
    font-weight: 650;
    line-height: 1.3;
}

.error-message {
    margin: 0.38rem 0 0;
    overflow-wrap: anywhere;
    color: #6e3434;
    font-size: 0.9rem;
    line-height: 1.5;
}

.error-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}

.error-actions .button {
    min-height: 44px;
}

.kind-physical {
    --kind-color: #835647;
}

.kind-fire {
    --kind-color: #c64229;
}

.kind-ice {
    --kind-color: #287aa3;
}

.kind-electric {
    --kind-color: #aa7a10;
}

.kind-force {
    --kind-color: #398066;
}

.kind-light {
    --kind-color: #8f741d;
}

.kind-dark {
    --kind-color: #6b4a85;
}

.kind-almighty {
    --kind-color: #50565d;
}

.kind-ailment {
    --kind-color: #8d436d;
}

.kind-recovery {
    --kind-color: #377451;
}

.kind-support {
    --kind-color: #3d628d;
}

.kind-passive,
.kind-special,
.kind-innate {
    --kind-color: #665a4f;
}

.skill-badge[class*="kind-"],
.skill-kind[class*="kind-"] {
    border: 1px solid color-mix(in srgb, var(--kind-color) 32%, transparent);
    background: color-mix(in srgb, var(--kind-color) 9%, white);
    color: var(--kind-color);
}

.no-route {
    min-height: 260px;
}

@media (max-width: 1000px) {
    .workspace {
        grid-template-columns: minmax(270px, 320px) minmax(0, 1fr);
        gap: 1rem;
        padding: 1rem;
    }
}

@media (max-width: 880px) {
    .site-header {
        min-height: 92px;
        padding: 1rem;
    }

    .workspace {
        display: block;
        padding: 0.8rem;
    }

    .search-panel {
        position: static;
        max-height: none;
        margin-bottom: 0.9rem;
        overflow: visible;
    }

    .result-placeholder {
        min-height: 300px;
    }

    .modal-backdrop {
        align-items: end;
        padding: 0;
    }

    .picker-panel {
        width: 100%;
        max-height: min(88vh, 880px);
        border-width: 1px 0 0;
        border-radius: 14px 14px 0 0;
        padding-bottom: env(safe-area-inset-bottom);
    }

}

@media (max-width: 480px) {
    .site-header {
        flex-wrap: wrap;
        gap: 0.7rem;
    }

    .site-title {
        flex: 1 1 13rem;
    }

    .language-picker {
        max-width: 100%;
        margin-left: auto;
    }

    .site-header h1 {
        font-size: 1.3rem;
    }

    .workspace {
        padding: 0.55rem;
    }

    .search-panel,
    .result-summary {
        padding: 0.85rem;
    }

    .route-node {
        padding: 0.72rem 0.68rem;
    }

    .result-actions {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    .result-actions .button {
        flex: 1 1 auto;
    }

    .result-metrics {
        grid-template-columns: 1fr;
        gap: 0.7rem;
    }

    .depth-metric {
        padding: 0.7rem 0 0;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .skill-picker-filters {
        grid-template-columns: 1fr;
    }

    .target-option {
        grid-template-columns: 1fr;
        gap: 0.05rem;
    }

    .state-flow {
        grid-template-columns: 1fr;
    }

    .state-arrow {
        justify-self: center;
        transform: rotate(90deg);
    }

    .source-tree {
        --tree-line-offset: 0.85rem;
        padding-left: 1.3rem;
    }

    .option-card {
        grid-template-columns: 1fr;
    }

    .option-action {
        justify-self: end;
    }

    .error-notice {
        right: 0.55rem;
        bottom: max(0.55rem, env(safe-area-inset-bottom));
        width: calc(100vw - 1.1rem);
        max-height: calc(100vh - 1.1rem);
        padding: 0.9rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
