:root {
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --bg-grad-1: #0f172a;
  --bg-grad-2: #1e293b;
  --card-bg: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --input-bg: #f8fafc;
  --shadow: 0 20px 60px -15px rgba(2, 6, 23, 0.55);
  --radius: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px 18px;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 15% -10%, #334155 0%, transparent 55%),
              radial-gradient(1000px 700px at 110% 10%, #4338ca 0%, transparent 45%),
              linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Card ---------- */
.card {
  width: 100%;
  max-width: 560px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px 28px 26px;
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.card__header { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.card__heading { flex: 1; min-width: 0; }
.logo {
  width: 48px; height: 48px; flex: 0 0 auto;
  display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-radius: 14px; box-shadow: 0 8px 20px -6px var(--accent-dark);
}
.logo svg { width: 24px; height: 24px; }
.card__header h1 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.subtitle { color: var(--text-muted); font-size: 0.88rem; margin-top: 3px; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius);
  background: var(--input-bg);
  padding: 38px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.05s ease;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--accent); background: var(--accent-soft); outline: none; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.dz-icon { width: 42px; height: 42px; color: var(--accent); margin-bottom: 10px; }
.dz-title { font-size: 1.05rem; font-weight: 700; }
.dz-sub { color: var(--text-muted); font-size: 0.86rem; margin-top: 4px; }
.dz-browse { color: var(--accent-dark); font-weight: 600; text-decoration: underline; }
.dz-notice { margin-top: 12px; text-align: center; font-size: 0.85rem; font-weight: 600; color: #dc2626; }

/* ---------- Controls ---------- */
.controls { margin-top: 20px; }
.field { margin-bottom: 18px; }
.field > label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 10px;
}
.field > label span { color: var(--accent-dark); font-weight: 700; }

.format-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); gap: 10px; }
.fmt-btn {
  padding: 12px 0; font-size: 1rem; font-weight: 700; color: var(--text);
  background: var(--input-bg); border: 2px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}
.fmt-btn:hover { border-color: var(--accent); }
.fmt-btn:active { transform: scale(0.96); }
.fmt-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border-color: transparent; color: #fff;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  background: var(--border); border-radius: 999px; outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(2,6,23,.3);
}
input[type="range"]::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 3px solid #fff;
}

.primary-btn {
  width: 100%; padding: 14px 0; font-size: 1rem; font-weight: 700; letter-spacing: 0.02em;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  transition: filter 0.15s ease, transform 0.08s ease; font-family: inherit;
}
.primary-btn:hover { filter: brightness(1.08); }
.primary-btn:active { transform: scale(0.99); }
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- File list ---------- */
.files { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.file-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--input-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px;
}
.file-thumb {
  width: 46px; height: 46px; flex: 0 0 auto; border-radius: 8px; object-fit: cover;
  background: #e2e8f0; border: 1px solid var(--border);
}
.file-meta { flex: 1; min-width: 0; }
.file-name { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.file-info .arrow { color: var(--accent-dark); font-weight: 700; }
.file-info .saved { color: #16a34a; font-weight: 600; }
.file-info .grew { color: #ea580c; font-weight: 600; }
.file-action { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; }
.file-fail { color: #dc2626; font-weight: 600; font-size: 0.8rem; }
.dl-btn {
  display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
  padding: 8px 14px; font-size: 0.82rem; font-weight: 700; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark); border: 1px solid transparent; cursor: pointer;
  font-family: inherit;
}
.dl-btn:hover { background: var(--accent); color: #fff; }
.dl-btn svg { width: 14px; height: 14px; }
.remove-btn {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 50%; border: none; cursor: pointer;
  background: transparent; color: var(--text-muted); font-size: 1.1rem; line-height: 1;
}
.remove-btn:hover { background: #fee2e2; color: #dc2626; }
.spinner {
  width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bulk-row { display: flex; justify-content: flex-end; margin-top: 4px; }
.bulk-row .dl-btn { background: var(--accent); color: #fff; }

/* ---------- Privacy note ---------- */
.privacy-note {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  margin-top: 18px; color: var(--text-muted); font-size: 0.82rem;
}
.privacy-note svg { width: 15px; height: 15px; color: #16a34a; flex: 0 0 auto; }

/* ---------- Ad slot ---------- */
.adslot {
  width: 100%; max-width: 560px; min-height: 100px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.04); border: 1px dashed rgba(148,163,184,0.35);
  border-radius: var(--radius-sm); color: rgba(148,163,184,0.7); font-size: 0.8rem;
}

/* ---------- Footer ---------- */
.site-footer {
  width: 100%; max-width: 560px; display: flex; justify-content: flex-end; align-items: center; gap: 18px;
  padding: 4px 6px 0; color: rgba(148,163,184,0.75); font-size: 0.8rem;
}
.site-footer .copy { margin-right: auto; }
.site-footer a { color: rgba(203,213,225,0.85); text-decoration: none; font-weight: 500; }
.site-footer a:hover { color: #fff; text-decoration: underline; }

/* ---------- Document pages (About / Privacy) ---------- */
.doc {
  width: 100%; max-width: 720px; background: var(--card-bg); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 34px 34px 30px; border: 1px solid rgba(255,255,255,0.6);
}
.doc__brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); margin-bottom: 22px; }
.doc__brand .logo { width: 40px; height: 40px; }
.doc__brand .logo svg { width: 20px; height: 20px; }
.doc__brand span { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
.doc h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; margin-bottom: 6px; }
.doc .updated { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px; }
.doc h2 { font-size: 1.1rem; font-weight: 700; margin: 24px 0 8px; }
.doc p, .doc li { color: #334155; font-size: 0.96rem; line-height: 1.7; }
.doc p { margin-bottom: 12px; }
.doc ul { margin: 0 0 12px 20px; }
.doc li { margin-bottom: 6px; }
.doc a { color: var(--accent-dark); font-weight: 600; text-decoration: none; }
.doc a:hover { text-decoration: underline; }
.doc .back {
  display: inline-block; margin-top: 24px; padding: 11px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff;
  border-radius: var(--radius-sm); font-weight: 700; font-size: 0.9rem;
}
.doc .back:hover { filter: brightness(1.08); text-decoration: none; }

@media (max-width: 440px) {
  .card { padding: 24px 20px 22px; }
  .doc { padding: 24px 20px 22px; }
  .card__header h1 { font-size: 1.25rem; }
  .site-footer { justify-content: center; flex-wrap: wrap; gap: 12px; }
  .site-footer .copy { margin-right: 0; width: 100%; text-align: center; }
  .file-name { max-width: 40vw; }
}
