:root {
  --bg: #070707;
  --text: #f6f6f6;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.1);
  --red: #c4161c;
  --red-hot: #da1b22;
  --red-bright: #ff4b55;
  --ok: #8ee0b5;
  --danger: #ffb4b8;
  --max: 1080px;
  --font: Bahnschrift, "Segoe UI", system-ui, sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --mono: "Cascadia Mono", "Segoe UI Mono", ui-monospace, monospace;
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background:
    radial-gradient(880px 380px at 88% -8%, rgba(196, 22, 28, 0.22), transparent 62%),
    var(--bg);
  color: var(--text);
  letter-spacing: -0.011em;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto 0;
  height: 2px;
  background: linear-gradient(90deg, #6d0d12, var(--red-bright), #6d0d12);
  z-index: 20;
}

body.page-home {
  display: flex;
  flex-direction: column;
}

body.page-home main { flex: 1; }

::selection { background: var(--red); color: white; }

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--red-bright);
  outline-offset: 3px;
}

button, input { font: inherit; color: inherit; }

button { cursor: pointer; }

a { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 14px 28px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(7, 7, 7, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 13px;
}

.mark {
  width: 10px;
  height: 10px;
  background: var(--red);
  border-radius: 2px;
  box-shadow: 5px 5px 0 rgba(196, 22, 28, 0.35);
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.nav a, .signed-in {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.nav a:hover { color: white; }

.signed-in strong { color: white; font-weight: 600; }

.hero, .spec, .footer-inner, .desk {
  width: min(var(--max), calc(100% - 40px));
  margin-left: auto;
  margin-right: auto;
}

.hero { padding: 72px 0 28px; }

.eyebrow {
  margin: 0;
  color: var(--red-bright);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 12px;
  font-weight: 600;
}

h1 {
  margin: 12px 0 16px;
  max-width: 12em;
  font-size: clamp(42px, 5.6vw, 72px);
  line-height: 0.98;
  letter-spacing: -0.045em;
  font-weight: 600;
}

h1 em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  color: var(--red-bright);
}

.lede {
  max-width: 46ch;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.shorten {
  max-width: 680px;
  margin-top: 32px;
}

.join {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: #0c0c0c;
  border: 1px solid #2c2c2c;
  border-radius: 999px;
}

.join:focus-within { border-color: rgba(255, 75, 85, 0.75); }

.join input {
  flex: 1;
  min-width: 0;
  height: 48px;
  border: 0;
  background: transparent;
  padding: 0 16px;
}

.join input:focus { outline: none; }

.join input::placeholder,
.stack input::placeholder,
.search::placeholder { color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { background: var(--red-hot); }

.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn.small { height: 34px; padding: 0 12px; font-size: 13px; }

.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.btn.ghost:hover { background: rgba(255, 255, 255, 0.04); }

.btn.danger { color: var(--danger); border-color: rgba(196, 22, 28, 0.5); }

.alias-line { margin-top: 12px; }

.text-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 14px;
}

.text-btn:hover { color: white; }

.alias-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
}

.alias-field input {
  width: min(240px, 100%);
  border: 0;
  border-bottom: 1px solid #333;
  background: transparent;
  color: white;
  padding: 6px 0;
}

.form-error, .form-ok {
  min-height: 1.2em;
  margin: 10px 2px 0;
  font-size: 14px;
}

.form-error { color: var(--danger); }

.form-ok { color: var(--ok); }

.result {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  border: 1px solid rgba(196, 22, 28, 0.4);
  background: linear-gradient(180deg, rgba(196, 22, 28, 0.1), rgba(255, 255, 255, 0.02));
}

.result-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.result-dest {
  margin: 12px 4px 0;
  color: var(--muted);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.spec { padding: 28px 0 80px; }

.spec-sheet {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.spec-sheet article { padding: 28px 24px 30px; }

.spec-sheet article + article { border-left: 1px solid var(--line); }

.spec-sheet span {
  display: block;
  margin-bottom: 18px;
  color: var(--red-bright);
  font-family: var(--mono);
  font-size: 12px;
}

.spec-sheet h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.spec-sheet p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.site-footer { border-top: 1px solid var(--line); }

.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.footer-inner a, .legal-links a { color: var(--muted); text-decoration: none; }

.footer-inner a:hover, .legal-links a:hover { color: white; }

.footer-links, .legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.legal-links { justify-content: center; margin: 18px 0 0; font-size: 13px; }

.legal {
  width: min(720px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 80px;
}

.legal h1 {
  max-width: none;
  font-size: clamp(40px, 6vw, 64px);
}

.legal .updated { margin: 0; color: var(--muted); }

.legal h2 {
  margin: 32px 0 8px;
  font-size: 20px;
  font-weight: 600;
}

.legal p, .legal li {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.legal ul { margin: 8px 0 0; padding-left: 1.2em; }

.legal a { color: var(--red-bright); }

.boot-note { margin: 0; padding: 28px; color: var(--muted); }

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.card {
  width: min(440px, 100%);
  padding: 32px 28px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(16, 16, 16, 0.94);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

.card h1 {
  max-width: none;
  margin: 22px 0 8px;
  font-size: 36px;
}

.card .lede { font-size: 15px; }

.stack { display: flex; flex-direction: column; gap: 6px; }

.stack + .stack, .password-form { margin-top: 14px; }

.stack span, .hint { color: var(--muted); font-size: 13px; line-height: 1.5; }

.stack input, .search {
  width: 100%;
  height: 46px;
  border-radius: 12px;
  border: 1px solid #2c2c2c;
  background: #0c0c0c;
  padding: 0 14px;
}

.stack input:focus, .search:focus { border-color: rgba(255, 75, 85, 0.75); }

.login-card .btn { width: 100%; margin-top: 8px; }

.desk { padding: 28px 0 72px; }

.banner {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(196, 22, 28, 0.45);
  border-radius: 12px;
  background: rgba(196, 22, 28, 0.12);
  color: #ffd5d8;
  font-size: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.stats article { padding: 18px 18px 16px; }

.stats article + article { border-left: 1px solid var(--line); }

.stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.panel {
  margin-top: 16px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.panel h2, .panel h3 { margin: 0; font-weight: 600; }

.panel h2 { font-size: 18px; }

.panel h3 { font-size: 15px; }

.panel-head, .create-grid, .split {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.panel-head { margin-bottom: 8px; }

.panel-head h2 { margin: 0; }

.search { max-width: 280px; }

.create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px auto;
  align-items: end;
  margin-top: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.check input { width: 16px; height: 16px; accent-color: var(--red); }

.hint { margin: 8px 0 0; }

.password-form { max-width: 420px; }

.link-head, .link-row {
  display: grid;
  grid-template-columns: minmax(140px, 190px) minmax(0, 1fr) 88px 148px minmax(230px, auto);
  gap: 12px;
  align-items: center;
}

.link-head {
  padding: 8px 8px 10px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.link-row {
  padding: 14px 8px;
  border-top: 1px solid var(--line);
}

.link-row.is-paused { opacity: 0.62; }

.link-short {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-width: 0;
}

.link-short a {
  color: var(--red-bright);
  font-family: var(--mono);
  font-size: 14px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ok);
  font-size: 12px;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill.paused { color: var(--muted); }

.dest { min-width: 0; }

.dest a {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  text-decoration: none;
}

.dest a:hover { color: white; }

.clicks, .when { font-variant-numeric: tabular-nums; }

.clicks { display: flex; flex-direction: column; }

.clicks strong { font-size: 18px; font-weight: 600; }

.when-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

.actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.split { display: grid; grid-template-columns: 1fr 1fr; align-items: start; }

.top-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 14px;
}

dialog {
  font: inherit;
  color: var(--text);
  width: min(460px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid #2a2a2a;
  border-radius: 18px;
  background: #121212;
}

dialog::backdrop { background: rgba(0, 0, 0, 0.72); }

dialog h2 { margin: 0 0 14px; font-size: 22px; letter-spacing: -0.03em; }

dialog p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }

.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 30;
  transform: translateX(-50%) translateY(8px);
  padding: 10px 16px;
  border: 1px solid #333;
  border-radius: 999px;
  background: #161616;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show { opacity: 1; transform: translateX(-50%); }

.status-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 12px;
  width: min(640px, calc(100% - 40px));
  margin: 0 auto;
}

.status-shell h1 {
  max-width: none;
  margin: 12px 0 0;
  font-size: clamp(40px, 6vw, 64px);
}

.status-shell p { margin: 0; color: var(--muted); font-size: 18px; }

.status-shell .btn { align-self: flex-start; margin-top: 8px; }

.status-shell .wait-count {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 72px;
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

a.btn[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

@media (max-width: 900px) {
  .spec-sheet, .stats, .split, .create-grid { grid-template-columns: 1fr; }
  .spec-sheet article + article, .stats article + article { border-left: 0; border-top: 1px solid var(--line); }
  .link-head { display: none; }
  .link-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "short clicks"
      "dest dest"
      "when when"
      "actions actions";
  }
  .link-short { grid-area: short; }
  .clicks { grid-area: clicks; align-items: flex-end; }
  .dest { grid-area: dest; }
  .when { grid-area: when; }
  .actions { grid-area: actions; justify-content: flex-start; }
}

@media (max-width: 640px) {
  .site-header { padding: 12px 16px; }
  .hero, .spec, .footer-inner, .desk, .legal { width: min(var(--max), calc(100% - 32px)); }
  .signed-in { display: none; }
  .join { flex-direction: column; border-radius: 18px; }
  .join .btn { width: 100%; }
  .footer-inner { flex-direction: column; }
  .search { max-width: none; }
  .panel-head { align-items: stretch; flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
