/* Base: fonts, colors, chunky buttons, in-game HUD and the instruction strip.
   Loaded in order from index.html (01 to 04): later files override earlier ones. */

@font-face {
  font-family: 'Fredoka';
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin-ext.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 700;
  font-display: swap;
  src: url(../assets/fonts/fredoka-latin.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 {
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --font:
    'Fredoka', 'Baloo 2', 'Nunito', 'Arial Rounded MT Bold', 'Segoe UI', system-ui, 'Hiragino Maru Gothic ProN',
    'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', 'Apple SD Gothic Neo', 'Malgun Gothic', 'PingFang SC', 'Microsoft YaHei',
    'Noto Sans CJK SC', sans-serif;
  --ink: #3a2416;
  --cream: #fff6e3;
  --cream2: #f6e3bf;
  --yellow: #ffd23a;
  --yellow2: #f0b419;
  --green: #5fd25a;
  --green2: #3aa53a;
  --pink: #ff8fc3;
  --sky: #8fd3ff;
  --wood: #e8b87a;
  --u: 1px; /* escala da interface, ajustada pelo JS */
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--font);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overscroll-behavior: none;
}
#game {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
#fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}
#fx.inwin {
  z-index: 0;
}
#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  font-size: calc(16 * var(--u));
}
#ui .layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#ui button,
#ui .hit {
  pointer-events: auto;
}
.hidden {
  display: none !important;
}

/* ---------- botões gordinhos ---------- */
.btn {
  font-family: var(--font);
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  border: calc(3.5 * var(--u)) solid var(--ink);
  border-radius: calc(18 * var(--u));
  background: linear-gradient(#fff9e9, var(--cream2));
  box-shadow:
    0 calc(5 * var(--u)) 0 var(--ink),
    inset 0 calc(-4 * var(--u)) 0 rgba(0, 0, 0, 0.08);
  transition:
    transform 90ms ease,
    box-shadow 90ms ease,
    filter 120ms;
  padding: calc(10 * var(--u)) calc(22 * var(--u));
  font-size: calc(22 * var(--u));
  position: relative;
  outline: none;
}
.btn:focus-visible {
  filter: brightness(1.08);
  box-shadow:
    0 calc(5 * var(--u)) 0 var(--ink),
    0 0 0 calc(4 * var(--u)) #fff;
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover {
    transform: translateY(calc(-2 * var(--u)));
    box-shadow: 0 calc(7 * var(--u)) 0 var(--ink);
  }
}
.btn:active,
.btn.press {
  transform: translateY(calc(4 * var(--u)));
  box-shadow: 0 calc(1 * var(--u)) 0 var(--ink);
}
.btn.green {
  background: linear-gradient(#9cf56a 0%, #5ad83a 45%, #34b52a 100%);
  color: #fff;
  -webkit-text-stroke: calc(5 * var(--u)) var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 calc(3 * var(--u)) 0 var(--ink);
  box-shadow:
    0 calc(6 * var(--u)) 0 var(--ink),
    inset 0 calc(-5 * var(--u)) 0 rgba(0, 0, 0, 0.14);
}
.btn.green {
  isolation: isolate;
}
.btn.green::before {
  z-index: -1;
  content: '';
  position: absolute;
  left: 12%;
  right: 12%;
  top: 10%;
  height: 28%;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}
.btn.yellow {
  background: linear-gradient(#ffe887, var(--yellow));
}
.btn.round {
  width: calc(54 * var(--u));
  height: calc(54 * var(--u));
  padding: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.btn.round svg {
  width: 56%;
  height: 56%;
}
.btn.big {
  font-size: calc(36 * var(--u));
  padding: calc(14 * var(--u)) calc(58 * var(--u));
  border-radius: calc(24 * var(--u));
}
.btn:disabled {
  filter: grayscale(0.7) brightness(0.92);
  cursor: default;
}

.pill {
  background: linear-gradient(#fffdf6, var(--cream) 55%, #f6e6c6);
  border: calc(3.5 * var(--u)) solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 calc(3 * var(--u)) 0 var(--ink);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(8 * var(--u));
  padding: calc(4 * var(--u)) calc(16 * var(--u));
  font-size: calc(22 * var(--u));
  white-space: nowrap;
}
.pill.hard {
  background: linear-gradient(#ffd0e6, #ffaed2);
}

/* ---------- HUD ---------- */
#hud {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--sat) + 10 * var(--u));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(10 * var(--u));
  padding: 0 calc(12 * var(--u));
}
#hud .timer {
  min-width: calc(170 * var(--u));
  position: relative;
  font-size: calc(24 * var(--u));
}
#hud .timer .bar {
  width: calc(110 * var(--u));
  height: calc(14 * var(--u));
  border-radius: 99px;
  background: #e8d9bd;
  border: calc(2 * var(--u)) solid var(--ink);
  overflow: hidden;
}
#hud .timer .bar i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(#8cf07f, var(--green));
  transform-origin: left;
}
#hud .timer.low .bar i {
  background: linear-gradient(#ffc36b, #ff9a3c);
}
#hud .timer.beat {
  animation: beat 260ms cubic-bezier(0.3, 1.8, 0.5, 1);
}
@keyframes beat {
  40% {
    transform: scale(1.07);
  }
}
#hud .timer.frozen {
  background: linear-gradient(#e6f4ff, #bfe2ff);
}
#hud .timer.frozen .bar i {
  background: linear-gradient(#d9ecff, #8fc8ff);
}
#hud .timer .clock {
  width: calc(34 * var(--u));
  height: calc(34 * var(--u));
  margin: calc(-4 * var(--u)) 0;
}
#hud .pause,
#hud .restart {
  flex: 0 0 auto;
}
#hud .grow {
  flex: 1 1 auto;
  max-width: calc(8 * var(--u));
}

#boosters {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(var(--sab) + 12 * var(--u));
  display: flex;
  justify-content: center;
  gap: calc(22 * var(--u));
}
.booster {
  width: calc(94 * var(--u));
  height: calc(94 * var(--u));
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 40% 35%, #fffef8, #fbefd6 72%);
  box-shadow:
    0 calc(5 * var(--u)) 0 var(--ink),
    inset 0 0 0 calc(4 * var(--u)) #f7dea6;
}
.booster img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 calc(2 * var(--u)) 0 rgba(58, 36, 22, 0.25));
}
.booster .badge {
  min-width: calc(36 * var(--u)) !important;
  height: calc(36 * var(--u)) !important;
  font-size: calc(20 * var(--u)) !important;
  position: absolute;
  right: calc(-6 * var(--u));
  top: calc(-6 * var(--u));
  min-width: calc(30 * var(--u));
  height: calc(30 * var(--u));
  border-radius: 99px;
  background: var(--green);
  color: #fff;
  border: calc(3 * var(--u)) solid var(--ink);
  font-size: calc(17 * var(--u));
  display: grid;
  place-items: center;
  text-shadow: 0 calc(1.5 * var(--u)) 0 var(--ink);
  padding: 0 calc(5 * var(--u));
}
.booster .badge.price {
  background: var(--yellow);
  color: var(--ink);
  text-shadow: none;
  display: flex;
  gap: calc(2 * var(--u));
  font-size: calc(14 * var(--u));
}
.booster .badge.price img {
  width: calc(16 * var(--u));
  height: calc(16 * var(--u));
}
.booster.locked img {
  filter: grayscale(0.85) opacity(0.4);
}
.booster .lock {
  position: absolute;
  right: calc(-4 * var(--u));
  bottom: calc(-2 * var(--u));
  width: calc(30 * var(--u));
  height: calc(30 * var(--u));
  display: grid;
  place-items: center;
  background: #fff6e3;
  border: calc(2.5 * var(--u)) solid var(--ink);
  border-radius: 50%;
}
.booster .lock svg {
  width: 72%;
  height: 72%;
}
.booster .badge.lv {
  top: auto;
  bottom: calc(-16 * var(--u));
  right: 50%;
  transform: translateX(50%);
  background: #fff6e3;
  color: var(--ink);
  text-shadow: none;
  font-size: calc(13 * var(--u));
  height: calc(24 * var(--u));
  white-space: nowrap;
}
.booster.active {
  animation: boostGlow 0.9s ease-in-out infinite;
}
@keyframes boostGlow {
  50% {
    box-shadow:
      0 calc(5 * var(--u)) 0 var(--ink),
      0 0 0 calc(6 * var(--u)) rgba(255, 255, 255, 0.8);
  }
}

/* paisagem: placar à esquerda, ajudantes em coluna à direita */
body.land #hud {
  left: calc(var(--sal) + 16 * var(--u));
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  width: var(--panelW);
  flex-direction: column;
  gap: calc(14 * var(--u));
}
body.land #hud .row {
  display: flex;
  gap: calc(14 * var(--u));
}
body.land #hud .grow {
  display: none;
}
body.land #boosters {
  left: auto;
  right: calc(var(--sar) + 14 * var(--u));
  top: 50%;
  bottom: auto;
  transform: translateY(-50%);
  flex-direction: column;
  width: var(--railW);
  align-items: center;
  gap: calc(26 * var(--u));
}
#hud .logo-small {
  display: none;
}
.logo-top {
  display: none;
  position: absolute;
  left: 50%;
  top: calc(var(--sat) + 12 * var(--u));
  height: calc(var(--logoH, 96px) - 14 * var(--u));
  transform: translateX(-50%);
  pointer-events: none;
}
body.withlogo:not(.land) .logo-top {
  display: block;
  top: calc(var(--sat) + var(--stackTop, 0px) + 2 * var(--u));
}
body.withlogo:not(.land) #hud {
  top: calc(var(--sat) + var(--stackTop, 0px) + var(--logoH, 96px));
}
body:not(.withlogo):not(.land) #hud {
  top: calc(var(--sat) + var(--stackTop, 0px) + 10 * var(--u));
}
#hudL.fadeout {
  opacity: 0;
  transition: opacity 280ms ease;
}
body.land #hud .logo-small {
  display: block;
  width: 92%;
}
#hud .coins {
  display: none;
}
body.land #hud .coins {
  display: flex;
}
#hud .row {
  display: contents;
}

/* faixa de instrução (tutorial / modo de ajudante) */
.hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: var(--hintY, 18%);
  background: rgba(58, 36, 22, 0.88);
  color: #fff;
  font-weight: 600;
  border-radius: calc(16 * var(--u));
  padding: calc(8 * var(--u)) calc(18 * var(--u));
  font-size: calc(19 * var(--u));
  white-space: nowrap;
  pointer-events: none;
  animation: hintIn 360ms cubic-bezier(0.2, 1.6, 0.4, 1) both;
}
.hint.with-cancel {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: calc(12 * var(--u));
}
.hint .x {
  font-size: calc(15 * var(--u));
  padding: calc(4 * var(--u)) calc(12 * var(--u));
  border-radius: 99px;
}
@keyframes hintIn {
  from {
    opacity: 0;
    transform: translate(-50%, calc(10 * var(--u))) scale(0.9);
  }
}

/* End of css/01-base.css */
