/* Display ads (computers) and the "Get the app" banner (phones and tablets) belong to the
   surrounding page, outside the full game viewport (web-ads.js decides which one a visitor gets).
   The page around the game (footer, ad column, banner) follows the game's own theme, a setting inside it,
   not the visitor's OS theme: src/app/_layout.tsx sets data-theme on <html> whenever the theme
   changes, and index.html sets it from the save before the app loads, so the page never flashes.
   Keep --web-bg equal to palettes.<theme>.bg, --web-text to .text, --web-muted to .text2,
   --web-surface to .surface, --web-line to .line2, --web-accent to .accent and --web-cta to .ctaBg
   in src/theme/tokens.ts. */
:root {
  color-scheme: dark;
  --web-bg: #15121f;
  --web-text: #f7f4ff;
  --web-muted: #aaa3c6;
  --web-surface: #1e1a2d;
  --web-line: rgba(255,255,255,0.13);
  --web-accent: #ff7a5c;
  --web-cta: #d4432a;
}
:root[data-theme=light] {
  color-scheme: light;
  --web-bg: #fbf6ee;
  --web-text: #2b2220;
  --web-muted: #6f6259;
  --web-surface: #ffffff;
  --web-line: rgba(70,45,20,0.17);
  --web-accent: #e8553a;
  --web-cta: #d4432a;
}
html, body { background: var(--web-bg); }
body {
  overflow-x: hidden;
  overflow-y: auto;
  /* Route changes replace large sections of the game. Keep browser scroll anchoring
     from moving its header off-screen while preserving manual scrolling to the ad. */
  overflow-anchor: none;
  color: var(--web-text);
  font-family: DMSans_400Regular, system-ui, sans-serif;
}
.web-shell {
  display: grid;
  grid-template-columns: minmax(0, 680px);
  justify-content: center;
  /* On phones the ad starts 150px below the game's edge. */
  gap: 150px;
  max-width: 1180px;
  margin: 0 auto;
}
.web-game {
  min-width: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
}
.web-ad {
  box-sizing: border-box;
  width: min(336px, calc(100vw - 48px));
  min-height: 280px;
  margin: 0 auto;
}
.web-ad[hidden], .web-footer button[hidden] { display: none; }
/* The label carries its own chip in the page colour, so it reads on whatever is behind it. */
.web-ad-label {
  width: max-content;
  margin: 0 auto 12px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--web-bg);
  color: var(--web-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
}
.web-ad-preview {
  display: grid;
  min-height: 250px;
  place-items: center;
  border: 1px dashed var(--web-muted);
  border-radius: 8px;
  background: var(--web-bg);
  color: var(--web-muted);
  font-size: 13px;
  text-align: center;
}
.web-footer {
  box-sizing: border-box;
  max-width: 680px;
  margin: 72px auto 0;
  padding: 0 24px 48px;
  color: var(--web-muted);
  font-size: 14px;
  line-height: 1.7;
}
.web-footer h1 { color: var(--web-text); font-family: Fredoka_600SemiBold, system-ui, sans-serif; font-size: 20px; font-weight: 600; }
.web-footer nav { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 24px; }
.web-footer a, .web-footer button {
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.web-footer button { padding: 0; border: 0; background: transparent; cursor: pointer; }
@media (min-width: 1200px) {
  .web-shell.has-ad {
    grid-template-columns: minmax(0, 680px) 300px;
    column-gap: 150px;
    padding: 0 24px;
  }
  .web-ad { width: 300px; align-self: start; margin-top: 64px; }
}
/* "Get the app": phones and tablets only, where the page has no ads (web-ads.js). It sits above the
   game in the page's flow, and the game is shorter by its height (--web-install-h, measured by
   web-ads.js), so the first screen still holds the whole game and nothing in it is under the
   banner. On wide screens its row lines up with the content of the game's tabs (560 px wide with
   24 px gutters, src/screens/fit.ts). Fixed line heights keep its height the same before and after
   the game's fonts load. */
.web-install {
  display: flex;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  padding-top: calc(8px + env(safe-area-inset-top, 0px));
  padding-bottom: 8px;
  padding-left: max(14px, env(safe-area-inset-left, 0px), calc((100% - 512px) / 2));
  padding-right: max(6px, env(safe-area-inset-right, 0px), calc((100% - 536px) / 2));
  border-bottom: 1px solid var(--web-line);
  background: var(--web-surface);
  color: var(--web-text);
}
.web-install[hidden] { display: none; }
.web-install-store {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 44px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.web-install-icon {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  box-shadow: 0 0 0 1px var(--web-line);
}
.web-install-text { display: flex; flex: 1; flex-direction: column; min-width: 0; }
.web-install-text strong {
  font-family: Fredoka_600SemiBold, system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
}
.web-install-note { color: var(--web-muted); font-size: 13px; line-height: 17px; }
.web-install-cta {
  flex: none;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--web-cta);
  color: #fff;
  font-family: Fredoka_600SemiBold, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 32px;
}
.web-install-store:not([href]) .web-install-cta { display: none; }
/* Under 360 px the store line needs the room; the whole row stays the link. */
@media (max-width: 359px) { .web-install-cta { display: none; } }
.web-install-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--web-muted);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.web-install-close svg { width: 20px; height: 20px; }
/* The tap's own feedback, in place of the browser's grey flash. */
.web-install-store[href]:active .web-install-cta { filter: brightness(0.9); }
.web-install-close:active { background: var(--web-line); }
.web-install-store[href]:focus-visible, .web-install-close:focus-visible {
  outline: 2px solid var(--web-accent);
  outline-offset: 2px;
}
.has-install .web-game {
  height: calc(100vh - var(--web-install-h, 0px));
  height: calc(100svh - var(--web-install-h, 0px));
}
