:root {
  --bg: #0d0f14;
  --panel: #151922;
  --panel-2: #1b2130;
  --line: #262d3d;
  --text: #e8ecf4;
  --muted: #8a93a6;
  --accent: #6aa6ff;
  --accent-2: #3f7ae0;
  --ok: #4ec9a4;
  --err: #ff6b6b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #182033 0%, var(--bg) 55%);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

h1 {
  margin: 0 0 6px;
  font-size: 26px;
}

h2 {
  margin: 0;
  font-size: 16px;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.sub a {
  color: var(--accent);
}

.badge {
  flex: none;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.badge.on {
  color: var(--ok);
  border-color: rgba(78, 201, 164, 0.35);
}

.badge.warn {
  color: #e8b64c;
  border-color: rgba(232, 182, 76, 0.35);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.dropzone {
  border: 1.5px dashed var(--line);
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.dragging {
  border-color: var(--accent);
  background: rgba(106, 166, 255, 0.06);
}

.dz-icon {
  font-size: 26px;
  color: var(--accent);
  line-height: 1;
}

.dz-title {
  margin: 10px 0 4px;
  font-weight: 600;
}

.dz-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.dz-filled {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
}

.dz-filled img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
}

.dz-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.dz-meta strong {
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dz-meta span {
  color: var(--muted);
  font-size: 12px;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  align-items: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
}

.field-out strong {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  gap: 3px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.segmented button {
  min-width: 52px;
  padding: 7px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--accent);
  color: #0b1220;
  font-weight: 600;
}

.primary {
  width: 100%;
  padding: 13px 18px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #071018;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

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

.ghost {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
}

.ghost.small {
  padding: 6px 10px;
  font-size: 12px;
}

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
  margin: 16px 0 8px;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--ok));
  transition: width 0.2s;
}

.status {
  min-height: 20px;
  margin: 6px 2px 14px;
  color: var(--muted);
  font-size: 13px;
}

.status.err {
  color: var(--err);
}

.result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.result-meta {
  flex: 1;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.compare {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #0a0c11;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}

.cmp-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
}

.cmp-clip {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--pos, 50%);
  overflow: hidden;
  pointer-events: none;
}

.cmp-under {
  right: auto;
  bottom: auto;
  width: auto;
  max-width: none;
}

.cmp-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos, 50%);
  width: 2px;
  background: var(--accent);
  transform: translateX(-1px);
  box-shadow: 0 0 12px rgba(106, 166, 255, 0.6);
}

.cmp-handle span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: rgba(11, 18, 32, 0.85);
}

.cmp-tag {
  position: absolute;
  top: 10px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(8, 12, 20, 0.72);
  color: var(--muted);
  font-size: 11px;
  pointer-events: none;
}

.cmp-tag-left {
  left: 10px;
}

.cmp-tag-right {
  right: 10px;
}

.hint {
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 620px) {
  .app {
    padding: 26px 14px 60px;
  }

  .head {
    flex-direction: column;
  }
}
