/* ============================================================
   FAMOUS PIGEON — PLAÇA PUMP
   Four colours, two faces, one loud voice per screen.
   ============================================================ */

@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('../fonts/plex-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Plex Mono';
  src: url('../fonts/plex-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

:root {
  --sky: #78CCF5;
  --pale: #DDF4FF;
  --white: #FFFFFF;
  --ink: #080808;
  --grey: #6E7378;
  --font-d: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --font-m: 'Plex Mono', 'SFMono-Regular', Menlo, monospace;
  --gutter: clamp(18px, 4vw, 64px);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --t-display: clamp(64px, 12vw, 176px);
  --t-lead: clamp(16px, 1.25vw, 19px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  font-family: var(--font-d);
  background: var(--sky);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
button { font: inherit; background: none; border: 0; cursor: pointer; color: inherit; }
::selection { background: var(--ink); color: var(--white); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
h1, h2 { font-weight: 800; line-height: 0.9; letter-spacing: -0.02em; }

.mono-label {
  font-family: var(--font-m);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
}
.grey { color: var(--grey); }
.display {
  font-family: var(--font-d);
  font-weight: 900;
  font-stretch: 112%;
  font-size: var(--t-display);
  line-height: 0.84;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}
.lead { font-size: var(--t-lead); max-width: 34em; line-height: 1.45; }
.kicker { margin-bottom: 14px; }

/* ---------- canvas ---------- */
#game {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
  touch-action: none;
  outline: none;
}

/* ---------- announcer strip ---------- */
.strip {
  position: fixed; left: 50%; top: 88px; transform: translateX(-50%);
  z-index: 5;
  font-family: var(--font-m); font-size: 12px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase;
  background: var(--ink); color: var(--white);
  padding: 8px 14px;
  max-width: calc(100vw - 32px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.strip:empty { display: none; }
body[data-state="title"] .strip { display: none; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-d); font-weight: 800; font-size: 15px; letter-spacing: .02em; text-transform: uppercase;
  padding: 16px 26px;
  border: 2.5px solid var(--ink);
  min-height: 52px;
  transition: transform .18s var(--ease-out), background-color .18s, color .18s;
}
.btn-ink { background: var(--ink); color: var(--white); }
.btn-ink:hover { background: var(--white); color: var(--ink); }
.btn-ghost { background: var(--white); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--white); }
.btn:active { transform: translateY(2px); }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 10; }

/* Title */
.title {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  padding: clamp(16px, 3vh, 32px) var(--gutter) calc(clamp(16px, 3vh, 28px) + var(--safe-b));
  gap: 12px;
  overflow: auto;
}
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lockup { display: inline-flex; align-items: center; gap: 10px; }
.mark { width: 34px; height: 34px; }
.wordmark { font-weight: 800; font-size: 15px; letter-spacing: .04em; text-transform: uppercase; }
.masthead-strip { color: var(--ink); }

.title-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  align-items: center;
  gap: clamp(16px, 4vw, 64px);
}
.title-copy { max-width: 640px; }
.title-copy .display { margin-bottom: 22px; }
/* The world map is a hub: the wordmark yields height so Play, the levels
   and the footer all fit above the fold on a laptop screen. */
#worldmap .display { font-size: min(var(--t-display), 12vh); }
#worldmap .title-copy .cta-row { margin-top: 18px; }
.controls { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 24px; }
.controls div { display: flex; gap: 8px; }
.controls dt { color: var(--ink); }
.controls dt::after { content: ' —'; }
.controls dd { color: var(--ink); }
.best-line { margin-top: 18px; }
.motion-note { margin-top: 10px; max-width: 46ch; color: var(--ink); }

.title-figure { justify-self: center; align-self: end; width: min(100%, 38vh, 400px); }
/* the mark, standing: no shadow, no glow (brand-system §5) */
.title-figure svg { display: block; width: 100%; height: auto; }
@media (prefers-reduced-motion: no-preference) {
  .title-figure svg { animation: hover 4.2s ease-in-out infinite; }
}
@keyframes hover { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

.title-foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 12px; }
.title-credit { display: grid; gap: 4px; align-content: start; }
.title-credit a { color: var(--ink); }

/* Levels */
.title-levels, .title-powers { margin-top: 18px; min-width: 0; }
.title-levels h2, .title-powers h2 { margin-bottom: 10px; }
.levels { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
.level {
  flex: 0 0 auto; width: 132px;
  display: grid; gap: 6px; justify-items: start; text-align: left;
  background: var(--white); color: var(--ink);
  border: 2.5px solid var(--ink); padding: 8px;
  transition: transform .18s var(--ease-out);
}
.level:hover:not(:disabled) { transform: translateY(-2px); }
.level.chosen { background: var(--ink); color: var(--white); }
.level.done { background: var(--ink); color: var(--white); }
.level.locked { cursor: not-allowed; color: var(--grey); border-color: var(--grey); }
.level.locked .level-tile { border-color: var(--grey); }
.level-tile { width: 100%; height: auto; aspect-ratio: 1; display: block; border: 1.5px solid var(--ink); }
.level.chosen .level-tile, .level.done .level-tile { border-color: var(--white); }
.level-n { font-size: 11px; }
.level-name { font-weight: 800; font-size: 14px; line-height: 1.1; letter-spacing: -.01em; }
.level-soon { font-size: 10px; opacity: .7; }
.title-levels .note { margin-top: 6px; }
.head-back { padding: 10px 16px; font-size: 13px; }

/* Power-up legend */
.powers { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 18px; }
.powers li { display: flex; gap: 10px; align-items: center; }
.power-icon { width: 44px; height: 44px; flex: 0 0 auto; border: 1.5px solid var(--ink); }
.powers strong { display: block; font-size: 14px; letter-spacing: -.01em; }
.powers span { display: block; font-size: 12.5px; line-height: 1.3; }

/* HUD */
.hud { position: fixed; inset: 0; z-index: 6; pointer-events: none; }
.hud-plate {
  position: absolute; top: 14px;
  display: flex; gap: 0;
  background: var(--white); color: var(--ink);
  border: 2.5px solid var(--ink);
}
.hud-left { left: 14px; }
.hud-right { right: 14px; }
.hud-cell {
  display: flex; flex-direction: column; gap: 2px;
  padding: 8px 14px;
  border-right: 2.5px solid var(--ink);
  min-width: 72px;
}
.hud-cell:last-child { border-right: 0; }
.hud-cell strong { font-weight: 800; font-size: 20px; line-height: 1; letter-spacing: -.01em; white-space: nowrap; }
.hud-mcap strong { font-size: 26px; }
.hud-lev strong { font-size: 26px; }
.hud-shield { background: var(--ink); color: var(--white); }
.hud-lives { background: var(--ink); color: var(--white); }
.hud-power { min-width: 120px; justify-content: center; }
.power-bar { display: block; width: 100%; height: 8px; background: var(--pale); border: 1.5px solid var(--ink); }
.power-bar i { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(1); }
.hud-levelcell strong { font-size: 18px; }
.hud-btn {
  pointer-events: auto;
  padding: 0 16px; font-weight: 800; font-size: 16px; letter-spacing: .1em;
  border-left: 2.5px solid var(--ink);
  min-width: 48px;
}
.hud-btn:hover { background: var(--ink); color: var(--white); }
#festes-hud .hud-right .hud-btn { border-left: 0; min-height: 52px; }
/* One line of rules for the festes level being played, under the HUD. */
.festes-hint {
  position: absolute; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 28px);
  background: var(--white); color: var(--ink); border: 2.5px solid var(--ink);
  padding: 8px 14px; text-align: center; text-transform: none; letter-spacing: .02em; font-size: 13px;
}
.festes-hint strong { font-weight: 800; }
.btn-cash {
  pointer-events: auto;
  position: absolute; right: 14px; bottom: calc(18px + var(--safe-b));
  background: var(--white); color: var(--ink);
  font-size: 18px; padding: 18px 28px; min-height: 60px;
}
.btn-cash:hover { background: var(--ink); color: var(--white); }
.btn-cash .mono-label { font-size: 11px; opacity: .8; }
.pop strong { animation: pop .42s var(--ease-out); }
@keyframes pop { 0% { transform: scale(1.5); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .pop strong { animation: none; } }

/* Modals */
.modal { display: grid; place-items: center; padding: var(--gutter); overflow: auto; }
.modal::before { content: ''; position: absolute; inset: 0; background: rgba(8, 8, 8, .22); }
.modal-box {
  position: relative;
  background: var(--white); color: var(--ink);
  border: 2.5px solid var(--ink);
  padding: clamp(24px, 4vw, 44px);
  width: min(100%, 560px);
}
.modal-box h2 { font-size: clamp(24px, 3vw, 36px); max-width: 16em; }
.result-box { width: min(100%, 640px); }
.res-big { font-size: clamp(56px, 9vw, 120px); margin: 6px 0 14px; }
body.rekt .res-big { color: var(--ink); text-decoration: line-through; text-decoration-thickness: .08em; }
.new-best, .unlock { margin-top: 12px; background: var(--ink); color: var(--white); display: inline-block; padding: 6px 10px; }
.unlock { background: var(--white); color: var(--ink); border: 1.5px solid var(--ink); }
.res-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 18px; margin-top: 24px; padding-top: 18px; border-top: 1.5px solid var(--ink); }
.res-meta dt { color: var(--grey); }
.res-meta dd { font-family: var(--font-d); font-weight: 800; font-size: 18px; letter-spacing: -.01em; text-transform: none; }
.share-note { margin-top: 12px; min-height: 1.4em; color: var(--ink); text-transform: none; letter-spacing: 0; word-break: break-word; }
.board-wrap { margin-top: 22px; padding-top: 16px; border-top: 1.5px solid var(--ink); }
.board { list-style: none; margin-top: 8px; }
.board li { display: grid; grid-template-columns: 34px 1fr auto; gap: 12px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--pale); }
.b-rank { font-family: var(--font-m); font-size: 12px; color: var(--grey); }
.b-mcap { font-weight: 800; font-size: 18px; }
.b-meta { font-family: var(--font-m); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--grey); }

/* Register */
.reg-form { display: grid; gap: 8px; margin-top: 22px; max-width: 360px; }
.reg-form input {
  font-family: var(--font-d); font-size: 17px; color: var(--ink);
  background: var(--white); border: 2.5px solid var(--ink);
  padding: 12px 14px; min-height: 48px;
}
.reg-form input:focus-visible { outline-offset: 0; }
.reg-error { min-height: 1.4em; }
.reg-error:not(:empty) { color: var(--ink); }
.reg-consent { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 13.5px; margin-top: 6px; cursor: pointer; }
.reg-consent input { width: 18px; height: 18px; flex: 0 0 auto; margin-top: 2px; accent-color: var(--ink); }
.reg-legal { margin-top: 4px; font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12.5px; color: var(--grey); }
.reg-legal a { color: var(--ink); }

/* Ranking */
.rank-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; margin-top: 20px; }
.rank-cols .board { margin-top: 8px; }
@media (max-width: 560px) { .rank-cols { grid-template-columns: 1fr; gap: 18px 0; } }

/* No-JS */
.nojs { z-index: 20; background: var(--sky); padding: var(--gutter); display: grid; align-content: center; gap: 18px; }

/* Legal pages (privacy, terms) */
body.legal-page { overflow: auto; height: auto; min-height: 100%; }
.legal { max-width: 640px; margin: 0 auto; padding: calc(var(--gutter) * 1.6) var(--gutter) calc(var(--gutter) * 2); }
.legal-h { font-size: clamp(48px, 9vw, 96px); margin-bottom: 18px; }
.legal h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin: 32px 0 10px; }
.legal p { font-size: 15.5px; line-height: 1.6; max-width: 60ch; }
.legal p + p { margin-top: 10px; }
.legal-back { margin-top: 40px; }
.legal-back a { font-weight: 700; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .strip { top: 88px; }
  .title-grid { grid-template-columns: 1fr; align-content: start; gap: 8px; }
  .title-figure { order: -1; width: min(40vw, 24vh); justify-self: end; margin-top: -8px; }
  .title-copy .display { margin-bottom: 16px; }
  .lead { font-size: 16px; }
  .title-foot { flex-direction: column; gap: 6px; }
  .masthead-strip { display: none; }
  .powers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  :root { --t-display: clamp(64px, 20vw, 110px); }
  .title { padding-top: 14px; }
  .title-figure { width: min(34vw, 20vh); }
  .controls { gap: 4px 16px; }
  .strip { top: 128px; }
  .hud-right { top: 72px; }
  #festes-hud .hud-right { top: 14px; }
  #hud .hud-left .hud-cell:nth-child(3), #hud .hud-left .hud-cell:nth-child(4) { display: none; }
  .hud-shield .mono-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hud-shield { min-width: 44px; align-items: center; justify-content: center; }
  .hud-cell { padding: 6px 10px; min-width: 0; }
  .hud-cell strong { font-size: 16px; }
  .hud-mcap strong, .hud-lev strong { font-size: 20px; }
  .hud-right .hud-cell:first-child strong { display: none; }
  .powers { grid-template-columns: 1fr; gap: 6px; }
  .level { width: 112px; }
  .hud-power { min-width: 90px; }
  .btn-cash { font-size: 16px; padding: 16px 20px; }
  .res-meta { grid-template-columns: repeat(2, 1fr); }
  .cta-row .btn { flex: 1 1 auto; justify-content: center; }
}
@media (max-height: 640px) and (orientation: landscape) {
  .best-line, .motion-note { display: none; }
}
@media (max-height: 600px) and (orientation: landscape) {
  .title-figure { display: none; }
  .title-grid { grid-template-columns: 1fr; }
  :root { --t-display: clamp(48px, 12vh, 96px); }
}

/* Screen wipe: one flat ink panel sliding across on every screen change.
   Removed entirely under prefers-reduced-motion. */
#wipe { position: fixed; inset: 0; background: var(--ink); transform: translateX(-101%); z-index: 90; pointer-events: none; }
#wipe.run { animation: wipe-in-out .62s cubic-bezier(.4, 0, .2, 1); }
@keyframes wipe-in-out {
  0% { transform: translateX(-101%); }
  42% { transform: translateX(0); }
  58% { transform: translateX(0); }
  100% { transform: translateX(101%); }
}
@media (prefers-reduced-motion: reduce) {
  #wipe.run { animation: none; }
}
