:root {
  color-scheme: light;
  --page: #f5f7f7;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --text: #17201d;
  --muted: #65726e;
  --line: #d8e0dd;
  --accent: #0f766e;
  --accent-soft: #e6f3f1;
  --danger: #b42318;
  --shadow: 0 18px 48px rgb(23 32 29 / 0.08);
  background: var(--page);
  color: var(--text);
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input {
  font: inherit;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar strong {
  font-size: 17px;
}

.topbar span,
.panel-title p,
.section-head p,
.drop-target small,
.drop-target em,
.notice,
.form-message,
.progress-head span,
.job-button small,
.empty-state {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.topbar span {
  margin-left: 8px;
}

.service-state {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 5px 10px;
  white-space: nowrap;
}

.service-state.is-ready {
  background: var(--accent-soft);
  border-color: #99d1ca;
  color: #0b5f59;
}

.workbench-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  margin: 24px auto;
  max-width: 1280px;
  padding: 0 20px 40px;
}

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

.upload-panel {
  align-self: start;
  display: grid;
  gap: 16px;
}

.result-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

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

h1,
h2 {
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.15;
}

.panel-title,
.section-head {
  display: grid;
  gap: 6px;
}

.section-head {
  align-items: start;
  grid-template-columns: minmax(0, 1fr) auto;
}

.drop-target {
  align-items: center;
  background: var(--surface-soft);
  border: 2px dashed #9cc9c4;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  justify-content: center;
  min-height: 220px;
  padding: 32px 20px;
  text-align: center;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.drop-target:hover,
.drop-target.is-dragging {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.drop-target input {
  display: none;
}

.drop-target span {
  color: var(--text);
  font-size: 18px;
  font-weight: 760;
}

.drop-target em {
  font-style: normal;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notice,
.progress-block,
.empty-state,
.job-button {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.notice strong {
  color: var(--text);
  display: block;
  margin-bottom: 3px;
}

.hidden {
  display: none;
}

.primary-action,
.secondary-action,
.download-action {
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 42px;
  text-decoration: none;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
  white-space: nowrap;
}

.primary-action,
.download-action.is-primary {
  background: #17201d;
  border: 1px solid #17201d;
  color: #ffffff;
  padding: 0 16px;
  width: 100%;
}

.primary-action:not(:disabled):hover,
.download-action.is-primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.primary-action:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.secondary-action,
.download-action {
  background: var(--surface);
  border: 1px solid #c5d0cc;
  color: var(--text);
  padding: 0 13px;
}

.secondary-action:hover,
.download-action:hover {
  border-color: var(--accent);
  color: #0b5f59;
}

.form-message {
  color: var(--danger);
  min-height: 18px;
}

.progress-block {
  display: grid;
  gap: 10px;
}

.progress-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.progress-head strong {
  font-size: 16px;
}

.progress-meter {
  background: #dce5e2;
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  width: 100%;
}

.progress-meter span {
  background: var(--accent);
  display: block;
  height: 100%;
  transition: width 240ms ease;
  width: 0%;
}

.job-list {
  display: grid;
  gap: 10px;
}

.job-button {
  color: inherit;
  cursor: pointer;
  display: grid;
  gap: 4px;
  text-align: left;
  width: 100%;
}

.job-button:hover,
.job-button.is-active {
  background: var(--accent-soft);
  border-color: #99d1ca;
}

.result-area {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.result-head {
  align-items: end;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.result-head h2 {
  font-size: 21px;
}

.section-kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 4px;
}

.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compare-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.compare-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px;
}

.compare-frame {
  aspect-ratio: 1 / 1;
  background: var(--surface-soft);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.compare-frame img {
  display: block;
  height: 100%;
  inset: 0;
  object-fit: contain;
  position: absolute;
  width: 100%;
}

.after-wrap {
  clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0);
  inset: 0;
  position: absolute;
}

.compare-label {
  background: rgb(255 255 255 / 0.88);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
  position: absolute;
  top: 9px;
}

.compare-label.before {
  left: 9px;
}

.compare-label.after {
  right: 9px;
}

.compare-slider {
  appearance: none;
  background: transparent;
  bottom: 10px;
  height: 28px;
  left: 10px;
  position: absolute;
  right: 10px;
  width: calc(100% - 20px);
}

.compare-slider::-webkit-slider-thumb {
  appearance: none;
  background: #ffffff;
  border: 3px solid var(--accent);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgb(23 32 29 / 0.22);
  height: 26px;
  width: 26px;
}

.compare-slider::-moz-range-thumb {
  background: #ffffff;
  border: 3px solid var(--accent);
  border-radius: 999px;
  box-shadow: 0 3px 10px rgb(23 32 29 / 0.22);
  height: 20px;
  width: 20px;
}

.compare-meta {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  min-width: 0;
}

.compare-meta strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
  }

  .workbench-grid {
    grid-template-columns: 1fr;
    margin-top: 16px;
    padding: 0 14px 28px;
  }

  .section-head,
  .progress-head,
  .result-head,
  .compare-meta {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .progress-head,
  .result-head,
  .compare-meta {
    flex-direction: column;
  }

  .secondary-action,
  .download-action {
    width: 100%;
  }
}
