/* Level select pages, settings language list, title bar, no-way-out card, tap-to-start and later polish.
   Loaded in order from index.html (01 to 04): later files override earlier ones. */

/* ---------- tela de fases em páginas ---------- */
#levels .lvbody {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(14 * var(--u));
  min-height: 0;
  padding: 0 calc(10 * var(--u));
}
#levels .lvview {
  flex: 0 1 calc(980 * var(--u));
  min-width: 0;
  height: 100%;
  overflow: hidden;
  pointer-events: auto;
  touch-action: pan-y;
}
#levels .lvtrack {
  display: flex;
  height: 100%;
  will-change: transform;
}
#levels .wpage {
  flex: 0 0 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: calc(10 * var(--u));
}
#levels .ribbon {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(#ff9a8a, #f2665a);
  color: #fff;
  font-weight: 700;
  font-size: calc(28 * var(--u));
  padding: calc(4 * var(--u)) calc(32 * var(--u)) calc(6 * var(--u));
  border: calc(3.5 * var(--u)) solid var(--ink);
  border-radius: calc(14 * var(--u));
  box-shadow: 0 calc(4 * var(--u)) 0 var(--ink);
  -webkit-text-stroke: calc(4 * var(--u)) var(--ink);
  paint-order: stroke fill;
  line-height: 1.05;
}
#levels .ribbon small {
  font-size: calc(14 * var(--u));
  -webkit-text-stroke: calc(3 * var(--u)) var(--ink);
}
#levels .wpage.locked .ribbon {
  background: linear-gradient(#cdbca4, #a8957c);
}
#levels .wgrid {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--egg));
  gap: var(--gap);
  justify-content: center;
  background: rgba(255, 246, 227, 0.68);
  border: calc(3 * var(--u)) solid rgba(58, 36, 22, 0.55);
  border-radius: calc(22 * var(--u));
  padding: calc(14 * var(--u));
  box-shadow: 0 calc(4 * var(--u)) 0 rgba(58, 36, 22, 0.35);
}
#levels .wgrid .lvegg {
  width: var(--egg);
}
#levels .wgrid .lvegg .n {
  font-size: calc(var(--egg) * 0.26);
}
#levels .wgrid .lvegg.done .n {
  font-size: calc(var(--egg) * 0.23);
}
#levels .wgrid .lvegg.hard::after {
  width: calc(var(--egg) * 0.16);
  height: calc(var(--egg) * 0.16);
}
#levels .lvarrow {
  flex: 0 0 auto;
  width: calc(64 * var(--u));
  height: calc(64 * var(--u));
  pointer-events: auto;
}
#levels .lvarrow svg {
  width: 58%;
  height: 58%;
}
#levels .lvarrow.next svg {
  transform: scaleX(-1);
}
#levels .lvarrow:disabled {
  opacity: 0.35;
  filter: grayscale(0.6);
}
#levels .lvnav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(18 * var(--u));
  padding: calc(6 * var(--u)) 0 calc(var(--sab) + 18 * var(--u));
  pointer-events: auto;
}
#levels .dots {
  display: flex;
  gap: calc(10 * var(--u));
}
#levels .dot {
  width: calc(16 * var(--u));
  height: calc(16 * var(--u));
  border-radius: 50%;
  padding: 0;
  border: calc(3 * var(--u)) solid var(--ink);
  background: #fff6e3;
  cursor: pointer;
  transition:
    transform 160ms,
    background 160ms;
}
#levels .dot.on {
  background: var(--yellow);
  transform: scale(1.35);
}
#levels .pill.soon {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sab) + 70 * var(--u));
  transform: translateX(-50%);
}
/* desktop: setas grandes e bem visíveis ao lado da grade */
#levels.land .lvarrow {
  width: calc(92 * var(--u));
  height: calc(92 * var(--u));
  min-width: 64px;
  min-height: 64px;
  border-width: calc(4 * var(--u));
  box-shadow:
    0 calc(6 * var(--u)) 0 var(--ink),
    0 0 0 calc(5 * var(--u)) rgba(255, 246, 227, 0.85);
}
#levels.land .lvarrow svg {
  width: 62%;
  height: 62%;
}
#levels.land .lvarrow:disabled {
  opacity: 0.4;
}
#levels.land .lvnav {
  padding-bottom: calc(var(--sab) + 12 * var(--u));
}
#levels.land .dot {
  width: calc(20 * var(--u));
  height: calc(20 * var(--u));
  min-width: 14px;
  min-height: 14px;
}

/* lista de idiomas nos Ajustes */
.toggle.langrow {
  gap: calc(12 * var(--u));
}
.langsel {
  flex: 1 1 auto;
  max-width: 62%;
  font: inherit;
  font-weight: 700;
  font-size: calc(18 * var(--u));
  color: var(--ink);
  background: #fff6e3
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%233a2416' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")
    no-repeat right calc(10 * var(--u)) center / calc(18 * var(--u));
  border: calc(3 * var(--u)) solid var(--ink);
  border-radius: calc(12 * var(--u));
  padding: calc(6 * var(--u)) calc(34 * var(--u)) calc(6 * var(--u)) calc(12 * var(--u));
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 calc(3 * var(--u)) 0 var(--ink);
}
.langsel:focus-visible {
  outline: calc(3 * var(--u)) solid #fff;
}
#ui select {
  pointer-events: auto;
}

/* vitória: conteúdo sempre no centro exato (encolhe para caber pelo meio) */
.win .content {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
}
/* volume: barra encolhe antes do texto */
.toggle.slider input[type='range'] {
  min-width: 0;
}
.toggle.slider .vol {
  flex: 0 0 auto;
  min-width: calc(34 * var(--u));
}
.toggle.slider > span:first-child {
  min-width: 0;
  flex: 0 1 auto;
  white-space: nowrap;
}

.toggle.slider > span:first-child {
  flex: 0 0 auto;
}
.win .stamp,
.hatchveil .hstamp {
  white-space: nowrap;
  max-width: 92vw;
}
.screen .top .title.fit {
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
}
/* celular deitado (tela baixa): Ajustes em duas colunas para caber sem cortar */
@media (orientation: landscape) and (max-height: 520px) {
  .panel {
    width: min(94vw, calc(760 * var(--u)));
    padding-top: calc(48 * var(--u));
  }
  .panel .col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: calc(8 * var(--u)) calc(12 * var(--u));
  }
  .panel .col .btn {
    grid-column: span 1;
  }
  .panel .col .langrow {
    grid-column: 1 / -1;
  }
}
/* barra de cima das telas: título no centro exato (mesmo eixo da faixa do mundo), voltar à esquerda e contadores à direita */
.screen .top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
}
.screen .top > .back {
  justify-self: start;
}
.screen .top > .pills {
  justify-self: end;
}
.screen .top .title {
  flex: none;
  max-width: 48vw;
}
/* celular em pé: voltar e contadores na primeira linha; título sozinho e centrado na linha de baixo */
@media (orientation: portrait), (max-width: 640px) {
  .screen .top {
    grid-template-columns: auto 1fr;
    grid-template-areas: 'back pills' 'title title';
    row-gap: calc(2 * var(--u));
  }
  .screen .top > .back {
    grid-area: back;
  }
  .screen .top > .pills {
    grid-area: pills;
  }
  .screen .top .title {
    grid-area: title;
    justify-self: center;
    max-width: 92vw;
  }
}

/* galinha no menu em pé (celular): no caminho, entre a logo e o botão Jogar */
body:not(.land) #home .grow {
  position: relative;
  align-self: stretch;
  min-height: 0;
}
body:not(.land) .hen-home {
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(16 * var(--u)); /* um respiro acima do botão Jogar */
  margin: 0 auto;
  height: min(88%, 27vh);
  width: auto;
  max-width: 60vw;
  object-fit: contain;
  animation: henIdle 2.6s ease-in-out infinite;
}
/* título das telas: o contorno grosso e a sombra precisam de espaço (o fitText já encolhe o texto longo) */
.screen .top .title,
.screen .top .title.fit {
  overflow: visible;
  text-overflow: clip;
  padding: calc(2 * var(--u)) calc(6 * var(--u)) calc(7 * var(--u));
  line-height: 1.15;
}

/* desfazer pulsando quando não há mais saída */
#hud .nudge,
#hudL .nudge {
  animation: nudge 1.1s ease-in-out infinite;
  box-shadow:
    0 0 0 calc(4 * var(--u)) rgba(255, 210, 58, 0.85),
    0 calc(4 * var(--u)) 0 var(--ink);
}
@keyframes nudge {
  50% {
    scale: 1.12;
  }
}

/* celular com a galinha em cima do tabuleiro: o aviso ocupa só o espaço à esquerda dela (quebra linha se precisar) */
body:not(.land) .hint {
  left: var(--hintL, 50%);
  max-width: var(--hintMax, 92vw);
  white-space: normal;
  text-align: center;
  line-height: 1.2;
}

/* canvas da vitória com sobra dos lados (asas): mais largo, margem negativa mantém o lugar na tela */
.win .burst {
  --bw: min(88vw, calc(340 * var(--u)));
  width: calc(var(--bw) * 428 / 340);
  margin-inline: calc(var(--bw) * -44 / 340);
  aspect-ratio: 428 / 290;
}

/* cartão "sem saída": embaixo, por cima da fileira dos ajudantes, sem tampar o tabuleiro */
.stuck-card {
  position: absolute;
  left: 50%;
  bottom: calc(var(--sab) + 14 * var(--u));
  transform: translateX(-50%);
  width: min(92vw, calc(440 * var(--u)));
  background: #fff8e8;
  color: var(--ink);
  border: calc(3.5 * var(--u)) solid var(--ink);
  border-radius: calc(20 * var(--u));
  box-shadow: 0 calc(5 * var(--u)) 0 var(--ink);
  padding: calc(12 * var(--u)) calc(16 * var(--u)) calc(14 * var(--u));
  text-align: center;
  pointer-events: auto;
  z-index: 4;
  animation: stuckIn 420ms cubic-bezier(0.2, 1.5, 0.4, 1) both;
}
.stuck-card .st-title {
  font-weight: 700;
  font-size: calc(24 * var(--u));
  color: #e0574f;
}
.stuck-card .st-tip {
  font-size: calc(15 * var(--u));
  line-height: 1.3;
  margin: calc(4 * var(--u)) 0 calc(10 * var(--u));
}
.stuck-card .st-btns {
  display: flex;
  gap: calc(10 * var(--u));
  justify-content: center;
}
.stuck-card .btn {
  flex: 1 1 0;
  font-size: calc(18 * var(--u));
  padding: calc(8 * var(--u)) calc(10 * var(--u));
}
@keyframes stuckIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(30 * var(--u))) scale(0.9);
  }
}

/* deitado: o cartão vai para a coluna da esquerda, embaixo (no lugar da galinha); não tampa tabuleiro nem ajudantes */
body.land .stuck-card {
  left: var(--leftC, 50%);
  width: min(var(--leftW, 92vw), calc(340 * var(--u)));
}
body.land .stuck-card .st-btns {
  flex-direction: column;
}

.stuck-card .st-once {
  font-size: calc(13 * var(--u));
  line-height: 1.3;
  margin: calc(-4 * var(--u)) 0 calc(10 * var(--u));
  padding: calc(6 * var(--u)) calc(8 * var(--u));
  background: #fff0c4;
  border-radius: calc(10 * var(--u));
}

/* tela "Toque para começar" (antes do menu: o primeiro toque libera o som no iPhone) */
#start {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  pointer-events: auto;
  cursor: pointer;
  padding: calc(var(--sat) + 4vh) 0 calc(var(--sab) + 7vh);
  background: radial-gradient(ellipse at 50% 40%, rgba(255, 250, 220, 0.35), transparent 60%);
  transition: opacity 260ms ease;
}
#start.out {
  opacity: 0;
}
#start .logo {
  width: min(80vw, calc(380 * var(--u)));
  animation:
    logoIn 700ms cubic-bezier(0.2, 1.6, 0.4, 1) both,
    logoIdle 3.4s ease-in-out 800ms infinite;
  transform-origin: 50% 90%;
}
#start .hen-start {
  height: min(30vh, calc(260 * var(--u)));
  width: auto;
  transform-origin: 50% 100%;
  animation: henIdle 2.6s ease-in-out infinite;
}
#start .tap {
  font-weight: 700;
  font-size: calc(28 * var(--u));
  color: #fff;
  -webkit-text-stroke: calc(6 * var(--u)) var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 calc(4 * var(--u)) 0 var(--ink);
  padding: calc(10 * var(--u)) calc(30 * var(--u)) calc(14 * var(--u));
  animation: tapPulse 1.3s ease-in-out infinite;
  white-space: nowrap;
}
@keyframes tapPulse {
  0%,
  100% {
    scale: 1;
    opacity: 1;
  }
  50% {
    scale: 1.08;
    opacity: 0.8;
  }
}
body.land #start .logo {
  width: auto;
  height: min(38vh, calc(300 * var(--u)));
}
body.land #start .hen-start {
  height: min(28vh, calc(220 * var(--u)));
}
@media (prefers-reduced-motion: reduce) {
  #start .tap,
  #start .logo,
  #start .hen-start {
    animation: none;
  }
}
#start .tap {
  font-size: max(26px, calc(38 * var(--u)));
  -webkit-text-stroke-width: max(5px, calc(7 * var(--u)));
}

/* rótulo longo nos Ajustes (alemão, russo): quebra linha em vez de encostar no botão */
.toggle > span:first-child {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.15;
  padding-right: calc(10 * var(--u));
}

/* End of css/04-pages-and-polish.css */

/* Dino Nest: número no meio da casca de cada ovo (centros medidos nas imagens: 38%, 41% e 47%) */
.lvegg .n { top: 41%; transform: translateY(-50%); line-height: 1; }
.lvegg.done .n { top: 47%; }
.lvegg.locked .n { top: 38%; opacity: 0.85; }

/* End of css/04-pages-and-polish.css (Dino Nest) */
