/* Fuga em 4 paradas: the game page. Night palette from the logo, paper for the real facts and the guide below. */
:root {
  --bg: #060a17;
  --panel: rgba(8, 12, 30, 0.93);
  --line: #2a3a6e;
  --text: #eaf0ff;
  --muted: #9ba8cc;
  --blue: #1f7bff;
  --green: #74e01c;
  --yellow: #ffd23f;
  --red: #ff4d4d;
  --paper: #f6f1e7;
  --paper-2: #efe8da;
  --rule: #d5c9b3;
  --ink: #17140f;
  --ink-2: #2c2820;
  --ink-3: #5a5245;
  --press-red: #b3261e;
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Newsreader", Georgia, serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); overscroll-behavior: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; }
body { color: var(--text); font-family: var(--body); overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
/* While flying, the page holds still: no scrolling, no pull-to-refresh */
body.is-playing { overflow: hidden; overscroll-behavior: none; touch-action: none; }

/* The game fills exactly one screen; the guide sits below it */
.game {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(60% 50% at 50% 40%, rgba(31, 123, 255, 0.18), transparent 70%),
    var(--bg);
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
@supports (height: 100dvh) {
  body.is-playing .game { height: 100dvh; }
}
body.is-playing .game { touch-action: none; }
#game {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow: 0 0 0 2px #10183a, 0 20px 60px rgba(0, 0, 0, 0.6);
}

/* Corner controls */
.g-ctl { position: absolute; top: max(8px, env(safe-area-inset-top)); right: max(8px, env(safe-area-inset-right)); display: flex; gap: 8px; z-index: 20; }
.g-icon {
  width: 44px;
  height: 44px;
  border: 2px solid var(--line);
  background: rgba(8, 12, 30, 0.82);
  color: var(--text);
  font: 12px/1 var(--pixel);
  cursor: pointer;
  box-shadow: 0 3px 0 #000;
  touch-action: manipulation;
}
.g-icon:active { transform: translateY(2px); box-shadow: 0 1px 0 #000; }
.g-only-play { display: none; }
body.is-playing .g-only-play { display: block; }

/* Real-life facts that pop up while flying */
.g-toast {
  position: absolute;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 15;
  width: min(560px, calc(100% - 24px));
  padding: 9px 13px 10px;
  background: var(--paper);
  color: var(--ink);
  border-top: 4px solid var(--ink);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  font: 500 14px/1.4 var(--body);
  transform: translate(-50%, 140%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.35s;
  pointer-events: none;
}
.g-toast.is-on { transform: translate(-50%, 0); opacity: 1; }
.g-toast b { display: block; margin-bottom: 3px; font: 9px/1.3 var(--pixel); color: var(--press-red); letter-spacing: 0.02em; }

/* Panels over the game */
.g-panel {
  position: absolute;
  z-index: 10;
  width: min(560px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 20px 22px 18px;
  background: var(--panel);
  border: 3px solid var(--line);
  box-shadow: 0 0 0 3px #000, 0 24px 60px rgba(0, 0, 0, 0.6);
  text-align: center;
  scrollbar-width: thin;
  touch-action: pan-y;
}
.g-panel[hidden] { display: none; }
.g-panel--small { width: min(320px, calc(100% - 24px)); }
.g-logo img { display: block; width: min(240px, 56vw); height: auto; margin: 0 auto 4px; filter: drop-shadow(0 8px 20px rgba(31, 123, 255, 0.4)); }
.g-h { margin: 6px 0 8px; font: 17px/1.4 var(--pixel); color: var(--yellow); text-shadow: 3px 3px 0 #000; }
.g-h__kicker { display: block; margin-bottom: 4px; font-size: 10px; color: var(--green); text-shadow: 2px 2px 0 #000; }
.g-h--bad { color: var(--red); font-size: 19px; }
.g-route { margin: 0 0 10px; font: 9px/1.7 var(--pixel); color: var(--green); }
.g-howto { margin: 0 auto 14px; max-width: 30em; font: 500 15px/1.5 var(--body); color: var(--text); }
.g-keys { margin: 10px 0 0; font: 600 12px/1.5 var(--body); color: var(--muted); }
.g-best { margin: 8px 0 0; font: 9px/1.6 var(--pixel); color: var(--muted); }
.g-best:empty { display: none; }
.g-best.is-new { color: var(--yellow); animation: blink 0.6s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
.g-lang { margin: 10px 0 0; font: 10px/1 var(--pixel); }
.g-lang a { display: inline-block; min-width: 44px; padding: 13px 9px; color: var(--muted); text-decoration: none; border: 2px solid transparent; }
.g-lang a[aria-current="true"] { color: #0b2a03; background: var(--green); border-color: #b4ff6a; }
.g-disclaimer { margin: 12px auto 0; max-width: 34em; font: 500 12px/1.5 var(--body); color: var(--muted); }
.g-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; margin: 8px 0 0; }
.g-back, .g-more { display: inline-block; padding: 10px 0; font: 700 13px/1.2 var(--body); color: var(--text); }
.g-more { color: var(--green); }

.g-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  background: #1a2550;
  color: var(--text);
  font: 11px/1 var(--pixel);
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.35), inset 3px 3px 0 rgba(255, 255, 255, 0.15), 0 4px 0 #000;
}
.g-btn:hover { filter: brightness(1.15); }
.g-btn:active { transform: translateY(3px); box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.35), 0 1px 0 #000; }
.g-btn:focus-visible, .g-icon:focus-visible, .g-lang a:focus-visible, .g-back:focus-visible, .g-more:focus-visible, .g-fact__link:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.g-btn--go { background: var(--green); color: #0b2a03; min-height: 52px; padding: 0 26px; font-size: 13px; }
#g-start { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.05); } }

/* Game over */
.g-score { margin: 4px 0 2px; font: 12px/1.6 var(--pixel); color: var(--text); }
.g-cash { margin: 0; font: 600 14px/1.5 var(--body); color: #7bd88a; }
.g-facts { display: grid; gap: 10px; margin: 14px 0 12px; text-align: left; }
.g-fact { padding: 11px 13px 11px; background: var(--paper); color: var(--ink); border-top: 4px solid var(--ink); }
.g-fact__kicker { margin: 0 0 4px; font: 9px/1.4 var(--pixel); color: var(--press-red); }
.g-fact__big { margin: 2px 0 4px; font: 24px/1.1 var(--pixel); color: var(--ink); }
.g-fact__text { margin: 0; font: 500 15px/1.5 var(--body); color: var(--ink-2); }
.g-fact__link { display: inline-block; margin-top: 4px; padding: 6px 0; font: 700 13px/1.4 var(--body); color: var(--press-red); }
.g-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* Wide screens: the two facts side by side */
@media (min-width: 760px) {
  .g-panel--over { width: min(720px, calc(100% - 24px)); }
  .g-facts { grid-template-columns: 1fr 1fr; }
}

/* Phones in portrait */
@media (max-width: 520px) {
  .g-panel { padding: 16px 14px 14px; }
  .g-h { font-size: 14px; }
  .g-h__kicker { font-size: 9px; }
  .g-h--bad { font-size: 16px; }
  .g-route { font-size: 8px; }
  .g-howto, .g-fact__text { font-size: 14px; }
  .g-toast { font-size: 13px; }
  .g-fact__big { font-size: 20px; }
}
@media (max-width: 360px) {
  .g-btn { padding: 0 12px; font-size: 10px; }
  .g-btn--go { font-size: 12px; }
  .g-logo img { width: 52vw; }
}
/* Phones in portrait: keep the panels clear of the corner buttons */
@media (max-width: 520px) and (min-aspect-ratio: 1/3) and (max-aspect-ratio: 1/1) {
  .g-panel { margin-top: 46px; max-height: calc(100% - 66px); }
  .g-panel--small { margin-top: 0; }
}
/* Small phones (iPhone SE and the like): a tighter title and result screen */
@media (max-width: 520px) and (max-height: 700px) {
  .g-logo img { width: 42vw; }
  .g-h { margin: 2px 0 6px; font-size: 13px; }
  .g-route { margin-bottom: 6px; }
  .g-howto { margin-bottom: 10px; font-size: 13px; line-height: 1.4; }
  .g-keys { display: none; }
  .g-best { margin-top: 4px; }
  .g-lang { margin-top: 4px; }
  .g-lang a { padding: 10px 8px; }
  .g-disclaimer { margin-top: 6px; font-size: 11px; line-height: 1.4; }
  .g-links { margin-top: 2px; }
  .g-back, .g-more { padding: 8px 0; font-size: 12px; }
  .g-panel--over .g-disclaimer { display: none; }
  .g-score { font-size: 10px; }
  .g-cash { font-size: 13px; }
  .g-facts { gap: 8px; margin: 10px 0; }
  .g-fact { padding: 9px 11px; }
  .g-fact__big { font-size: 16px; margin: 0 0 2px; }
  .g-fact__text { font-size: 13px; line-height: 1.4; }
  .g-fact__link { padding: 4px 0; font-size: 12px; }
  .g-h--bad { font-size: 14px; }
  .g-btn { min-height: 42px; }
  .g-btn--go { min-height: 46px; }
}

/* Short screens (phones in landscape): a compact title, two-column game over */
@media (max-height: 520px) {
  .g-panel { padding: 12px 16px 12px; max-height: calc(100% - 16px); }
  .g-logo img { width: auto; height: 64px; }
  .g-h { margin: 2px 0 4px; font-size: 13px; }
  .g-h__kicker { display: inline; margin: 0 6px 0 0; font-size: 9px; }
  .g-route { margin-bottom: 6px; }
  .g-howto { margin-bottom: 10px; font-size: 13px; }
  .g-keys, .g-disclaimer { display: none; }
  .g-lang { margin-top: 4px; }
  .g-lang a { padding: 10px 8px; }
  .g-btn--go { min-height: 46px; }
  .g-panel--over { width: min(760px, calc(100% - 24px)); }
  .g-facts { grid-template-columns: 1fr 1fr; margin: 10px 0; }
  .g-fact__text { font-size: 13px; }
  .g-fact__big { font-size: 18px; }
  .g-h--bad { font-size: 15px; }
  .g-toast { width: min(520px, calc(100% - 140px)); font-size: 12px; padding: 7px 11px 8px; }
}

/* Link preview still: big title, no buttons */
body.is-poster .g-ctl, body.is-poster .g-toast, body.is-poster #g-start, body.is-poster .g-keys, body.is-poster .g-best,
body.is-poster .g-lang, body.is-poster .g-links, body.is-poster .g-howto, body.is-poster .g-disclaimer, body.is-poster .g-about { display: none; }
body.is-poster .g-panel--title { left: 4%; width: 54%; max-height: none; background: rgba(8, 12, 30, 0.82); padding: 30px 24px 34px; }
body.is-poster .g-logo img { width: 86%; height: auto; }
body.is-poster .g-h { font-size: 27px; white-space: nowrap; }
body.is-poster .g-h__kicker { display: block; font-size: 14px; margin: 0 0 8px; }
body.is-poster .g-route { font-size: 11px; }

/* ---------- The guide under the game: a newspaper page ---------- */

.g-about {
  position: relative;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(23, 20, 15, 0.035) 1px, transparent 1.2px);
  background-size: 4px 4px;
  color: var(--ink);
  padding: 44px max(18px, env(safe-area-inset-left)) calc(56px + env(safe-area-inset-bottom));
  font: 400 18px/1.62 var(--serif);
}
.g-about:empty, .g-about__inner:empty { display: none; }
.g-about__inner { max-width: 760px; margin: 0 auto; }
.g-about .crumbs { margin: 0 0 18px; font: 600 13px/1.5 var(--body); color: var(--ink-3); }
.g-about .crumbs a { display: inline-block; padding: 10px 0; color: var(--ink-2); }
.g-about h2 { margin: 0 0 12px; font: 800 clamp(28px, 6vw, 40px)/1.08 var(--display); letter-spacing: -0.015em; text-wrap: balance; }
.g-about h3 { margin: 34px 0 10px; padding-top: 12px; border-top: 3px double var(--ink); font: 800 clamp(22px, 4.6vw, 28px)/1.15 var(--display); }
.g-about h4 { margin: 18px 0 4px; font: 700 19px/1.3 var(--display); }
.g-about p { margin: 0 0 12px; color: var(--ink-2); text-wrap: pretty; }
.g-about .lead { font-size: 20px; color: var(--ink-2); }
.g-about ul, .g-about ol { margin: 0 0 12px; padding-left: 1.2em; }
.g-about li { margin: 0 0 8px; color: var(--ink-2); }
.g-about li b { color: var(--ink); }
.g-about a { color: var(--press-red); }
.g-about .stages li::marker { font: 700 16px var(--body); color: var(--press-red); }
.g-about .facts { list-style: none; padding: 0; display: grid; gap: 8px; }
.g-about .facts li { display: grid; grid-template-columns: 64px 1fr; gap: 12px; align-items: baseline; margin: 0; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.g-about .facts .n { font: 14px/1.2 var(--pixel); color: var(--ink); text-align: right; }
.g-about .facts a { font: 700 13px/1.4 var(--body); white-space: nowrap; }
.g-about .powers { list-style: none; padding: 0; display: grid; gap: 10px; }
.g-about .powers li { margin: 0; padding: 10px 14px; background: var(--paper-2); box-shadow: inset 0 0 0 1px var(--rule); }
.g-about .faq h4 { margin-top: 20px; }
.g-about .cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 30px 0 0; }
.g-about .cta a {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 18px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  font: 700 14px/1.2 var(--body);
  text-decoration: none;
}
.g-about .cta a.go { background: var(--ink); color: var(--paper); }
.g-about .note { margin-top: 26px; font: 500 13px/1.6 var(--body); color: var(--ink-3); }
@media (min-width: 640px) {
  .g-about .powers { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 420px) {
  .g-about { font-size: 17px; }
  .g-about .facts li { grid-template-columns: 52px 1fr; gap: 10px; }
  .g-about .facts .n { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  #g-start, .g-best.is-new { animation: none; }
  .g-toast { transition: none; }
}

/* A link to the other game under the title screen */
.g-links--other { margin-top: 4px; }
.g-links--other a { color: var(--yellow); }
body.is-poster .g-links--other { display: none; }
