*  {
  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;
  --danger: #b42318;
  --white: #ffffff;
}

body  {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
  padding: 0;
  display: grid;
  min-height: 100dvh;
  grid-template-rows: auto 1fr auto;
}

header {
  text-align: center;
  padding: 36px 20px 28px;
  background: transparent;
  color: var(--text);
}

header p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.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;
  }
}

footer {
  margin-top: auto;
  padding: 18px;
  text-align: center;
  background: #ededee;
  color: #30343a;
}

.grid-container  {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,900px) minmax(0,1fr);
  gap: 24px;
  margin: 0 auto 52px;
  /* padding: 40px 24px 70px; */
}

.container  {
  min-width: 0;
}

.ads  {
  min-width: 0;
}

/* .tool  {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(32,33,36,.06);
  overflow: hidden;
} */

.site-header {
  text-align: center;
  padding: 36px 20px 28px;
}

.site-header h1 {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.2;
}

.site-header p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.tool-card {
  background: #fff;
  border-radius: 9px;
  padding: 24px;
  box-shadow: 0 1px 5px rgba(0, 0, 0, .04);
}

/* .tool-section  {
  padding: 32px 36px;
}

.tool-section + .tool-section  {
  border-top: 1px solid var(--border);
} */

.tool-card h2  {
  margin: 0 0 18px;
  font-size: 22px;
  line-height: 1.3;
}

.dropzone  {
  min-height: 250px;
  padding: 32px 24px;
  border: 2px dashed #cfd1d8;
  border-radius: 14px;
  background: #fbfbfc;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  cursor:pointer;
  transition:border-color .2s,background .2s;
}

.dropzone:hover,.dropzone:focus-visible,.dropzone.dragover  {
  border-color:var(--primary);
  background:#f7f7ff;
  outline:none;
}

.dropzone-icon  {
  width:48px;
  height:48px;
  margin-bottom:12px;
  border-radius:50%;
  background:#ededff;
  color:var(--primary);
  display:grid;
  place-items:center;
  font-size:26px;
  font-weight:bold;
}

.dropzone strong  {
  font-size:18px;
  margin-bottom:3px;
}

.dropzone span,.dropzone small  {
  color:var(--muted);
}

.dropzone-icon span {
  color: var(--primary);
}

.dropzone small  {
  margin-top:8px;
}

.choose-btn,.primary-btn,.secondary-btn,.download-btn,.remove-btn  {
  display: flex;
  align-items: center;
  border:0;
  border-radius:9px;
  font:inherit;
  font-weight:600;
  cursor:pointer;
  transition:background .2s,transform .1s;
}

.choose-btn  {
  margin-top:18px;
  padding:10px 18px;
  color:var(--white);
  background:var(--primary);
}

.choose-btn:hover,.primary-btn:hover,.download-btn:hover  {
  background:var(--primary-dark);
}

.settings  {
  margin-top: 1.5rem;
  padding: 1.5rem;
  border:1px solid var(--border);
  border-radius: 0.5rem;
  background:#fff;

  margin-bottom: 1.5rem;
}

.form-group  {
  margin-bottom:20px;
}

.form-group label  {
  display:block;
  margin-bottom:8px;
  font-weight:600;
}

.form-group small  {
  display:block;
  color:var(--muted);
  font-size:13px;
}

.optional  {
  color:var(--muted);
  font-weight:normal;
}

.size-inputs  {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.size-field  {
  min-width:0;
}

.size-subtitle  {
  font-weight:600;
  font-size:13px;
  margin-bottom:6px!important;
}

input:disabled  {
  background:var(--soft);
  color:var(--muted);
  cursor:not-allowed;
}

.size-computed  {
  background:#f4f4ff;
  border-color:#c7c7f5;
}

.aspect-note  {
  margin-top:10px;
  padding:9px 11px;
  border-radius:7px;
  background:#f4f4ff;
  color:#4b4bd6;
  font-size:12.5px!important;
}

.crop-hint  {
  margin-top:10px!important;
}

.crop-hint a  {
  color:var(--primary);
  font-weight:600;
}

select,input[type=number]  {
  width:100%;
  min-height:44px;
  padding:9px 12px;
  border:1px solid var(--border);
  border-radius:8px;
  background:var(--white);
  color:var(--text);
  font:inherit;
}

input[type=range]  {
  width:100%;
  accent-color:var(--primary);
}

select:focus-visible,input:focus-visible,button:focus-visible  {
  outline:3px solid rgba(91,91,240,.25);
  outline-offset:2px;
}

.checkbox-row  {
  display:flex;
  align-items:flex-start;
  gap:10px;
  margin:8px 0 20px;
  cursor:pointer;
}

.checkbox-row input  {
  margin-top:4px;
  accent-color:var(--primary);
}

.privacy-note  {
  padding:14px 16px;
  border-radius:9px;
  background:#f4faf7;
  color:var(--success);
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  font-size:14px;
}

.privacy-note span  {
  color:#476257;
}

.actions  {
  display:flex;
  gap:10px;
  margin-top:20px;
}

.primary-btn,.secondary-btn  {
  padding:11px 18px;
}

.primary-btn  {
  color:var(--white);
  background:var(--primary);
}

.secondary-btn  {
  color:var(--text);
  background:var(--background-canvas);
  border: 1px solid var(--border);
}

.secondary-btn:hover  {
  background: var(--soft);
}

.status  {
  /* min-height:24px; */
  /* margin-top:18px; */
  color:var(--muted);
  font-size:14px;
}

.status.error  {
  color:var(--danger);
}

.results  {
  display:grid;
  gap:14px;
  /* margin-top:4px; */
}

.download-all-btn  {
  border-radius:9px;
  font:inherit;
  font-weight:600;
  cursor:pointer;
  padding:11px 18px;
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--primary);
  transition:background .2s;
}

.download-all-btn:hover  {
  background: #f7f7ff;
}

.download-all-btn:disabled  {
  opacity:.6;
  cursor:wait;
}

.result-card  {
  padding:18px;
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--white);
}

.result-main  {
  display:flex;
  align-items:center;
  gap:16px;
}

.preview  {
  width:84px;
  height:84px;
  flex:0 0 84px;
  border-radius:8px;
  background:#f2f2f4;
  object-fit:contain;
}

.preview-loading  {
  width:84px;
  height:84px;
  flex:0 0 84px;
  border-radius:8px;
  background:linear-gradient(90deg,#f2f2f4 25%,#e9e9ec 37%,#f2f2f4 63%);
  background-size:400% 100%;
  animation:shimmer 1.4s ease infinite;
}

@keyframes shimmer  {
  0%   { background-position:100% 50%; }
  100% { background-position:0 50%; }
}

.result-info  {
  min-width:0;
  flex:1;
}

.result-name  {
  margin:0 0 5px;
  font-weight:700;
  overflow-wrap:anywhere;
}

.result-meta  {
  margin:0;
  color:var(--muted);
  font-size:13px;
}

.result-stats  {
  display:flex;
  gap:14px;
  flex-wrap:wrap;
  font-size:13px;
}

.result-stats strong  {
  color:var(--text);
}

.savings  {
  color:var(--success);
  font-weight:700;
}

.download-btn  {
  flex:0 0 auto;
  padding:9px 14px;
  color:var(--white);
  background:var(--primary);
}

.remove-btn {
  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;
}

.remove-btn:hover {
  color: #c5221f;
  border-color: #f1b8b5;
  background: #fdf1f0;
}

.remove-btn:focus-visible {
  outline: 3px solid rgba(91, 91, 240, .25);
  outline-offset: 2px;
}

.delete-button .material-symbols-outlined { font-size: 21px; }

.faq-content-section {
  margin-top: 32px;
  padding: 0 4px;
}

.faq-content-section h2 {
  margin: 0 0 10px;
  font-size: 25px;
}

.faq-content-section h3 {
  margin: 26px 0 7px;
  font-size: 19px;
}

.faq-content-section p,
.faq-content-section li {
  color: #454a51;
}

.faq-content-section h2:not(:first-child)  {
  margin-top:30px;
}

@media (max-width:1180px)  {
  .ads {
  display:none}

  .grid-container {
    grid-template-columns:minmax(0,900px);
    justify-content:center;
    padding-left:16px;
    padding-right:16px;
  }

}

@media (max-width:640px)  {
  .grid-container {
  padding:12px 10px 40px}

  .tool-header,.tool-card {
  padding:24px 18px}

  .tool-header h1 {
  font-size:28px}

  .dropzone {
  min-height:220px}

  .settings {
  padding:18px}

  .actions {
  flex-direction:column}

  .primary-btn,.secondary-btn,.download-all-btn {
  width:100%}

  .result-main {
    align-items:flex-start;
  flex-wrap:wrap}

  .download-btn,.remove-btn {
  width:100%}

}

.result-format  {
  margin:6px 0 0;
  color:var(--muted);
  font-size:13px;
  overflow-wrap:anywhere;
}

.result-format strong  {
  color:var(--text);
}

.icon-btn  {
  display:flex;
  align-items:center;
  justify-content:center;
}

.result-buttons  {
  flex:0 0 auto;
  display:flex;
  flex-direction:row;
  gap:8px;
}

@media (max-width:640px)  {
  .result-buttons {
  width:100%}

}

/* ---------------- Conversion progress ---------------- */

.progress  {
  margin-top:18px;
}

.progress-head  {
  display:flex;
  justify-content:space-between;
  gap:12px;
  margin-bottom:8px;
  color:var(--muted);
  font-size:14px;
}

.progress-percent  {
  color:var(--text);
  font-weight:700;
  font-variant-numeric:tabular-nums;
}

.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 .3s ease;
}

.progress:not([hidden]) + .results  {
  margin-top:14px;
}

.card-progress  {
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  min-height:40px;
  padding:9px 14px;
  border-radius:9px;
  background:var(--soft);
  color:var(--muted);
  font-size:14px;
  font-weight:600;
}

.card-progress.processing  {
  background:var(--primary-bg);
  color:var(--primary);
}

.spinner  {
  width:16px;
  height:16px;
  border:2px solid var(--primary-subtle);
  border-top-color:var(--primary);
  border-radius:50%;
  animation:spin .8s linear infinite;
}

@keyframes spin  {
  to { transform:rotate(360deg); }
}

.result-card  {
  transition:opacity .2s;
}

.result-card.is-queued  {
  opacity:.65;
}

.dropzone.is-disabled  {
  opacity:.6;
  cursor:not-allowed;
}

button:disabled  {
  opacity:.6;
  cursor:not-allowed;
}

@media (max-width:640px)  {
  .card-progress {
  width:100%}

}

@media (prefers-reduced-motion:reduce)  {
  .spinner {
  animation-duration:2s}

  .progress-fill {
  transition:none}

}
