/* ===========================================================================
   Animated Punks — whitelist
   Monochrome CRT. Black field, silver pixel type, no rounded corners anywhere:
   the collection is pixel art, so every edge stays on the grid.
   =========================================================================== */

:root {
  --bg:        #000000;
  --panel:     #080808;
  --panel-2:   #0e0e0e;
  --line:      #242424;
  --line-hi:   #3d3d3d;
  --dim:       #757575;
  --mid:       #a8a8a8;
  --text:      #e6e6e6;
  --bright:    #ffffff;
  --ok:        #62f39a;
  --bad:       #ff5252;

  --pixel: 'Press Start 2P', monospace;
  --mono:  'IBM Plex Mono', ui-monospace, monospace;

  --gap: 20px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.65;
  letter-spacing: 0.01em;
  padding: 0 16px 96px;
  overflow-x: hidden;
}

/* Faint CRT scanlines over the whole page, echoing the banner artwork. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255,255,255,.028) 0px,
    rgba(255,255,255,.028) 1px,
    transparent 1px,
    transparent 3px);
}

img { image-rendering: pixelated; }

a { color: var(--bright); text-decoration: none; border-bottom: 1px solid var(--line-hi); }
a:hover { border-bottom-color: var(--bright); }

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

.wrap { max-width: 620px; margin: 0 auto; }
.wrap-wide { max-width: 900px; margin: 0 auto; }

/* ------------------------------------------------------------------ header */

.masthead {
  padding: 40px 0 30px;
  text-align: center;
}

.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;
}

/* The banner artwork already carries the wordmark, so it is the hero. */
.banner-link { display: block; border: 0; }
.banner-link:hover { border: 0; }

.hero-banner {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
}

.mark {
  width: 96px; height: 96px;
  display: block;
  margin: 0 auto 22px;
  border: 1px solid var(--line);
}

.wordmark {
  font-family: var(--pixel);
  font-size: clamp(17px, 5.4vw, 30px);
  line-height: 1.5;
  color: var(--bright);
  margin: 0;
  text-shadow: 0 0 18px rgba(255,255,255,.22);
}

.wordmark span { display: block; }

/* ---------------------------------------------------- facts / showcase -- */

.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  margin-bottom: 16px;
}

.fact { background: var(--panel); padding: 15px 12px; text-align: center; }
.fact b {
  display: block;
  font-family: var(--pixel);
  font-size: 13px;
  color: var(--bright);
  margin-bottom: 8px;
}
.fact span { font-size: 11px; color: var(--dim); line-height: 1.4; display: block; }

.showcase {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.showcase img { width: 100%; height: auto; display: block; }
.showcase-note { margin: 14px 0 0; }

/* ----------------------------------------------------------------- steps */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
}
.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
}
.steps li:last-child { border-bottom: 0; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--dim);
  padding-top: 3px;
}
.steps li p { margin: 0; }
.steps li b { color: var(--text); font-weight: 500; }

/* ------------------------------------------------------- admin preview -- */

.preview-bar {
  border: 1px solid var(--line-hi);
  border-left: 3px solid var(--bright);
  background: var(--panel-2);
  padding: 13px 16px;
  margin-bottom: 16px;
  font-size: 12.5px;
  color: var(--mid);
}
.preview-bar b { color: var(--bright); font-weight: 600; }

.nav a.preview { color: var(--mid); }
.nav a.preview::after {
  content: ' ·hidden';
  color: #4a4a4a;
  font-size: 10px;
}

.tagline {
  color: var(--dim);
  margin: 16px 0 0;
  font-size: 12.5px;
}

/* Small nav that reflects which pages the admin has switched on. */
.nav {
  display: flex;
  justify-content: center;
  gap: 0;
  margin-top: 26px;
  border: 1px solid var(--line);
  width: fit-content;
  margin-inline: auto;
}

.nav a, .nav span {
  padding: 8px 15px;
  font-size: 11.5px;
  color: var(--dim);
  border: 0;
  border-right: 1px solid var(--line);
}
.nav a:last-child, .nav span:last-child { border-right: 0; }
.nav a:hover { color: var(--bright); background: var(--panel-2); }
.nav a[aria-current='page'] { color: var(--bright); background: var(--panel-2); }
.nav span { color: #3f3f3f; }

/* ------------------------------------------------------------------ panels */

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 22px;
  margin-bottom: 16px;
}

.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  font-family: var(--pixel);
  font-size: 11px;
  line-height: 1.6;
  margin: 0;
  color: var(--bright);
}

.panel-head .count { color: var(--dim); font-size: 12px; }

.note { color: var(--dim); font-size: 12.5px; margin: 0 0 14px; }

/* ------------------------------------------------------------------- tasks */

.task {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  grid-template-areas: 'box body action';
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.task .box       { grid-area: box; }
.task .task-body { grid-area: body; }
.task .btn       { grid-area: action; }
.task:last-of-type { border-bottom: 0; }

.box {
  width: 20px; height: 20px;
  padding: 0;
  border: 1px solid var(--line-hi);
  display: grid;
  place-items: center;
  background: transparent;
}
/* The tick is a filled square, not a glyph — pixel type has no checkmark. */
.box::after {
  content: '';
  width: 10px; height: 10px;
  background: transparent;
  transition: background .1s linear;
}
.task.done .box { border-color: var(--ok); background: rgba(98,243,154,.08); }
.task.done .box::after { background: var(--ok); }

.task-body strong { display: block; font-weight: 500; color: var(--text); }
.task-body small  { display: block; color: var(--dim); font-size: 12px; margin-top: 2px; }
.task.done .task-body strong { color: var(--mid); }

/* The hint swaps for a verified line once the link has been opened. */
.task .hint-done { display: none; color: var(--ok); }
.task.done .hint-default { display: none; }
.task.done .hint-done { display: block; }

/* ----------------------------------------------------------------- buttons */

button, .btn {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: .02em;
  padding: 9px 16px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-hi);
  cursor: pointer;
  transition: background .12s linear, color .12s linear, border-color .12s linear;
}
button:hover:not(:disabled), .btn:hover { background: var(--bright); color: #000; border-color: var(--bright); }
button:disabled { opacity: .35; cursor: not-allowed; }

.btn-primary {
  background: var(--bright);
  color: #000;
  border-color: var(--bright);
  font-weight: 600;
}
.btn-primary:hover { background: var(--text); border-color: var(--text); color: #000; }

.btn-block { display: block; width: 100%; text-align: center; }

.btn-x {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
}
.btn-x svg { width: 15px; height: 15px; fill: currentColor; }

/* ------------------------------------------------------------------ inputs */

label { display: block; font-size: 12px; color: var(--dim); margin-bottom: 6px; }
label .opt {
  color: #4a4a4a;
  border: 1px solid var(--line);
  padding: 1px 6px;
  margin-left: 6px;
  font-size: 10.5px;
}
.hint { font-size: 11.5px; color: var(--dim); margin: 7px 0 0; }
.hint.ok  { color: var(--ok); }
.hint.bad { color: var(--bad); }

input[type=text], input[type=number], textarea, select {
  width: 100%;
  font-family: var(--mono);
  font-size: 13px;
  padding: 10px 12px;
  background: #000;
  color: var(--text);
  border: 1px solid var(--line-hi);
}
input::placeholder { color: #4a4a4a; }
input:focus, textarea:focus { border-color: var(--bright); outline: none; }

.field { margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: flex-end; }
.row > .field { flex: 1; margin-bottom: 0; }

/* -------------------------------------------------------------- referral -- */

.code-slab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line-hi);
  background: #000;
  padding: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.code-slab .code {
  font-family: var(--pixel);
  font-size: 19px;
  color: var(--bright);
  letter-spacing: .06em;
}

.link-slab {
  display: flex;
  gap: 0;
  border: 1px solid var(--line-hi);
  margin-bottom: 16px;
}
.link-slab input {
  border: 0;
  border-right: 1px solid var(--line-hi);
  font-size: 12px;
  min-width: 0;
}
.link-slab button { border: 0; white-space: nowrap; }

/* progress ticks — one square per referral needed */
.ticks { display: flex; gap: 6px; margin: 4px 0 14px; }
.tick {
  flex: 1;
  height: 10px;
  border: 1px solid var(--line-hi);
  background: transparent;
}
.tick.on { background: var(--ok); border-color: var(--ok); }

/* --------------------------------------------------------------- statuses -- */

.status {
  border: 1px solid var(--line-hi);
  padding: 16px;
  font-size: 13px;
}
.status.win  { border-color: var(--ok);  color: var(--ok);  background: rgba(98,243,154,.06); }
.status.miss { border-color: var(--bad); color: var(--bad); background: rgba(255,82,82,.06); }
.status strong { display: block; font-family: var(--pixel); font-size: 11px; line-height: 1.7; margin-bottom: 8px; }

.locked {
  text-align: center;
  padding: 54px 24px;
  border: 1px dashed var(--line-hi);
  color: var(--dim);
}
.locked h2 { font-family: var(--pixel); font-size: 12px; color: var(--mid); margin: 0 0 12px; line-height: 1.7; }

.meter {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--dim);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 16px;
}
.meter b { color: var(--text); font-weight: 500; }

/* ------------------------------------------------------------------ tables */

table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--dim); font-weight: 500; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--panel-2); }

.rank { font-family: var(--pixel); font-size: 10px; color: var(--dim); }
.rank.top { color: var(--bright); }

.who { display: flex; align-items: center; gap: 9px; }
.who img { width: 22px; height: 22px; border: 1px solid var(--line); }

/* ------------------------------------------------------------------- misc */

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stat { background: var(--panel); padding: 14px; }
.stat b { display: block; font-family: var(--pixel); font-size: 15px; color: var(--bright); margin-bottom: 6px; }
.stat span { font-size: 11.5px; color: var(--dim); }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.toggle-row:last-child { border-bottom: 0; }
.toggle-row div small { display: block; color: var(--dim); font-size: 11.5px; }

.switch {
  width: 52px; height: 24px;
  border: 1px solid var(--line-hi);
  background: #000;
  position: relative;
  cursor: pointer;
  flex: none;
  padding: 0;
}
.switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  background: var(--dim);
  transition: transform .12s linear, background .12s linear;
}
.switch[aria-checked='true'] { border-color: var(--ok); }
.switch[aria-checked='true']::after { transform: translateX(26px); background: var(--ok); }
.switch:hover { background: #000; }

.toast {
  position: fixed;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  background: var(--bright);
  color: #000;
  padding: 10px 18px;
  font-size: 12.5px;
  z-index: 200;
  max-width: 90vw;
}
.toast.err { background: var(--bad); color: #fff; }

.foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: #4a4a4a;
  font-size: 11.5px;
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.foot a { color: var(--dim); border-bottom-color: var(--line); }
.foot a:hover { color: var(--bright); }

.spinner { color: var(--dim); font-size: 12.5px; padding: 28px 0; text-align: center; }

.hidden { display: none !important; }

@media (max-width: 560px) {
  .masthead { padding: 24px 0 24px; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .showcase { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 17px; }
  .grid-2 { grid-template-columns: 1fr; }
  .task {
    grid-template-columns: 22px 1fr;
    grid-template-areas: 'box body' '. action';
    row-gap: 10px;
  }
  .task .btn { justify-self: start; }
  .row { flex-direction: column; align-items: stretch; }
  .nav { width: 100%; }
  .nav a, .nav span { flex: 1; text-align: center; padding: 8px 6px; }
}

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