:root {
  --bg: #f6f6f7;
  --card: #ffffff;
  --ink: #14161a;
  --muted: #6b7280;
  --line: #e6e7ea;
  --accent: #ff5a1f;
  --ok: #0f9d76;
  --err: #d92d20;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(16, 18, 22, .04), 0 8px 24px rgba(16, 18, 22, .06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a20;
    --ink: #eceef2;
    --muted: #9aa1ad;
    --line: #262a32;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  max-width: 860px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.ghostlink {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.ghostlink:hover { color: var(--ink); }

.wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 20px 40px;
  display: grid;
  gap: 18px;
}

.hero h1 {
  font-size: clamp(22px, 5vw, 30px);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 10px 0 8px;
}

.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }
.note { margin-top: 12px; }

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

.gate { max-width: 380px; margin: 6vh auto 0; }
.gate h1 { margin: 0 0 4px; font-size: 22px; }

.field {
  width: 100%;
  margin: 14px 0 10px;
  padding: 13px 14px;
  font-size: 16px;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}

.drop {
  display: block;
  position: relative;
  border: 1.5px dashed var(--line);
  border-radius: 14px;
  background: var(--bg);
  padding: 30px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--bg)); }
.drop.has-file { padding: 10px; border-style: solid; }

.drop-inner { display: grid; gap: 6px; justify-items: center; }
.drop.has-file .drop-inner { display: none; }

.ico {
  width: 26px; height: 26px; fill: none;
  stroke: var(--accent); stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}

#thumb {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: contain;
  border-radius: 10px;
}

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0; }
@media (max-width: 460px) { .modes { grid-template-columns: 1fr; } }

.chip { position: relative; display: block; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  transition: border-color .15s, background .15s;
}
.chip strong { font-weight: 600; font-size: 15px; }
.chip em { font-style: normal; font-size: 13px; color: var(--muted); }
.chip input:checked + span {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--bg));
}
.chip input:focus-visible + span { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  font: inherit;
  font-weight: 600;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform .06s, opacity .15s, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn.wide { width: 100%; }
.btn.primary { background: var(--ink); color: var(--card); }
.btn.primary:hover { opacity: .9; }
.btn.primary:disabled { opacity: .35; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); margin-top: 10px; }
.btn.ghost:hover { color: var(--ink); }

.err { color: var(--err); font-size: 14px; margin: 10px 0 0; }

.spinner {
  width: 34px; height: 34px; margin: 6px auto 14px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
@media (max-width: 520px) { .compare { grid-template-columns: 1fr; } }

.compare figure { margin: 0; display: grid; gap: 6px; }
.compare img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.compare figcaption { font-size: 13px; color: var(--muted); text-align: center; }

.foot { text-align: center; padding: 10px 20px 28px; }
