/* Exact Image Compressor — mobile-first, single accent, no framework. */
:root {
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-soft: #eff6ff;
  --ink: #0f172a;
  --ink-soft: #475569;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --good: #16a34a;
  --warn-bg: #fef9c3;
  --warn-ink: #854d0e;
  --error-bg: #fee2e2;
  --error-ink: #991b1b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }

img { max-width: 100%; height: auto; }

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

h1 { font-size: 1.7rem; line-height: 1.25; margin: 20px 0 8px; }
h2 { font-size: 1.25rem; margin: 28px 0 8px; }

/* ------------------------------ header ------------------------------ */
.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.site-header nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.logo svg { color: var(--accent); }
.nav-links { display: flex; gap: 14px; }
.nav-links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.9rem;
}
.nav-links a:hover { color: var(--accent); }

.tagline { color: var(--ink-soft); margin: 0 0 16px; }

/* ------------------------------- tool ------------------------------- */
.tool {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 1px 3px rgb(15 23 42 / 0.06);
}

.privacy-line {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--good);
  font-weight: 500;
}

.dropzone {
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  color: var(--ink);
  transition: background 0.15s, border-color 0.15s;
}
.dropzone svg { color: var(--accent); }
.dropzone:hover, .dropzone:focus-visible, .dropzone--over {
  background: #dbeafe;
  border-color: var(--accent-dark);
  outline: none;
}
.dz-main { margin: 10px 0 4px; font-size: 1.05rem; }
.dz-hint { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }

.tool-error {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--error-bg);
  color: var(--error-ink);
  font-size: 0.9rem;
}

/* controls */
.controls { margin: 0; }
.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.file-info img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg);
}
.file-info > div { min-width: 0; flex: 1; }
.file-name {
  margin: 0;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-meta { margin: 0; font-size: 0.85rem; color: var(--ink-soft); }
.icon-btn {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: var(--ink-soft);
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--error-ink); border-color: var(--error-ink); }

.field-row { margin-bottom: 10px; }
.field-row label { font-weight: 600; font-size: 0.9rem; display: block; margin-bottom: 4px; }
.target-group { display: flex; gap: 8px; }
.target-group input {
  flex: 1;
  max-width: 160px;
  font-size: 1.1rem;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.target-group select {
  font-size: 1rem;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
}
.target-group input:focus, .target-group select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 14px; }
.chip {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip--active, .chip--current {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chip--active:hover, .chip--current:hover { color: #fff; }

.format-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}
.format-row legend { font-weight: 600; font-size: 0.9rem; padding: 0 4px; }
.format-row label { font-size: 0.92rem; display: inline-flex; align-items: center; gap: 6px; }
.format-row small { color: var(--ink-soft); }
.format-note, .resize-note {
  font-size: 0.85rem;
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0 0 12px;
  color: var(--ink-soft);
}

.resize-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.resize-details summary { cursor: pointer; font-size: 0.92rem; font-weight: 600; }
.resize-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  margin-top: 10px;
}
.resize-fields label { font-size: 0.85rem; font-weight: 600; }
.resize-fields input[type="number"] {
  display: block;
  width: 96px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1rem;
  margin-top: 2px;
}
.dim-x { color: var(--ink-soft); padding-bottom: 10px; }
.lock-label { display: inline-flex; align-items: center; gap: 6px; font-weight: 400 !important; padding-bottom: 8px; }
.resize-note { margin-top: 10px; margin-bottom: 0; }

.btn-primary {
  display: block;
  width: 100%;
  padding: 13px 20px;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-secondary {
  display: block;
  width: 100%;
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.95rem;
  cursor: pointer;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

/* progress */
.progress { text-align: center; padding: 20px 0 8px; }
.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 10px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-label { margin: 0 0 10px; font-size: 0.92rem; color: var(--ink-soft); }
.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.2s;
}

/* result */
.result-message {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  font-size: 0.9rem;
  margin: 0 0 12px;
}
.result-message--warn { background: var(--warn-bg); color: var(--warn-ink); }
.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 14px;
}
.stat { display: flex; flex-direction: column; }
.stat-label { font-size: 0.75rem; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-weight: 700; }
.stat-good { color: var(--good); }
.stat-arrow { color: var(--ink-soft); font-size: 1.2rem; }

.preview-wrap { text-align: center; margin-bottom: 14px; }
.preview-wrap img {
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 0 0 / 20px 20px;
}
.preview-toggle { margin-top: 8px; user-select: none; -webkit-user-select: none; touch-action: none; }

.result-actions { display: grid; gap: 10px; }

/* ------------------------------ ad slots ---------------------------- */
.ad-slot {
  margin: 20px 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.ad-slot--rect { min-height: 250px; }   /* 300×250 / responsive rectangle */
.ad-slot--footer { min-height: 90px; }  /* 728×90 / mobile banner */

/* ------------------------------ content ----------------------------- */
.content { margin-top: 8px; }
.content ul { padding-left: 20px; }
.content li { margin-bottom: 6px; }
.content--page { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 20px 20px; margin-top: 20px; }

/* faq */
.faq-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}
.faq-item summary { font-weight: 600; cursor: pointer; }
.faq-item p { margin: 8px 0 0; color: var(--ink-soft); }

.other-sizes { margin: 28px 0; }
.other-sizes h2 { font-size: 1rem; margin-bottom: 10px; }

/* ------------------------------ footer ------------------------------ */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--card);
  margin-top: 32px;
  padding: 8px 0 24px;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 16px 0 8px;
}
.footer-links a { font-size: 0.9rem; color: var(--ink-soft); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }
.footer-note { font-size: 0.8rem; color: var(--ink-soft); margin: 0; }

/* ------------------------------ desktop ----------------------------- */
@media (min-width: 640px) {
  h1 { font-size: 2.1rem; margin-top: 32px; }
  .tool { padding: 24px; }
  .result-actions { grid-template-columns: 1fr 1fr; }
  .btn-primary, .btn-secondary { width: auto; min-width: 220px; }
  .result-actions .btn-primary, .result-actions .btn-secondary { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  .progress-fill { transition: none; }
}
