:root {
  /* Shared theme bridge */
  --color-background: var(--bg-dark);
  --color-surface: rgba(var(--bg-surface-rgb), 0.85);
  --color-text: var(--text-primary);
  --color-text-secondary: var(--text-secondary);
  --color-primary: var(--accent);
  --color-primary-hover: var(--accent-hover);
  --color-primary-active: var(--accent);
  --color-primary-rgb: var(--accent-rgb);
  --color-secondary: rgba(var(--accent-rgb), 0.08);
  --color-secondary-hover: rgba(var(--accent-rgb), 0.14);
  --color-secondary-active: rgba(var(--accent-rgb), 0.2);
  --color-border: var(--border-color);
  --color-border-secondary: rgba(var(--accent-rgb), 0.2);
  --color-btn-primary-text: #000000;
  --color-card-border: var(--border-color);
  --color-card-border-inner: rgba(var(--accent-rgb), 0.12);
  --color-error: #ef4444;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-info: #3b82f6;
  --color-focus-ring: rgba(var(--accent-rgb), 0.35);

  /* RGB helpers */
  --color-success-rgb: 16, 185, 129;
  --color-error-rgb: 239, 68, 68;
  --color-warning-rgb: 245, 158, 11;
  --color-info-rgb: 59, 130, 246;
  --color-teal-300-rgb: var(--accent-rgb);
  --color-orange-400-rgb: 245, 158, 11;

  /* Surface accents */
  --color-bg-1: rgba(var(--accent-rgb), 0.05);
  --color-bg-2: rgba(255, 217, 94, 0.08);
  --color-bg-3: rgba(16, 185, 129, 0.08);
  --color-bg-8: rgba(var(--accent-rgb), 0.1);

  /* Form & status helpers */
  --focus-ring: 0 0 0 3px var(--color-focus-ring);
  --focus-outline: 2px solid var(--color-primary);
  --status-bg-opacity: 0.15;
  --status-border-opacity: 0.25;
  --select-caret-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23134252' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  --select-caret-dark: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f5f5f5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

  /* Typography */
  --font-family-base: var(--font-sans);
  --font-family-mono: var(--font-mono);
  --font-size-xs: 11px;
  --font-size-sm: 12px;
  --font-size-base: 14px;
  --font-size-md: 14px;
  --font-size-lg: 16px;
  --font-size-xl: 18px;
  --font-size-2xl: 20px;
  --font-size-3xl: 24px;
  --font-size-4xl: 30px;
  --font-weight-medium: 500;
  --font-weight-semibold: 550;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --letter-spacing-tight: -0.01em;

  /* Spacing */
  --space-1: 1px;
  --space-4: 4px;
  --space-6: 6px;
  --space-8: 8px;
  --space-10: 10px;
  --space-12: 12px;
  --space-16: 16px;
  --space-20: 20px;
  --space-24: 24px;
  --space-32: 32px;

  /* Border radius */
  --radius-sm: 6px;
  --radius-base: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.22), 0 1px 2px rgba(0, 0, 0, 0.16);
  --shadow-md: 0 4px 10px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 10px 20px -3px rgba(0, 0, 0, 0.32), 0 4px 8px -2px rgba(0, 0, 0, 0.24);

  /* Animation */
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --ease-standard: cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --container-sm: 640px;
  --container-md: 768px;
  --container-lg: 1024px;
  --container-xl: 1280px;
}

.metrics-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  margin-top: var(--space-12);
}

.metrics-row {
  display: flex;
  gap: var(--space-8);
  flex-wrap: wrap;
}

.metrics-controls {
  min-width: 220px;
  display: flex;
  justify-content: flex-end;
}

.metrics-select {
  max-width: 100%;
}

.badge-row {
  display: flex;
  gap: var(--space-6);
  flex-wrap: wrap;
  margin-left: auto;
}

.stat-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(var(--color-info-rgb, 59, 130, 246), 0.12);
  color: var(--color-text);
  border: 1px solid rgba(var(--color-info-rgb, 59, 130, 246), 0.25);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.stat-badge.diff--good {
  color: var(--color-success);
  background: rgba(var(--color-success-rgb, 16, 185, 129), 0.1);
  border-color: rgba(var(--color-success-rgb, 16, 185, 129), 0.35);
}

.stat-badge.diff--bad {
  color: var(--color-error);
  background: rgba(var(--color-error-rgb, 239, 68, 68), 0.08);
  border-color: rgba(var(--color-error-rgb, 239, 68, 68), 0.35);
}

.stat-badge.diff--neutral {
  color: var(--color-info);
}

.results-section .card__header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.results-section .card__header h3 {
  font-size: var(--font-size-lg);
}

.results-section .status {
  padding: 3px 8px;
  font-size: var(--font-size-xs);
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  border-radius: var(--radius-base);
}

.results-section .card__header .actions {
  margin-left: auto;
  display: inline-flex;
  gap: 8px;
}

.text-content.fade-in {
  opacity: 0.01;
}

.text-content {
  transition: opacity 200ms var(--ease-standard);
}
/* Base styles */
html {
  font-size: var(--font-size-base);
  font-family: var(--font-family-base);
  line-height: var(--line-height-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text);
  letter-spacing: var(--letter-spacing-tight);
}

h1 {
  font-size: var(--font-size-4xl);
}
h2 {
  font-size: var(--font-size-3xl);
}
h3 {
  font-size: var(--font-size-2xl);
}
h4 {
  font-size: var(--font-size-xl);
}
h5 {
  font-size: var(--font-size-lg);
}
h6 {
  font-size: var(--font-size-md);
}

p {
  margin: 0 0 var(--space-16) 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-standard);
}

a:hover {
  color: var(--color-primary-hover);
}

code,
pre {
  font-family: var(--font-family-mono);
  font-size: calc(var(--font-size-base) * 0.95);
  background-color: var(--color-secondary);
  border-radius: var(--radius-sm);
}

code {
  padding: var(--space-1) var(--space-4);
}

pre {
  padding: var(--space-16);
  margin: var(--space-16) 0;
  overflow: auto;
  border: 1px solid var(--color-border);
}

pre code {
  background: none;
  padding: 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-16);
  border-radius: var(--radius-base);
  font-size: var(--font-size-base);
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-standard);
  border: none;
  text-decoration: none;
  position: relative;
}

.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--primary {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
}

.btn--primary:hover {
  background: var(--color-primary-hover);
}

.btn--primary:active {
  background: var(--color-primary-active);
}

.btn--secondary {
  background: var(--color-secondary);
  color: var(--color-text);
}

.btn--secondary:hover {
  background: var(--color-secondary-hover);
}

.btn--secondary:active {
  background: var(--color-secondary-active);
}

.btn--outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

.btn--outline:hover {
  background: var(--color-secondary);
}

.btn--sm {
  padding: var(--space-4) var(--space-12);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: var(--space-10) var(--space-20);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-md);
}

.btn--full-width {
  width: 100%;
}

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

/* Form elements */
.form-control {
  display: block;
  width: 100%;
  padding: var(--space-8) var(--space-12);
  font-size: var(--font-size-md);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  transition: border-color var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

textarea.form-control {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
}

select.form-control {
  padding: var(--space-8) var(--space-12);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: var(--select-caret-light);
  background-repeat: no-repeat;
  background-position: right var(--space-12) center;
  background-size: 16px;
  padding-right: var(--space-32);
}

/* Add a dark mode specific caret */
@media (prefers-color-scheme: dark) {
  select.form-control {
    background-image: var(--select-caret-dark);
  }
}

/* Also handle data-color-scheme */
[data-color-scheme="dark"] select.form-control {
  background-image: var(--select-caret-dark);
}

[data-color-scheme="light"] select.form-control {
  background-image: var(--select-caret-light);
}

.form-control:focus {
  border-color: var(--color-primary);
  outline: var(--focus-outline);
}

.form-label {
  display: block;
  margin-bottom: var(--space-8);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.form-group {
  margin-bottom: var(--space-16);
}

/* Card component */
.card {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-card-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--duration-normal) var(--ease-standard);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card__body {
  padding: var(--space-16);
}

.card__header,
.card__footer {
  padding: var(--space-16);
  border-bottom: 1px solid var(--color-card-border-inner);
}

/* Status indicators - simplified with CSS variables */
.status {
  display: inline-flex;
  align-items: center;
  padding: var(--space-6) var(--space-12);
  border-radius: var(--radius-full);
  font-weight: var(--font-weight-medium);
  font-size: var(--font-size-sm);
}

.status--success {
  background-color: rgba(
    var(--color-success-rgb, 33, 128, 141),
    var(--status-bg-opacity)
  );
  color: var(--color-success);
  border: 1px solid
    rgba(var(--color-success-rgb, 33, 128, 141), var(--status-border-opacity));
}

.status--error {
  background-color: rgba(
    var(--color-error-rgb, 192, 21, 47),
    var(--status-bg-opacity)
  );
  color: var(--color-error);
  border: 1px solid
    rgba(var(--color-error-rgb, 192, 21, 47), var(--status-border-opacity));
}

.status--warning {
  background-color: rgba(
    var(--color-warning-rgb, 168, 75, 47),
    var(--status-bg-opacity)
  );
  color: var(--color-warning);
  border: 1px solid
    rgba(var(--color-warning-rgb, 168, 75, 47), var(--status-border-opacity));
}

.status--info {
  background-color: rgba(
    var(--color-info-rgb, 98, 108, 113),
    var(--status-bg-opacity)
  );
  color: var(--color-info);
  border: 1px solid
    rgba(var(--color-info-rgb, 98, 108, 113), var(--status-border-opacity));
}

/* Container layout */
.container {
  width: 100%;
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--space-16);
  padding-left: var(--space-16);
}

@media (min-width: 640px) {
  .container {
    max-width: var(--container-sm);
  }
}
@media (min-width: 768px) {
  .container {
    max-width: var(--container-md);
  }
}
@media (min-width: 1024px) {
  .container {
    max-width: var(--container-lg);
  }
}
@media (min-width: 1280px) {
  .container {
    max-width: var(--container-xl);
  }
}

/* Utility classes */
.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-4 {
  gap: var(--space-4);
}
.gap-8 {
  gap: var(--space-8);
}
.gap-16 {
  gap: var(--space-16);
}

.m-0 {
  margin: 0;
}
.mt-8 {
  margin-top: var(--space-8);
}
.mb-8 {
  margin-bottom: var(--space-8);
}
.mx-8 {
  margin-left: var(--space-8);
  margin-right: var(--space-8);
}
.my-8 {
  margin-top: var(--space-8);
  margin-bottom: var(--space-8);
}

.p-0 {
  padding: 0;
}
.py-8 {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
}
.px-8 {
  padding-left: var(--space-8);
  padding-right: var(--space-8);
}
.py-16 {
  padding-top: var(--space-16);
  padding-bottom: var(--space-16);
}
.px-16 {
  padding-left: var(--space-16);
  padding-right: var(--space-16);
}

.block {
  display: block;
}
.hidden {
  display: none;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

:focus-visible {
  outline: var(--focus-outline);
  outline-offset: 2px;
}

/* Dark mode specifics */
[data-color-scheme="dark"] .btn--outline {
  border: 1px solid var(--color-border-secondary);
}

@font-face {
  font-family: 'FKGroteskNeue';
  src: url('https://r2cdn.perplexity.ai/fonts/FKGroteskNeue.woff2')
    format('woff2');
}

/* END PERPLEXITY DESIGN SYSTEM */
/* Custom styles for Text Processing Pipeline */

body {
  background-color: var(--color-background);
  padding: var(--space-32) 0;
}

.container {
  max-width: var(--container-xl);
}

/* Header styles */
.header {
  text-align: center;
  margin-bottom: var(--space-32);
}

.header h1 {
  font-size: var(--font-size-4xl);
  color: var(--color-text);
  margin-bottom: var(--space-8);
}

.subtitle {
  font-size: var(--font-size-lg);
  color: var(--color-text-secondary);
  margin: 0;
}

/* Input section */
.input-section {
  margin-bottom: var(--space-32);
}

.text-input {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
}

.process-btn {
  margin-top: var(--space-16);
  width: 100%;
  position: relative;
}

.btn-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Enhanced CSS for improved UX animations */

/* Add to existing CSS - Pipeline step animations with progress indication */
.pipeline-step {
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0.0, 0.2, 1);
    transform: scale(1);
}

/* Progressive activation states */
.pipeline-step.active {
    border-color: var(--color-primary);
    background-color: var(--color-bg-8);
    transform: scale(1.05) translateY(-4px);
    box-shadow: 
        var(--shadow-lg),
        0 0 20px rgba(var(--color-primary-rgb, 33, 128, 141), 0.2);
    z-index: 10;
}

.pipeline-step.processing {
    border-color: var(--color-warning);
    background-color: var(--color-bg-2);
    animation: processingPulse 2s ease-in-out infinite;
}

.pipeline-step.completed {
    border-color: var(--color-success);
    background-color: var(--color-bg-3);
    transform: scale(1.02);
}

/* Enhanced processing animation */
@keyframes processingPulse {
    0%, 100% {
        transform: scale(1.02);
        box-shadow: 0 0 15px rgba(var(--color-warning-rgb, 168, 75, 47), 0.3);
    }
    50% {
        transform: scale(1.06);
        box-shadow: 0 0 25px rgba(var(--color-warning-rgb, 168, 75, 47), 0.5);
    }
}

/* Progress bar animation for pipeline steps */
.pipeline-step::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(var(--color-primary-rgb, 33, 128, 141), 0.3),
        transparent
    );
    transition: left 0.8s ease-out;
    z-index: -1;
}

.pipeline-step.processing::before {
    animation: progressSweep 2s ease-in-out infinite;
}

@keyframes progressSweep {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Step icon animations */
.step-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.pipeline-step.active .step-icon {
    transform: scale(1.2) rotate(5deg);
    animation: iconBounce 0.6s ease-out;
}

.pipeline-step.processing .step-icon {
    animation: iconSpin 1.5s linear infinite;
}

.pipeline-step.completed .step-icon {
    transform: scale(1.1);
    animation: iconSuccess 0.5s ease-out;
}

@keyframes iconBounce {
    0%, 20%, 60%, 100% { transform: scale(1.2) translateY(0); }
    40% { transform: scale(1.3) translateY(-10px); }
    80% { transform: scale(1.15) translateY(-3px); }
}

@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes iconSuccess {
    0% { transform: scale(1.1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1.1); }
}

/* Pipeline arrow animations */
.pipeline-arrow {
    transition: all 0.3s ease-in-out;
    opacity: 0.5;
}

.pipeline-arrow.active {
    opacity: 1;
    color: var(--color-primary);
    animation: arrowPulse 1s ease-in-out infinite;
}

@keyframes arrowPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Status indicator enhancements */
.step-status {
    transition: all 0.3s ease-in-out;
    position: relative;
    overflow: hidden;
}

.step-status.processing {
    background-color: var(--color-bg-2);
    color: var(--color-warning);
    animation: statusGlow 2s ease-in-out infinite;
}

.step-status.completed {
    background-color: var(--color-bg-3);
    color: var(--color-success);
    animation: statusComplete 0.5s ease-out;
}

@keyframes statusGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(var(--color-warning-rgb, 168, 75, 47), 0.3); }
    50% { box-shadow: 0 0 15px rgba(var(--color-warning-rgb, 168, 75, 47), 0.6); }
}

@keyframes statusComplete {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Results section fade-in animation */
.results-section {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.results-section.show {
    opacity: 1;
    transform: translateY(0);
}

/* Individual result card animations */
.result-panel {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.result-panel.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger the animation of result cards */
.result-panel:nth-child(1) { transition-delay: 0.1s; }
.result-panel:nth-child(2) { transition-delay: 0.2s; }
.result-panel:nth-child(3) { transition-delay: 0.3s; }

/* Text content typing effect */
.text-content {
    position: relative;
}

.text-content.typing::after {
    content: '|';
    animation: blink 1s infinite;
    color: var(--color-primary);
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Enhanced button loading state */
.process-btn {
    position: relative;
    overflow: hidden;
}

.process-btn.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: buttonProgress 2s ease-in-out infinite;
}

@keyframes buttonProgress {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Metric badges animation on update */
.stat-badge {
    transition: all 0.3s ease-in-out;
}

.stat-badge.updated {
    transform: scale(1.1);
    background-color: rgba(var(--color-success-rgb, 33, 128, 141), 0.2);
    animation: badgeUpdate 0.6s ease-out;
}

@keyframes badgeUpdate {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* Smooth transitions for mobile responsiveness */
@media (max-width: 768px) {
    .pipeline-step {
        min-width: 160px;
        transition: all 0.3s ease-in-out;
    }

    .pipeline-arrow {
        transform: rotate(90deg);
        transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    }

    .pipeline-arrow.active {
        animation: arrowPulseMobile 1s ease-in-out infinite;
    }

    @keyframes arrowPulseMobile {
        0%, 100% { transform: rotate(90deg) scale(1); }
        50% { transform: rotate(90deg) scale(1.2); }
    }
}

/* Enhanced accessibility - reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .pipeline-step,
    .step-icon,
    .pipeline-arrow,
    .step-status,
    .result-panel {
        animation: none !important;
        transition-duration: 0.2s !important;
    }

    .pipeline-step::before {
        display: none;
    }
}

/* Dark mode enhancements for animations */
@media (prefers-color-scheme: dark) {
    .pipeline-step.active {
        box-shadow: 
            var(--shadow-lg),
            0 0 20px rgba(var(--color-teal-300-rgb, 50, 184, 198), 0.2);
    }

    .pipeline-step.processing {
        animation: processingPulseDark 2s ease-in-out infinite;
    }

    @keyframes processingPulseDark {
        0%, 100% {
            transform: scale(1.02);
            box-shadow: 0 0 15px rgba(var(--color-orange-400-rgb, 230, 129, 97), 0.3);
        }
        50% {
            transform: scale(1.06);
            box-shadow: 0 0 25px rgba(var(--color-orange-400-rgb, 230, 129, 97), 0.5);
        }
    }
}











/* Pipeline visualization */
.pipeline-section {
  margin-bottom: var(--space-32);
}

.pipeline-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-16);
  flex-wrap: wrap;
  padding: var(--space-24);
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-card-border);
}

.pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-16);
  background-color: var(--color-bg-1);
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  transition: all var(--duration-normal) var(--ease-standard);
  min-width: 180px;
}

.pipeline-step.active {
  border-color: var(--color-primary);
  background-color: var(--color-bg-8);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.pipeline-step.completed {
  border-color: var(--color-success);
  background-color: var(--color-bg-3);
}

.step-icon {
  font-size: 32px;
  margin-bottom: var(--space-8);
}

.step-content h3 {
  font-size: var(--font-size-lg);
  margin-bottom: var(--space-4);
}

.step-content p {
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin: 0;
}

.step-status {
  margin-top: var(--space-8);
  padding: var(--space-4) var(--space-8);
  background-color: var(--color-secondary);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
}

.step-status.processing {
  background-color: var(--color-bg-2);
  color: var(--color-warning);
}

.step-status.completed {
  background-color: var(--color-bg-3);
  color: var(--color-success);
}

.pipeline-arrow {
  font-size: var(--font-size-2xl);
  color: var(--color-text-secondary);
  font-weight: bold;
}

/* Results section */
.results-section {
  margin-bottom: var(--space-32);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-24);
}

.result-panel .card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-panel h3 {
  margin: 0;
}

.text-content {
  background-color: var(--color-secondary);
  padding: var(--space-16);
  border-radius: var(--radius-base);
  min-height: 120px;
  font-family: var(--font-family-base);
  line-height: var(--line-height-normal);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.decoder-meta {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.decoder-meta::before {
  content: "🔍";
  font-size: var(--font-size-md);
}

.decoder-alt {
  margin-top: var(--space-12);
  padding: var(--space-12);
  border-radius: var(--radius-base);
  background: rgba(var(--color-primary-rgb, 33, 128, 141), 0.08);
  border: 1px solid rgba(var(--color-primary-rgb, 33, 128, 141), 0.2);
  font-size: var(--font-size-sm);
  color: var(--color-text-secondary);
}

.decoder-alt strong {
  color: var(--color-text);
  font-weight: var(--font-weight-semibold);
}

.decoder-alt ul {
  padding-left: 18px;
  margin: var(--space-6) 0 0 0;
}

.decoder-alt li {
  margin-bottom: var(--space-4);
}

/* Sample texts section */
.samples-section {
  margin-bottom: var(--space-32);
}

.sample-buttons {
  display: flex;
  gap: var(--space-12);
  flex-wrap: wrap;
}

.sample-btn {
  flex: 1;
  min-width: 160px;
}

/* Loading animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.processing .step-icon {
  animation: pulse 1.5s ease-in-out infinite;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .pipeline-container {
    flex-direction: column;
    gap: var(--space-12);
  }
  
  .pipeline-arrow {
    transform: rotate(90deg);
  }
  
  .pipeline-step {
    min-width: 200px;
  }
  
  .results-grid {
    grid-template-columns: 1fr;
  }
  
  .sample-buttons {
    flex-direction: column;
  }
}

/* Utility classes */
.hidden {
  display: none !important;
}

.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

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

/* Enhanced button states */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn--primary:disabled {
  background-color: var(--color-text-secondary);
}

/* Pipeline step animations */
.pipeline-step {
  position: relative;
  overflow: hidden;
}

.pipeline-step::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(var(--color-primary-rgb, 33, 128, 141), 0.2),
    transparent
  );
  transition: left 0.8s ease-in-out;
}

.pipeline-step.processing::before {
  left: 100%;
}

/* Text highlighting for changes */
.text-highlight {
  background-color: var(--color-bg-2);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-medium);
}

/* --- UI polish overrides (December refresh) --- */
body {
  background:
    radial-gradient(circle at top, rgba(99, 237, 255, 0.12), transparent 55%),
    linear-gradient(180deg, rgba(5, 7, 10, 1) 0%, rgba(5, 7, 10, 0.85) 60%, #030507 100%);
  min-height: 100vh;
  padding: 40px 0 56px;
}

.container {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
}

.input-section .card,
.pipeline-section .pipeline-container,
.results-section .card,
.samples-section .card {
  background: rgba(var(--bg-surface-rgb, 10, 12, 16), 0.85);
  border: 1px solid rgba(var(--accent-rgb, 99, 237, 255), 0.15);
  box-shadow: 0 20px 45px rgba(2, 4, 8, 0.35);
}

.process-btn {
  background: linear-gradient(95deg, #63edff, #85f1ff);
  color: #041014;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  box-shadow: 0 12px 30px rgba(99, 237, 255, 0.25);
}

.process-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 15px 35px rgba(99, 237, 255, 0.35);
}

.pipeline-container {
  gap: 12px;
  border-radius: 18px;
  border: 1px solid rgba(var(--accent-rgb, 99, 237, 255), 0.18);
}

.pipeline-step {
  min-width: 200px;
  padding: 18px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(var(--accent-rgb, 99, 237, 255), 0.12);
}

.pipeline-arrow {
  font-size: 32px;
  color: rgba(255, 255, 255, 0.35);
}

.results-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-20);
}

.result-panel .card {
  min-height: 240px;
  display: flex;
  flex-direction: column;
}

.result-panel .card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.text-content {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(var(--accent-rgb, 99, 237, 255), 0.2);
}

.sample-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.sample-btn {
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb, 99, 237, 255), 0.4);
  color: var(--accent);
  background: transparent;
  font-weight: 500;
  transition: background 180ms var(--ease-standard);
}

.sample-btn:hover {
  background: rgba(var(--accent-rgb, 99, 237, 255), 0.15);
  color: #021115;
}

.metrics-bar {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
}

.metrics-controls {
  width: 100%;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

@media (min-width: 768px) {
  .metrics-bar {
    flex-direction: row;
    align-items: center;
  }
  .metrics-controls {
    width: auto;
    justify-content: flex-end;
  }
}

/* Batch mode + entities */
.batch-result-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-base);
  margin-bottom: var(--space-8);
  background: rgba(var(--bg-surface-rgb, 10, 12, 16), 0.6);
}

.batch-result-item summary {
  cursor: pointer;
  padding: var(--space-8) var(--space-12);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.batch-result-item__body {
  padding: 0 var(--space-12) var(--space-12) var(--space-12);
  color: var(--color-text-secondary);
  line-height: var(--line-height-normal);
}

.batch-result-item__body p {
  margin-bottom: var(--space-8);
}

.entity-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.entity-table th,
.entity-table td {
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-8);
  text-align: left;
}

.entity-table th {
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-semibold);
}

.entity-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.entity-person {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.entity-org {
  background: rgba(168, 85, 247, 0.2);
  color: #d8b4fe;
}

.entity-phone {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.entity-url {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.entity-ip {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}
