:root {
  --ink: #21313c;
  --muted: #647886;
  --line: #d9e3e7;
  --paper: #ffffff;
  --wash: #f6faf8;
  --soft-green: #dfeee8;
  --green: #38b277;
  --green-dark: #17835a;
  --amber: #f2b85a;
  --blue: #3b7ea1;
  --danger: #b94b4b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #eaf5f1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 0%, rgba(56, 178, 119, 0.14), transparent 27rem),
    radial-gradient(circle at 92% 12%, rgba(59, 126, 161, 0.12), transparent 25rem),
    linear-gradient(180deg, #f8fcfa 0%, #eff7f3 42rem, #f8fbfa 100%),
    var(--wash);
}

button,
input,
select {
  font: inherit;
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #fff;
  background: var(--green-dark);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}

.usage-widget {
  display: grid;
  gap: 6px;
  min-width: 190px;
  padding: 10px 12px;
  border: 1px solid rgba(48, 99, 87, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.usage-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.usage-copy strong {
  color: var(--green-dark);
}

.usage-bar {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #dfece8;
}

.usage-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green-dark);
  transition: width 180ms ease;
}

.usage-bar span.warning {
  background: var(--amber);
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  padding: 34px 16px 44px;
}

.upload-shell {
  position: relative;
  z-index: 1;
  display: block;
  width: min(1080px, 100%);
  margin: 0 auto;
}

.dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 440px;
  padding: 38px 24px;
  border: 4px dashed #b7d6df;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 24px 60px rgba(41, 83, 75, 0.12);
  text-align: center;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.dropzone.drag-over {
  border-color: var(--green);
  background: #ffffff;
  transform: translateY(-2px);
}

.file-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 18px;
  border-radius: 50%;
  background: #e0f4ef;
  color: var(--green-dark);
}

.drop-icon svg {
  width: 52px;
  height: 52px;
  fill: currentColor;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1.04;
  letter-spacing: 0;
}

.dropzone p {
  margin-bottom: 22px;
  color: var(--muted);
  font-weight: 650;
}

.primary-action,
.secondary-action,
.download-all,
.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--green-dark);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.primary-action:hover,
.secondary-action:hover {
  background: #106e4b;
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.format-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(520px, 100%);
  margin-top: 26px;
}

.format-pill,
.segment,
.format-action {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.format-pill.active,
.segment.active {
  border-color: var(--green-dark);
  color: #fff;
  background: var(--green-dark);
}

.format-pill:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.settings {
  align-self: start;
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid rgba(48, 99, 87, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 54px rgba(41, 83, 75, 0.1);
}

.settings-row,
.range-row,
.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-label,
.range-row span,
.target-grid label {
  color: var(--muted);
  font-weight: 800;
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
}

.segment {
  border: 0;
  border-radius: 0;
}

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

select,
.target-grid input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font-weight: 700;
}

.resize-row {
  align-items: start;
  flex-direction: column;
}

.resize-row select {
  width: 100%;
}

.target-grid {
  display: grid;
  grid-template-columns: 1fr 120px;
  align-items: center;
  gap: 12px;
}

.checkbox-row {
  justify-content: flex-start;
  color: var(--ink);
  font-weight: 750;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--green-dark);
}

.results-band,
.deployment-band {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto 42px;
}

.results-header,
.deployment-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--green-dark);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: 0;
}

.summary {
  margin: 18px 0;
  padding: 14px 16px;
  border-left: 4px solid var(--green-dark);
  background: #fff;
  font-weight: 800;
}

.results {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.result-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) minmax(300px, 420px);
  align-items: start;
  gap: 16px;
  min-height: 96px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.thumb {
  width: 74px;
  height: 74px;
  border-radius: 6px;
  background: #dbe8e5 center / cover no-repeat;
}

.result-meta h3 {
  margin-bottom: 4px;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.25;
  overflow-wrap: anywhere;
  white-space: normal;
}

.result-detail {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.meter {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e9f1ef;
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.card-settings {
  margin-top: 12px;
}

.card-settings summary {
  width: fit-content;
  color: var(--green-dark);
  font-weight: 900;
  cursor: pointer;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfa;
}

.settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
}

.settings-grid input[type="range"],
.scale-control {
  width: 100%;
}

.scale-control > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.scale-value {
  color: var(--ink);
}

.scale-marks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.scale-marks button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--green-dark);
  background: #fff;
  font-weight: 900;
  cursor: pointer;
}

.scale-size {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

.format-action {
  min-height: 46px;
  padding: 8px;
  line-height: 1.15;
  text-align: center;
}

.format-action span {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  font-weight: 800;
}

.format-action.ready {
  border-color: var(--green-dark);
  color: #fff;
  background: var(--green-dark);
}

.format-action.loading {
  color: var(--muted);
  cursor: wait;
  background: #f1f6f4;
}

.format-action.loading .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  margin: 0 auto 3px;
  border: 2px solid #c9d9d4;
  border-top-color: var(--green-dark);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.format-action.failed {
  border-color: var(--danger);
  color: var(--danger);
}

.format-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.format-action.loading:disabled {
  opacity: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.deployment-band {
  align-items: flex-start;
  padding: 30px 0 64px;
  border-top: 1px solid rgba(33, 49, 60, 0.12);
}

.deployment-list {
  display: grid;
  gap: 10px;
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 860px) {
  .site-header,
  .results-header,
  .deployment-band {
    align-items: flex-start;
    flex-direction: column;
  }

  .usage-widget {
    width: 100%;
  }

  .hero {
    min-height: 0;
    padding-top: 22px;
  }

  .result-card {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .result-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .dropzone {
    min-height: 390px;
    padding: 30px 16px;
  }

  .result-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .thumb {
    width: 64px;
    height: 64px;
  }

  .result-actions {
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: center;
    justify-items: start;
  }

  .format-action {
    width: 100%;
  }

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