* { box-sizing: border-box; }

:root {
  --primary: #3330F9;
  --primary-dark: #0A06DF;
  --primary-bg: #E7E6FE; 
  --primary-subtle: #C3C2FD; 
  --text: #202124;
  --muted: #68707a;
  --border: #dedfe3;
  --background: #f7f7f8;
  --background-canvas: #fbfbfc; 
  --soft: #f0f0f2;
  --success: #18794e;
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }

.float-backhome {
  .back-link {
    padding: 0.5rem;
    border: 1px solid var(--border);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    vertical-align: middle;
    gap: 0.5rem;
    color: var(--primary);
    border-radius: 0.5rem;
    margin-top: 1rem;
    font-size: 0.875rem;
    line-height: 1;
    span {
      font-size: 1rem;
    }
    &:hover {
      background-color: var(--primary-bg);
    }
  }
}

@media (min-width: 990px) {
  .float-backhome {
    position: fixed;
    top: 1rem;
  }
}

.site-header {
  text-align: center;
  padding: 34px 20px 28px;
}

.site-header h1 {
  margin: 0 0 7px;
  font-size: clamp(29px, 4vw, 38px);
  line-height: 1.2;
}

.site-header p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.container {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto 52px;
}

.tool-card {
  background: #fff;
  border-radius: 9px;
  padding: 24px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .04);
}

.tool-intro { margin-bottom: 20px; }
.tool-intro h2 { margin: 0 0 5px; font-size: 21px; }
.tool-intro p { margin: 0; color: var(--muted); }

.drop-zone {
  min-height: 225px;
  border: 2px dashed #cfd1d7;
  border-radius: 10px;
  background: #fbfbfc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}

.drop-zone:hover,
.drop-zone:focus-visible,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: #f7f7ff;
  outline: none;
}

.drop-zone.drag-over { transform: scale(1.005); }

.upload-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 3px;
  border-radius: 50%;
  background: #ececff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 27px;
  font-weight: 700;
}

.drop-zone strong { font-size: 18px; margin-bottom: 3px; }
.drop-zone small { color: var(--muted); margin-top: 8px; }
.drop-zone span { color: var(--muted); }

.choose-btn {
  margin-top: 1rem;
}

.settings {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border:1px solid var(--border);
  border-radius: 0.5rem;
  background:#fff;
  margin-bottom: 1.5rem;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px 20px;
}

.field { min-width: 0; }

.field label {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-weight: 600;
}

.field label span,
.range-labels,
.field small { color: var(--muted); font-weight: 400; }

input[type="range"] { width: 100%; accent-color: var(--primary); }

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
}

select, input[type="number"] {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

.privacy-note {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 11px;
  border-radius: 6px;
  background: #fff;
}

.privacy-note > span {
  width: 25px;
  height: 25px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e8f5ef;
  color: var(--success);
  font-weight: 700;
}

.privacy-note strong,
.privacy-note small { display: block; }
.privacy-note strong { font-size: 14px; }
.privacy-note small { font-size: 12px; line-height: 1.35; }

.actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.primary-button,
.secondary-button {
  border: 0;
  border-radius: 7px;
  min-height: 43px;
  padding: 9px 18px;
  font-weight: 700;
  cursor: pointer;
}

.primary-button { background: var(--primary); color: #fff; }
.primary-button:hover { background: var(--primary-dark); }
.primary-button:disabled { opacity: .65; cursor: wait; }

.secondary-button {
  color:var(--text);
  background:var(--background-canvas);
  border: 1px solid var(--border);
}

.secondary-button:hover  {
  background: var(--soft);
}

.zip-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--primary);
  border-color: var(--primary);
}

.zip-button:hover { background: #f7f7ff; }
.zip-button:disabled { opacity: .65; cursor: wait; }
.zip-button[hidden] { display: none; }
.zip-button .material-symbols-outlined { font-size: 20px; }

.primary-button:focus-visible,
.secondary-button:focus-visible,
.choose-button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(91, 91, 240, .25);
  outline-offset: 2px;
}

.status {
  /* margin-top: 15px; */
  color: var(--muted);
}

.results { display: grid; gap: 12px; }

.progress { margin: 18px 0 14px; }

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 14px;
}

.progress-header strong { color: var(--text); font-size: 15px; }

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
  transition: width .35s ease;
}

.progress.is-done .progress-fill { background: var(--success); }
.progress.is-done .progress-header span { color: var(--success); font-weight: 700; }

.result-card { transition: opacity .2s; }
.result-card.is-waiting { opacity: .6; }
.result-card.is-compressing { border-color: #c9c9f7; }

.state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.state-badge.waiting { background: var(--soft); color: var(--muted); }
.state-badge.compressing { background: #ececff; color: var(--primary); }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid #c9c9f7;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
  .progress-fill { transition: none; }
}

.result-card {
  display: grid;
  grid-template-columns: 82px 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.thumbnail {
  width: 82px;
  height: 68px;
  border-radius: 5px;
  object-fit: cover;
  background: var(--soft);
}

.result-name {
  margin: 0 0 3px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.result-meta { margin: 0; color: var(--muted); font-size: 13px; }
.result-meta strong { color: var(--text); }
.saving { color: var(--success); font-weight: 700; }

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 700;
  white-space: nowrap;
}

.download-button:hover { background: var(--primary-dark); }

.result-info { min-width: 0; }
.result-info .result-meta + .result-meta { margin-top: 2px; }

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.delete-button {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}

.delete-button:hover {
  color: #c5221f;
  border-color: #f1b8b5;
  background: #fdf1f0;
}

.delete-button:focus-visible {
  outline: 3px solid rgba(91, 91, 240, .25);
  outline-offset: 2px;
}

.delete-button .material-symbols-outlined { font-size: 21px; }

.content-section { margin-top: 32px; padding: 0 4px; }
.content-section h2 { margin: 0 0 10px; font-size: 25px; }
.content-section h3 { margin: 26px 0 7px; font-size: 19px; }
.content-section p, .content-section li { color: #454a51; }
.content-section ol { padding-left: 23px; }

.site-footer {
  margin-top: auto;
  padding: 18px;
  text-align: center;
  background: #ededee;
  color: #30343a;
}

.site-footer p { margin: 0; }

@media (max-width: 700px) {
  .site-header { padding-top: 26px; }
  .tool-card { padding: 17px; }
  .settings-grid { grid-template-columns: 1fr; }
  .result-card { grid-template-columns: 64px 1fr; }
  .thumbnail { width: 64px; height: 56px; }
  .card-actions { grid-column: 1 / -1; }
  .download-button,
  .state-badge { flex: 1; }
  .actions { flex-direction: column; }
}
