/* =====================================================================
   CAGGY.fun — styles (night arcade)
   ===================================================================== */

:root {
  /* Robinhood Chain palette: neon lime on near-black */
  --bg: #0b0c0a;
  --bg-2: #111310;
  --surface: #151815;
  --surface-2: #1c201b;
  --line: #262b25;
  --line-2: #353c33;
  --text: #f2f5ea;
  --muted: #a3ab99;
  --green: #d4fc50;
  --green-2: #e6ff7a;
  --green-dim: rgba(212, 252, 80, .14);
  --orange: #f0a04b;
  --danger: #ff6b6b;
  --font-display: "Silkscreen", monospace;
  --font-body: "Pixelify Sans", "Silkscreen", monospace;
  --shadow: 4px 4px 0 #000;
  /* one-step "pixel rounded" corners */
  --cut: polygon(4px 0, calc(100% - 4px) 0, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 0 calc(100% - 4px), 0 4px);
  --cut-lg: polygon(6px 0, calc(100% - 6px) 0, 100% 6px, 100% calc(100% - 6px), calc(100% - 6px) 100%, 6px 100%, 0 calc(100% - 6px), 0 6px);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 20px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

/* Fixed backdrop: crisp pixel stars (tiled SVG rects, no anti-aliasing) */
.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='173' height='131'%3E%3Crect x='31' y='9' width='3' height='3' fill='%23d4fc50' fill-opacity='.5'/%3E%3Crect x='120' y='88' width='2' height='2' fill='%23d4fc50' fill-opacity='.3'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Crect x='20' y='20' width='2' height='2' fill='%23262b25'/%3E%3C/svg%3E");
}

a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
img, .sprite { image-rendering: pixelated; image-rendering: crisp-edges; }
.hidden { display: none !important; }

h1, h2, h3, .label, .btn, .pill, .chip, .toggle__btn, .frames caption, .ca, .wallet__btn, .menu__item, .rule__when, .anim figcaption {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: .02em;
}

/* Sprite clips: 64×64 cells, 100 ms/frame; sN = scale */
.sprite { display: inline-block; width: 64px; height: 64px; max-width: none; flex: none; }
.sprite.s2 { width: 128px; height: 128px; }
.sprite.s3 { width: 192px; height: 192px; }
.sprite.s4 { width: 256px; height: 256px; }

/* ---------------------------------------------------------------------
   Buttons, chips, labels
   --------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 22px;
  font-size: 14px;
  line-height: 1;
  color: #0b0c0a;
  background: var(--green);
  border: 0;
  clip-path: var(--cut);
  text-decoration: none;
  cursor: pointer;
  transition: transform .06s, filter .06s;
  white-space: nowrap;
}
.btn:hover { transform: translate(-2px, -2px); filter: brightness(1.08); }
.btn:active { transform: translate(1px, 1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn--primary { color: #0b0c0a; }
.btn--ghost { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 2px var(--line-2); }
.btn--ghost:hover { box-shadow: inset 0 0 0 2px var(--green); filter: none; }
.btn--sm { padding: 11px 16px; font-size: 12px; }

.label {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--green-2);
  text-transform: uppercase;
}
.h2 { margin: 0 0 16px; font-size: clamp(22px, 3.2vw, 34px); line-height: 1.2; }
.lead { max-width: 720px; margin: 0 0 36px; font-size: 19px; color: var(--muted); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px;
  padding: 8px 14px;
  font-size: 11px;
  color: var(--green-2);
  background: var(--green-dim);
  border: 2px solid rgba(212, 252, 80, .35);
  clip-path: var(--cut);
}
.chip__dot { width: 8px; height: 8px; background: var(--green-2); animation: pulse 1.2s steps(2, end) infinite; }
.chip__tag { padding: 3px 6px; color: #0b0c0a; background: var(--green); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------------------------------------------------------------------
   Nav
   --------------------------------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 12px 28px;
  background: var(--bg);
  border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand__logo { width: 32px; height: 28px; overflow: hidden; }
.brand__logo .sprite { margin: -20px 0 0 -16px; }
.brand__name { font-family: var(--font-display); font-size: 18px; }
.brand__name em { font-style: normal; color: var(--green-2); }
.nav__links { display: flex; gap: 22px; margin-left: auto; font-weight: 500; font-size: 16px; }
.nav__links a { color: var(--muted); text-decoration: none; }
.nav__links a:hover { color: var(--text); }
.nav__actions { display: flex; align-items: center; }

.wallet { position: relative; }
.wallet__btn { font-family: var(--font-display); }
.wallet__dot { width: 8px; height: 8px; background: var(--green-2); }
.wallet__caret { font-size: 10px; opacity: .7; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 100%;
  padding: 6px;
  background: var(--surface);
  border: 2px solid var(--line-2);
  box-shadow: var(--shadow);
  z-index: 30;
}
.menu__item {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font-size: 12px;
  text-align: left;
  color: var(--danger);
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.menu__item:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 28px 40px;
}
.hero__title {
  margin: 0;
  font-size: clamp(56px, 8vw, 104px);
  font-weight: 700;
  line-height: .95;
  text-shadow: 6px 6px 0 #1f2a08;
}
.hero__dollar { color: var(--green-2); }
.hero__tag { margin: 12px 0 0; font-family: var(--font-display); font-size: 16px; color: var(--orange); }
.hero__sub { max-width: 560px; margin: 18px 0 0; font-size: 19px; color: var(--muted); }

.ca {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  margin: 22px 0 0;
  padding: 8px 8px 8px 14px;
  font-size: 12px;
  background: var(--surface);
  border: 2px solid var(--line-2);
  clip-path: var(--cut);
}
.ca__label { color: var(--green-2); }
.ca__addr { word-break: break-all; font-family: var(--font-body); font-weight: 500; }
.ca__short { display: none; }
.ca__copy {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid var(--line-2);
  cursor: pointer;
}
.ca__copy:hover { border-color: var(--green); color: var(--green-2); }
.ca__copy.is-copied { color: var(--bg); background: var(--green); border-color: var(--green); }

.hero__cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 22px; }
.hero__pals { display: flex; gap: 8px; margin: 18px 0 0 -16px; }

.hero__panel { display: grid; gap: 18px; }
.screen {
  overflow: hidden;
  background: var(--surface);
  border: 3px solid var(--line-2);
  box-shadow: var(--shadow);
}
.screen__bar { display: flex; align-items: center; gap: 7px; padding: 10px 12px; border-bottom: 2px solid var(--line); }
.screen__bar i { width: 10px; height: 10px; background: var(--line-2); }
.screen__bar i:first-child { background: var(--danger); }
.screen__bar i:nth-child(2) { background: var(--orange); }
.screen__bar i:nth-child(3) { background: var(--green); }
.screen__bar em { margin-left: auto; font-family: var(--font-display); font-style: normal; font-size: 11px; color: var(--muted); }
.screen__gif { width: 100%; height: auto; }

.grad {
  padding: 18px 20px 16px;
  background: var(--surface);
  border: 3px solid var(--line-2);
  box-shadow: var(--shadow);
}
.grad__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grad__head .label { margin: 0; }
.pill {
  padding: 6px 10px;
  font-size: 10px;
  color: var(--muted);
  background: var(--surface-2);
  border: 2px solid var(--line-2);
  white-space: nowrap;
}
.pill--live { color: var(--orange); border-color: rgba(240, 160, 75, .5); }
.pill--done { color: var(--bg); background: var(--green); border-color: var(--green); }
.pill--off { color: var(--muted); }
.bar {
  height: 20px;
  padding: 3px;
  background: var(--bg-2);
  border: 2px solid var(--line-2);
}
.bar__fill {
  width: 0;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--green) 0 8px, transparent 8px 11px);
  transition: width .6s steps(12, end);
}
.grad--done .bar__fill { background: repeating-linear-gradient(90deg, var(--green-2) 0 10px, #fff 10px 12px); }
.grad__meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-family: var(--font-display); font-size: 12px; }
.grad__meta span:last-child { color: var(--muted); }
.grad__note { margin: 10px 0 0; font-size: 15px; color: var(--muted); }

/* ---------------------------------------------------------------------
   Sections
   --------------------------------------------------------------------- */
.section { max-width: 1200px; margin: 0 auto; padding: 72px 28px; border-top: 2px solid var(--line); }
.section__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 32px; }
.section__head .h2 { margin-bottom: 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.tiles--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tile {
  padding: 22px;
  background: var(--surface);
  border: 2px solid var(--line-2);
  box-shadow: var(--shadow);
  transition: transform .08s, border-color .08s;
}
.tile:hover { transform: translate(-2px, -2px); border-color: var(--green); }
.tile__sprite { display: block; margin: -14px 0 2px -22px; }
.tile h3 { margin: 0 0 8px; font-size: 14px; }
.tile p { margin: 0; font-size: 16px; color: var(--muted); }

.frames {
  margin: 40px 0 0;
  border-collapse: collapse;
  min-width: min(420px, 100%);
  background: var(--surface);
  border: 2px solid var(--line-2);
  box-shadow: var(--shadow);
}
.frames caption { padding: 12px 16px; font-size: 12px; text-align: left; color: var(--green-2); background: var(--surface-2); border: 2px solid var(--line-2); border-bottom: 0; }
.frames th, .frames td { padding: 10px 20px; border-bottom: 2px solid var(--line); text-align: left; }
.frames th { font-size: 14px; color: var(--muted); font-weight: 500; }
.frames td:last-child, .frames th:last-child { text-align: right; font-family: var(--font-display); }
.frames tbody tr:last-child td { border-bottom: 0; }

/* Motion gallery */
.toggle { display: inline-flex; padding: 4px; background: var(--surface); border: 2px solid var(--line-2); }
.toggle__btn { padding: 8px 14px; font-size: 11px; color: var(--muted); background: none; border: 0; cursor: pointer; }
.toggle__btn.is-active { color: var(--bg); background: var(--green); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.anim {
  margin: 0;
  background: var(--surface);
  border: 2px solid var(--line-2);
  box-shadow: var(--shadow);
}
.anim .sprite { display: block; width: 100%; height: auto; aspect-ratio: 1; margin: 0 auto; background: linear-gradient(var(--bg-2), var(--bg-2)) 50% 78% / 60% 8px no-repeat; }
.anim figcaption { display: flex; justify-content: space-between; padding: 12px 14px; font-size: 11px; border-top: 2px solid var(--line); }
.anim figcaption span { color: var(--muted); }

/* Buy bar */
.buy {
  display: inline-flex;
  align-items: center;
  gap: 28px;
  margin-top: 24px;
  padding: 18px 24px;
  color: #0b0c0a;
  background: var(--green);
  clip-path: var(--cut-lg);
  text-decoration: none;
  transition: transform .06s, filter .06s;
}
.buy:hover { transform: translate(-2px, -2px); filter: brightness(1.08); }
.buy__title { font-family: var(--font-display); font-size: 16px; }
.buy__hint { font-family: var(--font-display); font-size: 11px; opacity: .8; }

/* ---------------------------------------------------------------------
   Download gate
   --------------------------------------------------------------------- */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 22px; }
.rule { padding: 16px 18px; font-size: 17px; color: var(--muted); background: var(--surface); border: 2px solid var(--line-2); }
.rule strong { color: var(--text); }
.rule__when { display: block; margin-bottom: 6px; font-size: 10px; color: var(--muted); text-transform: uppercase; }
.rule.is-now { border-color: var(--green); box-shadow: var(--shadow); }
.rule.is-now .rule__when { color: var(--green-2); }
.rule.is-now .rule__when::after { content: " · now"; }

.gate { padding: 22px 24px; background: var(--surface); border: 3px solid var(--line-2); box-shadow: var(--shadow); }
.gate__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.gate__row:empty, .gate__row:not(:has(:not(.hidden))) { display: none; }
.gate__status { display: flex; align-items: center; gap: 12px; margin-top: 16px; min-height: 40px; }
.gate__status p { margin: 0; font-size: 17px; color: var(--muted); }
.gate__sprite { width: 48px; height: 48px; }
.gate--good .gate__status p { color: var(--green-2); }
.gate--bad .gate__status p { color: var(--danger); }
.gate__status a { color: var(--text); }
.gate__addr { font-family: var(--font-display); font-size: 12px; }

.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-top: 26px; }
.file { display: flex; flex-direction: column; background: var(--surface); border: 2px solid var(--line-2); box-shadow: var(--shadow); }
.file__thumb { display: grid; place-items: center; height: 120px; background: var(--bg-2); border-bottom: 2px solid var(--line); }
.file__lock { font-family: var(--font-display); font-size: 26px; color: var(--muted); opacity: .6; }
.file__body { flex: 1; padding: 14px; }
.file__body h3 { margin: 0 0 4px; font-size: 12px; }
.file__body p { margin: 0; font-size: 14px; color: var(--muted); }
.file__btn { margin: 0 14px 14px; }
.is-locked .file__btn { pointer-events: none; opacity: .4; }

/* ---------------------------------------------------------------------
   Footer + modal
   --------------------------------------------------------------------- */
.footer { margin-top: 24px; border-top: 2px solid var(--line); text-align: center; font-size: 16px; color: var(--muted); }
.footer p { margin: 0; padding: 18px 24px; }
.footer a { color: var(--green-2); }
.track { position: relative; height: 64px; overflow: hidden; background: linear-gradient(var(--bg-2), var(--bg-2) 72%, #2f4a1a 72%); border-bottom: 2px solid var(--line); }
.runner { position: absolute; bottom: -4px; left: 0; animation: cross 14s linear infinite; }
@keyframes cross { from { transform: translateX(-80px); } to { transform: translateX(100vw); } }
.runner { animation-timing-function: steps(200, end); }

.modal {
  width: min(420px, calc(100% - 32px));
  padding: 22px;
  color: var(--text);
  background: var(--surface);
  border: 3px solid var(--line-2);
  box-shadow: var(--shadow);
}
.modal::backdrop { background: rgba(0, 0, 0, .75); }
.modal h3 { margin: 0 0 16px; font-size: 14px; }
.modal__list { display: grid; gap: 10px; margin-bottom: 16px; }
.modal__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 2px solid var(--line-2);
  cursor: pointer;
  text-decoration: none;
}
.modal__item:hover { border-color: var(--green); }
.modal__item img, .modal__glyph { width: 28px; height: 28px; flex: none; image-rendering: auto; }
.modal__glyph { background: var(--line-2); }
.modal__item small { margin-left: auto; font-size: 13px; color: var(--muted); }
.modal__group { margin: 6px 0 0; font-family: var(--font-display); font-size: 10px; color: var(--muted); }

/* ---------------------------------------------------------------------
   Responsive & motion
   --------------------------------------------------------------------- */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
  .hero__pals { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 17px; }
  .nav { gap: 12px; padding: 10px 16px; }
  .nav__links, .brand__name em { display: none; }
  .nav__actions { margin-left: auto; }
  .hero { padding: 36px 16px 32px; }
  .ca__full { display: none; }
  .ca__short { display: inline; }
  .section { padding: 56px 16px; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .anim figcaption { flex-direction: column; gap: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  .runner, .chip__dot { animation: none; }
  html { scroll-behavior: auto; }
}
