:root {
  color-scheme: dark;
  --bg: #071015;
  --ink: #0d161a;
  --panel: rgba(9, 18, 22, 0.84);
  --panel-strong: rgba(12, 23, 27, 0.94);
  --line: rgba(219, 232, 222, 0.2);
  --line-bright: rgba(224, 246, 239, 0.48);
  --text: #eef5ec;
  --muted: #9fb5b0;
  --faint: #67807b;
  --bone: #f2edd8;
  --shell: #e9e5d2;
  --shell-dim: rgba(233, 229, 210, 0.62);
  --shell-faint: rgba(233, 229, 210, 0.2);
  --soul: #8de7df;
  --soul-dim: rgba(141, 231, 223, 0.38);
  --void: #02070a;
  --void-soft: rgba(3, 9, 12, 0.78);
  --teal: #78d8cd;
  --moss: #a8c887;
  --amber: #d7a84e;
  --danger: #d67868;
  --shadow: 0 28px 72px rgba(0, 0, 0, 0.42);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 50% 20%, rgba(14, 31, 35, 0.7), transparent 42%),
    linear-gradient(90deg, rgba(2, 6, 8, 0.96), rgba(5, 12, 14, 0.9) 48%, rgba(2, 6, 8, 0.96)),
    linear-gradient(180deg, rgba(6, 14, 17, 0.96), rgba(1, 5, 7, 1)),
    var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.map-body {
  overflow: hidden;
}

.map-body .app-shell {
  height: 100vh;
  overflow: hidden;
}

.map-body .map-page {
  height: 100%;
  min-height: 0;
}

body::before {
  display: none;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 76px;
  padding: 16px 28px;
  border-bottom: 1px solid rgba(233, 229, 210, 0.18);
  background:
    linear-gradient(180deg, rgba(11, 21, 25, 0.94), rgba(3, 8, 11, 0.86)),
    rgba(5, 12, 15, 0.72);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 18px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  overflow: hidden;
  color: var(--shell);
  border: 1px solid rgba(233, 229, 210, 0.56);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.14), rgba(233, 229, 210, 0.02)),
    rgba(2, 7, 10, 0.72);
  box-shadow:
    0 0 18px rgba(141, 231, 223, 0.12),
    inset 0 0 18px rgba(141, 231, 223, 0.18);
}

.brand-mark i {
  width: 22px;
  height: 22px;
}

.brand-copy {
  display: block;
  min-width: 0;
}

.brand-mark:hover,
.brand-mark:focus-visible {
  border-color: rgba(233, 229, 210, 0.82);
  box-shadow:
    0 0 20px rgba(141, 231, 223, 0.22),
    inset 0 0 18px rgba(141, 231, 223, 0.18);
}

.brand-mark:focus-visible {
  outline: 0;
}

.brand-mark img,
.editor-title-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 42%;
}

.brand-title {
  display: block;
  overflow: hidden;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-subtitle {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link,
.ghost-link,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid rgba(233, 229, 210, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.07), rgba(233, 229, 210, 0.018)),
    rgba(3, 9, 12, 0.58);
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.nav-link:hover,
.ghost-link:hover,
.tool-button:hover,
.tree-node:hover,
.child-link:hover,
.plot-card:hover {
  border-color: rgba(233, 229, 210, 0.56);
  background:
    linear-gradient(180deg, rgba(141, 231, 223, 0.12), rgba(233, 229, 210, 0.03)),
    rgba(5, 15, 18, 0.76);
  box-shadow: 0 0 18px rgba(141, 231, 223, 0.11);
}

.nav-link:active,
.ghost-link:active,
.tool-button:active {
  transform: translateY(1px);
}

.nav-link.is-active {
  color: var(--bone);
  border-color: rgba(242, 237, 216, 0.58);
  box-shadow: inset 0 0 20px rgba(242, 237, 216, 0.08);
}

.nav-link i,
.ghost-link i,
.tool-button i,
.panel-title i {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  width: min(1500px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.workspace.map-workspace {
  grid-template-columns: 1fr;
  width: min(1720px, calc(100vw - 36px));
}

.map-page {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  height: calc(100vh - 76px);
  min-height: 520px;
  overflow: hidden;
  padding: 0;
}

.map-toolbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: grid;
  grid-template-columns: auto minmax(220px, 420px) auto;
  align-items: center;
  gap: 12px;
  width: min(1380px, calc(100% - 48px));
  margin: 0 auto;
  padding: 8px 0 12px;
  pointer-events: none;
}

.map-toolbar > * {
  pointer-events: auto;
}

.map-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}

.map-title h1 {
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.05rem;
}

.map-title span {
  color: var(--moss);
  font-size: 0.78rem;
  white-space: nowrap;
}

.map-toolbar .search-shell {
  margin: 0;
  background: rgba(5, 12, 15, 0.56);
  backdrop-filter: blur(10px);
}

.map-toolbar .tree-tools {
  justify-content: flex-end;
  padding: 0;
}

.map-scroll {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  background:
    radial-gradient(circle at 50% 24%, rgba(15, 34, 36, 0.46), transparent 42%),
    linear-gradient(90deg, rgba(1, 5, 7, 0.92), transparent 34%, transparent 66%, rgba(1, 5, 7, 0.94)),
    rgba(2, 7, 9, 0.82);
  box-shadow:
    inset 0 1px 0 rgba(233, 229, 210, 0.04),
    inset 0 0 140px rgba(0, 0, 0, 0.58);
}

.map-scroll::before {
  display: none;
}

.map-canvas {
  position: relative;
  z-index: 1;
  min-width: 100%;
  margin: 0 auto;
  transform-origin: 0 0;
  will-change: transform;
}

.map-scroll.is-dragging {
  cursor: grabbing;
}

.map-scroll.is-dragging .map-node,
.map-scroll.is-dragging .map-video-cover {
  cursor: grabbing;
}

.map-links,
.map-arrow-layer,
.map-node-layer {
  position: absolute;
  inset: 0;
}

.map-links {
  z-index: 1;
  overflow: visible;
  pointer-events: none;
}

.map-node-layer {
  z-index: 2;
  pointer-events: none;
}

.map-arrow-layer {
  z-index: 3;
  pointer-events: none;
}

.map-sibling-arrow {
  position: absolute;
  display: grid;
  place-items: center;
  width: 32px;
  height: 22px;
  transform: translate(-50%, -50%);
  color: rgba(164, 190, 184, 0.42);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1;
  text-shadow: 0 0 8px rgba(141, 231, 223, 0.08);
}

.map-sibling-arrow.is-tree-arrow-animating {
  transition:
    left 460ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 460ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 300ms ease,
    transform 460ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: left, top, opacity, transform;
}

.map-link {
  fill: none;
  stroke: rgba(38, 55, 57, 0.62);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.map-link.is-tree-link-animating {
  transition: opacity 320ms ease;
  will-change: opacity;
}

.map-link.is-tree-link-entering {
  opacity: 0;
}

.map-link-exit {
  opacity: 0.58;
}

.map-link-spine {
  stroke: rgba(48, 66, 67, 0.66);
  stroke-width: 1.1;
}

.map-node {
  position: absolute;
  display: grid;
  overflow: visible;
  color: var(--text);
  isolation: isolate;
  pointer-events: auto;
  transition:
    filter 180ms ease,
    transform 180ms ease;
}

.map-node.is-tree-animating {
  transition:
    left 460ms cubic-bezier(0.2, 0.72, 0.22, 1),
    top 460ms cubic-bezier(0.2, 0.72, 0.22, 1),
    opacity 280ms ease,
    transform 460ms cubic-bezier(0.2, 0.72, 0.22, 1),
    filter 180ms ease;
  will-change: left, top, opacity, transform;
}

.map-node.is-tree-exiting {
  pointer-events: none;
  transition:
    left 320ms cubic-bezier(0.32, 0, 0.68, 0),
    top 320ms cubic-bezier(0.32, 0, 0.68, 0),
    opacity 220ms ease,
    transform 320ms cubic-bezier(0.32, 0, 0.68, 0);
}

.map-node-exit-layer {
  z-index: 3;
  pointer-events: none;
}

.map-node-exit-layer .map-node {
  pointer-events: none;
}

.map-node::before {
  position: absolute;
  inset: -8px;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(90deg, rgba(233, 229, 210, 0.62), transparent 75%) left top / 32px 1px no-repeat,
    linear-gradient(180deg, rgba(233, 229, 210, 0.62), transparent 75%) left top / 1px 32px no-repeat,
    linear-gradient(270deg, rgba(233, 229, 210, 0.62), transparent 75%) right top / 32px 1px no-repeat,
    linear-gradient(180deg, rgba(233, 229, 210, 0.62), transparent 75%) right top / 1px 32px no-repeat,
    linear-gradient(90deg, rgba(233, 229, 210, 0.62), transparent 75%) left bottom / 32px 1px no-repeat,
    linear-gradient(0deg, rgba(233, 229, 210, 0.62), transparent 75%) left bottom / 1px 32px no-repeat,
    linear-gradient(270deg, rgba(233, 229, 210, 0.62), transparent 75%) right bottom / 32px 1px no-repeat,
    linear-gradient(0deg, rgba(233, 229, 210, 0.62), transparent 75%) right bottom / 1px 32px no-repeat;
  opacity: 0.42;
}

.map-node-parent {
  cursor: pointer;
}

.map-node:hover::before,
.map-node:focus-visible::before {
  opacity: 0.82;
}

.map-node-text {
  align-content: center;
}

.map-text-box,
.map-node-cap {
  position: relative;
  z-index: 1;
  border: 1px solid rgba(233, 229, 210, 0.28);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.08), rgba(233, 229, 210, 0.018) 42%, rgba(0, 0, 0, 0.16)),
    linear-gradient(135deg, rgba(20, 34, 39, 0.96), rgba(4, 10, 13, 0.96));
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(0, 0, 0, 0.46),
    inset 0 0 28px rgba(141, 231, 223, 0.05);
}

.map-text-box {
  display: grid;
  align-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  padding: 13px 18px;
  border-radius: 8px;
  text-align: center;
}

.map-text-box::before {
  position: absolute;
  inset: 6px;
  z-index: 0;
  pointer-events: none;
  border: 1px solid rgba(233, 229, 210, 0.14);
  border-radius: 5px;
  content: "";
}

.map-text-box > * {
  position: relative;
  z-index: 1;
}

.map-node-main .map-text-box {
  border-radius: 8px;
}

.tone-cyan .map-text-box {
  border-color: rgba(141, 231, 223, 0.62);
  background:
    linear-gradient(90deg, rgba(141, 231, 223, 0.15), transparent 18%, transparent 82%, rgba(141, 231, 223, 0.1)),
    linear-gradient(180deg, rgba(233, 229, 210, 0.08), rgba(233, 229, 210, 0.018)),
    linear-gradient(135deg, rgba(18, 50, 59, 0.98), rgba(4, 12, 16, 0.98));
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.5),
    0 0 26px rgba(141, 231, 223, 0.2),
    inset 0 0 32px rgba(141, 231, 223, 0.08);
}

.map-node-main .map-text-box,
.map-node-main .map-media-box,
.map-node-main .map-video-cover {
  border-color: rgba(141, 231, 223, 0.42);
  background-color: rgba(4, 13, 16, 0.94);
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.52),
    0 0 18px rgba(141, 231, 223, 0.1),
    inset 0 0 0 1px rgba(233, 229, 210, 0.04);
}

.tone-gold .map-text-box {
  align-content: center;
  align-items: center;
  justify-items: center;
  gap: 3px;
  padding: 10px 15px;
  text-align: center;
  border-color: rgba(215, 168, 78, 0.68);
  background:
    linear-gradient(90deg, rgba(215, 168, 78, 0.22), transparent 22%, transparent 78%, rgba(215, 168, 78, 0.14)),
    linear-gradient(180deg, rgba(233, 229, 210, 0.08), rgba(233, 229, 210, 0.018)),
    linear-gradient(135deg, rgba(56, 36, 13, 0.96), rgba(8, 10, 9, 0.98));
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(215, 168, 78, 0.18),
    inset 0 0 28px rgba(215, 168, 78, 0.08);
}

.tone-gold .map-node-eyebrow {
  color: rgba(226, 184, 104, 0.9);
}

.tone-gold .map-text-box strong {
  width: 100%;
  font-size: 0.94rem;
  text-align: center;
}

.tone-gold .map-text-box p {
  width: 100%;
  font-size: 0.7rem;
  line-height: 1.35;
  text-align: center;
  -webkit-line-clamp: 1;
}

.tone-gold .map-text-box p:empty {
  display: none;
}

.tone-red .map-text-box {
  border-color: rgba(214, 120, 104, 0.62);
  background:
    linear-gradient(90deg, rgba(214, 120, 104, 0.2), transparent 22%, transparent 78%, rgba(214, 120, 104, 0.14)),
    linear-gradient(180deg, rgba(233, 229, 210, 0.08), rgba(233, 229, 210, 0.018)),
    linear-gradient(135deg, rgba(55, 20, 20, 0.96), rgba(8, 10, 9, 0.98));
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.5),
    0 0 24px rgba(214, 120, 104, 0.16),
    inset 0 0 28px rgba(214, 120, 104, 0.08);
}

.tone-red .map-node-eyebrow {
  color: rgba(214, 120, 104, 0.88);
}

.tone-image .map-media-box {
  border-color: rgba(168, 200, 135, 0.42);
  background:
    linear-gradient(90deg, rgba(168, 200, 135, 0.12), transparent 26%, transparent 78%, rgba(168, 200, 135, 0.06)),
    linear-gradient(180deg, rgba(233, 229, 210, 0.07), rgba(233, 229, 210, 0.014) 42%, rgba(0, 0, 0, 0.17)),
    linear-gradient(135deg, rgba(16, 30, 24, 0.98), rgba(4, 10, 10, 0.98));
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.48),
    0 0 20px rgba(168, 200, 135, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 0 0 1px rgba(0, 0, 0, 0.46),
    inset 0 0 24px rgba(168, 200, 135, 0.04);
}

.tone-video .map-video-cover {
  border-color: rgba(116, 164, 196, 0.44);
  background:
    linear-gradient(90deg, rgba(116, 164, 196, 0.13), transparent 26%, transparent 78%, rgba(116, 164, 196, 0.07)),
    linear-gradient(180deg, rgba(233, 229, 210, 0.07), rgba(233, 229, 210, 0.014) 42%, rgba(0, 0, 0, 0.18)),
    linear-gradient(135deg, rgba(12, 24, 33, 0.98), rgba(4, 9, 12, 0.98));
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.48),
    0 0 20px rgba(116, 164, 196, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 0 0 1px rgba(0, 0, 0, 0.46),
    inset 0 0 24px rgba(116, 164, 196, 0.04);
}

.tone-image .map-media-head {
  border-bottom-color: rgba(168, 200, 135, 0.18);
  background:
    linear-gradient(90deg, rgba(168, 200, 135, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.03), transparent);
}

.tone-image .map-media-head span {
  color: rgba(168, 200, 135, 0.86);
}

.tone-video .map-media-head {
  border-bottom-color: rgba(116, 164, 196, 0.2);
  background:
    linear-gradient(90deg, rgba(116, 164, 196, 0.09), transparent 30%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.03), transparent);
}

.tone-video .map-media-head span {
  color: rgba(116, 164, 196, 0.9);
}

.tone-cyan.map-node::before {
  opacity: 0.7;
}

.tone-gold.map-node::before {
  opacity: 0.64;
}

.tone-red.map-node::before {
  opacity: 0.64;
}

.tone-image.map-node::before,
.tone-video.map-node::before {
  opacity: 0.55;
}

.map-node-parent:hover .map-text-box,
.map-node-parent:hover .map-media-box,
.map-node-parent:hover .map-video-cover,
.map-node:focus-visible .map-text-box,
.map-node:focus-visible .map-media-box,
.map-node:focus-visible .map-video-cover {
  border-color: rgba(233, 229, 210, 0.62);
  box-shadow:
    0 20px 42px rgba(0, 0, 0, 0.52),
    0 0 28px rgba(141, 231, 223, 0.18),
    inset 0 0 0 1px rgba(233, 229, 210, 0.08),
    inset 0 0 28px rgba(141, 231, 223, 0.08);
}

.tone-red.map-node-parent:hover .map-text-box,
.tone-red.map-node:focus-visible .map-text-box {
  border-color: rgba(235, 143, 124, 0.74);
  box-shadow:
    0 20px 42px rgba(0, 0, 0, 0.52),
    0 0 30px rgba(214, 120, 104, 0.2),
    inset 0 0 0 1px rgba(233, 229, 210, 0.08),
    inset 0 0 28px rgba(214, 120, 104, 0.1);
}

.map-node-eyebrow {
  display: block;
  overflow: hidden;
  color: rgba(141, 231, 223, 0.82);
  font-size: 0.72rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-text-box strong {
  display: block;
  overflow: hidden;
  color: var(--shell);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.02rem;
  font-weight: 800;
  line-height: 1.25;
  text-shadow:
    0 0 10px rgba(141, 231, 223, 0.14),
    0 1px 0 rgba(0, 0, 0, 0.48);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-node-cap strong {
  display: -webkit-box;
  overflow: hidden;
  color: #fff;
  font-size: 0.94rem;
  font-weight: 800;
  line-height: 1.18;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.map-text-box p {
  display: -webkit-box;
  margin: 2px 0 0;
  overflow: hidden;
  color: rgba(233, 229, 210, 0.82);
  font-size: 0.76rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.map-node-cap {
  position: absolute;
  top: -46px;
  left: 50%;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  width: max-content;
  min-width: 112px;
  max-width: 210px;
  min-height: 44px;
  padding: 6px 12px;
  border-radius: 14px;
  transform: translateX(-50%);
}

.map-node-cap .map-node-eyebrow {
  grid-column: 1 / -1;
  color: var(--amber);
}

.map-node-type {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-left: 8px;
  color: var(--bone);
}

.map-node-type i {
  width: 17px;
  height: 17px;
}

.map-media-box,
.map-video-cover {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: 34px auto;
  gap: 6px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  padding: 7px;
  border: 1px solid rgba(233, 229, 210, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.08), rgba(233, 229, 210, 0.018) 42%, rgba(0, 0, 0, 0.16)),
    linear-gradient(135deg, rgba(20, 34, 39, 0.96), rgba(4, 10, 13, 0.96));
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.48),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    inset 0 0 0 1px rgba(0, 0, 0, 0.46),
    inset 0 0 28px rgba(141, 231, 223, 0.05);
}

.map-node-parent .map-media-box,
.map-node-parent .map-video-cover {
  box-shadow:
    0 18px 38px rgba(0, 0, 0, 0.52),
    0 0 24px rgba(141, 231, 223, 0.16),
    inset 0 0 0 1px rgba(141, 231, 223, 0.12);
}

.map-media-stage img {
  display: block;
  width: 100%;
  height: 100%;
  filter: saturate(0.82) contrast(1.06) brightness(0.9);
  object-fit: cover;
  transition:
    filter 180ms ease,
    transform 220ms ease;
}

.map-video-cover {
  align-items: stretch;
  justify-items: stretch;
  color: var(--text);
  cursor: pointer;
}

.map-media-head {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 34px;
  padding: 5px 9px 6px;
  border: 0;
  border-bottom: 1px solid rgba(233, 229, 210, 0.13);
  border-radius: 0;
  background:
    linear-gradient(90deg, rgba(141, 231, 223, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.035), transparent);
  box-shadow: none;
  pointer-events: none;
}

.map-media-stage {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  align-self: start;
  min-height: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.035), transparent 32%),
    rgba(1, 6, 8, 0.7);
  box-shadow: inset 0 10px 28px rgba(0, 0, 0, 0.2);
}

.map-media-head span {
  max-width: 48px;
  overflow: hidden;
  color: rgba(141, 231, 223, 0.78);
  font-size: 0.68rem;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-media-head strong {
  overflow: hidden;
  color: rgba(233, 229, 210, 0.94);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  text-overflow: ellipsis;
  text-shadow:
    0 0 10px rgba(141, 231, 223, 0.1),
    0 1px 0 rgba(0, 0, 0, 0.54);
  white-space: nowrap;
}

.map-media-box::before,
.map-video-cover::before {
  position: absolute;
  inset: 6px;
  z-index: 2;
  pointer-events: none;
  border: 1px solid rgba(233, 229, 210, 0.14);
  border-radius: 5px;
  content: "";
}

.map-media-stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.08), transparent 22%, rgba(0, 0, 0, 0.26)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.26), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.28));
  content: "";
}

.map-video-cover .map-media-stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 50% 50%, rgba(233, 229, 210, 0.08), transparent 19%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.06), transparent 30%, rgba(0, 0, 0, 0.62)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.3), transparent 20%, transparent 80%, rgba(0, 0, 0, 0.32));
  content: "";
}

.map-media-box:hover .map-media-stage img,
.map-video-cover:hover .map-media-stage img {
  filter: saturate(0.96) contrast(1.08) brightness(1);
  transform: scale(1.025);
}

.map-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(233, 229, 210, 0.7);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(233, 229, 210, 0.16), transparent 58%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.09), rgba(233, 229, 210, 0.018)),
    rgba(2, 7, 10, 0.58);
  color: var(--shell);
  box-shadow:
    0 0 0 6px rgba(2, 7, 10, 0.26),
    0 0 18px rgba(141, 231, 223, 0.12),
    inset 0 0 16px rgba(233, 229, 210, 0.08);
  backdrop-filter: blur(4px);
  transform: translate(-50%, -50%);
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.map-play::before {
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(233, 229, 210, 0.2);
  border-radius: 50%;
  content: "";
}

.map-play i {
  width: 21px;
  height: 21px;
  margin-left: 2px;
  fill: rgba(233, 229, 210, 0.16);
}

.map-video-cover:hover .map-play {
  border-color: rgba(233, 229, 210, 0.84);
  background:
    radial-gradient(circle, rgba(141, 231, 223, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.12), rgba(233, 229, 210, 0.025)),
    rgba(2, 7, 10, 0.66);
  box-shadow:
    0 0 0 6px rgba(2, 7, 10, 0.3),
    0 0 22px rgba(141, 231, 223, 0.18),
    inset 0 0 16px rgba(141, 231, 223, 0.12);
  transform: translate(-50%, -50%) scale(1.04);
}

.map-toggle {
  position: absolute;
  right: -11px;
  bottom: -11px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(227, 237, 240, 0.2);
  border-radius: 50%;
  background: rgba(12, 22, 30, 0.88);
  color: var(--bone);
  cursor: pointer;
}

.map-toggle i {
  width: 15px;
  height: 15px;
}

.map-placeholder {
  display: grid;
  place-items: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  border: 1px dashed rgba(233, 229, 210, 0.26);
  border-radius: 8px;
  color: rgba(233, 229, 210, 0.68);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.035), rgba(0, 0, 0, 0.18)),
    rgba(2, 7, 10, 0.52);
}

.map-media-stage .map-placeholder {
  border: 0;
  border-radius: 0;
  color: rgba(233, 229, 210, 0.66);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.026), rgba(0, 0, 0, 0.18)),
    rgba(1, 6, 8, 0.45);
}

.map-placeholder i {
  width: 24px;
  height: 24px;
}

.map-empty {
  width: min(520px, calc(100vw - 40px));
  margin: 120px auto 0;
}

.workspace.editor-layout {
  grid-template-columns: minmax(260px, 330px) minmax(380px, 0.92fr) minmax(320px, 0.75fr);
}

.side-panel,
.detail-panel,
.editor-panel,
.preview-panel,
.graph-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.graph-panel {
  min-height: calc(100vh - 122px);
  overflow: hidden;
}

.graph-head {
  align-items: flex-start;
}

.panel-note {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.side-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 122px);
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.05rem;
}

.counter {
  color: var(--moss);
  font-size: 0.78rem;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 16px 0;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.24);
}

.search-shell i {
  width: 16px;
  height: 16px;
  color: var(--faint);
}

.search-shell input {
  width: 100%;
  min-height: 38px;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.tree-tools,
.editor-tools {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 12px 16px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:disabled {
  opacity: 0.32;
  cursor: default;
}

.icon-button i {
  width: 15px;
  height: 15px;
}

.tree-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 10px 16px 12px;
}

.graph-scroll {
  min-height: calc(100vh - 288px);
  overflow: auto;
  padding: 24px 26px 34px;
}

.story-tree {
  position: relative;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.story-tree .story-tree {
  margin-left: 20px;
  padding-left: 14px;
  border-left: 1px solid rgba(224, 246, 239, 0.18);
}

.tree-branch {
  min-width: 0;
}

.tree-node {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 54px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.028);
}

.tree-node.is-active {
  border-color: rgba(120, 216, 205, 0.58);
  background:
    linear-gradient(90deg, rgba(120, 216, 205, 0.16), rgba(255, 255, 255, 0.03)),
    rgba(7, 20, 23, 0.64);
  box-shadow: inset 4px 0 0 rgba(120, 216, 205, 0.72);
}

.node-title {
  display: grid;
  min-width: 0;
  padding: 7px 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.node-eyebrow {
  overflow: hidden;
  color: var(--amber);
  font-size: 0.72rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-name {
  overflow-wrap: anywhere;
  font-size: 0.94rem;
  line-height: 1.35;
}

.node-badges {
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 10px;
}

.content-badge {
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid rgba(224, 246, 239, 0.16);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.2);
}

.content-badge i {
  width: 13px;
  height: 13px;
}

.content-badge-wide {
  display: inline-flex;
  width: auto;
  min-width: 56px;
  gap: 5px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--bone);
}

.plot-forest,
.plot-children {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 22px;
  min-width: max-content;
  margin: 0;
  padding: 0;
  list-style: none;
}

.plot-forest {
  align-items: flex-start;
  justify-content: flex-start;
  padding: 8px 0 12px;
}

.plot-children {
  position: relative;
  margin-top: 34px;
  padding-top: 28px;
}

.plot-children::before {
  position: absolute;
  top: 0;
  right: 146px;
  left: 146px;
  border-top: 1px solid rgba(224, 246, 239, 0.26);
  content: "";
}

.plot-branch {
  position: relative;
  display: grid;
  justify-items: center;
  min-width: 292px;
}

.plot-children > .plot-branch::before {
  position: absolute;
  top: -28px;
  left: 50%;
  height: 28px;
  border-left: 1px solid rgba(224, 246, 239, 0.26);
  content: "";
}

.plot-branch.has-children > .plot-card::after {
  position: absolute;
  bottom: -34px;
  left: 50%;
  height: 34px;
  border-left: 1px solid rgba(224, 246, 239, 0.26);
  content: "";
}

.plot-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(152px, auto);
  width: 292px;
  min-height: 258px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(6, 16, 19, 0.9);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.34),
    inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.plot-card:hover {
  transform: translateY(-2px);
}

.plot-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  min-height: 86px;
  padding: 14px 14px 11px;
  border-bottom: 1px solid rgba(224, 246, 239, 0.14);
}

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

.plot-title-wrap h2 {
  margin: 3px 0 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.08rem;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.plot-meta {
  display: grid;
  justify-items: end;
  gap: 8px;
}

.plot-toggle {
  border-color: rgba(224, 246, 239, 0.16);
  background: rgba(0, 0, 0, 0.18);
}

.plot-card-content {
  display: grid;
  min-height: 172px;
  padding: 12px;
}

.plot-text {
  display: -webkit-box;
  max-height: 148px;
  margin: 0;
  overflow: hidden;
  color: #dbe7df;
  font-size: 0.92rem;
  line-height: 1.65;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.plot-image,
.video-cover img {
  width: 100%;
  height: 100%;
  min-height: 148px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
}

.video-cover {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 148px;
  overflow: hidden;
  border: 1px solid rgba(224, 246, 239, 0.16);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 50% 34%, rgba(120, 216, 205, 0.24), transparent 36%),
    linear-gradient(135deg, rgba(242, 237, 216, 0.1), rgba(9, 18, 22, 0.9));
  color: var(--text);
  cursor: pointer;
}

.video-cover::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 35%, rgba(0, 0, 0, 0.6));
  content: "";
}

.video-cover-fallback {
  color: rgba(242, 237, 216, 0.28);
  font-family: "Segoe UI", sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.play-chip {
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(242, 237, 216, 0.56);
  border-radius: 999px;
  background: rgba(4, 9, 11, 0.72);
  color: var(--bone);
}

.play-chip i {
  width: 15px;
  height: 15px;
}

.plot-placeholder {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 148px;
  border: 1px dashed rgba(224, 246, 239, 0.18);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
}

.plot-placeholder i {
  width: 28px;
  height: 28px;
}

.graph-empty {
  width: min(520px, 100%);
  margin: 28px auto;
}

.detail-panel {
  min-height: calc(100vh - 122px);
  padding: 24px;
  overflow: hidden auto;
}

.detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.breadcrumb {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.detail-header h1 {
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 2rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.media-panel,
.text-panel,
.children-strip,
.empty-state {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.035);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--bone);
  font-size: 0.86rem;
}

.video-shell {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid rgba(224, 246, 239, 0.16);
  border-radius: var(--radius);
  background: #020506;
}

.video-shell.compact {
  margin-top: 12px;
}

.video-shell iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.modal-open {
  overflow: hidden;
}

.video-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(10px);
}

.video-modal[hidden] {
  display: none;
}

.video-dialog {
  width: min(1120px, 100%);
  border: 1px solid var(--line-bright);
  border-radius: var(--radius);
  background: rgba(5, 12, 15, 0.96);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.58);
}

.video-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.video-dialog-head h2 {
  margin: 0;
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.1rem;
  overflow-wrap: anywhere;
}

.modal-video-shell {
  border: 0;
  border-radius: 0 0 var(--radius) var(--radius);
}

.story-image {
  display: block;
  width: 100%;
  max-height: 520px;
  object-fit: cover;
  border: 1px solid rgba(224, 246, 239, 0.16);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.24);
}

.text-panel p,
.preview-text {
  margin: 0;
  color: #d8e4dd;
  font-size: 1rem;
  line-height: 1.85;
  white-space: pre-wrap;
}

.child-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.child-link {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.22);
  cursor: pointer;
}

.empty-state {
  color: var(--muted);
}

.editor-panel,
.preview-panel {
  max-height: calc(100vh - 122px);
  overflow: hidden auto;
}

.editor-panel {
  padding: 18px;
}

.node-form {
  display: grid;
  gap: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 0.62fr;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: var(--muted);
  font-size: 0.8rem;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: 0;
  background: rgba(0, 0, 0, 0.3);
  color: var(--text);
}

.field input {
  min-height: 42px;
  padding: 9px 11px;
}

.field textarea {
  min-height: 190px;
  resize: vertical;
  padding: 11px;
  line-height: 1.65;
}

.content-mode {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.content-mode legend {
  grid-column: 1 / -1;
  margin-bottom: 1px;
  color: var(--muted);
  font-size: 0.8rem;
}

.content-mode label {
  position: relative;
}

.content-mode input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.content-mode span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.24);
  color: var(--muted);
  cursor: pointer;
}

.content-mode span i {
  width: 16px;
  height: 16px;
}

.content-mode input:checked + span {
  border-color: rgba(120, 216, 205, 0.68);
  background: rgba(120, 216, 205, 0.12);
  color: var(--text);
}

.field input:focus,
.field textarea:focus {
  border-color: rgba(120, 216, 205, 0.68);
  box-shadow: 0 0 0 3px rgba(120, 216, 205, 0.1);
}

.form-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.tool-button.danger {
  color: #ffe5df;
  border-color: rgba(214, 120, 104, 0.34);
}

.tool-button:disabled,
.nav-link:disabled {
  opacity: 0.42;
  cursor: default;
}

.editor-node {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 50px;
  padding-left: 10px;
  cursor: pointer;
  text-align: left;
}

.editor-node-title {
  pointer-events: none;
}

.preview-panel {
  padding: 18px;
}

.preview-heading {
  display: grid;
  gap: 5px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.preview-heading span {
  color: var(--amber);
  font-size: 0.78rem;
}

.preview-heading strong {
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.35rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.editor-video-cover {
  margin-top: 14px;
  cursor: default;
}

.status-line {
  color: var(--moss);
  font-size: 0.78rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .workspace,
  .workspace.editor-layout {
    grid-template-columns: 1fr;
  }

  .side-panel,
  .detail-panel,
  .editor-panel,
  .preview-panel,
  .graph-panel {
    max-height: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 14px 16px;
  }

  .top-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .workspace {
    width: min(100vw - 20px, 1500px);
    padding-top: 10px;
  }

  .map-page {
    height: calc(100vh - 132px);
    min-height: 520px;
    padding: 0;
  }

  .map-toolbar {
    position: relative;
    grid-template-columns: 1fr;
    gap: 10px;
    width: calc(100% - 20px);
    padding-bottom: 10px;
  }

  .map-title {
    justify-content: space-between;
  }

  .map-toolbar .tree-tools {
    justify-content: flex-start;
  }

  .graph-scroll {
    min-height: 0;
    padding: 18px 14px 28px;
  }

  .plot-forest,
  .plot-children {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
    gap: 16px;
  }

  .plot-children {
    margin-top: 14px;
    padding-top: 0;
    padding-left: 18px;
    border-left: 1px solid rgba(224, 246, 239, 0.2);
  }

  .plot-children::before,
  .plot-children > .plot-branch::before,
  .plot-branch.has-children > .plot-card::after {
    display: none;
  }

  .plot-branch,
  .plot-card {
    width: 100%;
    min-width: 0;
  }

  .detail-panel {
    padding: 16px;
  }

  .detail-header {
    flex-direction: column;
  }

  .detail-header h1 {
    font-size: 1.55rem;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .content-mode {
    grid-template-columns: 1fr;
  }

  .video-modal {
    padding: 10px;
  }

  .nav-link,
  .ghost-link,
  .tool-button {
    min-height: 36px;
    padding: 7px 10px;
  }
}

/* Row actions inside the directory item */
.directory-entry {
  padding-top: 0;
}

.directory-entry .row-actions {
  position: static;
  z-index: 1;
  justify-content: flex-end;
  min-height: 0;
  padding: 0;
  opacity: 1;
  pointer-events: auto;
}

.directory-panel .editor-tree-row {
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  min-height: 48px;
}

.directory-panel .editor-branch > .editor-tree {
  margin-left: 40px;
  padding-left: 16px;
}

.directory-panel .tree-level {
  display: none;
}

.directory-panel .editor-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.node-edit-button {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.node-edit-button:focus-visible {
  outline: 0;
}

.directory-panel .editor-node .node-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-entry .row-action {
  min-width: 42px;
  height: 26px;
  padding: 0 8px;
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.04), rgba(0, 0, 0, 0.12)),
    rgba(1, 6, 8, 0.34);
}

@media (max-width: 720px) {
  .directory-panel .editor-tree-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .directory-panel .editor-node {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .directory-entry .row-actions {
    justify-content: flex-start;
    padding-left: 0;
  }
}

/* Directory editor visual alignment */
.editor-workbench.directory-workbench {
  width: min(1420px, calc(100vw - 36px));
  padding-top: 18px;
}

.directory-panel.structure-panel {
  height: calc(100vh - 112px);
  border-color: rgba(233, 229, 210, 0.18);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.035), rgba(233, 229, 210, 0.008)),
    rgba(5, 12, 15, 0.88);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.directory-panel .editor-panel-head {
  padding: 15px 18px;
  border-bottom-color: rgba(233, 229, 210, 0.14);
}

.directory-panel .editor-panel-head h2 {
  color: var(--shell);
  font-size: 1rem;
  letter-spacing: 0;
}

.directory-panel .status-line {
  color: rgba(168, 200, 135, 0.9);
}

.directory-panel .editor-metrics {
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  gap: 10px;
  padding: 14px 18px;
  border-bottom-color: rgba(233, 229, 210, 0.11);
}

.directory-panel .editor-metrics span {
  min-height: 54px;
  border-color: rgba(233, 229, 210, 0.16);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.1)),
    rgba(1, 6, 8, 0.34);
  color: rgba(233, 229, 210, 0.68);
}

.directory-panel .editor-metrics strong {
  color: var(--shell);
  font-size: 1.12rem;
}

.directory-toolbar {
  padding: 13px 18px;
  border-bottom-color: rgba(233, 229, 210, 0.11);
}

.directory-toolbar .search-shell {
  border-color: rgba(233, 229, 210, 0.16);
  background: rgba(1, 6, 8, 0.42);
}

.directory-scroll {
  padding: 14px 18px 22px;
}

.directory-panel .editor-tree {
  gap: 6px;
}

.directory-panel .editor-branch > .editor-tree {
  margin: 6px 0 2px 49px;
  padding-left: 14px;
  border-left: 1px solid rgba(233, 229, 210, 0.13);
}

.directory-panel .editor-tree-row {
  grid-template-columns: 30px minmax(46px, auto) minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 44px;
}

.directory-panel .tree-toggle,
.directory-panel .tree-toggle-spacer {
  width: 30px;
  height: 38px;
}

.directory-panel .tree-toggle {
  color: rgba(233, 229, 210, 0.45);
}

.directory-panel .tree-toggle:hover {
  color: var(--shell);
  background: rgba(233, 229, 210, 0.055);
}

.directory-panel .tree-level {
  min-width: 46px;
  height: 26px;
  padding: 0 9px;
  border-color: rgba(233, 229, 210, 0.15);
  color: rgba(233, 229, 210, 0.78);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.05), rgba(0, 0, 0, 0.12)),
    rgba(2, 7, 10, 0.56);
  font-size: 0.76rem;
}

.directory-panel .editor-node {
  position: relative;
  min-height: 42px;
  padding: 8px 13px 8px 15px;
  overflow: hidden;
  border-color: rgba(233, 229, 210, 0.14);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(3, 9, 12, 0.58);
  transition:
    border-color 160ms ease,
    background 160ms ease,
    box-shadow 160ms ease;
}

.directory-panel .editor-node::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
}

.directory-panel .editor-node-text {
  border-color: rgba(215, 168, 78, 0.34);
  background:
    linear-gradient(90deg, rgba(215, 168, 78, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(15, 11, 6, 0.58);
}

.directory-panel .editor-node-text::before {
  background: rgba(215, 168, 78, 0.82);
}

.directory-panel .editor-node-image {
  border-color: rgba(168, 200, 135, 0.34);
  background:
    linear-gradient(90deg, rgba(168, 200, 135, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(7, 16, 12, 0.6);
}

.directory-panel .editor-node-image::before {
  background: rgba(168, 200, 135, 0.82);
}

.directory-panel .editor-node-video {
  border-color: rgba(116, 164, 196, 0.36);
  background:
    linear-gradient(90deg, rgba(116, 164, 196, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(6, 13, 18, 0.62);
}

.directory-panel .editor-node-video::before {
  background: rgba(116, 164, 196, 0.86);
}

.directory-panel .editor-node:hover {
  border-color: rgba(233, 229, 210, 0.44);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.07), rgba(0, 0, 0, 0.1)),
    rgba(6, 15, 18, 0.82);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(233, 229, 210, 0.035);
}

.directory-panel .editor-node.is-active {
  border-color: rgba(141, 231, 223, 0.56);
  box-shadow:
    0 0 20px rgba(141, 231, 223, 0.12),
    inset 0 0 0 1px rgba(141, 231, 223, 0.08);
}

.directory-panel .editor-node-text.is-active {
  background:
    linear-gradient(90deg, rgba(215, 168, 78, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(0, 0, 0, 0.12)),
    rgba(15, 11, 6, 0.66);
}

.directory-panel .editor-node-image.is-active {
  background:
    linear-gradient(90deg, rgba(168, 200, 135, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(0, 0, 0, 0.12)),
    rgba(7, 16, 12, 0.68);
}

.directory-panel .editor-node-video.is-active {
  background:
    linear-gradient(90deg, rgba(116, 164, 196, 0.17), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(0, 0, 0, 0.12)),
    rgba(6, 13, 18, 0.7);
}

.directory-panel .editor-node .node-name {
  color: var(--shell);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 650;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.row-actions {
  gap: 7px;
}

.row-action {
  width: 32px;
  height: 32px;
  border-color: rgba(233, 229, 210, 0.14);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.04), rgba(0, 0, 0, 0.1)),
    rgba(1, 6, 8, 0.36);
  color: rgba(233, 229, 210, 0.62);
  font-size: 0.78rem;
  font-weight: 700;
}

.row-action-label {
  line-height: 1;
}

.row-action:hover {
  border-color: rgba(141, 231, 223, 0.44);
  background: rgba(141, 231, 223, 0.09);
  color: var(--shell);
  box-shadow: none;
}

.row-action:disabled {
  opacity: 0.28;
  cursor: default;
}

.row-action:disabled:hover {
  border-color: rgba(233, 229, 210, 0.14);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.04), rgba(0, 0, 0, 0.1)),
    rgba(1, 6, 8, 0.36);
  color: rgba(233, 229, 210, 0.62);
}

.row-action-danger {
  color: rgba(255, 217, 211, 0.72);
}

.row-action-danger:hover {
  border-color: rgba(214, 120, 104, 0.48);
  background: rgba(214, 120, 104, 0.1);
  color: #ffe5df;
}

.editor-dialog {
  border-color: rgba(233, 229, 210, 0.2);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(233, 229, 210, 0.01)),
    rgba(5, 12, 15, 0.98);
}

.editor-dialog-head {
  border-bottom-color: rgba(233, 229, 210, 0.14);
}

.editor-dialog-head h2 {
  color: var(--shell);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
}

.editor-dialog .field input,
.editor-dialog .field textarea {
  border-color: rgba(233, 229, 210, 0.16);
  background: rgba(1, 6, 8, 0.5);
}

.editor-dialog .content-mode span {
  border-color: rgba(233, 229, 210, 0.15);
  background: rgba(1, 6, 8, 0.42);
}

.editor-dialog .content-mode input[value="text"]:checked + span {
  border-color: rgba(215, 168, 78, 0.62);
  background: rgba(215, 168, 78, 0.12);
}

.editor-dialog .content-mode input[value="image"]:checked + span {
  border-color: rgba(168, 200, 135, 0.62);
  background: rgba(168, 200, 135, 0.12);
}

.editor-dialog .content-mode input[value="video"]:checked + span {
  border-color: rgba(116, 164, 196, 0.64);
  background: rgba(116, 164, 196, 0.12);
}

@media (max-width: 720px) {
  .directory-panel .editor-tree-row {
    grid-template-columns: 28px minmax(42px, auto) minmax(0, 1fr);
  }

  .directory-panel .editor-node {
    min-height: 40px;
  }
}

.editor-body {
  background:
    linear-gradient(180deg, rgba(10, 18, 19, 0.92), rgba(4, 8, 10, 1)),
    var(--bg);
}

.editor-locked .app-shell {
  display: none;
}

.editor-auth {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 28px;
  background:
    radial-gradient(circle at 50% 24%, rgba(141, 231, 223, 0.1), transparent 34%),
    linear-gradient(180deg, rgba(10, 18, 19, 0.92), rgba(4, 8, 10, 1)),
    var(--bg);
}

.editor-auth-card {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid rgba(233, 229, 210, 0.22);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(233, 229, 210, 0.014)),
    rgba(5, 12, 15, 0.96);
  box-shadow: var(--shadow);
}

.editor-auth-mark {
  width: 58px;
  height: 58px;
}

.editor-auth-copy {
  display: grid;
  gap: 5px;
  text-align: center;
}

.editor-auth-copy p {
  margin: 0;
  color: var(--moss);
  font-size: 0.78rem;
  font-weight: 800;
}

.editor-auth-copy h1 {
  margin: 0;
  color: var(--shell);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.28rem;
  line-height: 1.25;
}

.editor-auth-field {
  width: 100%;
}

.editor-auth-error {
  min-height: 18px;
  margin: -4px 0 0;
  color: #ffe5df;
  font-size: 0.78rem;
  text-align: center;
}

.editor-auth-submit {
  width: 100%;
}

.editor-workbench {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(460px, 1fr);
  gap: 14px;
  align-items: start;
  width: min(1640px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 16px 0 28px;
}

.structure-panel,
.editor-compose {
  min-width: 0;
  border: 1px solid rgba(219, 232, 222, 0.16);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01)),
    rgba(8, 15, 17, 0.86);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(16px);
}

.structure-panel {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 108px);
  overflow: hidden;
}

.editor-compose {
  max-height: calc(100vh - 108px);
  overflow: auto;
  padding: 0;
}

.editor-panel-head {
  padding: 14px;
}

.editor-panel-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.editor-panel-head h2 {
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
}

.editor-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(219, 232, 222, 0.1);
}

.editor-metrics span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid rgba(219, 232, 222, 0.12);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}

.editor-metrics strong {
  color: var(--bone);
  font-size: 1.05rem;
  line-height: 1;
}

.editor-search {
  margin: 0 14px 12px;
}

.editor-file-tools {
  padding: 0 14px 12px;
}

.editor-file-tools .tool-button {
  flex: 1 1 86px;
  min-width: 0;
}

.editor-tree-scroll {
  padding: 4px 10px 14px;
}

.editor-tree.story-tree,
.editor-tree .editor-tree {
  gap: 5px;
  margin: 0;
  padding: 0;
  border-left: 0;
}

.editor-branch > .editor-tree {
  margin: 5px 0 2px 41px;
  padding-left: 13px;
  border-left: 1px solid rgba(120, 216, 205, 0.22);
}

.editor-tree-row {
  display: grid;
  grid-template-columns: 28px 30px minmax(0, 1fr);
  gap: 4px;
  align-items: center;
  padding-left: 0;
}

.tree-toggle,
.tree-toggle-spacer {
  width: 28px;
  height: 40px;
}

.tree-toggle {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.tree-toggle:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
}

.tree-toggle i {
  width: 16px;
  height: 16px;
}

.tree-level {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(219, 232, 222, 0.14);
  border-radius: 50%;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.72rem;
  line-height: 1;
}

.tree-level-0 {
  color: var(--bone);
  border-color: rgba(215, 168, 78, 0.42);
  background: rgba(215, 168, 78, 0.1);
}

.tree-level-1 {
  color: var(--moss);
  border-color: rgba(168, 200, 135, 0.36);
  background: rgba(168, 200, 135, 0.09);
}

.tree-level-2 {
  color: var(--soul);
  border-color: rgba(120, 216, 205, 0.34);
  background: rgba(120, 216, 205, 0.08);
}

.editor-node {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 46px;
  padding: 6px 8px 6px 10px;
  border-color: rgba(219, 232, 222, 0.08);
  background: rgba(255, 255, 255, 0.025);
}

.editor-node:hover {
  border-color: rgba(168, 200, 135, 0.45);
  background: rgba(168, 200, 135, 0.08);
  box-shadow: none;
}

.editor-node.is-active {
  border-color: rgba(120, 216, 205, 0.62);
  background:
    linear-gradient(90deg, rgba(120, 216, 205, 0.16), rgba(255, 255, 255, 0.035)),
    rgba(7, 20, 23, 0.7);
  box-shadow:
    inset 3px 0 0 rgba(120, 216, 205, 0.8),
    0 8px 24px rgba(0, 0, 0, 0.18);
}

.editor-node.is-search-hit:not(.is-active) {
  border-color: rgba(215, 168, 78, 0.48);
}

.editor-node-title {
  padding: 4px 0;
}

.editor-node .node-eyebrow {
  color: rgba(168, 200, 135, 0.95);
}

.editor-node .node-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.editor-node .content-badge,
.child-icon {
  border-radius: var(--radius);
  color: var(--soul);
  background: rgba(120, 216, 205, 0.08);
}

.child-count-pill {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(219, 232, 222, 0.12);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.72rem;
}

.selected-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(219, 232, 222, 0.14);
  background: rgba(255, 255, 255, 0.018);
}

.selected-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.selected-copy h1 {
  margin: 0;
  font-family: inherit;
  font-size: clamp(1.2rem, 1.7vw, 1.55rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-height: 24px;
  color: var(--faint);
  font-size: 0.78rem;
}

.breadcrumb button {
  max-width: 150px;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.breadcrumb button:hover,
.breadcrumb button.is-current {
  color: var(--bone);
}

.breadcrumb-divider {
  color: rgba(219, 232, 222, 0.28);
}

.selected-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(120, 216, 205, 0.3);
  border-radius: 999px;
  color: var(--soul);
  background: rgba(120, 216, 205, 0.08);
  font-size: 0.82rem;
}

.selected-chip i {
  width: 16px;
  height: 16px;
}

.editor-compose .node-form {
  gap: 18px;
  padding: 18px;
}

.form-section {
  display: grid;
  gap: 13px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(219, 232, 222, 0.1);
}

.form-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--bone);
}

.section-title h2 {
  margin: 0;
  font-family: inherit;
  font-size: 0.95rem;
}

.section-title i {
  width: 17px;
  height: 17px;
  color: var(--moss);
}

.editor-compose .field span,
.editor-compose .content-mode legend {
  color: rgba(159, 181, 176, 0.92);
  font-size: 0.78rem;
}

.editor-compose .field input,
.editor-compose .field textarea {
  border-color: rgba(219, 232, 222, 0.14);
  background: rgba(1, 5, 7, 0.42);
}

.media-fields {
  display: grid;
  gap: 12px;
}

.editor-compose .content-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-compose .content-mode span {
  min-height: 40px;
  background: rgba(1, 5, 7, 0.34);
}

.editor-compose .content-mode input:checked + span {
  border-color: rgba(168, 200, 135, 0.65);
  background: rgba(168, 200, 135, 0.12);
}

.editor-compose .form-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  padding-top: 0;
}

.editor-compose .form-actions .tool-button {
  min-width: 0;
  white-space: nowrap;
}

.editor-empty-state {
  display: grid;
  place-items: center;
  min-height: 84px;
  padding: 18px;
  border: 1px dashed rgba(219, 232, 222, 0.16);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(0, 0, 0, 0.12);
  text-align: center;
}

@media (max-width: 1120px) {
  .editor-workbench {
    grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .editor-workbench {
    grid-template-columns: 1fr;
    width: min(100vw - 22px, 1640px);
    padding-top: 12px;
  }

  .structure-panel,
  .editor-compose {
    position: static;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .editor-tree-scroll {
    max-height: 52vh;
  }

  .selected-bar {
    flex-direction: column;
  }

  .editor-compose .form-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .editor-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .editor-compose .content-mode,
  .editor-compose .form-actions {
    grid-template-columns: 1fr;
  }

  .editor-tree-row {
    grid-template-columns: 26px 28px minmax(0, 1fr);
  }

  .editor-branch > .editor-tree {
    margin-left: 34px;
    padding-left: 10px;
  }
}

.editor-workbench.directory-workbench {
  grid-template-columns: 1fr;
  width: min(1320px, calc(100vw - 32px));
}

.directory-panel.structure-panel {
  position: static;
  height: calc(100vh - 108px);
  min-height: 620px;
}

.directory-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(219, 232, 222, 0.1);
}

.directory-toolbar .editor-search,
.directory-toolbar .editor-file-tools {
  margin: 0;
  padding: 0;
}

.directory-toolbar .editor-file-tools {
  justify-content: flex-end;
}

.directory-scroll {
  padding: 12px 14px 20px;
}

.directory-panel .editor-tree {
  gap: 7px;
}

.directory-panel .editor-branch > .editor-tree {
  margin: 7px 0 3px 52px;
  padding-left: 15px;
  border-left: 1px solid rgba(224, 246, 239, 0.2);
}

.directory-panel .editor-tree-row {
  display: grid;
  grid-template-columns: 32px minmax(42px, auto) minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.directory-panel .tree-toggle,
.directory-panel .tree-toggle-spacer {
  width: 32px;
  height: 42px;
}

.directory-panel .tree-level {
  width: auto;
  min-width: 42px;
  height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: rgba(242, 237, 216, 0.9);
  background: rgba(0, 0, 0, 0.22);
  font-variant-numeric: tabular-nums;
}

.directory-panel .editor-node {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 44px;
  padding: 9px 13px;
  border-color: rgba(219, 232, 222, 0.1);
  text-align: left;
  box-shadow: none;
}

.directory-panel .editor-node-text {
  background:
    linear-gradient(90deg, rgba(168, 200, 135, 0.15), rgba(255, 255, 255, 0.025)),
    rgba(8, 18, 15, 0.76);
}

.directory-panel .editor-node-image {
  background:
    linear-gradient(90deg, rgba(120, 216, 205, 0.16), rgba(255, 255, 255, 0.025)),
    rgba(5, 17, 19, 0.76);
}

.directory-panel .editor-node-video {
  background:
    linear-gradient(90deg, rgba(215, 168, 78, 0.18), rgba(255, 255, 255, 0.025)),
    rgba(22, 16, 7, 0.76);
}

.directory-panel .editor-node.is-active {
  border-color: rgba(242, 237, 216, 0.58);
  box-shadow:
    inset 3px 0 0 rgba(242, 237, 216, 0.74),
    0 8px 22px rgba(0, 0, 0, 0.18);
}

.directory-panel .editor-node .node-name {
  display: block;
  overflow: hidden;
  width: 100%;
  font-size: 0.96rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.row-action {
  width: 34px;
  height: 34px;
  border-color: rgba(219, 232, 222, 0.16);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.16);
}

.row-action:hover {
  border-color: rgba(120, 216, 205, 0.5);
  background: rgba(120, 216, 205, 0.1);
}

.row-action i {
  width: 16px;
  height: 16px;
}

.editor-modal-open {
  overflow: hidden;
}

.editor-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 22px;
}

.editor-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(8px);
}

.editor-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 0;
  width: min(760px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 34px));
  overflow: auto;
  border: 1px solid rgba(219, 232, 222, 0.2);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    rgba(8, 15, 17, 0.96);
  box-shadow: 0 30px 82px rgba(0, 0, 0, 0.54);
}

.editor-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid rgba(219, 232, 222, 0.14);
}

.editor-dialog-head h2 {
  margin: 6px 0 0;
  font-size: 1.25rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.clear-confirm-dialog {
  width: min(460px, calc(100vw - 28px));
  gap: 16px;
  padding: 22px;
  overflow: visible;
}

.clear-confirm-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(214, 120, 104, 0.34);
  border-radius: 12px;
  background: rgba(214, 120, 104, 0.12);
  color: #ffd7cf;
}

.clear-confirm-icon i {
  width: 22px;
  height: 22px;
}

.clear-confirm-kicker {
  margin: 0 0 6px;
  color: #d67868;
  font-size: 0.78rem;
  font-weight: 800;
}

.clear-confirm-dialog h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.3;
}

.clear-confirm-copy {
  margin: 10px 0 0;
  color: rgba(219, 232, 222, 0.72);
  line-height: 1.65;
}

.clear-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 4px;
}

.editor-dialog .node-form {
  gap: 18px;
  padding: 18px;
}

.editor-dialog .section-title h3 {
  margin: 0;
  font-size: 0.95rem;
}

.editor-dialog .field span,
.editor-dialog .content-mode legend {
  color: rgba(159, 181, 176, 0.92);
  font-size: 0.78rem;
}

.editor-dialog .field input,
.editor-dialog .field textarea {
  border-color: rgba(219, 232, 222, 0.14);
  background: rgba(1, 5, 7, 0.42);
}

.editor-dialog .content-mode {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.editor-dialog .content-mode span {
  min-height: 40px;
  background: rgba(1, 5, 7, 0.34);
}

.editor-dialog .content-mode input:checked + span {
  border-color: rgba(168, 200, 135, 0.65);
  background: rgba(168, 200, 135, 0.12);
}

.editor-dialog .form-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.editor-dialog .form-actions .tool-button {
  min-width: 0;
}

@media (max-width: 720px) {
  .editor-workbench.directory-workbench {
    width: min(100vw - 18px, 1320px);
  }

  .directory-panel.structure-panel {
    height: auto;
    min-height: 0;
  }

  .directory-toolbar {
    grid-template-columns: 1fr;
  }

  .directory-toolbar .editor-file-tools {
    justify-content: stretch;
  }

  .directory-panel .editor-tree-row {
    grid-template-columns: 28px minmax(36px, auto) minmax(0, 1fr);
  }

  .directory-panel .editor-branch > .editor-tree {
    margin-left: 43px;
    padding-left: 10px;
  }

  .row-actions {
    grid-column: 3;
    justify-content: flex-end;
  }

  .editor-dialog .field-grid,
  .editor-dialog .content-mode,
  .editor-dialog .form-actions {
    grid-template-columns: 1fr;
  }

  .clear-confirm-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Final directory editor overrides: keep these after legacy editor rules. */
.editor-workbench.directory-workbench {
  grid-template-columns: 1fr;
  width: min(1420px, calc(100vw - 36px));
  padding-top: 18px;
}

.directory-panel.structure-panel {
  position: static;
  height: calc(100vh - 112px);
  min-height: 620px;
  border-color: rgba(233, 229, 210, 0.18);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.035), rgba(233, 229, 210, 0.008)),
    rgba(5, 12, 15, 0.88);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.directory-panel .editor-panel-head,
.directory-toolbar {
  padding-inline: 18px;
  border-bottom-color: rgba(233, 229, 210, 0.12);
}

.directory-panel .editor-metrics {
  gap: 10px;
  padding: 14px 18px;
  border-bottom-color: rgba(233, 229, 210, 0.11);
}

.directory-panel .editor-metrics span {
  min-height: 54px;
  border-color: rgba(233, 229, 210, 0.16);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.1)),
    rgba(1, 6, 8, 0.34);
}

.directory-scroll {
  padding: 14px 18px 22px;
}

.directory-panel .editor-branch > .editor-tree {
  margin: 6px 0 2px 49px;
  padding-left: 14px;
  border-left-color: rgba(233, 229, 210, 0.13);
}

.directory-panel .editor-tree-row {
  grid-template-columns: 30px minmax(46px, auto) minmax(0, 1fr) auto;
  gap: 8px;
  min-height: 44px;
}

.directory-panel .tree-level {
  min-width: 46px;
  height: 26px;
  padding: 0 9px;
  border-color: rgba(233, 229, 210, 0.15);
  color: rgba(233, 229, 210, 0.78);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.05), rgba(0, 0, 0, 0.12)),
    rgba(2, 7, 10, 0.56);
}

.directory-panel .editor-node {
  position: relative;
  min-height: 42px;
  padding: 8px 13px 8px 15px;
  overflow: hidden;
  border-color: rgba(233, 229, 210, 0.14);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(3, 9, 12, 0.58);
}

.directory-panel .editor-node::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  content: "";
}

.directory-panel .editor-node-text {
  border-color: rgba(215, 168, 78, 0.34);
  background:
    linear-gradient(90deg, rgba(215, 168, 78, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(15, 11, 6, 0.58);
}

.directory-panel .editor-node-text::before {
  background: rgba(215, 168, 78, 0.82);
}

.directory-panel .editor-node-image {
  border-color: rgba(168, 200, 135, 0.34);
  background:
    linear-gradient(90deg, rgba(168, 200, 135, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(7, 16, 12, 0.6);
}

.directory-panel .editor-node-image::before {
  background: rgba(168, 200, 135, 0.82);
}

.directory-panel .editor-node-video {
  border-color: rgba(116, 164, 196, 0.36);
  background:
    linear-gradient(90deg, rgba(116, 164, 196, 0.13), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(6, 13, 18, 0.62);
}

.directory-panel .editor-node-video::before {
  background: rgba(116, 164, 196, 0.86);
}

.directory-panel .editor-node:hover {
  border-color: rgba(233, 229, 210, 0.44);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.24),
    inset 0 0 0 1px rgba(233, 229, 210, 0.035);
}

.directory-panel .editor-node.is-active {
  border-color: rgba(141, 231, 223, 0.56);
  box-shadow:
    0 0 20px rgba(141, 231, 223, 0.12),
    inset 0 0 0 1px rgba(141, 231, 223, 0.08);
}

.directory-panel .editor-node-text.is-active {
  background:
    linear-gradient(90deg, rgba(215, 168, 78, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(0, 0, 0, 0.12)),
    rgba(15, 11, 6, 0.66);
}

.directory-panel .editor-node-image.is-active {
  background:
    linear-gradient(90deg, rgba(168, 200, 135, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(0, 0, 0, 0.12)),
    rgba(7, 16, 12, 0.68);
}

.directory-panel .editor-node-video.is-active {
  background:
    linear-gradient(90deg, rgba(116, 164, 196, 0.17), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(0, 0, 0, 0.12)),
    rgba(6, 13, 18, 0.7);
}

.directory-panel .editor-node .node-name {
  color: var(--shell);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.35;
}

.row-action {
  width: 32px;
  height: 32px;
  border-color: rgba(233, 229, 210, 0.14);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.04), rgba(0, 0, 0, 0.1)),
    rgba(1, 6, 8, 0.36);
  color: rgba(233, 229, 210, 0.62);
}

.row-action:hover {
  border-color: rgba(141, 231, 223, 0.44);
  background: rgba(141, 231, 223, 0.09);
  color: var(--shell);
  box-shadow: none;
}

.editor-dialog .content-mode input[value="text"]:checked + span {
  border-color: rgba(215, 168, 78, 0.62);
  background: rgba(215, 168, 78, 0.12);
}

.editor-dialog .content-mode input[value="image"]:checked + span {
  border-color: rgba(168, 200, 135, 0.62);
  background: rgba(168, 200, 135, 0.12);
}

.editor-dialog .content-mode input[value="video"]:checked + span {
  border-color: rgba(116, 164, 196, 0.64);
  background: rgba(116, 164, 196, 0.12);
}

@media (max-width: 720px) {
  .editor-workbench.directory-workbench {
    width: min(100vw - 18px, 1420px);
  }

  .directory-panel.structure-panel {
    height: auto;
    min-height: 0;
  }

  .directory-panel .editor-tree-row {
    grid-template-columns: 28px minmax(42px, auto) minmax(0, 1fr);
  }
}

/* Redesigned directory workbench */
.directory-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(233, 229, 210, 0.1);
}

.directory-toolbar .editor-file-tools {
  justify-content: flex-end;
  width: auto;
}

.directory-toolbar .tool-button {
  min-width: 88px;
}

.directory-scroll {
  padding: 16px 18px 26px;
  background:
    linear-gradient(180deg, rgba(141, 231, 223, 0.018), transparent 220px),
    rgba(1, 5, 7, 0.16);
}

.directory-panel .editor-tree {
  gap: 9px;
}

.directory-panel .editor-branch > .editor-tree {
  margin: 9px 0 3px 58px;
  padding-left: 18px;
  border-left: 1px solid rgba(233, 229, 210, 0.14);
}

.directory-entry {
  position: relative;
  display: grid;
  gap: 0;
  min-width: 0;
  padding-top: 9px;
}

.directory-entry .row-actions {
  position: absolute;
  top: -2px;
  right: 4px;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-height: 25px;
  padding-right: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease;
}

.directory-entry:hover .row-actions,
.directory-entry.is-active .row-actions,
.directory-entry:focus-within .row-actions {
  opacity: 1;
  pointer-events: auto;
}

.directory-entry .row-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 46px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(233, 229, 210, 0.13);
  border-radius: 999px;
  background: rgba(1, 6, 8, 0.28);
  color: rgba(233, 229, 210, 0.62);
  font-size: 0.72rem;
  font-weight: 650;
  cursor: pointer;
}

.directory-entry .row-action:hover {
  border-color: rgba(141, 231, 223, 0.44);
  background: rgba(141, 231, 223, 0.09);
  color: var(--shell);
}

.directory-entry .row-action:disabled {
  opacity: 0.24;
  cursor: default;
}

.directory-entry .row-action-danger {
  color: rgba(255, 217, 211, 0.72);
}

.directory-entry .row-action-danger:hover {
  border-color: rgba(214, 120, 104, 0.48);
  background: rgba(214, 120, 104, 0.1);
  color: #ffe5df;
}

.directory-panel .editor-tree-row {
  grid-template-columns: 32px minmax(48px, auto) minmax(0, 1fr);
  gap: 10px;
  min-height: 46px;
}

.directory-panel .tree-toggle,
.directory-panel .tree-toggle-spacer {
  width: 32px;
  height: 36px;
}

.directory-panel .tree-toggle {
  border: 1px solid rgba(233, 229, 210, 0.13);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.14)),
    rgba(1, 6, 8, 0.38);
  color: rgba(233, 229, 210, 0.72);
  font-size: 1rem;
  line-height: 1;
}

.directory-panel .tree-toggle:hover {
  border-color: rgba(141, 231, 223, 0.46);
  background: rgba(141, 231, 223, 0.08);
}

.directory-panel .tree-toggle-spacer {
  display: block;
}

.directory-panel .tree-level {
  min-width: 48px;
  height: 28px;
  border-color: rgba(233, 229, 210, 0.14);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.13)),
    rgba(2, 7, 10, 0.54);
  color: rgba(233, 229, 210, 0.76);
}

.directory-panel .editor-node {
  min-height: 46px;
  padding: 10px 15px 10px 17px;
  border-radius: var(--radius);
  box-shadow:
    0 10px 22px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.directory-panel .editor-node::after {
  position: absolute;
  inset: 6px;
  pointer-events: none;
  border: 1px solid rgba(233, 229, 210, 0.055);
  border-radius: 5px;
  content: "";
}

.directory-panel .editor-node .node-name {
  position: relative;
  z-index: 1;
  font-size: 0.96rem;
}

.directory-entry-text .tree-level {
  border-color: rgba(215, 168, 78, 0.24);
}

.directory-entry-image .tree-level {
  border-color: rgba(168, 200, 135, 0.24);
}

.directory-entry-video .tree-level {
  border-color: rgba(116, 164, 196, 0.25);
}

@media (max-width: 720px) {
  .directory-toolbar,
  .directory-toolbar .editor-file-tools {
    justify-content: stretch;
  }

  .directory-toolbar .tool-button {
    flex: 1;
    min-width: 0;
  }

  .directory-entry .row-actions {
    position: static;
    justify-content: flex-start;
    padding-left: 42px;
    flex-wrap: wrap;
    opacity: 1;
    pointer-events: auto;
  }

  .directory-entry .row-action {
    min-width: 42px;
  }

  .directory-panel .editor-tree-row {
    grid-template-columns: 30px minmax(44px, auto) minmax(0, 1fr);
  }

  .directory-panel .editor-branch > .editor-tree {
    margin-left: 46px;
    padding-left: 12px;
  }
}

/* Final placement requested: actions inside the row, no numbering badges. */
.directory-entry {
  padding-top: 0;
}

.directory-entry .row-actions {
  position: static;
  z-index: 1;
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  min-height: 0;
  padding: 0;
  opacity: 1;
  pointer-events: auto;
}

.directory-panel .editor-tree-row {
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  min-height: 48px;
}

.directory-panel .editor-branch > .editor-tree {
  margin-left: 40px;
  padding-left: 16px;
}

.directory-panel .tree-level {
  display: none;
}

.directory-panel .editor-node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.node-edit-button {
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.node-edit-button:focus-visible {
  outline: 0;
}

.directory-panel .editor-node .node-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-entry .row-action {
  min-width: 42px;
  height: 26px;
  padding: 0 8px;
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.04), rgba(0, 0, 0, 0.12)),
    rgba(1, 6, 8, 0.34);
}

@media (max-width: 720px) {
  .directory-panel .editor-tree-row {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .directory-panel .editor-node {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .directory-entry .row-actions {
    justify-content: flex-start;
  }
}

/* Icon actions and frontend-aligned root tone. */
.directory-entry .row-action {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: var(--radius);
}

.directory-entry .row-action i,
.directory-entry .row-action svg {
  display: block;
  width: 15px;
  height: 15px;
}

.directory-entry .row-action i::before {
  content: attr(data-fallback);
  display: grid;
  place-items: center;
  width: 15px;
  height: 15px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 0.95rem;
  font-style: normal;
  font-weight: 800;
  line-height: 1;
}

.directory-panel .editor-node-depth-0.editor-node-text {
  border-color: rgba(214, 120, 104, 0.42);
  background:
    linear-gradient(90deg, rgba(214, 120, 104, 0.15), transparent 34%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.045), rgba(0, 0, 0, 0.12)),
    rgba(24, 8, 8, 0.62);
}

.directory-panel .editor-node-depth-0.editor-node-text::before {
  background: rgba(214, 120, 104, 0.84);
}

.directory-panel .editor-node-depth-0.editor-node-text.is-active {
  background:
    linear-gradient(90deg, rgba(214, 120, 104, 0.2), transparent 36%),
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(0, 0, 0, 0.12)),
    rgba(28, 9, 9, 0.72);
}

/* Directory title density: short label + title + missing media cue. */
.directory-panel .node-edit-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.directory-panel .node-title-stack {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.directory-panel .editor-node .node-eyebrow {
  display: inline-block;
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
  padding: 3px 7px;
  border: 1px solid rgba(233, 229, 210, 0.16);
  border-radius: 6px;
  background: rgba(1, 6, 8, 0.32);
  color: rgba(233, 229, 210, 0.7);
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.1;
  text-overflow: clip;
  white-space: nowrap;
}

.directory-panel .editor-node .node-name {
  min-width: 0;
}

.directory-panel .editor-node.has-missing-media {
  border-color: rgba(214, 120, 104, 0.58);
  box-shadow:
    0 0 0 1px rgba(214, 120, 104, 0.1),
    0 10px 22px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.node-warning-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(214, 120, 104, 0.42);
  border-radius: 999px;
  background: rgba(214, 120, 104, 0.13);
  color: #ffd7cf;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.node-warning-badge i,
.node-warning-badge svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.node-warning-badge i::before {
  content: attr(data-fallback);
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
}

@media (max-width: 720px) {
  .directory-panel .node-edit-button {
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .node-warning-badge {
    justify-self: flex-start;
  }
}

/* Flat edit page: remove the outer framed container and cap content width. */
.editor-workbench.directory-workbench {
  width: min(1280px, calc(100vw - 32px));
  padding: 18px 0 28px;
}

.directory-panel.structure-panel {
  height: calc(100vh - 112px);
  min-height: 560px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.directory-panel .editor-panel-head {
  padding: 0 0 14px;
  border-bottom: 1px solid rgba(233, 229, 210, 0.12);
}

.directory-panel .editor-metrics {
  padding: 14px 0;
}

.directory-toolbar {
  padding: 13px 0;
}

.directory-scroll {
  padding: 14px 0 22px;
  background: transparent;
}

@media (max-width: 720px) {
  .editor-workbench.directory-workbench {
    width: min(1280px, calc(100vw - 18px));
    padding-top: 12px;
  }

  .directory-panel.structure-panel {
    height: auto;
    min-height: 0;
  }
}

/* Independent editor header, visually aligned with the showcase topbar. */
.editor-page-head {
  position: sticky;
  top: 0;
  z-index: 70;
  min-height: 76px;
  border-bottom: 1px solid rgba(233, 229, 210, 0.18);
  background:
    linear-gradient(180deg, rgba(11, 21, 25, 0.94), rgba(3, 8, 11, 0.86)),
    rgba(5, 12, 15, 0.72);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 18px 42px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.editor-body .app-shell {
  grid-template-rows: auto 1fr;
}

.editor-page-head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  min-height: 76px;
  margin: 0 auto;
  padding: 16px 28px;
  box-sizing: border-box;
}

.editor-page-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.editor-title-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(233, 229, 210, 0.56);
  border-radius: 50%;
  color: var(--shell);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.14), rgba(233, 229, 210, 0.02)),
    rgba(2, 7, 10, 0.72);
  box-shadow:
    0 0 18px rgba(141, 231, 223, 0.12),
    inset 0 0 18px rgba(141, 231, 223, 0.18);
}

.editor-title-mark i {
  width: 22px;
  height: 22px;
}

.editor-page-title h1 {
  margin: 0;
  color: var(--shell);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0;
}

.editor-header-status {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.editor-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0;
}

.editor-header-actions .tool-button {
  min-height: 38px;
  padding: 8px 12px;
}

.editor-preview-link {
  flex: 0 0 auto;
}

/* Let the document scroll instead of the directory pane. */
.editor-page-head + .editor-workbench.directory-workbench {
  padding-top: 16px;
}

.editor-page-head + .editor-workbench .directory-panel.structure-panel {
  height: auto;
  min-height: 0;
  overflow: visible;
}

.editor-page-head + .editor-workbench .directory-scroll {
  flex: initial;
  min-height: 0;
  overflow: visible;
}

.editor-body .directory-panel.structure-panel,
.editor-body .structure-panel.directory-panel {
  position: static !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}

.editor-body .tree-scroll,
.editor-body .editor-tree-scroll,
.editor-body .directory-scroll {
  flex: none !important;
  height: auto !important;
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
}

/* Keep row and action borders tied to each entry's content tone. */
.directory-entry-text .row-action {
  border-color: rgba(215, 168, 78, 0.24);
}

.directory-depth-0.directory-entry-text .row-action {
  border-color: rgba(214, 120, 104, 0.28);
}

.directory-entry-image .row-action {
  border-color: rgba(168, 200, 135, 0.26);
}

.directory-entry-video .row-action {
  border-color: rgba(116, 164, 196, 0.28);
}

.directory-entry-text .row-action:hover {
  border-color: rgba(215, 168, 78, 0.48);
  background: rgba(215, 168, 78, 0.1);
}

.directory-depth-0.directory-entry-text .row-action:hover {
  border-color: rgba(214, 120, 104, 0.48);
  background: rgba(214, 120, 104, 0.1);
}

.directory-entry-image .row-action:hover {
  border-color: rgba(168, 200, 135, 0.52);
  background: rgba(168, 200, 135, 0.1);
}

.directory-entry-video .row-action:hover {
  border-color: rgba(116, 164, 196, 0.54);
  background: rgba(116, 164, 196, 0.1);
}

.directory-entry-text .row-action-check {
  color: rgba(215, 168, 78, 0.82);
  border-color: rgba(215, 168, 78, 0.38);
}

.directory-depth-0.directory-entry-text .row-action-check {
  color: rgba(214, 120, 104, 0.86);
  border-color: rgba(214, 120, 104, 0.42);
  background:
    linear-gradient(180deg, rgba(214, 120, 104, 0.08), rgba(0, 0, 0, 0.12)),
    rgba(1, 6, 8, 0.38);
}

.directory-entry-image .row-action-check {
  color: rgba(168, 200, 135, 0.84);
}

.directory-entry-video .row-action-check {
  color: rgba(116, 164, 196, 0.86);
}

.directory-entry .row-action-check.is-checked {
  color: var(--bone);
  border-color: rgba(242, 237, 216, 0.56);
  background:
    linear-gradient(180deg, rgba(242, 237, 216, 0.12), rgba(215, 168, 78, 0.08)),
    rgba(4, 9, 11, 0.66);
  box-shadow: inset 0 0 16px rgba(215, 168, 78, 0.12);
}

.directory-depth-0 .row-action-check,
.directory-depth-0 .row-action-check:hover,
.directory-depth-0 .row-action-check:disabled:hover {
  color: rgba(233, 229, 210, 0.5);
  border-color: rgba(233, 229, 210, 0.14);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.04), rgba(0, 0, 0, 0.1)),
    rgba(1, 6, 8, 0.36);
  box-shadow: none;
}

.directory-panel .editor-node-text.has-missing-media {
  border-color: rgba(215, 168, 78, 0.46);
}

.directory-panel .editor-node-depth-0.editor-node-text.has-missing-media {
  border-color: rgba(214, 120, 104, 0.42);
}

.directory-panel .editor-node-image.has-missing-media {
  border-color: rgba(168, 200, 135, 0.5);
}

.directory-panel .editor-node-video.has-missing-media {
  border-color: rgba(116, 164, 196, 0.52);
}

@media (max-width: 720px) {
  .editor-page-head-inner {
    align-items: flex-start;
    min-height: 0;
    padding: 12px 10px;
  }

  .editor-header-actions {
    justify-content: flex-start;
  }

  .editor-header-actions .tool-button span {
    display: none;
  }
}

/* Showcase-style node edit dialog. */
.editor-dialog {
  width: min(680px, calc(100vw - 28px));
  border-color: rgba(233, 229, 210, 0.22);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.055), rgba(233, 229, 210, 0.012)),
    rgba(5, 12, 15, 0.98);
}

.clear-confirm-dialog {
  width: min(460px, calc(100vw - 28px));
}

.editor-dialog-head {
  padding: 16px 18px;
  background:
    linear-gradient(90deg, rgba(141, 231, 223, 0.07), transparent 42%),
    rgba(1, 6, 8, 0.22);
}

.editor-dialog-head h2 {
  color: var(--shell);
  font-family: "SimSun", "Songti SC", serif;
  font-size: 1.25rem;
  font-weight: 700;
}

.editor-dialog .node-form {
  gap: 0;
  padding: 0;
}

.editor-node-editor .form-section {
  display: grid;
  gap: 13px;
  padding: 18px;
  border-bottom: 1px solid rgba(233, 229, 210, 0.11);
}

.editor-node-editor .form-section:last-child {
  border-bottom: 0;
}

.editor-node-editor .section-title {
  gap: 8px;
}

.editor-node-editor .section-title i {
  width: 16px;
  height: 16px;
  color: rgba(168, 200, 135, 0.95);
}

.editor-dialog .section-title h3 {
  color: var(--shell);
  font-size: 0.92rem;
  font-weight: 800;
}

.editor-type-section .content-mode legend {
  display: none;
}

.editor-dialog .content-mode {
  gap: 10px;
}

.editor-dialog .content-mode span {
  justify-content: flex-start;
  min-height: 48px;
  padding: 10px 12px;
  border-color: rgba(233, 229, 210, 0.16);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.04), rgba(0, 0, 0, 0.14)),
    rgba(1, 6, 8, 0.42);
  color: rgba(233, 229, 210, 0.78);
  font-weight: 800;
}

.editor-dialog .content-mode span i {
  width: 17px;
  height: 17px;
}

.editor-title-grid {
  grid-template-columns: minmax(112px, 0.34fr) minmax(0, 1fr);
}

.editor-dialog .field span {
  color: rgba(159, 181, 176, 0.94);
  font-size: 0.76rem;
  font-weight: 750;
}

.editor-dialog .field input {
  min-height: 44px;
  border-color: rgba(233, 229, 210, 0.16);
  background:
    linear-gradient(180deg, rgba(233, 229, 210, 0.035), rgba(0, 0, 0, 0.08)),
    rgba(1, 6, 8, 0.5);
}

.editor-media-section {
  background:
    linear-gradient(90deg, rgba(116, 164, 196, 0.045), transparent 44%),
    rgba(1, 6, 8, 0.16);
}

.editor-media-section[hidden] {
  display: none;
}

.editor-media-section .media-fields {
  gap: 13px;
}

.image-upload-field {
  display: grid;
}

.image-upload-card {
  position: relative;
  width: 100%;
  height: 228px;
  overflow: hidden;
  border: 1px dashed rgba(168, 200, 135, 0.48);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(168, 200, 135, 0.09), transparent 46%),
    rgba(1, 6, 8, 0.45);
  color: var(--shell);
  font: inherit;
  text-align: center;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.image-upload-card:hover,
.image-upload-card:focus-within {
  border-color: rgba(168, 200, 135, 0.78);
  background:
    linear-gradient(135deg, rgba(168, 200, 135, 0.13), transparent 48%),
    rgba(1, 6, 8, 0.58);
}

.image-upload-card:focus-within {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(168, 200, 135, 0.13);
}

.image-upload-trigger {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.image-upload-trigger:focus-visible {
  outline: 0;
}

.image-upload-preview {
  display: block;
  width: 100%;
  height: 100%;
}

.image-upload-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-upload-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 30px 20px;
}

.image-upload-empty i {
  width: 34px;
  height: 34px;
  color: rgba(168, 200, 135, 0.95);
}

.image-upload-empty strong {
  color: var(--shell);
  font-size: 0.96rem;
}

.image-upload-empty small {
  max-width: 360px;
  color: rgba(159, 181, 176, 0.9);
  font-size: 0.78rem;
  line-height: 1.55;
}

.image-upload-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(214, 120, 104, 0.45);
  border-radius: var(--radius);
  background: rgba(4, 9, 11, 0.78);
  color: #ffe5df;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.image-upload-remove:hover,
.image-upload-remove:focus-visible {
  border-color: rgba(214, 120, 104, 0.78);
  background: rgba(80, 26, 21, 0.78);
}

.image-upload-remove:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 3px rgba(214, 120, 104, 0.16);
}

.image-upload-remove i {
  width: 17px;
  height: 17px;
}

.video-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.video-preview-card {
  min-width: 0;
  overflow: hidden;
  border: 1px dashed rgba(116, 164, 196, 0.5);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(116, 164, 196, 0.09), transparent 48%),
    rgba(1, 6, 8, 0.45);
}

.video-cover-preview {
  border-color: rgba(168, 200, 135, 0.45);
  background:
    linear-gradient(135deg, rgba(168, 200, 135, 0.08), transparent 48%),
    rgba(1, 6, 8, 0.45);
}

.video-preview-head {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 40px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(233, 229, 210, 0.1);
  color: rgba(233, 229, 210, 0.84);
  font-size: 0.78rem;
  font-weight: 800;
}

.video-preview-head i {
  width: 15px;
  height: 15px;
  color: rgba(116, 164, 196, 0.95);
}

.video-cover-preview .video-preview-head i {
  color: rgba(168, 200, 135, 0.95);
}

.video-preview-stage {
  position: relative;
  display: grid;
  place-items: center;
  height: 188px;
  overflow: hidden;
  background: rgba(1, 6, 8, 0.34);
}

.video-preview-stage iframe,
.video-cover-preview-image,
.video-cover-preview-image img {
  display: block;
  width: 100%;
  height: 100%;
}

.video-preview-stage iframe {
  border: 0;
}

.video-cover-preview-image img {
  object-fit: cover;
}

.map-media-stage img,
.plot-image,
.video-cover img,
.story-image,
.image-upload-preview img,
.video-cover-preview-image img {
  object-position: 50% 58%;
}

.video-preview-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 26px 18px;
  text-align: center;
}

.video-preview-empty i {
  width: 30px;
  height: 30px;
  color: rgba(159, 181, 176, 0.78);
}

.video-preview-empty strong {
  color: rgba(233, 229, 210, 0.78);
  font-size: 0.86rem;
}

@media (max-width: 720px) {
  .editor-dialog {
    width: min(100vw - 18px, 680px);
  }

  .editor-node-editor .form-section {
    padding: 15px;
  }

  .editor-title-grid,
  .editor-dialog .content-mode,
  .video-preview-grid {
    grid-template-columns: 1fr;
  }
}
