@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --brand:       #0f79d8;
  --brand-hover: #0d6abf;
  --brand-pale:  #e8f2fd;
  --bg:          #f5f7fa;
  --surface:     #ffffff;
  --surface-2:   #f9fafb;
  --line:        #e5eaf2;
  --text:        #1a1f2e;
  --muted:       #6b7a99;
  --success:     #0d7a4a;
  --error:       #c0192e;
  --radius:      14px;
  --radius-sm:   10px;
  --shadow-sm:   0 2px 8px rgba(15,30,70,.07);
  --shadow:      0 4px 20px rgba(15,30,70,.10);
  --shadow-md:   0 8px 32px rgba(15,30,70,.12);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }

/* ─── App wrapper ─────────────────────────── */
.imgCompressApp {
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

/* ─── Top bar ─────────────────────────────── */
.imgCompressApp__top {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 100;
}

.imgCompressApp__topInner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.imgCompressApp__brand {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.imgCompressApp__brand span { color: var(--text); }

.imgCompressApp__topActions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.imgCompressApp__lang { position: relative; }

.imgCompressApp__lang summary {
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  transition: border-color .18s, background .18s;
}
.imgCompressApp__lang summary:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-pale);
}

.imgCompressApp__langMenu {
  position: absolute;
  right: 0;
  top: 40px;
  min-width: 76px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  z-index: 20;
}
.imgCompressApp__langMenu a {
  display: block;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.04em;
  transition: background .15s, color .15s;
}
.imgCompressApp__langMenu a:hover {
  background: var(--brand-pale);
  color: var(--brand);
}

/* ─── Step indicator ──────────────────────── */
.stepBar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
}

.stepBar__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  height: 52px;
}

.stepBar__item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  transition: color .2s;
  white-space: nowrap;
}
.stepBar__item.is-active { color: var(--brand); }
.stepBar__item.is-done   { color: var(--success); }

.stepBar__num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: background .2s, color .2s, border-color .2s;
}
.stepBar__item.is-active .stepBar__num {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.stepBar__item.is-done .stepBar__num {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.stepBar__sep {
  flex: 1;
  height: 2px;
  background: var(--line);
  margin: 0 12px;
  border-radius: 2px;
  min-width: 24px;
  max-width: 100px;
}

/* ─── Wizard steps ────────────────────────── */
.wizardStep { display: none; }
.wizardStep.is-active { display: block; }

/* ─── STEP 1: Upload ──────────────────────── */
.imgCompressHero {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 48px 24px 44px;
  text-align: center;
}
.imgCompressHero__inner {
  max-width: 680px;
  margin: 0 auto;
}
.imgCompressHero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 3.2vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text);
}
.imgCompressHero p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.97rem;
  font-weight: 500;
  line-height: 1.6;
}

.imgCompressDrop {
  max-width: 620px;
  margin: 32px auto 0;
}

.dropZone {
  border: 2px dashed #c5d8f5;
  border-radius: var(--radius);
  background: var(--brand-pale);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.dropZone:hover,
.dropZone.is-over {
  border-color: var(--brand);
  background: #ddeeff;
}
.dropZone.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.dropZone__icon  { font-size: 2.8rem; display: block; margin-bottom: 12px; }
.dropZone__title { display: block; font-size: 1.05rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.dropZone__sub   { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; }

.fileInfo {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: center;
}

/* features */
.imgCompressFeatures {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 32px 24px;
}
.imgCompressFeatures__inner {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.featureItem { display: flex; align-items: flex-start; gap: 14px; }
.featureItem__icon  { font-size: 1.6rem; flex-shrink: 0; line-height: 1; }
.featureItem__title { font-size: 0.88rem; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.featureItem__desc  { font-size: 0.83rem; color: var(--muted); line-height: 1.5; margin: 0; }

/* SEO */
.imgCompressSeo {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 16px;
}
.imgCompressSeo h2 { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 12px; color: var(--text); }
.imgCompressSeo h3 { font-size: 1rem; font-weight: 700; margin: 28px 0 8px; color: var(--text); }
.imgCompressSeo p  { color: var(--muted); font-size: 0.93rem; line-height: 1.7; margin: 0 0 10px; max-width: 760px; }

.seoGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 8px; }
.seoGrid__item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 16px 18px; background: var(--surface); }
.seoGrid__item h4 { font-size: 0.88rem; font-weight: 700; margin: 0 0 6px; color: var(--text); }
.seoGrid__item p  { font-size: 0.83rem; margin: 0; }

/* FAQ */
.imgCompressFaq { max-width: 1120px; margin: 0 auto; padding: 8px 24px 48px; }
.imgCompressFaq h2 { font-size: 1.2rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 14px; color: var(--text); }
.imgCompressFaq details {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 14px 18px;
  margin-top: 8px;
  transition: box-shadow .2s;
}
.imgCompressFaq details[open] { box-shadow: var(--shadow-sm); }
.imgCompressFaq summary {
  font-size: 0.93rem; font-weight: 700; cursor: pointer; color: var(--text);
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.imgCompressFaq summary::after { content: '+'; font-size: 1.1rem; color: var(--brand); flex-shrink: 0; transition: transform .2s; }
.imgCompressFaq details[open] summary::after { transform: rotate(45deg); }
.imgCompressFaq p { margin: 10px 0 0; color: var(--muted); font-size: 0.88rem; line-height: 1.65; }

/* ─── STEP 2: Settings ────────────────────── */
.imgCompressSettings {
  max-width: 860px;
  margin: 40px auto 0;
  padding: 0 24px 48px;
}

.settingsHeader { margin-bottom: 24px; }
.settingsHeader h2 { margin: 0 0 6px; font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.settingsHeader p  { margin: 0; color: var(--muted); font-size: 0.93rem; }

.selectedFileBar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 24px;
}
.selectedFileBar__icon { font-size: 1.4rem; flex-shrink: 0; }
.selectedFileBar__info { flex: 1; min-width: 0; }
.selectedFileBar__name {
  font-weight: 700; font-size: 0.9rem; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.selectedFileBar__size { font-size: 0.8rem; color: var(--muted); margin-top: 1px; }
.selectedFileBar__change {
  font-size: 0.8rem; color: var(--brand); font-weight: 600;
  cursor: pointer; background: none; border: none; padding: 0;
  flex-shrink: 0; text-decoration: underline; text-underline-offset: 2px;
}
.selectedFileBar__change:hover { color: var(--brand-hover); }

.settingsCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
.settingsCard__head {
  padding: 16px 20px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.settingsCard__head h3 { margin: 0; font-size: 0.9rem; font-weight: 800; }
.settingsCard__head p  { margin: 3px 0 0; font-size: 0.82rem; color: var(--muted); }
.settingsCard__body { padding: 18px 20px 20px; }

.field { margin-top: 14px; }
.field:first-child { margin-top: 0; }
.field label { display: block; margin-bottom: 5px; font-size: 0.84rem; font-weight: 600; color: #374151; }
.fieldHint {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.55;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7a99' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}
input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15,121,216,.14);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--brand);
}

.rangeRow {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rangeValue {
  min-width: 52px;
  text-align: right;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--brand);
}

.sizeGrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.inlineToggle {
  display: flex; align-items: center; gap: 9px;
  cursor: pointer; transition: border-color .18s, background .18s; user-select: none;
}
.inlineToggle input[type="checkbox"] {
  width: 16px; height: 16px; margin: 0; accent-color: var(--brand); flex-shrink: 0; cursor: pointer;
}
.inlineToggle span { font-size: 0.82rem; font-weight: 500; color: #374151; line-height: 1.3; }

.inlineToggle--boxed {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.inlineToggle--boxed:hover { border-color: var(--brand); background: var(--brand-pale); }

.previewGrid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}
.previewGrid--settings {
  margin-top: 2px;
}

.previewCard {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 12px;
}
.previewCard figcaption {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 8px;
}

.imageFrame {
  min-height: 280px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  position: relative;
  padding: 12px;
}
.imageFrame--download {
  min-height: 340px;
}

#originalPreview,
#resultPreview,
#downloadPreview {
  max-width: 100%;
  max-height: 60vh;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(17, 33, 61, 0.10);
}

.previewPlaceholder {
  color: var(--muted);
  font-weight: 700;
  text-align: center;
  font-size: 0.88rem;
}

.statusBar {
  margin-top: 14px; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.84rem; font-weight: 600; background: var(--surface-2);
  color: var(--muted); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 7px; min-height: 40px;
  transition: background .2s, color .2s, border-color .2s;
}
.statusBar.is-error { background: #fff5f6; color: var(--error); border-color: #f5c0c8; }
.statusBar.is-ok    { background: #f0faf6; color: var(--success); border-color: #b3e0c9; }

.actionBar { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }

/* ─── STEP 3: Download ────────────────────── */
.imgCompressDownload {
  max-width: 760px;
  margin: 60px auto 0;
  padding: 0 24px 60px;
  text-align: center;
}

.downloadSuccess__icon  { font-size: 3.5rem; display: block; margin-bottom: 16px; }
.downloadSuccess__title { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; margin: 0 0 8px; color: var(--text); }
.downloadSuccess__sub   { font-size: 0.95rem; color: var(--muted); margin: 0 0 32px; }

.downloadCard {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
  text-align: left;
}
.downloadCard__row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; font-size: 0.88rem; border-bottom: 1px solid var(--line);
}
.downloadCard__row:last-child { border-bottom: none; }
.downloadCard__row:nth-child(even) { background: var(--surface-2); }
.downloadCard__label { color: var(--muted); font-size: 0.82rem; font-weight: 500; }
.downloadCard__value { font-weight: 700; color: var(--text); font-size: 0.88rem; text-align: right; max-width: 65%; word-break: break-all; }

.downloadPreviewWrap {
  margin-bottom: 20px;
}

.previewCard--download {
  text-align: left;
}

.downloadActions { display: flex; flex-direction: column; gap: 8px; }

.newFileLink {
  display: inline-block; margin-top: 20px; font-size: 0.85rem;
  color: var(--brand); font-weight: 600; cursor: pointer;
  background: none; border: none;
  text-decoration: underline; text-underline-offset: 2px;
}
.newFileLink:hover { color: var(--brand-hover); }

/* ─── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 18px; background: var(--surface); color: var(--text);
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .1s;
  width: 100%; text-decoration: none; white-space: nowrap;
}
.btn:focus-visible { outline: 3px solid rgba(15,121,216,.3); outline-offset: 2px; }
.btn:disabled      { opacity: 0.42; cursor: not-allowed; pointer-events: none; }

.btn--primary {
  background: var(--brand); color: #fff;
  border-color: rgba(10,55,130,.2);
  box-shadow: 0 2px 8px rgba(15,121,216,.22);
}
.btn--primary:hover:not(:disabled) { background: var(--brand-hover); box-shadow: 0 4px 14px rgba(15,121,216,.30); }
.btn--primary:active:not(:disabled) { transform: scale(0.98); }

.btn--ghost { background: var(--surface-2); border-color: var(--line); color: var(--muted); }
.btn--ghost:hover:not(:disabled) { background: var(--line); color: var(--text); }

.btn--sm { width: auto; min-height: 38px; padding: 7px 14px; font-size: 0.85rem; }

.small { font-size: 0.82rem; font-weight: 500; color: var(--muted); }

/* ─── Responsive ──────────────────────────── */
@media (max-width: 860px) {
  .imgCompressFeatures__inner { grid-template-columns: 1fr 1fr; gap: 20px; }
  .seoGrid { grid-template-columns: 1fr; }
  .previewGrid { grid-template-columns: 1fr; }
  .sizeGrid { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .imgCompressApp__topInner { padding: 0 16px; }
  .imgCompressHero { padding: 32px 16px 28px; }
  .dropZone { padding: 30px 16px; }
  .imgCompressSettings { padding: 0 16px 40px; margin-top: 24px; }
  .settingsCard__head, .settingsCard__body { padding-left: 16px; padding-right: 16px; }
  .imgCompressDownload { margin-top: 32px; padding: 0 16px 40px; }
  .imgCompressFeatures { padding: 24px 16px; }
  .imgCompressFeatures__inner { grid-template-columns: 1fr; gap: 18px; }
  .imgCompressSeo, .imgCompressFaq { padding-left: 16px; padding-right: 16px; }
  .stepBar__label { display: none; }
  .stepBar__sep { max-width: 40px; }
  .imageFrame { min-height: 220px; }
}