:root {
  color-scheme: dark;
  --bg: #10110e;
  --card: #1b1e18;
  --card-2: #23271e;
  --line: #33382c;
  --text: #f4f2ea;
  --muted: #a8ae9f;
  --faint: #8d937f;
  --accent: #dff56a;
  --accent-2: #cbe05a;
  --ink: #14160c;
  --danger: #ff9b8d;
  --ok: #c6f2a8;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  --sans: "Avenir Next", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --radius: 18px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 40% at 50% -10%, rgba(223, 245, 106, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}

body:focus { outline: none; }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 10;
  background: var(--accent);
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 700;
}

.skip:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

a { color: inherit; }

.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 12px 20px;
  background: rgba(16, 17, 14, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
  font-size: 18px;
}

.brand img { display: block; border-radius: 7px; }

.nav { display: flex; gap: 6px; }

.nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}

.nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--accent);
}

main {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.narrow { width: min(720px, 100%); margin-inline: auto; }

.hero { margin-bottom: 28px; }

.kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

h1 {
  margin: 0 0 14px;
  font-size: clamp(42px, 8vw, 72px);
}

h1 em { font-style: italic; color: var(--accent); }

h2 { margin: 0; font-size: 28px; }

h3 {
  margin: 0 0 12px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lede {
  margin: 0;
  max-width: 40em;
  color: var(--muted);
  font-size: 17px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.form { display: grid; gap: 14px; }

.fields {
  display: grid;
  gap: 12px;
}

.field { display: grid; gap: 6px; }

label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #12140f;
  color: var(--text);
  font: inherit;
}

input::placeholder { color: var(--faint); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn.primary { background: var(--accent); color: var(--ink); }
.btn.primary:hover { background: var(--accent-2); }
.btn.ghost { border-color: var(--line); background: var(--card-2); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.wide { width: 100%; }
.btn.danger { color: var(--danger); padding-inline: 10px; }

.actions, .row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 28px 0 12px;
}

.row-between h1 {
  margin: 0;
  font-size: clamp(32px, 5vw, 44px);
}

.banner {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 120, 96, 0.12);
  color: var(--danger);
  font-size: 14px;
}

.banner.ok {
  background: rgba(198, 242, 168, 0.1);
  color: var(--ok);
}

.result { margin-top: 16px; display: grid; gap: 16px; }

.result > * { min-width: 0; }

@media (min-width: 720px) {
  .fields { grid-template-columns: 1.1fr 1.3fr 0.8fr; }
  .result { grid-template-columns: 180px 1fr; align-items: start; }
}

.code {
  margin: 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

details { margin-top: 8px; }
details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  width: fit-content;
}
details .code { margin-top: 8px; }

.stamp {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 28px;
  letter-spacing: -0.04em;
}

.stamp.small {
  font-size: 18px;
  margin: 0;
}

.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 13px; }

.qr {
  width: 168px;
  height: 168px;
  border-radius: 12px;
  background: white;
  padding: 8px;
}

.recent, .link-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.recent a, .link-list a {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--card);
  text-decoration: none;
}

.recent a:hover, .link-list a:hover { border-color: var(--muted); }

.link-list a[aria-current="true"] {
  border-color: var(--accent);
  background: #262b1d;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--faint);
  font-size: 13px;
}

.board {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.detail { display: grid; gap: 12px; min-width: 0; }

.board > *,
.detail > * { min-width: 0; }

.stat {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.stat > :first-child {
  flex: 1;
  min-width: 0;
}

.stat .count { text-align: right; min-width: 4.5rem; }

.stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 0.9;
  color: var(--accent);
}

.bars { display: grid; gap: 12px; }

@media (min-width: 800px) {
  .board { grid-template-columns: 280px 1fr; align-items: start; }
  .bars { grid-template-columns: repeat(3, 1fr); }
  .link-scroll { max-height: calc(100vh - 140px); overflow: auto; }
}

.bar { display: grid; gap: 4px; margin-bottom: 10px; }

.bar-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.track {
  height: 6px;
  border-radius: 999px;
  background: #12140f;
  overflow: hidden;
}

.track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #f3ffb8);
}

.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }

th {
  text-align: left;
  color: var(--faint);
  font-weight: 700;
  padding: 0 8px 8px 0;
}

td {
  padding: 8px 8px 8px 0;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.empty {
  text-align: center;
  padding: 36px 16px;
}

.empty p { margin: 0 0 16px; color: var(--muted); }

.leave {
  min-height: 58vh;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 8px;
}

.leave-title {
  max-width: 14em;
  font-size: clamp(32px, 6vw, 52px);
}

.leave-title .host { color: var(--accent); font-style: italic; }

.url-box {
  width: min(100%, 640px);
  margin: 8px 0 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #12140f;
  border: 1px solid var(--line);
  text-align: left;
}

.foot {
  width: min(980px, calc(100% - 32px));
  margin: 0 auto;
  padding: 8px 0 28px;
  color: var(--faint);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.foot a { color: var(--muted); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 640px) {
  .stat { flex-direction: column; }
  .stat .count {
    display: flex;
    align-items: baseline;
    gap: 8px;
    text-align: left;
  }
  .top { padding-inline: 12px; }
  main, .foot { width: min(980px, calc(100% - 24px)); }
  main { padding-top: 28px; }
  .foot { display: grid; }
  .clicks thead { display: none; }
  .clicks tr { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); }
  .clicks td { border: 0; padding: 0; }
  .clicks td::before {
    content: attr(data-label);
    display: block;
    color: var(--faint);
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }
  .link-scroll { max-height: 240px; overflow: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
