/* ============ Theme tokens ============ */
:root {
  --bg: #0a0a0b;
  --surface: rgba(255, 255, 255, 0.025);
  --surface-strong: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #ececee;
  --text-dim: #9a9aa4;
  --text-faint: #66666f;
  --accent: #ededf0;
  --accent-soft: #8b8bf2;
  --success: #4ade80;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ============ Background ============ */
.bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg);
}

.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(800px 500px at 50% -5%, #000 20%, transparent 75%);
}

/* ============ Card primitive ============ */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ============ Nav ============ */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1040px;
  margin: 0 auto;
  padding: 20px 24px;
  background: rgba(10, 10, 11, 0.7);
  backdrop-filter: blur(8px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.08rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
}
.brand-mark svg {
  width: 16px;
  height: 16px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.nav-links a {
  transition: color 0.2s var(--ease);
}
.nav-links a:hover {
  color: var(--text);
}
.nav-cta {
  padding: 8px 15px;
  border-radius: 8px;
  color: #0a0a0b !important;
  background: var(--accent);
  font-weight: 600;
  transition: opacity 0.2s var(--ease);
}
.nav-cta:hover {
  opacity: 0.85;
}

/* ============ Hero ============ */
main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

.hero {
  text-align: center;
  padding: 72px 0 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
}
.pill-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.hero-title {
  margin: 24px 0 0;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.05;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.grad-text {
  color: var(--text-dim);
}

.hero-sub {
  margin: 18px 0 0;
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  color: var(--text-dim);
  max-width: 520px;
}

/* ============ Shortener ============ */
.shortener {
  margin-top: 36px;
  width: 100%;
  max-width: 580px;
  padding: 14px;
  text-align: left;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 46px;
  flex: 0 0 auto;
  color: var(--text-faint);
}
.field-icon svg {
  width: 18px;
  height: 18px;
}

#url {
  flex: 1;
  min-width: 0;
  height: 50px;
  padding: 0 6px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.98rem;
  font-family: inherit;
  outline: none;
}
#url::placeholder {
  color: var(--text-faint);
}

.btn-primary {
  position: relative;
  flex: 0 0 auto;
  height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  color: #0a0a0b;
  cursor: pointer;
  background: var(--accent);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  overflow: hidden;
}
.btn-primary:hover {
  opacity: 0.88;
}
.btn-primary:active {
  transform: scale(0.97);
}
.btn-primary:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 2px;
}

.btn-spinner {
  display: none;
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(0, 0, 0, 0.25);
  border-top-color: #0a0a0b;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.btn-primary.loading .btn-label {
  opacity: 0;
}
.btn-primary.loading .btn-spinner {
  display: block;
}

.slug-toggle {
  margin: 12px 0 0 4px;
  padding: 4px 2px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.84rem;
  cursor: pointer;
  transition: color 0.2s var(--ease);
}
.slug-toggle:hover {
  color: var(--text);
}

.slug-wrap {
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding: 0 14px;
  height: 44px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
}
.slug-prefix {
  color: var(--text-faint);
  font-size: 0.9rem;
}
#code {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
}

/* ============ Result card ============ */
.result-zone {
  width: 100%;
  max-width: 580px;
  margin-top: 16px;
}

.result-card {
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: center;
  text-align: left;
  animation: fade 0.35s var(--ease) both;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.result-card.error {
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--danger);
  font-size: 0.94rem;
  justify-content: center;
  text-align: center;
}

.qr {
  flex: 0 0 auto;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  display: grid;
  place-items: center;
}
.qr img {
  width: 100%;
  height: 100%;
  display: block;
}

.result-main {
  flex: 1;
  min-width: 0;
}
.result-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  color: var(--success);
  font-weight: 600;
  margin-bottom: 4px;
}
.check {
  width: 15px;
  height: 15px;
}
.check circle {
  stroke-dasharray: 76;
  stroke-dashoffset: 76;
  animation: draw 0.5s var(--ease) forwards;
}
.check path {
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  animation: draw 0.35s var(--ease) 0.35s forwards;
}
@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

.short-url {
  font-size: 1.06rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
  word-break: break-all;
}
.short-url:hover {
  color: var(--text-dim);
}
.result-target {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.copy-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  color: var(--text);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease);
}
.copy-btn svg {
  width: 15px;
  height: 15px;
}
.copy-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}
.copy-btn:active {
  transform: scale(0.96);
}
.copy-btn.copied {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.45);
}

/* Skeleton */
.skeleton {
  padding: 18px;
  display: flex;
  gap: 16px;
  align-items: center;
}
.sk {
  background: linear-gradient(
    100deg,
    rgba(255, 255, 255, 0.04) 30%,
    rgba(255, 255, 255, 0.09) 50%,
    rgba(255, 255, 255, 0.04) 70%
  );
  background-size: 200% 100%;
  border-radius: 8px;
  animation: sweep 1.2s linear infinite;
}
@keyframes sweep {
  to {
    background-position: -200% 0;
  }
}
.sk-qr {
  width: 84px;
  height: 84px;
  border-radius: 10px;
  flex: 0 0 auto;
}
.sk-lines {
  flex: 1;
}
.sk-line {
  height: 13px;
  margin-bottom: 10px;
}
.sk-line.w60 {
  width: 60%;
}
.sk-line.w90 {
  width: 90%;
}
.sk-line.w40 {
  width: 40%;
}

.trust {
  margin-top: 26px;
  font-size: 0.8rem;
  color: var(--text-faint);
  letter-spacing: 0.02em;
}

/* ============ Features ============ */
.features {
  padding: 64px 0 32px;
  text-align: center;
}
.section-title {
  font-size: clamp(1.5rem, 3.5vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
}
.section-sub {
  margin: 12px 0 0;
  color: var(--text-dim);
}

.feature-grid {
  margin-top: 40px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  text-align: left;
}

.feature {
  padding: 22px;
  transition: border-color 0.25s var(--ease), background 0.25s var(--ease);
}
.feature:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--text);
  background: var(--surface-strong);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.feature-icon svg {
  width: 21px;
  height: 21px;
}

.feature h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.feature p {
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ============ Links section ============ */
.links-section {
  padding: 40px 0 30px;
}
.links-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.btn-ghost {
  height: 36px;
  padding: 0 15px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.links-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.2s var(--ease), background 0.2s var(--ease);
  animation: fade 0.3s var(--ease) both;
}
.link-row:hover {
  border-color: var(--border-strong);
  background: var(--surface-strong);
}
.link-code {
  font-weight: 600;
  color: var(--text);
  flex: 0 0 auto;
}
.link-target {
  flex: 1;
  min-width: 0;
  color: var(--text-dim);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.link-hits {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}
.link-mini-copy {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.link-mini-copy svg {
  width: 15px;
  height: 15px;
}
.link-mini-copy:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.link-mini-copy.copied {
  color: var(--success);
  border-color: rgba(74, 222, 128, 0.45);
}

.empty {
  text-align: center;
  color: var(--text-faint);
  padding: 26px 0;
  font-size: 0.9rem;
}

/* ============ Footer ============ */
.footer {
  text-align: center;
  padding: 48px 24px 56px;
  margin-top: 24px;
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.88rem;
}
.footer a {
  color: var(--text);
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
  transition: color 0.2s var(--ease);
}
.footer a:hover {
  color: var(--text-dim);
}

/* ============ Reveal on scroll ============ */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ============ Responsive ============ */
@media (max-width: 860px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 620px) {
  .nav-links a:not(.nav-cta) {
    display: none;
  }
  .hero {
    padding: 44px 0 32px;
  }
  .field-row {
    flex-wrap: wrap;
  }
  #url {
    flex: 1 1 100%;
    order: 1;
    height: 48px;
  }
  .field-icon {
    display: none;
  }
  .btn-primary {
    flex: 1 1 100%;
    order: 2;
    height: 48px;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .result-card {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .qr {
    margin: 0 auto;
  }
  .result-target {
    white-space: normal;
    word-break: break-all;
  }
  .copy-btn {
    justify-content: center;
  }
  .link-target {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
