:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --line: #dfe5ef;
  --brand: #ff7675;
  --action: #2563eb;
  --action-hover: #1d4ed8;
  --success: #15803d;
  --success-bg: #ecfdf3;
  --success-line: #bbf7d0;
  --warning: #b45309;
  --shadow: 0 18px 50px rgba(27, 39, 67, 0.08);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
}

button,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.28);
  outline-offset: 3px;
}

.site-bar {
  min-height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid rgba(223, 229, 239, 0.9);
  background: rgba(255, 255, 255, 0.92);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.brand-link,
.tools-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-mark { font-size: 1.1rem; }

.tools-link {
  font-size: 0.85rem;
  color: var(--muted);
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pwa-install-button {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid #bfd4ff;
  border-radius: 10px;
  background: #eff6ff;
  color: var(--action);
  font-weight: 850;
  font-size: .74rem;
  cursor: pointer;
}

.pwa-install-button:hover {
  border-color: #93b4ff;
  background: #e4edff;
}

.pwa-install-button[hidden] {
  display: none !important;
}

.pwa-toast {
  position: fixed;
  z-index: 120;
  top: 72px;
  right: 14px;
  max-width: min(440px, calc(100vw - 28px));
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 12px;
  border: 1px solid #bfd4ff;
  border-radius: 13px;
  background: rgba(255, 255, 255, .98);
  color: var(--text);
  box-shadow: 0 16px 38px rgba(15, 23, 42, .18);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.pwa-toast__message {
  flex: 1 1 auto;
  font-size: .78rem;
  font-weight: 750;
  line-height: 1.5;
}

.pwa-toast__button {
  flex: 0 0 auto;
  pointer-events: auto;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: .72rem;
  font-weight: 850;
  cursor: pointer;
}

.pwa-toast__button--primary {
  border-color: var(--action);
  background: var(--action);
  color: #fff;
}

.page-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 72px;
}

.tool-start {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.compact-tool-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 13px;
  margin-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.tool-title-block {
  min-width: 0;
}

.mini-label {
  letter-spacing: 0.04em;
  font-weight: 850;
}

.tool-title-block h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3.2vw, 2.25rem);
  line-height: 1.12;
  letter-spacing: -0.035em;
  font-weight: 900;
  word-break: keep-all;
  overflow-wrap: normal;
}

.tool-tagline {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.9rem;
}

.privacy-badge {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 320px;
  padding: 9px 12px;
  border: 1px solid var(--success-line);
  border-radius: 13px;
  background: var(--success-bg);
  color: #166534;
}

.privacy-badge > span:first-child {
  font-size: 1.05rem;
}

.privacy-badge > span:last-child {
  display: grid;
  gap: 1px;
}

.privacy-badge strong {
  font-size: 0.8rem;
  line-height: 1.35;
}

.privacy-badge small {
  color: #39734d;
  font-size: 0.68rem;
  line-height: 1.35;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--action);
  font-size: 0.74rem;
  letter-spacing: .02em;
  font-weight: 850;
}

.noscript-block {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
  color: #9a3412;
  font-size: .82rem;
  line-height: 1.55;
}

.noscript-block strong {
  flex: 0 0 auto;
}

.export-card,
.privacy-note {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}

.upload-card {
  margin: 0;
  padding: 0;
}

.editor-topline,
.control-heading,
.preview-toolbar,
.crop-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.mini-label {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.65rem;
}

.editor-topline h2,
.control-heading h3,
.export-card h3 {
  margin: 0;
}

.editor-topline h2 {
  font-size: 1.22rem;
}

.drop-zone {
  min-height: 172px;
  border: 2px dashed #c8d2e2;
  border-radius: 16px;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 22px 20px;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}

.drop-zone:hover,
.drop-zone.is-dragover,
.drop-zone:focus-visible {
  border-color: var(--action);
  background: #eff6ff;
}

.drop-zone:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.22);
  outline-offset: 3px;
}

.drop-zone:active {
  transform: scale(.995);
}

.drop-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 2px;
  border-radius: 13px;
  background: var(--action);
  color: white;
  font-size: 1.55rem;
  line-height: 1;
}

.drop-zone strong { font-size: 1.05rem; }

.drop-zone span:not(.drop-icon),
.drop-zone small {
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

.drop-zone span:not(.drop-icon) { font-size: .84rem; }
.drop-zone small { font-size: .72rem; }

.upload-foot {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 5px;
}

.text-button {
  min-height: 40px;
  border: 0;
  background: transparent;
  color: var(--action);
  font-weight: 800;
  font-size: .84rem;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 9px;
}

.text-button:hover {
  background: #eff6ff;
}

.inline-message {
  min-height: 1.3em;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.55;
  text-align: center;
}

.inline-message[data-tone="info"] { color: var(--action); }
.inline-message[data-tone="success"] { color: var(--success); }
.inline-message[data-tone="error"] { color: #b42318; }

.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;
}

.editor-section {
  margin-top: 32px;
  scroll-margin-top: 74px;
}

.editor-topline {
  margin-bottom: 12px;
}

.batch-progress {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .74rem;
  font-weight: 700;
}

.ready-hint {
  margin: 3px 0 0;
  color: var(--success);
  font-size: .72rem;
  font-weight: 800;
  line-height: 1.45;
}

.batch-auto-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.5;
  text-align: center;
}

.copy-button {
  width: 100%;
  margin-top: 8px;
}

.quick-action-dock {
  flex-wrap: wrap;
  position: fixed;
  z-index: 90;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(148, 163, 184, .35);
  border-radius: 16px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  backdrop-filter: blur(14px);
}

.quick-save-message {
  flex: 0 0 100%;
  min-width: 0;
  min-height: 0;
  margin: 0;
  font-size: .75rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-action-dock[hidden] {
  display: none !important;
}

.quick-action-dock .quick-action {
  min-height: 48px;
  margin: 0;
}

.quick-action-dock .primary-button {
  flex: 1 1 auto;
  width: auto;
}

.quick-action-dock .secondary-button {
  flex: 0 0 auto;
}

.editor-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.editor-header-actions button {
  scroll-margin-top: 78px;
}

.preset-bar {
  margin: -2px 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

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

.preset-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.preset-copy strong {
  font-size: .8rem;
  line-height: 1.2;
}

.preset-copy span {
  color: var(--muted);
  font-size: .65rem;
  line-height: 1.35;
}

.preset-slots {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, 48px);
  gap: 6px;
}

.preset-slot {
  position: relative;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.preset-slot:hover {
  border-color: #b7c4d6;
}

.preset-slot small {
  position: absolute;
  top: 3px;
  right: 5px;
  color: #98a2b3;
  font-size: .58rem;
  font-weight: 900;
  line-height: 1;
}

.preset-slot.is-registered small {
  color: var(--success);
}

.preset-slot.is-selected {
  border-color: #8eafff;
  background: #f3f7ff;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .08);
}

.preset-manager[hidden] {
  display: none !important;
}

.preset-manager {
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.preset-manager p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: .69rem;
  font-weight: 700;
  line-height: 1.45;
}

.preset-manager-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
}

.preset-manager-actions .secondary-button.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: .7rem;
}

.preset-manager-actions .text-button {
  min-height: 32px;
  padding: 5px 7px;
  font-size: .68rem;
}

.preset-delete-button {
  color: #a63a32;
}

.danger-lite {
  color: #a63a32;
}

.batch-strip[hidden] {
  display: none !important;
}

.batch-strip {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
  margin: -4px 0 16px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.batch-arrow {
  width: 34px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.batch-arrow:disabled {
  opacity: .35;
  cursor: default;
}

.batch-list {
  min-width: 0;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  padding: 2px;
}

.batch-item {
  position: relative;
  flex: 0 0 auto;
  width: 64px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  padding: 3px;
  cursor: pointer;
}

.batch-preview-slot {
  display: block;
}

.batch-item img,
.batch-item-placeholder {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #e5e7eb;
}

.batch-item img {
  object-fit: cover;
}

.batch-item-placeholder {
  display: grid;
  place-items: center;
  color: #98a2b3;
  font-size: 1.1rem;
  font-weight: 800;
}

.batch-item.is-current {
  border-color: #7fa4ff;
  box-shadow: 0 0 0 2px rgba(37,99,235,.12);
}


.batch-item-index {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: .62rem;
  font-weight: 800;
  text-align: center;
}

.batch-save-button {
  width: 100%;
  margin-top: 8px;
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
  gap: 20px;
  align-items: start;
}

.preview-column {
  min-width: 0;
}

.preview-toolbar {
  padding: 12px 3px 10px;
}

.preview-toolbar-simple {
  justify-content: flex-end;
  min-height: 40px;
  padding: 2px 3px 8px;
}

.preview-toolbar-simple .compare-button {
  min-height: 34px;
  padding: 5px 7px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 750;
}

.preview-toolbar-simple .compare-button:hover {
  color: var(--action);
}

.edit-state {
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--action);
  font-size: .72rem;
  font-weight: 800;
}

.canvas-shell {
  min-height: 330px;
  padding: 14px;
  border-radius: 22px;
  background: #111827;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}

#previewCanvas {
  display: block;
  max-width: 100%;
  max-height: min(68vh, 720px);
  border-radius: 9px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  touch-action: none;
  cursor: crosshair;
}

.canvas-help {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 24, 39, .78);
  color: rgba(255, 255, 255, .92);
  font-size: .7rem;
  white-space: nowrap;
  pointer-events: none;
}

.crop-summary {
  padding: 11px 3px 0;
  color: var(--muted);
  font-size: .78rem;
}

.crop-summary strong {
  color: var(--text);
  margin-right: auto;
}

.control-column {
  display: grid;
  gap: 14px;
}

.edge-control-card,
.advanced-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
}

.edge-fieldset {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.edge-toggle {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}

.edge-toggle:hover {
  border-color: #b7c4d6;
}

.edge-toggle input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--action);
}

.edge-toggle > span {
  min-width: 0;
  display: grid;
  place-items: center;
}

.edge-toggle strong {
  font-size: .8rem;
}

.edge-toggle.is-active {
  border-color: #9eb9ff;
  background: #f3f7ff;
}

.edge-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.55;
}

.compare-button[aria-pressed="true"] {
  border-color: #9eb9ff;
  background: #eef4ff;
  color: var(--action);
}

.advanced-panel {
  overflow: hidden;
}

.advanced-panel > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.advanced-panel > summary::-webkit-details-marker {
  display: none;
}

.advanced-panel > summary > span:first-child {
  display: grid;
}

.advanced-panel > summary strong {
  font-size: .9rem;
}

.advanced-panel-body {
  display: grid;
  gap: 18px;
  margin-top: 16px;
}

.advanced-section + .advanced-section {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.compact-heading {
  margin-bottom: 10px;
}

.detected-inline {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.45;
}

.detected-inline strong {
  color: var(--text);
  font-size: .72rem;
}

.advanced-section h3 {
  margin: 0;
  font-size: .9rem;
}

.manual-section > div:first-child {
  display: grid;
}

.range-row.is-disabled {
  opacity: .46;
}

.range-row.is-disabled input {
  cursor: not-allowed;
}


.export-card,
.privacy-note {
  padding: 18px;
}

.control-heading {
  align-items: flex-start;
  margin-bottom: 13px;
}

.control-heading h3,
.export-card h3 {
  font-size: 1rem;
}

.mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 4px;
  background: #eef2f7;
  border-radius: 12px;
  gap: 4px;
}

.mode-button {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  padding: 9px 8px;
  cursor: pointer;
}

.mode-button.is-active {
  background: var(--surface);
  color: var(--action);
  box-shadow: 0 2px 8px rgba(27, 39, 67, .08);
}

.check-row {
  margin-top: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.check-row input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--action);
}

.check-row span {
  display: grid;
  gap: 3px;
}

.check-row strong {
  font-size: .86rem;
}

.check-row small {
  color: var(--muted);
  line-height: 1.55;
  font-size: .73rem;
}

.secondary-button,
.primary-button {
  border-radius: 11px;
  border: 1px solid transparent;
  font-weight: 850;
  cursor: pointer;
  transition: background .16s ease, border-color .16s ease, transform .16s ease;
}

.secondary-button:active,
.primary-button:active {
  transform: translateY(1px);
}

.secondary-button {
  min-height: 42px;
  background: var(--surface);
  border-color: var(--line);
  color: var(--text);
  padding: 10px 13px;
}

.secondary-button:hover {
  border-color: #b9c3d3;
  background: var(--surface-soft);
}

.secondary-button.compact {
  min-height: 36px;
  font-size: .74rem;
  padding: 7px 9px;
}

.primary-button {
  width: 100%;
  min-height: 48px;
  background: var(--action);
  color: white;
  padding: 13px 16px;
  font-size: .94rem;
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: wait;
  opacity: .62;
}

.primary-button:hover {
  background: var(--action-hover);
}

.chevron {
  color: var(--muted);
  transition: transform .18s ease;
}

.advanced-panel[open] .chevron {
  transform: rotate(180deg);
}

.range-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.range-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.5;
}

.range-row {
  display: grid;
  gap: 7px;
}

.range-row > span {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
}

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

.range-row input {
  width: 100%;
  min-height: 34px;
  accent-color: var(--action);
}

.privacy-note {
  display: flex;
  gap: 11px;
  background: var(--success-bg);
  border-color: var(--success-line);
}

.privacy-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--success);
  color: white;
  font-weight: 900;
}

.privacy-note strong {
  color: #166534;
  font-size: .84rem;
}

.privacy-note p {
  margin: 5px 0 0;
  color: #39734d;
  font-size: .72rem;
  line-height: 1.6;
}

.export-card {
  border-color: #bfd4ff;
}

.export-card > div > p:last-child {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.6;
}

.share-button {
  width: 100%;
  margin-top: 8px;
}

.explain-section {
  margin-top: 72px;
  padding-top: 38px;
  border-top: 1px solid var(--line);
  content-visibility: auto;
  contain-intrinsic-size: auto 520px;
}

.explain-main {
  max-width: 760px;
}

.explain-main h2,
.faq-section h2 {
  margin: 0;
  font-size: clamp(1.75rem, 4vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.explain-main > p:last-child {
  color: var(--muted);
  line-height: 1.9;
  margin: 18px 0 0;
}

.use-cases {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.use-cases article {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.use-cases article > span {
  font-size: 1.25rem;
}

.use-cases h3 {
  margin: 12px 0 7px;
  font-size: .97rem;
}

.use-cases p {
  margin: 0;
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.7;
}

.faq-section {
  margin-top: 70px;
  max-width: 820px;
  content-visibility: auto;
  contain-intrinsic-size: auto 360px;
}

.faq-section h2 {
  margin-bottom: 18px;
}

.faq-section details {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.faq-section details:last-child {
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  cursor: pointer;
  font-weight: 850;
  line-height: 1.5;
}

.faq-section details p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.8;
  font-size: .87rem;
}

.site-footer {
  min-height: 90px;
  padding: 24px 20px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 11px 20px;
  color: var(--muted);
  font-size: .76rem;
}

.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-footer a:hover { color: var(--text); }


body.has-editor .tool-start {
  max-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  opacity: 0;
  box-shadow: none;
  pointer-events: none;
}

body.has-editor .pwa-install-button,
body.has-editor .tools-link,
body.has-editor .explain-section,
body.has-editor .faq-section {
  display: none !important;
}

body.has-editor .site-bar {
  min-height: 44px;
}

body.has-editor .page-shell {
  padding-top: 12px;
}

.privacy-inline-note {
  margin: 0;
  color: var(--muted);
  font-size: .72rem;
  line-height: 1.5;
  text-align: center;
}

.control-column .preset-bar {
  margin: 0;
  border-color: #e4e9f1;
  background: #fbfcfe;
}

.batch-review {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0 2px;
  padding: 10px 11px;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  background: #f8fafc;
}

.batch-review[hidden] {
  display: none !important;
}

.batch-review > div {
  min-width: 0;
}

.batch-review strong {
  display: block;
  margin-bottom: 2px;
  font-size: .76rem;
}

.batch-review p {
  margin: 0;
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.45;
}

.batch-review-next {
  flex: 0 0 auto;
  min-height: 40px;
  padding-inline: 8px;
  font-size: .72rem;
}

.batch-item-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 17px;
  margin-top: 2px;
  padding: 1px 5px;
  border-radius: 999px;
  font-size: .55rem;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.batch-item[data-status="unreviewed"] .batch-item-status {
  background: #eef1f5;
  color: #667085;
}

.batch-item[data-status="auto"] .batch-item-status {
  background: #eaf2ff;
  color: #2459b8;
}

.batch-item[data-status="adjusted"] .batch-item-status {
  background: #fff4df;
  color: #a35300;
}

.batch-item[data-status="saved"] .batch-item-status {
  background: #e9f8ee;
  color: #18743b;
}

.batch-item[data-status="saved"] {
  border-color: #86cfa0;
}

@media (display-mode: standalone) {
  .site-bar {
    min-height: calc(44px + env(safe-area-inset-top));
    padding-top: env(safe-area-inset-top);
  }

  .tools-link,
  .pwa-install-button {
    display: none !important;
  }

  .page-shell {
    padding-top: 12px;
  }
}

@media (min-width: 821px) and (min-height: 651px) {
  .control-column {
    position: sticky;
    top: 72px;
  }
}

@media (max-width: 820px) {
  body.has-editor .pwa-install-button {
    display: none !important;
  }

  .pwa-toast {
    top: 56px;
    left: 10px;
    right: 10px;
    max-width: none;
    flex-wrap: wrap;
  }


  body.has-editor .export-card > .export-heading,
  body.has-editor .export-card > #saveButton,
  body.has-editor .export-card > #copyButton,
  body.has-editor .export-card > #shareButton {
    display: none !important;
  }

  body.has-editor .export-card {
    padding: 0;
    border: 0;
    background: transparent;
  }

  body.has-editor.has-batch .export-card {
    padding: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
  }


  body.has-editor .tool-start {
    max-height: 0;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    opacity: 0;
    box-shadow: none;
    pointer-events: none;
  }

  body.has-editor .page-shell {
    padding-bottom: calc(120px + env(safe-area-inset-bottom));
  }

  body.has-editor .editor-section {
    margin-top: 10px;
  }

  body.has-editor .site-bar {
    min-height: 44px;
  }

  body.has-editor .tools-link {
    display: none;
  }

  body.has-editor .quick-action-dock:not([hidden]) {
    left: 8px;
    right: 8px;
    bottom: calc(6px + env(safe-area-inset-bottom));
    display: flex;
  }

  .page-shell {
    width: min(100% - 24px, 720px);
    padding-top: 16px;
  }

  .compact-tool-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .privacy-badge {
    max-width: none;
    width: 100%;
  }

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

  .control-column {
    grid-template-columns: 1fr;
  }

  .use-cases {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-actions {
    gap: 5px;
  }

  .pwa-install-button {
    min-height: 32px;
    padding: 6px 8px;
    font-size: .68rem;
  }

  .tools-link {
    font-size: .76rem;
  }


  .editor-topline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
    margin-bottom: 7px;
  }

  .ready-hint {
    max-width: 100%;
    font-size: .69rem;
    line-height: 1.4;
  }

  .quick-action-dock {
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
  }

  .quick-action-dock .quick-action {
    min-height: 44px;
    padding-inline: 12px;
    font-size: .82rem;
  }

  .editor-header-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .editor-header-actions #replaceButton {
    min-height: 44px;
    padding: 5px 8px;
    font-size: .72rem;
  }

  .editor-header-actions #removeCurrentButton {
    min-height: 44px;
    padding: 3px 5px;
    font-size: .68rem;
  }

  .batch-strip {
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 5px;
    padding: 8px;
  }

  .batch-arrow {
    width: 44px;
    height: 44px;
  }

  .batch-item {
    width: 58px;
  }

  .batch-item img,
  .batch-item-placeholder {
    width: 50px;
    height: 50px;
  }

  .preview-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .site-bar {
    min-height: 50px;
    padding-inline: 12px;
  }

  .page-shell {
    width: min(100% - 16px, 540px);
    padding: 10px 0 52px;
  }

  .tool-start {
    padding: 13px;
    border-radius: 18px;
  }

  .compact-tool-header {
    padding-bottom: 12px;
    margin-bottom: 12px;
  }

  .tool-title-block h1 {
    font-size: 1.65rem;
  }

  .tool-tagline {
    margin-top: 5px;
    font-size: .82rem;
    line-height: 1.55;
  }

  .privacy-badge {
    padding: 8px 10px;
  }

  .privacy-badge strong {
    font-size: .76rem;
  }

  .privacy-badge small {
    font-size: .64rem;
  }

  .editor-topline {
    align-items: flex-start;
  }

  .editor-topline h2 {
    font-size: 1.1rem;
  }

  .drop-zone {
    min-height: 154px;
    padding: 15px 12px;
  }

  .drop-icon {
    width: 42px;
    height: 42px;
    font-size: 1.4rem;
  }

  .upload-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    padding-top: 6px;
  }

  .editor-section {
    margin-top: 10px;
  }

  .preview-toolbar-simple {
    min-height: 28px;
    padding: 0 2px 4px;
  }

  .preview-toolbar-simple .compare-button {
    min-height: 44px;
    padding: 3px 4px;
    font-size: .7rem;
  }

  .canvas-shell {
    min-height: 280px;
    padding: 9px;
    border-radius: 18px;
  }

  #previewCanvas {
    max-height: 62vh;
  }

  .canvas-help {
    max-width: calc(100% - 24px);
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .crop-summary {
    gap: 8px;
    flex-wrap: wrap;
  }

  .crop-summary strong {
    margin-right: 0;
  }

  .edge-control-card,
  .advanced-panel,
  .export-card,
  .privacy-note {
    padding: 15px;
  }

  .control-heading {
    gap: 10px;
  }

  .batch-review {
    align-items: flex-start;
  }

  .explain-section {
    margin-top: 58px;
    padding-top: 32px;
  }

  .faq-section {
    margin-top: 50px;
  }
}

@media (max-width: 520px) {
  .preset-bar {
    margin: 0;
    padding: 6px 7px;
    border-color: #e8edf4;
    border-radius: 12px;
    background: rgba(255, 255, 255, .72);
  }

  .preset-bar-row {
    gap: 8px;
  }

  .preset-copy strong {
    font-size: .74rem;
  }

  .preset-copy span {
    display: none;
  }

  .preset-slots {
    grid-template-columns: repeat(3, 44px);
    gap: 5px;
  }

  .preset-slot {
    min-height: 44px;
    padding: 4px 6px;
    border-radius: 9px;
    font-size: .88rem;
  }

  .preset-slot small {
    top: 2px;
    right: 4px;
    font-size: .54rem;
  }

  .preset-manager {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .preset-manager-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .preset-manager-actions button,
  .batch-review-next {
    min-height: 44px;
  }
}

@media (max-height: 650px) and (min-width: 700px) {
  body.has-editor .export-card > #saveButton,
  body.has-editor .export-card > #copyButton,
  body.has-editor .export-card > #shareButton {
    display: none !important;
  }

  body.has-editor .page-shell {
    padding-bottom: 112px;
  }

  body.has-editor .quick-action-dock:not([hidden]) {
    right: 16px;
    bottom: 16px;
    display: flex;
    width: min(430px, calc(100vw - 32px));
  }

  .page-shell {
    padding-top: 10px;
  }

  .tool-start {
    padding: 16px 20px;
  }

  .compact-tool-header {
    padding-bottom: 10px;
    margin-bottom: 10px;
  }

  .tool-tagline {
    margin-top: 4px;
  }

  .drop-zone {
    min-height: 150px;
    padding-block: 14px;
  }
}

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


/* Saved crop position notice: informational, non-modal, never blocks editing. */
.profile-toast {
  position: fixed;
  left: 50%;
  bottom: calc(112px + env(safe-area-inset-bottom, 0px));
  z-index: 1200;
  width: min(560px, calc(100vw - 28px));
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(22, 29, 40, 0.96);
  color: #ffffff;
  box-shadow: 0 14px 36px rgba(9, 15, 28, 0.24);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.6;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.profile-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (min-width: 821px) and (min-height: 651px) {
  .profile-toast {
    bottom: 24px;
  }
}

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


/* Optional privacy masking: collapsed so edge cropping remains the primary workflow. */
.redaction-panel { border-color: var(--line); }
.redaction-panel summary { align-items: center; }

.redaction-panel-body { padding: 0 18px 18px; }

.redaction-help,
.redaction-safety {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.6;
}

.redaction-tools {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.redaction-tool.is-active {
  border-color: var(--action);
  background: #eef4ff;
  color: var(--action);
}

.redaction-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
}

.redaction-count {
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: var(--action);
  font-size: .7rem;
  font-weight: 800;
}

.redaction-safety { margin-top: 8px; }

@media (max-width: 520px) {
  .redaction-panel-body { padding: 0 14px 14px; }
  .redaction-actions { justify-content: space-between; }
}
