/* =============================================
   BUNNY BALLOON — style.css
   iPad & touch-first, dreamy pastel sky
============================================= */

:root {
  --sky-top:    #b3d9ff;
  --sky-mid:    #d4eeff;
  --sky-bot:    #ffd6e8;
  --cloud:      rgba(255,255,255,0.88);
  --hud-bg:     rgba(255,255,255,0.55);
  --hud-border: rgba(255,255,255,0.85);
  --text-dark:  #4a3060;
  --text-mid:   #8066a0;
  --bunny:      #ffb3d1;
}

/* ---- RESET ---- */
*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

html {
  height: 100%;
  overscroll-behavior: none;
  overflow: hidden;
}

body {
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
  touch-action: none;
  background: linear-gradient(175deg, var(--sky-top) 0%, var(--sky-mid) 50%, var(--sky-bot) 100%);
  font-family: 'Nunito', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ---- ANIMATED SKY ---- */
.sky { position:fixed; inset:0; pointer-events:none; z-index:0; overflow:hidden; }

.cloud {
  position: absolute;
  background: var(--cloud);
  border-radius: 50px;
  filter: blur(2px);
  opacity: 0.7;
}
.cloud::before, .cloud::after { content:''; position:absolute; background:var(--cloud); border-radius:50%; }

.c1 { width:190px; height:58px; top:7%;  left:-210px; animation:driftCloud 28s linear infinite; }
.c1::before { width:95px;  height:75px; top:-38px; left:28px; }
.c1::after  { width:72px;  height:58px; top:-27px; left:96px; }
.c2 { width:140px; height:44px; top:20%; left:-160px; animation:driftCloud 23s 6s linear infinite; opacity:.55; }
.c2::before { width:70px;  height:56px; top:-30px; left:20px; }
.c2::after  { width:58px;  height:46px; top:-20px; left:72px; }
.c3 { width:210px; height:64px; top:52%; left:-230px; animation:driftCloud 33s 3s linear infinite; opacity:.48; }
.c3::before { width:105px; height:84px; top:-42px; left:30px; }
.c3::after  { width:88px;  height:68px; top:-32px; left:110px; }
.c4 { width:120px; height:38px; top:76%; left:-140px; animation:driftCloud 20s 11s linear infinite; opacity:.38; }
.c4::before { width:60px;  height:48px; top:-24px; left:16px; }
.c4::after  { width:46px;  height:38px; top:-18px; left:60px; }

@keyframes driftCloud {
  from { transform:translateX(0); }
  to   { transform:translateX(calc(100vw + 320px)); }
}

.star { position:absolute; color:rgba(255,220,255,0.8); animation:twinkle 3s ease-in-out infinite; }
.s1 { top:12%; right:18%; font-size:1.2rem; animation-delay:0s; }
.s2 { top:40%; right:8%;  font-size:.8rem;  animation-delay:1.2s; }
.s3 { top:28%; right:32%; font-size:.95rem; animation-delay:2.1s; }

@keyframes twinkle {
  0%,100% { opacity:.4; transform:scale(1); }
  50%      { opacity:1;  transform:scale(1.3) rotate(15deg); }
}

/* ---- HUD ---- */
.hud {
  position: relative;
  z-index: 10;
  display: flex;
  gap: 20px;
  padding-top: max(14px, env(safe-area-inset-top));
  margin-bottom: 4px;
  flex-shrink: 0;
}

.hud-block {
  background: var(--hud-bg);
  border: 2px solid var(--hud-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 22px;
  padding: 7px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
  box-shadow: 0 4px 20px rgba(180,100,200,0.1);
}

.hud-label {
  font-family: 'Baloo 2', cursive;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: var(--text-mid);
  text-transform: uppercase;
}

.hud-val {
  font-family: 'Baloo 2', cursive;
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.1;
}

/* ---- STATUS BANNER ---- */
.status-banner {
  position: relative;
  z-index: 10;
  height: 26px;
  font-family: 'Baloo 2', cursive;
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 1px;
  opacity: 0;
  transition: opacity 0.25s;
  flex-shrink: 0;
}
.status-banner.show     { opacity:1; }
.status-banner.frozen   { color:#ff4f5e; }
.status-banner.spinning { color:#c07000; }

/* ---- CANVAS ---- */
canvas {
  position: relative;
  z-index: 5;
  display: block;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(140,80,180,0.15), 0 2px 0 rgba(255,255,255,0.5) inset;
  touch-action: none;   /* critical — let JS handle all touch */
  flex-shrink: 0;
}

/* Level badge in HUD */
.hud-level { background: rgba(255,180,210,0.45); }
.hud-level .hud-val { color: #c0306a; }

/* Centre bunny emoji between touch buttons */
.touch-mid {
  font-size: 2.2rem;
  line-height: 1;
  opacity: 0.55;
  user-select: none;
  pointer-events: none;
  flex-shrink: 0;
}

/* ---- TOUCH CONTROLS ---- */
.touch-controls {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 16px max(14px, env(safe-area-inset-bottom));
  flex-shrink: 0;
  width: 100%;
}

/* JS adds .hidden on non-touch desktop */
.touch-controls.hidden { opacity:0; pointer-events:none; }

.touch-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: 22px;
  background: rgba(255,255,255,0.52);
  border: 2.5px solid rgba(255,255,255,0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--text-dark);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(140,80,180,0.16);
  touch-action: none;
  transition: transform 0.07s, background 0.07s;
  /* Default size — overridden per button */
  width: 110px;
  height: 82px;
}

.left-btn, .right-btn { width:120px; height:82px; }
.jump-btn             { width:130px; height:90px; background:rgba(255,180,220,0.56); }

.touch-btn.pressed {
  transform: scale(0.9);
  background: rgba(255,255,255,0.82);
  box-shadow: 0 2px 8px rgba(140,80,180,0.18);
}

.btn-icon  { font-size:1.7rem; line-height:1; }
.jump-btn .btn-icon { font-size:2.1rem; }
.btn-label {
  font-family: 'Baloo 2', cursive;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-mid);
  text-transform: uppercase;
}

/* iPad landscape tweaks */
@media (orientation:landscape) and (min-width:768px) {
  .touch-btn             { width:130px; height:74px; }
  .left-btn, .right-btn  { width:140px; }
  .jump-btn              { width:150px; height:82px; }
  .touch-controls        { gap:22px; padding-top:6px; }
}

/* ---- OVERLAY ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(200,230,255,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  touch-action: manipulation;
}
.overlay.hidden { display:none; }

.overlay-inner {
  background: rgba(255,255,255,0.92);
  border-radius: 32px;
  padding: 30px 34px 26px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(140,80,180,0.2);
  max-width: 400px;
  width: 88%;
  animation: popIn 0.38s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes popIn {
  from { transform:scale(0.7); opacity:0; }
  to   { transform:scale(1);   opacity:1; }
}

.title-bunny {
  font-size: 3.6rem;
  line-height: 1;
  margin-bottom: 4px;
  animation: bop 1.2s ease-in-out infinite;
}
@keyframes bop {
  0%,100% { transform:translateY(0) rotate(-3deg); }
  50%      { transform:translateY(-10px) rotate(3deg); }
}

.game-title {
  font-family: 'Baloo 2', cursive;
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.1;
  margin-bottom: 14px;
}

.intro-text {
  font-size: clamp(0.78rem, 2.2vw, 0.88rem);
  color: var(--text-mid);
  line-height: 1.95;
  margin-bottom: 22px;
}
.intro-text b { color:var(--text-dark); }

.play-btn {
  display: inline-block;
  background: linear-gradient(135deg, #ff85b3, #c066d0);
  color: #fff;
  font-family: 'Baloo 2', cursive;
  font-size: 1.2rem;
  font-weight: 800;
  border: none;
  border-radius: 50px;
  padding: 16px 42px;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(200,80,180,0.38);
  transition: transform 0.12s, box-shadow 0.12s;
  touch-action: manipulation;
  letter-spacing: 0.5px;
}
.play-btn:hover  { transform:scale(1.05) translateY(-2px); }
.play-btn:active { transform:scale(0.94); }

.control-hint {
  font-size: 0.58rem;
  color: #bbb;
  margin-top: 14px;
  line-height: 1.9;
}

.gameover-score { font-family:'Baloo 2',cursive; font-size:1rem; color:var(--text-mid); margin-bottom:6px; }
.gameover-score strong { font-size:2rem; color:var(--text-dark); display:block; }

/* ---- HOME BUTTON ---- */
.home-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(255,255,255,0.86);
  border: 3px solid rgba(255,255,255,0.96);
  color: #7957c8;
  font-family: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 7px 24px rgba(50,90,80,0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  touch-action: manipulation;
  cursor: pointer;
}

.home-btn:hover,
.home-btn:focus-visible {
  transform: translateY(-2px) scale(1.03);
  background: rgba(255,255,255,0.96);
  outline: none;
}

.home-btn:active {
  transform: scale(0.94);
}

.home-icon {
  font-size: 1.25rem;
  line-height: 1;
}

@media (max-width: 520px) {
  .home-btn {
    min-width: 52px;
    width: 52px;
    height: 52px;
    padding: 0;
    border-radius: 50%;
    justify-content: center;
  }

  .home-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
