:root {
  --primary: #0070f3;
  --primary-hover: #0051cc;
  --primary-light: #e6f2ff;
  --secondary: #687076;
  --secondary-hover: #4a5056;
  --success: #10b981;
  --error: #ef4444;
  --warning: #f59e0b;
  --bg: #fafbfc;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --text: #1a1a1a;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(135deg, #fafbfc 0%, #f0f4f8 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.app-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3rem 2rem;
}

/* Announcement Banner */
.announcement-banner {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border: 1.5px solid #fed7aa;
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 8px rgba(251, 146, 60, 0.15);
  animation: slideDown 0.4s ease-out;
}

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

.announcement-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
  animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
}

.announcement-content {
  flex: 1;
  min-width: 0;
}

.announcement-text {
  font-size: 0.938rem;
  color: #9a3412;
  font-weight: 500;
  line-height: 1.5;
}

/* Hero Section */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px solid var(--border-light);
}

.kicker {
  font-size: 0.813rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  display: inline-block;
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

h2 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.nav-links-header {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  padding: 0.75rem 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.nav-links-header:hover {
  box-shadow: var(--shadow);
  border-color: var(--primary);
}

.nav-links-header a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: var(--transition);
  position: relative;
  padding-bottom: 2px;
  white-space: nowrap;
}

.nav-links-header a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--primary);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-links-header a:hover {
  color: var(--primary-hover);
}

.nav-links-header a:hover::after {
  width: 100%;
}

/* Workbench */
.workbench {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

/* Panels */
.input-panel,
.output-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
}

.input-panel:hover,
.output-panel:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

.panel-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--border-light);
}

.panel-title h2 {
  position: relative;
  padding-left: 1rem;
}

.panel-title h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 1.25rem;
  background: linear-gradient(180deg, var(--primary) 0%, #00a0e3 100%);
  border-radius: 2px;
}

/* Form Elements */
textarea,
input[type="text"],
input[readonly],
select {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.938rem;
  background: #fafbfc;
  transition: var(--transition);
  color: var(--text);
}

textarea {
  min-height: 200px;
  resize: vertical;
  font-family: "SF Mono", "Monaco", "Menlo", "Consolas", "Liberation Mono", monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  background: #ffffff;
}

textarea:focus,
input:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background: #ffffff;
}

textarea:hover:not(:focus),
input:hover:not(:focus):not([readonly]),
select:hover:not(:focus) {
  border-color: var(--text-muted);
  background: #ffffff;
}

input[readonly] {
  background: var(--border-light);
  cursor: default;
  color: var(--text-secondary);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236b7280' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  background-color: #fafbfc;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.settings-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.settings-grid label span {
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* Buttons */
button {
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  font-weight: 500;
  position: relative;
}

.primary-button {
  width: 100%;
  padding: 1rem 1.5rem;
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: 0.938rem;
  box-shadow: 0 2px 4px rgba(0, 112, 243, 0.2);
}

.primary-button:hover:not(:disabled) {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(0, 112, 243, 0.3);
}

.primary-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 112, 243, 0.2);
}

.primary-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.secondary-button {
  padding: 0.875rem 1.5rem;
  background: white;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.938rem;
  box-shadow: var(--shadow-sm);
}

.secondary-button:hover {
  background: var(--bg);
  border-color: var(--text-secondary);
  box-shadow: var(--shadow);
}

.secondary-button:active {
  transform: scale(0.98);
}

.primary-button.compact,
.secondary-button.compact {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  width: auto;
}

/* Monitor Card */
.monitor-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  transition: var(--transition);
}

.monitor-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

#progressBadge {
  background: linear-gradient(135deg, var(--primary) 0%, #0051cc 100%);
  color: white;
  padding: 0.375rem 1rem;
  border-radius: 16px;
  font-size: 0.813rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 8px rgba(0, 112, 243, 0.25);
  transition: all 0.3s ease;
  min-width: 60px;
  text-align: center;
}

#progressBadge.processing {
  background: linear-gradient(135deg, var(--primary) 0%, #00a0e3 100%);
  animation: pulse 2s ease-in-out infinite;
}

#progressBadge.complete {
  background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

#progressBadge.error {
  background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 2px 8px rgba(0, 112, 243, 0.25);
  }
  50% {
    box-shadow: 0 4px 16px rgba(0, 112, 243, 0.45);
  }
}

.progress-track {
  height: 10px;
  background: var(--border-light);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 1.25rem;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.08);
  position: relative;
}

#progressBar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary) 0%, #00a0e3 50%, #0070f3 100%);
  background-size: 200% 100%;
  transition: width 0.15s ease-out;
  box-shadow: 0 0 12px rgba(0, 112, 243, 0.6);
  position: relative;
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* 进度条活动状态指示器 */
#progressBar::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 40px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  animation: slide 1.5s ease-in-out infinite;
}

@keyframes slide {
  0% {
    transform: translateX(-100px);
  }
  100% {
    transform: translateX(100px);
  }
}

/* 完成状态 */
#progressBar.complete {
  background: linear-gradient(90deg, var(--success) 0%, #059669 100%);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.6);
}

#progressBar.complete::after {
  display: none;
}

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

.log-box {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  min-height: 200px;
  max-height: 300px;
  overflow-y: auto;
  font-family: "SF Mono", "Monaco", "Menlo", "Consolas", "Liberation Mono", monospace;
  font-size: 0.813rem;
  line-height: 1.6;
}

.log-box::-webkit-scrollbar {
  width: 8px;
}

.log-box::-webkit-scrollbar-track {
  background: transparent;
}

.log-box::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.log-box::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

.log-box div {
  margin-bottom: 0.5rem;
}

.log-info {
  color: var(--text);
}

.log-success {
  color: var(--success);
  font-weight: 500;
}

.log-error {
  color: var(--error);
  font-weight: 500;
}

.log-warning {
  color: #856404;
}

/* Result Card */
.result-card {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  padding-top: 1.5rem;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  transition: var(--transition);
  border-top: 1px solid var(--border-light);
}

.result-actions {
  display: flex;
  gap: 0.75rem;
}

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

.result-card label span {
  font-size: 0.813rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

/* Stats Widget */
.stats-widget {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 190px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.stats-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem;
  background: #ffffff;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  font-size: 0.875rem;
}

.stats-toggle:hover {
  background: var(--bg);
}

.stats-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.12);
  flex-shrink: 0;
}

.stats-chevron {
  margin-left: auto;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.stats-body {
  display: grid;
  gap: 0.5rem;
  padding: 0.75rem 0.875rem 0.875rem;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.813rem;
  color: var(--text-secondary);
}

.stats-row strong {
  color: var(--text);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.stats-row.success strong {
  color: var(--success);
}

.stats-row.failure strong {
  color: var(--error);
}

.stats-widget.collapsed {
  width: 138px;
}

.stats-widget.collapsed .stats-body {
  display: none;
}

.stats-widget.collapsed .stats-toggle {
  border-bottom: none;
}

.stats-widget.collapsed .stats-chevron {
  transform: rotate(180deg);
}

/* Responsive */
@media (max-width: 768px) {
  .app-shell {
    padding: 1.5rem 1rem;
  }

  .announcement-banner {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
  }

  .announcement-icon {
    font-size: 1.25rem;
  }

  .announcement-text {
    font-size: 0.875rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
    gap: 1.25rem;
  }

  .nav-links-header {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    width: 100%;
    align-items: flex-start;
  }

  .nav-links-header a {
    font-size: 0.813rem;
  }

  .workbench {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .stats-widget {
    right: 1rem;
    bottom: 1rem;
    width: 176px;
  }

  .input-panel,
  .output-panel {
    padding: 1.5rem;
  }
}

/* Utility */
[hidden] {
  display: none !important;
}
