:root {
  --chestnut: #4361ee;
  --chestnut-dark: #3a0ca3;
  --chestnut-deeper: #7209b7;
  --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, #4361ee 0%, #3a0ca3 50%, #7209b7 100%);
  --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;
  --chestnut-deeper: #a78bfa;
  --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);
}

.load-mask {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}
.load-mask.active {
  opacity: 1;
  visibility: visible;
}

.load-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top: 4px solid #818cf8;
  border-radius: 50%;
  animation: spinf 0.8s linear infinite;
}

@keyframes spinf {
  to {
    transform: rotate(360deg);
  }
}
.load-txt {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 16px;
}

.notification {
  position: fixed;
  top: 100px;
  right: 20px;
  padding: 0.8rem 1.3rem;
  border-radius: 12px;
  color: white;
  font-weight: 600;
  z-index: 10001;
  opacity: 0;
  transform: translateX(100%);
  transition: all 0.3s ease;
  max-width: 340px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  font-size: 0.95rem;
}
.notification.show {
  opacity: 1;
  transform: translateX(0);
}
.notification.success {
  background: linear-gradient(135deg, var(--success), #059669);
}
.notification.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}
.notification.warning {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}
.notification.info {
  background: linear-gradient(135deg, var(--gray-500), #475569);
}

#backToTop {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--grad-primary);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
}
#backToTop.show {
  opacity: 1;
  visibility: visible;
}
#backToTop:hover {
  transform: translateY(-3px);
}

.hero-section {
  background: var(--grad-hero);
  padding: 100px 0 70px;
  color: #fff;
  position: relative;
  overflow: hidden;
}

.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);
}

.upload-zone {
  border: 3px dashed var(--gray-300);
  border-radius: 20px;
  padding: 3rem 2rem;
  text-align: center;
  background: rgba(67, 97, 238, 0.03);
  cursor: pointer;
  transition: var(--transition);
  margin-bottom: 2rem;
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--chestnut);
  background: rgba(67, 97, 238, 0.1);
  transform: translateY(-5px);
}

.upload-icon {
  width: 90px;
  height: 90px;
  background: var(--grad-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  color: var(--snow);
  box-shadow: 0 15px 35px rgba(79, 70, 229, 0.4);
}

.file-info {
  background: #f0fff4;
  border: 2px solid #48bb78;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 700;
  padding: 1rem 2.5rem;
  border-radius: var(--radius-md);
  transition: all 0.25s ease;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary-custom {
  background: var(--grad-primary);
  color: #fff !important;
  padding: 1.2rem 3rem;
  font-size: 1.1rem;
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.4);
}
.btn-primary-custom:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(79, 70, 229, 0.6);
  color: #fff !important;
}

.btn-success-custom {
  background: linear-gradient(135deg, #34d399, #059669);
  color: #fff !important;
  box-shadow: 0 10px 30px rgba(52, 211, 153, 0.4);
}
.btn-success-custom:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(52, 211, 153, 0.6);
  color: #fff !important;
}

.btn-reset-custom {
  background: var(--snow);
  color: var(--dark);
  border: 2px solid var(--gray-200);
}
.btn-reset-custom:hover {
  background: var(--snow-dark);
  border-color: var(--chestnut);
  color: var(--chestnut);
}

.preview-panel {
  background: var(--snow);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  border: 2px solid rgba(79, 70, 229, 0.1);
  margin-top: 2rem;
}

.preview-header {
  background: var(--grad-primary);
  padding: 1.2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-title {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.preview-content {
  padding: 2rem;
  height: 450px;
  overflow-y: auto;
  background: var(--snow-dark);
}

.preview-render {
  background: var(--snow);
  border-radius: var(--radius-md);
  padding: 2rem;
  min-height: 400px;
  overflow-y: auto;
}

.json-preview {
  font-family: "Fira Code", "Courier New", monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.json-key {
  color: #e44d26;
  font-weight: 600;
}

.json-string {
  color: #859900;
}

.json-number {
  color: #268bd2;
}

.control-panel {
  background: var(--snow-dark);
  border-radius: 20px;
  padding: 2rem;
  margin-top: 2rem;
  border: 2px solid rgba(79, 70, 229, 0.1);
}

.control-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.control-item {
  background: var(--snow);
  padding: 1.5rem;
  border-radius: var(--radius-md);
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(79, 70, 229, 0.1);
}

.control-label {
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-family: "Inter", sans-serif;
}
.form-select:focus {
  outline: none;
  border-color: var(--chestnut);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.progress-container {
  margin-top: 1.5rem;
}

.progress {
  height: 10px;
  border-radius: 10px;
  background: var(--gray-200);
}

.progress-bar {
  background: var(--grad-primary);
  border-radius: 10px;
  transition: width 0.3s ease;
}

.content-card {
  background: var(--snow);
  border-radius: 20px;
  padding: 40px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
}
.content-card h2 {
  font-size: 1.4rem;
  margin-bottom: 16px;
  color: var(--dark);
}
.content-card h3 {
  font-size: 1.15rem;
  margin: 20px 0 10px;
  color: var(--dark);
}
.content-card p {
  color: var(--gray-500);
  margin-bottom: 14px;
  line-height: 1.8;
}
.content-card ul {
  color: var(--gray-500);
  margin-bottom: 14px;
  padding-left: 20px;
}
.content-card ul li {
  margin-bottom: 6px;
}

.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 {
  background: var(--snow);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-section .faq-item:hover {
  border-color: var(--chestnut);
}
.faq-section .faq-question {
  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-question:hover {
  background: var(--snow-dark);
  color: var(--chestnut);
}
.faq-section .faq-question i {
  transition: transform 0.3s;
  color: var(--chestnut);
  flex-shrink: 0;
}
.faq-section .faq-item.open .faq-question i {
  transform: rotate(180deg);
}
.faq-section .faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.3s ease;
}
.faq-section .faq-answer p {
  padding: 0 1.3rem 1.15rem;
  color: var(--gray-500);
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 0;
}
.faq-section .faq-item.open .faq-answer {
  max-height: 600px;
}

.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 h2 {
  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-card.dark-mode {
  background: var(--gray-200);
}

.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);
}

.privacy-note p {
  color: var(--gray-500) !important;
}

#app-content[data-theme=dark] .tool-card, #app-content[data-theme=dark] .content-card, #app-content[data-theme=dark] .control-item {
  background: var(--snow);
  border-color: var(--gray-200);
}
#app-content[data-theme=dark] .preview-panel {
  border-color: var(--gray-200);
}
#app-content[data-theme=dark] .preview-content {
  background: var(--snow-dark);
}
#app-content[data-theme=dark] .preview-render {
  background: var(--snow);
}
#app-content[data-theme=dark] .file-info {
  background: rgba(52, 211, 153, 0.1);
  border-color: #34d399;
}
#app-content[data-theme=dark] .upload-zone {
  background: rgba(79, 70, 229, 0.1);
}
#app-content[data-theme=dark] .upload-zone:hover {
  background: rgba(79, 70, 229, 0.2);
}
#app-content[data-theme=dark] .faq-item {
  background: var(--snow);
  border-color: var(--gray-200);
}
#app-content[data-theme=dark] .faq-question {
  background: var(--snow);
}
#app-content[data-theme=dark] .faq-question:hover {
  background: var(--snow-dark);
}
#app-content[data-theme=dark] .related-card {
  background: var(--snow);
  border-color: var(--gray-200);
}
#app-content[data-theme=dark] .privacy-note {
  background: rgba(99, 102, 241, 0.08) !important;
  border-color: rgba(99, 102, 241, 0.15) !important;
}

.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-card {
    padding: 24px;
  }
  .case-grid {
    grid-template-columns: 1fr;
  }
  .related-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  .hero-section {
    padding: 80px 0 50px;
  }
  .hero-title {
    font-size: 2rem;
  }
  .control-group {
    grid-template-columns: 1fr;
  }
  .action-buttons {
    flex-direction: column;
  }
  .btn-icon {
    width: 100%;
    justify-content: center;
  }
  .btn-primary-custom {
    padding: 1rem 2rem;
    font-size: 1rem;
  }
}
@media (max-width: 480px) {
  .btn-primary-custom {
    padding: 1.5rem 3rem !important;
    font-size: 1rem;
  }
}
@media (max-width: 480px) {
  .hero-badges {
    gap: 0.3rem;
  }
  .hero-badge {
    font-size: 0.75rem;
    padding: 0.2rem 0.7rem;
  }
  .upload-zone {
    padding: 2rem 1rem;
  }
  .btn-icon {
    padding: 0.85rem 1.2rem;
    font-size: 0.9rem;
  }
  .btn-primary-custom {
    padding: 0.85rem 1.2rem;
    font-size: 0.9rem;
    white-space: normal;
  }
}
