:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --ink: #101828;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #d4deeb;
  --blue: #2f6fed;
  --blue-dark: #1e4fc4;
  --blue-soft: #eaf1ff;
  --green: #0f9f6e;
  --green-soft: #e9f9f2;
  --red: #d14343;
  --red-soft: #fff1f1;
  --amber: #b7791f;
  --amber-soft: #fff9ec;
  --shadow: 0 30px 80px rgba(15, 23, 42, .10);
  --radius: 22px;
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font-family: "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 8% -10%, rgba(47, 111, 237, .16), transparent 62%),
    radial-gradient(760px 460px at 100% 0%, rgba(16, 185, 129, .12), transparent 58%),
    linear-gradient(rgba(15, 23, 42, .032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .032) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 62%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 62%, transparent 100%);
}

a { color: inherit; }

button,
input,
summary { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(980px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 64px;
}

/* --------------------------------------------------------------------------
   Top bar / brand / group button
   -------------------------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 46px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  user-select: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 8px 18px rgba(47, 111, 237, .28);
}

.brand-mark svg { width: 23px; height: 23px; }

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.04em;
}

.brand-name span { color: var(--blue); }

.group-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .45);
  border-radius: 999px;
  background: linear-gradient(135deg, #18b8f2, #0a84ff);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 9px 24px rgba(10, 132, 255, .24);
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease;
}

.group-button svg { width: 17px; height: 17px; flex: none; }

.group-button:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(10, 132, 255, .3);
}

.group-button:focus-visible,
.brand:focus-visible,
.primary:focus-visible,
.download:focus-visible,
.drop:focus-visible,
summary:focus-visible,
.clear-file:focus-visible {
  outline: 3px solid rgba(47, 111, 237, .28);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero { margin-bottom: 26px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 11px;
  border: 1px solid #ccdbfa;
  border-radius: 999px;
  background: rgba(238, 244, 255, .8);
  color: #2b5bd7;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2f6fed;
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .12);
}

h1 {
  margin: 16px 0 0;
  font-size: clamp(44px, 8vw, 76px);
  line-height: .95;
  letter-spacing: -.06em;
  font-weight: 850;
}

h1 .arrow { color: var(--blue); }

/* --------------------------------------------------------------------------
   Main card
   -------------------------------------------------------------------------- */

.card {
  position: relative;
  overflow: hidden;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .84);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .9);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #2f6fed, #38bdf8 40%, #34d399 72%, transparent);
}

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

.card-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -.02em;
}

.card-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
}

.card-head code {
  padding: 1px 5px;
  border: 1px solid #dce5f0;
  border-radius: 5px;
  background: #f7f9fc;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: .92em;
}

.card-tag {
  flex: none;
  padding: 5px 9px;
  border: 1px solid #dbe6f6;
  border-radius: 8px;
  background: #f7faff;
  color: #5a6b85;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   Drop zone
   -------------------------------------------------------------------------- */

.drop-wrap { position: relative; }

.drop {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 154px;
  padding: 22px;
  border: 1.5px dashed #c7d6ee;
  border-radius: 17px;
  background:
    radial-gradient(420px 200px at 15% 0%, rgba(47, 111, 237, .06), transparent 70%),
    linear-gradient(180deg, #fcfdff, #f4f8ff);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}

.drop:hover,
.drop.dragging {
  border-color: var(--blue);
  background:
    radial-gradient(420px 200px at 15% 0%, rgba(47, 111, 237, .12), transparent 70%),
    linear-gradient(180deg, #fbfdff, #edf4ff);
  box-shadow: 0 0 0 4px rgba(47, 111, 237, .08);
  transform: translateY(-1px);
}

.drop.has-file {
  min-height: 116px;
  border-style: solid;
  border-color: #bfe7d7;
  background:
    radial-gradient(420px 200px at 15% 0%, rgba(16, 185, 129, .09), transparent 70%),
    linear-gradient(180deg, #fbfffd, #f0fbf6);
}

.drop.is-busy {
  pointer-events: none;
  opacity: .68;
}

.drop.has-file .drop-copy { padding-right: 34px; }

.drop-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 15px;
  background: #e8f0ff;
  color: var(--blue);
  transition: background .18s ease, color .18s ease;
}

.drop-icon svg { width: 26px; height: 26px; }

.drop.has-file .drop-icon {
  background: #dcf7ea;
  color: var(--green);
}

.drop-copy {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.drop-copy strong {
  overflow: hidden;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drop-copy small {
  color: var(--muted);
  font-size: 12.5px;
}

.clear-file {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid #e0e8f2;
  border-radius: 50%;
  background: #fff;
  color: #7b8aa1;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(15, 23, 42, .06);
  transition: color .16s ease, border-color .16s ease, background .16s ease;
}

.clear-file svg { width: 14px; height: 14px; }

.clear-file:hover {
  border-color: #f0caca;
  background: #fff7f7;
  color: var(--red);
}

.clear-file:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.clear-file[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Form / advanced
   -------------------------------------------------------------------------- */

.form-row { margin-top: 18px; }

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}

.field > span {
  color: #5b6b82;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: .025em;
}

.field input {
  width: 100%;
  height: 46px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.field input::placeholder { color: #a2aebe; }

.field input:hover { border-color: #b9c8dc; }

.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, .13);
}

.advanced {
  margin-top: 14px;
  border: 1px solid #e4eaf3;
  border-radius: 14px;
  background: #fbfcff;
  overflow: hidden;
}

.advanced summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 13px 15px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.advanced summary::-webkit-details-marker { display: none; }

.advanced-title {
  font-size: 13px;
  font-weight: 750;
}

.advanced-hint {
  color: var(--muted-2);
  font-size: 11.5px;
}

.advanced .chevron {
  width: 17px;
  height: 17px;
  margin-left: auto;
  color: #8a99ad;
  transition: transform .18s ease;
}

.advanced[open] .chevron { transform: rotate(180deg); }
.advanced[open] summary { border-bottom: 1px solid #edf1f7; }

.advanced-body { padding: 15px; }

.origin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed #e5ebf3;
  cursor: pointer;
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.switch-copy strong { font-size: 12.5px; }

.switch-copy small {
  color: var(--muted);
  font-size: 11px;
}

.switch-control {
  position: relative;
  display: inline-flex;
  flex: none;
}

.switch-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 44px;
  height: 25px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background .18s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(15, 23, 42, .2);
  transition: transform .18s ease;
}

.switch-input:checked + .switch-track { background: var(--green); }
.switch-input:checked + .switch-track::after { transform: translateX(19px); }
.switch-input:focus-visible + .switch-track { outline: 3px solid rgba(15, 159, 110, .22); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Primary button / hint
   -------------------------------------------------------------------------- */

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  height: 52px;
  margin-top: 18px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(135deg, #3b7bf6, #2f6fed 55%, #1e4fc4);
  color: #fff;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .01em;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(47, 111, 237, .24);
  transition: transform .16s ease, filter .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.primary svg {
  width: 19px;
  height: 19px;
  transition: transform .16s ease;
}

.primary:hover:not(:disabled) {
  filter: brightness(1.04);
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(47, 111, 237, .3);
}

.primary:hover:not(:disabled) svg { transform: translateX(3px); }

.primary:disabled {
  cursor: not-allowed;
  opacity: 1;
  background: #e8eef7;
  color: #8b9bb0;
  box-shadow: none;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted-2);
  font-size: 11.5px;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Status
   -------------------------------------------------------------------------- */

.status {
  margin-top: 20px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface-soft);
  transition: border-color .18s ease, background .18s ease;
}

.status[hidden] { display: none; }

.status[data-state="running"] {
  border-color: #c9dcff;
  background: #f6f9ff;
}

.status[data-state="ok"] {
  border-color: #c7ead9;
  background: #f3fbf7;
}

.status[data-state="bad"] {
  border-color: #f2cccc;
  background: #fff7f7;
}

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

.status-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.status-kicker {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.status[data-state="ok"] .status-kicker { color: var(--green); }
.status[data-state="bad"] .status-kicker { color: var(--red); }

#status-text {
  font-size: 14px;
  letter-spacing: -.01em;
}

.status-percent {
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 11.5px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.status[data-state="ok"] .status-percent { background: #ddf5e9; color: #087a54; }
.status[data-state="bad"] .status-percent { background: #ffe3e3; color: #b33131; }

.bar {
  height: 7px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf6;
}

#bar-fill {
  position: relative;
  width: 0;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, #6aa0ff, #2f6fed);
  transition: width .25s ease;
}

.status[data-state="running"] #bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

.status[data-state="ok"] #bar-fill { background: linear-gradient(90deg, #47cf9a, #0f9f6e); }
.status[data-state="bad"] #bar-fill { background: linear-gradient(90deg, #ef8a8a, #d14343); }

.status-detail {
  margin-top: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(148, 163, 184, .18);
}

.mini-stats div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mini-stats span {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .05em;
}

.mini-stats strong {
  overflow: hidden;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Result
   -------------------------------------------------------------------------- */

.result {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid #c8ebda;
  border-radius: 15px;
  background: linear-gradient(135deg, #f1fcf6, #e9f9f1);
}

.result[hidden] { display: none; }

.result-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: #d9f6e8;
  color: var(--green);
}

.result-icon svg { width: 20px; height: 20px; }

.result-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.result-copy strong { font-size: 13px; }

.result-copy span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 18px;
  border-radius: 11px;
  background: linear-gradient(180deg, #1fb57c, #0f9f6e);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 9px 20px rgba(15, 159, 110, .22);
  transition: transform .16s ease, filter .16s ease;
}

.download svg { width: 17px; height: 17px; }

.download:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Warnings
   -------------------------------------------------------------------------- */

.warnings {
  margin-top: 14px;
  border: 1px solid #f0dfbf;
  border-radius: 13px;
  background: var(--amber-soft);
  color: #6b4d1f;
  font-size: 12px;
}

.warnings[hidden] { display: none; }

.warnings summary {
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 750;
  color: var(--amber);
}

.warnings pre {
  max-height: 240px;
  margin: 0;
  padding: 0 14px 13px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 11.5px;
  line-height: 1.65;
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */

@media (max-width: 620px) {
  .shell {
    width: calc(100% - 24px);
    padding: 16px 0 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 10px;
    margin-bottom: 30px;
  }

  .brand { gap: 9px; }

  .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }

  .brand-mark svg { width: 20px; height: 20px; }

  .brand-name { font-size: 16px; }

  .group-button {
    min-height: 38px;
    padding: 0 12px;
    gap: 6px;
    font-size: 11.5px;
  }

  .group-button svg { width: 15px; height: 15px; }

  .hero { margin-bottom: 20px; }

  .badge {
    padding: 5px 10px;
    font-size: 10px;
  }

  h1 {
    margin-top: 12px;
    font-size: clamp(40px, 14vw, 58px);
    letter-spacing: -.05em;
  }

  .card {
    padding: 16px;
    border-radius: 19px;
  }

  .card-head {
    margin-bottom: 14px;
  }

  .card-head h2 { font-size: 16px; }
  .card-head p { margin-top: 4px; font-size: 11.5px; }
  .card-tag { display: none; }

  .drop {
    min-height: 128px;
    padding: 16px;
    gap: 12px;
    border-radius: 14px;
  }

  .drop-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .drop-icon svg { width: 23px; height: 23px; }

  .drop-copy strong { font-size: 15px; }
  .drop-copy small { font-size: 11.5px; }

  .clear-file {
    top: 9px;
    right: 9px;
    width: 28px;
    height: 28px;
  }

  .form-row { margin-top: 14px; }

  .field input {
    height: 44px;
    /* 16px avoids the automatic zoom in iOS Safari. */
    font-size: 16px;
  }

  .advanced summary { padding: 12px 13px; }
  .advanced-body { padding: 13px; }
  .advanced-hint { font-size: 10.5px; }

  .origin-grid { gap: 8px; }

  .switch-row {
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
  }

  .primary {
    height: 50px;
    margin-top: 15px;
    font-size: 15px;
  }

  .hint { font-size: 10.5px; }

  .status {
    margin-top: 16px;
    padding: 13px;
  }

  .status-detail { font-size: 11px; }

  .mini-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 14px;
  }

  .result {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    padding: 13px;
  }

  .result-icon { width: 34px; height: 34px; }

  .result-copy span {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .download {
    width: 100%;
    height: 46px;
  }

  .warnings pre { max-height: 190px; }
}

@media (max-width: 370px) {
  .brand-name { font-size: 15px; }

  .group-button {
    padding: 0 10px;
    font-size: 10.5px;
  }

  .group-button span { letter-spacing: -.02em; }

  h1 { font-size: 38px; }

  .advanced-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
