:root {
  --primary: #2e7d32;
  --primary-dark: #1b5e20;
  --primary-soft: #eaf7ed;
  --text: #18201b;
  --muted: #68716b;
  --bg: #f5f8f6;
  --card: #ffffff;
  --border: #e0e8e2;
  --input: #ffffff;
  --shadow: 0 14px 40px rgba(30, 60, 40, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 0%, #e9f8ed 0, transparent 34%),
    radial-gradient(circle at 90% 8%, #eef9f1 0, transparent 30%),
    var(--bg);
  line-height: 1.6;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.compressor-page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 36px 0 70px;
}

/* =========================================================
   HERO
   ========================================================= */

.tool-hero {
  max-width: 850px;
  margin: 0 auto 34px;
  text-align: center;
}

.tool-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 13px;
  border: 1px solid #ccebd3;
  border-radius: 999px;
  background: #effaf1;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

.tool-hero h1 {
  margin: 14px 0 8px;
  font-size: clamp(34px, 6vw, 54px);
  line-height: 1.05;
  letter-spacing: -1.8px;
}

.tool-hero p {
  max-width: 760px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 16px;
}

.hero-points {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 17px;
}

.hero-points span {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: #69736d;
  font-size: 12px;
}

/* =========================================================
   TOOL CARD
   ========================================================= */

.tool-card {
  padding: 25px;
  border: 1px solid rgba(35, 70, 45, 0.08);
  border-radius: 22px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.step-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.step-number {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.step-heading h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.step-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* =========================================================
   UPLOAD
   ========================================================= */

.upload-zone {
  min-height: 255px;
  margin-top: 22px;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed #b8d7bf;
  border-radius: 17px;
  background:
    radial-gradient(circle at center, rgba(232, 248, 236, 0.9), rgba(247, 251, 248, 0.95));
  cursor: pointer;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    transform 0.2s ease;
}

.upload-zone:hover,
.upload-zone:focus {
  border-color: var(--primary);
  outline: none;
  background: #eef9f1;
}

.upload-zone.drag-over {
  border-color: var(--primary);
  background: #e4f5e8;
  transform: scale(1.005);
}

.upload-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(30, 70, 40, 0.08);
  font-size: 25px;
}

.upload-zone h3 {
  margin: 0;
  font-size: 17px;
}

.upload-zone p {
  margin: 2px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.upload-btn {
  min-height: 43px;
  padding: 9px 18px;
  border: 1px solid var(--primary);
  border-radius: 9px;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 7px 17px rgba(46, 125, 50, 0.18);
}

.upload-btn:hover {
  background: var(--primary-dark);
}

.upload-zone small {
  margin-top: 9px;
  color: #7c857f;
  font-size: 10px;
}

/* =========================================================
   DIVIDER
   ========================================================= */

.section-divider {
  height: 1px;
  margin: 25px 0;
  background: #edf1ee;
}

/* =========================================================
   PREVIEW GRID
   ========================================================= */

.preview-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 22px;
}

.preview-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fbfdfc;
}

.preview-label {
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 800;
}

.image-preview-box {
  position: relative;
  min-height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 12px;
  background:
    linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
    linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0;
}

.image-preview-box img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.preview-placeholder {
  padding: 20px;
  color: #89938c;
  text-align: center;
  font-size: 12px;
}

.file-details {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
}

.file-details span:first-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-details span:last-child {
  flex: 0 0 auto;
  font-weight: 700;
}

.image-dimensions {
  margin-top: 3px;
  color: #7c867f;
  font-size: 10px;
}

/* =========================================================
   SETTINGS
   ========================================================= */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 18px;
  margin-top: 22px;
}

.setting-group {
  min-width: 0;
  margin-bottom: 16px;
}

.setting-group label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
}

.setting-group label strong {
  color: var(--primary);
  font-size: 12px;
}

.setting-group input[type="text"],
.setting-group select {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1px solid #d5dfd8;
  border-radius: 11px;
  outline: none;
  background: var(--input);
  color: var(--text);
}

.setting-group input[type="text"]:focus,
.setting-group select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

/* RANGE */

.setting-group input[type="range"] {
  width: 100%;
  height: 7px;
  margin: 7px 0 2px;
  accent-color: var(--primary);
  cursor: pointer;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: #7c867f;
  font-size: 10px;
}

/* =========================================================
   ADVANCED SETTINGS
   ========================================================= */

.advanced-settings {
  margin-top: 5px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: #fafcfb;
}

.advanced-settings summary {
  padding: 13px 15px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}

.advanced-content {
  padding: 0 15px 14px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}

.check-row input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 1px;
  accent-color: var(--primary);
}

/* =========================================================
   ACTIONS
   ========================================================= */

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.primary-btn,
.secondary-btn,
.download-btn {
  min-height: 45px;
  padding: 10px 19px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

.primary-btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 18px rgba(46, 125, 50, 0.18);
}

.primary-btn:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.primary-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
}

.secondary-btn:hover {
  background: #f6faf7;
  border-color: #b9c8bd;
}

/* =========================================================
   PROGRESS
   ========================================================= */

.progress-section {
  margin-top: 20px;
  padding: 15px;
  border: 1px solid #d9e7dc;
  border-radius: 13px;
  background: #f8fbf9;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe8e1;
}

.progress-bar {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.2s ease;
}

/* =========================================================
   RESULT
   ========================================================= */

.result-section {
  margin-top: 25px;
  padding: 30px 20px;
  border: 1px solid #cde8d2;
  border-radius: 18px;
  background: linear-gradient(135deg, #f0faf2, #f8fcf9);
  text-align: center;
}

.success-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 25px;
  font-weight: 800;
}

.result-section h2 {
  margin: 0;
  font-size: 21px;
}

.result-section > p {
  margin: 6px auto 20px;
  color: var(--muted);
  font-size: 13px;
}

/* =========================================================
   STATS
   ========================================================= */

.compression-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}

.stat-card {
  padding: 16px 10px;
  border: 1px solid #dce9df;
  border-radius: 13px;
  background: #fff;
}

.stat-card span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}

.stat-card strong {
  color: var(--text);
  font-size: 18px;
}

.stat-card.highlight {
  border-color: #bfe2c5;
  background: #edf9ef;
}

.stat-card.highlight strong {
  color: var(--primary-dark);
}

/* =========================================================
   DOWNLOAD
   ========================================================= */

.download-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.download-btn {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(46, 125, 50, 0.18);
}

.download-btn:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  transform: translateY(-1px);
}

/* =========================================================
   HOW TO
   ========================================================= */

.how-to {
  margin-top: 45px;
}

.section-heading {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  text-align: center;
}

.section-heading > span {
  font-size: 22px;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
}

.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 18px;
}

.info-card,
.feature-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.9);
  transition: 0.2s ease;
}

.info-card:hover,
.feature-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(30, 60, 40, 0.06);
}

.info-card > span {
  color: var(--primary);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}

.info-card h3,
.feature-card h3 {
  margin: 7px 0 4px;
  font-size: 14px;
}

.info-card p,
.feature-card p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

/* =========================================================
   FEATURES
   ========================================================= */

.features-section {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.feature-card > span {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
}

/* =========================================================
   DARK MODE
   ========================================================= */

html[data-theme="dark"] body {
  --text: #edf4ef;
  --muted: #aebbb2;
  --bg: #101512;
  --card: #18201b;
  --border: #303b34;
  --input: #1c251f;

  background:
    radial-gradient(circle at 15% 0%, #172c1d 0, transparent 35%),
    radial-gradient(circle at 90% 10%, #18281d 0, transparent 30%),
    #101512;
}

html[data-theme="dark"] .tool-badge {
  background: #17331e;
  border-color: #285a31;
  color: #9fe0a7;
}

html[data-theme="dark"] .hero-points span {
  background: #18201b;
  border-color: #303b34;
  color: #aebbb2;
}

html[data-theme="dark"] .tool-card,
html[data-theme="dark"] .preview-card,
html[data-theme="dark"] .info-card,
html[data-theme="dark"] .feature-card {
  background: #18201b;
  border-color: #303b34;
}

html[data-theme="dark"] .upload-zone {
  background: #152019;
  border-color: #42634b;
}

html[data-theme="dark"] .upload-zone:hover,
html[data-theme="dark"] .upload-zone:focus {
  background: #19301f;
  border-color: #65a86e;
}

html[data-theme="dark"] .upload-icon {
  background: #202a23;
}

html[data-theme="dark"] .input-group input,
html[data-theme="dark"] .input-group textarea,
html[data-theme="dark"] .input-group select,
html[data-theme="dark"] .setting-group input[type="text"],
html[data-theme="dark"] .setting-group select,
html[data-theme="dark"] .secondary-btn {
  background: #1c251f;
  color: #edf4ef;
  border-color: #39463e;
}

html[data-theme="dark"] .advanced-settings,
html[data-theme="dark"] .progress-section {
  background: #152019;
  border-color: #344238;
}

html[data-theme="dark"] .section-divider {
  background: #2b352e;
}

html[data-theme="dark"] .progress-track {
  background: #303b34;
}

html[data-theme="dark"] .result-section {
  background: linear-gradient(135deg, #15291a, #18241b);
  border-color: #315c38;
}

html[data-theme="dark"] .stat-card {
  background: #fff;
  border-color: #dce9df;
}

html[data-theme="dark"] .stat-card span,
html[data-theme="dark"] .stat-card strong {
  color: #18201b;
}

html[data-theme="dark"] .stat-card.highlight {
  background: #edf9ef;
}

html[data-theme="dark"] .stat-card.highlight strong {
  color: #1b5e20;
}

/* =========================================================
   SENIOR MODE
   ========================================================= */

html[data-theme="senior"] body {
  font-size: 18px;
  background: #f4f4f4;
}

html[data-theme="senior"] .compressor-page {
  max-width: 1200px;
}

html[data-theme="senior"] .tool-hero h1 {
  font-size: clamp(38px, 7vw, 58px);
  letter-spacing: -1px;
}

html[data-theme="senior"] .tool-hero p {
  font-size: 17px;
}

html[data-theme="senior"] .tool-card {
  border: 2px solid #222;
}

html[data-theme="senior"] .tool-badge,
html[data-theme="senior"] .hero-points span {
  border: 2px solid #222;
  background: #fff;
  color: #111;
  font-size: 15px;
}

html[data-theme="senior"] .step-heading h2 {
  font-size: 21px;
}

html[data-theme="senior"] .step-heading p {
  font-size: 16px;
}

html[data-theme="senior"] .setting-group label {
  font-size: 17px;
}

html[data-theme="senior"] .setting-group input[type="text"],
html[data-theme="senior"] .setting-group select {
  min-height: 55px;
  border: 2px solid #222;
  font-size: 17px;
}

html[data-theme="senior"] .primary-btn,
html[data-theme="senior"] .secondary-btn,
html[data-theme="senior"] .download-btn,
html[data-theme="senior"] .upload-btn {
  min-height: 52px;
  padding: 11px 20px;
  font-size: 17px;
}

html[data-theme="senior"] .upload-zone {
  border: 2px dashed #222;
}

html[data-theme="senior"] .preview-card,
html[data-theme="senior"] .advanced-settings,
html[data-theme="senior"] .result-section {
  border: 2px solid #222;
}

html[data-theme="senior"] .info-card,
html[data-theme="senior"] .feature-card {
  border: 2px solid #222;
  background: #fff;
}

html[data-theme="senior"] .info-card h3,
html[data-theme="senior"] .feature-card h3 {
  font-size: 18px;
}

html[data-theme="senior"] .info-card p,
html[data-theme="senior"] .feature-card p {
  font-size: 14px;
}

/* =========================================================
   TABLET
   ========================================================= */

@media (max-width: 900px) {
  .features-section {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 680px) {
  .compressor-page {
    width: min(100% - 20px, 1180px);
    padding-top: 25px;
    padding-bottom: 45px;
  }

  .tool-hero {
    margin-bottom: 24px;
  }

  .tool-hero h1 {
    font-size: 35px;
    letter-spacing: -1.2px;
  }

  .tool-hero p {
    font-size: 13px;
  }

  .hero-points {
    gap: 6px;
  }

  .hero-points span {
    padding: 5px 8px;
    font-size: 10px;
  }

  .tool-card {
    padding: 15px;
    border-radius: 17px;
  }

  .upload-zone {
    min-height: 220px;
    padding: 25px 14px;
  }

  .preview-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .image-preview-box {
    min-height: 230px;
  }

  .image-preview-box img {
    max-height: 230px;
  }

  .action-row {
    flex-direction: column;
  }

  .primary-btn,
  .secondary-btn {
    width: 100%;
  }

  .compression-stats {
    grid-template-columns: 1fr;
  }

  .download-actions {
    flex-direction: column;
  }

  .download-actions .download-btn,
  .download-actions .secondary-btn {
    width: 100%;
  }

  .steps-grid {
    grid-template-columns: 1fr;
  }

  .features-section {
    grid-template-columns: 1fr;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-heading h2 {
    font-size: 20px;
  }
}

/* =========================================================
   SMALL PHONES
   ========================================================= */

@media (max-width: 380px) {
  .tool-hero h1 {
    font-size: 31px;
  }

  .tool-card {
    padding: 12px;
  }

  .upload-zone h3 {
    font-size: 15px;
  }

  .file-details {
    flex-direction: column;
    gap: 2px;
  }
}
