:root {
  --bg: #eef1f4;
  --surface: #ffffff;
  --ink: #17202a;
  --muted: #64707d;
  --line: #d8dee6;
  --blue: #235fb8;
  --blue-dark: #174680;
  --green: #2f7d5b;
  --amber: #b06b1b;
  --shadow: 0 18px 48px rgba(27, 39, 54, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(35, 95, 184, 0.08), rgba(47, 125, 91, 0.07)),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  min-height: 100svh;
  grid-template-columns: minmax(360px, 0.82fr) minmax(420px, 1.18fr);
  gap: clamp(20px, 3vw, 36px);
  padding: clamp(18px, 3vw, 40px);
}

.tool-surface,
.results-panel {
  align-self: start;
  border: 1px solid rgba(216, 222, 230, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.tool-surface {
  position: sticky;
  top: clamp(18px, 3vw, 40px);
  padding: clamp(22px, 3vw, 34px);
}

.tool-header,
.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.35;
  word-break: break-word;
}

.status-pill {
  min-width: 84px;
  border: 1px solid rgba(47, 125, 91, 0.26);
  border-radius: 999px;
  background: rgba(47, 125, 91, 0.1);
  color: var(--green);
  padding: 6px 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.settings-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 10px;
  margin: 28px 0 18px;
}

.control,
.switch {
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 8px 10px;
}

.control span {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.control input,
.control select {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
  outline: 0;
}

.switch {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
}

.switch input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.drop-zone {
  display: grid;
  min-height: 360px;
  place-items: center;
  align-content: center;
  border: 2px dashed #a8b4c2;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(35, 95, 184, 0.08), rgba(47, 125, 91, 0.08)),
    #f7f9fb;
  cursor: pointer;
  padding: 30px;
  text-align: center;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.drop-zone.is-dragging {
  border-color: var(--blue);
  background: rgba(35, 95, 184, 0.13);
  transform: translateY(-2px);
}

.drop-icon {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: white;
}

.drop-icon svg {
  width: 36px;
  height: 36px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.drop-title {
  margin-top: 22px;
  font-size: clamp(24px, 3vw, 34px);
  font-weight: 850;
  line-height: 1.2;
}

.drop-copy {
  max-width: 28rem;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.drop-button,
.secondary-button,
.download-link,
.open-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 8px 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.drop-button {
  margin-top: 22px;
  background: var(--ink);
  color: white;
}

.results-panel {
  min-height: calc(100svh - clamp(36px, 6vw, 80px));
  padding: clamp(20px, 3vw, 30px);
}

.secondary-button {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--ink);
  cursor: pointer;
}

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

.empty-state {
  display: grid;
  min-height: 280px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 18px;
  color: var(--muted);
  font-weight: 700;
}

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

.result-item {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(220px, 0.72fr);
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.preview-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

figure {
  margin: 0;
}

.preview-pair img {
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: 6px;
  background: #e8edf2;
  object-fit: contain;
}

figcaption {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.result-meta {
  align-self: center;
}

.detail-line,
.crop-line {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.crop-line {
  color: var(--amber);
}

.save-line {
  min-height: 20px;
  margin-bottom: 0;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

.item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.download-link {
  background: var(--blue);
  color: #fff;
}

.open-link {
  border-color: var(--line);
  background: #f8fafc;
  color: var(--ink);
}

.download-link:hover,
.open-link:hover,
.drop-button:hover,
.secondary-button:hover {
  filter: brightness(0.96);
}

.download-link:disabled {
  cursor: wait;
  opacity: 0.65;
}

.result-item--error {
  border-color: rgba(176, 107, 27, 0.35);
  background: rgba(176, 107, 27, 0.08);
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .tool-surface {
    position: static;
  }
}

@media (max-width: 620px) {
  .app-shell {
    padding: 12px;
  }

  .tool-header,
  .results-heading,
  .result-item {
    grid-template-columns: 1fr;
  }

  .tool-header,
  .results-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-bar,
  .preview-pair {
    grid-template-columns: 1fr;
  }

  .drop-zone {
    min-height: 300px;
  }
}
