/* Sudoku Cosmos: base. Every size comes from one unit (--u): 100u is the width of the stage standing up,
   or its height lying down. Art from assets/; stretchable pieces are put together by src/lib/nine.js. */
/* One file per weight (static cuts of the variable font). A browser that cannot read variable
   fonts drew every text at the thinnest weight. Cyrillic, Japanese, Korean and Chinese fall back to the system font. */
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-400.woff2) format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-400.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-500.woff2) format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-500.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-600.woff2) format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-600.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext-700.woff2) format('woff2');
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F,
    U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-700.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
:root {
  --u: min(1vw, 0.562vh, 5.6px);
  --u: min(1vw, 0.562dvh, 5.6px);
  --b: calc(89 * var(--u)); /* board side */
  --peek: calc(25 * var(--u)); /* height of the axolotl over the board */
  --ar: 0.575; /* background art: width / height */
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --cap: 0.02em; /* Fredoka sits a hair high in its line box: every centred label goes down by this */
  --ink: #ffffff;
  --soft: #b1b8f7;
  --sky: #8fd8ff;
  --amber: #19e6dc;
  --gold: #52f0ff;
  --mint: #9bff8a;
  --well: #0d1442;
  --pink: #ff9ab0;
  --spring: cubic-bezier(0.22, 1.5, 0.4, 1);
}
@media (orientation: landscape) {
  :root {
    --u: min(1vh, 0.62vw, 11px);
    --u: min(1dvh, 0.62vw, 11px);
    --b: calc(65 * var(--u));
    --peek: calc(19 * var(--u));
    --ar: 1.777;
  }
} /* a phone lying down: the height is the scarce thing, so the board takes most of it and the axolotl gets small */
@media (orientation: landscape) and (max-height: 520px) {
  :root {
    --b: calc(77 * var(--u));
    --peek: calc(10 * var(--u));
  }
}

/* system fonts (Japanese, Korean, Chinese) sit higher in the line than Fredoka */
:lang(ja),
:lang(ko),
:lang(zh) {
  --cap: 0.07em;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #090f36;
  color: var(--ink);
  font-family:
    'Fredoka', 'Segoe UI', 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', 'Noto Sans JP',
    'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', system-ui,
    sans-serif;
  font-weight: 500;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}
[hidden] {
  display: none !important;
}
b {
  font-weight: 600; /* titles and labels: semibold is the heaviest weight of the interface */
}
img {
  -webkit-user-drag: none;
}
button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  outline: none;
}
button:disabled {
  cursor: default;
}
#app {
  /* the size the menu art has on screen (it always covers it), where the axolotl sits in the art, and --p: which
     part of the art stays on screen when its sides are cropped (0.5 = centred, near 0 = the left side, the boulder) */
  --sw: max(100vw, 100vh * var(--ar));
  --sw: max(100vw, 100dvh * var(--ar));
  --sh: max(100vh, 100vw / var(--ar));
  --sh: max(100dvh, 100vw / var(--ar));
  --x: 0.436;
  --y: 0.635;
  --k: 0.25;
  --p: 0.5;
  --ox: calc((100vw - var(--sw)) * var(--p)); /* where the left edge of the art is */
  position: fixed;
  inset: 0;
  overflow: hidden;
  overflow: clip; /* never scrolls, not even when a button takes the focus */
}

/* ---- the scene: the background art always covers the screen; what stands on it is placed in % of the art ---- */
/* The scene never gets bigger than the screen (a bigger box could be scrolled sideways): the art covers it, and
   --sw / --sh are the size the art has on screen, so a piece is placed at "50% + (x - 0.5) * size of the art". */
.scene {
  position: absolute;
  inset: 0;
  z-index: 0; /* its own layer: nothing inside it ever sits over the buttons */
  overflow: hidden;
  pointer-events: none;
  background: #0b1240 url(../assets/bg/pe.webp) calc(var(--p) * 100%) center / cover no-repeat;
}
/* the game screen has its own view of the observatory (no boulder): it fades in over the menu view */
.scene::after {
  content: '';
  position: absolute;
  inset: 0;
  /* anchored at the top: a window wider than the art (tablet standing, ultrawide lying) crops the deck, never the sky with
     the planet (which would slide under the top bar) */
  background: url(../assets/bg/jogo-pe.webp) center top / cover no-repeat;
  opacity: 0;
  transition: opacity 0.4s ease-out;
}
#app[data-screen='game'] .scene::after {
  opacity: 1;
}
.calm .scene::after {
  transition-duration: 1ms;
}
.sky {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
}
.menu-mascot {
  position: absolute;
  left: calc(var(--ox) + var(--x) * var(--sw));
  top: calc(50% + (var(--y) - 0.5) * var(--sh));
  height: calc(var(--k) * var(--sh));
  aspect-ratio: 989 / 1252;
  translate: -50% -100%;
  z-index: 2;
  transition: opacity 0.25s;
}
.menu-mascot::before {
  content: '';
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: -4%;
  height: 13%;
  z-index: -1;
  background: radial-gradient(closest-side, rgba(14, 8, 34, 0.6), rgba(14, 8, 34, 0));
}
@media (orientation: landscape) {
  #app {
    --x: 0.18;
    --y: 0.705;
    --k: 0.37;
    --p: 0.06; /* a narrow window crops the right side, never the boulder with the axolotl */
    /* On a narrow (squarish) window the axolotl would sit under the logo and the buttons: they move right by what is
       missing, together, and never past the right edge. On a wide screen this is zero. */
    --panda-right: calc(var(--ox) + var(--x) * var(--sw) + var(--k) * var(--sh) * 0.46);
    --shift: clamp(0px, calc(var(--panda-right) + 3 * var(--u) - (50vw - 28 * var(--u))), calc(50vw - 36 * var(--u)));
  }
  .scene {
    background-image: url(../assets/bg/deitado.webp);
  }
  .scene::after {
    background-image: url(../assets/bg/jogo-deitado.webp);
  }
}
#app:not([data-screen='menu']) .menu-mascot,
#app[data-panel] .menu-mascot {
  opacity: 0;
}
.mascot {
  transform-origin: 50% 100%;
  animation: mascot-breathe 3.4s ease-in-out infinite;
}
.mascot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
}
.mascot img.on {
  opacity: 1;
}
@keyframes mascot-breathe {
  50% {
    scale: 1.012 1.028;
  }
}
.float {
  position: absolute;
  left: calc(var(--ox) + var(--fx) * var(--sw));
  top: calc(50% + (var(--fy) - 0.5) * var(--sh));
  width: calc(var(--fs) * var(--sw));
  aspect-ratio: 320 / 238;
  translate: -50% -50%;
  background: var(--img, url(../assets/fx/lantern.webp)) center / contain no-repeat;
  transition: opacity 0.4s ease-out;
  animation: bob 5s ease-in-out var(--fd, 0s) infinite;
}
@keyframes bob {
  50% {
    translate: -50% -56%;
  }
}
#app[data-screen='game'] .float {
  opacity: 0;
}
.calm .float {
  animation: none;
}
/* A few comets rise slowly in the sky of the menu view, each in its own lane of the art (x, start height and
   size as fractions of the art), chosen where nothing is painted: they never cross one another. */
.sky i {
  position: absolute;
  left: calc(var(--ox) + var(--fx) * var(--sw));
  top: calc(50% + (var(--fy) - 0.5) * var(--sh));
  width: calc(var(--fs) * var(--sw));
  aspect-ratio: 244 / 282;
  translate: -50% 0;
  opacity: 0;
  background: url(../assets/fx/sky.webp) center / contain no-repeat;
  animation: sky-rise var(--d) linear var(--dl) infinite;
}
.sky {
  transition: opacity 0.4s ease-out;
}
#app[data-screen='game'] .sky {
  opacity: 0;
}
@keyframes sky-rise {
  12% {
    opacity: 0.95;
  }
  80% {
    opacity: 0.95;
  }
  to {
    translate: -50% calc(-1 * var(--rise) * var(--sh));
    opacity: 0;
  }
}
.calm .mascot,
.calm .sky i,
.calm .tap .pilltext,
.calm .breathe {
  animation: none;
}

/* ---- screens ---- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: var(--sat) 0 var(--sab);
  display: none;
  flex-direction: column;
  align-items: center;
}
.screen.on,
#menu[data-leaving],
#game[data-leaving] {
  display: flex;
}
#game[data-leaving] {
  pointer-events: none;
}
#menu[data-leaving] > * {
  pointer-events: none !important;
}

/* ---- pieces of stretchable art (see src/lib/nine.js) ---- */
.btn,
.ib,
.tool,
.key,
.pill,
.chip,
.panel,
.band,
.card,
.item,
.rowb,
.row,
.fact,
.stat,
.board,
.pilltext {
  background-repeat: no-repeat;
  background-size: 100% 100%;
}
.amber {
  --nine: btn-amber;
}
/* the primary face is bright cyan: its label (and the icon of an armed tool) is dark navy, never white */
.btn.amber,
.btn.amber small,
.btn.amber b {
  color: #07173f;
  text-shadow: none;
}
.teal {
  --nine: btn-teal;
}
.indigo {
  --nine: btn-indigo;
}
.navy {
  --nine: btn-navy;
}
#btn-continue {
  color: var(--gold);
}
#btn-continue small {
  color: #fff;
}
.btn.indigo {
  filter: brightness(0.93) saturate(1.06);
}
.btn.indigo[data-down] {
  filter: brightness(0.84);
}
/* End of css/01-base.css (complete file). */
