:root {
  /* Anthropic 美学 - 背景色（温暖象牙白） */
  --bg-primary: #FCFAF8;
  --bg-primary-alt: #F5F2EB;
  --bg-surface: #FFFFFF;
  --bg-surface-alt: #FDFDFC;

  /* 文字色（炭灰色，柔和但清晰） */
  --text-primary: #2D2D2D;
  --text-secondary: #6B6B6B;
  --text-tertiary: #999999;

  /* 强调色（陶土色 + 深灰） */
  --accent-primary: #D97757;
  --accent-dark: #3D3D3D;

  /* 边框（细腻柔和） */
  --border-default: #E5E5E5;
  --border-light: #F0F0F0;

  /* 焦点环（柔和，无刺眼蓝色） */
  --focus-ring: 0 0 0 3px rgba(217, 119, 87, 0.1);
  --focus-ring-alt: 0 0 0 3px rgba(45, 45, 45, 0.05);

  /* 阴影（极简） */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.08);

  /* 过渡时长 */
  --transition-fast: 150ms;
  --transition-base: 200ms;
  --transition-slow: 300ms;

  /* 圆角（适度） */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* 间距（充足留白） */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 2.5rem;   /* 40px */

  /* 字体 */
  --font-heading: "Tiempos Headline", "Merriweather", "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", serif;
  --font-body: "Inter", "Söhne", "Avenir Next", "-apple-system", "BlinkMacSystemFont", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-mono: "SF Mono", "SFMono-Regular", "JetBrains Mono", "Fira Code", monospace;

  /* 字重（避免超粗） */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;

  /* 行高（放松节奏） */
  --line-height-tight: 1.4;
  --line-height-normal: 1.6;
  --line-height-relaxed: 1.7;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: var(--line-height-normal);
  font-weight: var(--font-weight-normal);
}

button,
input {
  font: inherit;
}

.page-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-xl) var(--spacing-lg) var(--spacing-2xl);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.hero-copy,
.hero-card,
.panel,
.subpanel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}

.hero-copy {
  padding: var(--spacing-2xl);
  border-radius: var(--radius-xl);
}

.eyebrow {
  margin: 0 0 var(--spacing-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.6875rem;
  font-weight: var(--font-weight-semibold);
}

.hero h1 {
  margin: 0;
  max-width: 16ch;
  font-family: var(--font-heading);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  line-height: var(--line-height-tight);
  letter-spacing: -0.02em;
  font-weight: var(--font-weight-semibold);
}

.hero-text {
  margin: var(--spacing-md) 0 0;
  max-width: 65ch;
  color: var(--text-secondary);
  line-height: var(--line-height-relaxed);
  font-size: 0.9375rem;
}

.direction-toggle {
  display: flex;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
  margin-top: var(--spacing-lg);
}

.direction-btn {
  position: relative;
  transition: all 0.2s ease;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.direction-btn:hover:not(.active) {
  background: var(--bg-primary-alt);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.direction-btn.active {
  background: var(--accent-dark);
  color: white;
  border-color: var(--accent-dark);
}

.direction-btn.active:hover {
  background: #2A2A2A;
}

.hero-card {
  border-radius: var(--radius-xl);
  padding: var(--spacing-lg);
  display: grid;
  gap: var(--spacing-sm);
  align-content: center;
}

.hero-stat {
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  background: var(--bg-primary-alt);
  border: 1px solid var(--border-light);
  transition: all var(--transition-base) ease;
}

.hero-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
}

.hero-stat-value {
  display: block;
  font-family: var(--font-heading);
  font-size: 1.875rem;
  line-height: 1;
  font-weight: var(--font-weight-semibold);
  color: var(--accent-dark);
}

.hero-stat-label {
  display: block;
  margin-top: var(--spacing-xs);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: var(--font-weight-medium);
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: var(--spacing-xl);
}

.panel {
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
}

.panel-head h2,
.subpanel h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: var(--font-weight-semibold);
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.panel-head p,
#summary-text {
  margin: var(--spacing-xs) 0 0;
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
  font-size: 0.875rem;
}

.panel-head-inline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  gap: var(--spacing-sm);
  min-height: 220px;
  margin-top: var(--spacing-lg);
  padding: var(--spacing-xl);
  text-align: center;
  border-radius: var(--radius-lg);
  border: 2px dashed var(--border-default);
  background: var(--bg-primary-alt);
  transition: all var(--transition-base) ease;
  cursor: pointer;
}

.dropzone:hover:not(.processing) {
  border-color: var(--text-secondary);
  background: var(--bg-surface);
}

.dropzone.drag-active {
  border-color: var(--accent-dark);
  background: var(--bg-surface);
  transform: scale(1.005);
  box-shadow: 0 0 0 3px rgba(61, 61, 61, 0.08);
}

.dropzone.processing {
  pointer-events: none;
  opacity: 0.6;
  cursor: wait;
}

.dropzone.processing::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  animation: pulse 1.5s ease-in-out infinite;
}

.dropzone-icon {
  color: var(--text-tertiary);
  transition: all var(--transition-base) ease;
}

.dropzone:hover:not(.processing) .dropzone-icon {
  color: var(--accent-dark);
  transform: translateY(-3px);
}

.dropzone.drag-active .dropzone-icon {
  color: var(--accent-dark);
  transform: scale(1.08);
}

.dropzone-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: var(--font-weight-semibold);
}

.dropzone-subtitle {
  max-width: 40ch;
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

.dropzone input {
  display: none;
}

.dropzone-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: var(--font-weight-semibold);
}

.dropzone-subtitle {
  max-width: 40ch;
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

.dropzone-actions,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
}

.controls {
  display: grid;
  gap: var(--spacing-lg);
  margin-top: var(--spacing-xl);
}

.field {
  display: grid;
  gap: var(--spacing-sm);
}

.field-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: var(--font-weight-medium);
}

.field:has(.field-input:disabled) .field-label {
  opacity: 0.6;
}

.field-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  font-family: var(--font-body);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.field-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-primary-alt);
}

.field-input:focus {
  outline: none;
  border-color: var(--text-secondary);
  box-shadow: var(--focus-ring-alt);
}

.privacy-note {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  border-radius: var(--radius-md);
  background: var(--bg-primary-alt);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
  font-size: 0.875rem;
}

.button {
  position: relative;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.625rem 1.25rem;
  cursor: pointer;
  font-weight: var(--font-weight-medium);
  transition: all var(--transition-base) ease;
}

.button:hover:not(:disabled) {
  opacity: 0.9;
  transform: translateY(-1px);
}

.button:active:not(:disabled) {
  transform: translateY(0);
}

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

.button.loading {
  color: transparent;
  pointer-events: none;
}

.button.loading::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid currentColor;
  border-radius: 50%;
  border-top-color: transparent;
  animation: button-spin 0.6s linear infinite;
}

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

.button-primary {
  background: var(--accent-dark);
  color: white;
}

.button-primary:hover:not(:disabled) {
  background: #2A2A2A;
}

.button-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.button-secondary:hover:not(:disabled) {
  background: var(--bg-primary-alt);
  border-color: var(--text-secondary);
}

.button-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.button-ghost:hover:not(:disabled) {
  background: var(--bg-primary-alt);
  border-color: var(--text-secondary);
  color: var(--text-primary);
}

.results-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: var(--spacing-xl);
  margin-top: var(--spacing-xl);
}

.subpanel {
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
}

.scroll-area {
  margin-top: var(--spacing-md);
  max-height: 380px;
  overflow: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.result-table thead {
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
  box-shadow: 0 1px 0 var(--border-light);
}

.result-table th,
.result-table td {
  padding: var(--spacing-md) var(--spacing-sm);
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  transition: background var(--transition-fast) ease;
}

.result-table th {
  color: var(--text-secondary);
  font-weight: var(--font-weight-semibold);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.result-table tbody tr {
  transition: all var(--transition-fast) ease;
}

.result-table tbody tr:hover {
  background: var(--bg-primary-alt);
}

.result-table tbody tr:last-child td {
  border-bottom: none;
}

.result-table td {
  word-break: break-word;
  color: var(--text-primary);
}

.result-table code {
  font-size: 0.8125rem;
  padding: 0.125rem 0.375rem;
}

.empty-row td,
.empty-issue {
  color: var(--text-tertiary);
  font-style: italic;
}

.issue-list {
  margin: var(--spacing-md) 0 0;
  padding-left: var(--spacing-lg);
  color: var(--text-secondary);
  line-height: var(--line-height-normal);
}

.issue-list li + li {
  margin-top: var(--spacing-sm);
}

.output-preview {
  margin-top: var(--spacing-lg);
}

.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}

#output-preview {
  margin: var(--spacing-md) 0 0;
  padding: var(--spacing-lg);
  border-radius: var(--radius-md);
  background: #2D2D2D;
  color: #E5E5E5;
  overflow: auto;
  max-height: 420px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  border: 1px solid var(--border-default);
}

code {
  font-family: var(--font-mono);
  background: var(--bg-primary-alt);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.875em;
}

@media (max-width: 960px) {
  .hero,
  .workspace,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .panel-head-inline,
  .output-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-copy {
    padding: var(--spacing-xl);
  }

  .page-shell {
    padding: var(--spacing-lg);
  }
}

.toast {
  position: fixed;
  bottom: var(--spacing-xl);
  right: var(--spacing-xl);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--accent-dark);
  color: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: var(--font-weight-medium);
  opacity: 0;
  transform: translateY(1rem);
  transition: all var(--transition-base) ease;
  pointer-events: none;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast.success {
  background: #059669;
}

.toast.error {
  background: #DC2626;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .button:hover:not(:disabled),
  .hero-stat:hover {
    transform: none;
  }
}
