:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  color: #1d2a23;
  background: #f5f6f0;
  --ink: #1d2a23;
  --muted: #526259;
  --line: #dce2d8;
  --green: #20483a;
  --green-hover: #153c2f;
  --soft: #e7efe3;
  --white: #fff;
  --shadow: 0 12px 35px #20382b0b, 0 2px 5px #20382b08;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
h1, h2, p, ol, dl, dd { margin: 0; }
button, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid #438366; outline-offset: 3px; }

.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon {
  flex: none;
  width: 1.15em;
  height: 1.15em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-header { border-bottom: 1px solid var(--line); background: #fbfcf8; }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 1296px;
  min-height: 72px;
  padding: 0 30px;
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.025em;
  white-space: nowrap;
}
.privacy-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border: 1px solid #d5e4d5;
  border-radius: 30px;
  background: #edf4ea;
  color: #2c5845;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
}

.page { max-width: 1296px; margin: 0 auto; padding: 0 30px; }
#welcome { max-width: 880px; margin: 0 auto; }
.intro { text-align: center; padding: clamp(34px, 7vh, 84px) 0 30px; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #3e6a55;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
}
.eyebrow span { width: 16px; height: 2px; border-radius: 2px; background: #6f9c7c; }
.intro .eyebrow { justify-content: center; }
h1 { letter-spacing: -.04em; }
.intro h1 { margin: 12px 0 14px; font-size: clamp(24px, 5vw, 49px); line-height: 1.27; }
.intro-copy { color: var(--muted); font-size: clamp(13px, 2.5vw, 15px); line-height: 1.75; }

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 28px 16px 24px;
  text-align: center;
  border: 1px dashed #8daa96;
  border-radius: 22px;
  background: radial-gradient(ellipse at 50% 10%, #e9f2e5, #fcfdf9 77%);
  box-shadow: var(--shadow);
}
.drop-zone.is-dragging { border-color: var(--green); background: #e1efe2; }
.drop-art { margin-bottom: 1px; }
.drop-zone h2 { font-size: clamp(18px, 3vw, 22px); letter-spacing: -.025em; }
.drop-zone p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.drop-zone .button { margin-top: 8px; padding-inline: 25px; }
.drop-zone .formats { margin-top: 7px; font-size: 11px; }
.mobile-only, .touch-copy { display: none; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 690;
  white-space: nowrap;
  transition: background-color .12s, border-color .12s, color .12s;
}
.button .icon { width: 17px; height: 17px; }
.primary { background: var(--green); border-color: var(--green); color: #fff; }
.primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.primary:disabled { background: #65766c; border-color: #65766c; }
.secondary { background: #fafbf8; border-color: var(--line); }
.secondary:hover { background: var(--soft); border-color: #c9d9cd; }

.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
  padding: 0;
  overflow: hidden;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fbfcf8;
}
.steps li { display: flex; align-items: center; gap: 12px; padding: 17px 16px; }
.steps li + li { border-inline-start: 1px solid var(--line); }
.steps .icon { width: 20px; height: 20px; color: #40725a; }
.steps strong { font-size: 13px; }
.steps p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.editor-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 24px 0 17px;
}
.editor-heading h1 { margin-top: 4px; font-size: clamp(22px, 5vw, 32px); }
#editor-title:focus { outline: none; }
.workspace { border: 1px solid var(--line); border-radius: 17px; background: var(--white); box-shadow: var(--shadow); }
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.tool-groups { display: flex; align-items: center; gap: 10px; }
.tool-group {
  display: flex;
  gap: 1px;
  padding: 2px;
  border: 1px solid #e1e6de;
  border-radius: 10px;
  background: #f5f7f3;
}
.tool {
  min-height: 38px;
  padding-inline: 10px;
  border-radius: 7px;
  color: #42544a;
}
.tool:enabled:hover { background: #e9eee7; }
.tool[aria-pressed="true"] { background: #dcebdc; color: #1d4a36; }
.tool[aria-pressed="true"]:hover { background: #d3e6d5; }
.tool:disabled { color: #a0aaa1; }
.icon-button { width: 39px; padding: 0; }
.zoom-value { min-width: 53px; padding-inline: 3px; font-variant-numeric: tabular-nums; }

.viewport {
  height: clamp(330px, 61dvh, 920px);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: none;
  background-color: #e9eee8;
  background-image: radial-gradient(circle, #c0ccc1 1px, transparent 1px);
  background-size: 16px 16px;
}
.image-stage {
  display: flex;
  width: max-content;
  height: max-content;
  min-width: 100%;
  min-height: 100%;
  padding: 18px;
}
.image-frame {
  position: relative;
  flex: none;
  margin: auto;
  cursor: crosshair;
  box-shadow: 0 2px 12px #263c333b;
  user-select: none;
}
.viewport.is-pan { cursor: grab; }
.viewport.is-pan .image-frame { cursor: inherit; }
.viewport.is-panning, .viewport.is-panning .image-frame { cursor: grabbing; }
#image { display: block; width: 100%; height: 100%; }
.image-frame.is-enlarged #image { image-rendering: pixelated; }
#selection {
  position: absolute;
  outline: 2px dashed #d8f1b5;
  background: #111e17ad;
  pointer-events: none;
}
.image-info {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.image-info .icon { color: #528068; }
#filename { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#dimensions { margin-inline-end: auto; }
#dimensions, #mask-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.editor-help {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
.editor-help summary { cursor: pointer; font-weight: 650; }
.editor-help dl { margin: 8px 0 0; }
.editor-help dl div { display: flex; justify-content: space-between; gap: 16px; margin: 4px 0; }
kbd { font-family: inherit; }

.notice {
  position: fixed;
  z-index: 2;
  inset: auto 16px max(16px, env(safe-area-inset-bottom));
  width: fit-content;
  max-width: calc(100% - 32px);
  margin: 0 auto;
  padding: 11px 16px;
  border: 1px solid #c8dacd;
  border-radius: 10px;
  color: var(--green);
  background: #f1f8ee;
  box-shadow: var(--shadow);
  font-size: 13px;
  line-height: 1.6;
}
.notice.error { color: #742c24; border-color: #e9c8bf; background: #fff2ed; }
.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 0 24px;
  color: var(--muted);
  text-align: center;
  font-size: 11px;
}
.footer .icon { color: #40725a; }
.drag-overlay {
  position: fixed;
  z-index: 3;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: #1c45355e;
}
.drag-overlay div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border: 2px dashed #7ba789;
  border-radius: 12px;
  color: var(--green);
  background: #f2f8ed;
  font-weight: 700;
}

dialog {
  width: min(430px, calc(100% - 32px));
  max-height: calc(100% - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: #fbfcf9;
  box-shadow: 0 22px 75px #142b234d;
}
dialog::backdrop { background: #162b2366; }
#save-form { position: relative; padding: 25px; }
.close-dialog { position: absolute; top: 12px; right: 12px; }
.dialog-icon {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  margin-bottom: 12px;
  border-radius: 10px;
  color: var(--green);
  background: var(--soft);
}
dialog h2 { font-size: 23px; }
dialog p { margin-top: 8px; color: var(--muted); font-size: 13px; line-height: 1.65; }
dialog label { display: block; margin-top: 18px; margin-bottom: 6px; font-size: 13px; font-weight: 700; }
dialog select {
  width: 100%;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid #c9d5cc;
  border-radius: 8px;
  color: var(--ink);
  background: var(--white);
}
dialog .output-name { overflow-wrap: anywhere; font-size: 12px; }
dialog .export-warning { color: #7a4725; font-weight: 650; }
dialog .primary { width: 100%; margin-top: 16px; }

@media (max-width: 650px) {
  .header-inner { min-height: 60px; padding-inline: 16px; }
  .page { padding-inline: 16px; }
  .brand { font-size: 15px; }
  .brand img { width: 31px; height: 31px; }
  .privacy-badge { padding: 5px 8px; font-size: 10px; }
  .intro { padding-bottom: 21px; }
  .drop-zone { border-radius: 16px; }
  .mobile-only { display: initial; }
  .steps { grid-template-columns: 1fr; margin-top: 14px; }
  .steps li { padding: 10px 13px; }
  .steps li + li { border-inline-start: 0; border-top: 1px solid var(--line); }
  .steps p { margin-top: 1px; }
  .editor-heading { padding: 16px 0 12px; }
  .editor-heading .button { padding-inline: 9px; font-size: 11px; }
  .toolbar { flex-wrap: wrap; padding: 7px; gap: 6px; }
  .tool-groups { gap: 6px; }
  .view-tools { flex: 1; flex-wrap: wrap; justify-content: space-between; }
  .tool { min-height: 44px; }
  .tool.icon-button { width: 44px; }
  .viewport { height: clamp(260px, 53dvh, 620px); }
  .image-info { padding-inline: 9px; font-size: 11px; gap: 7px; }
  .editor-help { gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; }
}

@media (hover: none) and (pointer: coarse) {
  .drop-copy { display: none; }
  .touch-copy { display: inline; }
}
