:root {
  color-scheme: light;
  --ink: #17201c;
  --muted: #637069;
  --line: #dce5df;
  --paper: #f6f8f5;
  --panel: #ffffff;
  --green: #1f6f50;
  --green-dark: #174f3c;
  --mint: #dff3e9;
  --blue: #5a7cff;
  --orange: #d76a3d;
  --shadow: 0 20px 60px rgba(38, 61, 48, .1);
}

* { 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, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
button, input { font: inherit; }
button, .drop-zone { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.site-header {
  height: 68px;
  max-width: 1180px;
  margin: auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 760; letter-spacing: -.02em; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--ink); color: white; font-size: 14px; }
nav { display: flex; gap: 28px; }
nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; }
nav a:hover { color: var(--ink); }

main { overflow: hidden; }
.tool-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: calc(100vh - 92px);
  margin: 8px auto 72px;
  padding: clamp(28px, 4vw, 52px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.tool-heading { max-width: 700px; margin: 0 auto 28px; text-align: center; }
.eyebrow, .section-kicker { margin: 0 0 8px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(38px, 6vw, 64px); letter-spacing: -.055em; line-height: 1; }
.tool-heading > p:last-child { margin: 16px auto 0; color: var(--muted); font-size: clamp(15px, 2vw, 18px); }

.drop-zone {
  min-height: 260px;
  max-width: 860px;
  margin: auto;
  border: 1.5px dashed #aabbb0;
  border-radius: 22px;
  background: linear-gradient(180deg, #fbfdfb, #f4f8f5);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  outline: none;
  transition: border-color .2s, background .2s, transform .2s;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.dragging { border-color: var(--green); background: var(--mint); transform: translateY(-1px); }
.drop-zone strong { font-size: 20px; letter-spacing: -.02em; }
.drop-zone span { color: var(--muted); }
.drop-zone small { margin-top: 11px; color: #839088; }
.text-link { color: var(--green) !important; font-weight: 700; }
.upload-icon { width: 54px; height: 54px; margin-bottom: 10px; border-radius: 16px; display: grid; place-items: center; background: var(--mint); color: var(--green); }
.upload-icon svg { width: 27px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.privacy-line { margin: 16px auto 0; text-align: center; color: var(--muted); font-size: 13px; }
.privacy-line span { color: #43a77a; }
.status { min-height: 26px; margin-top: 8px; text-align: center; color: var(--orange); font-weight: 650; font-size: 14px; }

.editor { margin-top: 22px; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 4px; }
.file-summary { min-width: 0; display: flex; align-items: center; gap: 10px; }
.file-summary div { min-width: 0; display: flex; flex-direction: column; }
.file-summary strong { max-width: 48vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.file-summary span { color: var(--muted); font-size: 12px; }
.file-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #43a77a; box-shadow: 0 0 0 4px var(--mint); }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 20px; padding: 16px; background: #fbfcfb; }
.panel-head { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; font-size: 14px; }
.panel-head > div { display: flex; align-items: center; gap: 9px; }
.step-number { width: 25px; height: 25px; display: inline-grid; place-items: center; border-radius: 8px; background: var(--ink); color: white; font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.format-badge { padding: 5px 9px; border-radius: 999px; background: var(--mint); color: var(--green-dark); font-size: 11px; font-weight: 800; }
.canvas-wrap { position: relative; min-height: 320px; overflow: hidden; display: grid; place-items: center; border-radius: 13px; background-color: #e9eeea; background-image: linear-gradient(45deg,#dde4df 25%,transparent 25%),linear-gradient(-45deg,#dde4df 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#dde4df 75%),linear-gradient(-45deg,transparent 75%,#dde4df 75%); background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0; touch-action: none; }
.canvas-wrap canvas { display: block; max-width: 100%; max-height: min(54vh, 520px); width: auto; height: auto; }
#mask-canvas { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); cursor: crosshair; }
.controls { min-height: 50px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.segmented { display: flex; padding: 3px; border-radius: 10px; background: #e9eeea; }
.tool-button, .quiet-button { min-height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-weight: 700; font-size: 13px; padding: 0 13px; }
.tool-button.active { background: white; color: var(--ink); box-shadow: 0 2px 7px rgba(30, 50, 39, .1); }
.quiet-button:hover:not(:disabled) { background: #edf2ee; color: var(--ink); }
.quiet-button:disabled { opacity: .38; cursor: default; }
.brush-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.brush-control input { width: 74px; accent-color: var(--green); }
.brush-control output { min-width: 20px; color: var(--ink); }
.primary-button, .download-button { min-height: 50px; width: 100%; border: 0; border-radius: 12px; background: var(--green); color: white; font-weight: 800; transition: background .2s, transform .2s; }
.download-button { text-decoration: none; }
.primary-button:hover:not(:disabled), .download-button:hover { background: var(--green-dark); transform: translateY(-1px); }
.primary-button:disabled { background: #a8b5ae; cursor: not-allowed; }
.result-panel { display: flex; flex-direction: column; }
.result-empty { flex: 1; min-height: 420px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px dashed var(--line); border-radius: 13px; text-align: center; color: var(--muted); }
.result-empty strong { color: var(--ink); margin-bottom: 4px; }
.result-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; margin-bottom: 14px; background: var(--mint); color: var(--green); font-size: 20px; }
.result-ready { flex: 1; display: flex; flex-direction: column; gap: 12px; }
.result-wrap { min-height: 370px; }
.download-button { display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.download-button small { opacity: .76; font-weight: 650; }

.content-section { width: min(1080px, calc(100% - 40px)); margin: 0 auto 96px; }
.content-section > h2, .scope-copy h2 { max-width: 720px; margin: 0 0 34px; font-size: clamp(30px, 4vw, 48px); line-height: 1.08; letter-spacing: -.045em; }
.fact-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.fact-grid article, .scope-grid article { padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: white; }
.fact-grid article > span { color: var(--green); font-size: 12px; font-weight: 850; }
.fact-grid h3, .scope-grid h3 { margin: 18px 0 8px; letter-spacing: -.025em; }
.fact-grid p, .scope-copy > p:last-child, .scope-grid li, .faq-section details p { color: var(--muted); }
.scope-section { display: grid; grid-template-columns: .8fr 1.2fr; gap: 56px; align-items: start; }
.scope-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.scope-grid h3 { margin-top: 0; }
.scope-grid h3 span { display: inline-grid; width: 24px; height: 24px; place-items: center; border-radius: 50%; margin-right: 5px; }
.works h3 span { background: var(--mint); color: var(--green); }
.limits h3 span { background: #faeae3; color: var(--orange); }
.scope-grid ul { padding-left: 20px; margin-bottom: 0; }
.scope-grid li + li { margin-top: 9px; }
.heic-note { grid-column: 1 / -1; padding: 18px 20px; border-left: 3px solid #d49a3a; border-radius: 8px; background: #fff7e8; color: #695536; font-size: 14px; }
.faq-section { max-width: 820px; }
.faq-section details { border-top: 1px solid var(--line); }
.faq-section details:last-child { border-bottom: 1px solid var(--line); }
.faq-section summary { padding: 20px 4px; cursor: pointer; font-weight: 760; }
.faq-section details p { margin: -6px 0 22px; max-width: 720px; }
footer { min-height: 110px; padding: 0 max(24px, calc((100vw - 1080px) / 2)); display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer span:first-child { color: var(--ink); font-weight: 800; }

@media (max-width: 820px) {
  nav { display: none; }
  .tool-shell { min-height: auto; padding: 28px 18px; border-radius: 22px; }
  .drop-zone { min-height: 220px; }
  .workspace-grid, .scope-section { grid-template-columns: 1fr; }
  .fact-grid { grid-template-columns: 1fr; }
  .scope-section { gap: 28px; }
  .result-empty { min-height: 300px; }
}

@media (max-width: 520px) {
  .site-header { height: 60px; padding: 0 16px; }
  .tool-shell { width: calc(100% - 16px); margin-top: 4px; padding: 24px 12px; }
  .tool-heading { margin-bottom: 22px; }
  h1 { font-size: 42px; }
  .drop-zone { min-height: 200px; padding: 20px; }
  .editor-bar { align-items: flex-start; }
  .file-summary strong { max-width: 46vw; }
  .panel { padding: 11px; }
  .panel-head { align-items: flex-start; }
  .hint { max-width: 92px; text-align: right; }
  .canvas-wrap { min-height: 240px; }
  .canvas-wrap canvas { max-height: 420px; }
  .controls { align-items: stretch; }
  .brush-control { order: 3; width: 100%; justify-content: space-between; min-height: 40px; }
  .brush-control input { flex: 1; }
  .result-wrap { min-height: 260px; }
  .download-button { align-items: flex-start; flex-direction: column; justify-content: center; gap: 1px; text-align: left; }
  .content-section { width: calc(100% - 28px); margin-bottom: 72px; }
  .scope-grid { grid-template-columns: 1fr; }
  footer { padding: 24px; flex-direction: column; justify-content: center; gap: 4px; }
}
