:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --accent: #3f51b5;
  --accent-2: #ff9800;
  --success: #2e7d32;
  --danger: #c62828;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #dfe3ec;
  --shadow: 0 10px 28px rgba(31, 41, 55, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(180deg, #f5f7fb, #eef2ff);
  color: var(--text);
}

.app-shell {
  max-width: 960px;
  margin: 40px auto;
  padding: 20px;
}

.topbar {
  text-align: center;
  margin-bottom: 20px;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.9rem, 3vw, 3rem);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
}

button {
  border: none;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.2s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.primary {
  background: var(--accent);
  color: white;
}

.accent {
  background: var(--accent-2);
  color: white;
}

.secondary {
  background: #eceffb;
  color: var(--text);
}

.success {
  background: var(--success);
  color: white;
  width: 100%;
  margin-top: 14px;
}

.folder-info {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
  min-height: 50px;
  word-break: break-word;
}

.progress-box {
  margin-top: 12px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
}

.progress-bar {
  width: 100%;
  height: 20px;
  border-radius: 999px;
  overflow: hidden;
  background: #ecf0f8;
  border: 1px solid #d6ddea;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #46a0f3);
  transition: width 0.25s ease;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.stat-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
}

.stat-card label {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 1.8rem;
}

.status-box {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #eef3ff;
  border: 1px solid #d7e3ff;
  font-weight: 700;
}

.preview-box {
  margin-top: 24px;
}

.preview-box h2 {
  margin-bottom: 10px;
}

#previewOutput {
  width: 100%;
  min-height: 240px;
  resize: vertical;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 14px;
  background: #f8fafc;
  font-family: Consolas, monospace;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}
