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

:root {
  --header-bg: #0E1116;
  --accent-primary: #5B7FFF;
  --accent-secondary: #4C6EE8;
  --text-primary: #1a1a1a;
  --text-secondary: #666;
  --text-light: #999;
  --bg-white: #ffffff;
  --bg-light: #f8f9ff;
  --border-light: #e0e4f0;
  --success-green: #10b981;
  --error-red: #ef4444;
  --focus-ring: rgba(91, 127, 255, 0.3);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  background: #f5f6fa;
  min-height: 100vh;
  margin: 0;
}

/* Header */
.site-header {
  background: var(--header-bg);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.logo-link {
  text-decoration: none;
  color: inherit;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.5px;
}

.logo-accent {
  color: white;
}

.logo-mb {
  color: var(--accent-primary);
  font-weight: 800;
}

.header-nav {
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.header-nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s;
  font-weight: 500;
}

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

/* Container */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

/* Hero */
.hero {
  text-align: center;
  margin: 2rem 0;
}

.hero-title {
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 700px;
  margin: 0 auto;
}

/* Tool Card */
.ftm-tool .tool-card {
  background: var(--bg-white);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
}

/* Drop Zone */
.ftm-tool .dropzone {
  border: 3px dashed var(--accent-primary);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 1.5rem;
  background: var(--bg-light);
}

.ftm-tool .dropzone:hover {
  border-color: var(--accent-secondary);
  background: #f0f3ff;
  transform: translateY(-2px);
}

.ftm-tool .dropzone.drag-over {
  border-color: var(--accent-secondary);
  background: #e8ecff;
  transform: scale(1.01);
}

.ftm-tool .dropzone-content {
  pointer-events: none;
}

.ftm-tool .upload-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--accent-primary);
}

.ftm-tool .dropzone-text {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.ftm-tool .dropzone-hint {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* File Info */
.ftm-tool .file-info {
  background: #f0f9ff;
  border-left: 4px solid var(--accent-primary);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
}

.ftm-tool .file-info p {
  margin: 0.25rem 0;
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* Preset Section */
.ftm-tool .preset-section {
  margin-bottom: 1.5rem;
}

.ftm-tool .preset-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.ftm-tool .preset-chips {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.ftm-tool .preset-chip {
  padding: 0.65rem 1.5rem;
  border: 2px solid var(--border-light);
  background: white;
  color: var(--text-primary);
  border-radius: 24px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s;
}

.ftm-tool .preset-chip:hover {
  border-color: var(--accent-primary);
  background: var(--bg-light);
}

.ftm-tool .preset-chip.active {
  border-color: var(--accent-primary);
  background: var(--accent-primary);
  color: white;
}

.ftm-tool .custom-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.ftm-tool .custom-input input {
  flex: 1;
  max-width: 200px;
  padding: 0.65rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

.ftm-tool .custom-input input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.ftm-tool .custom-unit {
  font-weight: 600;
  color: var(--text-secondary);
}

.ftm-tool .platform-hint {
  font-size: 0.85rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* Advanced Settings */
.ftm-tool .advanced-settings {
  background: var(--bg-light);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.ftm-tool .advanced-settings summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  color: var(--text-primary);
  user-select: none;
}

.ftm-tool .advanced-settings summary::-webkit-details-marker {
  display: none;
}

.ftm-tool .advanced-settings summary::before {
  content: '▶';
  margin-right: 0.5rem;
  transition: transform 0.2s;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.ftm-tool .advanced-settings[open] summary::before {
  transform: rotate(90deg);
}

.ftm-tool .settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.ftm-tool .setting-group label {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
  color: var(--text-primary);
}

.ftm-tool .setting-group select {
  width: 100%;
  padding: 0.6rem;
  border: 2px solid var(--border-light);
  border-radius: 6px;
  font-size: 0.95rem;
  background: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

.ftm-tool .setting-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.ftm-tool .checkbox-group {
  display: flex;
  align-items: center;
}

.ftm-tool .checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  margin: 0;
}

.ftm-tool .checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent-primary);
}

.ftm-tool .settings-helper {
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
  font-style: italic;
}

/* Buttons */
.ftm-tool .btn-primary,
.ftm-tool .btn-secondary {
  width: 100%;
  padding: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.ftm-tool .btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(91, 127, 255, 0.3);
}

.ftm-tool .btn-primary:hover:not(:disabled) {
  background: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(91, 127, 255, 0.4);
}

.ftm-tool .btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: none;
}

.ftm-tool .btn-secondary {
  background: white;
  color: var(--accent-primary);
  border: 2px solid var(--accent-primary);
  margin-top: 0.75rem;
}

.ftm-tool .btn-secondary:hover {
  background: var(--bg-light);
  transform: translateY(-1px);
}

/* Progress */
.ftm-tool .progress {
  margin: 1.5rem 0;
}

.ftm-tool .progress-bar {
  width: 100%;
  height: 32px;
  background: #e8ecf0;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.ftm-tool .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
  width: 0%;
  transition: width 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}

.ftm-tool .progress-text {
  text-align: center;
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.95rem;
}

/* Result */
.ftm-tool .result {
  padding: 1.5rem 0;
}

.ftm-tool .result-success {
  text-align: center;
  margin-bottom: 1.5rem;
}

.ftm-tool .result-success h3 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  color: var(--success-green);
  font-size: 1.25rem;
  margin: 0;
}

.ftm-tool .check-icon {
  width: 28px;
  height: 28px;
  color: var(--success-green);
  flex-shrink: 0;
}

.ftm-tool .result-stats {
  background: var(--bg-light);
  border-radius: 8px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.75rem;
}

.ftm-tool .stat-item {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.ftm-tool .stat-item strong {
  color: var(--text-secondary);
  font-weight: 600;
  margin-right: 0.25rem;
}

.ftm-tool .result-tip {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 1rem;
  font-style: italic;
}

/* Error */
.ftm-tool .error {
  background: #fef2f2;
  border-left: 4px solid var(--error-red);
  padding: 1.25rem;
  border-radius: 6px;
  margin: 1.5rem 0;
}

.ftm-tool [data-el="errorText"] {
  color: #dc2626;
  margin-bottom: 1rem;
  font-weight: 500;
}

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

/* Guide Section */
.guide-section,
.calculator-section,
.faq-section {
  background: var(--bg-white);
  border-radius: 12px;
  padding: 2.5rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
}

.guide-section h2,
.calculator-section h2,
.faq-section h2 {
  color: var(--text-primary);
  font-size: 1.75rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.guide-section h3 {
  color: var(--text-primary);
  font-size: 1.3rem;
  margin: 1.5rem 0 0.75rem;
  font-weight: 600;
}

.guide-section p,
.guide-section ul {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.7;
}

.guide-section ul {
  padding-left: 1.5rem;
}

.guide-section li {
  margin-bottom: 0.5rem;
}

/* Calculator */
.calculator-desc {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.calculator-widget {
  background: var(--bg-light);
  border-radius: 8px;
  padding: 1.5rem;
  display: grid;
  gap: 1.25rem;
}

.calc-input-group {
  display: grid;
  gap: 0.5rem;
}

.calc-input-group label {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-primary);
}

.calc-input-group input {
  padding: 0.75rem;
  border: 2px solid var(--border-light);
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
  background: white;
}

.calc-input-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.calc-result {
  background: white;
  padding: 1rem;
  border-radius: 6px;
  border-left: 4px solid var(--accent-primary);
}

.calc-result strong {
  color: var(--text-primary);
}

.calc-result [data-ftm-calc="result"] {
  color: var(--accent-primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.calc-note {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.5rem 0 0;
  font-style: italic;
}

/* FAQ */
.faq-accordion {
  display: grid;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-light);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border-light);
  transition: all 0.2s;
}

.faq-item[open] {
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.faq-item summary {
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  color: var(--text-primary);
  font-size: 1.05rem;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item p {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Footer */
.site-footer {
  background: var(--bg-white);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 2rem;
}

.privacy-block h3 {
  color: var(--text-primary);
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.privacy-block p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 1.5rem;
}

.disclaimer {
  border-top: 1px solid var(--border-light);
  padding-top: 1rem;
}

.disclaimer p {
  font-size: 0.85rem;
  color: var(--text-light);
  text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
  .header-content {
    justify-content: center;
    text-align: center;
  }

  .header-nav {
    width: 100%;
    justify-content: center;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .tool-card,
  .guide-section,
  .calculator-section,
  .faq-section,
  .site-footer {
    padding: 1.5rem;
  }

  .dropzone {
    padding: 2rem 1rem;
  }

  .preset-chips {
    justify-content: center;
  }

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

  .result-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 10px;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .tool-card,
  .guide-section,
  .calculator-section,
  .faq-section,
  .site-footer {
    padding: 1.25rem;
    border-radius: 8px;
  }

  .logo {
    font-size: 1.3rem;
  }

  .header-nav {
    gap: 1rem;
  }

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

/* Focus visible for accessibility */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

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