:root {
  --bg: #0d0f12;
  --bg-2: #111418;
  --surface: #15191f;
  --surface-2: #191e26;
  --border: #242b35;
  --border-strong: #313a47;
  --text: #eef1f5;
  --muted: #8a94a3;
  --muted-2: #5d6675;
  --accent: #b8ff3d;
  --accent-ink: #0d0f12;
  --radius: 14px;
  --glow: 0.16;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
a { color: inherit; text-decoration: none; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 520px at 50% -8%, color-mix(in oklab, var(--accent) calc(var(--glow) * 100%), transparent), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 60%);
}
.backdrop::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, color-mix(in oklab, var(--border) 60%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in oklab, var(--border) 60%, transparent) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(700px 560px at 50% 18%, #000 0%, transparent 78%);
  opacity: 0.5;
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 2px;
  gap: 18px;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand .slash { color: var(--accent); }
.brand .cursor {
  display: inline-block;
  width: 9px;
  height: 18px;
  margin-left: 3px;
  background: var(--accent);
  transform: translateY(2px);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.top-meta {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}
.top-meta .dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  vertical-align: middle;
}
.top-meta b { color: var(--text); font-weight: 600; }

.stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 0 56px;
}
.core { width: 100%; max-width: 720px; }
.eyebrow {
  margin-bottom: 16px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
}
.eyebrow .c { color: var(--muted-2); }
.headline {
  margin: 0 0 16px;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.headline .swap {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 500;
}
.sub {
  max-width: 520px;
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.panel {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 24px 60px -32px rgba(0,0,0,0.8);
}
.input-shell {
  display: flex;
  align-items: stretch;
  gap: 8px;
  padding: 7px 7px 7px 16px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 4px);
  background: var(--bg);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.input-shell:focus-within {
  border-color: color-mix(in oklab, var(--accent) 55%, var(--border));
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 16%, transparent);
}
.prefix {
  align-self: center;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 14px;
  user-select: none;
}
.url-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: -0.01em;
}
.url-input::placeholder { color: var(--muted-2); }

.btn {
  border: 0;
  border-radius: calc(var(--radius) - 6px);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 14.5px;
  font-weight: 600;
  transition: transform 0.12s ease, filter 0.18s, background 0.18s, border-color 0.18s, color 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { cursor: not-allowed; opacity: 0.45; }
.btn-go {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
  white-space: nowrap;
  background: var(--accent);
  color: var(--accent-ink);
}
.btn-go:hover { filter: brightness(1.07); }
.btn-go:hover .arrow { transform: translateX(3px); }
.arrow { transition: transform 0.18s; }

.opts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 8px 4px;
}
.alias-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}
.alias-chip .dom { color: var(--muted-2); }
.alias-input {
  width: 102px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12.5px;
}
.alias-input::placeholder { color: var(--muted-2); }
.opt-note {
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 12px;
}
.err {
  margin: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 107, 107, 0.35);
  border-radius: 9px;
  background: rgba(255, 107, 107, 0.08);
  color: #ff8a8a;
  font-family: var(--mono);
  font-size: 12.5px;
}

.result {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--accent) 28%, var(--border));
  border-radius: var(--radius);
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent) 6%, var(--surface-2)), var(--surface));
  box-shadow: 0 0 0 1px rgba(255,255,255,0.02) inset, 0 22px 70px -36px color-mix(in oklab, var(--accent) 40%, #000);
  animation: pop 0.24s cubic-bezier(.2,.9,.25,1);
}
@keyframes pop {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.result-main {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
}
.qr {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 92px;
  height: 92px;
  padding: 7px;
  border-radius: 10px;
  background: #fff;
}
.qr svg { display: block; width: 100%; height: 100%; }
.qr-fallback {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background:
    linear-gradient(90deg, #0d0f12 50%, transparent 0) 0 0 / 12px 12px,
    linear-gradient(#0d0f12 50%, transparent 0) 0 0 / 12px 12px;
  opacity: 0.9;
}
.result-body { flex: 1; min-width: 0; }
.result-label {
  margin-bottom: 7px;
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.short-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.short-link {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--mono);
  font-size: clamp(20px, 3vw, 27px);
  font-weight: 600;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.short-link .host { color: var(--accent); }
.copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}
.copy-icon,
.copy-btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.copy-btn svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.done {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 22px;
  margin-top: 14px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12.5px;
}
.result-meta .k { color: var(--muted-2); }
.result-meta b { color: var(--text); font-weight: 600; }
.orig {
  overflow: hidden;
  padding: 11px 18px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 12.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.orig .k { margin-right: 8px; color: var(--muted); }


.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px 2px 26px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-family: var(--mono);
  font-size: 11.5px;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}
.tags span { color: var(--muted); }
.tags .a { color: var(--accent); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  z-index: 50;
  max-width: calc(100vw - 32px);
  padding: 11px 20px;
  border-radius: 10px;
  background: var(--accent);
  box-shadow: 0 16px 40px -12px color-mix(in oklab, var(--accent) 60%, transparent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(20px);
  transition: opacity 0.22s, transform 0.22s;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 640px) {
  .app { padding: 0 16px; }
  .hide-sm { display: none; }
  .top { align-items: flex-start; }
  .input-shell {
    flex-direction: column;
    padding: 12px;
  }
  .prefix { display: none; }
  .btn-go {
    justify-content: center;
    padding: 12px;
  }
  .result-main {
    flex-direction: column;
    align-items: flex-start;
  }
  .qr {
    width: 100%;
    max-width: 140px;
    height: auto;
    aspect-ratio: 1;
  }
  .short-row {
    align-items: stretch;
    flex-direction: column;
  }
  .copy-btn { justify-content: center; }
}
