/* Mostly Kat Battles: a 1980s-90s fighting game's title screen. The fire-and-stone title with
   its medallion, the stage floor and the fighter select all come from that era. Marmalade is
   Whiskers / player 1 and every primary action; lavender is Shadow and secondary actions. The
   fire gradient is only for the title, VS and the FIGHT! stamp. */

:root {
  --void: #000000;
  --cabinet: #0e0b2b;
  --cabinet-edge: #2a2560;
  --text: #f4efe2;
  --muted: #aaa6c9;
  --marmalade: #ffb44a;
  --marmalade-strong: #c9781c;
  --lavender: #b8a4ff;
  --lavender-strong: #7a63d9;
  --p1-p2: linear-gradient(90deg, var(--marmalade), var(--lavender));
  --on-accent: #120d02;
  --error: #ff8f8f;
  --stone-1: #8d8577;
  --stone-2: #5f584d;
  --stone-3: #36312a;
  --fire: linear-gradient(180deg, #fff1a8 8%, #ffb44a 40%, #ff6a1f 70%, #c4261a 100%);

  /* Names the admin pages rely on. */
  --bg: var(--void);
  --surface: var(--cabinet);
  --panel: var(--cabinet);
  --panel-text: var(--text);
  --border: var(--cabinet-edge);
  --focus: #ffffff;

  --font:
    'Atkinson Hyperlegible Next', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bungee', 'Arial Black', Impact, sans-serif;
  --pixel: 'Silkscreen', ui-monospace, monospace;
  color-scheme: dark;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.55;
  overflow-x: hidden;
  background: var(--void);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration-color: var(--marmalade);
  text-underline-offset: 0.18em;
}

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

h1,
h2,
h3 {
  line-height: 1.1;
}

h2 {
  font-family: var(--display);
  font-weight: 400;
  letter-spacing: 0.02em;
}

h3 {
  font-weight: 800;
}

/* ---------- Attract screen (title) ---------- */

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px 48px;
}

/* The title screen is lit like a stage at night: a warm spotlight behind the title. */
.attract {
  padding-top: clamp(28px, 6vw, 56px);
  text-align: center;
  background: radial-gradient(ellipse 60% 55% at 50% 45%, rgb(255 106 31 / 0.16), transparent 70%);
}

.lockup {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: clamp(4px, 2vw, 24px);
  position: relative;
  z-index: 1;
  margin-bottom: -12px;
}

/* A sprite-style drop shadow under each cat's feet, drawn behind the transparent image. */
.squarer {
  width: clamp(64px, 16vw, 180px);
  background: radial-gradient(ellipse 44% 6% at 50% 96%, rgb(0 0 0 / 0.75), transparent 75%);
  filter: drop-shadow(0 0 14px rgb(255 106 31 / 0.25));
}

.squarer.whiskers {
  justify-self: end;
}

.squarer.shadow {
  justify-self: start;
  filter: drop-shadow(0 0 14px rgb(184 164 255 / 0.3));
}

.title-block {
  display: grid;
  justify-items: center;
  padding-bottom: clamp(22px, 4vw, 36px);
}

.medallion {
  width: clamp(56px, 10vw, 96px);
  margin-bottom: -6px;
  filter: drop-shadow(0 0 16px rgb(255 140 40 / 0.45));
}

/* Fire-filled letters with a carved stone extrusion: each drop-shadow stacks on the last, so
   three 2px steps make a 6px slab, then a warm glow sits behind it all. */
.title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.1rem, 8.6vw, 5.4rem);
  line-height: 0.92;
  letter-spacing: 0.01em;
  color: var(--marmalade);
  background: var(--fire);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1px rgb(60 20 0 / 0.55);
  filter: drop-shadow(0 2px 0 var(--stone-1)) drop-shadow(0 2px 0 var(--stone-2))
    drop-shadow(0 2px 0 var(--stone-3)) drop-shadow(0 0 22px rgb(255 90 20 / 0.45));
}

.title span {
  display: block;
}

.tagline {
  margin: 22px auto 0;
  max-width: 30em;
  font-size: clamp(1.1rem, 2.6vw, 1.45rem);
  font-weight: 800;
  color: var(--text);
}

/* The stage floor the cats stand on. The lockup overlaps it slightly so the cats' feet (and
   the shadows under them) land on the floor rather than above it. */
.floor {
  height: clamp(36px, 7vw, 64px);
  margin: 0 -16px;
  border-top: 3px solid transparent;
  border-image: var(--p1-p2) 1;
  background: linear-gradient(180deg, #241c52, transparent);
}

/* ---------- Arena: screenshot + sign-up ---------- */

.arena {
  display: grid;
  gap: 28px;
  margin-top: 28px;
}

/* On phones the sign-up comes straight after the title; the screenshot follows. */
.side {
  order: -1;
}

@media (min-width: 900px) {
  .side {
    order: 0;
  }

  .arena {
    grid-template-columns: minmax(0, 1fr) 380px;
    column-gap: 40px;
    align-items: start;
  }

  .side .card {
    position: sticky;
    top: 24px;
  }
}

.hero-shot {
  margin: 0;
}

.hero-shot img,
.shots img {
  border: 2px solid var(--cabinet-edge);
  box-shadow:
    0 0 0 4px var(--void),
    0 0 0 5px var(--cabinet-edge);
}

figcaption,
.fine-print {
  margin: 12px 0 0;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* ---------- Cards, forms, buttons ---------- */

.card {
  position: relative;
  background: var(--cabinet);
  border: 1px solid var(--cabinet-edge);
  padding: 24px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 1.45rem;
  color: var(--marmalade);
}

.card h3 {
  margin: 24px 0 6px;
  font-size: 1.05rem;
}

.card > p {
  margin: 0 0 16px;
}

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

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}

.optional {
  font-weight: 400;
  color: var(--muted);
}

input[type='email'],
input[type='text'],
textarea {
  font: inherit;
  font-weight: 400;
  color: var(--text);
  background: var(--void);
  border: 2px solid var(--cabinet-edge);
  border-radius: 0;
  padding: 10px 12px;
  width: 100%;
}

input:focus-visible,
textarea:focus-visible {
  border-color: var(--focus);
  outline-offset: 1px;
}

.honeypot {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Cabinet buttons: a lit face over a darker base that you press down into. */
.button {
  display: inline-block;
  font: inherit;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
  color: var(--on-accent);
  background: var(--marmalade);
  border: 0;
  border-radius: 4px;
  box-shadow:
    0 5px 0 var(--marmalade-strong),
    0 0 18px rgb(255 180 74 / 0.25);
  padding: 12px 20px;
  min-height: 48px;
  cursor: pointer;
}

.button:hover {
  filter: brightness(1.08);
}

.button:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--marmalade-strong);
}

.button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.button.big {
  display: block;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.03em;
  padding: 16px 24px;
  margin: 18px 0 22px;
}

.button.secondary {
  background: var(--lavender);
  box-shadow:
    0 5px 0 var(--lavender-strong),
    0 0 18px rgb(184 164 255 / 0.2);
}

.button.secondary:active {
  box-shadow: 0 2px 0 var(--lavender-strong);
}

.error {
  color: var(--error);
  font-weight: 600;
  margin: 0;
}

.error:empty {
  display: none;
}

.callout {
  border-left: 4px solid var(--lavender);
  padding: 4px 0 4px 14px;
  margin: 8px 0 0;
}

.callout p {
  margin: 0 0 12px;
}

.how-to {
  padding-left: 1.2em;
  margin: 0;
}

.how-to li + li {
  margin-top: 8px;
}

.how-to li::marker {
  color: var(--marmalade);
}

#turnstile:empty {
  display: none;
}

#turnstile {
  margin-top: 12px;
}

/* FIGHT! stamps over the tester card once, right after sign-up (home.js adds .just-joined). */
.fight {
  display: none;
}

.just-joined .fight {
  position: absolute;
  top: 36px;
  left: 0;
  right: 0;
  z-index: 1;
  display: block;
  width: max-content;
  margin: 0 auto;
  line-height: 1;
  font-family: var(--display);
  font-size: clamp(3rem, 14vw, 5rem);
  background: var(--fire);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px #1b1006;
  filter: drop-shadow(0 3px 0 var(--stone-2)) drop-shadow(0 3px 0 var(--stone-3))
    drop-shadow(0 0 12px rgb(0 0 0 / 0.8));
  pointer-events: none;
  animation: fight 1300ms cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards;
}

@keyframes fight {
  0% {
    transform: scale(2.4) rotate(-6deg);
    opacity: 0;
  }
  18% {
    transform: scale(1) rotate(-6deg);
    opacity: 1;
  }
  70% {
    transform: scale(1.05) rotate(-6deg);
    opacity: 1;
  }
  100% {
    transform: scale(1.05) rotate(-6deg);
    opacity: 0;
    visibility: hidden;
  }
}

/* ---------- Choose your fighter ---------- */

.select {
  margin-top: clamp(48px, 8vw, 80px);
}

.select h2,
.shots h2 {
  margin: 0 0 18px;
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  color: var(--text);
}

.fighters {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.fighter {
  border: 2px solid var(--marmalade);
  background: linear-gradient(180deg, rgb(255 180 74 / 0.14), transparent 60%), var(--cabinet);
  padding: 20px;
}

.fighter.p2 {
  border-color: var(--lavender);
  background: linear-gradient(180deg, rgb(184 164 255 / 0.16), transparent 60%), var(--cabinet);
}

.fighter img {
  width: 170px;
  margin: 0 auto 8px;
}

.fighter h3 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--marmalade);
}

.fighter.p2 h3 {
  color: var(--lavender);
}

.slot {
  font-family: var(--pixel);
  font-size: 0.8rem;
  vertical-align: 0.3em;
  padding: 2px 6px;
  color: var(--on-accent);
}

.fighter.p1 .slot {
  background: var(--marmalade);
}

.fighter.p2 .slot {
  background: var(--lavender);
}

.fighter p {
  margin: 0;
  max-width: 34ch;
}

.versus {
  justify-self: center;
  font-family: var(--display);
  font-size: 2rem;
  line-height: 1;
  background: var(--fire);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

@media (min-width: 720px) {
  .fighters {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
  }

  .fighter.p2 {
    text-align: right;
  }

  .fighter.p2 p {
    margin-left: auto;
  }
}

/* ---------- Sneak peek ---------- */

.shots {
  margin-top: clamp(48px, 8vw, 80px);
}

.shots .grid {
  display: grid;
  gap: 20px;
}

.shots img {
  width: 100%;
}

@media (min-width: 720px) {
  .shots .grid {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
  }
}

footer {
  margin-top: 56px;
  padding-top: 16px;
  border-top: 1px solid var(--cabinet-edge);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 0.9rem;
}

footer p {
  margin: 0;
}

.credit {
  font-family: var(--pixel);
  color: var(--marmalade);
}

/* ---------- Feedback page ---------- */

.feedback {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 16px 64px;
}

.feedback h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.7rem, 5vw, 2.5rem);
  line-height: 1.05;
  margin: 12px 0 12px;
  color: var(--marmalade);
}

.lede {
  font-size: 1.1rem;
  max-width: 36em;
}

.back {
  margin: 0;
}

.back a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
}

.back img {
  width: 36px;
}

.back a:hover span {
  text-decoration: underline;
  text-decoration-color: var(--marmalade);
}

.question-group h2 {
  font-size: 1.35rem;
  margin: 48px 0 4px;
  padding-bottom: 10px;
  border-bottom: 3px solid transparent;
  border-image: var(--p1-p2) 1;
  color: var(--text);
}

fieldset.question {
  border: 0;
  margin: 28px 0 0;
  padding: 0;
  min-width: 0;
}

fieldset.question legend {
  font-weight: 800;
  padding: 0;
  margin-bottom: 10px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  position: relative;
  font-weight: 600;
}

.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.chip span {
  padding: 9px 16px;
  border: 2px solid var(--cabinet-edge);
  border-radius: 4px;
  background: var(--cabinet);
  min-height: 44px;
  display: flex;
  align-items: center;
}

@media (hover: hover) {
  .chip:hover span {
    border-color: var(--marmalade);
  }
}

.chip:has(input:checked) span {
  background: var(--marmalade);
  border-color: var(--marmalade);
  color: var(--on-accent);
  box-shadow: 0 0 14px rgb(255 180 74 / 0.35);
}

.chip:has(input:focus-visible) span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

details {
  margin-top: 10px;
}

summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

details textarea {
  margin-top: 8px;
}

.anything-else {
  margin-top: 48px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 1.35rem;
}

.anything-else textarea {
  font-family: var(--font);
  font-size: 1.0625rem;
}

#feedback-form > .button.big {
  margin-bottom: 0;
}

#thanks {
  margin-top: 24px;
}

#thanks h2 {
  font-size: 2rem;
}

/* ---------- Plain pages (unsubscribe, 404) ---------- */

.plain {
  max-width: 620px;
  margin: 0 auto;
  padding: 64px 16px;
}

.plain h1 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(1.9rem, 6vw, 2.8rem);
  margin: 0 0 16px;
  color: var(--marmalade);
}

.plain .medallion {
  margin-bottom: 20px;
}

.plain form {
  display: block;
  margin: 20px 0;
}

.continue {
  margin: 28px 0 0;
  font-family: var(--pixel);
  font-size: 1.4rem;
  color: var(--marmalade);
}

.continue span {
  margin-left: 0.4em;
  font-size: 2.4rem;
  vertical-align: -0.15em;
  color: var(--text);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .just-joined .fight {
    display: none;
  }

  .button:active {
    transform: none;
  }
}

/* ---------- Admin ---------- */

body.admin {
  font-size: 1rem;
  background-image: none;
}

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 14px 16px;
  background: var(--void);
  border-bottom: 3px solid transparent;
  border-image: var(--p1-p2) 1;
  color: var(--panel-text);
  font-weight: 700;
}

.admin-nav a {
  text-decoration: none;
}

body.admin main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

body.admin h1 {
  font-size: 2rem;
}

body.admin h2 {
  margin-top: 36px;
  font-family: var(--font);
  font-weight: 800;
  letter-spacing: 0;
}

.totals {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0;
}

.totals div {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 18px;
  min-width: 150px;
}

.totals dt {
  color: var(--muted);
  font-size: 0.9rem;
}

.totals dd {
  margin: 0;
  font-size: 2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

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

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-weight: 700;
  color: var(--muted);
}

td form {
  display: inline;
}

td button {
  font: inherit;
  font-size: 0.85rem;
  margin-left: 6px;
}

body.admin .button {
  padding: 6px 14px;
  min-height: 0;
  font-size: 0.9rem;
  margin-left: 6px;
}

.result {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

.result h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.counts {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}

.counts li {
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.bar {
  display: inline-block;
  width: 160px;
  height: 10px;
  background: var(--border);
  overflow: hidden;
  vertical-align: middle;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--marmalade);
}

.comments {
  margin: 10px 0 0;
  padding-left: 1.2em;
}

.comments li + li {
  margin-top: 4px;
}
