:root {
  --bg: #f3f5fb;
  --bg-elevated: rgba(255, 255, 255, 0.92);
  --bg-card: rgba(255, 255, 255, 0.88);
  --bg-subtle: rgba(15, 23, 42, 0.04);
  --border: rgba(15, 23, 42, 0.1);
  --text: #1e293b;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-light: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.2);
  --success: #059669;
  --warning: #d97706;
  --strategy-a: #2563eb;
  --strategy-b: #7c3aed;
  --strategy-c: #059669;
  --strategy-d: #ea580c;
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.bg-gradient {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99, 102, 241, 0.1), transparent),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.08), transparent),
    var(--bg);
  pointer-events: none;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
}

body[data-page="gallery"] .app,
body[data-page="demo"] .app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.85);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  width: 100%;
  max-width: none;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.brand h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.header-links a,
.tab-btn,
.nav-link {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.header-links a:hover,
.tab-btn:hover,
.nav-link:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.tab-btn.active,
.nav-link.active {
  color: var(--accent-light);
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.3);
}

.brand-link {
  text-decoration: none;
  color: inherit;
}

.brand-link:hover .brand h1 {
  color: var(--accent-light);
}

/* Layout */
.main-view {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 1.25rem 1rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.25rem;
  align-items: start;
}

body[data-page="gallery"] .main-view,
body[data-page="demo"] .main-view {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
  grid-template-rows: minmax(0, 1fr);
}

@media (min-width: 1280px) {
  .main-view {
    grid-template-columns: 300px 1fr;
    padding: 1.25rem 1.25rem;
    gap: 1.5rem;
  }
}

.hidden {
  display: none !important;
}

.main-view.hidden {
  display: none;
}

#local-view {
  display: block;
  grid-template-columns: 1fr;
  max-width: 960px;
  margin: 0 auto;
}

body[data-page="local"] .main-view {
  display: block;
  grid-template-columns: 1fr;
  max-width: 960px;
  margin: 0 auto;
}

.sidebar {
  position: sticky;
  top: 5.75rem;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

body[data-page="gallery"] .sidebar,
body[data-page="demo"] .sidebar {
  position: relative;
  top: auto;
  align-self: stretch;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.content {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
}

body[data-page="gallery"] .content,
body[data-page="demo"] .content {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

body[data-page="gallery"] .content > .pipeline-header,
body[data-page="gallery"] .content > .step-nav,
body[data-page="demo"] .content > .demo-task-card,
body[data-page="demo"] .content > .demo-build-area {
  flex-shrink: 0;
}

body[data-page="gallery"] .content > .step-content {
  flex: none;
  min-height: 0;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.875rem;
  cursor: pointer;
}

.model-display {
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(99, 102, 241, 0.25);
  background: rgba(99, 102, 241, 0.06);
  color: var(--accent-light);
  font-size: 0.875rem;
  font-weight: 600;
}

.select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.card-glass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
}

.case-info {
  padding: 1rem;
}

.case-info h3 {
  font-size: 1rem;
  margin-bottom: 0.375rem;
}

.case-info p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.case-info .domain-tag {
  display: inline-block;
  margin-top: 0.625rem;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent-light);
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.stat-item {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent-light);
}

.stat-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Content panel sections */
.pipeline-header {
  padding: 1.375rem 1.5rem 1.625rem;
}

.pipeline-header h2 {
  font-size: 1.125rem;
  margin-bottom: 0.25rem;
}

.pipeline-header p {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.pipeline-header .case-question {
  font-size: 0.875rem;
  color: var(--text);
}

.pipeline-header .dataset-desc {
  margin-top: 0.875rem;
}

.case-question-label {
  margin-top: 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.case-question-label .case-question-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.02em;
}

.case-question {
  margin-top: 0.375rem;
  line-height: 1.65;
  word-break: break-word;
}

.case-question-wrap {
  margin-top: 0.25rem;
}

.case-question-body.collapsed > .rich-question {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  overflow: hidden;
}

.case-question-body.expanded > .rich-question {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.case-question-toggle {
  margin-top: 0.35rem;
}

.collapsible-toggle.hidden {
  display: none;
}

.rich-question {
  font-size: 0.875rem;
  color: var(--text);
}

.rich-question p {
  margin: 0 0 0.65rem;
}

.rich-question p:last-child {
  margin-bottom: 0;
}

.question-heading {
  margin: 1rem 0 0.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.question-heading:first-child {
  margin-top: 0;
}

.question-label {
  margin: 0.65rem 0 0.25rem;
  font-weight: 600;
  color: var(--text);
}

.question-list {
  margin: 0.15rem 0 0.65rem 1.15rem;
  padding: 0;
}

.question-list li {
  margin: 0.15rem 0;
}

.question-answer-format {
  margin-top: 0.875rem !important;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.rich-question mjx-container {
  font-size: 105%;
}

.sample-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.step-panel-head {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.step-panel-head h2 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.step-panel-head p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.demo-result-panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap;
}

.demo-result-panel-title-row h2 {
  margin-bottom: 0;
  flex-shrink: 0;
}

.demo-stream-batch-note {
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-muted);
  text-align: right;
  white-space: nowrap;
  flex-shrink: 0;
}

.step-section h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-light);
  margin: 1.75rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(99, 102, 241, 0.18);
}

.step-section h3::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.step-section h3 .section-hint {
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0.01em;
  color: var(--text-muted);
  font-size: 0.625rem;
  margin-left: 0.125rem;
}

.step-section h3:first-child {
  margin-top: 0;
}

.step-section > p:not(.note) {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.75;
  padding: 0.875rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.step-section > .thinking-block {
  margin-top: 0;
}

.step-section > .dep-graph,
.step-section > ul:not(.bullet-list) {
  padding: 0.75rem 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.step-section > ul:not(.bullet-list) {
  margin: 0;
  padding-left: 2rem;
  font-size: 0.875rem;
  line-height: 1.6;
}

.bullet-list {
  margin: 0;
  padding: 0.75rem 1rem 0.75rem 2rem;
  font-size: 0.875rem;
  line-height: 1.65;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  list-style: disc;
}

.step-nav {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.step-tab {
  flex-shrink: 0;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-tab:hover {
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--text);
}

.step-tab.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--accent-light);
}

.step-tab .step-title {
  line-height: 1.35;
  text-align: left;
  max-width: 11rem;
}

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
}

.step-tab.active .step-num {
  background: var(--accent);
  color: white;
}

.step-content {
  flex: 1;
}

.step-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.step-panel.active {
  display: block;
  padding: 1.375rem 1.5rem 1.625rem;
}

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

.panel-card {
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}

.panel-card h3 {
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.thinking-block {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.06);
  border-left: 3px solid var(--accent);
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.collapsible-wrap {
  margin-bottom: 1rem;
}

.collapsible-body.collapsed,
.thinking-block.collapsible-body.collapsed {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--clamp-lines, 4);
  overflow: hidden;
}

.collapsible-body.expanded {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.collapsible-toggle {
  margin-top: 0.5rem;
  padding: 0.25rem 0.75rem;
  border: none;
  background: transparent;
  color: var(--accent-light);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

.collapsible-toggle:hover {
  text-decoration: underline;
}

.query-reason-block {
  margin-top: 0.5rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  font-size: 0.8125rem;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.summary-text-block {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
}

.keyword-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.75rem;
}

.keyword-category {
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.keyword-category h4 {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-light);
  margin-bottom: 0.5rem;
}

.keyword-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.tag {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
}

.strategy-section {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.strategy-section summary {
  list-style: none;
  cursor: pointer;
}

.strategy-section summary::-webkit-details-marker {
  display: none;
}

.strategy-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  user-select: none;
}

.strategy-header::before {
  content: "▸";
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.strategy-section[open] .strategy-header::before {
  transform: rotate(90deg);
}

.strategy-count {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.strategy-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.strategy-badge {
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}

.strategy-a { background: rgba(37, 99, 235, 0.12); color: var(--strategy-a); }
.strategy-b { background: rgba(124, 58, 237, 0.12); color: var(--strategy-b); }
.strategy-c { background: rgba(5, 150, 105, 0.12); color: var(--strategy-c); }
.strategy-d { background: rgba(234, 88, 12, 0.12); color: var(--strategy-d); }

.strategy-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.strategy-filter-btn {
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.strategy-filter-btn:hover {
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--text);
}

.strategy-filter-btn.active {
  background: #fff;
  border-color: var(--accent);
  color: var(--accent-light);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.12);
}

.strategy-panels {
  min-height: 120px;
}

.strategy-panel {
  display: none;
}

.strategy-panel.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

.strategy-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.strategy-count {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.strategy-panel-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.round-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin: 1rem 0 0.75rem;
}

.round-filter-btn {
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.2s;
}

.round-filter-btn:hover {
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--text);
}

.round-filter-btn.active {
  border-color: var(--accent);
  color: var(--accent-light);
  background: rgba(99, 102, 241, 0.06);
}

.round-panel {
  display: none;
}

.round-panel.active {
  display: block;
  animation: fadeIn 0.2s ease;
}

.round-query {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.query-card {
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.query-card .query-text {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.query-card .query-reason {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.search-session {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.search-session summary {
  list-style: none;
  cursor: pointer;
}

.search-session summary::-webkit-details-marker {
  display: none;
}

.search-session-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  flex-wrap: wrap;
  user-select: none;
}

.search-session-header::before {
  content: "▸";
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.search-session[open] .search-session-header::before {
  transform: rotate(90deg);
}

.session-goal {
  flex: 1;
  min-width: 160px;
  font-size: 0.8125rem;
  color: var(--text);
  line-height: 1.5;
}

.search-session-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.search-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meta-pill {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.summary-text {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.6;
}

.result-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.result-item {
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
}

.result-item a {
  color: var(--accent-light);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
}

.result-item a:hover {
  text-decoration: underline;
}

.result-item .snippet {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.source-card {
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 0.5rem;
  background: #fff;
}

.source-card .preview {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.analysis-card {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  overflow: hidden;
}

.analysis-card summary {
  list-style: none;
  cursor: pointer;
}

.analysis-card summary::-webkit-details-marker {
  display: none;
}

.analysis-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  user-select: none;
}

.analysis-summary::before {
  content: "▸";
  color: var(--text-muted);
  transition: transform 0.2s;
  flex-shrink: 0;
  margin-right: 0.25rem;
}

.analysis-card[open] .analysis-summary::before {
  transform: rotate(90deg);
}

.analysis-summary h4 {
  font-size: 0.875rem;
  margin: 0;
  color: var(--accent-light);
  flex: 1;
}

.analysis-body {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.node-card {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
  transition: border-color 0.2s;
  overflow: hidden;
}

.node-card summary {
  list-style: none;
  cursor: pointer;
}

.node-card summary::-webkit-details-marker {
  display: none;
}

.node-summary {
  padding: 1rem;
  user-select: none;
}

.node-summary::before {
  content: "▸";
  float: right;
  color: var(--text-muted);
  transition: transform 0.2s;
}

.node-card[open] .node-summary::before {
  transform: rotate(90deg);
}

.node-card:hover {
  border-color: rgba(99, 102, 241, 0.4);
}

.node-code {
  padding: 0 1rem 1rem;
  border-top: 1px solid var(--border);
}

.node-code .code-block {
  margin-top: 0.75rem;
}

.connections-panel summary {
  list-style: none;
  cursor: pointer;
  padding: 1rem 1.25rem;
}

.connections-panel summary::-webkit-details-marker {
  display: none;
}

.connections-panel summary h3 {
  display: inline;
  font-size: 0.9375rem;
}

.connections-panel summary::before {
  content: "▸ ";
  color: var(--text-muted);
}

.connections-panel[open] summary::before {
  content: "▾ ";
}

.connections-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.node-card h4 {
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
}

.node-type {
  font-size: 0.7rem;
  color: var(--success);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.node-desc {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin: 0.5rem 0;
}

.node-io {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.node-io span {
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: var(--bg-subtle);
}

.code-block {
  margin-top: 0;
  padding: 0.875rem;
  border-radius: var(--radius-sm);
  background: #eef2ff;
  border: 1px solid rgba(99, 102, 241, 0.15);
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.5;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

.code-block pre {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.pipeline-desc {
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(5, 150, 105, 0.08);
  border-left: 3px solid var(--success);
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.pipeline-graph {
  margin: 1.25rem 0 1.5rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(circle at 1px 1px, rgba(99, 102, 241, 0.08) 1px, transparent 0),
    linear-gradient(180deg, #ffffff 0%, #f8faff 100%);
  background-size: 22px 22px, auto;
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
}

.pipeline-graph-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.pipeline-graph-header h3 {
  font-size: 0.9375rem;
  margin: 0;
}

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

.pipeline-graph-scroll {
  overflow: hidden;
  width: 100%;
}

.pipeline-graph-fit {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.pipeline-graph-stage {
  position: relative;
  margin: 0;
}

.pipeline-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: visible;
}

.pipeline-edge {
  fill: none;
}

.pipeline-edge-track {
  stroke: #cbd5e1;
  stroke-width: 2;
  opacity: 0.95;
}

.pipeline-edge-flow {
  stroke: #6366f1;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-dasharray: 14 12;
  animation: pipeline-edge-flow 1.1s linear infinite;
}

@keyframes pipeline-edge-flow {
  to {
    stroke-dashoffset: -26;
  }
}

.pipeline-flow-layer {
  pointer-events: none;
}

.pipeline-flow-svg {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: visible;
}

.pipeline-flow-dot {
  fill: #4f46e5;
  stroke: #eef2ff;
  stroke-width: 1.5;
}

.pipeline-flow-dot-glow {
  fill: rgba(99, 102, 241, 0.22);
}

.pipeline-flow-dot-trail {
  fill: #818cf8;
  opacity: 0.75;
}

@media (prefers-reduced-motion: reduce) {
  .pipeline-edge-flow {
    animation: none;
    stroke-dasharray: none;
    opacity: 0.55;
  }

  .pipeline-flow-svg {
    display: none;
  }
}

.pipeline-nodes-layer {
  position: relative;
  z-index: 1;
}

.pipeline-node {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.5rem;
  border-radius: 12px;
  border: 1.5px solid rgba(99, 102, 241, 0.22);
  background: rgba(255, 255, 255, 0.96);
  box-shadow:
    0 8px 18px rgba(99, 102, 241, 0.08),
    0 2px 6px rgba(15, 23, 42, 0.04);
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
  overflow: visible;
}

.pipeline-node:hover {
  transform: translateY(-2px);
  box-shadow:
    0 14px 28px rgba(99, 102, 241, 0.12),
    0 4px 10px rgba(15, 23, 42, 0.06);
}

.pipeline-node-port {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #6366f1;
}

.pipeline-node-port-in {
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
}

.pipeline-node-port-out {
  right: -4px;
  left: auto;
  top: 50%;
  transform: translateY(-50%);
}

.pipeline-node-type {
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.pipeline-node-type-llm-generator {
  color: #059669;
}

.pipeline-node-type-tool,
.pipeline-node-type-llm-tool {
  color: #2563eb;
}

.pipeline-node-name {
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
  overflow: visible;
  width: 100%;
}

.node-section {
  margin-top: 0.5rem;
}

.node-section-title {
  font-size: 0.9375rem;
  margin: 0 0 1rem;
}

.node-card-simple {
  padding: 1rem;
}

.node-card-simple:hover {
  border-color: rgba(99, 102, 241, 0.35);
}

/* Local view */
.local-panel {
  padding: 2rem;
}

.local-panel h2 {
  font-size: 1.5rem;
  margin-bottom: 0.75rem;
}

.lead {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.reason-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.reason-card {
  padding: 1.25rem;
  border-radius: var(--radius);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.reason-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.reason-card h3 {
  font-size: 0.9375rem;
  margin-bottom: 0.375rem;
}

.reason-card p {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.local-steps {
  margin-bottom: 1.5rem;
}

.local-steps h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.local-steps ol {
  padding-left: 1.25rem;
}

.local-steps li {
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.local-steps pre {
  margin: 0.5rem 0;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  background: #eef2ff;
  border: 1px solid rgba(99, 102, 241, 0.15);
  overflow-x: auto;
}

.local-steps code,
.reason-card code {
  font-family: var(--mono);
  font-size: 0.8125rem;
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  background: #eef2ff;
}

.note {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 1rem;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.08);
  border: 1px solid rgba(99, 102, 241, 0.2);
  line-height: 1.65;
}

.step-note {
  margin-bottom: 1rem;
}

.step-note strong {
  color: var(--text);
}

/* Footer */
.footer {
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--accent-light);
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

/* Loading */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(243, 245, 251, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  z-index: 1000;
}

.loading.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 900px) {
  .main-view {
    grid-template-columns: 1fr;
  }

  body[data-page="gallery"] .app,
  body[data-page="demo"] .app {
    display: block;
    min-height: 100vh;
  }

  body[data-page="gallery"] .main-view,
  body[data-page="demo"] .main-view {
    flex: none;
    overflow: visible;
    max-height: none;
  }

  body[data-page="gallery"] .sidebar,
  body[data-page="demo"] .sidebar,
  body[data-page="gallery"] .content,
  body[data-page="demo"] .content {
    max-height: none;
    overflow: visible;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .sidebar-section {
    flex: 1;
    min-width: 140px;
  }

  .case-info,
  .stats-panel {
    width: 100%;
  }

  .demo-task-card-top {
    flex-direction: column;
  }

  .demo-task-quota {
    width: 100%;
  }
}

/* Gallery (Part 1) */
.gallery-sidebar {
  gap: 1rem;
  min-height: 0;
}

.gallery-samples-section {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

body[data-page="gallery"] .gallery-samples-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
}

body[data-page="gallery"] .gallery-samples-section .sample-pager {
  flex-shrink: 0;
}

/* Online Demo (Part 2) */
.demo-sidebar {
  gap: 1rem;
  min-height: 0;
}

.demo-presets-section {
  flex: 1;
  min-height: 0;
}

.preset-source-tabs {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.preset-source-tab {
  width: 100%;
  text-align: left;
  padding: 0.3rem 0.625rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  line-height: 1.25;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.preset-source-tab:hover {
  border-color: rgba(99, 102, 241, 0.4);
  color: var(--text);
}

.preset-source-tab.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent);
  color: var(--accent-light);
  font-weight: 600;
}

.preset-source-tab--noted {
  gap: 0.2rem;
}

.preset-source-tab-label {
  display: block;
}

.preset-source-tab-note {
  display: block;
  font-size: 0.625rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--text-muted);
}

.preset-source-tab.active .preset-source-tab-note {
  color: rgba(165, 180, 252, 0.92);
}

.preset-custom-panel {
  margin-top: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
}

.preset-custom-panel .note {
  padding: 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.demo-preset-list {
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.25rem 0;
  border-top: 1px solid var(--border);
  margin-top: 0.625rem;
}

.demo-task-card {
  margin-bottom: 0;
}

.demo-task-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 0.875rem;
}

.demo-task-card-intro {
  flex: 1 1 auto;
  min-width: 0;
}

.demo-task-quota {
  flex: 0 0 auto;
  width: min(100%, 17.5rem);
  margin: 0;
  align-self: flex-start;
}

.demo-intro {
  margin-bottom: 0.75rem;
}

.demo-intro-step {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin: 0 0 0.35rem;
}

.demo-intro-step:last-child {
  margin-bottom: 0;
}

.demo-plan-note {
  margin-bottom: 0;
  padding: 0.75rem 0.875rem;
  font-size: 0.8125rem;
  line-height: 1.6;
}

.demo-task-card .case-question-label {
  margin-top: 0;
}

.question-input {
  width: 100%;
  font-family: var(--font);
  font-size: 0.875rem;
  line-height: 1.65;
  padding: 0.875rem 1rem;
  margin-top: 0.375rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
  color: var(--text);
  resize: vertical;
  min-height: 132px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.question-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  background: #fff;
}

.demo-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.demo-phase-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.demo-phase-build {
  border-color: rgba(99, 102, 241, 0.22);
  background: rgba(99, 102, 241, 0.04);
}

.demo-phase-run {
  border-color: rgba(99, 102, 241, 0.22);
  background: rgba(99, 102, 241, 0.04);
}

.demo-phase-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.demo-phase-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

@media (max-width: 720px) {
  .demo-toolbar {
    grid-template-columns: 1fr;
  }
}

.primary-btn {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  border: none;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  color: #fff;
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: var(--font);
  box-shadow: 0 2px 8px var(--accent-glow);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

.secondary-btn {
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: var(--font);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.secondary-btn:hover:not(:disabled) {
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--accent-light);
  background: rgba(99, 102, 241, 0.06);
}

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

.stop-btn,
.resume-btn {
  padding: 0.625rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: var(--font);
  transition: border-color 0.2s, color 0.2s, background 0.2s, opacity 0.15s;
}

.stop-btn {
  border: 1px solid rgba(239, 68, 68, 0.45);
  background: rgba(239, 68, 68, 0.06);
  color: #dc2626;
}

.stop-btn:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.65);
}

.resume-btn {
  border: 1px solid rgba(16, 185, 129, 0.45);
  background: rgba(16, 185, 129, 0.06);
  color: #059669;
}

.resume-btn:hover:not(:disabled) {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.65);
}

.stop-btn:disabled,
.resume-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.demo-build-area {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.demo-empty-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
}

.demo-empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 1rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.12));
  border: 1px solid rgba(99, 102, 241, 0.2);
}

.demo-empty-state h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.demo-empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
  max-width: 36rem;
  margin: 0 auto 0.75rem;
  line-height: 1.65;
}

.demo-empty-state .note {
  display: inline-block;
  margin-top: 0.25rem;
  text-align: left;
}

.demo-stage-progress {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.demo-step-nav {
  margin-top: 0.25rem;
}

.demo-step-tab.is-running:not(.active) {
  border-color: rgba(99, 102, 241, 0.45);
  color: var(--accent-light);
}

.demo-step-tab.is-running .step-num {
  background: rgba(99, 102, 241, 0.2);
  color: var(--accent);
}

.demo-step-tab.is-done:not(.active) {
  border-color: rgba(16, 185, 129, 0.35);
}

.demo-step-tab.is-done:not(.active) .step-num {
  background: rgba(16, 185, 129, 0.15);
  color: #059669;
}

.demo-step-tab.is-pending {
  opacity: 0.72;
}

.demo-step-tab.is-failed:not(.active) {
  border-color: rgba(234, 88, 12, 0.35);
}

.demo-step-tab.is-failed:not(.active) .step-num {
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
}

.demo-step-tab.demo-result-tab.is-stopped:not(.active) {
  border-color: rgba(180, 83, 9, 0.35);
}

.demo-step-tab.demo-result-tab.is-stopped:not(.active) .step-num {
  background: rgba(180, 83, 9, 0.12);
  color: #b45309;
}

.demo-result-panel.is-failed .demo-stage-state {
  color: #c2410c;
}

.demo-result-panel.is-stopped .demo-stage-state {
  color: #b45309;
}

.demo-result-panel .answer-body {
  margin: 0;
}

.demo-run-status {
  margin: 0 0 0.75rem;
}

.run-agent-nav {
  margin: 0.75rem 0 0.875rem;
}

.run-agent-panel {
  padding: 0.875rem 1rem;
  border: 1px solid rgba(99, 102, 241, 0.14);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
}

.run-agent-panel-head {
  margin-bottom: 0.625rem;
}

.run-agent-panel-head h3 {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--text);
}

.run-node-output {
  margin: 0;
  padding: 0.75rem 0.875rem;
  font-size: 0.75rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(15, 23, 42, 0.04);
  border-radius: 6px;
  max-height: min(60vh, 36rem);
  overflow-y: auto;
}

.run-node-waiting {
  margin: 0;
  font-size: 0.8125rem;
}

.run-final-answer {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(99, 102, 241, 0.14);
}

.run-final-label {
  margin: 0 0 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.demo-step-content .step-panel {
  display: block;
}

.demo-stage-panel.is-running .demo-stage-state {
  color: var(--accent);
}

.demo-stage-panel.is-done .demo-stage-state {
  color: #059669;
}

.demo-stage-placeholder {
  margin: 0;
  font-size: 0.8125rem;
}

.demo-stage-status-note {
  margin: 0;
  padding: 0.75rem 0.875rem;
  font-size: 0.8125rem;
  line-height: 1.55;
  border-radius: var(--radius-sm);
  background: rgba(99, 102, 241, 0.06);
  border: 1px solid rgba(99, 102, 241, 0.18);
  color: var(--text);
}

.demo-stage-panel .step-section {
  margin: 0;
}

.demo-stage-panel .step-section > *:last-child {
  margin-bottom: 0;
}

.demo-build-error {
  margin-bottom: 0.75rem;
  color: #dc2626;
}

.demo-session-note {
  margin-bottom: 0.75rem;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  margin-top: 0.375rem;
  padding: 0.2rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.sample-row {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem 1rem;
  margin: 0 -1rem;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  transition: background 0.15s, border-color 0.15s;
}

.sample-row.active {
  background: rgba(99, 102, 241, 0.1);
  border-left-color: var(--accent);
}

.sample-row.active .sample-preview {
  color: var(--text);
  font-weight: 500;
}

.sample-row.active .view-sample-btn {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--accent-light);
}

.sample-row:last-child {
  border-bottom: none;
}

.view-sample-btn {
  align-self: flex-start;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent-light);
  cursor: pointer;
  font-weight: 600;
}

.view-sample-btn:hover {
  background: rgba(99, 102, 241, 0.08);
}

.quota-panel {
  padding: 0.625rem 0.75rem;
}

.quota-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.375rem;
  margin-bottom: 0.5rem;
}

.quota-head .sidebar-label {
  margin: 0;
  font-size: 0.6875rem;
}

.quota-head .domain-tag {
  font-size: 0.625rem;
  padding: 0.15rem 0.45rem;
}

.quota-stats {
  margin-bottom: 0;
  gap: 0.375rem;
}

.quota-panel .stat-item {
  padding: 0.4rem 0.2rem;
}

.quota-panel .stat-value {
  font-size: 0.9375rem;
  line-height: 1.2;
}

.quota-panel .stat-label {
  font-size: 0.5625rem;
  letter-spacing: 0.02em;
  margin-top: 0.1rem;
}

.quota-footnote {
  margin-top: 0.5rem;
  font-size: 0.6875rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.quota-footnote strong {
  color: var(--text);
}

.rate-limit-banner {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(234, 88, 12, 0.35);
  background: rgba(234, 88, 12, 0.08);
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.55;
}

.rate-limit-banner h3 {
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
  color: #c2410c;
}

.local-skill-list {
  margin: 0.5rem 0 0 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.local-skill-list li {
  margin-bottom: 0.35rem;
}

.local-skill-list code {
  font-family: var(--mono);
  font-size: 0.8125rem;
}

.run-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.preset-list {
  margin-top: 0.5rem;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.25rem 0;
}

.sample-pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.625rem;
  padding-top: 0.625rem;
  border-top: 1px solid var(--border);
}

.sample-pager.hidden {
  display: none;
}

.pager-btn {
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font);
}

.pager-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent-light);
}

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

.pager-info {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.pager-page-input {
  width: 2.75rem;
  padding: 0.25rem 0.375rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.75rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: var(--font);
}

.pager-page-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.pager-total {
  white-space: nowrap;
}

.preset-item {
  text-align: left;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.4;
}

.preset-item:hover,
.preset-item.active {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(99, 102, 241, 0.06);
}

.answer-panel {
  padding: 1.375rem 1.5rem 1.625rem;
}

.answer-panel h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.answer-panel.answer-success h3 {
  color: var(--success);
}

.answer-panel.answer-failed h3 {
  color: #c2410c;
}

.answer-body {
  font-size: 0.875rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  padding: 0.875rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
}

.answer-panel.answer-success .answer-body {
  background: rgba(5, 150, 105, 0.06);
  border-color: rgba(5, 150, 105, 0.2);
}

.answer-panel.answer-failed .answer-body {
  background: rgba(234, 88, 12, 0.06);
  border-color: rgba(234, 88, 12, 0.2);
}

.dep-graph {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.75rem 0;
}

.dep-node {
  padding: 0.375rem 0.625rem;
  border-radius: 999px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.25);
  font-size: 0.75rem;
  font-family: var(--mono);
}

.agent-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
  background: var(--bg-card);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.agent-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
  flex-wrap: wrap;
}

.agent-name {
  font-family: var(--mono);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-light);
}

.agent-exec-mode {
  font-family: var(--font);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.agent-exec-mode.mode-llm {
  background: rgba(99, 102, 241, 0.1);
  color: var(--accent-light);
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.agent-exec-mode.mode-search {
  background: rgba(37, 99, 235, 0.1);
  color: var(--strategy-a);
  border: 1px solid rgba(37, 99, 235, 0.25);
}

.agent-exec-mode.mode-tool {
  background: rgba(234, 88, 12, 0.1);
  color: var(--strategy-d);
  border: 1px solid rgba(234, 88, 12, 0.25);
}

.agent-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 0.375rem;
}

.agent-card p:last-child {
  margin-bottom: 0;
}

.agent-card p strong {
  color: var(--text);
  font-weight: 600;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.code-block {
  font-family: var(--mono);
  font-size: 0.75rem;
  background: #1e293b;
  color: #e2e8f0;
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre;
}

/* ── Demo guided tour (Online Demo page only) ── */
.tour-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tour-trigger-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

body.demo-tour-active {
  overflow: hidden;
}

.demo-tour-root {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

.demo-tour-root.hidden {
  display: none !important;
}

.demo-tour-spotlight {
  position: fixed;
  z-index: 1;
  border-radius: var(--radius);
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.58);
  pointer-events: auto;
  transition: top 0.22s ease, left 0.22s ease, width 0.22s ease, height 0.22s ease;
  outline: 2px solid rgba(99, 102, 241, 0.85);
  outline-offset: 0;
}

.demo-tour-popover {
  position: fixed;
  z-index: 2;
  pointer-events: auto;
  width: min(340px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.125rem 1.125rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
}

.demo-tour-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.625rem;
}

.demo-tour-progress {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.demo-tour-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.125rem 0.375rem;
  border-radius: 6px;
}

.demo-tour-close:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.demo-tour-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.5rem;
}

.demo-tour-body {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 1rem;
}

.demo-tour-body a {
  color: var(--accent-light);
  font-weight: 600;
  text-decoration: none;
}

.demo-tour-body a:hover {
  text-decoration: underline;
}

.demo-tour-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.demo-tour-dismiss {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.demo-tour-dismiss-input {
  accent-color: var(--accent);
}

.demo-tour-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.demo-tour-skip,
.demo-tour-next {
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.45rem 0.875rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.demo-tour-skip {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.demo-tour-skip:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.demo-tour-next {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.demo-tour-next:hover {
  background: var(--accent-light);
}

.tour-anchor {
  position: relative;
}

@media (max-width: 900px) {
  .demo-tour-popover {
    width: min(320px, calc(100vw - 20px));
  }

  .demo-tour-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .demo-tour-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
