:root {
  --navy-deep: #0d1550;
  --navy: #14206b;
  --panel: #1e2c7a;
  --panel-edge: #4fb3ff;
  --text: #ffffff;
  --muted: #b9c6f5;
  --gold: #ffd24d;
  --gold-dark: #c98a00;
  --green: #a8e22d;
  --green-dark: #3f8a0e;
  --display: "Baloo Bhaijaan 2", "Fredoka", system-ui, sans-serif;
  --body: "Fredoka", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--navy-deep); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 500 17px/1.5 var(--body);
  background:
    radial-gradient(ellipse 70% 40% at 50% 0%, rgba(79, 179, 255, 0.28), transparent 70%),
    url("/img/background.jpg") center top / cover fixed,
    linear-gradient(var(--navy), var(--navy-deep));
  overflow-x: hidden;
}
main {
  max-width: 880px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.studio {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  font: 700 14px/1 var(--body);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}
.studio img { width: 28px; height: auto; }

.hero { text-align: center; padding: 28px 0 8px; }
.logo {
  display: block;
  width: min(100%, 520px);
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 12px 30px rgba(5, 10, 50, 0.6));
}
.logo-wrap { position: relative; }
/* The same soft spotlight the main menu puts behind its logo. */
.logo-wrap::before {
  content: "";
  position: absolute;
  inset: -10% 10%;
  background: radial-gradient(closest-side, rgba(120, 200, 255, 0.35), transparent);
  z-index: -1;
}
.tagline {
  max-width: 30ch;
  margin: 18px auto 26px;
  font: 600 clamp(19px, 3.6vw, 24px)/1.35 var(--body);
  text-shadow: 0 2px 0 rgba(5, 10, 50, 0.5);
}

/* Glossy number blocks, coloured from the game's Block_*.asset effect colours. */
.chain {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 0 auto;
  padding: 0;
  list-style: none;
  max-width: 700px;
}
.block {
  --size: 54px;
  --edge: color-mix(in srgb, var(--c) 55%, #000);
  width: var(--size);
  height: var(--size);
  display: grid;
  place-items: center;
  border-radius: 22%;
  border: 2px solid var(--edge);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.45), transparent 42%),
    linear-gradient(color-mix(in srgb, var(--c) 82%, #fff), var(--c));
  box-shadow:
    inset 0 -4px 0 rgba(0, 0, 0, 0.18),
    inset 0 2px 0 rgba(255, 255, 255, 0.45),
    0 5px 0 var(--edge),
    0 9px 16px rgba(0, 0, 0, 0.35);
  font: 800 calc(var(--size) * 0.42)/1 var(--display);
  color: #fff;
  text-shadow:
    2px 0 0 var(--edge), -2px 0 0 var(--edge), 0 2px 0 var(--edge), 0 -2px 0 var(--edge),
    1.5px 1.5px 0 var(--edge), -1.5px 1.5px 0 var(--edge), 1.5px -1.5px 0 var(--edge), -1.5px -1.5px 0 var(--edge),
    0 4px 0 var(--edge);
  padding-top: 4px;
}
.block.long { font-size: calc(var(--size) * 0.3); }
.chain .block { animation: bob 3.2s ease-in-out infinite; animation-delay: calc(var(--i) * -0.29s); }
@keyframes bob { 50% { transform: translateY(-6px); } }

.b2    { --c: #6cb5de; }
.b4    { --c: #3358a9; }
.b8    { --c: #6aa302; }
.b16   { --c: #038a50; }
.b32   { --c: #fac102; }
.b64   { --c: #fd5701; }
.b128  { --c: #b11ec5; }
.b256  { --c: #813a05; }
.b512  { --c: #620d2b; }
.b1024 { --c: #2f51ab; }
.b2048 { --c: #2b0431; }

h2 {
  margin: 56px 0 18px;
  text-align: center;
  font: 800 clamp(28px, 5vw, 36px)/1.1 var(--display);
  color: var(--gold);
  text-shadow: 0 3px 0 #7a4a00, 0 6px 14px rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Panels echo the game-over card: navy fill with a glowing blue rim. */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.panel {
  background: linear-gradient(rgba(40, 60, 150, 0.85), rgba(22, 34, 110, 0.9));
  border: 2px solid var(--panel-edge);
  border-radius: 22px;
  box-shadow: 0 0 18px rgba(79, 179, 255, 0.35), inset 0 0 22px rgba(79, 179, 255, 0.18);
  padding: 22px 20px;
}
.steps .panel { text-align: center; }
.demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 66px;
  margin-bottom: 14px;
}
.demo .block { --size: 44px; }
.demo .arrow { font: 800 24px/1 var(--display); color: var(--gold); }
.panel h3 {
  margin: 0 0 6px;
  font: 800 21px/1.2 var(--display);
  text-transform: uppercase;
}
.panel p { margin: 0; color: var(--muted); }

.links { text-align: center; }
.links .panel { max-width: 560px; margin: 0 auto; }
.links nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}
/* Chunky 3D buttons in the style of MM_ButtonGreen / GO_ButtonYellow. */
.btn {
  --top: var(--green);
  --side: var(--green-dark);
  display: inline-block;
  padding: 12px 22px 10px;
  border-radius: 16px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.28), transparent 55%),
    var(--top);
  box-shadow: 0 6px 0 var(--side), 0 10px 16px rgba(0, 0, 0, 0.35);
  color: #fff;
  font: 800 18px/1 var(--display);
  text-transform: uppercase;
  text-decoration: none;
  text-shadow: 0 2px 0 var(--side);
  transition: transform 0.08s, box-shadow 0.08s;
}
.btn.gold { --top: #ffc21a; --side: #b86d00; }

/* Official Google Play and App Store badges (public/img/badges), shown at the same height as each guide asks.
   Both guides require clear space of a quarter of the badge height on every side, so each badge carries
   it as a margin: nothing, not even the other badge, comes closer than that. */
.stores {
  --badge: 52px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: calc(30px - var(--badge) / 4);
}
.store {
  display: block;
  margin: calc(var(--badge) / 4);
  border-radius: 10px;
  transition: transform 0.08s;
}
.store img { display: block; height: var(--badge); width: auto; }
.store:hover { transform: translateY(-2px); }
.store:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--side), 0 4px 8px rgba(0, 0, 0, 0.35); }
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

/* Instagram's guide: the white glyph unaltered, at least 29px, with clear space of half its size on every
   side (the panel padding and the gap), always next to a call to action. */
.follow { text-align: center; }
.social {
  --glyph: 32px;
  display: inline-flex;
  align-items: center;
  gap: calc(var(--glyph) / 2);
  padding: calc(var(--glyph) / 2) 24px;
  color: var(--text);
  text-decoration: none;
  text-align: start;
  transition: transform 0.08s;
}
.social img { width: var(--glyph); height: var(--glyph); flex: none; }
.social strong { display: block; font: 800 19px/1.2 var(--display); text-transform: uppercase; }
.social bdi { color: var(--muted); }
.social:hover { transform: translateY(-2px); }
.social:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }

footer {
  margin-top: 44px;
  text-align: center;
  font-size: 15px;
  color: var(--muted);
}
footer a { color: var(--gold); }

@media (max-width: 480px) {
  .chain .block { --size: 46px; }
  .demo .block { --size: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  .chain .block { animation: none; }
  .btn, .store, .social { transition: none; }
}

/* Fredoka has no Arabic, Cyrillic or Japanese glyphs, so those pages swap in fonts that do. */
html[lang="ar"] {
  --display: "Baloo Bhaijaan 2", system-ui, sans-serif;
  --body: "Baloo Bhaijaan 2", system-ui, sans-serif;
}
html[lang="ru"],
html[lang="ja"] {
  --display: "M PLUS Rounded 1c", system-ui, sans-serif;
  --body: "M PLUS Rounded 1c", system-ui, sans-serif;
}
/* Letter-spacing breaks Arabic joining, and the merge arrows must point the way the row reads. */
html[lang="ar"] .studio,
html[lang="ar"] h2 { letter-spacing: 0; }
[dir="rtl"] .demo .arrow { transform: scaleX(-1); }

/* Language menu: a <details> dropdown so it works without JavaScript. */
.top { position: relative; }
.lang {
  position: absolute;
  inset-inline-end: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  font: 600 15px/1 var(--body);
}
.lang summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 2px solid var(--panel-edge);
  border-radius: 999px;
  background: rgba(22, 34, 110, 0.85);
  cursor: pointer;
  list-style: none;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: "▾"; color: var(--gold); }
.lang summary:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.lang ul {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 8px);
  min-width: 160px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: linear-gradient(rgba(40, 60, 150, 0.97), rgba(22, 34, 110, 0.98));
  border: 2px solid var(--panel-edge);
  border-radius: 16px;
  box-shadow: 0 0 18px rgba(79, 179, 255, 0.35), 0 10px 24px rgba(0, 0, 0, 0.4);
}
.lang a {
  display: block;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-family: system-ui, sans-serif;
}
.lang a:hover, .lang a:focus-visible { background: rgba(79, 179, 255, 0.25); outline: none; }
.lang a[aria-current] { color: var(--gold); }

@media (max-width: 560px) {
  /* No room beside the studio name on phones: put the menu above it instead. */
  .top { display: flex; flex-direction: column-reverse; align-items: center; gap: 16px; }
  .lang { position: relative; top: auto; transform: none; inset-inline-end: auto; }
  .lang ul { inset-inline-end: 50%; transform: translateX(50%); }
  [dir="rtl"] .lang ul { transform: translateX(-50%); }
}
