/* =========================================================
   Buttons, fields and small utilities
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 35px; padding: 0 15px; border-radius: 8px;
  border: 1px solid transparent; color: var(--text-soft);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.01em;
  transition: all 0.16s ease; white-space: nowrap;
}
.btn:hover { color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-sm { height: 30px; padding: 0 11px; font-size: 11.5px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: 13px; border-radius: 10px; }
.btn-primary {
  color: #1c1407;
  background: linear-gradient(135deg, #ffd392, #ffb862 58%, #f1a14a);
  border-color: rgba(255, 219, 162, 0.42);
  box-shadow: 0 7px 22px rgba(255, 166, 67, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.btn-primary:hover { color: #160f05; background: linear-gradient(135deg, #ffdfa9, #ffc374 58%, #f5a64f); }
.btn-ghost { border-color: var(--border); background: rgba(148, 174, 210, 0.04); color: var(--text-soft); }
.btn-ghost:hover { border-color: var(--border-strong); background: rgba(148, 174, 210, 0.09); }
.btn-danger { color: #240a0e; background: linear-gradient(135deg, #ff9cab, #ff6f86); border-color: rgba(255, 150, 165, 0.44); }
.btn-danger-ghost { color: #ff9cad; border-color: rgba(255, 114, 136, 0.16); background: rgba(255, 114, 136, 0.04); }
.btn-danger-ghost:hover { color: #ffc0ca; border-color: rgba(255, 114, 136, 0.32); background: rgba(255, 114, 136, 0.1); }
.btn-sub { font-size: 9.5px; opacity: 0.7; margin-left: 4px; font-weight: 500; }
.icon-btn {
  width: 29px; height: 29px; display: grid; place-items: center; border-radius: 7px;
  color: var(--text-dim); transition: all 0.15s;
}
.icon-btn:hover { color: var(--text); background: rgba(148, 174, 210, 0.09); }
.mini-icon {
  width: 23px; height: 23px; display: inline-grid; place-items: center; border-radius: 5px;
  color: var(--text-faint); transition: all 0.14s; flex: 0 0 auto;
}
.mini-icon:hover { color: var(--text-soft); background: rgba(148, 174, 210, 0.09); }
.mini-icon.danger:hover { color: #ff9bab; background: rgba(255, 114, 136, 0.1); }
.mini-icon[disabled] { opacity: 0.28; }
.text-link { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; color: var(--text-dim); transition: color 0.14s; }
.text-link:hover { color: var(--accent); }
.footer-spacer { flex: 1 1 auto; }

/* =========================================================
   Status bar
   ========================================================= */
.statusbar {
  flex: 0 0 var(--statusbar-h); height: var(--statusbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  border-top: 1px solid var(--border); background: rgba(8, 12, 19, 0.96);
  color: var(--text-faint); font-size: 10.5px; z-index: 25; user-select: none;
}
.status-left, .status-center, .status-right { display: flex; align-items: center; gap: 9px; min-width: 0; }
.status-center { flex: 1 1 auto; justify-content: center; overflow: hidden; }
.status-right { flex-shrink: 0; }
.status-item { white-space: nowrap; font-variant-numeric: tabular-nums; }
.status-item.muted { color: var(--text-faint); }
.status-sep { width: 1px; height: 10px; background: var(--border); flex: 0 0 auto; }
.status-center span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #667389; }
.status-link { display: inline-flex; align-items: center; gap: 4px; color: var(--text-faint); font-size: 10px; }
.status-link:hover { color: var(--accent); }
.status-version { white-space: nowrap; color: #626e82; }

/* =========================================================
   Canvas extras
   ========================================================= */
.canvas-world.is-animating { transition: transform 0.34s cubic-bezier(0.2, 0.75, 0.25, 1); }
.canvas-viewport.space-held, .canvas-viewport.space-held .story-node { cursor: grab; }
.canvas-viewport.space-held.is-panning, .canvas-viewport.space-held.is-panning .story-node { cursor: grabbing; }
.node-palette .palette-item.is-dragging { opacity: 0.45; }

.quick-add {
  position: absolute; z-index: 60; width: 246px; overflow: hidden;
  border-radius: 12px; border: 1px solid rgba(170, 192, 221, 0.2);
  background: rgba(16, 23, 35, 0.98); backdrop-filter: blur(20px);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: quick-in 0.16s ease both;
}
@keyframes quick-in { from { opacity: 0; transform: scale(0.97) translateY(-4px); } to { opacity: 1; transform: none; } }
.qa-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 12px 12px 10px; border-bottom: 1px solid var(--border); }
.qa-title { font-size: 11.5px; font-weight: 700; color: var(--text); }
.qa-sub { font-size: 9px; color: var(--text-faint); margin-top: 3px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qa-close { width: 21px; height: 21px; display: grid; place-items: center; border-radius: 5px; color: var(--text-faint); }
.qa-close:hover { background: rgba(148, 174, 210, 0.1); color: var(--text); }
.qa-list { padding: 5px; max-height: 306px; overflow-y: auto; }
.qa-item { width: 100%; display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 7px; text-align: left; transition: background 0.13s; }
.qa-item:hover { background: color-mix(in srgb, var(--nc) 8%, rgba(148, 174, 210, 0.05)); }
.qa-icon { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 6px; display: grid; place-items: center; color: var(--nc); background: color-mix(in srgb, var(--nc) 12%, transparent); border: 1px solid color-mix(in srgb, var(--nc) 16%, transparent); }
.qa-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.qa-name { font-size: 10.5px; font-weight: 600; color: var(--text-soft); }
.qa-desc { font-size: 8.5px; color: var(--text-faint); }
.qa-plus { color: var(--text-faint); opacity: 0; transition: opacity 0.13s; }
.qa-item:hover .qa-plus { opacity: 1; color: var(--nc); }
.qa-foot { display: flex; align-items: center; gap: 5px; padding: 8px 11px; border-top: 1px solid var(--border); font-size: 8.5px; color: var(--text-faint); line-height: 1.45; background: rgba(9, 14, 21, 0.5); }

/* =========================================================
   Inspector
   ========================================================= */
.insp-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 13px 13px 12px;
  border-bottom: 1px solid var(--border); position: relative;
}
.insp-head::before { content: ""; position: absolute; inset: 0 auto auto 0; width: 100%; height: 46px; background: radial-gradient(130px 45px at 12% 0%, color-mix(in srgb, var(--nc) 9%, transparent), transparent 75%); pointer-events: none; }
.insp-head-icon {
  width: 35px; height: 35px; flex: 0 0 35px; border-radius: 9px; display: grid; place-items: center;
  color: var(--nc); background: color-mix(in srgb, var(--nc) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--nc) 22%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.insp-head-main { min-width: 0; flex: 1; }
.insp-title { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.3; }
.insp-type { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--text-dim); margin-top: 3px; letter-spacing: 0.03em; }
.live-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--nc, var(--accent)); opacity: 0.8; }
.insp-close { flex: 0 0 auto; }
.inspector .inspector-scroll { padding: 0 13px 30px; }

.insp-tip {
  display: flex; gap: 7px; margin: 12px 0 3px; padding: 9px 10px;
  border-radius: 8px; border: 1px solid rgba(255, 180, 92, 0.1);
  background: linear-gradient(135deg, rgba(255, 180, 92, 0.055), rgba(255, 180, 92, 0.015));
  color: #b5ab97; font-size: 10.5px; line-height: 1.65;
}
.tip-icon { color: var(--accent); flex: 0 0 auto; margin-top: 1px; opacity: 0.85; }

.insp-section { padding: 14px 0; border-bottom: 1px solid rgba(148, 174, 210, 0.07); }
.insp-section:last-child { border-bottom: 0; }
.insp-section.preview-section { border-bottom: 1px dashed rgba(148, 174, 210, 0.09); }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; min-height: 16px; }
.section-title { font-size: 11.5px; font-weight: 600; color: #c9d3e1; letter-spacing: 0.01em; }
.section-hint { font-size: 9.5px; color: var(--text-faint); white-space: nowrap; }
.section-title + .text-link { margin-left: auto; }
.field-hint { display: flex; gap: 5px; align-items: flex-start; font-size: 10px; line-height: 1.6; color: var(--text-faint); margin: 7px 0 0; }
.field-hint svg { flex: 0 0 auto; margin-top: 1px; opacity: 0.85; }
.field-hint.warn { color: #e7ad68; }

.input {
  width: 100%; display: block; height: 36px; padding: 0 10px;
  border-radius: 7px; border: 1px solid rgba(148, 174, 210, 0.14);
  background: rgba(8, 13, 21, 0.55); color: var(--text);
  font-size: 12px; line-height: 1.55; transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input:hover { border-color: rgba(148, 174, 210, 0.24); }
.input:focus { outline: none; border-color: rgba(255, 180, 92, 0.5); box-shadow: 0 0 0 3px rgba(255, 180, 92, 0.07); background: rgba(8, 13, 21, 0.78); }
.input::placeholder { color: #67738a; }
.textarea { height: auto; min-height: 58px; padding: 9px 10px; resize: vertical; line-height: 1.7; }
.story-textarea { min-height: 148px; font-size: 13px; line-height: 1.85; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 26px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23748196' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center; background-color: rgba(8, 13, 21, 0.55);
}
.select.compact { width: auto; min-width: 95px; height: 33px; font-size: 11px; }
.value-input { width: 76px; height: 33px; font-size: 11px; }
.input.compact { height: 33px; }
.writing-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 6px; font-size: 9.5px; color: var(--text-faint); }
.writing-tools span:first-child { display: inline-flex; align-items: center; gap: 4px; }
.writing-count { font-variant-numeric: tabular-nums; }

.option-list { display: flex; flex-direction: column; gap: 8px; }
.option-card { padding: 9px; border-radius: 9px; border: 1px solid rgba(148, 174, 210, 0.1); background: rgba(148, 174, 210, 0.03); }
.option-head { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
.option-index { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 189, 107, 0.11); color: #ffc77f; border: 1px solid rgba(255, 189, 107, 0.18); font-size: 9px; font-weight: 700; }
.option-label { font-size: 10px; color: var(--text-dim); font-weight: 600; flex: 1; }
.option-tools { display: flex; gap: 0; }
.add-option-btn {
  width: 100%; height: 34px; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: 7px; border: 1px dashed rgba(148, 174, 210, 0.18); color: var(--text-dim); font-size: 11px;
  transition: all 0.15s;
}
.add-option-btn:hover { color: var(--accent); border-color: rgba(255, 180, 92, 0.35); background: rgba(255, 180, 92, 0.04); }
.connect-inline { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.connect-inline-label { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; font-size: 9.5px; color: var(--text-faint); white-space: nowrap; }
.connect-inline.missing .connect-inline-label { color: #eda45e; }
.connect-select { height: 31px; font-size: 10px; padding: 0 24px 0 7px; background-position: right 7px center; background-size: 10px; }
.connect-inline .connect-select { flex: 1; min-width: 0; }
.branch-connect { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.branch-connect-label { display: flex; align-items: center; gap: 5px; flex: 0 0 52px; font-size: 9px; color: var(--text-dim); }
.branch-connect-label .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--success); }
.branch-connect.false .branch-connect-label .dot { background: #8190a5; }
.branch-connect .connect-select { flex: 1; min-width: 0; }

.condition-builder, .var-builder {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 9px; border-radius: 8px; border: 1px solid rgba(148, 174, 210, 0.09);
  background: rgba(8, 13, 21, 0.35);
}
.builder-prefix { font-size: 9.5px; color: var(--text-faint); }
.builder-var { font-size: 9.5px; font-weight: 600; color: #cbb7ff; background: rgba(179, 154, 255, 0.09); border: 1px solid rgba(179, 154, 255, 0.14); border-radius: 5px; padding: 3px 7px; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.var-builder .builder-var { color: #ffa9c3; background: rgba(255, 141, 177, 0.08); border-color: rgba(255, 141, 177, 0.14); }
.sentence-preview { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 8px 9px; border-radius: 7px; background: rgba(179, 154, 255, 0.055); border: 1px solid rgba(179, 154, 255, 0.1); font-size: 9.5px; line-height: 1.55; color: #b7aad8; }
.sentence-preview svg { flex: 0 0 auto; opacity: 0.8; }
.sentence-preview.pink { background: rgba(255, 141, 177, 0.045); border-color: rgba(255, 141, 177, 0.1); color: #d0a3b3; }
.variable-meta { display: flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 8.5px; color: var(--text-faint); }
.link-tip, .endpoint-note { display: flex; align-items: flex-start; gap: 6px; padding: 9px; border-radius: 7px; background: rgba(148, 174, 210, 0.04); border: 1px solid rgba(148, 174, 210, 0.08); font-size: 9px; line-height: 1.6; color: var(--text-faint); }
.link-tip svg, .endpoint-note svg { flex: 0 0 auto; margin-top: 1px; }

.status-line { display: flex; align-items: center; gap: 7px; padding: 9px 10px; border-radius: 8px; border: 1px solid rgba(98, 217, 168, 0.12); background: rgba(98, 217, 168, 0.045); font-size: 9.5px; color: #9fc9b8; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px rgba(98, 217, 168, 0.5); }
.status-badge { margin-left: auto; font-size: 7.5px; letter-spacing: 0.1em; color: #6edbb1; border: 1px solid rgba(98, 217, 168, 0.16); border-radius: 4px; padding: 2px 5px; }

.tone-segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.tone-btn {
  height: 30px; display: flex; align-items: center; justify-content: center; gap: 4px;
  border-radius: 6px; border: 1px solid rgba(148, 174, 210, 0.1); color: var(--text-faint);
  font-size: 9px; background: rgba(148, 174, 210, 0.03); transition: all 0.14s;
}
.tone-btn span { font-size: 9px; opacity: 0.65; }
.tone-btn:hover { color: var(--text-soft); border-color: rgba(148, 174, 210, 0.22); }
.tone-btn.active { color: #ffdda4; border-color: rgba(255, 180, 92, 0.28); background: rgba(255, 180, 92, 0.08); }
.tone-btn.tone-good.active { color: #85e9c2; border-color: rgba(98, 217, 168, 0.3); background: rgba(98, 217, 168, 0.08); }
.tone-btn.tone-bad.active { color: #ff9cac; border-color: rgba(255, 114, 136, 0.3); background: rgba(255, 114, 136, 0.08); }
.tone-btn.tone-secret.active { color: #cdbbff; border-color: rgba(169, 155, 255, 0.3); background: rgba(169, 155, 255, 0.08); }

.preview-section { background: linear-gradient(180deg, rgba(148, 174, 210, 0.018), transparent); }
.preview-tag { font-size: 7px; font-weight: 700; letter-spacing: 0.13em; color: #5c687a; border: 1px solid rgba(148, 174, 210, 0.12); border-radius: 3px; padding: 2px 4px; }
.story-preview { position: relative; padding: 12px; border-radius: 9px; border: 1px solid rgba(148, 174, 210, 0.11); background: radial-gradient(160px 80px at 50% 0%, rgba(64, 90, 120, 0.12), transparent 70%), rgba(6, 10, 16, 0.55); }
.preview-speaker { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 8px; font-size: 8.5px; color: #ffc379; font-weight: 600; letter-spacing: 0.06em; }
.preview-speaker.narrator { color: #8c9ab0; }
.preview-text { font-family: var(--font-display); font-size: 11px; line-height: 1.9; color: #c0cad8; letter-spacing: 0.02em; word-break: break-word; }
.preview-next { display: flex; justify-content: flex-end; align-items: center; gap: 3px; margin-top: 11px; padding-top: 8px; border-top: 1px solid rgba(148, 174, 210, 0.08); font-size: 8.5px; color: #8a7a63; }
.choice-preview .preview-text { margin-bottom: 9px; }
.preview-choice { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px; margin-top: 4px; border-radius: 5px; border: 1px solid rgba(148, 174, 210, 0.09); background: rgba(148, 174, 210, 0.035); font-size: 9px; color: #9ca8ba; }
.preview-choice span { color: #59667a; }
.ending-preview { text-align: center; padding: 16px 12px; }
.preview-ending-badge { display: inline-flex; font-size: 7.5px; padding: 2px 6px; border-radius: 4px; color: #e0cf9f; background: rgba(242, 211, 119, 0.08); border: 1px solid rgba(242, 211, 119, 0.14); margin-bottom: 8px; }
.preview-ending-title { font-family: var(--font-display); font-size: 15px; color: #e6d7b8; margin-bottom: 8px; letter-spacing: 0.05em; }
.ending-preview .preview-text { text-align: left; color: #aeb8c6; }
.cover-preview { padding: 17px 12px; border-radius: 9px; text-align: center; border: 1px solid rgba(255, 180, 92, 0.12); background: radial-gradient(120px 65px at 50% 0%, rgba(255, 180, 92, 0.09), transparent 70%), rgba(6, 10, 16, 0.6); }
.cover-eyebrow { display: block; font-size: 7px; letter-spacing: 0.18em; color: #756850; margin-bottom: 8px; }
.cover-preview strong { display: block; font-family: var(--font-display); font-size: 17px; color: #e9dfcd; letter-spacing: 0.06em; }
.cover-preview p { font-size: 9px; color: #7c8799; margin: 6px 0 12px; }
.cover-start { display: inline-flex; font-size: 8.5px; color: #f4c883; border: 1px solid rgba(255, 180, 92, 0.2); border-radius: 5px; padding: 4px 10px; background: rgba(255, 180, 92, 0.06); }

.insp-actions { padding-top: 14px; }
.action-row { display: flex; gap: 6px; margin-bottom: 7px; }
.action-row .btn { flex: 1; }
.action-row .btn-danger-ghost { flex: 0 0 auto; }
.node-id { font-size: 7.5px; color: #485365; margin-top: 8px; text-align: center; letter-spacing: 0.03em; }

.insp-empty { padding: 30px 18px 26px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.empty-illustration { width: 124px; height: 102px; position: relative; margin-bottom: 16px; }
.empty-core { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 53px; height: 53px; border-radius: 16px; display: grid; place-items: center; color: var(--accent); background: radial-gradient(circle at 30% 20%, rgba(255, 180, 92, 0.22), rgba(22, 31, 44, 0.9)); border: 1px solid rgba(255, 180, 92, 0.24); box-shadow: 0 0 30px rgba(255, 180, 92, 0.09); z-index: 2; }
.empty-orbit { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); border: 1px solid rgba(148, 174, 210, 0.1); border-radius: 50%; }
.empty-orbit.orbit-1 { width: 88px; height: 88px; }
.empty-orbit.orbit-2 { width: 118px; height: 64px; transform: translate(-50%, -50%) rotate(-18deg); border-style: dashed; }
.empty-node { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: #6bc4ff; box-shadow: 0 0 9px rgba(107, 196, 255, 0.45); }
.empty-node.en-1 { left: 8px; top: 27px; background: #ffbd6b; }
.empty-node.en-2 { right: 10px; top: 17px; background: #b39aff; }
.empty-node.en-3 { right: 23px; bottom: 17px; background: #ff8db1; }
.insp-empty h3 { margin: 0 0 7px; font-size: 15px; font-weight: 600; color: #e1e8f1; }
.insp-empty > p { margin: 0; font-size: 11px; line-height: 1.7; color: var(--text-dim); max-width: 275px; }
.empty-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; width: 100%; margin: 18px 0 10px; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--border); }
.empty-stats .stat { background: rgba(13, 19, 29, 0.96); padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.stat-num { font-size: 16px; font-weight: 600; color: #d6dfea; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 9px; color: var(--text-faint); }
.empty-meta { display: flex; justify-content: center; gap: 12px; font-size: 9.5px; color: var(--text-faint); margin-bottom: 13px; }
.empty-meta span { display: inline-flex; align-items: center; gap: 4px; }
.empty-health { width: 100%; display: flex; align-items: center; gap: 6px; padding: 9px; border-radius: 7px; border: 1px solid var(--border); font-size: 10px; color: var(--text-faint); }
.empty-health .health-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--success); }
.empty-health.has-errors { color: #d6a77a; border-color: rgba(255, 180, 92, 0.12); background: rgba(255, 180, 92, 0.035); }
.empty-health.has-errors .health-dot { background: var(--accent); }
.empty-health .text-link { margin-left: auto; }
.empty-actions { display: flex; gap: 5px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.empty-actions .btn { flex: 1; min-width: 74px; padding: 0 7px; }
.shortcut-card { width: 100%; margin-top: 18px; padding: 10px; border-radius: 9px; border: 1px solid var(--border); background: rgba(148, 174, 210, 0.022); }
.shortcut-title { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--text-faint); margin-bottom: 7px; }
.shortcut-row { display: flex; justify-content: space-between; align-items: center; font-size: 9.5px; color: #738095; padding: 3px 0; }
.shortcut-row kbd { margin-left: 3px; }
.shortcut-row kbd, .kbd-hint kbd, .tour-tip kbd { font-family: var(--font-ui); font-size: 7.5px; padding: 1px 4px; border-radius: 3px; border: 1px solid rgba(148, 174, 210, 0.16); background: rgba(255, 255, 255, 0.025); color: #8491a4; }

.multi-list { display: flex; flex-direction: column; gap: 4px; }
.multi-row { display: flex; align-items: center; gap: 8px; padding: 7px; border-radius: 6px; border: 1px solid transparent; text-align: left; font-size: 10px; color: var(--text-soft); }
.multi-row:hover { background: rgba(148, 174, 210, 0.05); border-color: var(--border); }
.multi-icon { width: 23px; height: 23px; border-radius: 6px; display: grid; place-items: center; color: var(--nc); background: color-mix(in srgb, var(--nc) 10%, transparent); }
.multi-row > span:nth-child(2) { flex: 1; }
.multi-row > svg { color: var(--text-faint); }

.edge-route { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 9px; border: 1px solid var(--border); background: rgba(148, 174, 210, 0.025); }
.edge-endpoint { display: flex; align-items: center; gap: 8px; }
.edge-icon { width: 27px; height: 27px; flex: 0 0 27px; border-radius: 7px; display: grid; place-items: center; color: var(--nc); background: color-mix(in srgb, var(--nc) 11%, transparent); border: 1px solid color-mix(in srgb, var(--nc) 16%, transparent); }
.edge-name { font-size: 10.5px; font-weight: 600; color: var(--text-soft); flex: 1; }
.edge-type { font-size: 8px; color: var(--text-faint); border: 1px solid var(--border); border-radius: 3px; padding: 1px 4px; }
.edge-arrow { display: flex; justify-content: center; color: var(--text-faint); padding-left: 4px; }
.edge-note { font-size: 9px; line-height: 1.7; color: var(--text-faint); margin: 10px 0 0; }

[hidden] { display: none !important; }
.modal:focus { outline: none; }

/* =========================================================
   Responsive editor chrome
   ========================================================= */
@media (max-width: 1220px) {
  :root { --palette-w: 258px; --inspector-w: 340px; }
  .top-actions .tbtn span { display: none; }
  .top-actions .tbtn { padding: 0 9px; }
  .top-actions .tbtn-primary span { display: inline; }
  .project-chip { max-width: 250px; }
  .project-title { max-width: 205px; }
}
@media (max-width: 1100px) {
  :root { --palette-w: 246px; --inspector-w: 324px; }
  .brand-sub { display: none; }
  .project-chip { max-width: 190px; }
  .project-title { max-width: 150px; }
  .status-center { display: none; }
  .canvas-hint span:nth-child(2) { display: none; }
  .minimap { width: 148px; height: 92px; }
}
@media (max-width: 980px) {
  .topbar { gap: 10px; padding: 0 10px; }
  .project-sub { display: none; }
  .brand-text { display: none; }
  .canvas-hint { display: none; }
  .empty-stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 1220px) {
  .top-actions .issue-badge { display: inline-grid !important; }
}

/* =========================================================
   Image upload inspector
   ========================================================= */
.hidden-file { display: none !important; }
.image-dropzone {
  position: relative; min-height: 176px; border-radius: 10px; overflow: hidden;
  border: 1px dashed rgba(255, 159, 127, 0.32);
  background: radial-gradient(150px 100px at 50% 0%, rgba(255, 159, 127, 0.08), transparent 70%), rgba(8, 13, 21, 0.5);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.image-dropzone:hover, .image-dropzone.is-dragover {
  border-color: rgba(255, 159, 127, 0.65);
  background: radial-gradient(180px 120px at 50% 0%, rgba(255, 159, 127, 0.13), transparent 72%), rgba(10, 15, 24, 0.7);
  box-shadow: 0 0 0 3px rgba(255, 159, 127, 0.06);
}
.image-dropzone.has-image { border-style: solid; min-height: 0; background: #070b11; }
.image-dropzone img { display: block; width: 100%; max-height: 300px; object-fit: contain; }
.image-empty-state { display: flex; flex-direction: column; align-items: center; gap: 5px; color: #d19a87; padding: 26px 12px; }
.image-empty-state svg { opacity: 0.9; }
.image-empty-state strong { font-size: 11.5px; font-weight: 600; color: #e0b6a7; }
.image-empty-state span { font-size: 9.5px; color: #8a7d78; }
.image-change-hint {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 5px;
  background: rgba(5, 9, 14, 0.58); color: #f2ddd4; font-size: 10.5px; font-weight: 600;
  opacity: 0; transition: opacity 0.16s;
}
.image-dropzone:hover .image-change-hint { opacity: 1; }
.image-busy-state {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: rgba(6, 10, 16, 0.82); color: #e0b6a7; font-size: 10.5px; z-index: 2;
}
.image-busy-state svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.image-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.image-meta { margin-left: auto; font-size: 9px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.image-fit-segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.fit-btn {
  height: 34px; display: flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: 7px; border: 1px solid rgba(148, 174, 210, 0.12);
  color: var(--text-dim); font-size: 10.5px; background: rgba(148, 174, 210, 0.03); transition: all 0.14s;
}
.fit-btn:hover { color: var(--text-soft); border-color: rgba(148, 174, 210, 0.24); }
.fit-btn.active { color: #ffd0c1; border-color: rgba(255, 159, 127, 0.34); background: rgba(255, 159, 127, 0.08); }

/* =========================================================
   Character inspector
   ========================================================= */
.character-portrait-panel { display: flex; gap: 10px; align-items: stretch; }
.character-portrait-preview {
  width: 118px; height: 142px; flex: 0 0 118px; border-radius: 9px; overflow: hidden;
  border: 1px solid rgba(200, 167, 255, 0.2);
  background: radial-gradient(100px 90px at 50% 20%, rgba(200, 167, 255, 0.13), transparent 72%), rgba(8, 13, 21, 0.65);
  display: grid; place-items: center;
}
.character-portrait-preview img { width: 100%; height: 100%; display: block; object-fit: cover; }
.character-portrait-preview > div { display: flex; flex-direction: column; align-items: center; gap: 6px; color: #8d7aab; font-size: 9.5px; }
.character-portrait-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 2px 0; }
.character-portrait-info strong { font-size: 11px; color: #d9c9f0; font-weight: 600; }
.character-portrait-info p { margin: 0; font-size: 9.5px; line-height: 1.6; color: var(--text-faint); }
.character-portrait-actions { margin-top: auto; display: flex; gap: 5px; flex-wrap: wrap; }
.character-portrait-actions .btn { padding: 0 8px; font-size: 9.5px; }
.character-form-grid { display: flex; flex-direction: column; gap: 8px; }
.character-input { display: flex; flex-direction: column; gap: 4px; }
.character-input > span { font-size: 9.5px; color: var(--text-faint); }
.character-stat-row { display: flex; align-items: center; gap: 6px; }
.character-stat-label { flex: 0 0 32px; font-size: 9.5px; color: var(--text-faint); }
.character-stat-row .input { flex: 1; min-width: 0; }
.character-stat-row .unit-input { flex: 0 0 66px; width: 66px; }
.character-attr-list { display: flex; flex-direction: column; gap: 7px; }
.character-attr-card { padding: 8px; border-radius: 8px; border: 1px solid rgba(200, 167, 255, 0.11); background: rgba(200, 167, 255, 0.025); }
.character-attr-head { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
.character-attr-index { width: 20px; flex: 0 0 20px; font-size: 8px; color: #8c7ca6; font-variant-numeric: tabular-nums; }
.character-attr-name { flex: 1; min-width: 0; height: 30px; font-size: 10.5px; }
.character-attr-values { display: flex; gap: 5px; margin-bottom: 5px; }
.character-attr-values .input { flex: 1; min-width: 0; height: 30px; font-size: 10.5px; }
.character-attr-values .unit-input { flex: 0 0 70px; width: 70px; }
.character-attr-desc { height: 29px; font-size: 10px; }
.character-attr-empty { padding: 17px 12px; text-align: center; border-radius: 8px; border: 1px dashed rgba(200, 167, 255, 0.16); background: rgba(200, 167, 255, 0.02); color: #8b7da1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.character-attr-empty span { font-size: 10px; color: #aa9bbf; }
.character-attr-empty small { font-size: 8.5px; line-height: 1.55; color: #756a86; }
.character-add-attr { border-color: rgba(200, 167, 255, 0.2); color: #a995c4; }
.character-display-segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.character-display-btn {
  height: 34px; display: flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: 7px; border: 1px solid rgba(200, 167, 255, 0.12);
  color: var(--text-dim); font-size: 10px; background: rgba(200, 167, 255, 0.025); transition: all 0.14s;
}
.character-display-btn:hover { color: var(--text-soft); border-color: rgba(200, 167, 255, 0.26); }
.character-display-btn.active { color: #e4d6ff; border-color: rgba(200, 167, 255, 0.38); background: rgba(200, 167, 255, 0.09); }

/* =========================================================
   Character conditions / option gates
   ========================================================= */
.condition-source-segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 6px; }
.condition-source-btn {
  height: 34px; display: flex; align-items: center; justify-content: center; gap: 5px;
  border-radius: 7px; border: 1px solid rgba(148, 174, 210, 0.12);
  color: var(--text-dim); font-size: 10.5px; background: rgba(148, 174, 210, 0.03); transition: all 0.14s;
}
.condition-source-btn:hover { color: var(--text-soft); border-color: rgba(148, 174, 210, 0.25); }
.condition-source-btn.active { color: #e2d6ff; border-color: rgba(200, 167, 255, 0.35); background: rgba(200, 167, 255, 0.08); }
.builder-var.character { color: #e1d0ff; background: rgba(200, 167, 255, 0.1); border-color: rgba(200, 167, 255, 0.16); }
.condition-unit { font-size: 8.5px; color: #9a8dac; border: 1px solid rgba(200, 167, 255, 0.14); border-radius: 4px; padding: 2px 5px; }
.sentence-preview.character { background: rgba(200, 167, 255, 0.055); border-color: rgba(200, 167, 255, 0.11); color: #cbbce2; }
.option-card.has-gate { border-color: rgba(200, 167, 255, 0.2); }
.option-gate-toggle {
  height: 20px; padding: 0 6px; border-radius: 4px; display: inline-flex; align-items: center; gap: 3px;
  font-size: 8.5px; color: #8d7ba5; border: 1px solid rgba(200, 167, 255, 0.14);
  background: rgba(200, 167, 255, 0.04); transition: all 0.14s; white-space: nowrap;
}
.option-gate-toggle:hover, .option-gate-toggle.active { color: #e1d0ff; border-color: rgba(200, 167, 255, 0.32); background: rgba(200, 167, 255, 0.1); }
.option-gate-editor {
  margin-top: 7px; padding: 8px; border-radius: 7px;
  border: 1px solid rgba(200, 167, 255, 0.13); background: rgba(200, 167, 255, 0.035);
  display: flex; flex-direction: column; gap: 5px;
}
.option-gate-row { display: flex; align-items: center; gap: 4px; }
.option-gate-kicker { flex: 0 0 34px; font-size: 8px; color: #907fa9; letter-spacing: 0.03em; }
.option-gate-row .select, .option-gate-row .input { height: 29px; font-size: 9.5px; }
.option-gate-row .gate-select { flex: 1; min-width: 0; }
.option-gate-row .gate-field { flex: 1; min-width: 0; }
.option-gate-row .gate-op { flex: 0 0 81px; width: 81px; padding-left: 5px; }
.option-gate-row .gate-value { flex: 0 0 54px; width: 54px; text-align: center; }
.option-gate-row .gate-mode { flex: 0 0 86px; width: 86px; }
.option-gate-unit { font-size: 8px; color: #9386a5; }
.option-gate-summary { display: flex; gap: 4px; align-items: flex-start; padding-top: 3px; font-size: 8.5px; line-height: 1.5; color: #9e8fae; }
.option-gate-summary svg { flex: 0 0 auto; margin-top: 1px; }
.option-gate-summary.warn { color: #d7a668; }

/* =========================================================
   Layout inspector
   ========================================================= */
.layout-resolution-card { display: flex; align-items: center; gap: 9px; padding: 10px; border-radius: 8px; border: 1px solid rgba(94, 214, 196, 0.14); background: rgba(94, 214, 196, 0.04); }
.layout-resolution-icon { width: 31px; height: 31px; flex: 0 0 31px; border-radius: 8px; display: grid; place-items: center; color: #5ed6c4; background: rgba(94, 214, 196, 0.09); border: 1px solid rgba(94, 214, 196, 0.16); }
.layout-resolution-card > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.layout-resolution-card strong { font-size: 12px; color: #d9f2ed; font-weight: 600; font-variant-numeric: tabular-nums; }
.layout-resolution-card small { font-size: 9px; color: #7f9d99; }
.layout-region-count { font-size: 8.5px; color: #88b3ac; border: 1px solid rgba(94, 214, 196, 0.15); border-radius: 4px; padding: 2px 5px; }
.layout-inspector-preview {
  position: relative; width: min(100%, calc(190px * var(--ar))); aspect-ratio: 16 / 9; max-height: 190px;
  margin: 0 auto 9px; border-radius: 7px; border: 1px solid rgba(148, 174, 210, 0.16);
  background: #070c12; background-image: linear-gradient(rgba(148,174,210,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(148,174,210,.05) 1px, transparent 1px); background-size: 20% 20%;
  overflow: hidden;
}
.layout-preview-region { position: absolute; border-radius: 3px; border: 1px solid color-mix(in srgb, var(--rc) 40%, transparent); background: color-mix(in srgb, var(--rc) 11%, transparent); color: color-mix(in srgb, var(--rc) 75%, #c8d5e4); font-size: 6.5px; line-height: 1.2; padding: 2px 3px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.layout-inspector-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.layout-chip { display: inline-flex; align-items: center; gap: 3px; font-size: 7.5px; padding: 2px 5px; border-radius: 3px; color: color-mix(in srgb, var(--rc) 70%, #aab7c8); background: color-mix(in srgb, var(--rc) 7%, transparent); border: 1px solid color-mix(in srgb, var(--rc) 14%, transparent); }
.layout-open-editor { width: 100%; margin-top: 2px; }
.character-attr-live { display: flex; align-items: center; gap: 4px; margin-top: 5px; padding: 4px 6px; border-radius: 4px; font-size: 8px; color: #79cdb7; border: 1px solid rgba(94, 214, 196, 0.13); background: rgba(94, 214, 196, 0.04); }
.character-attr-live svg { flex: 0 0 auto; }
.save-dot.error { background: #ff7288; box-shadow: 0 0 8px rgba(255, 114, 136, 0.55); }
.project-folder-btn.has-disk-file { color: #7fe0c7; border-color: rgba(94, 214, 196, 0.24); background: rgba(94, 214, 196, 0.07); }
.status-link [data-disk-status], .status-link[data-disk-status] { white-space: nowrap; }
.save-dot.offline { background: #ffbd6b; box-shadow: 0 0 8px rgba(255, 189, 107, 0.5); }
.project-folder-btn.is-offline { color: #ffcf8a; border-color: rgba(255, 189, 107, 0.24); background: rgba(255, 189, 107, 0.07); }
