/* MetaClean — light-first tokens, redefined for dark below. Every colour is
   defined on bare :root so no value exists only inside a media query. */
:root {
  --bg: #f6f7f6;
  --surface: #ffffff;
  --surface-sunk: #f0f2f0;
  --border: #dfe3df;
  --border-strong: #c6ccc6;
  --text: #16211a;
  --text-dim: #5c6b60;
  --text-faint: #8a978d;
  --accent: #03a24a;
  --accent-hover: #028a3f;
  --accent-soft: rgba(3, 162, 74, 0.1);
  --warn: #b4690e;
  --warn-soft: rgba(180, 105, 14, 0.12);
  --good: #03a24a;
  --danger: #c0392b;
  --shadow: 0 1px 2px rgba(20, 32, 24, 0.06), 0 8px 24px rgba(20, 32, 24, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1310;
    --surface: #161d18;
    --surface-sunk: #111713;
    --border: #263029;
    --border-strong: #38443b;
    --text: #e8efe9;
    --text-dim: #9fb0a4;
    --text-faint: #6f8076;
    --accent: #34c46f;
    --accent-hover: #4bd482;
    --accent-soft: rgba(52, 196, 111, 0.14);
    --warn: #e0a44a;
    --warn-soft: rgba(224, 164, 74, 0.15);
    --good: #34c46f;
    --danger: #e5776a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  --bg: #0e1310;
  --surface: #161d18;
  --surface-sunk: #111713;
  --border: #263029;
  --border-strong: #38443b;
  --text: #e8efe9;
  --text-dim: #9fb0a4;
  --text-faint: #6f8076;
  --accent: #34c46f;
  --accent-hover: #4bd482;
  --accent-soft: rgba(52, 196, 111, 0.14);
  --warn: #e0a44a;
  --warn-soft: rgba(224, 164, 74, 0.15);
  --good: #34c46f;
  --danger: #e5776a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- top bar ---------- */

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  letter-spacing: -0.01em;
}

.brand__mark {
  width: 24px;
  height: 24px;
  color: var(--accent);
  flex: none;
}

.brand__name {
  font-size: 1.05rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--accent-soft);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}

.badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

/* ---------- intro ---------- */

.intro {
  padding: 44px 0 28px;
  max-width: 620px;
}

.intro h1 {
  margin: 0 0 12px;
  font-size: clamp(1.6rem, 4vw, 2.1rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.intro p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.97rem;
}

abbr {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
}

/* ---------- dropzone ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 48px 24px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.dropzone:hover,
.dropzone:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.005);
}

.dropzone__icon {
  width: 34px;
  height: 34px;
  color: var(--accent);
  margin-bottom: 4px;
}

.dropzone__title {
  font-weight: 600;
  font-size: 1.02rem;
}

.dropzone__hint {
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* ---------- options ---------- */

.options {
  margin-top: 20px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.options__row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  flex: 1 1 380px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 170px;
}

.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-dim);
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.field__note {
  font-weight: 400;
  color: var(--text-faint);
  font-size: 0.75rem;
}

.field--slider {
  flex: 1 1 200px;
}

select,
input[type="range"] {
  font: inherit;
  font-size: 0.9rem;
  accent-color: var(--accent);
}

select {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-sunk);
  color: var(--text);
}

select:focus-visible,
input[type="range"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

output {
  font-family: var(--mono);
  color: var(--accent);
}

.options__actions {
  display: flex;
  gap: 10px;
  flex: none;
}

.btn {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  white-space: nowrap;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-dim);
}

.btn--ghost:hover {
  border-color: var(--danger);
  color: var(--danger);
}

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

.btn--sm {
  font-size: 0.8rem;
  padding: 6px 12px;
}

/* ---------- summary ---------- */

.summary {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.stat {
  flex: 1 1 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat__value {
  font-size: 1.5rem;
  font-weight: 680;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat__value--warn {
  color: var(--warn);
}
.stat__value--good {
  color: var(--good);
}

.stat__label {
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ---------- results ---------- */

.results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.card {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 16px;
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.card__thumb {
  width: 76px;
  height: 76px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--surface-sunk);
  border: 1px solid var(--border);
}

.card__body {
  min-width: 0;
}

.card__name {
  font-weight: 620;
  font-size: 0.93rem;
  word-break: break-all;
  margin-bottom: 2px;
}

.card__meta {
  font-size: 0.8rem;
  color: var(--text-faint);
  font-family: var(--mono);
  margin-bottom: 8px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-sunk);
  color: var(--text-dim);
  border: 1px solid var(--border);
  font-family: var(--mono);
}

.chip--flag {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: transparent;
}

.chip--clean {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: transparent;
}

.card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: none;
}

.card__size {
  font-size: 0.78rem;
  font-family: var(--mono);
  color: var(--text-faint);
  text-align: right;
  white-space: nowrap;
}

.card__size b {
  color: var(--good);
  font-weight: 600;
}

.card__status {
  font-size: 0.78rem;
  color: var(--text-faint);
}

.card--error {
  border-color: var(--danger);
}

.card__error {
  color: var(--danger);
  font-size: 0.82rem;
}

/* Details block listing the raw keys we found. */
.details {
  margin-top: 9px;
}

.details summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-dim);
  user-select: none;
}

.details summary:hover {
  color: var(--accent);
}

.details__body {
  margin-top: 7px;
  padding: 9px 11px;
  background: var(--surface-sunk);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--text-dim);
  max-height: 190px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--border);
}

/* ---------- explainer ---------- */

.explainer {
  margin: 52px 0 40px;
}

.explainer h2 {
  font-size: 1.12rem;
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.explainer__list {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 16px;
}

.explainer__list > div {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 15px;
}

.explainer__list dt {
  font-weight: 640;
  font-size: 0.89rem;
  margin-bottom: 5px;
}

.explainer__list dd {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-dim);
}

code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-sunk);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.callout {
  margin-top: 18px;
  padding: 14px 16px;
  border-left: 3px solid var(--warn);
  background: var(--warn-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 0.87rem;
  color: var(--text-dim);
}

.callout strong {
  color: var(--text);
}

/* ---------- footer ---------- */

.footer {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  color: var(--text-faint);
  font-size: 0.82rem;
  background: var(--surface);
}

@media (max-width: 560px) {
  .card {
    grid-template-columns: 58px 1fr;
  }
  .card__thumb {
    width: 58px;
    height: 58px;
  }
  .card__side {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
  }
  .options__actions {
    width: 100%;
  }
  .options__actions .btn {
    flex: 1;
  }
}
