:root {
  --bg: #f4f6fb; --surface: #ffffff; --surface-2: #f0f3fa; --text: #172033; --muted: #5a6478;
  --border: #dde2ee; --accent: #3358e0; --accent-2: #7b4dff; --accent-soft: #e8edff;
  --ok: #178a57; --ok-soft: #e3f6ec; --warn: #b45309; --warn-soft: #fff3e0;
  --bad: #c62839; --bad-soft: #fdebed; --shadow: 0 10px 30px rgba(30, 45, 90, .08);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131c; --surface: #181e2b; --surface-2: #202839; --text: #e8ecf5; --muted: #98a2b8;
    --border: #2b3447; --accent: #7c9bff; --accent-2: #a98bff; --accent-soft: #232d52;
    --ok: #52d49a; --ok-soft: #153126; --warn: #f4b35e; --warn-soft: #382a15;
    --bad: #ff7b8a; --bad-soft: #3a1b21; --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text); background: var(--bg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  position: relative; overflow-x: hidden;
}
/* Soft moving colour behind the page. */
body::before, body::after {
  content: ""; position: fixed; z-index: -1; width: 60vmax; height: 60vmax; border-radius: 50%;
  filter: blur(90px); opacity: .22; pointer-events: none;
}
body::before { background: var(--accent); top: -30vmax; left: -20vmax; animation: drift 24s ease-in-out infinite alternate; }
body::after { background: var(--accent-2); bottom: -32vmax; right: -22vmax; animation: drift 30s ease-in-out infinite alternate-reverse; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.12); } }

a { color: var(--accent); }
.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }
.wrap.wide { max-width: 1000px; }

header.top { display: flex; align-items: center; gap: 12px; padding: 18px 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 19px;
  color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.logo { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-size: 16px; }
.spacer { flex: 1; }

/* availability pill */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; font-size: 13px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  color: var(--muted); transition: background .4s, color .4s, border-color .4s; }
.pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); position: relative; }
.pill.ready { color: var(--ok); background: var(--ok-soft); border-color: transparent; }
.pill.ready .dot { background: var(--ok); }
.pill.ready .dot::after, .pill.starting .dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit;
  animation: ping 1.8s cubic-bezier(0, 0, .2, 1) infinite; }
.pill.starting, .pill.stopped { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.pill.starting .dot, .pill.stopped .dot { background: var(--warn); }
.pill.offline { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.pill.offline .dot { background: var(--bad); }
@keyframes ping { 75%, 100% { transform: scale(2.6); opacity: 0; } }

.hero { padding: 18px 0 8px; }
.hero h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 0 0 10px; letter-spacing: -.02em; }
.hero h1 span { background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--muted); font-size: 17px; max-width: 56ch; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; margin: 18px 0; box-shadow: var(--shadow); }
.reveal { animation: rise .55s cubic-bezier(.2, .8, .2, 1) both; }
.reveal:nth-child(2) { animation-delay: .06s; } .reveal:nth-child(3) { animation-delay: .12s; }
.reveal:nth-child(4) { animation-delay: .18s; } .reveal:nth-child(5) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

.card h2 { margin: 0 0 14px; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
@media (max-width: 600px) { .grid { grid-template-columns: 1fr; } }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--muted); }
label.field.full { grid-column: 1 / -1; }
input[type=text], input[type=email], input[type=tel], textarea {
  font: inherit; color: var(--text); background: var(--surface-2); border: 1.5px solid transparent;
  border-radius: 11px; padding: 11px 13px; width: 100%; transition: border-color .2s, background .2s, box-shadow .2s; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft); }
textarea { resize: vertical; min-height: 78px; }

/* key input */
.key-box { position: relative; }
.key-box input { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 18px;
  letter-spacing: .08em; padding-right: 48px; }
.key-box .state { display: grid; place-items: center; color: var(--bad); position: absolute; right: 12px; top: 50%; width: 26px; height: 26px; margin-top: -13px; }
.key-box.valid input { border-color: var(--ok); background: var(--ok-soft); }
.key-box.invalid input { border-color: var(--bad); background: var(--bad-soft); animation: shake .4s; }
.key-msg { font-size: 13px; min-height: 20px; margin-top: 6px; }
.key-msg.bad { color: var(--bad); } .key-msg.good { color: var(--ok); }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

/* drop zone */
.drop { border: 2px dashed var(--border); border-radius: 14px; padding: 28px 16px; text-align: center;
  color: var(--muted); cursor: pointer; transition: all .25s; background: var(--surface-2); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--accent); background: var(--accent-soft);
  transform: scale(1.01); }
.drop .icon { font-size: 30px; display: block; margin-bottom: 4px; transition: transform .3s; }
.drop.over .icon { transform: translateY(-6px) scale(1.15); }
.drop small { display: block; margin-top: 4px; }
.files { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.files li { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--surface-2);
  border-radius: 11px; animation: pop .3s cubic-bezier(.2, .9, .3, 1.3) both; }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(6px); } }
.files .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .size { color: var(--muted); font-size: 13px; }
.files button { border: 0; background: none; color: var(--muted); font-size: 18px; cursor: pointer;
  border-radius: 8px; width: 28px; height: 28px; }
.files button:hover { background: var(--bad-soft); color: var(--bad); }

/* buttons */
.btn { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 12px 22px; cursor: pointer;
  color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; position: relative;
  overflow: hidden; transition: transform .15s, box-shadow .2s, opacity .2s; box-shadow: 0 6px 18px rgba(51, 88, 224, .3); }
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(51, 88, 224, .38); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn.ghost { color: var(--text); background: var(--surface-2); box-shadow: none; }
.btn.ghost:hover:not(:disabled) { background: var(--accent-soft); box-shadow: none; }
.btn.block { width: 100%; padding: 15px; font-size: 17px; }
.btn .fill { position: absolute; inset: 0 auto 0 0; background: rgba(255, 255, 255, .28); width: 0; transition: width .2s; }
.btn > span { position: relative; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor;
  border-right-color: transparent; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.notice { padding: 12px 15px; border-radius: 12px; font-size: 14.5px; margin: 14px 0 0; animation: rise .4s both; }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.notice.warn { background: var(--warn-soft); color: var(--warn); }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.info { background: var(--accent-soft); color: var(--accent); }
.hint { color: var(--muted); font-size: 13.5px; }

/* progress view */
.run-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.run-head h2 { margin: 0; flex: 1; min-width: 200px; }
.timer { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 14px; }
.stage { display: grid; grid-template-columns: 190px 1fr; gap: 26px; align-items: center; margin-top: 18px; }
@media (max-width: 640px) { .stage { grid-template-columns: 1fr; justify-items: center; text-align: center; } }
.ring { position: relative; width: 170px; height: 170px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.ring .track { stroke: var(--surface-2); }
.ring .bar { stroke: url(#ring-gradient); stroke-linecap: round; transition: stroke-dashoffset .9s cubic-bezier(.3, .7, .2, 1); }
.ring.working .bar { filter: drop-shadow(0 0 6px var(--accent)); }
.ring .pct { position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center;
  padding-top: 62px;
  font-size: 38px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring .pct small { font-size: 18px; font-weight: 600; color: var(--muted); }
.ring.failed .bar { stroke: var(--bad); filter: none; }
.headline { font-size: 21px; font-weight: 700; margin: 0 0 4px; transition: opacity .25s, transform .25s; }
.headline.swap { opacity: 0; transform: translateY(6px); }
.sub { color: var(--muted); font-size: 14.5px; min-height: 22px; }

.steps { list-style: none; margin: 22px 0 0; padding: 0; position: relative; }
.step { display: flex; gap: 14px; padding: 9px 0; position: relative; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 14px; top: 38px; bottom: -9px; width: 2px;
  background: var(--border); transition: background .6s; }
.step.done:not(:last-child)::before { background: var(--ok); }
.step .mark { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  border: 2px solid var(--border); background: var(--surface); transition: all .4s; position: relative; z-index: 1; }
.step .mark svg { width: 16px; height: 16px; fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.step .mark .check, .step .mark .cross { stroke: #fff; display: none; stroke-dasharray: 24; stroke-dashoffset: 24; }
.step.done .mark { background: var(--ok); border-color: var(--ok); }
.step.done .mark .check { display: block; animation: draw .5s .1s ease forwards; }
.step.failed .mark { background: var(--bad); border-color: var(--bad); }
.step.failed .mark .cross { display: block; animation: draw .4s ease forwards; }
.step.active .mark { border-color: var(--accent); }
.step.active .mark::after { content: ""; position: absolute; inset: -6px; border-radius: 50%;
  border: 2px solid var(--accent); border-top-color: transparent; animation: spin 1s linear infinite; }
.step.active .mark::before { content: ""; width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.55); opacity: .6; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.step .text { padding-top: 3px; }
.step .label { font-weight: 600; color: var(--muted); transition: color .3s; }
.step.active .label, .step.done .label { color: var(--text); }
.step.failed .label { color: var(--bad); }
.step .detail { font-size: 13.5px; color: var(--muted); min-height: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { padding: 6px 13px; border-radius: 999px; font-size: 13.5px; background: var(--surface-2);
  color: var(--muted); border: 1px solid transparent; transition: all .4s; display: inline-flex; gap: 6px; align-items: center; }
.chip.running { color: var(--accent); background: var(--accent-soft); border-color: var(--accent);
  animation: glow 1.6s ease-in-out infinite; }
.chip.done { color: var(--ok); background: var(--ok-soft); }
.chip.done::before { content: "✓"; font-weight: 700; animation: pop .35s both; }
@keyframes glow { 50% { box-shadow: 0 0 0 5px var(--accent-soft); } }

.share { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border); }
.share code { flex: 1; min-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: var(--surface-2); padding: 6px 10px; border-radius: 8px; font-size: 12.5px; }

/* result */
.result-top { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.score { width: 112px; height: 112px; border-radius: 50%; display: grid; place-content: center; text-align: center;
  background: conic-gradient(var(--accent) calc(var(--p, 0) * 1%), var(--surface-2) 0); position: relative; flex: none; }
.score::before { content: ""; position: absolute; inset: 9px; background: var(--surface); border-radius: 50%; }
.score b, .score small { position: relative; }
.score b { font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }
.score small { color: var(--muted); font-size: 12px; }
.result-top .summary { flex: 1; min-width: 240px; }
.result-top h2 { margin: 0 0 6px; font-size: 20px; }
.result-top p { margin: 6px 0 0; color: var(--muted); font-size: 15px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 18px; }
.tile { background: var(--surface-2); border-radius: 13px; padding: 13px 15px; animation: rise .5s both; }
.tile .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; }
.tile .v { font-size: 20px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.tile .v.small { font-size: 15px; }
.tile .d { color: var(--muted); font-size: 13px; }
.tile.bad .v { color: var(--bad); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.preview-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.preview-head h2 { margin: 0; flex: 1; }
.paper { background: #fff; border-radius: 12px; border: 1px solid var(--border); overflow: hidden; position: relative; }
.paper iframe { display: block; width: 100%; height: 78vh; min-height: 480px; border: 0; background: #fff; }
.paper .loading { position: absolute; inset: 0; display: grid; place-items: center; color: #5a6478; background: #fff; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 20; overflow: hidden; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 14px; opacity: .9; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .2; } }

footer.legal { color: var(--muted); font-size: 12.5px; padding: 8px 0 40px; }

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

.tick-path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .45s ease forwards; }
