:root {
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-border: #e0e4ec;
  --color-border-hover: #adb5bd;
  --color-text: #1a1d23;
  --color-text-secondary: #5f6877;
  --color-primary: #4361ee;
  --color-primary-hover: #3a50d4;
  --color-primary-light: #eef1ff;
  --color-primary-text: #ffffff;
  --color-error: #dc3545;
  --color-error-bg: #f8d7da;
  --color-success: #198754;
  --color-trust: #0f7b5f;
  --color-trust-bg: #ecfdf5;
  --color-trust-border: #b7ebe0;
  --color-drop-bg: #f0f4ff;
  --color-drop-border: #4361ee;
  --color-row-alt: #f8f9fc;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
header {
  text-align: center;
  padding: 2.5rem 1rem 0.75rem;
}

header h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #4361ee, #7c3aed);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
  font-size: 1rem;
}

/* Trust banner */
.trust-banner {
  padding: 0 1rem;
  margin-bottom: 1.5rem;
}

.trust-banner-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.7rem 1.25rem;
  background: var(--color-trust-bg);
  border: 1px solid var(--color-trust-border);
  border-radius: var(--radius);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-trust);
  white-space: nowrap;
}

.trust-item svg {
  flex-shrink: 0;
}

/* Main */
main {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  flex: 1;
}

section {
  margin-bottom: 1.5rem;
}

h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

/* Drop zone */
#drop-zone {
  border: 2px dashed var(--color-border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, transform 0.15s;
  background: var(--color-surface);
  box-shadow: var(--shadow);
  outline: none;
}

#drop-zone:hover,
#drop-zone:focus-visible {
  border-color: var(--color-drop-border);
  background: var(--color-drop-bg);
}

#drop-zone.drag-over {
  border-color: var(--color-drop-border);
  background: var(--color-drop-bg);
  border-style: solid;
  transform: scale(1.01);
}

.drop-zone-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-light);
  border-radius: 50%;
  color: var(--color-primary);
}

.drop-zone-text {
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 500;
}

.drop-zone-hint {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

#file-info {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-primary-light);
  border: 1px solid #d4dafb;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-primary);
}

/* Options */
#options-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

fieldset {
  border: none;
  margin-bottom: 1rem;
}

legend {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}

.radio-label input[type="radio"] {
  accent-color: var(--color-primary);
  width: 16px;
  height: 16px;
}

.input-group {
  margin-bottom: 1rem;
}

.input-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.input-group input[type="number"],
.input-group select {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input-group input[type="number"]:focus,
.input-group select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.12);
}

.input-group input[type="number"] {
  width: 140px;
}

.size-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.size-row select {
  width: 80px;
}

/* Buttons */
.primary-btn {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.75rem;
  border: none;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #4361ee, #5a4de6);
  color: var(--color-primary-text);
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.primary-btn:hover {
  opacity: 0.9;
}

.primary-btn:active {
  transform: scale(0.98);
}

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

.secondary-btn {
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.7rem 1.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}

.secondary-btn:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg);
}

/* Progress */
.progress-bar-container {
  width: 100%;
  height: 10px;
  background: var(--color-border);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4361ee, #7c3aed);
  border-radius: 5px;
  transition: width 0.15s ease;
}

#progress-text {
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
  margin-top: 0.5rem;
}

/* Results */
#results-summary {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.75rem;
}

#results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

#results-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  background: var(--color-bg);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

#results-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}

#results-table tbody tr:nth-child(even) {
  background: var(--color-row-alt);
}

#results-table tbody tr:last-child td {
  border-bottom: none;
}

.download-part-btn {
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-primary);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.download-part-btn:hover {
  background: var(--color-primary);
  color: var(--color-primary-text);
}

.results-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

/* Error */
.error-banner {
  padding: 0.75rem 1rem;
  background: var(--color-error-bg);
  color: var(--color-error);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
}

/* Content sections */
.content-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border);
}

.content-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.content-section h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.content-section p {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  line-height: 1.65;
}

/* Steps */
.steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-number {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4361ee, #5a4de6);
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  border-radius: 50%;
}

/* Features grid */
.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.feature {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.15rem;
}

.feature h3 {
  margin-bottom: 0.35rem;
}

/* FAQ */
.faq {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq details {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  transition: border-color 0.2s;
}

.faq details[open] {
  border-color: var(--color-primary);
}

.faq summary {
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq summary::after {
  content: "+";
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--color-text-secondary);
  transition: transform 0.2s;
}

.faq details[open] summary::after {
  content: "-";
}

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

.faq details p {
  margin-top: 0.65rem;
}

@media (max-width: 600px) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* Footer */
footer {
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--color-border);
}

.footer-security {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  text-align: left;
}

.footer-security svg {
  flex-shrink: 0;
  color: var(--color-trust);
  margin-top: 2px;
}

.footer-security p {
  font-size: 0.8rem;
  color: var(--color-text-secondary);
  line-height: 1.5;
}

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

/* Responsive */
@media (max-width: 600px) {
  header {
    padding: 1.5rem 1rem 0.5rem;
  }

  header h1 {
    font-size: 1.6rem;
  }

  .trust-banner-inner {
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
  }

  #drop-zone {
    padding: 1.5rem 1rem;
  }

  #options-section {
    padding: 1rem;
  }

  .results-actions {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
    text-align: center;
  }
}
