:root {
  --primary: #e53e3e;
  --primary-dark: #c53030;
  --primary-light: #fff5f5;
  --text: #1a202c;
  --text-muted: #718096;
  --border: #e2e8f0;
  --bg: #f7fafc;
  --white: #ffffff;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { max-width: 860px; margin: 0 auto; padding: 0 20px; }

/* Header */
.header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header .container { display: flex; align-items: center; justify-content: space-between; }

.logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}
.logo span { color: var(--primary); }

.nav { display: flex; gap: 20px; }
.nav a { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; }
.nav a:hover { color: var(--primary); }

/* Hero */
.hero { text-align: center; padding: 48px 0 32px; }
.hero h1 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.hero-desc { color: var(--text-muted); font-size: 1.05rem; margin-bottom: 20px; }

.badges { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.badge {
  background: var(--primary-light);
  color: var(--primary-dark);
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* AdSense */
.ad-slot { margin: 24px 0; }

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}
.tab-btn.active { background: var(--primary); color: white; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--white);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.drop-icon { font-size: 3rem; margin-bottom: 12px; }
.drop-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; }
.drop-sub { color: var(--text-muted); font-size: 0.88rem; }

/* Options */
.options {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.option-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.option-row label { font-size: 0.88rem; font-weight: 600; color: var(--text-muted); min-width: 100px; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; }

.fmt-btn, .dpi-btn, .page-btn, .orient-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s;
}
.fmt-btn.active, .dpi-btn.active, .page-btn.active, .orient-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

input[type="range"] {
  flex: 1;
  min-width: 120px;
  accent-color: var(--primary);
}

/* Progress */
.progress-wrap { margin: 20px 0; }
.progress-bar {
  background: var(--border);
  border-radius: 8px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 8px;
  transition: width 0.3s;
  width: 0%;
}
.progress-text { text-align: center; font-size: 0.88rem; color: var(--text-muted); }

/* Results grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.result-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: center;
}
.result-card img { width: 100%; height: 120px; object-fit: cover; display: block; }
.result-card-info { padding: 8px; }
.result-card-name { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-card-dl {
  display: block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  width: 100%;
}
.result-card-dl:hover { background: var(--primary); color: white; }

/* Image preview list (img→pdf) */
.img-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.img-preview-item {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-align: center;
}
.img-preview-item img { width: 100%; height: 90px; object-fit: cover; display: block; }
.img-preview-item .page-num {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0,0,0,0.6);
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}
.img-preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-preview-name { font-size: 0.72rem; color: var(--text-muted); padding: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Actions */
.actions { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; }

.btn-primary {
  flex: 1;
  padding: 13px 24px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  padding: 13px 20px;
  background: var(--white);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }

/* Features */
.features { padding: 48px 0 32px; }
.features h2 { text-align: center; font-size: 1.5rem; font-weight: 800; margin-bottom: 28px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}
.feature-icon { font-size: 2rem; margin-bottom: 10px; }
.feature-card h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 0.83rem; color: var(--text-muted); line-height: 1.6; }

/* FAQ */
.faq { padding: 32px 0 48px; }
.faq h2 { text-align: center; font-size: 1.5rem; font-weight: 800; margin-bottom: 24px; }
.faq-list { display: flex; flex-direction: column; gap: 10px; }

.faq-item {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-item summary::after { content: '+'; font-size: 1.2rem; color: var(--primary); }
.faq-item[open] summary::after { content: '−'; }
.faq-item p { padding: 0 20px 16px; color: var(--text-muted); font-size: 0.9rem; }

/* Footer */
.footer {
  background: var(--white);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
}
.footer-links { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; }
.footer-links a { color: var(--text-muted); text-decoration: none; font-size: 0.88rem; }
.footer-links a:hover { color: var(--primary); }
.footer-copy { font-size: 0.8rem; color: #a0aec0; }

@media (max-width: 600px) {
  .hero h1 { font-size: 1.5rem; }
  .option-row { flex-direction: column; align-items: flex-start; }
  .actions { flex-direction: column; }
  .btn-primary { flex: none; width: 100%; }
}
