:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --text: #15171a;
  --muted: #6d737c;
  --line: #dfe3e8;
  --accent: #e85d24;
  --accent-dark: #c94716;
  --soft-accent: #fff3eb;
  --danger: #b42318;
  --radius: 22px;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top left, rgba(232, 93, 36, 0.09), transparent 28rem), var(--bg);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 72px;
}

.hero { text-align: center; margin-bottom: 28px; }
.eyebrow, .section-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}
.hero-title {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.hero-title-top {
  display: block;
  font-size: clamp(1.15rem, 2.6vw, 2rem);
  font-weight: 800;
}

.hero-title-bottom {
  display: block;
  margin-top: 8px;
  font-size: clamp(2.1rem, 6vw, 4.25rem);
  font-weight: 900;
}
.hero-text { max-width: 650px; margin: 18px auto 0; color: var(--muted); line-height: 1.8; }

.panel {
  background: var(--panel);
  border: 1px solid rgba(223, 227, 232, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.drop-zone {
  min-height: 350px;
  padding: 48px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: 2px dashed #c7ced8;
  border-radius: var(--radius);
  transition: border-color .2s ease, background .2s ease, transform .2s ease;
  outline: none;
}
.drop-zone:hover, .drop-zone:focus-visible, .drop-zone.is-dragover { border-color: var(--accent); background: var(--soft-accent); }
.drop-zone.is-dragover { transform: scale(.995); }
.drop-icon {
  width: 64px; height: 64px; display: grid; place-items: center; border-radius: 18px;
  margin-bottom: 20px; background: var(--soft-accent); color: var(--accent); font-size: 2rem; font-weight: 300;
}
.drop-title { margin: 0; font-size: clamp(1.2rem, 3vw, 1.65rem); font-weight: 800; }
.drop-sub, .drop-note { color: var(--muted); }
.drop-sub { margin: 12px 0; }
.drop-note { margin: 16px 0 0; font-size: .86rem; }

.button {
  border: 0; border-radius: 12px; padding: 12px 20px; font-weight: 800;
  transition: transform .15s ease, background .15s ease, opacity .15s ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button-primary { background: var(--accent); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--accent-dark); }
.button-secondary { background: #101318; color: #fff; }
.button:disabled { cursor: not-allowed; opacity: .45; }
.button-large { min-height: 52px; padding-inline: 24px; }

.editor { margin-top: 28px; }
.settings-panel { padding: 26px; margin-bottom: 22px; }
.preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.preview-card { padding: 24px; }

.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.text-button { border: 0; background: transparent; color: var(--accent); padding: 4px; font-weight: 700; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.field-group { display: flex; flex-direction: column; gap: 8px; }
.field-group-wide { grid-column: 1 / -1; }
.field-group label { font-size: .9rem; font-weight: 800; }
.field-group input[type="number"], .field-group select {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--text); outline: none;
}
.field-group input:focus, .field-group select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(232,93,36,.14); }
.field-group.is-disabled { opacity: .5; }
.field-note { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-row output { color: var(--accent); font-weight: 800; }

.input-with-suffix { position: relative; }
.input-with-suffix input { padding-right: 54px !important; }
.input-with-suffix span { position: absolute; top: 50%; right: 14px; transform: translateY(-50%); color: var(--muted); font-size: .85rem; font-weight: 700; pointer-events: none; }

.checkbox-field { padding-top: 2px; }
.checkbox-label { display: inline-flex; align-items: center; gap: 10px; width: fit-content; cursor: pointer; }
.checkbox-label input { width: 18px; height: 18px; accent-color: var(--accent); }

input[type="range"] { width: 100%; accent-color: var(--accent); }
.preset-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.preset-button { border: 1px solid var(--line); border-radius: 999px; background: #fff; padding: 9px 14px; font-weight: 700; }
.preset-button:hover { border-color: var(--accent); color: var(--accent); background: var(--soft-accent); }

.conversion-note {
  margin-top: 18px; padding: 13px 15px; border-radius: 12px; background: var(--soft-accent); color: #234;
  font-size: .88rem; line-height: 1.6;
}
.action-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.status-message { min-height: 1.5em; margin: 14px 0 0; color: #186a3b; font-weight: 700; }
.status-message.is-error { color: var(--danger); }

.image-frame {
  width: 100%; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px;
}
.checkerboard {
  background-color: #f8f9fb;
  background-image: linear-gradient(45deg,#eceff3 25%,transparent 25%), linear-gradient(-45deg,#eceff3 25%,transparent 25%), linear-gradient(45deg,transparent 75%,#eceff3 75%), linear-gradient(-45deg,transparent 75%,#eceff3 75%);
  background-size: 22px 22px; background-position: 0 0,0 11px,11px -11px,-11px 0;
}
.image-frame img { width: 100%; height: 100%; object-fit: contain; }
.stats { margin: 18px 0 0; display: grid; gap: 10px; }
.stats div { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding-bottom: 10px; border-bottom: 1px solid #eef0f3; }
.stats div:last-child { border-bottom: 0; padding-bottom: 0; }
.stats dt { color: var(--muted); font-size: .88rem; }
.stats dd { margin: 0; font-weight: 800; text-align: right; }

.hidden, .visually-hidden { display: none !important; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 20px, 1180px); padding: 34px 0 50px; }
  .drop-zone { min-height: 290px; padding: 36px 18px; }
  .settings-grid, .preview-grid { grid-template-columns: 1fr; }
  .field-group-wide { grid-column: auto; }
  .settings-panel, .preview-card { padding: 18px; }
  .section-heading { align-items: center; }
  .action-row .button { width: 100%; }
}

.section-note { margin: 7px 0 0; color: var(--muted); font-size: .88rem; }
.batch-panel { padding: 24px; }
.image-list { display: grid; gap: 18px; }
.batch-item { border: 1px solid var(--line); border-radius: 18px; padding: 18px; background: #fff; }
.batch-title-row { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; margin-bottom: 14px; }
.batch-title-row strong { overflow-wrap: anywhere; }
.batch-title-row span { flex: 0 0 auto; color: var(--muted); font-size: .85rem; }
.compare-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.compare-label { margin: 0 0 8px; font-weight: 800; font-size: .88rem; }
.image-meta { margin: 9px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.55; }
.empty-result { color: var(--muted); font-size: .9rem; font-weight: 700; }

@media (max-width: 760px) {
  .compare-grid { grid-template-columns: 1fr; }
  .batch-panel { padding: 18px; }
  .batch-title-row { align-items: flex-start; flex-direction: column; gap: 4px; }
}


@media (max-width: 480px) {
  .hero-title-top {
    font-size: clamp(1rem, 5vw, 1.25rem);
  }

  .hero-title-bottom {
    margin-top: 6px;
    font-size: clamp(2rem, 10vw, 2.8rem);
  }
}
