:root {
  --bg: #050505;
  --bg-2: #0c0c0c;
  --fg: #f2f2f0;
  --dim: #8b8b88;
  --mute: #4a4a48;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --g1: #8fefa4;
  --g2: #e4ff5c;
  --grad: linear-gradient(90deg, var(--g1), var(--g2));
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
::selection { background: var(--g2); color: #000; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mono { font-family: var(--mono); }
button { font: inherit; color: inherit; }

/* ---------- interactive background ---------- */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.glow {
  position: fixed; left: 0; top: 0; z-index: 0; pointer-events: none;
  width: 560px; height: 560px; margin: -280px 0 0 -280px; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(143, 239, 164, 0.13), rgba(228, 255, 92, 0.04) 55%, transparent);
  filter: blur(10px);
  will-change: transform;
}
.nav, main, .foot { position: relative; z-index: 1; }

/* ---------- nav ---------- */
.nav {
  max-width: 1160px; margin: 0 auto;
  display: flex; justify-content: center; align-items: center;
  padding: 26px 24px;
}
.logo { font-weight: 600; font-size: 21px; letter-spacing: -0.04em; color: var(--fg); text-decoration: none; }
.logo .n { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 500; }
.logo { display: inline-flex; align-items: center; }
.logo img { height: 28px; width: auto; display: block; }
.nav-links { display: flex; gap: 34px; }
.nav-links a { color: var(--dim); text-decoration: none; font-size: 13px; transition: color .2s; }
.nav-links a:hover { color: var(--fg); }
.nav .pill { justify-self: end; }

/* ---------- pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 0;
  border: 0; background: none; padding: 0; cursor: pointer;
}
.pill .go-label {
  background: var(--fg); color: #000;
  padding: 0 22px; height: 44px; display: inline-flex; align-items: center;
  border-radius: 999px; font-size: 14px; font-weight: 500;
  transition: background .25s;
}
.pill .circle {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--fg); color: #000;
  display: inline-grid; place-items: center; margin-left: -2px;
  transition: transform .35s cubic-bezier(.2, .9, .3, 1.3), background .25s;
}
.pill .circle svg { width: 18px; height: 18px; }
.pill:hover .circle { transform: translateX(6px) rotate(-45deg); background: var(--g2); }
.t { display: inline-block; transition: transform .35s cubic-bezier(.2, .9, .3, 1.3); }
.pill:hover .t { transform: translateX(5px); }
.ghost:hover .t { transform: translateX(3px); }
.pill:hover .go-label { background: #fff; }
.pill:disabled { cursor: wait; opacity: .6; }
.pill.small {
  background: var(--fg); color: #000; border-radius: 999px;
  height: 34px; padding: 0 18px; font-size: 13px; font-weight: 500;
}
.pill.small:hover { background: var(--g2); }

.ghost {
  display: inline-flex; align-items: center; height: 44px; padding: 0 20px;
  border: 1px solid var(--line-2); border-radius: 999px; background: transparent;
  color: var(--fg); text-decoration: none; font-size: 14px; cursor: pointer;
  transition: border-color .2s, background .2s;
}
.ghost:hover { border-color: var(--fg); background: rgba(255, 255, 255, .04); }
.ghost.dim { border-color: transparent; color: var(--dim); }
.ghost.dim:hover { color: var(--fg); background: transparent; }
.ghost.small { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---------- stage: the link box is centre stage ---------- */
main { max-width: 1160px; margin: 0 auto; padding: 0 24px; }
.stage {
  min-height: calc(100vh - 96px); min-height: calc(100svh - 96px);
  max-width: 820px; margin: 0 auto;
  display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  padding: 2vh 0 6vh; text-align: center;
}
.kicker {
  align-self: center;
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim); margin: 0 0 18px;
}
.kicker .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--g1); box-shadow: 0 0 10px var(--g1); }
.title {
  margin: 0 0 28px; font-weight: 400; letter-spacing: -0.04em; line-height: 1.05;
  font-size: clamp(30px, 4.6vw, 48px);
}
.stage .box, .stage .result { text-align: left; }

/* ticker: long links turning into short ones */
.ticker {
  margin: 34px 0 0; overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}
.track { display: flex; width: max-content; animation: scroll 70s linear infinite; }
.track .it {
  display: inline-flex; align-items: center; gap: 12px; padding: 6px 26px;
  font-family: var(--mono); font-size: 12px; white-space: nowrap;
}
.track .long { color: var(--mute); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.2); }
.track .to { color: var(--mute); }
.track .s { color: var(--g1); opacity: .8; }
@keyframes scroll { to { transform: translateX(-50%); } }

/* ---------- form box ---------- */
.box {
  border: 1px solid var(--line); border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.01));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 10px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.9), inset 0 1px 0 rgba(255,255,255,.05);
  transition: border-color .3s;
}
.box:focus-within { border-color: var(--line-2); }
.field {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 16px;
  padding: 8px 8px 8px 18px;
}
.field .ico { width: 20px; height: 20px; color: var(--dim); flex: none; }
#url {
  flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--fg);
  font: 400 18px var(--sans); height: 52px;
}
#url::placeholder { color: var(--mute); }
.box.busy .field { position: relative; overflow: hidden; }
.box.busy .field::after {
  content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 40%;
  background: var(--grad); animation: load 0.9s ease-in-out infinite;
}
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

.controls {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 14px 10px 6px;
}
.group { display: flex; align-items: center; gap: 14px; min-width: 0; }
.label { font-family: var(--mono); font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .1em; }
.chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chips button {
  border: 1px solid transparent; background: none; color: var(--dim); cursor: pointer;
  font-size: 13px; padding: 6px 12px; border-radius: 999px; transition: color .2s, border-color .2s, background .2s;
}
.chips button:hover { color: var(--fg); }
.chips button.on { color: var(--fg); border-color: var(--line-2); background: rgba(255,255,255,.05); }
.toggle {
  border: 0; background: none; color: var(--dim); cursor: pointer; font-size: 13px;
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 4px;
}
.toggle:hover, .toggle[aria-expanded="true"] { color: var(--fg); }
.toggle .plus {
  width: 18px; height: 18px; border-radius: 50%; border: 1px solid currentColor;
  display: inline-grid; place-items: center; font-size: 12px; line-height: 1;
  transition: transform .3s;
}
.toggle[aria-expanded="true"] .plus { transform: rotate(45deg); }

.alias {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  margin: 8px 10px 4px; padding: 10px 14px;
  border: 1px dashed var(--line-2); border-radius: 12px;
  font-family: var(--mono); font-size: 14px;
  animation: in .35s ease;
}
.alias .host { color: var(--mute); }
.alias input {
  flex: 1; min-width: 100px; border: 0; outline: 0; background: none; color: var(--g2);
  font: inherit; padding: 4px 0;
}
.alias .status { font-size: 11px; color: var(--mute); transition: color .2s; }
.alias.ok { border-color: rgba(143,239,164,.5); border-style: solid; }
.alias.ok .status { color: var(--g1); }
.alias.bad { border-color: rgba(255,138,122,.5); border-style: solid; }
.alias.bad .status { color: #ff8a7a; }
.alias.bad input { color: #ff8a7a; }
@keyframes in { from { opacity: 0; transform: translateY(-6px); } }

.err { color: #ff8a7a; font-size: 13px; margin: 6px 12px 4px; }
.err:empty { display: none; }

/* ---------- result ---------- */
.result {
  margin-top: 18px; display: grid; grid-template-columns: 1fr auto; gap: 0;
  border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  background: rgba(12,12,12,.8); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  animation: rise .6s cubic-bezier(.2, .9, .2, 1);
  position: relative;
}
.result::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px; background: var(--grad); opacity: .7;
}
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.res-main { padding: 30px 32px; min-width: 0; }
.res-top { font-family: var(--mono); font-size: 12px; color: var(--dim); margin: 0 0 18px; }
.res-top .tick { color: var(--g1); }
.short {
  display: block; text-decoration: none; color: var(--fg);
  font-weight: 300; font-size: clamp(40px, 6vw, 64px); letter-spacing: -0.045em; line-height: 1;
  overflow-wrap: anywhere;
}
.short .host { display: block; font-family: var(--mono); font-size: 14px; letter-spacing: 0; color: var(--mute); margin-bottom: 8px; }
.short .code { font-weight: 400; }
.short:hover .host { color: var(--dim); }
.orig {
  font-family: var(--mono); font-size: 12px; color: var(--mute); margin: 18px 0 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.exp { font-size: 13px; color: var(--dim); margin: 0 0 24px; }
.exp b { color: var(--fg); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill.done .circle, .pill.done .go-label { background: var(--g1); }

.res-qr {
  border-left: 1px solid var(--line); padding: 26px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
#qr { width: 150px; height: 150px; border-radius: 14px; background: #fff; }
.qr-dl { font-family: var(--mono); font-size: 12px; color: var(--dim); background: none; border: 0; cursor: pointer; }
.qr-dl:hover { color: var(--g2); }

/* ---------- how ---------- */
.how {
  display: grid; grid-template-columns: repeat(3, 1fr);
  margin: 110px 0 0; border-top: 1px solid var(--line);
}
.step { padding: 30px 28px 10px 0; }
.step + .step { padding-left: 28px; border-left: 1px solid var(--line); }
.step .n { font-family: var(--mono); font-size: 11px; color: var(--mute); border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 8px; }
.step h3 { font-weight: 400; font-size: 22px; letter-spacing: -0.03em; margin: 22px 0 8px; text-transform: uppercase; }
.step p { color: var(--dim); font-size: 14px; line-height: 1.6; margin: 0; }
kbd { font-family: var(--mono); font-size: 11px; border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; color: var(--fg); }

/* ---------- history ---------- */
.history { margin-top: 110px; }
.hist-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.history h2 {
  margin: 0; font-weight: 300; text-transform: uppercase; letter-spacing: -0.05em;
  font-size: clamp(38px, 6vw, 72px); line-height: 1;
}
#list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line-2); }
#list li {
  position: relative; display: grid; grid-template-columns: minmax(0, auto) 1fr auto; align-items: center; gap: 28px;
  padding: 18px 8px; border-bottom: 1px solid var(--line-2); overflow: hidden;
}
#list li::before {
  content: ""; position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(143,239,164,.35) 55%, rgba(143,239,164,.6) 85%, var(--g2) 100%);
  opacity: 0; transform: translateX(-30%); transition: opacity .4s, transform .6s cubic-bezier(.2,.9,.2,1);
}
#list li:hover::before { opacity: 1; transform: none; }
#list li > * { position: relative; z-index: 1; }
#list .code {
  font-weight: 300; font-size: clamp(30px, 4.5vw, 52px); letter-spacing: -0.04em; line-height: 1;
  color: var(--fg); text-decoration: none; transition: color .3s;
}
#list li:hover .code { color: var(--g1); }
#list .info { min-width: 0; font-size: 12px; color: var(--dim); }
#list .info .u { font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
#list .info .m { display: block; margin-top: 4px; color: var(--mute); }
#list li:hover .info, #list li:hover .info .m { color: #cfd6cd; }
#list .copy {
  height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2);
  background: rgba(5,5,5,.6); cursor: pointer; font-size: 13px;
}
#list .copy:hover { background: var(--fg); color: #000; }
#list li.gone { opacity: .45; }
.note { font-family: var(--mono); font-size: 11px; color: var(--mute); margin-top: 14px; }

/* ---------- footer ---------- */
.foot {
  max-width: 1160px; margin: 140px auto 0; padding: 30px 24px 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  border-top: 1px solid var(--line); color: var(--dim); font-size: 13px;
}
.foot p { margin: 0; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 10;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--fg); color: #000; font-size: 14px; font-weight: 500;
  padding: 11px 20px; border-radius: 999px;
  transition: transform .35s cubic-bezier(.2,.9,.3,1.3), opacity .25s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- mobile ---------- */
@media (max-width: 760px) {
  .nav { grid-template-columns: 1fr auto; padding: 20px 16px; }
  .nav-links { display: none; }
  main { padding: 0 16px; }
    .field { flex-wrap: wrap; padding: 8px; }
  .field .ico { margin-left: 8px; }
  #url { flex-basis: calc(100% - 40px); }
  .field .pill { width: 100%; }
  .field .pill .go-label { flex: 1; justify-content: center; }
  .group { flex-direction: column; align-items: flex-start; gap: 8px; }
  .result { grid-template-columns: 1fr; }
  .res-main { padding: 24px 20px; }
  .res-qr { border-left: 0; border-top: 1px solid var(--line); flex-direction: row; justify-content: flex-start; padding: 18px 20px; }
  #qr { width: 104px; height: 104px; }
  .how { grid-template-columns: 1fr; margin-top: 80px; }
  .step, .step + .step { padding: 24px 0; border-left: 0; }
  .step + .step { border-top: 1px solid var(--line); }
  #list li { grid-template-columns: 1fr auto; gap: 6px 14px; }
  #list .info { grid-column: 1 / -1; grid-row: 2; }
  .foot { flex-direction: column; align-items: flex-start; margin-top: 90px; }
  .glow { width: 380px; height: 380px; margin: -190px 0 0 -190px; }
}

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

@media (max-width: 760px) {
  .stage { min-height: calc(100svh - 76px); justify-content: flex-start; padding-top: 12vh; }
  .kicker { font-size: 11px; letter-spacing: .1em; }
}
