:root {
  --ink: #192018;
  --muted: #646b63;
  --paper: #f7f6f1;
  --panel: #ffffff;
  --soft: #f0f3ef;
  --line: #d8ded6;
  --line-strong: #b8c2b7;
  --blue: #315fe8;
  --blue-dark: #2448b6;
  --blue-soft: #eef2ff;
  --green: #1f7449;
  --green-soft: #edf8f1;
  --amber: #79550f;
  --amber-soft: #fff6df;
  --red: #a8342d;
  --red-soft: #fff2f0;
  --shadow: 0 18px 52px rgba(25, 32, 24, .09);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}
button, input, select { font: inherit; }
button, a { touch-action: manipulation; }
a { color: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.nav { width: min(1180px, calc(100% - 40px)); }
.nav-links { margin-left: auto; }

.intro { padding: 48px 0 28px; text-align: center; }
.eyebrow, .panel-kicker, .section-kicker {
  margin: 0;
  color: var(--blue-dark);
  font-size: .75rem;
  font-weight: 850;
  letter-spacing: .13em;
  text-transform: uppercase;
}
h1 {
  margin: 9px 0 8px;
  font-size: clamp(2.45rem, 6vw, 4.7rem);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: 1.02;
}
.intro-copy {
  max-width: 760px;
  margin: 0 auto;
  color: #4e5750;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
}

.tool-shell { margin-bottom: 84px; }
.dropzone {
  display: grid;
  min-height: 340px;
  padding: 42px 24px;
  place-items: center;
  align-content: center;
  border: 2px dashed #9ba69a;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 10px 34px rgba(25, 32, 24, .05);
  cursor: pointer;
  text-align: center;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.dropzone:hover, .dropzone.drag {
  border-color: var(--blue);
  background: #fafbff;
  box-shadow: 0 14px 38px rgba(49, 95, 232, .1);
}
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload-icon { margin-bottom: 15px; color: var(--blue); }
.dropzone h2 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.05rem); letter-spacing: -.035em; }
.dropzone > p { max-width: 630px; margin: 9px auto 21px; color: var(--muted); }
.dropzone .upload-privacy { margin: 18px auto 0; color: #4d554e; font-size: .86rem; }

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 10px 17px;
  font-weight: 800;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { background: var(--blue); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--blue-dark); }
.button-secondary { border-color: var(--line-strong); background: #fff; color: var(--ink); }
.button-secondary:hover:not(:disabled) { border-color: #8c978c; background: #fafbf9; }
.button-quiet { border-color: transparent; background: transparent; color: #4d554e; }
.button:disabled { cursor: not-allowed; opacity: .48; }
.text-button {
  border: 0;
  border-bottom: 1px solid currentColor;
  padding: 1px 0;
  background: transparent;
  color: var(--blue-dark);
  font-weight: 800;
  cursor: pointer;
}
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(49, 95, 232, .34);
  outline-offset: 3px;
}

.issue-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px 22px;
  margin: 14px 0;
  border: 1px solid #e5b4ae;
  border-radius: 12px;
  padding: 15px 17px;
  background: var(--red-soft);
  color: #6f2823;
}
.issue-panel p { margin: 2px 0 0; }
.issue-panel ul { grid-column: 1 / -1; margin: 0; padding-left: 21px; }

.editor {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(330px, .7fr);
  align-items: start;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.media-panel { min-width: 0; padding: 26px; }
.settings-panel {
  min-width: 0;
  border-left: 1px solid var(--line);
  padding: 26px;
  background: #fbfcfa;
}
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 1.45rem; letter-spacing: -.025em; }
.summary { margin: 6px 0 0; color: var(--muted); font-size: .94rem; }
.compact-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.compact-actions .button { min-height: 39px; padding: 7px 11px; font-size: .88rem; }

.file-list { display: grid; gap: 11px; }
.file-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.file-card.is-error { border-color: #e5b4ae; background: #fffaf9; }
.file-card.is-stale { border-color: #dfc078; background: #fffdf7; }
.thumb-wrap {
  position: relative;
  width: 88px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: repeating-conic-gradient(#edf0ed 0 25%, #fff 0 50%) 50% / 14px 14px;
}
.thumb { width: 100%; height: 100%; object-fit: contain; display: block; }
.file-main { min-width: 0; }
.file-name { overflow: hidden; color: #252b25; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.file-meta, .file-result { display: flex; flex-wrap: wrap; gap: 3px 12px; margin-top: 3px; color: var(--muted); font-size: .84rem; }
.file-result { color: #3d453e; }
.result-good { color: var(--green); font-weight: 800; }
.result-neutral { color: var(--amber); font-weight: 800; }
.status-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 7px; }
.status-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 8px; background: var(--soft); color: #4d554e; font-size: .76rem; font-weight: 850; }
.status-badge.done { background: var(--green-soft); color: var(--green); }
.status-badge.working { background: var(--blue-soft); color: var(--blue-dark); }
.status-badge.error { background: var(--red-soft); color: var(--red); }
.status-badge.stale { background: var(--amber-soft); color: var(--amber); }
.status-copy { color: var(--muted); font-size: .79rem; }
.file-actions { display: flex; align-items: center; gap: 6px; }
.row-button {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 7px 10px;
  background: #fff;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}
.row-button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue-dark); }
.row-button.remove { width: 38px; padding-inline: 0; color: #6c716c; }
.row-button:disabled { cursor: not-allowed; opacity: .45; }

.preset-group { min-width: 0; margin: 0; border: 0; padding: 0; }
.preset-group legend { margin-bottom: 9px; padding: 0; font-size: .9rem; font-weight: 850; }
.preset-list { display: grid; gap: 7px; }
.preset {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.preset:hover:not(:disabled) { border-color: #96a5d5; }
.preset.active { border-color: var(--blue); background: var(--blue-soft); box-shadow: inset 3px 0 0 var(--blue); }
.preset strong { font-size: .94rem; }
.preset span { color: var(--muted); font-size: .8rem; }

.advanced-settings { margin-top: 17px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.advanced-settings summary { padding: 13px 1px; font-weight: 850; cursor: pointer; }
.advanced-body { display: grid; gap: 17px; padding: 3px 0 18px; }
.field label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: .88rem; font-weight: 800; }
.field select { width: 100%; min-height: 43px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--ink); }
.field input[type="range"] { width: 100%; accent-color: var(--blue); }
.field-help { margin: 5px 0 0; color: var(--muted); font-size: .78rem; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input { width: 52px; height: 39px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 3px; background: #fff; }
.color-field output { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .82rem; }
.notice { margin: 15px 0 0; border-radius: 9px; padding: 10px 11px; background: var(--amber-soft); color: #624710; font-size: .82rem; }
.notice:empty { display: none; }
.progress-wrap { margin-top: 16px; }
.progress-wrap div { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: .8rem; }
.progress-wrap progress { width: 100%; height: 9px; accent-color: var(--blue); }
.primary-actions { display: grid; gap: 8px; margin-top: 18px; }
.primary-actions .button { width: 100%; }
.action-status { min-height: 20px; margin: 9px 0 0; color: var(--muted); font-size: .79rem; text-align: center; }
.local-note { margin: 17px 0 0; border-top: 1px solid var(--line); padding-top: 15px; color: var(--muted); font-size: .79rem; }
.local-note strong { color: #394039; }

.guide-section { padding: 4px 0 76px; }
.guide-section > h2, .faq > h2 { margin: 5px 0 26px; font-size: clamp(2rem, 4vw, 3.2rem); letter-spacing: -.045em; line-height: 1.05; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.steps article { border: 1px solid var(--line); border-radius: 13px; padding: 22px; background: var(--panel); }
.steps article > span { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark); font-size: .84rem; font-weight: 900; }
.steps h3 { margin: 15px 0 5px; font-size: 1.08rem; }
.steps p { margin: 0; color: var(--muted); }

.learn-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding-bottom: 76px; }
.learn-grid article { border: 1px solid var(--line); border-radius: 14px; padding: 25px; background: var(--panel); }
.learn-grid h2 { margin: 5px 0 9px; font-size: 1.45rem; letter-spacing: -.025em; }
.learn-grid p:last-child { margin: 0; color: var(--muted); }
.learn-grid a { color: var(--blue-dark); font-weight: 800; }
.faq { padding-bottom: 90px; }
.faq-list { max-width: 900px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { display: flex; justify-content: space-between; gap: 20px; padding: 17px 3px; font-weight: 850; cursor: pointer; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--blue-dark); font-size: 1.2rem; }
.faq details[open] summary::after { content: "−"; }
.faq details p { max-width: 780px; margin: -3px 3px 18px; color: var(--muted); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: min(380px, calc(100% - 44px)); border-radius: 10px; padding: 12px 15px; background: var(--ink); color: #fff; box-shadow: 0 12px 32px rgba(0,0,0,.18); font-weight: 750; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .settings-panel { border-top: 1px solid var(--line); border-left: 0; }
  .steps { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .shell, .nav { width: min(100% - 24px, 1180px); }
  .nav-links a:not(.pill) { display: none; }
  .intro { padding: 34px 0 22px; }
  h1 { font-size: clamp(2.25rem, 12vw, 3.15rem); }
  .dropzone { min-height: 310px; padding: 33px 17px; }
  .editor { margin-inline: -1px; border-radius: 14px; }
  .media-panel, .settings-panel { padding: 18px 14px; }
  .panel-heading { display: grid; }
  .compact-actions { justify-content: flex-start; }
  .file-card { grid-template-columns: 70px minmax(0, 1fr); gap: 10px; }
  .thumb-wrap { width: 70px; height: 62px; }
  .file-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .row-button:not(.remove) { flex: 1; }
  .learn-grid { grid-template-columns: 1fr; }
  .guide-section, .learn-grid, .faq { padding-bottom: 62px; }
  .toast { right: 12px; bottom: 12px; max-width: calc(100% - 24px); }
}

@media (max-width: 360px) {
  .shell, .nav { width: min(100% - 18px, 1180px); }
  .button { padding-inline: 13px; }
  .compact-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .file-card { grid-template-columns: 58px minmax(0, 1fr); }
  .thumb-wrap { width: 58px; height: 54px; }
  .file-meta, .file-result { display: grid; gap: 1px; }
  .issue-panel { grid-template-columns: 1fr; }
  .issue-panel ul { grid-column: 1; }
}

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