:root {
  --chestnut: #4361ee;
  --chestnut-dark: #3a0ca3;
  --accent: #4cc9f0;
  --success: #06d6a0;
  --snow: #ffffff;
  --snow-dark: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --dark: #1e293b;
  --grad-primary: linear-gradient(135deg, #4361ee, #3a0ca3);
  --grad-hero: linear-gradient(135deg, #1e3a8a, #0f172a);
  --grad-accent: linear-gradient(135deg, #4cc9f0, #06d6a0);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 8px 25px rgba(67, 97, 238, 0.1);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.08);
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --transition: all 0.25s ease;
}

#app-content {
  background: linear-gradient(160deg, #f8faff 0%, #f0f4ff 40%, #f5f0ff 100%);
  min-height: 100vh;
  color: var(--dark);
}
#app-content[data-theme=dark] {
  --chestnut: #818cf8;
  --chestnut-dark: #6366f1;
  --accent: #22d3ee;
  --success: #34d399;
  --snow: #1e293b;
  --snow-dark: #0f172a;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-500: #94a3b8;
  --dark: #f1f5f9;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
  background: linear-gradient(160deg, #0f172a 0%, #1e293b 40%, #0f172a 100%);
}

#floatThemeToggle {
  position: fixed;
  top: 80px;
  right: 16px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid var(--gray-200);
  background: var(--snow);
  color: var(--dark);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
}
#floatThemeToggle:hover {
  transform: scale(1.1);
  border-color: var(--chestnut);
}

.hero-section {
  background: var(--grad-hero);
  padding: 100px 0 70px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="%23fff" fill-opacity="0.06" d="M0,192L48,197.3C96,203,192,213,288,229.3C384,245,480,267,576,250.7C672,235,768,181,864,181.3C960,181,1056,235,1152,234.7C1248,235,1344,181,1392,154.7L1440,128L1440,320L0,320Z"/></svg>') no-repeat bottom/cover;
}

.hero-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 10px;
}

.hero-desc {
  font-size: 1.05rem;
  opacity: 0.9;
  max-width: 600px;
  line-height: 1.7;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.hero-badge {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 50px;
  padding: 0.3rem 1rem;
  font-weight: 500;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.tool-section {
  margin-top: -30px;
  position: relative;
  z-index: 10;
  padding-bottom: 2rem;
}

.tool-card {
  background: var(--snow);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}

.step-indicator {
  display: flex;
  justify-content: space-between;
  margin: 2rem 0;
  position: relative;
}
.step-indicator::before {
  content: "";
  position: absolute;
  top: 20px;
  left: 15%;
  right: 15%;
  height: 3px;
  background: var(--gray-200);
  z-index: 1;
}

.step {
  text-align: center;
  z-index: 2;
  flex: 1;
}

.step-number {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--gray-200);
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  font-weight: 700;
  font-size: 1rem;
  border: 3px solid var(--snow);
  transition: var(--transition);
}

.step.active .step-number {
  background: var(--chestnut);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.2);
  transform: scale(1.1);
}

.step.done .step-number {
  background: var(--success);
  color: #fff;
}

.step-label {
  font-weight: 600;
  color: var(--gray-500);
  font-size: 0.8rem;
  transition: var(--transition);
}

.step.active .step-label {
  color: var(--chestnut);
  font-weight: 700;
}

.upload-area {
  position: relative;
  border: 3px dashed var(--gray-300);
  border-radius: 16px;
  padding: 3rem 2rem;
  text-align: center;
  background: rgba(67, 97, 238, 0.03);
  transition: var(--transition);
  cursor: pointer;
}
.upload-area:hover, .upload-area.dragover {
  border-color: var(--chestnut);
  background: rgba(67, 97, 238, 0.08);
}

#fileInput {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 20;
}

.upload-icon {
  width: 70px;
  height: 70px;
  background: var(--grad-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
  color: var(--snow);
  box-shadow: 0 10px 30px rgba(67, 97, 238, 0.3);
}

.upload-text {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.upload-subtext {
  color: var(--gray-500);
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.browse-btn {
  background: var(--grad-primary);
  color: var(--snow);
  border: none;
  padding: 12px 32px;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 8px 25px rgba(67, 97, 238, 0.3);
}
.browse-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 12px 30px rgba(67, 97, 238, 0.4);
}
.browse-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.stats-card {
  background: var(--grad-primary);
  color: var(--snow);
  border-radius: 12px;
  padding: 1rem;
  box-shadow: 0 6px 20px rgba(67, 97, 238, 0.15);
  transition: transform 0.3s;
}
.stats-card:hover {
  transform: translateY(-3px);
}

.stats-icon {
  font-size: 1.4rem;
  margin-bottom: 0.4rem;
  opacity: 0.9;
}

.stats-value {
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.settings-card {
  background: var(--snow);
  border-radius: 12px;
  padding: 1.2rem;
  margin-bottom: 0.8rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  transition: var(--transition);
}
.settings-card:hover {
  border-color: var(--chestnut);
  box-shadow: var(--shadow-md);
}
.settings-card .card-header {
  background: var(--grad-primary);
  color: var(--snow);
  border-radius: 8px 8px 0 0;
  padding: 0.7rem 1.1rem;
  margin: -1.2rem -1.2rem 1rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.control-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.control-icon {
  font-size: 1rem;
  color: var(--chestnut);
}

.control-select {
  width: 100%;
  padding: 10px 16px;
  border: 2px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
  background: var(--snow);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%234361ee' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
}
.control-select:focus {
  outline: none;
  border-color: var(--chestnut);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
}

.preview-pane {
  background: var(--snow-dark);
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  overflow: auto;
  max-height: 400px;
}
.preview-pane table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.preview-pane th, .preview-pane td {
  border: 1px solid var(--gray-200);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
.preview-pane th {
  background: var(--chestnut);
  color: #fff;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.preview-pane td {
  color: var(--dark);
  background: var(--snow);
}
.preview-pane tr:nth-child(even) td {
  background: var(--snow-dark);
}

.result-card {
  background: linear-gradient(135deg, var(--success), #059669);
  color: var(--snow);
  border-radius: 20px;
  padding: 2rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(6, 214, 160, 0.3);
  display: none;
  animation: slideUp 0.5s ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(8px);
}
.loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: var(--accent);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.loading-text {
  color: #fff;
  margin-top: 16px;
  font-weight: 600;
  font-size: 1rem;
}

.loading-sub {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.85rem;
  margin-top: 4px;
}

.toast {
  position: fixed;
  top: 90px;
  right: 20px;
  padding: 0.8rem 1.2rem;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  z-index: 10000;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s;
  max-width: 320px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  font-size: 0.9rem;
}
.toast.on {
  opacity: 1;
  transform: translateX(0);
}
.toast.ok {
  background: linear-gradient(135deg, var(--success), #059669);
}
.toast.err {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.toast.wrn {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.toast.inf {
  background: var(--grad-primary);
}

.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 64px;
  height: 64px;
  background: var(--grad-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 10px 30px rgba(67, 97, 238, 0.5);
  transition: all 0.3s;
}
.back-to-top.show {
  display: flex;
}
.back-to-top:hover {
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 14px 40px rgba(67, 97, 238, 0.6);
}

.content-section {
  background: var(--snow);
  border-radius: var(--radius-lg);
  padding: 50px 40px;
  margin: 50px auto;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.content-section::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--grad-primary);
}
.content-section h2 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--dark);
}
.content-section h3 {
  font-size: 1.2rem;
  margin: 24px 0 12px;
  color: var(--dark);
}
.content-section p {
  color: var(--gray-500);
  line-height: 1.8;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 24px 0;
}

.case-card {
  background: var(--snow-dark);
  border-radius: 14px;
  padding: 22px;
  border: 1px solid var(--gray-200);
  transition: var(--transition);
  position: relative;
}
.case-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--chestnut);
}

.case-number {
  position: absolute;
  top: 12px;
  right: 16px;
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--chestnut);
  line-height: 1;
  opacity: 0.35;
}

.case-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 10px;
  padding-right: 24px;
  color: var(--dark);
}

.case-detail {
  font-size: 0.88rem;
  color: var(--gray-500);
  margin-bottom: 6px;
  line-height: 1.6;
}
.case-detail strong {
  color: var(--chestnut-dark);
}

#app-content[data-theme=dark] .case-card {
  background: #334155;
}
#app-content[data-theme=dark] .case-card h3 {
  color: #f8fafc;
}
#app-content[data-theme=dark] .case-detail {
  color: #cbd5e1;
}
#app-content[data-theme=dark] .case-detail strong {
  color: var(--chestnut);
}

.usage-guide {
  background: var(--snow-dark);
  border-radius: 12px;
  padding: 28px;
  margin: 20px 0;
}
.usage-guide .step {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  align-items: flex-start;
}
.usage-guide .step:last-child {
  margin-bottom: 0;
}
.usage-guide .step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--chestnut);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.usage-guide .step-content {
  flex: 1;
}
.usage-guide .step-content h3 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}
.usage-guide .step-content p {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin: 0;
  line-height: 1.6;
}

.faq-section .faq-item {
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-section .faq-q {
  width: 100%;
  padding: 1.1rem 1.3rem;
  font-weight: 600;
  font-size: 0.95rem;
  background: var(--snow);
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
  text-align: left;
  color: var(--dark);
}
.faq-section .faq-q:hover {
  background: var(--snow-dark);
}
.faq-section .faq-q i {
  transition: transform 0.3s;
  color: var(--chestnut);
  flex-shrink: 0;
}
.faq-section .faq-q.active i {
  transform: rotate(180deg);
}
.faq-section .faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.faq-section .faq-a.open {
  max-height: 320px;
}
.faq-section .faq-a-inner {
  padding: 0 1.3rem 1.15rem;
  color: var(--gray-500);
  font-size: 0.9rem;
  line-height: 1.7;
}

.related-tools {
  margin: 50px 0;
  padding: 36px;
  background: var(--snow);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}
.related-tools h3 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--dark);
}

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

.related-card {
  display: flex;
  flex-direction: column;
  padding: 14px;
  background: var(--snow-dark);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
  transition: all 0.25s;
  text-decoration: none;
}
.related-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--chestnut);
}

.related-name {
  font-weight: 600;
  color: var(--chestnut);
  margin-bottom: 3px;
  font-size: 0.88rem;
}

.related-desc {
  color: var(--gray-500);
  font-size: 0.78rem;
  line-height: 1.4;
}

.trust-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  padding: 16px;
  margin: 14px 0;
  background: var(--snow-dark);
  border-radius: 10px;
  border: 1px solid var(--gray-200);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--gray-500);
}
.trust-item i {
  color: var(--chestnut);
}

.gradient-text {
  background: var(--grad-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--snow-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--chestnut);
  border-radius: 3px;
}

@media (max-width: 768px) {
  .tool-card {
    padding: 1.2rem;
  }
  .content-section {
    padding: 30px 20px;
  }
  .step-indicator::before {
    left: 5%;
    right: 5%;
  }
  .case-grid {
    grid-template-columns: 1fr;
  }
  .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .hero-section {
    padding: 80px 0 50px;
  }
}
@media (max-width: 480px) {
  .hero-badges {
    gap: 0.3rem;
  }
  .hero-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.7rem;
  }
  .upload-area {
    padding: 2rem 1rem;
  }
  .upload-text {
    font-size: 1.1rem;
  }
}
