/* 職業星圖沿用圖鑑的書頁、金色與明暗模式語意色。 */
.view-toggle button[data-view="graph"] { display: flex; gap: 7px; align-items: center; padding-inline: 12px; width: auto; white-space: nowrap; }
.view-toggle button[data-view="graph"] span { font-size: 0.8rem; }
.job-atlas { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); overflow: hidden; }
.graph-tools { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; padding: 18px 20px; gap: 16px; border-bottom: 1px solid var(--line); }
.graph-search { flex: 1 1 240px; max-width: 340px; }
.graph-search label { display: block; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 6px; }
.graph-search select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 5px; padding: 8px; color: var(--text); background: var(--background); }
.graph-zoom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.graph-zoom button { min-height: 44px; min-width: 44px; border: 1px solid var(--line); border-radius: 5px; padding: 8px 12px; background: var(--surface-raised); font-size: 0.8rem; }
.graph-zoom button:hover { border-color: var(--gold); color: var(--gold); }
.graph-zoom output { color: var(--text-muted); text-align: center; min-width: 44px; font: 0.8rem monospace; }
.graph-legend { padding: 12px 20px; display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 0.8rem; color: var(--text-muted); border-bottom: 1px solid var(--line); }
.graph-legend > span { display: inline-flex; align-items: center; gap: 8px; }
.legend-line { width: 24px; border-top: 2px solid var(--gold); }
.legend-initial { width: 10px; height: 10px; border: 2px solid var(--gold); transform: rotate(45deg); }
.graph-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; }
.graph-viewport { height: 690px; overflow: auto; position: relative; background-color: var(--background); background-image: radial-gradient(var(--line) .8px, transparent .8px); background-size: 22px 22px; cursor: grab; overscroll-behavior: contain; scrollbar-width: thin; }
.graph-viewport:focus-visible { outline: 2px solid var(--gold); outline-offset: -3px; }
.graph-viewport.dragging { cursor: grabbing; user-select: none; }
.graph-stage { position: relative; margin-inline: auto; }
.graph-world { position: absolute; inset: 0 auto auto 0; transform-origin: top left; }
.graph-lines { position: absolute; inset: 0; overflow: visible; pointer-events: none; }
.graph-edge { fill: none; stroke: var(--gold); stroke-width: 1.5; opacity: .4; }
.graph-column-label { position: absolute; top: 30px; color: var(--gold); font-size: 0.86666667rem; letter-spacing: 1px; }
.graph-node { position: absolute; width: 240px; height: 104px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); display: flex; align-items: center; gap: 12px; padding: 12px; text-align: left; box-shadow: 0 5px 14px #00000012; }
.graph-node.initial { border-color: var(--gold-dark); background: var(--gold-surface); }
.graph-node:hover, .graph-node:focus-visible { border-color: var(--gold); z-index: 2; }
.graph-node strong { display: block; font: 600 1.0666667rem var(--font-title); color: var(--text); white-space: nowrap; }
.graph-node small { display: block; font-size: 0.73333333rem; color: var(--text-muted); margin-top: 5px; }
.graph-emblem { color: var(--gold); }
.graph-emblem .icon { width: 24px; height: 24px; }
.graph-world.has-selection .graph-node:not(.related) { opacity: .35; }
.graph-world.has-selection .graph-edge { opacity: .07; }
.graph-world.has-selection .graph-edge.highlight { opacity: 1; stroke-width: 3; }
.graph-world.has-selection .graph-node.chosen { border: 2px solid var(--gold); box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 18%, transparent); background: var(--gold-surface); }
.graph-inspector { border-left: 1px solid var(--line); padding: 24px 20px; max-height: 690px; overflow: auto; }
.graph-inspector h3 { font: 600 1.6rem var(--font-title); margin: 12px 0; }
.graph-inspector h4 { font-size: 0.86666667rem; margin: 24px 0 10px; }
.graph-inspector h4 span { color: var(--gold); margin-left: 6px; }
.graph-inspector p { font-size: 0.86666667rem; color: var(--text-muted); }
.graph-inspector .section-kicker { font-size: 0.66666667rem; letter-spacing: 1.3px; }
.graph-condition { white-space: pre-line; }
.graph-detail { width: 100%; min-height: 44px; font-size: 0.86666667rem; }
.graph-relations { display: flex; flex-wrap: wrap; gap: 8px; }
.graph-relations button { min-height: 44px; padding: 7px 10px; border: 1px solid var(--line); background: var(--surface-raised); border-radius: 4px; font-size: 0.8rem; text-align: left; }
.graph-relations button:hover { border-color: var(--gold); }
.graph-relations small { display: block; font-size: 0.66666667rem; color: var(--text-muted); }
.graph-totals { display: grid; grid-template-columns: auto 1fr; gap: 16px 12px; align-items: center; margin: 32px 0; }
.graph-totals strong { font: 1.8666667rem var(--font-title); color: var(--gold); }
.graph-totals span { font-size: 0.8rem; color: var(--text-muted); }
.graph-help { color: var(--text-muted); font-size: 0.8rem; margin: 0; padding: 14px 20px; border-top: 1px solid var(--line); }
@media (max-width: 1100px) {
  .graph-layout { grid-template-columns: minmax(0, 1fr); }
  .graph-inspector { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  .graph-viewport { height: 580px; }
  .graph-totals { margin: 16px 0; grid-template-columns: auto 1fr auto 1fr; }
}
@media (max-width: 580px) {
  .graph-tools { padding: 14px; gap: 12px; }
  .graph-search { max-width: none; }
  .graph-zoom { gap: 6px; }
  .graph-zoom button { padding-inline: 9px; }
  .graph-legend { padding: 12px 14px; font-size: 0.73333333rem; gap: 8px 16px; }
  .graph-viewport { height: 490px; }
  .directory-heading:has([data-view="graph"]) { flex-wrap: wrap; gap: 16px; }
}
.graph-expanded { position: fixed; inset: 12px; z-index: 25; overflow: auto; box-shadow: 0 0 0 20px var(--background); }
.graph-expanded .graph-viewport { height: calc(100dvh - 250px); min-height: 240px; }
.graph-expanded .graph-inspector { max-height: calc(100dvh - 250px); }
@media (max-width: 1100px) {
  .graph-expanded .graph-inspector { max-height: none; }
}

.legend-fixed { border-color: var(--blue); border-radius: 50%; transform: none; }
.graph-node.fixed { border-color: var(--blue); }
.graph-node.fixed .graph-emblem { color: var(--blue); }

.graph-node.item-unlocked { border-color: var(--green); }
.graph-node.item-unlocked .graph-emblem { color: var(--green); }
.legend-item { border-color: var(--green); border-radius: 2px; transform: none; }

/* 手機採直向分支閱讀；全圖保留原生觸控捲動與縮放。 */
.graph-node { user-select: none; cursor: grab; }
.graph-viewport.dragging .graph-node { cursor: grabbing; }
.graph-view-switch { display: flex; gap: 8px; flex-wrap: wrap; }
.graph-view-switch button { min-height: 44px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface-raised); }
.graph-view-switch button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-surface); color: var(--gold); }
.job-atlas[data-layout="branches"] .graph-layout,
.job-atlas[data-layout="branches"] .graph-zoom,
.job-atlas[data-layout="branches"] .graph-legend,
.job-atlas[data-layout="map"] .graph-branches { display: none; }
.graph-branches { padding: 20px; max-width: 860px; margin-inline: auto; }
.graph-branches h3 { font-family: var(--font-title); }
.graph-branches .detail-meta { color: var(--text-muted); font-size: .86666667rem; line-height: 1.7; }
.graph-branch-group h4 { display: flex; gap: 10px; margin: 16px 0 12px; }
.graph-branch-group h4 span, .graph-branch-index summary span { color: var(--gold); }
.graph-branch-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 8px; }
.graph-branch-node { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 68px; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-raised); text-align: left; }
.graph-branch-node > span:nth-child(2) { flex: 1; min-width: 0; }
.graph-branch-node strong { display: block; font-family: var(--font-title); }
.graph-branch-node small { display: block; color: var(--text-muted); margin-top: 4px; font-size: .8rem; }
.graph-branch-node:hover, .graph-branch-node:focus-visible { border-color: var(--gold); }
.graph-branch-node:active { background: var(--gold-surface); }
.graph-branch-node.current { border: 2px solid var(--gold); background: var(--gold-surface); }
.graph-branch-current { padding: 14px; border: 1px solid var(--gold); border-radius: 8px; }
.graph-branch-current .graph-condition { font-size: .93333333rem; line-height: 1.7; }
.graph-branch-arrow { text-align: center; color: var(--gold); font-size: 1.6rem; padding: 6px; }
.graph-branch-index { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-top: 12px; }
.graph-branch-index summary { min-height: 44px; padding: 12px 0; cursor: pointer; }
.graph-branch-index summary span { margin-left: 10px; }
@media (max-width: 768px) {
  .graph-tools { align-items: stretch; }
  .graph-view-switch { width: 100%; }
  .graph-view-switch button { flex: 1; }
  .graph-search { flex-basis: 100%; max-width: none; }
  .graph-search select { font-size: 16px; }
  .graph-branches { padding: 14px; }
}
