/* Matcha Filter Remover — Design System (design-system.md §13.1) */
:root {
  --color-primary: #5B8A5A;
  --color-primary-container: #DCEEDC;
  --color-secondary: #6B7B6E;
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-text: #1A1C1A;
  --color-text-muted: #424940;
  --color-border: #C1C9C0;
  --color-border-variant: #C1C9BD;
  --color-error: #BA1A1A;
  --color-error-container: #FFDAD6;

  --font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(26, 28, 26, 0.05);
  --shadow-md: 0 2px 8px rgba(26, 28, 26, 0.08);

  --margin-mobile: 16px;
  --margin-desktop: 32px;
  --tool-max: 720px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: var(--font-family);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--margin-mobile);
}
.container--tool {
  max-width: var(--tool-max);
}

/* focus rings (accessibility §11) */
a:focus-visible, button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ===== Typography ===== */
h1, h2, h3 { font-weight: 600; line-height: 1.2; }
.headline-lg { font-size: 32px; line-height: 40px; font-weight: 600; }
.headline-md { font-size: 24px; line-height: 32px; font-weight: 600; }
.body-md { font-size: 16px; line-height: 24px; }
.label-md { font-size: 14px; line-height: 20px; font-weight: 500; }

/* ===== TopAppBar ===== */
.topbar {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border-variant);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar__inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px var(--margin-mobile);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--spacing-md);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 16px;
  color: var(--color-text);
}
.brand:hover { text-decoration: none; }
.brand__mark {
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 15px;
}
.topbar__nav { display: flex; align-items: center; gap: var(--spacing-lg); }
.topbar__nav a { color: var(--color-text-muted); font-size: 14px; font-weight: 500; }
.topbar__nav a:hover { color: var(--color-primary); text-decoration: none; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  cursor: pointer;
  transition: transform .12s ease, opacity .12s ease, background .12s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

.btn--primary { background: var(--color-primary); color: #fff; }
.btn--primary:hover { background: #4f7c4e; }
.btn--secondary { background: transparent; color: var(--color-primary); border-color: var(--color-primary); }
.btn--secondary:hover { background: var(--color-primary-container); }
.btn--text { background: transparent; color: var(--color-primary); height: auto; padding: 8px; }
.btn--danger { background: var(--color-error); color: #fff; }
.btn--block { width: 100%; }

.btn--lg { height: 48px; }
.btn--md { height: 44px; }

/* ===== Cards ===== */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-variant);
  border-radius: var(--radius);
  padding: var(--spacing-md);
  box-shadow: none;
}
.card:hover { box-shadow: var(--shadow-sm); }

/* ===== Trust badges ===== */
.trust-row { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); }
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--color-primary-container);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}
.trust-badge svg { width: 16px; height: 16px; flex: none; }

/* ===== Dropzone ===== */
.dropzone {
  width: 100%;
  min-height: 200px;
  border: 2px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xl) var(--spacing-md);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.dropzone.is-dragover {
  border-color: var(--color-primary);
  background: color-mix(in srgb, var(--color-primary-container) 10%, #fff);
}
.dropzone.is-error { border-color: var(--color-error); }
.dropzone[aria-disabled="true"] { cursor: not-allowed; opacity: .7; }
.dropzone__icon { width: 48px; height: 48px; color: var(--color-secondary); }
.dropzone__title { font-size: 16px; font-weight: 600; color: var(--color-text); }
.dropzone__sub { font-size: 14px; color: var(--color-text-muted); }

/* ===== Error card ===== */
.error-card {
  border: 1px solid var(--color-error);
  border-radius: var(--radius);
  background: var(--color-error-container);
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--color-error);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.error-card svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }

/* ===== Progress ===== */
.progress-circular {
  width: 48px; height: 48px;
  border-radius: 50%;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.linear-track { height: 4px; background: var(--color-border); border-radius: var(--radius-full); overflow: hidden; }
.linear-fill { height: 100%; background: var(--color-primary); border-radius: var(--radius-full); transition: width .3s ease; }

/* ===== Compare slider ===== */
.compare {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--color-border-variant);
  user-select: none;
  touch-action: none;
  cursor: pointer;
}
.compare__after, .compare__before {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.compare__before { clip-path: inset(0 0 0 0); }
.compare__after { clip-path: inset(0 0 0 50%); }
.compare__handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 0;
  z-index: 3;
}
.compare__handle::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 4px;
  transform: translateX(-2px);
  background: #fff;
  box-shadow: 0 0 6px rgba(0,0,0,.3);
}
.compare__knob {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  width: 48px; height: 48px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--shadow-md);
  display: flex; align-items: center; justify-content: center;
  z-index: 4;
}
.compare__knob svg { width: 24px; height: 24px; color: var(--color-text-muted); }
.compare__label {
  position: absolute;
  top: 12px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255,255,255,.85);
  color: var(--color-text);
  z-index: 5;
}
.compare__label--before { left: 12px; }
.compare__label--after { right: 12px; }

/* ===== Segmented control ===== */
.segmented {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  padding: 4px;
  gap: 4px;
}
.segmented__opt {
  flex: 1;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  color: var(--color-text-muted);
}
.segmented__opt.is-active { background: var(--color-primary-container); color: var(--color-primary); }

/* ===== FAQ accordion ===== */
.faq { display: grid; gap: var(--spacing-sm); }
.faq__item {
  background: var(--color-surface);
  border: 1px solid var(--color-border-variant);
  border-radius: var(--radius);
  overflow: hidden;
}
.faq__q {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 16px 20px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-family: inherit;
}
.faq__q svg { flex: none; transition: transform .2s ease; }
.faq__item.is-open .faq__q svg { transform: rotate(180deg); }
.faq__a {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
  padding: 0 20px;
  color: var(--color-text-muted);
}
.faq__item.is-open .faq__a { max-height: 400px; padding-bottom: 16px; }

/* ===== Toast ===== */
.toast-wrap {
  position: fixed;
  top: 16px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100% - 32px));
}
.toast {
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
  border-radius: var(--radius);
  border-left: 4px solid var(--color-primary);
  padding: 12px 16px;
  font-size: 14px;
  animation: toast-in .2s ease;
}
.toast--error { border-left-color: var(--color-error); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== Forms ===== */
.field { display: flex; flex-direction: column; gap: var(--spacing-sm); }
.input {
  height: 48px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0 16px;
  font-size: 16px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
}
.input:focus { outline: none; border-color: var(--color-primary); border-width: 2px; box-shadow: 0 0 0 0; }
.input::placeholder { color: var(--color-text-muted); }
.form-note { font-size: 12px; line-height: 18px; color: var(--color-text-muted); }

/* ===== Legal pages ===== */
.legal { max-width: 720px; margin: 0 auto; padding: var(--spacing-2xl) var(--margin-mobile); }
.legal h1 { font-size: 32px; line-height: 40px; margin-bottom: var(--spacing-sm); }
.legal .last-updated { color: var(--color-text-muted); font-size: 14px; margin-bottom: var(--spacing-xl); }
.legal h2 { color: var(--color-primary); font-size: 22px; line-height: 30px; margin: var(--spacing-xl) 0 var(--spacing-md); }
.legal p, .legal li { color: var(--color-text); line-height: 1.6; }
.legal ul, .legal ol { padding-left: 24px; margin: var(--spacing-sm) 0; display: grid; gap: 8px; }
.legal a { text-decoration: underline; }

/* ===== Sections ===== */
.section { padding: var(--spacing-2xl) 0; }
.section--alt { background: var(--color-surface); border-top: 1px solid var(--color-border-variant); }
.section__head { text-align: center; max-width: 640px; margin: 0 auto var(--spacing-xl); }
.section__head p { color: var(--color-text-muted); margin-top: var(--spacing-sm); }

/* ===== Hero / upload ===== */
.hero { text-align: center; padding: var(--spacing-2xl) 0 var(--spacing-xl); }
.hero h1 { max-width: 600px; margin: 0 auto var(--spacing-md); }
.hero__sub { color: var(--color-text-muted); max-width: 520px; margin: 0 auto var(--spacing-lg); font-size: 18px; }
.hero .trust-row { justify-content: center; margin-top: var(--spacing-md); }

.steps { display: grid; gap: var(--spacing-lg); }
.step { text-align: left; }
.step__num {
  width: 32px; height: 32px;
  border-radius: var(--radius-full);
  background: var(--color-primary-container);
  color: var(--color-primary);
  font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: var(--spacing-sm);
}
.step h3 { font-size: 18px; margin-bottom: var(--spacing-xs); }
.step p { color: var(--color-text-muted); }

/* ===== Pricing ===== */
.pricing-grid { display: grid; gap: var(--spacing-md); }
.price-card { display: flex; flex-direction: column; gap: var(--spacing-sm); }
.price-card__title { font-size: 18px; font-weight: 600; }
.price-card__price { font-size: 32px; font-weight: 600; }
.price-card__price small { font-size: 16px; color: var(--color-text-muted); font-weight: 400; }
.price-card__tagline { color: var(--color-text-muted); font-size: 14px; }
.price-card__feats { list-style: none; color: var(--color-text); display: grid; gap: 8px; margin: var(--spacing-sm) 0; }
.price-card__feats li { display: flex; gap: 8px; align-items: flex-start; }
.price-card__feats svg { width: 18px; height: 18px; color: var(--color-primary); flex: none; margin-top: 3px; }
.price-card.is-highlighted { border-color: var(--color-primary); box-shadow: var(--shadow-md); }
.badge {
  display: inline-block;
  background: var(--color-primary-container);
  color: var(--color-primary);
  border-radius: var(--radius-full);
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.badge--plain { background: var(--color-border-variant); color: var(--color-text-muted); }
.price-card.is-current { border-style: dashed; }

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--color-border-variant); background: var(--color-surface); padding: var(--spacing-2xl) 0; }
.footer__inner { max-width: 1080px; margin: 0 auto; padding: 0 var(--margin-mobile); display: grid; gap: var(--spacing-lg); }
.footer__nav { display: flex; flex-wrap: wrap; gap: var(--spacing-lg); }
.footer__nav a { color: var(--color-text-muted); font-size: 14px; }
.footer__nav a:hover { color: var(--color-primary); text-decoration: none; }
.footer__brand { font-weight: 600; }
.footer__support { color: var(--color-text-muted); font-size: 13px; line-height: 20px; }
.footer__support a { color: var(--color-text-muted); text-decoration: underline; }
.footer__disclaimer { color: var(--color-text-muted); font-size: 12px; line-height: 18px; }

/* ===== Result / upload flow ===== */
.result-panel { display: grid; gap: var(--spacing-lg); }
.result-panel__meta { color: var(--color-text-muted); font-size: 14px; }
.result-actions { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); align-items: center; }
.quota-note { color: var(--color-text-muted); font-size: 13px; }

/* ===== 404 ===== */
.notfound { text-align: center; padding: var(--spacing-2xl) 0; }
.notfound h1 { font-size: 48px; }

/* ===== Responsive ===== */
@media (min-width: 768px) {
  .steps { grid-template-columns: repeat(3, 1fr); }
  .pricing-grid--credits { grid-template-columns: repeat(2, 1fr); }
  .faq--cols { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .pricing-grid--credits { grid-template-columns: repeat(4, 1fr); }
  .dropzone { min-height: 280px; }
}
@media (min-width: 768px) {
  .btn { height: 44px; }
  .btn--block { width: auto; }
}