:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-card: #111111;
  --bg-hover: #1a1a1a;
  --border: #333333;
  --text: #ffffff;
  --text-muted: #888888;
  --accent: #ff6b9d;
  --accent-2: #c084fc;
  --accent-soft: rgba(255, 107, 157, 0.15);
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "Cascadia Code", "Fira Code", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

/* ── landing / auth ───────────────────────────────────── */

.view {
  min-height: 100vh;
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 8vw;
  border-bottom: 1px solid transparent;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(120deg, #ff8fb8, #d8b4fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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

.hero {
  text-align: center;
  padding: 56px 8vw 40px;
  max-width: 920px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: #ffb0cb;
  background: var(--accent-soft);
  border: 1px solid rgba(255, 107, 157, 0.3);
  margin-bottom: 18px;
}

.hero h1 {
  margin: 0 0 16px;
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 560px;
  margin: 0 auto 28px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-bottom: 28px;
}

.btn-lg {
  padding: 12px 22px;
  font-size: 1rem;
  border-radius: 12px;
}

.platform-logos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.plat-pill {
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
}

.how-section {
  padding: 20px 8vw 48px;
  max-width: 1100px;
  margin: 0 auto;
}

.how-section h2 {
  text-align: center;
  margin: 0 0 24px;
  font-size: 1.35rem;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.how-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.how-num {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b9d, #c084fc);
  color: #1a1020;
  margin-bottom: 10px;
}

.how-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.how-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.feature-section {
  padding: 0 8vw 56px;
  max-width: 1100px;
  margin: 0 auto;
}

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

.feature-item {
  padding: 16px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
}

.feature-item h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
}

.feature-item p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.landing-footer {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

#viewAuth {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: min(400px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 8px 0 6px;
}

.auth-switch {
  text-align: center;
  margin-top: 16px;
}

.link-btn {
  color: var(--accent-2);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  padding: 0;
}

.back-link {
  margin-bottom: 4px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b9d55, #c084fc55);
  border: 1px solid rgba(255, 107, 157, 0.35);
}

.user-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.user-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.workflow-panel {
  margin-bottom: 16px;
}

.portable-panel {
  margin-bottom: 16px;
  border-color: rgba(192, 132, 252, 0.45);
  background: var(--bg-card);
}

.portable-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 12px 0;
}

.portable-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.portable-preview-wrap {
  margin-top: 8px;
}

.portable-preview-wrap summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

.portable-preview-wrap .context-preview {
  min-height: 120px;
  max-height: 320px;
}

.import-mode-box {
  padding: 0 14px 12px;
}

.import-mode-box select {
  font-size: 0.85rem;
}

.btn-accent {
  background: rgba(192, 132, 252, 0.18);
  border-color: rgba(192, 132, 252, 0.45);
  color: #e9d5ff;
  font-weight: 600;
}

.btn-accent:hover {
  background: rgba(192, 132, 252, 0.28);
}

.spec-body {
  margin-bottom: 12px;
}

.spec-body p {
  margin: 0 0 8px;
}

.collapsible-panel .workflow-body {
  margin-bottom: 8px;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: #e9d5ff;
}

.platform-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.plat-tab {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.85rem;
  transition: 0.15s ease;
}

.plat-tab:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.plat-tab.active {
  background: var(--accent-soft);
  border-color: rgba(255, 107, 157, 0.4);
  color: #ffb0cb;
  font-weight: 600;
}

.workflow-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.workflow-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workflow-steps li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.step-i {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: #e9d5ff;
}

.tip-line {
  margin: 12px 0 10px;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 900px) {
  .how-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--accent-2);
}

/* ── one-shot wizard layout ───────────────────────────── */

.app-wizard {
  min-height: 100vh;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px 48px;
}

.wiz-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 28px 0 8px;
}

.wiz-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(255, 107, 157, 0.2), 0 8px 20px rgba(192, 132, 252, 0.18);
}

.wiz-brand h1 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, #ff8fb8, #d8b4fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.wiz-brand p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.wiz-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mission-banner {
  margin: 16px 0 20px;
  padding: 18px 20px;
  border-radius: var(--radius);
  border: 1px solid rgba(192, 132, 252, 0.35);
  background: linear-gradient(
    135deg,
    rgba(255, 107, 157, 0.08),
    rgba(192, 132, 252, 0.1)
  );
}

.mission-text {
  font-size: 0.95rem;
  line-height: 1.65;
  color: #e8e0f0;
  margin-bottom: 14px;
}

.mission-text em {
  color: #ffb0cb;
  font-style: normal;
  font-weight: 600;
}

.mission-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.mission-flow li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.flow-n {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ff6b9d, #c084fc);
  color: #1a1020;
}

.flow-arrow {
  color: #5b4a78;
  font-weight: 600;
}

.step-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.step-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  text-align: left;
  transition: 0.15s ease;
}

.step-tab:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.step-tab.active {
  border-color: rgba(255, 107, 157, 0.45);
  background: var(--accent-soft);
  color: #ffb0cb;
  font-weight: 600;
}

.step-tab.done:not(.active) {
  border-color: rgba(74, 222, 128, 0.3);
  color: #86efac;
}

.step-tab:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.step-num {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.step-tab.active .step-num {
  background: linear-gradient(135deg, #ff6b9d, #c084fc);
  border: none;
  color: #1a1020;
}

.step-label {
  font-size: 0.9rem;
}

.wiz-main {
  min-width: 0;
}

.session-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.9rem;
}

.session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hint-inline {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 400;
}

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
  animation: fadeStep 0.2s ease;
}

@keyframes fadeStep {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-head {
  margin-bottom: 14px;
}

.step-head h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.step-form-panel {
  max-width: 640px;
}

.step-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 16px;
}

.step-footer.between {
  justify-content: space-between;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.next-cta-panel {
  border-color: rgba(255, 107, 157, 0.35);
  background: linear-gradient(
    180deg,
    rgba(255, 107, 157, 0.08),
    var(--bg-card)
  );
}

.download-hero {
  border-color: rgba(192, 132, 252, 0.5);
}

.download-hero-inner {
  text-align: center;
  padding: 12px 8px 4px;
}

.download-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #e9d5ff;
  background: rgba(192, 132, 252, 0.18);
  border: 1px solid rgba(192, 132, 252, 0.4);
  margin-bottom: 10px;
}

.download-hero-inner h3 {
  justify-content: center;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.download-hero-inner p {
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto 12px;
  font-size: 0.92rem;
}

.download-hero .portable-actions {
  justify-content: center;
}

.restore-guide {
  border-color: rgba(74, 222, 128, 0.25);
}

.restore-guide.highlight {
  animation: guidePulse 0.6s ease 2;
}

@keyframes guidePulse {
  0%,
  100% {
    border-color: rgba(74, 222, 128, 0.25);
  }
  50% {
    border-color: rgba(74, 222, 128, 0.7);
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.12);
  }
}

.restore-steps {
  margin: 0 0 14px;
  padding-left: 1.25em;
  color: var(--text-muted);
  font-size: 0.92rem;
  line-height: 1.7;
}

.restore-steps li {
  margin-bottom: 4px;
}

.restore-note {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.25);
  font-size: 0.9rem;
  color: #bbf7d0;
}

.advanced-panel summary {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.inline-select {
  max-width: 180px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
}

.wiz-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* export prompt + dump paste */
.prompt-panel {
  border-color: rgba(255, 107, 157, 0.35);
}

.panel-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-title-row h3 {
  margin: 0;
}

.prompt-preview {
  min-height: 160px;
  max-height: 280px;
  font-size: 0.78rem;
}

.tip-list {
  margin: 12px 0 0;
  padding-left: 1.2em;
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.65;
}

.dump-paste-panel {
  border-color: rgba(192, 132, 252, 0.4);
}

.dump-textarea {
  min-height: 220px;
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.5;
}

.dump-preview-box {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(96, 165, 250, 0.35);
  background: rgba(96, 165, 250, 0.08);
  font-size: 0.9rem;
}

.dump-preview-head {
  font-weight: 600;
  color: #93c5fd;
  margin-bottom: 8px;
}

.dump-preview-list {
  margin: 8px 0 0;
  padding-left: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.dump-preview-list li {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
}

@media (max-width: 700px) {
  .step-nav {
    grid-template-columns: 1fr;
  }
  .mission-flow {
    flex-direction: column;
    align-items: flex-start;
  }
  .flow-arrow {
    display: none;
  }
}

/* layout (legacy sidebar kept for compatibility) */
.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 22px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: linear-gradient(120deg, #ff8fb8, #d8b4fe);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand p {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.sidebar-actions {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.char-list {
  flex: 1;
  overflow: auto;
  padding: 8px 10px 20px;
}

.char-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: 0.15s ease;
}

.char-item:hover {
  background: var(--bg-hover);
}

.char-item.active {
  background: var(--accent-soft);
  border-color: rgba(255, 107, 157, 0.35);
}

.char-emoji {
  font-size: 0.95rem;
  font-weight: 700;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  border-radius: 10px;
  color: var(--accent, #ff6b9d);
  flex-shrink: 0;
}

.char-title-letter {
  display: inline-grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  font-size: 0.85em;
  font-weight: 700;
  border-radius: 8px;
  background: var(--accent-soft, rgba(255, 107, 157, 0.15));
  color: var(--accent, #ff6b9d);
  vertical-align: middle;
  margin-right: 4px;
}

.char-meta {
  min-width: 0;
  flex: 1;
}

.char-meta .name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.char-meta .sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.main {
  min-width: 0;
  padding: 20px 24px 40px;
}

.empty-state {
  margin-top: 12vh;
  text-align: center;
  color: var(--text-muted);
}

.empty-state .big {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin: 0 auto 12px;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent, #ff6b9d);
  background: var(--accent-soft, rgba(255, 107, 157, 0.15));
  border-radius: 16px;
}

/* top bar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 0;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

.badge.pink {
  background: var(--accent-soft);
  border-color: rgba(255, 107, 157, 0.3);
  color: #ffb0cb;
}

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

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  transition: 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
  border-color: #54466b;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b9d, #c084fc);
  border: none;
  color: #1a1020;
  font-weight: 600;
}

.btn-primary:hover {
  filter: brightness(1.08);
  background: linear-gradient(135deg, #ff6b9d, #c084fc);
}

.btn-danger {
  color: #fecaca;
  border-color: rgba(248, 113, 113, 0.4);
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.12);
}

.btn-ghost {
  background: transparent;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.85rem;
  border-radius: 8px;
}

/* cards / panels */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #e9d5ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

@media (max-width: 1100px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: relative;
    height: auto;
  }
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* forms */
.form-grid {
  display: grid;
  gap: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

label.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
}

textarea {
  min-height: 90px;
  resize: vertical;
  font-family: inherit;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.checkbox-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

/* memory list */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.toolbar input[type="search"] {
  flex: 1;
  min-width: 160px;
}

.memory-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 62vh;
  overflow: auto;
  padding-right: 4px;
}

.memory-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 12px 10px;
  transition: border-color 0.15s;
}

.memory-card:hover {
  border-color: #5b4a78;
}

.memory-card.pinned {
  border-color: rgba(255, 107, 157, 0.45);
  background: linear-gradient(180deg, rgba(255, 107, 157, 0.08), var(--bg));
}

.memory-card.inactive {
  opacity: 0.55;
}

.memory-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 6px;
}

.tag {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.tag.cat-fact { color: #93c5fd; border-color: rgba(96, 165, 250, 0.35); }
.tag.cat-preference { color: #f9a8d4; border-color: rgba(249, 168, 212, 0.35); }
.tag.cat-event { color: #fcd34d; border-color: rgba(252, 211, 77, 0.35); }
.tag.cat-emotion { color: #fca5a5; border-color: rgba(252, 165, 165, 0.35); }
.tag.cat-relationship { color: #d8b4fe; border-color: rgba(216, 180, 254, 0.35); }
.tag.cat-habit { color: #86efac; border-color: rgba(134, 239, 172, 0.35); }
.tag.cat-taboo { color: #fb7185; border-color: rgba(251, 113, 133, 0.45); background: rgba(251, 113, 133, 0.08); }
.tag.cat-nickname { color: #fde68a; border-color: rgba(253, 230, 138, 0.35); }
.tag.cat-dialogue { color: #a5b4fc; border-color: rgba(165, 180, 252, 0.35); }

.memory-content {
  font-size: 0.95rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.memory-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.memory-actions {
  display: flex;
  gap: 4px;
}

.stars {
  color: #fbbf24;
  letter-spacing: 1px;
}

/* context panel */
.context-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  min-height: 280px;
  max-height: 55vh;
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #e8e0f0;
}

.context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 10, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

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

.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.modal.wide {
  width: min(720px, 100%);
}

.modal h3 {
  margin: 0 0 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

/* toast */
.toast-wrap {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
  max-width: 320px;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.success {
  border-left-color: var(--success);
}

@keyframes slideIn {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.suggest-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40vh;
  overflow: auto;
  margin-top: 10px;
}

.suggest-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.suggest-item .content {
  font-size: 0.9rem;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
}

.stat-chip {
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
}

.persona-box {
  white-space: pre-wrap;
  color: var(--text-muted);
  font-size: 0.88rem;
  max-height: 120px;
  overflow: auto;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: #4a3d60;
  border-radius: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
