:root {
  --bg: #f2f1ed;
  --surface: #ffffff;
  --surface-muted: #f7f7f4;
  --text: #171717;
  --muted: #70706b;
  --border: #d9d8d2;
  --accent: #171717;
  --success: #2f7a51;
  --danger-bg: #fff4f0;
  --danger: #983d2f;
  --radius: 20px;
  --shadow: 0 20px 60px rgba(20,20,20,.06);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 72px 0 80px; }
.hero { display: flex; justify-content: space-between; gap: 40px; align-items: flex-end; margin-bottom: 36px; }
.hero h1 { margin: 6px 0 16px; max-width: 760px; font-size: clamp(40px, 6vw, 76px); line-height: .96; letter-spacing: -.055em; font-weight: 650; }
.intro { margin: 0; max-width: 620px; color: var(--muted); font-size: 18px; line-height: 1.55; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 750; letter-spacing: .12em; }
.privacy-badge { flex: 0 0 auto; display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); padding-bottom: 8px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(47,122,81,.12); }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.upload-panel { padding: 14px; }
.drop-zone { min-height: 300px; display: grid; place-items: center; align-content: center; text-align: center; border: 1.5px dashed #b9b8b2; border-radius: 14px; padding: 36px; transition: background .18s ease, border-color .18s ease, transform .18s ease; outline: none; }
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.is-dragging { border-color: var(--text); background: var(--surface-muted); }
.drop-zone.is-dragging { transform: scale(.997); }
.drop-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: var(--text); color: white; font-size: 24px; margin-bottom: 22px; }
.drop-zone h2 { margin: 0 0 8px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.03em; }
.drop-zone p { margin: 0 0 24px; color: var(--muted); }
.button-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.button { border: 0; border-radius: 999px; min-height: 46px; padding: 0 20px; font-weight: 700; transition: transform .16s ease, opacity .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:focus-visible, .text-button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(23,23,23,.2); outline-offset: 3px; }
.button-primary { background: var(--text); color: white; }
.button-secondary { background: #ecebe6; color: var(--text); }
.text-button { background: none; border: 0; padding: 8px 0; text-decoration: underline; text-underline-offset: 3px; color: var(--muted); }
.selection-summary { display: flex; align-items: center; gap: 34px; padding: 18px 8px 4px; }
.selection-summary > div { display: grid; gap: 2px; }
.selection-summary .text-button { margin-left: auto; }
.metric-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

.workspace { display: grid; grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr); gap: 18px; margin-top: 18px; align-items: start; }
.settings-panel, .progress-panel { padding: 28px; }
.section-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 28px; }
.section-heading h2 { margin: 5px 0 0; font-size: 28px; letter-spacing: -.03em; }
.settings-grid { display: grid; gap: 22px; }
.field { display: grid; gap: 8px; }
.field > span:first-child { font-weight: 700; }
.field small, .stat-card small { color: var(--muted); }
input[type="number"], select { width: 100%; border: 1px solid var(--border); background: var(--surface-muted); border-radius: 12px; min-height: 48px; padding: 0 14px; color: var(--text); }
.input-suffix { position: relative; }
.input-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-suffix input { padding-right: 48px; }
.range-row { display: grid; grid-template-columns: 1fr 52px; gap: 14px; align-items: center; }
input[type="range"] { width: 100%; accent-color: var(--text); }
output { display: grid; place-items: center; min-height: 42px; border-radius: 10px; background: var(--surface-muted); font-weight: 800; }
.button-action, .button-download { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-top: 30px; background: var(--text); color: white; border-radius: 14px; min-height: 54px; padding: 0 18px; }
.button-action:disabled { cursor: wait; opacity: .55; transform: none; }

.progress-track { height: 10px; background: #ecebe6; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--text); transition: width .15s ease; }
.progress-meta { display: flex; justify-content: space-between; gap: 20px; margin-top: 10px; color: var(--muted); font-size: 13px; }
#current-file { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 26px; }
.stat-card { background: var(--surface-muted); padding: 16px; border-radius: 14px; min-width: 0; }
.stat-card strong { display: block; margin-top: 6px; font-size: 22px; letter-spacing: -.03em; overflow-wrap: anywhere; }
.stat-highlight { background: #eaf3ed; }
.error-box { margin-top: 20px; padding: 16px; border-radius: 14px; color: var(--danger); background: var(--danger-bg); font-size: 14px; }
.error-box ul { margin: 10px 0 0; padding-left: 20px; }

@media (max-width: 800px) {
  .app-shell { width: min(100% - 20px, 680px); padding: 38px 0 48px; }
  .hero { display: grid; gap: 22px; align-items: start; }
  .hero h1 { font-size: clamp(42px, 13vw, 62px); }
  .privacy-badge { padding: 0; }
  .drop-zone { min-height: 270px; padding: 28px 18px; }
  .workspace { grid-template-columns: 1fr; }
  .selection-summary { gap: 18px; flex-wrap: wrap; }
  .selection-summary .text-button { margin-left: 0; }
}

@media (max-width: 520px) {
  .settings-panel, .progress-panel { padding: 22px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-highlight { grid-column: 1 / -1; }
  .progress-meta { display: grid; }
  #current-file { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
