:root {
  color-scheme: dark;
  --bg: #0b0c0f;
  --surface: #17191f;
  --surface-strong: #111319;
  --surface-muted: #242832;
  --ink: #edf0f7;
  --muted: #a5adbb;
  --subtle: #778194;
  --line: #2d333f;
  --line-strong: #424a59;
  --accent: #2563eb;
  --accent-dark: #3b82f6;
  --accent-soft: rgba(37, 99, 235, 0.18);
  --signal: #10b981;
  --signal-soft: rgba(16, 185, 129, 0.16);
  --warm: #f59e0b;
  --warm-soft: rgba(245, 158, 11, 0.16);
  --shadow: 0 18px 46px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 8px 22px rgba(0, 0, 0, 0.24);
  --radius: 8px;
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 70% 0%, rgba(51, 65, 85, 0.22), transparent 30%),
    linear-gradient(180deg, #14161c 0%, var(--bg) 42%, #07080a 100%);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  width: 100%;
  max-width: 100vw;
  min-height: 100vh;
  overflow-x: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  border-right: 1px solid var(--line);
  background: rgba(15, 17, 22, 0.9);
  backdrop-filter: blur(18px);
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: var(--radius);
  background: #2563eb;
  color: #ffffff;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 14px 28px rgba(16, 24, 40, 0.18);
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.pane-header h3,
.pane-header p,
.section-title h2 {
  margin: 0;
}

.brand h1 {
  font-size: 18px;
  letter-spacing: 0;
  line-height: 1.2;
}

.brand p,
.pane-header p,
.memory-card p,
.model-card p,
.field span,
.mini-field span,
.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.18), rgba(16, 185, 129, 0.12));
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    transform 0.18s ease;
}

.home-link:hover,
.home-link:focus-visible {
  border-color: rgba(96, 165, 250, 0.78);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.28), rgba(16, 185, 129, 0.18));
  outline: none;
  transform: translateY(-1px);
}

.home-link svg {
  width: 17px;
  height: 17px;
}

.feature-nav {
  display: grid;
  gap: 6px;
}

.feature-button {
  position: relative;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 11px;
  align-items: center;
  width: 100%;
  min-height: 56px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  padding: 11px 12px;
  text-align: left;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease;
}

.feature-button::before {
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
  opacity: 0;
}

.feature-button:hover {
  background: var(--surface-muted);
}

.feature-button svg {
  width: 20px;
  height: 20px;
  color: var(--subtle);
}

.feature-button strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.feature-button span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  margin-top: 3px;
}

.feature-button.active {
  border-color: #dbeafe;
  background: var(--accent-soft);
  box-shadow: var(--shadow-soft);
}

.feature-button.active::before {
  opacity: 1;
}

.feature-button.active svg {
  color: var(--accent);
}

.model-card,
.library-card,
.memory-card {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.model-card {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.library-card {
  display: grid;
  gap: 10px;
  margin-top: 2px;
}

.memory-card {
  margin-top: auto;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title h2 {
  font-size: 14px;
}

.section-title svg {
  width: 18px;
  color: var(--signal);
}

.model-card .section-title svg {
  color: var(--accent);
}

.library-card .section-title svg {
  color: var(--warm);
}

.library-card p {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.library-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.library-actions .secondary-button,
.library-actions .ghost-button {
  min-height: 34px;
  padding: 0 9px;
  font-size: 12px;
}

.library-actions svg {
  width: 15px;
  height: 15px;
}

.gem-library-actions {
  margin-top: 8px;
}

.model-status {
  margin: -2px 0 0;
  line-height: 1.45;
}

.mini-field {
  display: grid;
  gap: 5px;
}

.mini-field span {
  font-weight: 700;
}

.mini-field input,
.mini-field select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 8px 9px;
  outline: none;
}

.mini-field input:focus,
.mini-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.check-field input {
  width: 14px;
  height: 14px;
}

.model-save-button {
  justify-self: start;
}

.workspace {
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  gap: 16px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  padding: 18px;
  overflow-x: hidden;
}

.topbar,
.input-pane,
.settings-pane,
.result-area {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(23, 25, 31, 0.94);
  box-shadow: var(--shadow-soft);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.topbar > div:first-child {
  min-width: 0;
}

.topbar-actions {
  flex: 0 0 auto;
}

.topbar h2 {
  font-size: 28px;
  letter-spacing: 0;
  line-height: 1.1;
}

.eyebrow {
  margin-bottom: 5px;
}

.topbar-actions,
.control-row,
.pane-header,
.result-tabs,
.feedback-layout {
  display: flex;
  align-items: center;
}

.topbar-actions,
.control-row {
  gap: 10px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  min-height: 0;
  min-width: 0;
}

.input-pane,
.settings-pane {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 16px;
  overflow: visible;
}

.settings-pane {
  background: var(--surface);
}

.pane-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.pane-header.compact {
  align-items: flex-start;
}

.pane-header h3 {
  font-size: 16px;
}

#sourceText {
  flex: 1;
  min-height: 220px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  outline: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

textarea {
  resize: none;
  padding: 14px;
  line-height: 1.7;
}

textarea::placeholder {
  color: var(--subtle);
}

input {
  height: 40px;
  padding: 0 12px;
}

select {
  height: 40px;
  padding: 0 34px 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(37, 99, 235, 0.75);
  background: #151922;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 12px;
}

.field span {
  font-weight: 600;
}

.small-textarea {
  min-height: 118px;
}

.gem-mode-field {
  margin-bottom: 10px;
}

.gem-mode-selector {
  width: 100%;
  border-color: rgba(37, 99, 235, 0.42);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.16), rgba(16, 185, 129, 0.1)),
    var(--surface-strong);
  color: var(--ink);
  font-weight: 700;
}

.gem-default-note {
  margin: 0 0 14px;
  border: 1px solid rgba(16, 185, 129, 0.25);
  border-radius: var(--radius);
  background: rgba(16, 185, 129, 0.1);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  padding: 11px 12px;
}

.gem-custom-fields {
  display: grid;
  gap: 2px;
}

.gem-custom-actions {
  display: grid;
  gap: 10px;
}

.feedback-textarea {
  min-height: 130px;
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button,
.icon-button,
.tab-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 0 13px;
  white-space: nowrap;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.primary-button svg,
.secondary-button svg,
.ghost-button svg,
.text-button svg,
.icon-button svg,
.tab-button svg {
  width: 17px;
  height: 17px;
  margin-right: 7px;
}

.icon-button {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.icon-button svg {
  margin: 0;
}

.icon-button:hover,
.ghost-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.primary-button {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.22);
}

.primary-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.secondary-button {
  border-color: #bbf7d0;
  background: var(--signal-soft);
  color: #047857;
}

.secondary-button:hover {
  border-color: #86efac;
  background: #dcfce7;
}

.ghost-button,
.text-button {
  border-color: var(--line);
  background: var(--surface-strong);
  color: var(--ink);
}

.text-button {
  border-color: transparent;
  color: var(--accent);
}

.text-button:hover {
  background: var(--accent-soft);
}

.result-area {
  display: grid;
  grid-template-rows: auto minmax(320px, auto);
  min-height: 420px;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
}

.result-tabs {
  gap: 6px;
  border-bottom: 1px solid var(--line);
  padding: 8px;
  background: var(--surface-strong);
}

.tab-button {
  min-height: 34px;
  background: transparent;
  color: var(--muted);
}

.tab-button:hover {
  background: var(--surface-muted);
}

.tab-button.active {
  background: #101828;
  color: #ffffff;
}

.export-button {
  margin-left: auto;
  border-color: rgba(52, 211, 153, 0.32);
  color: #8cf0c8;
}

.export-button:hover {
  border-color: rgba(52, 211, 153, 0.58);
  background: rgba(16, 185, 129, 0.14);
}

.result-panel {
  display: none;
  min-height: 320px;
  padding: 16px;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-gutter: stable;
}

.result-panel.active {
  display: block;
  height: auto;
}

.result-panel.active:has(.storyboard-output) {
  display: block;
  min-height: 0;
}

.result-panel.active:has(.summary-output) {
  display: block;
  min-height: 0;
}

.result-panel.active:has(.visual-rules-output) {
  display: block;
  min-height: 0;
}

pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.75;
}

.text-output {
  min-height: 280px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
  font-family:
    "SFMono-Regular", Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 13px;
  line-height: 1.75;
}

.model-output {
  min-height: 280px;
  height: auto;
  display: grid;
  place-items: center;
  white-space: normal;
}

.model-thinking-output {
  display: grid;
  min-height: 280px;
  height: auto;
  place-items: center;
}

.continuation-map-output {
  min-height: 280px;
  color: var(--ink);
  overflow-x: auto;
  overflow-y: visible;
  padding-bottom: 10px;
}

.continuation-map {
  min-width: 100%;
  width: max-content;
}

.mind-map-board {
  display: flex;
  align-items: flex-start;
  gap: 42px;
  min-width: 100%;
  width: max-content;
  padding: 4px 0 16px;
}

.mind-center {
  position: relative;
  flex: 0 0 280px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(63, 105, 255, 0.42);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.2), rgba(20, 184, 166, 0.09));
  padding: 14px 16px;
  z-index: 2;
}

.mind-center::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 100%;
  width: 42px;
  height: 2px;
  background: linear-gradient(90deg, rgba(63, 105, 255, 0.78), rgba(20, 184, 166, 0.38));
  transform: translateY(-50%);
}

.mind-center span,
.mind-route-top span,
.mind-branch span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.mind-center strong {
  font-size: 18px;
}

.mind-center p,
.mind-core,
.mind-branch p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.mind-count {
  justify-self: start;
  border: 1px solid rgba(63, 105, 255, 0.45);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.52);
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  padding: 6px 10px;
  white-space: nowrap;
}

.mind-route-lanes {
  position: relative;
  display: grid;
  gap: 16px;
  min-width: 720px;
  padding-left: 22px;
}

.mind-route-lanes::before {
  content: "";
  position: absolute;
  top: 28px;
  bottom: 28px;
  left: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(63, 105, 255, 0.72), rgba(20, 184, 166, 0.32));
}

.mind-route-card {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 12px;
  width: max-content;
  min-width: 720px;
  overflow: visible;
}

.mind-route-card::before {
  content: "";
  position: absolute;
  top: 30px;
  right: 100%;
  width: 22px;
  height: 2px;
  background: rgba(63, 105, 255, 0.72);
}

.mind-route-summary,
.mind-branch {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.mind-route-summary {
  position: relative;
  flex: 0 0 270px;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px 16px;
}

.mind-route-summary::after {
  content: "";
  position: absolute;
  top: 30px;
  left: 100%;
  width: 12px;
  height: 2px;
  background: rgba(63, 105, 255, 0.55);
}

.mind-route-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mind-route-top b {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 12px;
  padding: 4px 9px;
}

.mind-route-summary h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.mind-core {
  border-left: 2px solid rgba(63, 105, 255, 0.55);
  padding-left: 10px;
}

.mind-node-chain {
  display: flex;
  align-items: stretch;
  gap: 12px;
}

.mind-branch {
  position: relative;
  flex: 0 0 220px;
  display: grid;
  align-content: start;
  gap: 6px;
  padding: 12px;
  background: var(--surface-strong);
}

.mind-branch::before {
  content: "";
  position: absolute;
  top: 30px;
  right: 100%;
  width: 12px;
  height: 2px;
  background: rgba(63, 105, 255, 0.42);
}

.mind-branch p {
  color: var(--ink);
}

.model-thinking {
  display: grid;
  gap: 10px;
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.model-thinking strong {
  color: var(--ink);
  font-size: 16px;
}

.model-thinking p,
.model-thinking em {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  line-height: 1.6;
}

.thinking-progress {
  position: relative;
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-muted);
}

.thinking-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #7c3aed, var(--signal));
  animation: thinking-slide 1.2s ease-in-out infinite;
}

@keyframes thinking-slide {
  0% {
    transform: translateX(-105%);
  }
  50% {
    transform: translateX(75%);
  }
  100% {
    transform: translateX(245%);
  }
}

.model-required {
  max-width: 560px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.model-required strong,
.model-required span {
  display: block;
}

.model-required strong {
  color: var(--ink);
  font-size: 16px;
}

.model-required p {
  color: var(--muted);
  margin: 10px 0;
}

.model-required span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.storyboard-output {
  display: block;
  height: auto;
  min-width: 0;
  min-height: 0;
  width: 100%;
  max-width: 100%;
}

.line-storyboard-note {
  border: 1px solid rgba(59, 130, 246, 0.36);
  border-radius: var(--radius);
  background: rgba(37, 99, 235, 0.14);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.6;
  margin: 0 0 10px;
  padding: 10px 12px;
}

.line-storyboard-card-list {
  display: grid;
  gap: 12px;
}

.line-storyboard-card {
  border: 1px solid #222938;
  border-radius: var(--radius);
  background: #05070b;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  padding: 14px;
}

.line-storyboard-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.line-storyboard-card-header strong {
  color: #f8fafc;
  font-size: 14px;
}

.line-storyboard-copy {
  min-height: 30px;
  padding: 5px 10px;
}

.line-storyboard-card-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e5edf8;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.85;
}

.visual-rules-output {
  color: var(--ink);
  height: auto;
  min-height: 0;
  overflow: visible;
  width: 100%;
  max-width: 100%;
}

.visual-rules-board {
  display: grid;
  gap: 14px;
}

.visual-rules-text-board {
  display: grid;
  gap: 12px;
}

.visual-rules-text-card {
  border: 1px solid #222938;
  border-radius: var(--radius);
  background: #05070b;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  padding: 14px;
}

.visual-rules-text-card-text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: #e5edf8;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.9;
}

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

.visual-rules-block,
.visual-keyword-panel,
.visual-rule-list,
.visual-rule-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.visual-rules-block h4,
.visual-keyword-panel h4,
.visual-rule-list h4,
.visual-rule-card h4,
.visual-rules-section h3 {
  margin: 0 0 8px;
  font-size: 14px;
}

.visual-rules-block p,
.visual-rule-card p {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.75;
  margin: 0;
}

.visual-keyword-panel > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.visual-keyword-panel span {
  border: 1px solid rgba(96, 165, 250, 0.36);
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
  padding: 5px 9px;
}

.visual-keyword-panel em {
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
}

.visual-rules-section {
  display: grid;
  gap: 10px;
}

.visual-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.visual-rule-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
}

.visual-rule-list li {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}

.summary-output {
  height: auto;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  width: 100%;
  max-width: 100%;
}

.summary-board {
  display: grid;
  grid-template-rows: auto auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  color: var(--ink);
}

.summary-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.summary-header strong,
.summary-header span {
  display: block;
}

.summary-header strong {
  font-size: 15px;
}

.summary-header span,
.summary-header em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.summary-header span {
  margin-top: 3px;
}

.summary-header em {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  padding: 6px 10px;
  white-space: nowrap;
}

.summary-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: visible;
  padding: 2px 6px 16px 2px;
}

.summary-line-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 14px;
}

.summary-line-index {
  display: grid;
  width: 46px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #101828;
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.summary-line-row p {
  margin: 0;
}

.summary-line-row p {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.8;
}

.asset-output {
  height: auto;
  min-height: 0;
  overflow: visible;
  width: 100%;
  max-width: 100%;
  color: var(--ink);
}

.asset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.asset-header strong {
  display: block;
  font-size: 15px;
}

.asset-header span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.continuation-card-header {
  margin-bottom: 8px;
}

.continuation-summary {
  max-width: 980px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin: 0 0 14px;
}

.asset-section,
.asset-grid-section {
  margin-top: 14px;
}

.asset-section h3,
.asset-grid-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.character-rail {
  display: grid;
  grid-auto-columns: minmax(380px, 520px);
  grid-auto-flow: column;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 14px;
  scroll-snap-type: x proximity;
}

.character-card {
  display: flex;
  flex-direction: column;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 14px;
  scroll-snap-align: start;
}

.continuation-card-rail {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 360px);
  grid-template-columns: none;
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 16px;
}

.continuation-card {
  min-height: 430px;
  width: 100%;
}

.continuation-card .avatar-mark {
  border-radius: 999px;
  font-size: 14px;
}

.continuation-card dl {
  gap: 12px;
}

.continuation-card dd {
  line-height: 1.65;
}

.continuation-question-map {
  width: 100%;
  max-width: 1180px;
}

.continuation-question-board {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 16px;
}

.continuation-question-board h3 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--ink);
}

.continuation-question-note {
  border: 1px solid rgba(37, 99, 235, 0.45);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.16);
  padding: 12px;
}

.continuation-question-note b {
  display: block;
  color: #93c5fd;
  margin-bottom: 6px;
}

.continuation-question-note p,
.continuation-next-action {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.continuation-question-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.continuation-question-list li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 10px;
}

.continuation-question-list span {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
}

.continuation-question-list p {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
}

.continuation-question-list.muted span {
  background: #334155;
}

.continuation-card .character-actions li b {
  display: block;
  color: #edf0f7;
  font-size: 12px;
  margin-bottom: 3px;
}

.character-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.asset-card-copy {
  margin-left: auto;
  min-height: 30px;
  padding: 0 10px;
}

.avatar-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border-radius: var(--radius);
  background: #101828;
  color: #ffffff;
  font-weight: 800;
}

.character-card h4,
.character-card p,
.character-card dl,
.character-card dd,
.character-card ul {
  margin: 0;
}

.character-card h4 {
  font-size: 17px;
}

.character-card-top p {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.character-card dl {
  display: grid;
  gap: 10px;
  padding: 12px 0;
}

.character-card dt,
.character-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.character-card dd {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
  margin-top: 3px;
}

.character-actions {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.character-actions ul {
  display: grid;
  gap: 6px;
  padding-left: 16px;
  margin-top: 7px;
}

.character-actions li {
  color: #c9d7ee;
  font-size: 12px;
  line-height: 1.45;
}

.character-image-prompt {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 10px;
}

.character-image-prompt-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.character-image-prompt-top span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.character-image-prompt-text {
  max-height: 180px;
  overflow: auto;
  border: 1px solid rgba(107, 124, 158, 0.22);
  border-radius: 8px;
  background: rgba(8, 13, 24, 0.62);
  padding: 10px;
  font-size: 12px;
  line-height: 1.65;
}

.evidence-line {
  margin-top: auto !important;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  padding-top: 10px;
}

.asset-grid-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.mini-asset-grid,
.asset-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.mini-asset-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 12px;
}

.mini-asset-card strong,
.mini-asset-card span {
  display: block;
}

.mini-asset-card strong {
  font-size: 14px;
}

.mini-asset-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

.mini-asset-card p,
.asset-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 7px 0 0;
}

.asset-detail-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 14px;
  min-height: 210px;
}

.asset-detail-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.asset-detail-card h4,
.asset-detail-card dl,
.asset-detail-card dd {
  margin: 0;
}

.asset-detail-card h4 {
  font-size: 17px;
  margin-top: 10px;
}

.asset-detail-card > span {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  margin-top: 4px;
}

.asset-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  padding: 0 9px;
}

.asset-detail-card dl {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.asset-detail-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.asset-detail-card dd {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 4px;
}

.storyboard-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.storyboard-toolbar strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.storyboard-toolbar span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.storyboard-warning {
  max-width: 520px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: rgba(245, 158, 11, 0.14);
  color: #ffd38a;
  font-size: 12px;
  line-height: 1.5;
  padding: 8px 10px;
}

.storyboard-loading {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.loader-line {
  width: min(320px, 80%);
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
  margin-bottom: 14px;
}

.loader-line::before {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  content: "";
  animation: loaderMove 1.1s ease-in-out infinite;
}

@keyframes loaderMove {
  0% {
    transform: translateX(-110%);
  }

  100% {
    transform: translateX(250%);
  }
}

.storyboard-table-wrap {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  max-height: none;
  border: 1px solid #222938;
  border-radius: var(--radius);
  background: #05070b;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.16);
}

.storyboard-meta-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.storyboard-meta-lead {
  display: grid;
  gap: 6px;
  border: 1px solid #dbeafe;
  border-radius: var(--radius);
  background: rgba(37, 99, 235, 0.18);
  padding: 12px 14px;
}

.storyboard-meta-lead span,
.storyboard-meta-column h4,
.storyboard-meta-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.storyboard-meta-lead p {
  margin: 0;
  color: #edf4ff;
  font-size: 13px;
  line-height: 1.6;
}

.storyboard-meta-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.storyboard-meta-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px;
}

.storyboard-meta-column h4 {
  margin: 0 0 10px;
}

.storyboard-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.storyboard-meta-card {
  display: grid;
  gap: 7px;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 10px;
}

.storyboard-meta-card strong {
  color: var(--ink);
  font-size: 15px;
}

.storyboard-meta-card em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.storyboard-meta-card p,
.storyboard-empty-note {
  margin: 0;
  color: #475467;
  font-size: 12px;
  line-height: 1.55;
}

.storyboard-meta-card b {
  color: var(--ink);
}

.storyboard-table {
  width: 100%;
  min-width: 1240px;
  border-collapse: collapse;
  table-layout: fixed;
  background: #05070b;
  color: #f8fafc;
}

.storyboard-table th,
.storyboard-table td {
  border: 1px solid #2a3140;
  vertical-align: middle;
}

.storyboard-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 38px;
  background: #090d14;
  color: #f4c56a;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.storyboard-table td {
  min-height: 108px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.55;
}

.storyboard-table th:nth-child(1),
.storyboard-table td:nth-child(1) {
  width: 72px;
}

.storyboard-table th:nth-child(2),
.storyboard-table td:nth-child(2) {
  width: 92px;
}

.storyboard-table th:nth-child(3),
.storyboard-table td:nth-child(3) {
  width: 86px;
}

.storyboard-table th:nth-child(4),
.storyboard-table td:nth-child(4) {
  width: 150px;
}

.storyboard-table th:nth-child(5),
.storyboard-table td:nth-child(5) {
  width: 370px;
}

.storyboard-table th:nth-child(6),
.storyboard-table td:nth-child(6) {
  width: 330px;
}

.storyboard-table th:nth-child(7),
.storyboard-table td:nth-child(7) {
  width: 150px;
}

.storyboard-table-v2 {
  min-width: 2300px;
}

.storyboard-table-v2 th:nth-child(1),
.storyboard-table-v2 td:nth-child(1) {
  width: 84px;
}

.storyboard-table-v2 th:nth-child(2),
.storyboard-table-v2 td:nth-child(2) {
  width: 150px;
}

.storyboard-table-v2 th:nth-child(3),
.storyboard-table-v2 td:nth-child(3) {
  width: 170px;
}

.storyboard-table-v2 th:nth-child(4),
.storyboard-table-v2 td:nth-child(4) {
  width: 230px;
}

.storyboard-table-v2 th:nth-child(5),
.storyboard-table-v2 td:nth-child(5) {
  width: 240px;
}

.storyboard-table-v2 th:nth-child(6),
.storyboard-table-v2 td:nth-child(6) {
  width: 210px;
}

.storyboard-table-v2 th:nth-child(7),
.storyboard-table-v2 td:nth-child(7) {
  width: 230px;
}

.storyboard-table-v2 th:nth-child(8),
.storyboard-table-v2 td:nth-child(8),
.storyboard-table-v2 th:nth-child(9),
.storyboard-table-v2 td:nth-child(9) {
  width: 170px;
}

.storyboard-table-v2 th:nth-child(10),
.storyboard-table-v2 td:nth-child(10) {
  width: 82px;
}

.storyboard-table-v2 th:nth-child(11),
.storyboard-table-v2 td:nth-child(11) {
  width: 560px;
}

.storyboard-table-v2 .shot-seedance-prompt {
  color: #e8f1ff;
  line-height: 1.7;
  text-align: left;
  vertical-align: top;
}

.shot-number {
  color: #ffffff;
  font-family: Impact, "Arial Black", sans-serif;
  font-size: 48px;
  line-height: 1;
  text-align: center;
}

.shot-number-v2 {
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
}

.shot-time,
.shot-note {
  color: #d1d5db;
  text-align: center;
}

.shot-move {
  color: #f8fafc;
  font-weight: 700;
  text-align: center;
}

.shot-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  min-height: 28px;
  border: 1px solid #374151;
  border-radius: 999px;
  background: #111827;
  color: #e5e7eb;
}

.shot-description {
  color: #f9fafb;
}

.shot-action {
  color: #e5e7eb;
}

.story-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  min-height: 118px;
  overflow: hidden;
  border: 1px solid #384152;
  border-radius: 4px;
  background: linear-gradient(180deg, #1e293b 0%, #111827 56%, #05070b 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.image-frame img,
.move-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.story-frame.mood-night {
  background: linear-gradient(180deg, #111827 0%, #1f2937 42%, #030712 100%);
}

.story-frame.mood-warm {
  background: linear-gradient(180deg, #46220d 0%, #78350f 45%, #111827 100%);
}

.story-frame.mood-mist {
  background: linear-gradient(180deg, #334155 0%, #64748b 46%, #111827 100%);
}

.frame-sky,
.frame-depth,
.frame-figure,
.frame-prop,
.frame-vignette {
  position: absolute;
}

.frame-sky {
  left: 0;
  right: 0;
  top: 0;
  height: 42%;
  background:
    radial-gradient(circle at 76% 22%, rgba(255, 255, 255, 0.5) 0 2px, transparent 3px),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
}

.frame-depth {
  left: 8%;
  right: 8%;
  bottom: 18%;
  height: 34%;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 26px),
    linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.18));
}

.frame-figure {
  bottom: 18%;
  width: 24px;
  height: 54px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, #f8fafc 0 18%, #94a3b8 19% 100%);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.32);
}

.frame-figure.primary {
  left: 38%;
}

.frame-figure.secondary {
  left: 52%;
  height: 48px;
  background: linear-gradient(180deg, #fef3c7 0 18%, #f97316 19% 100%);
}

.frame-prop {
  left: 18%;
  bottom: 18%;
  width: 40px;
  height: 22px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 3px;
  transform: skewX(-8deg);
}

.frame-vignette {
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.38), transparent 24%, transparent 76%, rgba(0, 0, 0, 0.38)),
    linear-gradient(180deg, transparent 56%, rgba(0, 0, 0, 0.42));
}

.move-diagram {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 8px;
  color: #e5e7eb;
}

.camera-icon {
  position: relative;
  width: 28px;
  height: 20px;
  border: 2px solid #e5e7eb;
  border-radius: 4px;
}

.camera-icon::before {
  position: absolute;
  left: -8px;
  top: 4px;
  width: 8px;
  height: 10px;
  border: 2px solid #e5e7eb;
  border-right: 0;
  border-radius: 3px 0 0 3px;
  content: "";
}

.camera-icon::after {
  position: absolute;
  right: -8px;
  top: 5px;
  width: 0;
  height: 0;
  border-left: 8px solid #e5e7eb;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  content: "";
}

.move-diagram svg {
  width: 100%;
  height: 68px;
  grid-column: 2;
}

.move-diagram path,
.move-diagram circle {
  fill: none;
  stroke: #f8fafc;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 3;
}

.move-diagram .dashed-line {
  stroke-dasharray: 7 7;
}

.move-diagram .muted-line {
  opacity: 0.5;
}

.move-diagram span {
  grid-column: 1 / -1;
  color: #cbd5e1;
  font-size: 12px;
  text-align: center;
}

.move-image {
  display: grid;
  gap: 6px;
  color: #cbd5e1;
  text-align: center;
}

.move-image img {
  aspect-ratio: 16 / 9;
  border: 1px solid #384152;
  border-radius: 4px;
  background: #05070b;
}

.move-image span {
  font-size: 12px;
}

.feedback-layout {
  align-items: flex-end;
  gap: 14px;
}

.feedback-layout .field {
  flex: 1;
  margin: 0;
}

.density-field {
  max-width: 180px;
  flex: 0 0 180px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(360px, calc(100vw - 36px));
  border-radius: var(--radius);
  background: #101828;
  color: white;
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  padding: 11px 14px;
  box-shadow: var(--shadow);
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.library-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.42);
  padding: 48px 48px 48px 280px;
  z-index: 20;
}

.library-modal.open {
  display: flex;
}

.library-dialog {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1540px, calc(100vw - 328px));
  height: min(820px, calc(100vh - 96px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

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

.library-dialog-header h2 {
  margin: 0;
  font-size: 22px;
}

.library-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-strong);
  padding: 10px 14px;
  overflow-x: auto;
}

.library-tab {
  min-height: 34px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  white-space: nowrap;
}

.library-tab.active {
  border-color: #dbeafe;
  background: var(--accent-soft);
  color: var(--accent);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.library-item {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 12px;
}

.library-item strong,
.library-title-input {
  color: var(--ink);
  font-size: 14px;
}

.library-title-input {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  font-weight: 800;
  line-height: 1.35;
  padding: 4px 6px;
}

.library-title-input:hover {
  background: var(--surface-muted);
  border-color: var(--line-strong);
}

.library-title-input:focus {
  outline: 2px solid rgba(63, 105, 255, 0.18);
  border-color: #9db5ff;
  background: #151922;
}

.library-item span,
.library-item p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 0;
}

.library-item-actions {
  display: flex;
  gap: 8px;
}

.library-empty {
  color: var(--muted);
  font-size: 13px;
}

.topbar,
.input-pane,
.settings-pane,
.result-area,
.model-card,
.library-card,
.memory-card,
.library-dialog,
.library-item,
.model-thinking,
.summary-output,
.extraction-output,
.storyboard-meta-panel,
.character-card,
.asset-card {
  background: rgba(23, 25, 31, 0.94);
  border-color: var(--line);
  box-shadow: var(--shadow-soft);
}

.sidebar,
.result-tabs,
.library-dialog-header,
.library-tabs,
.library-list {
  background-color: rgba(17, 19, 25, 0.94);
}

textarea,
input,
select,
.icon-button,
.ghost-button,
.text-button,
.tab-button,
.library-tab,
.library-item-output,
.summary-list,
.summary-line-row,
.storyboard-card,
.scene-card {
  background: var(--surface-strong);
  color: var(--ink);
  border-color: var(--line-strong);
}

textarea:focus,
input:focus,
select:focus {
  background: #151922;
  border-color: rgba(96, 165, 250, 0.82);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24);
}

.feature-button:hover,
.ghost-button:hover,
.icon-button:hover,
.tab-button:hover,
.text-button:hover {
  background: var(--surface-muted);
}

.feature-button.active,
.library-tab.active {
  border-color: rgba(96, 165, 250, 0.42);
  background: rgba(37, 99, 235, 0.18);
}

.primary-button {
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.32);
}

.secondary-button {
  border-color: rgba(52, 211, 153, 0.36);
  background: rgba(16, 185, 129, 0.14);
  color: #8cf0c8;
}

.secondary-button:hover {
  border-color: rgba(52, 211, 153, 0.58);
  background: rgba(16, 185, 129, 0.22);
}

.tab-button.active,
.summary-number,
.storyboard-shot-number {
  background: rgba(37, 99, 235, 0.72);
  color: #f8fbff;
}

pre,
.text-output,
.model-thinking strong,
.summary-header strong,
.summary-line-row p,
.asset-header strong,
.character-card-top strong,
.library-item h3 {
  color: var(--ink);
}

.model-thinking p,
.summary-header span,
.summary-header em,
.asset-header span,
.character-card-top p,
.library-item-meta,
.library-item-preview {
  color: var(--muted);
}

.status-pill,
.scene-pill,
.format-pill {
  background: var(--surface-muted);
  color: var(--muted);
}

.storyboard-meta-lead,
.storyboard-meta-column,
.storyboard-meta-card {
  border-color: rgba(96, 165, 250, 0.42);
  background: rgba(37, 99, 235, 0.18);
}

.storyboard-meta-lead p,
.storyboard-meta-card strong,
.storyboard-meta-card b {
  color: #edf4ff;
}

.storyboard-meta-card p,
.storyboard-empty-note {
  color: #c9d7ee;
}

.storyboard-meta-card em {
  color: #9fb7dc;
}

.storyboard-meta-lead span,
.storyboard-meta-column h4,
.storyboard-meta-card span {
  color: #60a5fa;
}

* {
  scrollbar-color: #5f6775 #111319;
}

*::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

*::-webkit-scrollbar-track {
  background: #111319;
}

*::-webkit-scrollbar-thumb {
  border: 2px solid #111319;
  border-radius: 999px;
  background: #5f6775;
}

*::-webkit-scrollbar-thumb:hover {
  background: #7b8494;
}

.tab-button.active,
.summary-number,
.storyboard-shot-number,
.summary-line-index,
.avatar-mark {
  background: rgba(37, 99, 235, 0.72);
  color: #f8fbff;
}

.model-required,
.summary-line-row,
.character-card,
.mini-asset-card,
.asset-detail-card,
.library-item {
  background: rgba(23, 25, 31, 0.94);
  border-color: var(--line-strong);
}

.character-card h4,
.character-card dd,
.character-actions li,
.evidence-line,
.mini-asset-card strong,
.mini-asset-card p,
.asset-detail-card h4,
.asset-detail-card dd,
.summary-line-row p,
.model-required strong,
.library-item strong,
.library-title-input {
  color: #edf0f7;
}

.character-card dt,
.character-actions span,
.asset-detail-card dt,
.asset-detail-card > span,
.model-required p,
.model-required span,
.library-item span,
.library-item p,
.mini-asset-card span,
.asset-empty {
  color: #b8c1d1;
}

.asset-chip,
.mini-asset-card span {
  background: rgba(37, 99, 235, 0.22);
  color: #8fc2ff;
}

.library-title-input:hover,
.library-title-input:focus {
  background: #151922;
  border-color: rgba(96, 165, 250, 0.52);
}

.storyboard-warning {
  border-color: rgba(245, 158, 11, 0.42);
  background: rgba(245, 158, 11, 0.14);
  color: #ffd38a;
}

.model-status,
.field span,
.mini-field span,
.check-field,
.section-title h2,
.asset-section h3,
.asset-grid-section h3 {
  color: #dbe4f0;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .feature-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .memory-card {
    margin-top: 0;
  }

  .workspace {
    grid-template-rows: auto auto auto;
  }

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

  .storyboard-meta-grid {
    grid-template-columns: 1fr;
  }

  .library-modal {
    padding: 20px;
  }

  .library-dialog {
    width: calc(100vw - 40px);
    height: calc(100vh - 40px);
  }

}

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 14px;
  }

  .feature-nav {
    grid-template-columns: 1fr;
  }

  .topbar,
  .feedback-layout,
  .control-row {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .text-button {
    width: 100%;
  }

  .icon-button {
    flex: 0 0 40px;
  }

  .summary-header {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-header em {
    white-space: normal;
  }

  .summary-line-row {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .summary-line-row p {
    font-size: 14px;
  }
}
