:root {
  color-scheme: dark;
  --bg: #07111F;
  --bg-2: #0A1628;
  --surface: #0D1A2D;
  --line: rgba(220, 230, 255, 0.12);
  --ink: #F2F0E9;
  --muted: #969EB2;
  --accent: #78FF4D;
  --accent-hover: #94FF71;
  --danger: #ff8b84;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page: min(1180px, calc(100vw - 48px));
}

* { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(120, 160, 255, 0.07), transparent 42%),
    radial-gradient(ellipse at 100% 80%, rgba(20, 40, 80, 0.45), transparent 36%);
  z-index: -1;
}
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 20;
  background: var(--accent);
  color: var(--bg);
  padding: 10px 14px;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

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

.site-header,
.site-footer,
.page-main,
.stage,
.take,
.take-rule,
.previous,
.word-page,
.success-main,
.checkout-main,
.legal-main,
.admin-main {
  width: var(--page);
  margin-inline: auto;
}

/* Homepage: one shared content column so hero and archive share an edge. */
body.home #main {
  width: var(--page);
  margin-inline: auto;
}
body.home #main .stage,
body.home #main .take,
body.home #main .take-rule,
body.home #main .previous {
  width: 100%;
  max-width: none;
  margin-inline: 0;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 28px 0 0;
}
.brand {
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 700;
}
.site-header nav,
.site-footer nav {
  display: flex;
  gap: 28px;
}
.site-header nav a,
.site-footer nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.14em;
}
.site-header nav a:hover,
.site-footer nav a:hover,
.site-header nav a[aria-current] {
  color: var(--accent);
}

.stage {
  min-height: calc(100dvh - 280px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10vh 0 8vh;
}
.live-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.18em;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  animation: live 2.6s ease-in-out infinite;
}
@keyframes live {
  50% { opacity: 0.35; }
}
.the-word {
  margin: 0;
  max-width: 100%;
  font-family: var(--mono);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.04em;
  overflow-wrap: anywhere;
  transition: opacity 400ms ease;
}
.the-word.is-leaving { opacity: 0; }
.byline {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin: 36px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.byline a {
  color: var(--accent);
  text-decoration: none;
}
.byline a:hover { color: var(--accent-hover); }

.take-rule {
  border: 0;
  border-top: 1px solid var(--line);
}
.take {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 36px 0 0;
}
.take-price {
  display: grid;
  gap: 6px;
}
.take-price > span {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
}
.take-price strong {
  color: var(--accent);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
}

.primary-button {
  border: 0;
  background: var(--accent);
  color: var(--bg);
  min-height: 52px;
  padding: 0 22px;
  letter-spacing: 0.08em;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  transition: background 180ms ease;
}
.primary-button:hover { background: var(--accent-hover); }
.primary-button:disabled { opacity: 0.5; cursor: wait; }
.ghost-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  min-height: 52px;
  padding: 0 18px;
  letter-spacing: 0.08em;
  font-size: 12px;
}
.ghost-button:hover { border-color: var(--accent); color: var(--accent); }

.site-footer {
  padding: 48px 0 40px;
  color: var(--muted);
}
.site-footer nav {
  justify-content: center;
}

.previous {
  padding: 64px 0 80px;
}
.previous h2 {
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 0.12em;
  font-weight: 400;
  text-transform: uppercase;
}
.previous-list { transition: opacity 350ms ease; }
.previous-list.is-leaving { opacity: 0; }
.prev-item {
  padding: 34px 0;
  border-top: 1px solid var(--line);
}
.prev-item:last-child { border-bottom: 1px solid var(--line); }
.prev-sentence {
  margin: 0 0 14px;
  max-width: 100%;
  font-size: clamp(20px, 1.7vw, 24px);
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.prev-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px 80px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.prev-owner { min-width: 0; color: var(--muted); }
.prev-owner a { color: var(--accent); text-decoration: none; }
.prev-owner a:hover { color: var(--accent-hover); }
.prev-facts {
  flex-shrink: 0;
  white-space: nowrap;
  margin-left: auto;
}
.previous-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 56px;
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.14em;
}
.previous-all:hover { color: var(--accent); }

.page-main { padding: 12vh 0 8vh; }
.page-kicker {
  margin: 0 0 64px;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 400;
}
.grave { display: grid; gap: 0; }
.grave-item {
  padding: 48px 0;
  border-top: 1px solid var(--line);
}
.grave-item:last-child { border-bottom: 1px solid var(--line); }
.grave-sentence {
  margin: 0 0 18px;
  font-size: clamp(22px, 3.4vw, 34px);
  line-height: 1.2;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}
.grave-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.grave-meta a { color: var(--accent); text-decoration: none; }
.grave-empty { color: var(--muted); }
.pager {
  display: flex;
  justify-content: space-between;
  margin: 48px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.pager a { color: var(--accent); text-decoration: none; }

.word-page {
  min-height: calc(100dvh - 160px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10vh 0;
}
.word-page[data-current="false"] .live-dot {
  animation: none;
  background: var(--muted);
}
.word-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  color: var(--muted);
  font-size: 12px;
  margin: 28px 0 0;
}

.success-main,
.checkout-main,
.legal-main {
  padding: 12vh 0 10vh;
  max-width: 920px;
}
.success-main .the-word,
.word-page .the-word { margin-top: 8px; }
.success-meta,
.checkout-summary {
  color: var(--muted);
  margin: 28px 0 48px;
}
.success-meta { display: flex; gap: 24px; }
.success-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.checkout-main h1,
.legal-main h1 {
  font-size: clamp(28px, 5vw, 42px);
  letter-spacing: 0.08em;
  font-weight: 500;
}
.checkout-summary > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.checkout-summary dt { color: var(--muted); }
.checkout-summary dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); }
.dev-note {
  margin-top: 24px;
  color: var(--muted);
  font-size: 11px;
}
.legal-main p {
  font-family: var(--sans);
  color: var(--muted);
  line-height: 1.7;
  font-size: 18px;
  max-width: 34em;
}
.placeholder-warning {
  border: 1px solid var(--danger);
  color: #ffd0cd;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 12px;
}

#claim-dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}
#claim-dialog::backdrop { background: rgba(4, 8, 16, 0.82); }
#claim-form { padding: 28px; }
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 28px;
}
.dialog-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.16em;
  font-weight: 500;
}
.close-button {
  border: 1px solid var(--line);
  background: transparent;
  width: 40px;
  height: 40px;
  font-size: 22px;
}
.close-button:hover { border-color: var(--accent); color: var(--accent); }
.field { display: grid; gap: 8px; margin-bottom: 18px; }
.field > span { color: var(--muted); font-size: 10px; letter-spacing: 0.12em; }
.field > span i { font-style: normal; opacity: 0.7; }
.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  padding: 13px 14px;
  border-radius: 0;
  outline: none;
  font-size: 16px;
}
.field textarea { resize: vertical; line-height: 1.35; }
.field input:focus,
.field textarea:focus { border-color: var(--accent); }
.field small { color: var(--muted); font-size: 10px; text-align: right; }
.money-input {
  display: grid;
  grid-template-columns: 48px 1fr;
  border: 1px solid var(--line);
  background: var(--bg);
}
.money-input:focus-within { border-color: var(--accent); }
.money-input b {
  display: grid;
  place-items: center;
  color: var(--accent);
  border-right: 1px solid var(--line);
}
.money-input input { border: 0; font-size: 22px; min-height: 48px; }
.form-error { min-height: 18px; color: var(--danger); font-size: 12px; margin: 0 0 12px; }
.submit-button { width: 100%; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: 360px;
  transform: translateY(120%);
  opacity: 0;
  background: var(--accent);
  color: var(--bg);
  padding: 14px 16px;
  font-size: 12px;
  transition: 250ms ease;
}
.toast.visible { transform: none; opacity: 1; }
.noscript {
  position: fixed;
  inset: auto 0 0;
  margin: 0;
  padding: 12px;
  background: var(--danger);
  color: #160505;
  text-align: center;
}

.admin-body { background: var(--bg-2); }
.admin-label { color: var(--accent); font-size: 11px; letter-spacing: 0.14em; }
.admin-main { padding: 48px 0 80px; width: min(1180px, calc(100vw - 32px)); }
.admin-login {
  display: grid;
  grid-template-columns: minmax(220px, 420px) 140px;
  gap: 12px;
  align-items: end;
}
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 28px 0;
}
.admin-stats div {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 14px;
}
.admin-stats dt { color: var(--muted); font-size: 10px; }
.admin-stats dd { margin: 8px 0 0; font-size: 18px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.admin-tabs button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
}
.admin-tabs button.active,
.admin-tabs button:hover { color: var(--accent); border-color: var(--accent); }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--line); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 920px; font-size: 12px; }
.admin-table th,
.admin-table td { text-align: left; padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin-table th { color: var(--muted); font-weight: 500; }
.admin-table small { display: block; color: var(--muted); margin-top: 6px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.admin-actions button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 6px 8px;
  font-size: 10px;
}
.admin-actions button:hover { color: var(--accent); }

@media (max-width: 820px) {
  :root { --page: min(100% - 32px, 720px); }
  .stage { min-height: calc(100dvh - 240px); padding-top: 8vh; }
  .take { flex-direction: column; align-items: stretch; }
  .take .primary-button { width: 100%; }
  .byline { flex-direction: column; gap: 8px; }
  .success-actions .primary-button { width: auto; }
  .previous { padding: 56px 0 64px; }
  .prev-item { padding: 28px 0; }
  .prev-sentence { font-size: 20px; }
  .prev-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    font-size: 14px;
  }
  .prev-facts { margin-left: 0; }
  .previous-all { margin-top: 40px; }
}
@media (max-width: 520px) {
  .site-header { padding-top: 20px; }
  .site-header nav { gap: 16px; }
  #claim-form { padding: 20px; }
  .admin-login { grid-template-columns: 1fr; }
  .checkout-summary > div { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 360px) {
  :root { --page: min(100% - 24px, 720px); }
}

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