/* Blueprint / paper aesthetic */
:root {
  --bg: #0f1419;
  --bg-panel: #1a2332;
  --bg-elevated: #243044;
  --ink: #f0f6fc;
  --ink-muted: #7ee787;
  --ink-dim: #adbac7;
  --gray: #9ca3af;
  --gray-light: #8b949e;
  --border: #30363d;
  --border-ink: #7ee787;
  --accent: #58a6ff;
  --glow: rgba(126, 231, 135, 0.35);
  --font-display: 'Crimson Pro', Georgia, serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;
  --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-panel: 0 8px 24px rgba(0, 0, 0, 0.4);
  --radius: 8px;
  --radius-sm: 4px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: 18px;
  line-height: 1.5;
  min-height: 100vh;
}

/* Subtle gradient overlay with pulse */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(
      ellipse 100% 60% at 50% 0%,
      rgba(126, 231, 135, 0.08) 0%,
      transparent 50%
    ),
    radial-gradient(
      ellipse 80% 50% at 80% 50%,
      rgba(88, 166, 255, 0.06) 0%,
      transparent 50%
    ),
    var(--bg);
  pointer-events: none;
  z-index: 0;
  animation: bgPulse 8s ease-in-out infinite;
}
@keyframes bgPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.95;
  }
}

.page {
  position: relative;
  z-index: 1;
  max-width: min(1600px, 96vw);
  margin: 0 auto;
  padding: 1rem 2rem 3rem;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  padding: 1.75rem 2rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-panel);
  border-radius: var(--radius);
}

h1,
h2,
h3 {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 600;
  margin-top: 0;
}

h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
h2 {
  font-size: 1.4rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}
h2.section-title {
  position: relative;
  padding-bottom: 0.5rem;
}
h2.section-title::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.5rem;
  height: 2px;
  background: linear-gradient(90deg, var(--ink-muted), transparent);
  border-radius: 1px;
}
h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

a {
  color: var(--ink-muted);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: rgba(126, 231, 135, 0.12);
  color: var(--ink-muted);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}

/* Hero */
.hero--compact {
  text-align: center;
  padding: 1.35rem 0 1.35rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}
.hero-title {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  letter-spacing: -0.03em;
  line-height: 1.2;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: center;
  gap: 0.35em;
}
.hero-title-brand {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
  text-shadow: 0 0 20px rgba(126, 231, 135, 0.25);
}
.hero-title-tagline {
  font-family: var(--font-display);
  font-weight: 600;
  font-style: italic;
  color: var(--ink);
  letter-spacing: -0.02em;
}

/* Playground, main focus */
.playground {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}
.playground-inner {
  padding: 1.5rem 2rem;
}

/* Playground */
.label-text {
  display: block;
  font-size: 0.85rem;
  color: var(--gray-light);
  margin-bottom: 0.25rem;
}

#input-text {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--ink);
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#input-text::placeholder {
  color: var(--gray-light);
}
#input-text:focus {
  outline: none;
  border-color: var(--ink-muted);
  box-shadow: 0 0 0 3px var(--glow);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.controls > label {
  display: block;
  width: 100%;
}
.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border);
}
.controls > #step-controls {
  margin-top: 0;
}
.sample-label,
.partitions-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.sample-label .label-text,
.partitions-label .label-text {
  margin-bottom: 0;
}
#sample-select {
  min-width: 10rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease;
}
#partitions-select {
  width: 4rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  padding: 0.5rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease;
  text-align: center;
}
#sample-select:focus,
#partitions-select:focus {
  outline: none;
  border-color: var(--ink-muted);
}
.run-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  flex-shrink: 0;
}

.btn {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--ink-muted);
  background: var(--ink-muted);
  color: var(--bg);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.2s ease, border-color 0.2s ease,
    transform 0.2s var(--ease-spring);
  position: relative;
  overflow: hidden;
}
.btn:hover {
  background: var(--ink-muted);
  border-color: var(--ink-muted);
  filter: brightness(1.15);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--glow);
}
.btn:active {
  transform: translateY(0);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn--run {
  min-width: 140px;
}
.btn--run .btn-loader {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: var(--ink-muted);
}
.btn--run .btn-loader::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid var(--bg);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.btn--running .btn-text {
  visibility: hidden;
}
.btn--running .btn-loader {
  display: flex;
}
.btn--running:hover {
  transform: none;
  cursor: wait;
}

.btn-step {
  background: var(--bg-panel);
  color: var(--ink-muted);
  border-style: dashed;
}
.btn-step:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.1);
  border-color: var(--ink-muted);
}

.step-through-label,
.step-through-label span {
  font-size: 0.9rem;
  color: var(--gray);
}
.step-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.step-label {
  font-size: 0.9rem;
  color: var(--gray-light);
}
.hidden {
  display: none !important;
}

/* Pipeline */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow-x: auto;
  position: relative;
}
.pipeline::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 38px,
    rgba(126, 231, 135, 0.06) 38px,
    rgba(126, 231, 135, 0.06) 40px
  );
  background-size: 40px 100%;
  pointer-events: none;
  animation: pipelineFlow 3s linear infinite;
}
@keyframes pipelineFlow {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 40px 0;
  }
}
.pipeline--animated .pipeline-phase {
  animation: phasePop 0.5s var(--ease-spring) backwards;
}
.pipeline--animated .pipeline-phase:nth-child(2) {
  animation-delay: 0.1s;
}
.pipeline--animated .pipeline-phase:nth-child(4) {
  animation-delay: 0.25s;
}
.pipeline--animated .pipeline-phase:nth-child(6) {
  animation-delay: 0.4s;
}
.pipeline--animated .pipeline-phase:nth-child(8) {
  animation-delay: 0.55s;
}
.pipeline--animated .pipeline-phase:nth-child(10) {
  animation-delay: 0.7s;
}
@keyframes phasePop {
  from {
    opacity: 0;
    transform: scale(0.92) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.pipeline-connector {
  width: 8px;
  flex-shrink: 0;
  background: repeating-linear-gradient(
    90deg,
    var(--border) 0,
    var(--border) 2px,
    transparent 2px,
    transparent 6px
  );
  opacity: 0.6;
  align-self: center;
}
.pipeline-connector--start {
  border-radius: 2px 0 0 2px;
}
.pipeline-connector--end {
  border-radius: 0 2px 2px 0;
}

.pipeline-phase {
  flex: 1 1 180px;
  min-width: 160px;
  max-width: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
  padding-top: 1.75rem;
  background: var(--bg-panel);
  position: relative;
  z-index: 1;
}
.pipeline-phase-num {
  position: absolute;
  top: 0.5rem;
  right: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--gray-light);
  background: rgba(0, 0, 0, 0.2);
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
}
.pipeline-phase h3 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
  color: var(--ink-muted);
}
.pipeline-content {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-dim);
  max-height: 120px;
  overflow: auto;
}
.pipeline-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}
/* Map phase: key-value pairs as pills */
.pipeline-emitted {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
}
.map-pair {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  color: var(--ink-dim);
  animation: mapPairIn 0.4s var(--ease-spring) backwards;
}
.map-key {
  font-weight: 500;
  color: var(--ink);
}
.map-val {
  font-size: 0.65rem;
  font-variant-numeric: tabular-nums;
  color: var(--gray-light);
  background: rgba(0, 0, 0, 0.2);
  padding: 0.05rem 0.25rem;
  border-radius: var(--radius-sm);
}
.map-more {
  color: var(--gray-light);
  font-size: 0.8em;
  align-self: center;
}
@keyframes mapPairIn {
  from {
    opacity: 0;
    transform: scale(0.85);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.pipeline-arrow {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding: 0 0.35rem;
  align-self: center;
  z-index: 1;
}
.pipeline-arrow-line {
  width: 12px;
  height: 2px;
  background: var(--ink-muted);
  flex-shrink: 0;
  opacity: 0.8;
}
.pipeline-arrow-head {
  display: block;
  width: 0;
  height: 0;
  margin-left: 1px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 6px solid var(--ink-muted);
  opacity: 0.8;
  flex-shrink: 0;
  font-size: 0;
  line-height: 0;
  overflow: hidden;
}
.partition-bucket {
  font-size: 0.75rem;
  margin-bottom: 0.35rem;
  padding: 0.25rem 0 0.25rem 0.5rem;
  border-left: 2px solid var(--border);
  background: rgba(0, 0, 0, 0.15);
  border-radius: 0 var(--radius) var(--radius) 0;
}
.partition-bucket:last-child {
  margin-bottom: 0;
}

/* Output */
.output-section {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-panel);
}

.output-section--empty .output-empty {
  display: block;
}
.output-section--empty .output-tabs,
.output-section--empty .output-pane {
  display: none !important;
}
.output-section:not(.output-section--empty) .output-empty {
  display: none;
}

.output-empty {
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--gray-light);
  font-size: 0.95rem;
}
.output-empty-message {
  margin: 0;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}
.output-empty-message strong {
  color: var(--ink-muted);
}

.output-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  padding: 0 0.25rem 0 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-panel);
}
.tab {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: var(--gray-light);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.tab:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.2);
}
.tab.active {
  color: var(--ink-muted);
  border-bottom-color: var(--ink-muted);
  background: var(--bg-elevated);
}

.output-pane {
  display: none;
  padding: 1.25rem;
  border: none;
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  min-height: 200px;
  animation: outputFadeIn 0.35s var(--ease-out);
}
@keyframes outputFadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.output-pane.active {
  display: block;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}
.results-table th,
.results-table td {
  padding: 0.5rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.results-table tbody tr {
  transition: background 0.15s ease;
  animation: rowIn 0.4s var(--ease-out) backwards;
}
.results-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.15);
}
.results-table th {
  color: var(--ink-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.results-table tbody tr:nth-child(1) {
  animation-delay: 0.02s;
}
.results-table tbody tr:nth-child(2) {
  animation-delay: 0.04s;
}
.results-table tbody tr:nth-child(3) {
  animation-delay: 0.06s;
}
.results-table tbody tr:nth-child(4) {
  animation-delay: 0.08s;
}
.results-table tbody tr:nth-child(5) {
  animation-delay: 0.1s;
}
.results-table tbody tr:nth-child(n + 6) {
  animation-delay: 0.12s;
}
@keyframes rowIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.word-cell {
  color: var(--ink);
  font-weight: 500;
}
.count-cell {
  color: var(--ink-dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Word cloud, stagger pop-in */
.word-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.75rem 0;
  line-height: 1.8;
}
.cloud-word {
  font-family: var(--font-mono);
  color: var(--ink-muted);
  margin: 0.15rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius);
  transition: transform 0.25s var(--ease-spring), background 0.2s ease,
    color 0.2s ease;
  display: inline-block;
  animation: cloudPop 0.5s var(--ease-spring) backwards;
}
.cloud-word:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.25);
  color: var(--ink);
}
.cloud-word:nth-child(3n) {
  color: var(--accent);
}
.cloud-word:nth-child(5n):hover {
  background: rgba(0, 0, 0, 0.25);
}
@keyframes cloudPop {
  from {
    opacity: 0;
    transform: scale(0.3);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Bar chart */
.bar-chart {
  padding: 0.5rem 0;
}
.chart-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  animation: chartRowIn 0.45s var(--ease-out) backwards;
}
.chart-row:nth-child(1) {
  animation-delay: 0.03s;
}
.chart-row:nth-child(2) {
  animation-delay: 0.06s;
}
.chart-row:nth-child(3) {
  animation-delay: 0.09s;
}
.chart-row:nth-child(4) {
  animation-delay: 0.12s;
}
.chart-row:nth-child(5) {
  animation-delay: 0.15s;
}
.chart-row:nth-child(n + 6) {
  animation-delay: 0.18s;
}
@keyframes chartRowIn {
  from {
    opacity: 0;
    transform: translateX(-12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}
.chart-label {
  flex: 0 0 140px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-bar-wrap {
  flex: 1;
  height: 1.35rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  overflow: hidden;
}
.chart-bar {
  height: 100%;
  background: var(--ink-muted);
  border-radius: var(--radius);
  transition: width 0.7s var(--ease-spring);
  min-width: 2px;
}
.chart-row:hover .chart-bar {
  filter: brightness(1.1);
}
.chart-value {
  flex: 0 0 2.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--gray);
}

/* Partition breakdown */
.partition-breakdown {
  padding: 0.5rem 0;
}
.partition-details {
  margin-bottom: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  background: var(--bg-panel);
  transition: border-color 0.2s ease, background 0.2s ease;
}
.partition-details:hover {
  border-color: var(--border-ink);
  background: rgba(0, 0, 0, 0.1);
}
.partition-details summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  line-height: 1.4;
}
.partition-details[open] summary {
  margin-bottom: 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px dashed var(--border);
}
.partition-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.35rem;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink-dim);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.partition-count {
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--gray-light);
  font-weight: normal;
}
.partition-keys {
  margin: 0.5rem 0 0 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
  color: var(--gray);
}
.partition-keys li {
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  justify-content: space-between;
  max-width: 280px;
}
.partition-keys .partition-key {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.partition-key-count {
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink-dim);
  background: rgba(0, 0, 0, 0.25);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  min-width: 2em;
  text-align: right;
}

/* How it works, collapsed by default, secondary */
.how-it-works {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 1.5rem;
}
.how-it-works-summary {
  list-style: none;
  padding: 0.85rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--gray);
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease;
}
.how-it-works-summary::-webkit-details-marker {
  display: none;
}
.how-it-works-summary::before {
  content: '▸ ';
  color: var(--ink-muted);
  margin-right: 0.35rem;
  transition: transform 0.2s ease;
}
.how-it-works[open] .how-it-works-summary::before {
  transform: rotate(90deg);
}
.how-it-works-summary:hover {
  color: var(--ink);
  background: rgba(0, 0, 0, 0.1);
}
.how-it-works-content {
  padding: 0 1.25rem 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--ink-dim);
}
.how-it-works-intro,
.how-timeline,
.how-it-works .diagram {
  max-width: 92ch;
  margin-left: auto;
  margin-right: auto;
}
.how-it-works-intro {
  color: var(--ink-dim);
  margin-top: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.75;
}
.how-it-works-content p {
  color: var(--ink-dim);
  margin-top: 0.75rem;
  margin-bottom: 1.15rem;
  line-height: 1.75;
}
.how-timeline {
  position: relative;
  padding-left: 2.75rem;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}
.how-timeline::before {
  content: '';
  position: absolute;
  left: 1.15rem;
  top: 0.35rem;
  bottom: 0.35rem;
  width: 2px;
  background: linear-gradient(
    180deg,
    rgba(126, 231, 135, 0.65),
    rgba(126, 231, 135, 0.12)
  );
  border-radius: 2px;
}
.how-timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
}
.how-timeline-item:last-child {
  padding-bottom: 0;
}
.how-timeline-marker {
  position: absolute;
  left: -2.75rem;
  top: 0.05rem;
  width: 2.3rem;
  display: flex;
  justify-content: center;
}
.how-timeline-step {
  width: 1.8rem;
  height: 1.8rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--ink-muted);
  border: 1px solid rgba(126, 231, 135, 0.55);
  box-shadow: 0 0 0 4px rgba(126, 231, 135, 0.08);
}
.how-timeline-step-btn {
  appearance: none;
  border: 1px solid rgba(126, 231, 135, 0.55);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), filter 0.18s ease,
    box-shadow 0.18s ease;
}
.how-timeline-step-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}
.how-timeline-step-btn:active {
  transform: translateY(0);
}
.how-timeline-step-btn:focus {
  outline: none;
}
.how-timeline-step-btn:focus-visible {
  box-shadow: 0 0 0 4px rgba(126, 231, 135, 0.12), 0 0 0 7px rgba(0, 0, 0, 0.3);
}
.how-timeline-body {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 0.9rem 1.05rem;
}
.how-timeline-body p:last-child {
  margin-bottom: 0;
}
.how-timeline-body .how-it-works-h4 {
  margin-top: 0;
}
.how-timeline-body .how-it-works-api {
  margin-bottom: 0;
}

@media (min-width: 1100px) {
  .how-it-works-intro,
  .how-timeline,
  .how-it-works .diagram {
    max-width: 1100px;
  }
}

@keyframes phaseFocusPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(126, 231, 135, 0);
  }
  35% {
    box-shadow: 0 0 0 6px rgba(126, 231, 135, 0.18);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(126, 231, 135, 0);
  }
}
.pipeline-phase.pipeline-phase--focus {
  border-color: rgba(126, 231, 135, 0.65);
  animation: phaseFocusPulse 0.9s ease-out;
}
.how-it-works-h4 {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink-muted);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  margin-left: auto;
  margin-right: auto;
  padding-bottom: 0.25rem;
  letter-spacing: 0.02em;
}
.how-it-works-h4:first-of-type {
  margin-top: 0;
}
.how-it-works-api {
  color: var(--ink-dim);
  font-size: 1em;
  line-height: 1.75;
  margin-top: 0.75rem;
  margin-bottom: 1.25rem;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
}
.how-it-works-api li {
  margin-bottom: 0.75rem;
}
.how-it-works-api code {
  font-size: 1em;
  white-space: normal;
  word-break: break-word;
}
.how-it-works-content code {
  font-size: 1em;
}
.how-it-works .diagram {
  margin-top: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  overflow-x: auto;
}
.how-it-works .diagram .mermaid {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100px;
}
/* Force Mermaid SVG to match dark theme and align diagram */
.how-it-works .diagram svg {
  max-width: 100%;
  height: auto;
  margin: 0.25rem auto;
  display: block;
}
.how-it-works .diagram .mermaid svg {
  margin-left: auto;
  margin-right: auto;
}
.how-it-works .diagram .node rect,
.how-it-works .diagram .node circle,
.how-it-works .diagram .node polygon,
.how-it-works .diagram .cluster rect {
  fill: var(--bg-panel) !important;
  stroke: var(--border) !important;
}
.how-it-works .diagram .edgePath path,
.how-it-works .diagram .marker {
  stroke: var(--ink-muted) !important;
}
.how-it-works .diagram .marker {
  fill: var(--ink-muted) !important;
}
.how-it-works .diagram .node text,
.how-it-works .diagram .cluster text {
  fill: var(--ink) !important;
}
.how-it-works .diagram .cluster text {
  fill: var(--ink-muted) !important;
}

.empty {
  font-size: 0.9rem;
  color: var(--gray-light);
  margin: 1rem 0;
}

/* Floating social links, bottom right */
.float-links {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 100;
}
.float-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--ink-dim);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease,
    transform 0.2s var(--ease-spring);
  box-shadow: var(--shadow);
}
.float-link:hover {
  color: var(--ink-muted);
  border-color: var(--ink-muted);
  background: rgba(126, 231, 135, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--glow);
}
.float-link:focus {
  outline: none;
  border-color: var(--ink-muted);
  box-shadow: 0 0 0 3px var(--glow);
}
.float-link--info {
  cursor: pointer;
  border: 1px solid var(--border);
  color: var(--gray-light);
  background: var(--bg-panel);
}
.float-link--info:hover {
  color: var(--ink);
  border-color: var(--gray-light);
  background: var(--bg-elevated);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.float-link--info:focus {
  border-color: var(--gray-light);
  box-shadow: 0 0 0 3px rgba(139, 148, 158, 0.3);
}
/* GitHub, green on green */
.float-link--github {
  color: var(--ink-muted);
  border-color: rgba(126, 231, 135, 0.4);
  background: rgba(126, 231, 135, 0.12);
}
.float-link--github:hover {
  color: var(--bg);
  border-color: var(--ink-muted);
  background: var(--ink-muted);
  box-shadow: 0 4px 12px var(--glow);
}
.float-link--github:focus {
  border-color: var(--ink-muted);
  box-shadow: 0 0 0 3px var(--glow);
}
/* LinkedIn, blue on blue */
.float-link--linkedin {
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.4);
  background: rgba(88, 166, 255, 0.12);
}
.float-link--linkedin:hover {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 4px 12px rgba(88, 166, 255, 0.4);
}
.float-link--linkedin:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.35);
}
.float-link-icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Info dialog */
.info-dialog {
  max-width: min(420px, 92vw);
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  box-shadow: var(--shadow-panel);
  color: var(--ink-dim);
}
.info-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.info-dialog-inner {
  padding: 1.5rem 1.75rem;
}
.info-dialog-title {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 1rem;
}
.info-dialog-text {
  font-size: 0.95rem;
  line-height: 1.6;
  margin: 0 0 1.25rem;
}
.info-dialog-text code {
  font-size: 0.9em;
}
.info-dialog-close {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.info-dialog-close:hover {
  border-color: var(--ink-muted);
  background: rgba(126, 231, 135, 0.1);
}

@media (max-width: 640px) {
  .page {
    padding: 1rem 1rem 2rem;
  }
  .playground-inner {
    padding: 1.25rem 1.25rem 1.5rem;
  }
  .control-row {
    gap: 0.75rem;
  }
  .sample-label {
    flex: 1 1 8rem;
    min-width: 0;
  }
  #sample-select {
    min-width: 0;
    width: 100%;
  }
  .run-row {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
  }
  #partitions-select {
    width: 3.5rem;
  }
  .pipeline {
    flex-direction: column;
    padding: 1rem;
  }
  .pipeline-phase {
    max-width: none;
  }
  .float-links {
    bottom: 1rem;
    right: 1rem;
  }
  .float-link {
    width: 2.25rem;
    height: 2.25rem;
  }
  .float-link-icon {
    width: 1.1rem;
    height: 1.1rem;
  }
}
