:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #63707a;
  --line: #d9e0e6;
  --panel: #ffffff;
  --accent: #0f7b6c;
  --accent-strong: #085d54;
  --blue: #2563eb;
  --danger: #b42318;
  --shadow: 0 16px 50px rgba(22, 32, 38, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; color: var(--ink); background: #f7faf9; }
a { color: inherit; }
button, input, select { font: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 250, 249, 0.94);
  backdrop-filter: blur(14px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  min-height: 64px;
  margin: 0 auto;
}

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

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
}

.nav-links { display: flex; align-items: center; gap: 18px; color: var(--muted); font-size: 14px; }
.nav-links a { text-decoration: none; }
.nav-links a:hover { color: var(--accent-strong); }

.tool-shell { width: min(1180px, calc(100% - 32px)); margin: 32px auto 0; }
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: end; margin-bottom: 20px; }
.eyebrow { margin: 0 0 8px; color: var(--accent-strong); font-size: 13px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
h1 { max-width: 780px; margin: 0; font-size: 44px; line-height: 1.05; letter-spacing: 0; }
.subtitle { max-width: 720px; margin: 14px 0 0; color: var(--muted); font-size: 17px; line-height: 1.6; }

.ad-box {
  display: grid;
  min-height: 92px;
  place-items: center;
  border: 1px dashed #b8c4cc;
  border-radius: 8px;
  color: #73808a;
  background: #fff;
  font-size: 12px;
  text-transform: uppercase;
}

.tool-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 20px; align-items: start; }
.controls, .workspace, .seo-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.controls { padding: 18px; }
.control-group + .control-group { margin-top: 20px; }
.label-row { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; font-weight: 700; }
.label-row small { color: var(--muted); font-weight: 600; }

.preset-grid { display: grid; gap: 8px; }
.preset-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}
.preset-button small { color: var(--muted); }
.preset-button.is-active { border-color: var(--accent); color: var(--accent-strong); background: #eaf7f3; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.field input, .field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}
.field input[type="range"] { padding: 0; }
.checkline { display: flex; align-items: center; gap: 10px; min-height: 34px; color: var(--ink); font-size: 14px; font-weight: 650; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; }
.button { min-height: 44px; border: 1px solid transparent; border-radius: 8px; padding: 0 14px; font-weight: 800; cursor: pointer; }
.button.primary { color: #fff; background: var(--accent); }
.button.primary:hover { background: var(--accent-strong); }
.button.secondary { border-color: var(--line); color: var(--ink); background: #fff; }
.button:disabled { cursor: not-allowed; opacity: 0.5; }

.workspace { min-height: 620px; padding: 18px; }
.dropzone {
  display: grid;
  min-height: 210px;
  place-items: center;
  border: 2px dashed #a9b8c2;
  border-radius: 8px;
  background: #f4f8fa;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.dropzone.is-dragging, .dropzone:focus-visible { outline: none; border-color: var(--accent); background: #eaf7f3; }
.dropzone-inner { display: grid; gap: 8px; width: min(430px, 100%); padding: 24px; text-align: center; }
.dropzone strong { font-size: 19px; }
.dropzone span, .muted { color: var(--muted); }

.selected-list { display: grid; gap: 8px; margin: 16px 0 0; padding: 0; list-style: none; }
.selected-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}
.selected-list span, .result-name strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-list small { color: var(--muted); }
.selected-list button { border: 0; color: var(--danger); background: transparent; cursor: pointer; }

.result-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 22px 0 10px; }
.result-head h2 { margin: 0; font-size: 20px; }
.status-line { min-height: 24px; margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.results { display: grid; gap: 10px; }
.result-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) repeat(3, minmax(82px, 0.45fr)) auto;
  gap: 12px;
  align-items: center;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
.result-row.is-error { grid-template-columns: 1fr; border-color: #fecaca; color: var(--danger); background: #fff7f7; }
.result-name, .result-stat { display: grid; gap: 3px; }
.result-stat span { font-weight: 800; }
.result-stat small, .result-name small { color: var(--muted); }
.savings span { color: var(--accent-strong); }
.download-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  background: var(--blue);
  font-weight: 800;
  text-decoration: none;
}
.empty-results { display: grid; min-height: 120px; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: #fff; }
.ad-band { width: min(1180px, calc(100% - 32px)); margin: 28px auto; }
.seo-panel { width: min(1180px, calc(100% - 32px)); margin: 0 auto 42px; padding: 24px; }
.seo-panel h2 { margin: 0 0 12px; font-size: 24px; }
.seo-panel p { margin: 0; color: var(--muted); line-height: 1.7; }
.seo-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.seo-links a { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; background: #fff; text-decoration: none; }

.site-footer { border-top: 1px solid var(--line); padding: 24px 0; color: var(--muted); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; width: min(1180px, calc(100% - 32px)); margin: 0 auto; font-size: 14px; }
.footer-inner nav { display: flex; gap: 14px; }

@media (max-width: 920px) {
  .intro, .tool-grid { grid-template-columns: 1fr; }
  .intro .ad-box { min-height: 74px; }
  .result-row { grid-template-columns: minmax(0, 1fr) 1fr 1fr; }
  .result-name, .download-link { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .nav { align-items: flex-start; flex-direction: column; padding: 12px 0; }
  .nav-links { flex-wrap: wrap; gap: 10px; }
  h1 { font-size: 32px; }
  .subtitle { font-size: 15px; }
  .field-grid, .actions { grid-template-columns: 1fr; }
  .selected-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .selected-list button { grid-column: 1 / -1; justify-self: start; }
  .result-row { grid-template-columns: 1fr 1fr; }
  .result-stat { min-width: 0; }
  .footer-inner { flex-direction: column; }
}
