:root {
  --bg-0: #080f1b;
  --bg-1: #0f1f2d;
  --panel: rgba(8, 18, 29, 0.82);
  --panel-strong: rgba(6, 15, 24, 0.94);
  --panel-border: rgba(142, 204, 225, 0.28);
  --text: #e9f2ff;
  --muted: #8aa2b7;
  --accent: #4fc2be;
  --accent-2: #eda55d;
  --line: rgba(126, 215, 225, 0.35);
  --complete: #6fcf86;
  --danger: #cf7f6f;
  --rare: #f2cf7f;
  --detail-panel-width: 370px;
  --font-display: "Chakra Petch", "Noto Sans TC", sans-serif;
  --font-body: "Noto Sans TC", "Chakra Petch", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  min-height: 100%;
  color: var(--text);
  font-family: var(--font-body);
  background:
    radial-gradient(1000px 700px at 15% 18%, rgba(79, 194, 190, 0.22), transparent 62%),
    radial-gradient(850px 600px at 86% 8%, rgba(237, 165, 93, 0.22), transparent 58%),
    linear-gradient(180deg, var(--bg-0) 0%, var(--bg-1) 100%);
}

body {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 100vh;
  gap: 0.85rem;
  padding: 1rem;
  overflow: hidden;
}

.bg-ornament {
  position: fixed;
  width: 28rem;
  height: 28rem;
  border-radius: 50%;
  filter: blur(84px);
  pointer-events: none;
  z-index: -1;
}

.bg-ornament--left {
  top: -9rem;
  left: -9rem;
  background: rgba(79, 194, 190, 0.24);
}

.bg-ornament--right {
  top: -12rem;
  right: -6rem;
  background: rgba(237, 165, 93, 0.24);
}

.shell-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: end;
  gap: 0.9rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(16, 30, 44, 0.82), rgba(9, 20, 30, 0.75));
  backdrop-filter: blur(8px);
}

.brand-kicker {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--accent);
  font-family: var(--font-display);
}

h1 {
  margin: 0.18rem 0 0;
  font-size: clamp(1.2rem, 3vw, 2rem);
  line-height: 1.08;
  font-family: var(--font-display);
  letter-spacing: 0.02em;
}

.subtle {
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.domain-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.4rem;
}

.domain-tab {
  border: 1px solid rgba(129, 183, 209, 0.36);
  border-radius: 999px;
  padding: 0.42rem 0.78rem;
  background: rgba(13, 29, 45, 0.8);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
}

.domain-tab[aria-selected="true"] {
  border-color: rgba(79, 194, 190, 0.95);
  background: linear-gradient(130deg, rgba(79, 194, 190, 0.24), rgba(13, 29, 45, 0.92));
}

.control-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 0.72rem;
  align-items: flex-end;
  padding: 0.75rem 0.9rem;
  border-radius: 0.95rem;
  border: 1px solid var(--panel-border);
  background: var(--panel);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 10rem;
}

.control-group--grow {
  flex: 1 1 18rem;
}

label {
  font-size: 0.75rem;
  color: var(--muted);
}

input[type="search"],
select,
button {
  border-radius: 0.7rem;
  border: 1px solid rgba(129, 183, 209, 0.36);
  background: rgba(9, 20, 30, 0.9);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  padding: 0.48rem 0.64rem;
}

input[type="search"]:focus,
select:focus,
button:focus,
.tech-node:focus {
  outline: 2px solid rgba(79, 194, 190, 0.65);
  outline-offset: 2px;
}

.control-inline {
  display: inline-flex;
  gap: 0.42rem;
  align-items: center;
  flex-wrap: wrap;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.7rem;
  border: 1px solid rgba(129, 183, 209, 0.36);
  background: rgba(9, 20, 30, 0.9);
  color: var(--text);
  font: inherit;
  font-size: 0.84rem;
  line-height: 1;
  padding: 0.5rem 0.7rem;
  text-decoration: none;
  transition: border-color 0.18s ease, background-color 0.18s ease, color 0.18s ease;
}

.button-link:hover {
  border-color: rgba(79, 194, 190, 0.75);
  background: rgba(13, 30, 44, 0.92);
}

.button-link:focus {
  outline: 2px solid rgba(79, 194, 190, 0.65);
  outline-offset: 2px;
}

.button-link--donate {
  border-color: rgba(237, 165, 93, 0.55);
  background: rgba(37, 22, 10, 0.88);
  color: #ffd8b0;
}

.button-link--donate:hover {
  border-color: rgba(237, 165, 93, 0.9);
  background: rgba(49, 30, 13, 0.94);
}

.checkbox {
  display: inline-flex;
  gap: 0.38rem;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text);
}

.checkbox input {
  accent-color: var(--accent);
}

.status-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.65rem;
  border: 1px solid var(--panel-border);
  border-radius: 0.85rem;
  background: var(--panel);
  padding: 0.55rem 0.9rem;
}

.status-bar p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.workspace-shell {
  --detail-panel-width: 370px;
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 10px minmax(300px, var(--detail-panel-width));
  align-items: stretch;
  gap: 0;
}

.tree-shell {
  --tree-zoom: 1;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  background: var(--panel-strong);
  position: relative;
  overflow: hidden;
}

.tree-zoom-controls {
  position: absolute;
  top: 0.62rem;
  right: 0.62rem;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  border-radius: 999px;
  border: 1px solid rgba(129, 183, 209, 0.36);
  background: rgba(8, 18, 29, 0.9);
  padding: 0.24rem 0.3rem;
}

.tree-zoom-button {
  width: 1.58rem;
  height: 1.58rem;
  min-width: 1.58rem;
  border-radius: 50%;
  border: 1px solid rgba(129, 183, 209, 0.44);
  background: rgba(10, 23, 35, 0.9);
  color: var(--text);
  padding: 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  line-height: 1;
  cursor: pointer;
}

.tree-zoom-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tree-zoom-value {
  min-width: 2.8rem;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  cursor: pointer;
}

.tree-scroll {
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: auto;
  position: relative;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}

.tree-scroll.is-panning {
  cursor: grabbing;
  user-select: none;
}

.tree-scroll.is-panning * {
  cursor: grabbing !important;
}

.tree-scroll *,
.detail-relation-tree-scroll * {
  user-select: none;
  -webkit-user-select: none;
}

.tree-content {
  min-height: 100%;
  min-width: 100%;
  display: flex;
  flex-direction: column;
  gap: calc(1.05rem * var(--tree-zoom, 1));
  align-items: stretch;
  padding: calc(1rem * var(--tree-zoom, 1));
  position: relative;
}

.tree-links {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

.tree-link {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.45px;
  stroke-opacity: 0.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.14s ease, stroke-opacity 0.14s ease, stroke-width 0.14s ease;
}

.tree-link--long {
  stroke-opacity: 0.34;
}

.tree-link--optional {
  stroke-dasharray: 4 4;
}

#tree-scroll.has-selection .tree-link.is-dimmed,
.detail-relation-tree-scroll.has-selection .tree-link.is-dimmed {
  stroke-opacity: 0.08;
}

#tree-scroll.has-selection .tree-link.is-upstream,
.detail-relation-tree-scroll.has-selection .tree-link.is-upstream {
  stroke: rgba(242, 207, 127, 0.95);
  stroke-opacity: 0.95;
  stroke-width: 1.9px;
}

#tree-scroll.has-selection .tree-link.is-downstream,
.detail-relation-tree-scroll.has-selection .tree-link.is-downstream {
  stroke: rgba(111, 207, 134, 0.95);
  stroke-opacity: 0.95;
  stroke-width: 1.9px;
}

.detail-relation-tree-scroll.has-selection .tree-link.is-direct-target {
  stroke: rgba(255, 223, 130, 0.98);
  stroke-opacity: 1;
  stroke-width: 2.5px;
}

.detail-relation-tree-scroll.has-selection .tree-link.is-direct-unlock {
  stroke: rgba(134, 235, 155, 0.98);
  stroke-opacity: 1;
  stroke-width: 2.5px;
}

.tier-row {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: calc(0.62rem * var(--tree-zoom, 1));
  position: relative;
}

.tier-body {
  --slot-count: 1;
  --lane-width: calc(252px * var(--tree-zoom, 1));
  display: grid;
  grid-template-columns: repeat(var(--slot-count), minmax(var(--lane-width), var(--lane-width)));
  gap: calc(0.55rem * var(--tree-zoom, 1));
  align-items: start;
  justify-content: start;
  width: max-content;
  min-width: 100%;
}

.tier-header {
  margin: 0;
  position: sticky;
  top: 0;
  z-index: 1;
  padding: calc(0.45rem * var(--tree-zoom, 1)) calc(0.58rem * var(--tree-zoom, 1));
  border-radius: calc(0.68rem * var(--tree-zoom, 1));
  border: 1px solid rgba(129, 183, 209, 0.3);
  background: rgba(11, 24, 37, 0.95);
  font-family: var(--font-display);
  font-size: calc(0.84rem * var(--tree-zoom, 1));
  letter-spacing: 0.06em;
  text-transform: uppercase;
  width: max-content;
  min-width: calc(8rem * var(--tree-zoom, 1));
}

.tech-node {
  width: var(--lane-width);
  position: relative;
  border: 1px solid rgba(129, 183, 209, 0.3);
  border-radius: calc(0.82rem * var(--tree-zoom, 1));
  background: linear-gradient(145deg, rgba(13, 29, 45, 0.93), rgba(8, 18, 29, 0.93));
  padding: calc(0.56rem * var(--tree-zoom, 1)) calc(0.55rem * var(--tree-zoom, 1))
    calc(0.6rem * var(--tree-zoom, 1));
  cursor: pointer;
  transition:
    transform 0.14s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    opacity 0.14s ease,
    filter 0.14s ease;
}

.tech-node:hover {
  transform: translateY(-1px);
  border-color: rgba(79, 194, 190, 0.64);
  box-shadow: 0 8px 14px rgba(0, 0, 0, 0.28);
}

.tech-node.is-complete {
  border-color: rgba(111, 207, 134, 0.74);
  background: linear-gradient(145deg, rgba(16, 38, 30, 0.93), rgba(10, 24, 21, 0.93));
}

.tech-node.is-rare {
  box-shadow: inset 0 0 0 1px rgba(242, 207, 127, 0.24);
}

.tree-content.has-selection .tech-node.is-dimmed {
  opacity: 0.3;
  filter: saturate(0.35);
}

.tech-node.is-selected {
  border-color: rgba(79, 194, 190, 0.98);
  box-shadow:
    inset 0 0 0 1px rgba(79, 194, 190, 0.5),
    0 10px 18px rgba(0, 0, 0, 0.34);
}

.tech-node.is-ancestor {
  border-color: rgba(242, 207, 127, 0.9);
  box-shadow: inset 0 0 0 1px rgba(242, 207, 127, 0.3);
}

.tech-node.is-descendant {
  border-color: rgba(111, 207, 134, 0.9);
  box-shadow: inset 0 0 0 1px rgba(111, 207, 134, 0.3);
}

.pane-resizer {
  position: relative;
  width: 10px;
  cursor: col-resize;
  border-radius: 999px;
}

.pane-resizer::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: 12px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(79, 194, 190, 0.1), rgba(79, 194, 190, 0.8), rgba(79, 194, 190, 0.1));
}

.pane-resizer:focus {
  outline: 2px solid rgba(79, 194, 190, 0.7);
  outline-offset: 1px;
}

.tech-detail-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--panel-border);
  border-radius: 1rem;
  background: linear-gradient(160deg, rgba(10, 22, 34, 0.95), rgba(8, 16, 26, 0.94));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.detail-panel-header {
  padding: 0.78rem 0.84rem 0.7rem;
  border-bottom: 1px solid rgba(129, 183, 209, 0.22);
  background: rgba(10, 21, 32, 0.7);
}

#detail-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  line-height: 1.25;
}

#detail-subtitle {
  margin-top: 0.36rem;
}

.detail-content {
  min-height: 0;
  overflow: auto;
  padding: 0.78rem 0.84rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.detail-group {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.detail-label {
  margin: 0;
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-family: var(--font-display);
}

.detail-meta {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #d2e0ed;
}

.detail-list {
  margin: 0;
  padding-left: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.8rem;
  color: #d2e0ed;
}

.detail-list code {
  color: #9fd6f4;
}

.detail-inline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.32rem;
}

.detail-chip {
  border: 1px solid rgba(129, 183, 209, 0.35);
  border-radius: 999px;
  padding: 0.16rem 0.42rem;
  font-size: 0.7rem;
  color: #b4c8d9;
}

.detail-chip--choice {
  border-color: rgba(242, 207, 127, 0.6);
  color: rgba(242, 207, 127, 0.96);
}

.detail-script {
  margin: 0;
  border-radius: 0.7rem;
  border: 1px solid rgba(129, 183, 209, 0.2);
  background: rgba(7, 15, 23, 0.88);
  padding: 0.54rem 0.58rem;
  font-size: 0.74rem;
  line-height: 1.34;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #b5c5d4;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-rule-list {
  margin: 0;
  padding-left: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
}

.detail-rule-list--prereq-tree {
  gap: 0.42rem;
}

.detail-prereq-tree-item > .detail-prereq-tree-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.32rem;
}

.detail-prereq-tree-item > .detail-rule-list--prereq-tree {
  margin-top: 0.3rem;
}

.detail-rule-list--root {
  padding-left: 0;
}

.detail-rule-list--logic {
  gap: 0.42rem;
}

.detail-rule-item {
  list-style: none;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #d2e0ed;
}

.detail-rule-item code {
  color: #9fd6f4;
}

.detail-rule-kv {
  display: inline-flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.detail-rule-key {
  color: #c7d8e8;
  font-weight: 600;
}

.detail-rule-op {
  color: #90a6ba;
  font-family: var(--font-display);
  font-size: 0.7rem;
}

.detail-rule-value {
  color: #dce8f4;
  word-break: break-word;
}

.detail-rule-factor {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.36rem;
  border-radius: 999px;
  border: 1px solid rgba(129, 183, 209, 0.42);
  background: rgba(11, 24, 37, 0.85);
  color: #dce8f4;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}

.detail-rule-factor--up {
  border-color: rgba(111, 207, 134, 0.72);
  background: rgba(19, 58, 34, 0.62);
  color: rgba(150, 236, 171, 0.96);
}

.detail-rule-factor--down {
  border-color: rgba(207, 127, 111, 0.72);
  background: rgba(63, 28, 23, 0.62);
  color: rgba(241, 167, 152, 0.98);
}

.detail-rule-factor--neutral {
  border-color: rgba(129, 183, 209, 0.46);
  background: rgba(13, 29, 45, 0.86);
  color: #c9d9e8;
}

.detail-rule-item--logic-scope > .detail-rule-list {
  margin-top: 0.24rem;
}

.detail-rule-head {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.11rem 0.44rem;
  border: 1px solid rgba(129, 183, 209, 0.34);
  border-radius: 999px;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: #b8cbda;
  margin-bottom: 0.2rem;
}

.detail-rule-item--any > .detail-rule-head {
  border-color: rgba(242, 207, 127, 0.7);
  color: rgba(242, 207, 127, 0.95);
}

.detail-rule-item--all > .detail-rule-head {
  border-color: rgba(128, 193, 231, 0.64);
  color: rgba(166, 221, 250, 0.94);
}

.detail-rule-item--nor > .detail-rule-head {
  border-color: rgba(207, 127, 111, 0.72);
  color: rgba(232, 166, 154, 0.96);
}

.detail-rule-item--not > .detail-rule-head {
  border-color: rgba(207, 127, 111, 0.68);
  color: rgba(207, 127, 111, 0.95);
}

.detail-rule-meta {
  color: #90a6ba;
}

.detail-logic-raw {
  margin-top: 0.36rem;
  border-radius: 0.62rem;
  border: 1px solid rgba(129, 183, 209, 0.22);
  background: rgba(7, 15, 23, 0.78);
  overflow: hidden;
}

.detail-logic-raw summary {
  cursor: pointer;
  padding: 0.32rem 0.5rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.detail-logic-raw[open] summary {
  border-bottom: 1px solid rgba(129, 183, 209, 0.18);
}

.detail-logic-raw .detail-script {
  margin: 0;
  border: 0;
  border-radius: 0;
}

.detail-logic-extra {
  padding: 0.46rem 0.54rem 0.58rem;
}

.detail-modifier-summary {
  display: flex;
  flex-direction: column;
  gap: 0.46rem;
}

.detail-modifier-base {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.detail-modifier-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.44rem;
}

.detail-modifier-card {
  border: 1px solid rgba(129, 183, 209, 0.28);
  border-radius: 0.58rem;
  background: rgba(9, 20, 31, 0.7);
  padding: 0.44rem 0.52rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.detail-modifier-card--group {
  background: rgba(9, 20, 31, 0.76);
}

.detail-modifier-effect-row {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.32rem;
}

.detail-modifier-when {
  font-size: 0.76rem;
  line-height: 1.42;
  color: #d2e0ed;
}

.detail-modifier-when--head {
  margin: 0.02rem 0 0;
  color: #a8bed1;
}

.detail-modifier-condition-list {
  margin: 0;
  padding-left: 1.02rem;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.detail-modifier-condition {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.38;
  color: #d7e5f2;
}

.detail-modifier-extra {
  border: 1px solid rgba(129, 183, 209, 0.22);
  border-radius: 0.56rem;
  background: rgba(8, 17, 27, 0.68);
  padding: 0.38rem 0.48rem;
}

.detail-level-groups {
  display: flex;
  flex-direction: column;
  gap: 0.54rem;
}

.detail-level-group {
  border: 1px solid rgba(129, 183, 209, 0.24);
  border-radius: 0.62rem;
  background: rgba(6, 14, 22, 0.7);
  padding: 0.4rem 0.5rem;
}

.detail-level-title {
  margin: 0 0 0.34rem;
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.detail-relation-wrap {
  border: 1px solid rgba(129, 183, 209, 0.25);
  border-radius: 0.72rem;
  background: rgba(7, 15, 23, 0.78);
  padding: 0.42rem;
}

.detail-relation-tree {
  position: relative;
}

.detail-relation-tree-scroll {
  position: relative;
  min-height: 220px;
  max-height: 430px;
  overflow: auto;
  border-radius: 0.58rem;
  border: 1px solid rgba(129, 183, 209, 0.2);
  background: rgba(5, 13, 21, 0.82);
  cursor: grab;
  -webkit-overflow-scrolling: touch;
  user-select: none;
  -webkit-user-select: none;
}

.detail-relation-tree-scroll.is-panning {
  cursor: grabbing;
  user-select: none;
}

.detail-relation-tree-scroll.is-panning * {
  cursor: grabbing !important;
}

.detail-relation-tree-content {
  min-height: 100%;
  min-width: 100%;
  width: max-content;
  display: flex;
  flex-direction: column;
  gap: 0.72rem;
  align-items: stretch;
  padding: 0.62rem;
  position: relative;
}

.detail-relation-tree-links {
  z-index: 0;
}

.tier-row--mini {
  gap: 0.42rem;
}

.tier-header--mini {
  position: static;
  padding: 0.28rem 0.45rem;
  font-size: 0.72rem;
  min-width: 6.2rem;
}

.tier-body--mini {
  --lane-width: 218px;
  gap: 0.44rem;
}

.tech-node--mini {
  padding: 0.46rem 0.46rem 0.48rem;
}

.tech-node--mini .tech-icon {
  width: 34px;
  height: 34px;
}

.tech-node--mini .tech-title {
  font-size: 0.74rem;
  line-height: 1.2;
}

.tech-node--mini .tech-meta {
  margin-top: 0.14rem;
  font-size: 0.66rem;
}

.tech-node--mini .tech-tags {
  margin-top: 0.3rem;
  gap: 0.22rem;
}

.tech-node--mini .tech-tag {
  font-size: 0.62rem;
  padding: 0.06rem 0.26rem;
}

.tech-node--static {
  cursor: default;
}

.tech-node--static:hover {
  transform: none;
  border-color: rgba(129, 183, 209, 0.3);
  box-shadow: none;
}

.tech-toggle {
  position: absolute;
  top: calc(0.45rem * var(--tree-zoom, 1));
  right: calc(0.45rem * var(--tree-zoom, 1));
  width: calc(1.12rem * var(--tree-zoom, 1));
  height: calc(1.12rem * var(--tree-zoom, 1));
  border-radius: 50%;
  border: 1px solid rgba(129, 183, 209, 0.38);
  background: rgba(6, 14, 23, 0.75);
  padding: 0;
  cursor: pointer;
}

.tech-node.is-complete .tech-toggle {
  background: var(--complete);
  border-color: rgba(111, 207, 134, 0.96);
}

.tech-top {
  display: flex;
  gap: calc(0.52rem * var(--tree-zoom, 1));
  align-items: flex-start;
}

.tech-icon {
  width: calc(44px * var(--tree-zoom, 1));
  height: calc(44px * var(--tree-zoom, 1));
  border-radius: calc(0.48rem * var(--tree-zoom, 1));
  object-fit: cover;
  border: 1px solid rgba(129, 183, 209, 0.4);
  background: rgba(7, 14, 21, 0.9);
  -webkit-user-drag: none;
  user-drag: none;
}

.tech-title-wrap {
  min-width: 0;
}

.tech-title {
  margin: 0;
  font-size: calc(0.84rem * var(--tree-zoom, 1));
  line-height: 1.28;
  font-family: var(--font-display);
  word-break: break-word;
}

.tech-meta {
  margin: calc(0.2rem * var(--tree-zoom, 1)) 0 0;
  font-size: calc(0.73rem * var(--tree-zoom, 1));
  color: var(--muted);
}

.tech-tags {
  margin-top: calc(0.42rem * var(--tree-zoom, 1));
  display: flex;
  flex-wrap: wrap;
  gap: calc(0.3rem * var(--tree-zoom, 1));
}

.tech-tag {
  padding: calc(0.1rem * var(--tree-zoom, 1)) calc(0.32rem * var(--tree-zoom, 1));
  border-radius: 999px;
  font-size: calc(0.67rem * var(--tree-zoom, 1));
  letter-spacing: 0.02em;
  border: 1px solid rgba(129, 183, 209, 0.35);
  color: var(--muted);
}

.tech-tag--area {
  color: var(--accent);
  border-color: rgba(79, 194, 190, 0.6);
}

.tech-tag--rare {
  color: var(--rare);
  border-color: rgba(242, 207, 127, 0.62);
}

.tech-tag--danger {
  color: var(--danger);
  border-color: rgba(207, 127, 111, 0.62);
}

.empty-message {
  border: 1px dashed rgba(129, 183, 209, 0.34);
  border-radius: 0.85rem;
  padding: 1rem;
  color: var(--muted);
}

.tech-tooltip {
  position: fixed;
  z-index: 20;
  max-width: min(360px, calc(100vw - 1rem));
  border-radius: 0.8rem;
  border: 1px solid rgba(142, 204, 225, 0.54);
  background: rgba(8, 18, 29, 0.97);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
  padding: 0.65rem 0.72rem;
}

.tech-tooltip h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
}

.tech-tooltip p {
  margin: 0.42rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.tech-tooltip .mono {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  line-height: 1.35;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: #b5c5d4;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 960px) {
  body {
    padding: 0.8rem;
    height: auto;
    min-height: 100dvh;
    overflow: auto;
  }

  .workspace-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 0.7rem;
  }

  .tree-shell {
    min-height: 52dvh;
  }

  .pane-resizer {
    display: none;
  }

  .tech-detail-panel {
    min-height: 34dvh;
    max-height: 46dvh;
  }

  .detail-panel-header {
    position: sticky;
    top: 0;
    z-index: 2;
    backdrop-filter: blur(5px);
  }

  .shell-header {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .domain-tabs {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  body {
    padding: 0.56rem;
    gap: 0.56rem;
  }

  .control-panel {
    padding: 0.62rem 0.66rem;
  }

  .control-group,
  .control-group--grow {
    min-width: 100%;
    flex: 1 1 100%;
  }

  .control-inline {
    width: 100%;
  }

  .control-inline > button,
  .control-inline > .button-link {
    flex: 1 1 calc(50% - 0.24rem);
    min-height: 2.2rem;
    text-align: center;
  }

  .control-inline > #reset-progress {
    flex-basis: 100%;
  }

  .domain-tabs {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 0.14rem;
  }

  .domain-tab {
    white-space: nowrap;
  }

  .tree-shell {
    min-height: 58dvh;
  }

  .tree-zoom-controls {
    top: 0.52rem;
    right: 0.52rem;
  }

  .tree-zoom-button {
    width: 1.88rem;
    height: 1.88rem;
    min-width: 1.88rem;
    font-size: 1.12rem;
  }

  .tree-zoom-value {
    min-width: 3.1rem;
    font-size: 0.78rem;
  }

  .tree-content {
    padding: calc(0.66rem * var(--tree-zoom, 1));
  }

  .tier-body {
    --lane-width: calc(206px * var(--tree-zoom, 1));
  }

  .detail-content {
    padding: 0.68rem 0.68rem 0.78rem;
  }
}

@media (hover: none) {
  .tech-tooltip {
    display: none !important;
  }

  .tree-scroll,
  .detail-relation-tree-scroll {
    cursor: auto;
  }
}
