:root {
  color-scheme: light;
  --canvas-ink: #142622;
  --ink: #1a302b;
  --muted: #64736f;
  --soft-muted: #87938f;
  --line: #dce3de;
  --line-strong: #c9d4cd;
  --paper: #ffffff;
  --paper-soft: #f7f9f6;
  --page: #f1f4ef;
  --accent: #2e695e;
  --accent-hover: #24594f;
  --accent-soft: #e3eee8;
  --accent-pale: #f0f6f2;
  --warm: #f5f2ea;
  --danger: #a63f3f;
  --danger-soft: #fdf0ef;
  --focus: #237967;
  --shadow-sm: 0 1px 2px rgb(20 38 34 / 6%), 0 8px 24px rgb(20 38 34 / 5%);
  --shadow-md: 0 18px 50px rgb(20 38 34 / 9%);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --content-width: 1480px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgb(220 235 225 / 75%), transparent 30rem),
    linear-gradient(180deg, #f7f8f5 0, var(--page) 42rem, #edf1ec 100%);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
label,
input[type="color"],
input[type="range"] {
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  padding: 10px 16px;
  color: #fff;
  background: var(--canvas-ink);
  border-radius: 8px;
  transform: translateY(-150%);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 72%, white);
  outline-offset: 3px;
}

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(calc(100% - 48px), var(--content-width));
  min-height: 78px;
  margin: 0 auto;
  border-bottom: 1px solid rgb(26 48 43 / 9%);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 13px;
}

.brand-mark svg {
  width: 27px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.brand-name,
.brand-subtitle {
  display: block;
}

.brand-name {
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.015em;
  line-height: 1.35;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--soft-muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  line-height: 1.2;
}

.header-help {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  text-underline-offset: 4px;
}

.header-help:hover {
  color: var(--accent);
}

.header-help svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.7;
}

main {
  width: min(calc(100% - 48px), var(--content-width));
  margin: 0 auto;
}

.eyebrow,
.panel-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.2em;
  line-height: 1.4;
}

.upload-section {
  max-width: 900px;
  margin: 0 auto;
  padding: clamp(64px, 9vw, 116px) 0 76px;
  text-align: center;
}

.intro-copy {
  max-width: 700px;
  margin: 0 auto 38px;
}

.intro-copy h1 {
  margin: 14px 0 20px;
  font-size: clamp(35px, 5.2vw, 60px);
  font-weight: 670;
  letter-spacing: -0.055em;
  line-height: 1.28;
}

.intro-copy h1 span {
  color: var(--accent);
}

.intro-lead {
  max-width: 610px;
  margin: 0 auto;
  color: var(--muted);
  font-size: clamp(14px, 1.6vw, 16px);
}

.upload-card {
  padding: 14px;
  background: rgb(255 255 255 / 78%);
  border: 1px solid rgb(255 255 255 / 85%);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(10px);
}

.upload-picker {
  position: relative;
}

.drop-zone {
  position: relative;
  display: flex;
  min-height: 350px;
  padding: 42px 28px 32px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--ink);
  background:
    linear-gradient(var(--paper-soft), var(--paper-soft)) padding-box,
    repeating-linear-gradient(90deg, var(--line-strong) 0 8px, transparent 8px 14px) border-box;
  border: 1.5px solid transparent;
  border-radius: 17px;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.drop-zone::before {
  position: absolute;
  inset: 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  content: "";
  pointer-events: none;
}

.drop-zone:hover,
.drop-zone[data-state="dragover"] {
  background: var(--accent-pale);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.drop-zone[data-state="dragover"]::before {
  border-color: var(--accent);
}

.file-input:focus-visible + .drop-zone {
  outline: 3px solid color-mix(in srgb, var(--focus) 72%, white);
  outline-offset: 4px;
}

.drop-illustration {
  display: grid;
  width: 78px;
  height: 78px;
  margin-bottom: 17px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
}

.drop-illustration svg {
  width: 56px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.drop-title,
.drop-or,
.drop-formats {
  display: block;
}

.drop-title {
  font-size: 19px;
  font-weight: 720;
  letter-spacing: -0.02em;
}

.drop-or {
  margin: 3px 0 12px;
  color: var(--soft-muted);
  font-size: 12px;
}

.drop-formats {
  margin-top: 14px;
  color: var(--soft-muted);
  font-size: 11px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  padding: 10px 18px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.button-primary {
  min-height: 48px;
  padding-inline: 28px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 7px 18px rgb(46 105 94 / 20%);
}

.drop-zone:hover .button-primary,
.button-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 9px 22px rgb(46 105 94 / 26%);
}

.privacy-note {
  display: flex;
  max-width: 620px;
  margin: 17px auto 3px;
  padding: 10px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.privacy-note strong {
  color: var(--ink);
}

.privacy-note svg {
  flex: 0 0 auto;
  width: 21px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.feature-list {
  display: grid;
  max-width: 770px;
  margin: 36px auto 0;
  padding: 0;
  grid-template-columns: repeat(3, 1fr);
  list-style: none;
  text-align: left;
}

.feature-list li {
  position: relative;
  display: flex;
  padding: 0 25px;
  align-items: center;
  gap: 12px;
}

.feature-list li + li {
  border-left: 1px solid var(--line-strong);
}

.feature-number {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.feature-list strong,
.feature-list small {
  display: block;
}

.feature-list strong {
  font-size: 13px;
}

.feature-list small {
  color: var(--soft-muted);
  font-size: 10px;
}

.editor {
  padding: 42px 0 76px;
}

.editor-toolbar {
  display: flex;
  margin-bottom: 24px;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.editor-heading h1 {
  margin: 7px 0 0;
  font-size: clamp(27px, 3vw, 38px);
  font-weight: 680;
  letter-spacing: -0.045em;
  line-height: 1.25;
}

.editor-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.file-badge {
  display: inline-block;
  max-width: 260px;
  padding: 4px 9px;
  overflow: hidden;
  color: var(--muted);
  background: rgb(255 255 255 / 75%);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 10px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  margin: 4px 0 0;
  color: var(--soft-muted);
  font-size: 11px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.toolbar-actions .button {
  min-height: 40px;
  padding: 9px 14px;
  font-size: 12px;
}

.button-quiet {
  color: var(--muted);
  background: transparent;
}

.button-quiet:hover {
  color: var(--ink);
  background: rgb(255 255 255 / 68%);
}

.button-secondary {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
  box-shadow: 0 2px 8px rgb(20 38 34 / 4%);
}

.button-secondary:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(350px, 410px);
  align-items: start;
  gap: 22px;
}

.preview-panel,
.settings-card {
  background: rgb(255 255 255 / 88%);
  border: 1px solid rgb(255 255 255 / 95%);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.preview-panel {
  min-width: 0;
  padding: 18px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.preview-header {
  min-height: 56px;
  padding: 0 5px 14px;
}

.panel-header h2 {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 720;
  letter-spacing: -0.025em;
  line-height: 1.35;
}

.detect-badge {
  display: inline-flex;
  padding: 5px 9px;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
}

.detect-badge > span:first-child {
  width: 6px;
  height: 6px;
  background: var(--soft-muted);
  border-radius: 50%;
}

.detect-badge[data-state="success"] {
  color: var(--accent);
  background: var(--accent-pale);
  border-color: #c9ddd2;
}

.detect-badge[data-state="success"] > span:first-child {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgb(46 105 94 / 12%);
}

.detect-badge[data-state="working"] > span:first-child {
  background: #c18b35;
  animation: pulse 1.2s ease-in-out infinite;
}

.detect-badge[data-state="review"] {
  color: #8b5f24;
  background: #fff7e6;
  border-color: #ead29f;
}

.detect-badge[data-state="review"] > span:first-child {
  background: #c18b35;
}

.detect-badge[data-state="error"] {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f0cccc;
}

.detect-badge[data-state="error"] > span:first-child {
  background: var(--danger);
}

.canvas-stage {
  position: relative;
  display: grid;
  min-height: clamp(410px, 61vh, 760px);
  padding: clamp(16px, 3vw, 38px);
  overflow: hidden;
  place-items: center;
  background-color: #dfe4e1;
  background-image:
    linear-gradient(45deg, rgb(255 255 255 / 28%) 25%, transparent 25%),
    linear-gradient(-45deg, rgb(255 255 255 / 28%) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgb(255 255 255 / 28%) 75%),
    linear-gradient(-45deg, transparent 75%, rgb(255 255 255 / 28%) 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border: 1px solid #d4dcd7;
  border-radius: 12px;
  isolation: isolate;
}

.canvas-stage:focus-visible {
  outline-offset: 4px;
}

.canvas-stack {
  position: relative;
  display: inline-block;
  max-width: 100%;
  max-height: calc(78vh - 130px);
  line-height: 0;
  filter: drop-shadow(0 10px 22px rgb(20 38 34 / 16%));
}

#previewCanvas {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: calc(78vh - 130px);
  background: #fff;
}

#overlayCanvas {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.handle-layer {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
}

.canvas-handle {
  position: absolute;
  width: 44px;
  height: 44px;
  cursor: grab;
  pointer-events: auto;
  touch-action: none;
  transform: translate(-50%, -50%);
}

.canvas-handle::before {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  background: #fff;
  border: 3px solid var(--handle-color, #326b83);
  border-radius: 50%;
  box-shadow: 0 1px 4px rgb(20 38 34 / 22%);
  content: "";
  transform: translate(-50%, -50%);
}

.canvas-handle[data-dragging="true"] {
  cursor: grabbing;
}

.canvas-handle[data-dragging="true"]::before {
  width: 18px;
  height: 18px;
}

.stage-loading {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--ink);
  background: rgb(239 243 240 / 86%);
  font-size: 12px;
  font-weight: 700;
  backdrop-filter: blur(4px);
}

.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #bdd0c8;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

.canvas-instructions {
  display: flex;
  min-height: 38px;
  margin: 10px 0 0;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.canvas-instructions svg {
  flex: 0 0 auto;
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.status-strip {
  display: flex;
  min-height: 38px;
  padding: 9px 12px;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  background: var(--paper-soft);
  border-radius: 8px;
  font-size: 10px;
}

.status-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}

.settings-panel {
  min-width: 0;
}

.settings-card {
  overflow: hidden;
}

.settings-header {
  min-height: 76px;
  padding: 15px 20px 13px;
  border-bottom: 1px solid var(--line);
}

.setting-group {
  min-width: 0;
  margin: 0;
  padding: 18px 20px 20px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.setting-group > legend {
  width: 100%;
  padding: 0;
  font-size: 12px;
  font-weight: 750;
}

.setting-group > legend > span,
.setting-title-row h3 > span {
  display: inline-grid;
  width: 20px;
  height: 20px;
  margin-right: 7px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 9px;
  font-weight: 800;
  vertical-align: 1px;
}

.choice-grid {
  display: grid;
  margin-top: 11px;
  gap: 8px;
}

.choice-grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-input,
.segment-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.choice-card {
  display: flex;
  min-width: 0;
  min-height: 75px;
  padding: 12px;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.choice-card:hover {
  border-color: var(--line-strong);
}

.choice-card svg {
  flex: 0 0 auto;
  width: 30px;
  color: var(--muted);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
}

.choice-card .muted-stroke {
  opacity: 0.38;
  stroke-dasharray: 2 2;
}

.choice-card strong,
.choice-card small {
  display: block;
}

.choice-card strong {
  font-size: 11px;
  line-height: 1.45;
}

.choice-card small {
  margin-top: 2px;
  color: var(--soft-muted);
  font-size: 9px;
  line-height: 1.5;
}

.choice-input:checked + .choice-card {
  color: var(--accent);
  background: var(--accent-pale);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.choice-input:checked + .choice-card svg {
  color: var(--accent);
}

.choice-input:focus-visible + .choice-card,
.segment-input:focus-visible + label {
  outline: 3px solid color-mix(in srgb, var(--focus) 72%, white);
  outline-offset: 2px;
}

.segmented-control {
  display: grid;
  margin-top: 11px;
  padding: 3px;
  gap: 3px;
  background: #eef1ee;
  border: 1px solid #e3e8e4;
  border-radius: 10px;
}

.segmented-two {
  grid-template-columns: repeat(2, 1fr);
}

.segmented-three {
  grid-template-columns: repeat(3, 1fr);
}

.segmented-control label {
  display: grid;
  min-height: 35px;
  padding: 7px 9px;
  place-items: center;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  transition: color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.segment-input:checked + label {
  color: var(--ink);
  background: var(--paper);
  border-color: rgb(207 216 210 / 70%);
  box-shadow: 0 1px 4px rgb(20 38 34 / 8%);
}

.setting-hint {
  margin: 8px 1px 0;
  color: var(--soft-muted);
  font-size: 9px;
}

.color-control {
  display: grid;
  margin-top: 12px;
  grid-template-columns: 64px 1fr;
  align-items: center;
  gap: 10px;
}

.background-image-control {
  margin-top: 12px;
}

.background-image-picker {
  display: grid;
  min-height: 68px;
  padding: 8px;
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.background-image-picker:hover {
  border-color: var(--line-strong);
}

.background-image-input:focus-visible + .background-image-picker {
  outline: 3px solid color-mix(in srgb, var(--focus) 72%, white);
  outline-offset: 2px;
}

#backgroundImageThumbnail {
  display: block;
  width: 72px;
  height: 48px;
  background:
    linear-gradient(135deg, var(--accent-soft), var(--paper-soft));
  border: 1px solid var(--line);
  border-radius: 7px;
}

.background-image-copy {
  min-width: 0;
  line-height: 1.4;
}

.background-image-copy strong,
.background-image-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.background-image-copy strong {
  font-size: 10px;
}

.background-image-copy small {
  margin-top: 3px;
  color: var(--soft-muted);
  font-size: 8px;
}

.background-image-action {
  display: grid;
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-pale);
  border-radius: 8px;
  font-size: 9px;
  font-weight: 750;
}

.background-image-remove {
  min-height: 44px;
  margin: 5px 0 -5px auto;
  padding: 7px 5px;
  color: var(--soft-muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.background-image-remove:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.color-control > label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.color-inputs {
  display: grid;
  min-width: 0;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 8px;
}

#backgroundColor {
  width: 38px;
  height: 38px;
  padding: 3px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  cursor: pointer;
}

#backgroundColor::-webkit-color-swatch-wrapper {
  padding: 0;
}

#backgroundColor::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}

#backgroundColor::-moz-color-swatch {
  border: 0;
  border-radius: 5px;
}

.color-swatch {
  display: none;
}

#backgroundColorText,
.coordinate-grid input {
  min-width: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

#backgroundColorText {
  width: 100%;
  height: 38px;
  padding: 7px 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#backgroundColorText:focus,
.coordinate-grid input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(46 105 94 / 10%);
  outline: 0;
}

#backgroundColorText:invalid:not(:focus) {
  border-color: var(--danger);
}

.adjustment-group {
  padding-top: 17px;
}

.setting-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setting-title-row h3 {
  margin: 0;
  font-size: 12px;
  font-weight: 750;
}

.text-button {
  display: inline-flex;
  min-height: 32px;
  padding: 5px 8px;
  align-items: center;
  gap: 5px;
  color: var(--accent);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
}

.text-button:hover {
  background: var(--accent-pale);
}

.text-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.6;
}

.boundary-tabs {
  display: flex;
  margin-top: 13px;
  border-bottom: 1px solid var(--line);
}

.boundary-tab {
  position: relative;
  flex: 1;
  min-height: 38px;
  padding: 8px 12px;
  color: var(--soft-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 10px;
  font-weight: 750;
}

.boundary-tab::after {
  position: absolute;
  right: 18%;
  bottom: -1px;
  left: 18%;
  height: 2px;
  background: transparent;
  border-radius: 2px 2px 0 0;
  content: "";
}

.boundary-tab[aria-selected="true"] {
  color: var(--accent);
}

.boundary-tab[aria-selected="true"]::after {
  background: var(--accent);
}

.boundary-panel {
  padding-top: 11px;
}

.boundary-panel > p {
  margin: 0 0 10px;
  color: var(--soft-muted);
  font-size: 9px;
  line-height: 1.55;
}

.coordinate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.coordinate-grid label {
  display: grid;
  min-width: 0;
  grid-template-columns: 23px minmax(0, 1fr) 17px;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.coordinate-grid input {
  width: 100%;
  height: 34px;
  padding: 5px 6px;
  font-size: 10px;
  text-align: right;
}

.coordinate-grid small {
  padding-left: 3px;
  color: var(--soft-muted);
  font-size: 8px;
  font-weight: 500;
}

.format-group {
  border-bottom: 0;
}

.quality-control {
  margin-top: 13px;
}

.range-label,
.range-scale {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.range-label {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.range-label output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

#quality {
  width: 100%;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.range-scale {
  margin-top: -1px;
  color: var(--soft-muted);
  font-size: 8px;
}

.notice {
  position: relative;
  display: grid;
  margin-top: 10px;
  padding: 11px 50px 11px 12px;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 8px;
  border: 1px solid;
  border-radius: 10px;
  font-size: 10px;
}

.notice-error {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #f0cccc;
}

.upload-error {
  margin: 14px 0 0;
  text-align: left;
}

.notice svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.8;
}

.notice p {
  margin: 0;
}

.notice button {
  position: absolute;
  top: 50%;
  right: 4px;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.notice button:hover {
  background: rgb(166 63 63 / 8%);
}

.progress-region {
  margin-top: 10px;
  padding: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.progress-label {
  display: flex;
  margin-bottom: 6px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 9px;
}

.progress-label output {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
}

.progress-region progress {
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  appearance: none;
  background: var(--accent-soft);
  border: 0;
  border-radius: 99px;
}

.progress-region progress::-webkit-progress-bar {
  background: var(--accent-soft);
  border-radius: 99px;
}

.progress-region progress::-webkit-progress-value {
  background: var(--accent);
  border-radius: 99px;
}

.progress-region progress::-moz-progress-bar {
  background: var(--accent);
  border-radius: 99px;
}

.export-dock {
  margin-top: 10px;
  padding: 14px;
  background: rgb(255 255 255 / 90%);
  border: 1px solid rgb(255 255 255 / 95%);
  border-radius: 13px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.export-summary {
  display: flex;
  margin: 0 2px 10px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--soft-muted);
  font-size: 9px;
}

.export-summary strong {
  overflow: hidden;
  color: var(--muted);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button-export {
  width: 100%;
  min-height: 53px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 20px rgb(46 105 94 / 24%);
  font-size: 13px;
}

.button-export:hover {
  background: var(--accent-hover);
  box-shadow: 0 10px 24px rgb(46 105 94 / 30%);
}

.usage-guide {
  display: grid;
  max-width: 1040px;
  margin: 0 auto 72px;
  padding: 28px clamp(24px, 5vw, 48px);
  grid-template-columns: minmax(210px, 0.75fr) minmax(0, 1.5fr);
  align-items: center;
  gap: 36px;
  background: rgb(255 255 255 / 52%);
  border: 1px solid rgb(255 255 255 / 80%);
  border-radius: var(--radius-md);
}

.usage-guide h2 {
  margin: 6px 0 0;
  font-size: 19px;
  letter-spacing: -0.025em;
}

.usage-guide ul {
  display: grid;
  margin: 0;
  padding: 0;
  gap: 10px;
  list-style: none;
}

.usage-guide li {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.usage-guide li span {
  display: grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 50%;
  font-size: 8px;
  font-weight: 800;
}

.site-footer {
  display: flex;
  width: min(calc(100% - 48px), var(--content-width));
  min-height: 74px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--soft-muted);
  border-top: 1px solid rgb(26 48 43 / 9%);
  font-size: 10px;
}

.site-footer p {
  margin: 0;
}

@keyframes spin {
  to { transform: rotate(1turn); }
}

@keyframes pulse {
  50% { opacity: 0.35; }
}

@media (max-width: 1080px) {
  .editor-layout {
    grid-template-columns: minmax(0, 1fr) 350px;
    gap: 16px;
  }

  .preview-panel {
    padding: 13px;
  }

  .canvas-stage {
    min-height: 480px;
    padding: 24px;
  }

  .setting-group {
    padding-right: 16px;
    padding-left: 16px;
  }
}

@media (max-width: 860px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }

  .canvas-stage {
    min-height: min(68vh, 650px);
  }

  .canvas-stack,
  #previewCanvas {
    max-height: calc(68vh - 50px);
  }

  .settings-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .settings-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-header {
    grid-column: 1 / -1;
  }

  #settingsForm {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .setting-group {
    border-right: 1px solid var(--line);
  }

  .setting-group:nth-child(even) {
    border-right: 0;
  }

  .adjustment-group,
  .format-group {
    border-bottom: 0;
  }
}

@media (max-width: 640px) {
  .site-header,
  main,
  .site-footer {
    width: min(calc(100% - 28px), var(--content-width));
  }

  .site-header {
    min-height: 66px;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
    border-radius: 11px;
  }

  .brand-mark svg {
    width: 24px;
  }

  .brand-name {
    font-size: 13px;
  }

  .brand-subtitle {
    font-size: 7px;
  }

  .header-help {
    padding-right: 2px;
    font-size: 0;
  }

  .header-help svg {
    width: 22px;
  }

  .upload-section {
    padding: 52px 0 54px;
  }

  .intro-copy {
    margin-bottom: 27px;
  }

  .intro-copy h1 {
    margin: 12px 0 16px;
    font-size: clamp(32px, 10.5vw, 44px);
    line-height: 1.32;
  }

  .intro-lead {
    font-size: 13px;
    text-align: left;
  }

  .upload-card {
    padding: 9px;
    border-radius: 19px;
  }

  .drop-zone {
    min-height: 300px;
    padding: 34px 20px 28px;
  }

  .drop-zone::before {
    inset: 8px;
  }

  .drop-illustration {
    width: 68px;
    height: 68px;
  }

  .drop-illustration svg {
    width: 49px;
  }

  .drop-title {
    font-size: 17px;
  }

  .privacy-note {
    align-items: flex-start;
    text-align: left;
  }

  .feature-list {
    margin-top: 28px;
    grid-template-columns: 1fr;
    gap: 0;
  }

  .feature-list li {
    min-height: 58px;
    padding: 8px 17px;
  }

  .feature-list li + li {
    border-top: 1px solid var(--line-strong);
    border-left: 0;
  }

  .feature-number {
    width: 25px;
  }

  .editor {
    padding: 27px 0 92px;
  }

  .editor-toolbar {
    margin-bottom: 16px;
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
  }

  .editor-heading h1 {
    font-size: 28px;
  }

  .file-badge {
    max-width: 48vw;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-actions .button {
    min-height: 44px;
    padding-inline: 9px;
    font-size: 10px;
  }

  .segmented-control label,
  .boundary-tab,
  .text-button,
  .coordinate-grid label {
    min-height: 44px;
  }

  .coordinate-grid input,
  #backgroundColorText {
    font-size: 16px;
  }

  .background-image-picker {
    grid-template-columns: 64px minmax(0, 1fr) auto;
  }

  #backgroundImageThumbnail {
    width: 64px;
    height: 44px;
  }

  .editor-layout {
    gap: 12px;
  }

  .preview-panel {
    padding: 9px;
    border-radius: 13px;
  }

  .preview-header {
    min-height: 54px;
    padding: 3px 4px 10px;
  }

  .panel-header h2 {
    font-size: 15px;
  }

  .canvas-stage {
    min-height: min(52vh, 480px);
    padding: 24px;
    border-radius: 9px;
  }

  .canvas-stack,
  #previewCanvas {
    max-height: calc(52vh - 48px);
  }

  .canvas-instructions {
    min-height: 48px;
    margin: 4px 5px 0;
    line-height: 1.45;
  }

  .status-strip {
    align-items: flex-start;
    line-height: 1.5;
  }

  .settings-card,
  #settingsForm {
    display: block;
  }

  .settings-header {
    min-height: 68px;
    padding-inline: 17px;
  }

  .setting-group,
  .setting-group:nth-child(even) {
    padding: 17px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .format-group {
    border-bottom: 0;
  }

  .choice-card {
    padding: 10px;
  }

  .choice-card svg {
    width: 27px;
  }

  .export-dock {
    position: sticky;
    z-index: 20;
    bottom: max(8px, env(safe-area-inset-bottom));
    padding: 10px;
    border-color: var(--line);
    box-shadow: 0 -5px 25px rgb(20 38 34 / 12%);
  }

  .export-summary {
    margin-bottom: 7px;
  }

  .button-export {
    min-height: 51px;
  }

  .usage-guide {
    margin-bottom: 48px;
    padding: 24px 20px;
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .usage-guide li {
    align-items: flex-start;
    line-height: 1.55;
  }

  .site-footer {
    min-height: 86px;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    gap: 2px;
  }
}

@media (max-width: 380px) {
  .choice-grid-two {
    grid-template-columns: 1fr;
  }

  .choice-card {
    min-height: 62px;
  }

  .coordinate-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (forced-colors: active) {
  .drop-zone,
  .choice-card,
  .segmented-control,
  .canvas-stage {
    border: 1px solid CanvasText;
  }

  .choice-input:checked + .choice-card,
  .segment-input:checked + label,
  .boundary-tab[aria-selected="true"] {
    outline: 2px solid Highlight;
  }
}
