:root {
  --bg: #070b14;
  --bg-elevated: #0e1524;
  --surface: rgba(16, 24, 40, 0.72);
  --surface-strong: #121c30;
  --ink: #eef3ff;
  --muted: #93a0bc;
  --accent: #2dd4bf;
  --accent-2: #38bdf8;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --info-soft: rgba(56, 189, 248, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --shell: 760px;
  --shell-wide: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { color: var(--accent); }

.page-wrap {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.bg-scene {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.orb-a {
  width: 520px;
  height: 520px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.35), transparent 70%);
  animation: drift-a 18s ease-in-out infinite alternate;
}

.orb-b {
  width: 480px;
  height: 480px;
  top: 10%;
  right: -120px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.28), transparent 70%);
  animation: drift-b 22s ease-in-out infinite alternate;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 20%, black, transparent 75%);
}

@keyframes drift-a {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(40px, 30px) scale(1.08); }
}

@keyframes drift-b {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-30px, 40px) scale(1.05); }
}

.shell {
  width: min(100% - 32px, var(--shell));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.page-home .shell,
.page-home .page-wrap > .site-header,
.page-home .page-wrap > .hero,
.page-home .page-wrap > .site-footer {
  width: min(100% - 32px, var(--shell));
  margin-left: auto;
  margin-right: auto;
}

.page-home .page-wrap > .hero {
  padding-bottom: 24px;
}

.shell-wide {
  width: min(100% - 32px, var(--shell-wide));
}

.flush-top { margin-top: -8px; margin-bottom: 16px; }

.site-header {
  text-align: center;
  padding: 36px 0 12px;
}

.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  width: min(100% - 32px, var(--shell-wide));
  margin: 0 auto;
  padding-top: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover { color: var(--ink); }

.brand-icon-img {
  display: block;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  flex-shrink: 0;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.brand-tagline {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(45, 212, 191, 0.25);
}

.hero {
  display: grid;
  gap: 28px;
  padding-bottom: 24px;
}

.hero-narrow { max-width: 460px; margin: 0 auto; }

.hero-copy { text-align: center; }

.eyebrow {
  display: inline-block;
  margin: 0 0 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hero-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 800;
  text-wrap: balance;
}

.hero-title-sm { font-size: clamp(1.6rem, 4vw, 2rem); }

.text-accent {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  margin: 16px auto 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.05rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.card-form {
  padding: 24px;
}

.card-login { margin-top: 12px; }

.panel {
  padding: 22px;
  margin-bottom: 18px;
}

.field { margin-bottom: 16px; }

.field label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.input-shell:focus-within {
  border-color: rgba(45, 212, 191, 0.45);
  box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.1);
}

.input-icon {
  display: inline-flex;
  padding: 0 12px 0 14px;
  color: var(--muted);
}

.input-prefix {
  padding-left: 14px;
  color: var(--muted);
  font-size: 0.92rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.input-shell--alias .input-alias {
  flex: 1;
  min-width: 0;
}

.input {
  width: 100%;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.input-shell .input { padding-left: 0; }

.input-captcha {
  flex: 1;
  min-width: 0;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.captcha-img {
  display: block;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface-strong);
  flex-shrink: 0;
}

.captcha-refresh {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}

.input-search { min-width: 0; flex: 1; background: var(--surface-strong); border: 1px solid var(--border); border-radius: var(--radius-sm); }

.input-readonly { background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: var(--radius-sm); }

.input:focus { outline: none; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease, background .15s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: #042f2e;
  box-shadow: 0 10px 30px rgba(45, 212, 191, 0.22);
}

.btn-primary.btn-lg { width: 100%; margin-top: 8px; padding: 15px 20px; font-size: 1rem; }

.btn-secondary {
  background: var(--surface-strong);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}

.btn-success { background: rgba(45, 212, 191, 0.2); color: var(--accent); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn-danger {
  background: var(--danger-soft);
  color: #fecdd3;
  border: 1px solid rgba(251, 113, 133, 0.28);
}

.btn-sm { padding: 9px 14px; font-size: 0.86rem; }
.btn-xs { padding: 6px 10px; font-size: 0.75rem; border-radius: 9px; }

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  font-size: 0.92rem;
}

.alert-error {
  background: var(--danger-soft);
  border: 1px solid rgba(251, 113, 133, 0.25);
  color: #fecdd3;
}

.alert-info {
  background: var(--info-soft);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #bae6fd;
}

.result-box {
  margin-bottom: 18px;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(45,212,191,.08), rgba(56,189,248,.04));
  border: 1px solid rgba(45, 212, 191, 0.22);
}

.result-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--accent);
}

.copy-row {
  display: flex;
  gap: 10px;
}

.copy-row .input { flex: 1; }

.features {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
}

.features li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.feature-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(45, 212, 191, 0.6);
}

.site-footer {
  text-align: center;
  padding: 8px 0 24px;
  color: var(--muted);
  font-size: 0.86rem;
}

.muted { color: var(--muted); }
.center { text-align: center; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.82rem; }

/* Redirect / status */
.page-redirect .page-wrap,
.page-status .page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.redirect-shell {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 24px 16px 32px;
  box-sizing: border-box;
}

.card-redirect {
  width: min(100%, 520px);
  padding: 28px 24px 32px;
  text-align: center;
}

.card-status {
  width: min(100%, 520px);
  padding: 28px 24px 32px;
  text-align: center;
}

.status-head {
  margin-bottom: 24px;
}

.status-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.status-visual {
  flex-shrink: 0;
}

.status-copy {
  width: 100%;
  min-width: 0;
}

.status-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.22);
  color: var(--accent-2);
}

.card-status-404 .status-icon {
  background: rgba(56, 189, 248, 0.08);
  border-color: rgba(56, 189, 248, 0.22);
  color: var(--accent-2);
}

.card-status-410 .status-icon {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.25);
  color: #fbbf24;
}

.status-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.status-title {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.status-message {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  text-wrap: pretty;
}

.status-action {
  display: inline-flex;
  min-width: 140px;
}

@media (min-width: 768px) {
  .card-status {
    width: min(100%, 680px);
    padding: 40px 48px 44px;
    text-align: left;
  }

  .status-head {
    margin-bottom: 32px;
    text-align: center;
  }

  .status-body {
    flex-direction: row;
    align-items: center;
    gap: 40px;
    padding: 8px 12px 0;
  }

  .status-visual {
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .status-icon {
    width: 88px;
    height: 88px;
    border-radius: 24px;
  }

  .status-icon svg {
    width: 36px;
    height: 36px;
  }

  .status-copy {
    flex: 1;
    min-width: 0;
  }

  .status-message {
    font-size: 1rem;
    max-width: 48ch;
    margin-bottom: 24px;
  }

  .status-action {
    margin-top: 0;
  }
}

@media (min-width: 1024px) {
  .card-status {
    width: min(100%, 740px);
    padding: 44px 56px 48px;
  }

  .status-body {
    gap: 48px;
    padding: 12px 20px 0;
  }
}

@media (max-width: 767px) {
  .card-status {
    padding: 24px 20px 28px;
  }

  .status-head {
    margin-bottom: 20px;
  }

  .status-action {
    width: 100%;
    justify-content: center;
  }
}

.redirect-head {
  margin-bottom: 24px;
}

.redirect-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.redirect-visual {
  flex-shrink: 0;
}

.redirect-copy {
  width: 100%;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent);
  margin-bottom: 0;
}

.redirect-ring {
  width: 58px;
  height: 58px;
  margin: 0 auto;
  border-radius: 50%;
  border: 3px solid rgba(45, 212, 191, 0.18);
  border-top-color: var(--accent);
  animation: spin 0.9s linear infinite;
}

.redirect-kicker {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.redirect-host {
  margin: 0 0 14px;
  padding: 14px 18px;
  font-size: clamp(1.1rem, 4vw, 1.45rem);
  font-weight: 700;
  line-height: 1.35;
  word-break: break-word;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--ink);
}

.redirect-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

@media (min-width: 768px) {
  .redirect-shell {
    padding: 40px 32px 48px;
  }

  .card-redirect {
    width: min(100%, 720px);
    padding: 40px 48px 44px;
    text-align: left;
  }

  .redirect-head {
    margin-bottom: 32px;
    text-align: center;
  }

  .redirect-body {
    flex-direction: row;
    align-items: center;
    gap: 40px;
    padding: 8px 12px 0;
  }

  .redirect-visual {
    width: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .redirect-ring {
    width: 72px;
    height: 72px;
    border-width: 4px;
  }

  .redirect-copy {
    flex: 1;
    min-width: 0;
  }

  .redirect-kicker {
    font-size: 0.82rem;
    margin-bottom: 12px;
  }

  .redirect-host {
    font-size: clamp(1.25rem, 2.2vw, 1.65rem);
    padding: 18px 22px;
    margin-bottom: 16px;
  }

  .redirect-note {
    font-size: 0.95rem;
    max-width: 52ch;
  }
}

@media (min-width: 1024px) {
  .card-redirect {
    width: min(100%, 780px);
    padding: 44px 56px 48px;
  }

  .redirect-body {
    gap: 48px;
    padding: 12px 20px 0;
  }
}

@media (max-width: 767px) {
  .card-redirect {
    padding: 24px 20px 28px;
  }

  .redirect-head {
    margin-bottom: 20px;
  }

  .redirect-host {
    padding: 12px 14px;
    font-size: 1.15rem;
  }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Admin */
.page-admin .shell-wide { padding-top: 8px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 18px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
}

.stat-num {
  display: block;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.stat-label {
  color: var(--muted);
  font-size: 0.82rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 1.15rem;
}

.search-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
}

.admin-create-form .btn-primary { width: auto; }

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.data-table th {
  color: var(--muted);
  font-weight: 700;
  background: rgba(0,0,0,.18);
  position: sticky;
  top: 0;
}

.cell-url {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-actions form { display: flex; flex-wrap: wrap; gap: 4px; }

.row-muted { opacity: 0.55; }

.link-slug { font-weight: 700; }

.pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.pill-ok { background: rgba(45,212,191,.12); color: var(--accent); }
.pill-track { background: rgba(56,189,248,.12); color: var(--accent-2); }
.pill-tg { background: rgba(129,140,248,.14); color: #c4b5fd; }
.pill-muted { background: rgba(148,163,184,.1); color: var(--muted); }
.pill-block { background: var(--danger-soft); color: #fecdd3; }

.empty-row {
  text-align: center;
  color: var(--muted);
  padding: 24px !important;
}

.pager {
  display: flex;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.pager a {
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  color: var(--muted);
}

.pager a.active {
  background: var(--accent);
  color: #042f2e;
  border-color: transparent;
}

.inline-form { display: inline; margin: 0; }

@media (min-width: 900px) {
  :root { --shell: 980px; }

  .page-home .hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    gap: 40px;
    align-items: center;
  }

  .page-home .hero-copy {
    text-align: left;
  }

  .page-home .features {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .page-home .site-header {
    text-align: left;
    padding-top: 48px;
  }

  .card-form {
    padding: 28px;
  }
}

@media (max-width: 768px) {
  .shell, .shell-wide {
    width: min(100% - 24px, 100%);
    padding-top: 20px;
    padding-bottom: 40px;
  }

  .site-header { padding-top: 24px; }

  .hero-title { font-size: clamp(1.85rem, 8vw, 2.5rem); }

  .card-form, .panel { padding: 18px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .site-header-row { flex-direction: column; align-items: flex-start; gap: 12px; }
  .copy-row { flex-direction: column; }
  .copy-row .btn { width: 100%; }

  .captcha-row {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "img refresh"
      "input input";
  }

  .captcha-img { grid-area: img; width: 100%; max-width: 180px; height: auto; aspect-ratio: 180 / 56; }
  .captcha-refresh { grid-area: refresh; align-self: center; }
  .input-captcha { grid-area: input; width: 100%; }

  .panel-head { flex-direction: column; align-items: stretch; }
  .search-form { width: 100%; }
  .search-form .btn { width: 100%; }

  .data-table { font-size: 0.78rem; }
  .data-table th, .data-table td { padding: 9px 8px; }
  .cell-actions .btn { flex: 1 1 auto; }

  /* Alias field: show full domain prefix, stack on narrow screens */
  .input-shell--alias {
    flex-wrap: nowrap;
  }

  .input-shell--alias .input-prefix {
    font-size: 0.84rem;
    padding-right: 4px;
  }
}

@media (max-width: 520px) {
  .input-shell--alias {
    flex-direction: column;
    align-items: stretch;
  }

  .input-shell--alias .input-prefix {
    padding: 10px 14px 6px;
    font-size: 0.82rem;
    color: var(--accent-2);
    background: rgba(45, 212, 191, 0.06);
    border-bottom: 1px solid var(--border);
  }

  .input-shell--alias .input-alias {
    padding: 12px 14px;
  }
}

@media (max-width: 480px) {
  .features { flex-direction: column; align-items: center; gap: 8px; }
  .hero-lead { font-size: 0.98rem; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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