/* slickagent.ai: a retro arcade cabinet holding SlickAgent's games. Two looks meet here: Bubble's night-sky cyan and
   violet, and JPApp's paper, ink and hard shadows (green, mustard, terracotta). Pixel type, self-hosted, OFL. */

@font-face {
  font-family: "Press Start 2P";
  src: url("/assets/fonts/press-start-2p.woff2") format("woff2");
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("/assets/fonts/vt323.woff2") format("woff2");
  font-display: swap;
}

:root {
  --bg: #0e0c16;
  --bg-2: #15121f;
  --panel: #1b1729;
  --panel-2: #241f36;
  --line: #3a3354;
  --paper: #f6f1e7;
  --ink: #07060b;
  --muted: #aaa3c2;
  --dim: #6f6890;
  /* Bubble */
  --cyan: #61d9fa;
  --violet: #9e85fa;
  /* JPApp, lit up for a dark screen */
  --green: #7fd483;
  --mustard: #f0c84b;
  --terra: #ef7350;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --crt: "VT323", ui-monospace, "SF Mono", Menlo, monospace;
  --max: 1160px;
  --gutter: max(16px, calc((100vw - var(--max)) / 2));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--paper);
  font: 22px/1.25 var(--crt);
  overflow-x: hidden;
  -webkit-font-smoothing: none;
}
/* The tube: scanlines and a vignette over everything. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  background:
    repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, 0.22) 2px 3px),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.45) 100%);
}
::selection { background: var(--mustard); color: var(--ink); }
a { color: var(--cyan); }
:focus-visible { outline: 3px dashed var(--mustard); outline-offset: 4px; }
h1, h2, h3, h4 { font-family: var(--pixel); font-weight: 400; line-height: 1.35; margin: 0; }
p { margin: 0; }
kbd {
  display: inline-block;
  font: 18px/1 var(--crt);
  padding: 3px 6px 2px;
  color: var(--paper);
  background: var(--panel-2);
  border: 2px solid var(--line);
  box-shadow: 0 2px 0 var(--ink);
  white-space: nowrap;
}
.skip { position: absolute; left: 16px; top: -80px; z-index: 200; background: var(--mustard); color: var(--ink); padding: 8px 12px; font-family: var(--pixel); font-size: 11px; }
.skip:focus { top: 12px; }

/* Sprites are drawn by main.js as crisp SVG pixels. */
.sprite { display: inline-block; flex: none; }
.sprite svg { display: block; width: 100%; height: 100%; shape-rendering: crispEdges; }

/* ───────────── HUD ───────────── */
.hud {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px var(--gutter);
  background: rgba(14, 12, 22, 0.92);
  border-bottom: 3px solid var(--ink);
  box-shadow: 0 3px 0 var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--paper); text-decoration: none; font: 13px/1 var(--pixel); }
.logo b { font-weight: 400; color: var(--cyan); }
.logo-sprite { width: 24px; height: 24px; }
.scores { display: flex; gap: 20px; margin-left: auto; font-family: var(--pixel); font-size: 12px; }
.score { display: flex; align-items: baseline; gap: 8px; }
.score small { font-size: 10px; color: var(--terra); }
.score.hi small { color: var(--mustard); }
.score output { color: var(--paper); letter-spacing: 1px; }
.score.bump output { color: var(--mustard); }
.hud nav { display: flex; gap: 18px; }
.hud nav a { color: var(--muted); text-decoration: none; font-size: 22px; display: flex; align-items: center; gap: 6px; }
.hud nav a:hover { color: var(--paper); }
.hud nav kbd { font-size: 16px; padding: 1px 5px; }

/* ───────────── Title screen ───────────── */
.title-screen {
  position: relative;
  min-height: min(92vh, 860px);
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: 72px var(--gutter) 120px;
  isolation: isolate;
}
.stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.floor {
  position: absolute;
  left: -50%;
  right: -50%;
  bottom: -2px;
  height: 46%;
  z-index: -1;
  transform: perspective(320px) rotateX(62deg);
  transform-origin: 50% 100%;
  background:
    repeating-linear-gradient(to right, rgba(158, 133, 250, 0.55) 0 2px, transparent 2px 64px),
    repeating-linear-gradient(to bottom, rgba(158, 133, 250, 0.55) 0 2px, transparent 2px 64px);
  mask-image: linear-gradient(to top, #000 10%, transparent 95%);
  -webkit-mask-image: linear-gradient(to top, #000 10%, transparent 95%);
  animation: floor 1.6s linear infinite;
}
@keyframes floor { to { background-position: 0 0, 0 64px; } }
.title-inner { text-align: center; max-width: 900px; display: grid; justify-items: center; gap: 22px; }
.credit { font: 10px/1.6 var(--pixel); color: var(--dim); letter-spacing: 1px; }
.marquee {
  font-size: clamp(26px, 8.4vw, 92px);
  line-height: 1.1;
  color: var(--paper);
  text-shadow:
    0.06em 0.06em 0 var(--terra),
    0.12em 0.12em 0 var(--violet),
    0.18em 0.18em 0 var(--ink);
  white-space: nowrap;
  margin-right: 0.18em;
}
.marquee-2 { color: var(--cyan); }
.tagline { font: clamp(12px, 2.2vw, 18px)/1.6 var(--pixel); color: var(--mustard); }
.tagline em { font-style: normal; color: var(--paper); border-bottom: 3px solid var(--terra); }
.lede { max-width: 640px; color: var(--muted); font-size: 24px; }
.start {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  padding: 16px 22px 14px;
  font: 14px/1 var(--pixel);
  color: var(--ink);
  background: var(--mustard);
  text-decoration: none;
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--ink), 5px 5px 0 3px var(--terra);
  transition: transform 80ms steps(2), box-shadow 80ms steps(2);
}
.start:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--ink), 7px 7px 0 3px var(--terra); }
.start:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.start-arrow { animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }
.cast { display: flex; align-items: flex-end; gap: 48px; margin-top: 18px; }
.cast-bubble { width: 80px; height: 80px; animation: bob 1.4s steps(4) infinite alternate; }
.cast-jp { width: 80px; height: 80px; animation: bob 1.4s steps(4) 0.7s infinite alternate; }
@keyframes bob { to { transform: translateY(-14px); } }

/* ───────────── Sections ───────────── */
main > section:not(.title-screen) { padding: 96px var(--gutter); }
.section-head { display: grid; gap: 14px; margin-bottom: 40px; max-width: 760px; }
.eyebrow { font: 10px/1.6 var(--pixel); color: var(--terra); letter-spacing: 1px; text-transform: uppercase; }
.section-head h2 { font-size: clamp(20px, 4vw, 34px); text-shadow: 4px 4px 0 var(--ink), 4px 4px 0 var(--violet); }
.section-head p:not(.eyebrow) { color: var(--muted); }
.hint kbd { font-size: 16px; }

/* ───────────── Cartridges ───────────── */
.games { background: linear-gradient(var(--bg), var(--bg-2)); }
.rules { background: var(--bg-2); }
.carts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.cart {
  --accent: var(--cyan);
  --accent-2: var(--violet);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 26px 24px 24px;
  background: var(--panel);
  border: 4px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--line), 8px 8px 0 var(--ink);
  outline: none;
  transition: transform 100ms steps(2), box-shadow 100ms steps(2);
}
.cart[data-game="jpapp"] { --accent: var(--mustard); --accent-2: var(--terra); }
.cart.selected {
  transform: translate(-3px, -3px);
  box-shadow: inset 0 0 0 3px var(--accent), 10px 10px 0 var(--accent-2);
}
.cart:focus-visible { outline: 3px dashed var(--mustard); outline-offset: 6px; }
.cursor {
  position: absolute;
  top: -34px;
  left: 20px;
  font: 12px/1 var(--pixel);
  color: var(--accent);
  visibility: hidden;
}
.cart.selected .cursor { visibility: visible; animation: hop 0.6s steps(2) infinite alternate; }
@keyframes hop { to { transform: translateY(-5px); } }
.cart-label {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--accent);
  flex-wrap: wrap;
}
.cart-sprite { width: 64px; height: 64px; }
.cart-label > div { flex: 1 1 170px; display: grid; gap: 6px; }
.slot { font: 9px/1 var(--pixel); color: var(--dim); }
.cart h3 { font-size: clamp(18px, 2.6vw, 24px); color: var(--accent); text-shadow: 3px 3px 0 var(--ink); }
.genre { color: var(--muted); font-size: 20px; }
.status { font: 9px/1 var(--pixel); padding: 7px 8px 6px; color: var(--ink); border: 2px solid var(--ink); }
.status.early { background: var(--cyan); }
.status.live { background: var(--green); }
.status.live::before { content: "● "; animation: blink 1.2s steps(2, start) infinite; }
.blurb { color: var(--paper); }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin: 0; }
.stats div { display: grid; gap: 4px; }
.stats dt { font: 9px/1 var(--pixel); color: var(--muted); }
.stats dd { margin: 0; }
.bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; height: 14px; }
.bar i { background: var(--panel-2); border: 1px solid var(--ink); }
.bar i.on { background: var(--accent); }
.bar i.on:nth-child(n + 8) { background: var(--accent-2); }

.cart h4 { font-size: 10px; color: var(--accent); }
.moves { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.moves li { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: start; font-size: 20px; color: var(--muted); }
.moves kbd { justify-self: start; font-size: 17px; }
.cart[data-game="jpapp"] .moves li { grid-template-columns: 40px 1fr; }
.moves b { color: var(--paper); font-weight: 400; display: block; }
.play {
  margin-top: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 12px;
  font: 12px/1 var(--pixel);
  color: var(--ink);
  background: var(--accent);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: transform 80ms steps(2), box-shadow 80ms steps(2);
}
.play:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.play:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
.play.small { padding: 10px 16px 8px; font-size: 11px; }

.locked {
  margin-top: 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 22px;
  border: 3px dashed var(--line);
  color: var(--dim);
  flex-wrap: wrap;
}
.lock-sprite { width: 36px; height: 42px; }
.locked > div { display: grid; gap: 6px; flex: 1; min-width: 180px; }
.locked-title { font: 13px/1.4 var(--pixel); color: var(--muted); }
.blink { animation: blink 1.1s steps(2, start) infinite; }
.locked-text { font-size: 20px; }
.loading { display: flex; gap: 4px; }
.loading i { width: 14px; height: 18px; background: var(--panel-2); border: 2px solid var(--ink); animation: fill 2.4s steps(1) infinite; }
.loading i:nth-child(2) { animation-delay: 0.3s; } .loading i:nth-child(3) { animation-delay: 0.6s; }
.loading i:nth-child(4) { animation-delay: 0.9s; } .loading i:nth-child(5) { animation-delay: 1.2s; }
.loading i:nth-child(6) { animation-delay: 1.5s; } .loading i:nth-child(7) { animation-delay: 1.8s; }
.loading i:nth-child(8) { animation-delay: 2.1s; }
@keyframes fill { 0%, 100% { background: var(--panel-2); } 50% { background: var(--violet); } }

/* ───────────── House rules ───────────── */
.rule-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.rule {
  --hue: var(--cyan);
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 22px;
  background: var(--paper);
  color: #2a2722;
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
  transition: transform 100ms steps(2), box-shadow 100ms steps(2);
}
.rule:hover { transform: translate(-2px, -2px); box-shadow: 8px 8px 0 var(--ink), 8px 8px 0 3px var(--hue); }
.rule[data-hue="violet"] { --hue: var(--violet); }
.rule[data-hue="green"] { --hue: #5a9a5e; }
.rule[data-hue="mustard"] { --hue: #c9a43a; }
.rule[data-hue="terra"] { --hue: #c0563c; }
.rule[data-hue="cyan"] { --hue: #2aa5c8; }
.rule-icon { width: 44px; height: 36px; color: var(--hue); }
.rule-no { font: 9px/1 var(--pixel); color: var(--hue); }
.rule h3 { font-size: 13px; color: #1c1b19; }
.rule p:last-child { font-size: 21px; color: #4d4940; }

/* ───────────── Controllers ───────────── */
.controllers { background: linear-gradient(var(--bg-2), var(--bg)); }
.pads { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 14px; }
.pads li {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 8px;
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--line), 4px 4px 0 var(--ink);
  font-size: 22px;
}
.pad-led { width: 10px; height: 10px; background: var(--green); box-shadow: 0 0 0 2px var(--ink); animation: blink 2s steps(2, start) infinite; }
.pads li:nth-child(2n) .pad-led { animation-delay: 0.5s; background: var(--cyan); }
.pads li:nth-child(3n) .pad-led { animation-delay: 1s; background: var(--mustard); }
.pads li.any { border-style: dashed; color: var(--muted); }

/* ───────────── Continue screen ───────────── */
.contact { text-align: center; display: grid; justify-items: center; gap: 18px; padding-block: 120px !important; }
.continue { font-size: clamp(24px, 5vw, 48px); color: var(--terra); text-shadow: 5px 5px 0 var(--ink); }
.countdown { font: clamp(56px, 12vw, 120px)/1 var(--pixel); color: var(--paper); text-shadow: 6px 6px 0 var(--violet), 12px 12px 0 var(--ink); min-height: 1.1em; }
.countdown.over { font-size: clamp(20px, 5vw, 40px); color: var(--mustard); }
.contact-text { color: var(--muted); max-width: 520px; }
.start.mail { font-size: clamp(10px, 2.6vw, 14px); text-transform: none; }
.insert { font: 11px/1 var(--pixel); color: var(--dim); animation: blink 1.4s steps(2, start) infinite; }

/* ───────────── Footer ───────────── */
.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
  padding: 28px var(--gutter) 40px;
  border-top: 3px solid var(--ink);
  box-shadow: 0 -3px 0 var(--line);
  color: var(--dim);
  font-size: 20px;
}
.foot-links { display: flex; flex-wrap: wrap; gap: 18px; }
.foot a { color: var(--muted); }
.foot a:hover { color: var(--paper); }
.keys-btn { margin-left: auto; background: none; border: 0; color: var(--muted); font: 20px var(--crt); cursor: pointer; display: flex; gap: 8px; align-items: center; padding: 0; }
.keys-btn:hover { color: var(--paper); }
.legal { flex-basis: 100%; font-size: 17px; color: var(--dim); }

/* ───────────── Key help ───────────── */
.keys {
  max-width: min(440px, calc(100vw - 32px));
  padding: 28px;
  background: var(--panel);
  color: var(--paper);
  border: 4px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--violet), 10px 10px 0 var(--ink);
}
.keys::backdrop { background: rgba(7, 6, 11, 0.75); }
.keys h2 { font-size: 16px; color: var(--cyan); margin-bottom: 18px; }
.keys dl { margin: 0 0 16px; display: grid; gap: 8px; }
.keys dl div { display: grid; grid-template-columns: 130px 1fr; align-items: center; }
.keys dd { margin: 0; color: var(--muted); }
.secret { color: var(--dim); font-size: 18px; margin-bottom: 18px; }
.keys form { margin: 0; }

/* ───────────── Achievements ───────────── */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 90; display: grid; gap: 10px; justify-items: end; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 10px;
  max-width: calc(100vw - 32px);
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: inset 0 0 0 2px var(--mustard), 5px 5px 0 var(--ink);
  animation: toast-in 240ms steps(4) both;
}
.toast.out { animation: toast-out 240ms steps(4) both; }
.toast .trophy { font: 18px/1 var(--pixel); color: var(--mustard); }
.toast b { display: block; font: 9px/1.4 var(--pixel); color: var(--mustard); font-weight: 400; }
.toast span { font-size: 20px; }
.toast em { font-style: normal; color: var(--green); }
@keyframes toast-in { from { transform: translateX(120%); } }
@keyframes toast-out { to { transform: translateX(120%); } }

/* The secret code: everything cycles through the palette. */
body.cheat .marquee, body.cheat .cast { animation: rainbow 1.2s steps(6) infinite; }
@keyframes rainbow { to { filter: hue-rotate(360deg); } }

/* ───────────── Small screens ───────────── */
@media (max-width: 900px) {
  .carts { grid-template-columns: minmax(0, 1fr); gap: 48px; }
  .rule-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hud nav { display: none; }
}
@media (max-width: 600px) {
  body { font-size: 20px; }
  .hud { gap: 12px; padding-block: 10px; }
  .logo { font-size: 10px; }
  .logo-sprite { width: 20px; height: 20px; }
  .scores { gap: 12px; font-size: 9px; }
  .score small { font-size: 8px; }
  .title-screen { padding-top: 48px; min-height: 0; }
  .lede { font-size: 21px; }
  .start { font-size: 12px; padding: 14px 16px 12px; }
  main > section:not(.title-screen) { padding-block: 72px; }
  .rule-grid { grid-template-columns: minmax(0, 1fr); }
  .cart { padding: 20px 16px; }
  .cart-sprite { width: 48px; height: 48px; }
  .moves li { grid-template-columns: 74px 1fr; font-size: 19px; }
  .stats { gap: 10px 14px; }
  .cast { gap: 32px; }
  .cast-bubble, .cast-jp { width: 60px; height: 60px; }
  .keys-btn { margin-left: 0; }
}
@media (max-width: 380px) {
  .score.hi { display: none; }
}

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