@font-face { font-family: 'Lilita One'; src: url('fonts/LilitaOne.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Nunito'; src: url('fonts/Nunito.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; }

: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);
  --gold: #ffd23f;
  --gold2: #ffa514;
  --leaf: #4fc25a;
  --deep: #0f2b20;
  --ink: #12231a;
  --blue: #2f9bff;
  --pink: #ff5fa2;
  --u: min(1vw, 1.9vh);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden;
  background: #0f2b20; color: #fff;
  font-family: 'Nunito', system-ui, sans-serif; font-weight: 800;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
  overscroll-behavior: none; position: fixed; inset: 0;
}
canvas#game { position: fixed; inset: 0; display: block; width: 100vw; height: 100vh; }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }

/* ---------- logo text ---------- */
.logo { text-align: center; transform: rotate(-3deg); filter: drop-shadow(0 6px 0 rgba(0,0,0,.35)); }
.logo-super, .logo-june, .logo-sub, h1, h2, .btn, .load-logo, .pill b, #timer, .res-stats b, .tap-hint, .badge-bday, #toast, .floater, #hint span {
  font-family: 'Lilita One', 'Arial Black', sans-serif; font-weight: 400; letter-spacing: .02em;
}
.logo-super { font-size: calc(var(--u) * 6); color: #fff; -webkit-text-stroke: calc(var(--u) * .5) var(--ink); paint-order: stroke fill; line-height: .9; }
.logo-june {
  font-size: calc(var(--u) * 21); line-height: .82; margin-top: calc(var(--u) * -.5);
  background: linear-gradient(180deg, #fff6a8 0%, #ffd23f 38%, #ff9f1a 70%, #ff6a1f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: calc(var(--u) * .9) var(--ink); paint-order: stroke fill;
  position: relative;
}
.logo-sub { font-size: calc(var(--u) * 4.2); color: #b6f56b; -webkit-text-stroke: calc(var(--u) * .45) var(--ink); paint-order: stroke fill; margin-top: calc(var(--u) * .6); letter-spacing: .12em; }
.badge-bday { margin: calc(var(--u) * 1.6) auto 0; display: inline-block; padding: calc(var(--u) * .7) calc(var(--u) * 2.2); background: linear-gradient(90deg, #ff5fa2, #ff8a3d); border-radius: 999px; font-size: calc(var(--u) * 2.4); transform: rotate(-2deg); box-shadow: 0 4px 0 rgba(0,0,0,.3); }

/* ---------- screens ---------- */
#screens { position: fixed; inset: 0; pointer-events: none; z-index: 8; } /* menus sit above the touch controls (the joystick zone used to eat their taps) */
.screen { position: absolute; inset: 0; pointer-events: auto; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--sat) + 10px) calc(var(--sar) + 16px) calc(var(--sab) + 10px) calc(var(--sal) + 16px); }
.screen.dim { background: radial-gradient(ellipse at center, rgba(8,30,20,.55), rgba(5,18,12,.85)); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#title { align-items: flex-start; justify-content: center; background: linear-gradient(90deg, rgba(6,24,16,.72) 0%, rgba(6,24,16,.35) 42%, rgba(0,0,0,0) 60%); }
.title-wrap { margin-left: calc(var(--u) * 5); display: flex; flex-direction: column; align-items: center; animation: floatIn .7s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes floatIn { from { transform: translateY(30px) scale(.9); opacity: 0; } }
.menu { margin-top: calc(var(--u) * 2.4); display: flex; flex-direction: column; gap: calc(var(--u) * 1.4); align-items: stretch; width: calc(var(--u) * 34); }
.row { display: flex; gap: calc(var(--u) * 1.4); justify-content: center; }
.row > .btn { flex: 1; }
.title-gems { margin-top: calc(var(--u) * 2); display: flex; align-items: center; gap: 6px; font-family: 'Lilita One'; font-size: calc(var(--u) * 3); background: rgba(0,0,0,.35); padding: 4px 14px; border-radius: 999px; }
.title-gems.small { margin: 0; font-size: calc(var(--u) * 2.6); }
.title-gems .sep { width: 10px; }
.tap-hint { position: absolute; bottom: calc(var(--sab) + 4vh); right: calc(var(--sar) + 5vw); font-size: calc(var(--u) * 3.4); color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.4); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); opacity: .75; } }
.challenge { margin-top: calc(var(--u) * 1.4); background: linear-gradient(90deg, #7b4dff, #2f9bff); padding: 8px 16px; border-radius: 14px; font-size: calc(var(--u) * 2.3); text-align: center; box-shadow: 0 4px 0 rgba(0,0,0,.3); max-width: calc(var(--u) * 44); }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  padding: calc(var(--u) * 1.3) calc(var(--u) * 3); font-size: calc(var(--u) * 3.2); color: #2a1600;
  background: linear-gradient(180deg, #fff3a0 0%, var(--gold) 45%, var(--gold2) 100%);
  border-radius: calc(var(--u) * 1.4); transform: skewX(-6deg);
  box-shadow: 0 calc(var(--u) * .7) 0 #a35a00, 0 calc(var(--u) * 1.2) calc(var(--u) * 1.6) rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.7);
  transition: transform .08s, box-shadow .08s, filter .1s;
  text-shadow: 0 1px 0 rgba(255,255,255,.5);
  min-height: calc(var(--u) * 7);
}
.btn:active { transform: skewX(-6deg) translateY(calc(var(--u) * .5)); box-shadow: 0 calc(var(--u) * .2) 0 #a35a00, 0 4px 8px rgba(0,0,0,.3), inset 0 2px 0 rgba(255,255,255,.7); filter: brightness(1.05); }
.btn.big { font-size: calc(var(--u) * 5); min-height: calc(var(--u) * 10); }
.btn.secondary { color: #fff; background: linear-gradient(180deg, #7fd0ff 0%, #2f9bff 50%, #1a6fe0 100%); box-shadow: 0 calc(var(--u) * .7) 0 #0d47a1, 0 calc(var(--u) * 1.2) calc(var(--u) * 1.6) rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.5); text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn.secondary:active { box-shadow: 0 calc(var(--u) * .2) 0 #0d47a1, inset 0 2px 0 rgba(255,255,255,.5); }
.btn.ghost { color: #fff; background: rgba(255,255,255,.14); box-shadow: inset 0 0 0 2px rgba(255,255,255,.35); text-shadow: 0 2px 0 rgba(0,0,0,.3); }
.btn.share { color: #fff; background: linear-gradient(180deg, #ff9ad0 0%, #ff5fa2 50%, #e0347f 100%); box-shadow: 0 calc(var(--u) * .7) 0 #9a1a55, 0 calc(var(--u) * 1.2) calc(var(--u) * 1.6) rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.5); text-shadow: 0 2px 0 rgba(0,0,0,.2); }
.btn.danger { color: #fff; background: #a83232; box-shadow: none; font-size: calc(var(--u) * 2.2); min-height: 0; padding: 6px 14px; margin-top: 8px; }
.btn.locked { filter: grayscale(.8) brightness(.7); }

/* ---------- panels ---------- */
.panel {
  background: linear-gradient(180deg, rgba(36,74,48,.96), rgba(18,44,30,.97));
  border: 3px solid rgba(182,245,107,.45); border-radius: calc(var(--u) * 3);
  padding: calc(var(--u) * 3) calc(var(--u) * 4); min-width: min(88vw, calc(var(--u) * 56));
  display: flex; flex-direction: column; gap: calc(var(--u) * 1.6); align-items: stretch;
  box-shadow: 0 20px 60px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.15);
  animation: pop .35s cubic-bezier(.2,1.5,.4,1) both;
  max-height: calc(100vh - var(--sat) - var(--sab) - 20px); overflow-y: auto;
}
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
.panel h1, .panel h2 { margin: 0; text-align: center; color: #fff; -webkit-text-stroke: calc(var(--u) * .35) var(--ink); paint-order: stroke fill; }
h1 { font-size: calc(var(--u) * 6.5); }
h2 { font-size: calc(var(--u) * 4.5); }
.panel.card { text-align: center; max-width: calc(var(--u) * 70); align-items: center; }
.panel.card p { font-size: calc(var(--u) * 2.8); line-height: 1.35; margin: 0; color: #eaffd6; }
.cake { font-size: calc(var(--u) * 9); animation: bob 1.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-8px) rotate(4deg); } }
.pause-info { text-align: center; font-size: calc(var(--u) * 2.6); color: #cfeeb0; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; padding: calc(var(--sat) + 8px) calc(var(--sar) + 14px) 0 calc(var(--sal) + 14px); display: flex; justify-content: space-between; align-items: flex-start; }
.hud-left, .hud-right, .hud-center { display: flex; align-items: center; gap: 8px; }
.hud-left { flex-wrap: wrap; max-width: calc(50% - 72px); align-content: flex-start; row-gap: 4px; } /* power pills wrap under the hearts instead of running into the candles */
.hud-center { flex-direction: column; gap: 2px; position: absolute; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + 6px); }
#hearts { display: flex; gap: 4px; }
.pet-hud { display: flex; align-items: center; gap: 6px; margin-top: 4px; background: rgba(0,0,0,.38); border-radius: 999px; padding: 2px 10px 2px 4px; width: max-content; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.pet-hud.hidden { display: none; }
.pet-hud .pi { font-size: calc(var(--u) * 3); line-height: 1; }
.pet-hud .pbar { width: calc(var(--u) * 9); height: calc(var(--u) * 1.1); border-radius: 999px; background: rgba(0,0,0,.4); overflow: hidden; }
.pet-hud .pbar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #7fffb0, #ffe066); transition: width .25s; }
.pet-hud.max .pbar i { background: linear-gradient(90deg, #ff6fae, #ffe066, #6fe3ff); }
.pet-hud.bump { animation: pflash .6s; }
.heart { width: calc(var(--u) * 5.2); height: calc(var(--u) * 5.2); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 29 C6 21 1 15 1 9.5 C1 5 4.5 2 8.5 2 C11.5 2 14 3.8 16 6.5 C18 3.8 20.5 2 23.5 2 C27.5 2 31 5 31 9.5 C31 15 26 21 16 29Z' fill='%23ff3d6e' stroke='%23400a1a' stroke-width='2.2'/%3E%3Cellipse cx='9.5' cy='9' rx='3.5' ry='2.4' fill='%23ffb3c6'/%3E%3C/svg%3E") center/contain no-repeat; filter: drop-shadow(0 2px 0 rgba(0,0,0,.4)); transition: transform .2s; }
.heart.empty { filter: grayscale(1) brightness(.45) drop-shadow(0 2px 0 rgba(0,0,0,.4)); transform: scale(.85); }
.heart.bump { animation: hbump .4s; }
@keyframes hbump { 40% { transform: scale(1.35); } }
#power { display: flex; gap: 6px; }
.power { padding: 2px 10px; border-radius: 999px; font-family: 'Lilita One'; font-size: calc(var(--u) * 2.2); background: rgba(0,0,0,.45); }
.power.shield { background: linear-gradient(90deg, #2f9bff, #6fe3ff); }
.power.star { background: linear-gradient(90deg, #ffb31a, #ff5fa2, #7b4dff); }
.power.magnet { background: linear-gradient(90deg, #c04fff, #ff6fd8); }
.power.ninja { background: linear-gradient(90deg, #1a2a6a, #2f6fff); }
.power.hoops { background: linear-gradient(90deg, #ff6a1a, #ffb03a); }
.power.drone { background: linear-gradient(90deg, #2b3038, #5a8a1a); box-shadow: 0 0 0 2px #a6f03a inset; }
#candles { display: flex; gap: 6px; }
.candle-ico { width: calc(var(--u) * 3.6); height: calc(var(--u) * 5.4); background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 36'%3E%3Cpath d='M12 1 C15 6 16 9 12 13 C8 9 9 6 12 1Z' fill='%23ffd23f' stroke='%23a35a00' stroke-width='1.2'/%3E%3Crect x='6' y='14' width='12' height='20' rx='3' fill='%23fff7ef' stroke='%2312231a' stroke-width='1.6'/%3E%3Cpath d='M6 19 L18 15 M6 25 L18 21 M6 31 L18 27' stroke='%23ff5fa2' stroke-width='2.4'/%3E%3C/svg%3E") center/contain no-repeat; opacity: .38; filter: grayscale(.6) drop-shadow(0 2px 0 rgba(0,0,0,.4)); transition: filter .3s, transform .3s, opacity .3s; }
.candle-ico.lit { opacity: 1; filter: drop-shadow(0 0 6px #ffd23f) drop-shadow(0 2px 0 rgba(0,0,0,.4)); }
.candle-ico.pop { animation: cpop .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes cpop { 0% { transform: scale(2.2) rotate(-20deg); } 100% { transform: scale(1); } }
#timer { font-size: calc(var(--u) * 2.6); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.5); background: rgba(0,0,0,.25); padding: 0 10px; border-radius: 999px; }
.pill { display: flex; align-items: center; gap: 4px; background: rgba(0,0,0,.42); padding: 3px 12px 3px 6px; border-radius: 999px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.18); }
.pill b { font-size: calc(var(--u) * 3.2); min-width: 1.5em; text-align: right; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
.pill.flash { animation: pflash .5s; }
@keyframes pflash { 30% { background: #e0322b; transform: scale(1.12); } }
.ico { display: inline-block; width: calc(var(--u) * 3.6); height: calc(var(--u) * 3.6); background-size: contain; background-repeat: no-repeat; background-position: center; }
.ico.gem { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M16 2 L27 11 L16 30 L5 11 Z' fill='%2335e08a' stroke='%23084a2a' stroke-width='2'/%3E%3Cpath d='M5 11 H27 L16 2Z' fill='%23a6ffd0'/%3E%3Cpath d='M16 11 L16 30 L27 11Z' fill='%2320b86a'/%3E%3C/svg%3E"); }
.ico.wood { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Crect x='3' y='6' width='26' height='9' rx='2' fill='%23e8b46e' stroke='%235a3410' stroke-width='2'/%3E%3Crect x='3' y='17' width='26' height='9' rx='2' fill='%23c98d4a' stroke='%235a3410' stroke-width='2'/%3E%3Ccircle cx='7' cy='10.5' r='1.4' fill='%235a3410'/%3E%3Ccircle cx='25' cy='21.5' r='1.4' fill='%235a3410'/%3E%3C/svg%3E"); }
.ico.candle { width: calc(var(--u) * 2.6); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 36'%3E%3Cpath d='M12 1 C15 6 16 9 12 13 C8 9 9 6 12 1Z' fill='%23ffd23f'/%3E%3Crect x='6' y='14' width='12' height='20' rx='3' fill='%23fff7ef'/%3E%3Cpath d='M6 19 L18 15 M6 25 L18 21 M6 31 L18 27' stroke='%23ff5fa2' stroke-width='2.4'/%3E%3C/svg%3E"); }
.icon-btn { pointer-events: auto; width: calc(var(--u) * 6.4); height: calc(var(--u) * 6.4); border-radius: 50%; background: rgba(0,0,0,.42); box-shadow: inset 0 0 0 2px rgba(255,255,255,.3); display: flex; align-items: center; justify-content: center; gap: 5px; }
.icon-btn span { width: 5px; height: 40%; background: #fff; border-radius: 3px; }

#hint { position: fixed; top: calc(var(--sat) + var(--u) * 10); left: 50%; transform: translateX(-50%); pointer-events: none; z-index: 5; max-width: 80vw; }
#hint span { display: block; padding: calc(var(--u) * 1.2) calc(var(--u) * 3); background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(230,255,214,.96)); color: #1a3a12; border-radius: 999px; font-size: calc(var(--u) * 3); box-shadow: 0 6px 0 rgba(0,0,0,.25), 0 10px 30px rgba(0,0,0,.25); text-align: center; animation: hintIn .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes hintIn { from { transform: translateY(-20px) scale(.8); opacity: 0; } }
#toast { position: fixed; top: 34%; left: 50%; transform: translate(-50%, -50%); font-size: calc(var(--u) * 7); color: #fff; -webkit-text-stroke: calc(var(--u) * .5) var(--ink); paint-order: stroke fill; pointer-events: none; white-space: nowrap; text-shadow: 0 6px 0 rgba(0,0,0,.3); z-index: 6; }
#toast.show { animation: toast 1.6s cubic-bezier(.2,1.5,.4,1) both; }
#toast.gold { color: var(--gold); }
#toast.pink { color: #ff9ad0; }
@keyframes toast { 0% { transform: translate(-50%, -50%) scale(.3) rotate(-8deg); opacity: 0; } 15% { transform: translate(-50%, -50%) scale(1.15) rotate(-3deg); opacity: 1; } 25% { transform: translate(-50%, -50%) scale(1) rotate(-3deg); } 80% { opacity: 1; } 100% { transform: translate(-50%, -70%) scale(1) rotate(-3deg); opacity: 0; } }
#floaters { position: fixed; inset: 0; pointer-events: none; z-index: 4; }
.floater { position: absolute; font-size: calc(var(--u) * 3.2); color: #fff; -webkit-text-stroke: calc(var(--u) * .3) var(--ink); paint-order: stroke fill; animation: floatUp .9s ease-out forwards; white-space: nowrap; transform: translate(-50%, -50%); }
.floater.green { color: #8dffb8; } .floater.gold { color: var(--gold); } .floater.wood { color: #ffd39a; } .floater.pink { color: #ff9ad0; } .floater.blue { color: #9fe8ff; }
@keyframes floatUp { 0% { opacity: 0; margin-top: 0; transform: translate(-50%, -50%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 100% { opacity: 0; margin-top: -60px; transform: translate(-50%, -50%) scale(1); } }

/* ---------- touch controls ---------- */
#controls { position: fixed; inset: 0; pointer-events: none; z-index: 3; }
#joyzone { position: absolute; left: 0; top: 18%; bottom: 0; width: 48%; pointer-events: auto; touch-action: none; }
#joybase { position: absolute; left: 0; top: 0; width: calc(var(--u) * 15); height: calc(var(--u) * 15); margin: calc(var(--u) * -7.5) 0 0 calc(var(--u) * -7.5); border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.08), rgba(255,255,255,.16)); box-shadow: inset 0 0 0 3px rgba(255,255,255,.35); pointer-events: none; opacity: .55; transition: opacity .15s; }
#joybase.active { opacity: 1; }
#joyknob { position: absolute; left: 50%; top: 50%; width: 46%; height: 46%; margin: -23% 0 0 -23%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #d6f5c0 60%, #9fd38a); box-shadow: 0 4px 10px rgba(0,0,0,.35); }
.btns { position: absolute; right: calc(var(--sar) + var(--u) * 3); bottom: calc(var(--sab) + var(--u) * 3); width: calc(var(--u) * 36); height: calc(var(--u) * 33); pointer-events: none; }
.cbtn { position: absolute; pointer-events: auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; touch-action: none; transition: transform .06s; box-shadow: 0 calc(var(--u) * .7) 0 rgba(0,0,0,.35), inset 0 3px 0 rgba(255,255,255,.4), inset 0 0 0 3px rgba(255,255,255,.25); }
.cbtn svg { width: 56%; height: 56%; pointer-events: none; filter: drop-shadow(0 2px 0 rgba(0,0,0,.35)); }
.cbtn.down { transform: scale(.9); filter: brightness(1.2); }
.cbtn.jump { right: 0; bottom: 0; width: calc(var(--u) * 15.5); height: calc(var(--u) * 15.5); background: radial-gradient(circle at 40% 30%, #8cf27a, #34b04a 60%, #1f7a32); }
.cbtn.pick { right: calc(var(--u) * 17); bottom: calc(var(--u) * 1.5); width: calc(var(--u) * 12); height: calc(var(--u) * 12); background: radial-gradient(circle at 40% 30%, #6fd8ff, #1f8fe0 60%, #125ea8); }
.cbtn.build { right: calc(var(--u) * 2); bottom: calc(var(--u) * 17); width: calc(var(--u) * 11); height: calc(var(--u) * 11); background: radial-gradient(circle at 40% 30%, #ffd88a, #f0a030 60%, #b06a10); }
.cbtn.build b { position: absolute; right: -4px; top: -4px; font-family: 'Lilita One'; font-size: calc(var(--u) * 2.4); background: #12231a; color: #ffd39a; border-radius: 999px; padding: 0 7px; box-shadow: 0 0 0 2px #ffd39a; }
.cbtn.build.empty { filter: grayscale(.9) brightness(.7); }
.cbtn.emote { right: calc(var(--u) * 16); bottom: calc(var(--u) * 17); width: calc(var(--u) * 8); height: calc(var(--u) * 8); background: radial-gradient(circle at 40% 30%, #ff9ad0, #e0347f 60%, #9a1a55); }

/* ---------- level select ---------- */
.screen-head { position: absolute; top: calc(var(--sat) + 10px); left: calc(var(--sal) + 16px); right: calc(var(--sar) + 16px); display: flex; align-items: center; gap: 14px; }
.screen-head h2 { flex: 1; margin: 0; font-size: calc(var(--u) * 5); -webkit-text-stroke: calc(var(--u) * .35) var(--ink); paint-order: stroke fill; }
.btn.back { min-height: calc(var(--u) * 7); width: calc(var(--u) * 8); padding: 0; font-size: calc(var(--u) * 5); }
#levels, #locker { background: linear-gradient(180deg, rgba(6,24,16,.55), rgba(6,24,16,.8)); }
.level-list { display: flex; gap: calc(var(--u) * 2.4); overflow-x: auto; padding: calc(var(--u) * 3) calc(var(--u) * 4); width: 100%; margin-top: calc(var(--u) * 6); scroll-snap-type: x mandatory; touch-action: pan-x; -webkit-overflow-scrolling: touch; }
.level-card { scroll-snap-align: center; flex: 0 0 calc(var(--u) * 34); height: calc(var(--u) * 46); border-radius: calc(var(--u) * 2.4); position: relative; overflow: hidden; box-shadow: 0 calc(var(--u) * 1) 0 rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.35); transform: skewX(-3deg); display: flex; flex-direction: column; justify-content: flex-end; padding: calc(var(--u) * 2); text-align: left; border: 3px solid rgba(255,255,255,.35); transition: transform .1s; }
.level-card:active { transform: skewX(-3deg) scale(.97); }
.level-card .num { position: absolute; top: calc(var(--u) * 1.4); left: calc(var(--u) * 2); font-family: 'Lilita One'; font-size: calc(var(--u) * 7); color: rgba(255,255,255,.9); -webkit-text-stroke: calc(var(--u) * .3) var(--ink); paint-order: stroke fill; }
.level-card .name { font-family: 'Lilita One'; font-size: calc(var(--u) * 4); line-height: 1; -webkit-text-stroke: calc(var(--u) * .3) var(--ink); paint-order: stroke fill; }
.level-card .sub { font-size: calc(var(--u) * 2.2); opacity: .92; margin-top: 4px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.level-card .meta { display: flex; justify-content: space-between; align-items: center; margin-top: calc(var(--u) * 1.4); font-family: 'Lilita One'; font-size: calc(var(--u) * 2.6); }
.level-card .cs { display: flex; gap: 3px; }
.level-card .cs i { width: calc(var(--u) * 2.6); height: calc(var(--u) * 3.9); }
.level-card.locked { filter: grayscale(.85) brightness(.55); }
.level-card.locked::after { content: '🔒'; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: calc(var(--u) * 10); }
.lv-forest { background: linear-gradient(160deg, #a8e06a 0%, #3f9a3a 45%, #1d5a2a 100%); }
.lv-canyon { background: linear-gradient(160deg, #8fe0c8 0%, #2f8a6a 45%, #164a3a 100%); }
.lv-cave { background: linear-gradient(160deg, #5fe8ff 0%, #2a4a8a 45%, #141a3a 100%); }
.lv-canopy { background: linear-gradient(160deg, #fff2a8 0%, #6fc84a 45%, #2a6a3a 100%); }
.lv-party { background: linear-gradient(160deg, #ffd29a 0%, #ff6fae 45%, #5a3a8a 100%); }
.level-card .deco { position: absolute; right: -10%; top: 8%; font-size: calc(var(--u) * 14); opacity: .35; transform: rotate(12deg); }

/* ---------- results ---------- */
.results { align-items: center; }
.res-candles { display: flex; gap: calc(var(--u) * 2.4); justify-content: center; margin: calc(var(--u) * .5) 0; }
.res-candles .candle-ico { width: calc(var(--u) * 7); height: calc(var(--u) * 10.5); }
.res-stats { display: flex; gap: calc(var(--u) * 4); justify-content: center; }
.res-stats div { display: flex; flex-direction: column; align-items: center; }
.res-stats span { font-size: calc(var(--u) * 2.2); color: #b6f56b; letter-spacing: .1em; }
.res-stats b { font-size: calc(var(--u) * 5); color: #fff; }
.res-stats em { font-style: normal; font-size: calc(var(--u) * 2); color: #cfeeb0; }
.res-badge { align-self: center; background: linear-gradient(90deg, #ff5fa2, #ffb31a); padding: 6px 18px; border-radius: 999px; font-family: 'Lilita One'; font-size: calc(var(--u) * 3); transform: rotate(-3deg); animation: pulse 1s infinite; }
.results .row { width: 100%; }

/* ---------- locker ---------- */
.locker-body { position: absolute; right: calc(var(--sar) + 16px); top: calc(var(--sat) + var(--u) * 11); bottom: calc(var(--sab) + 12px); width: min(56vw, calc(var(--u) * 70)); display: flex; flex-direction: column; gap: 10px; }
#locker { background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(6,24,16,.25) 35%, rgba(6,24,16,.85) 55%); }
.locker-tabs { display: flex; gap: 8px; }
.tab { font-family: 'Lilita One'; font-size: calc(var(--u) * 2.8); padding: 6px 16px; border-radius: 12px; background: rgba(255,255,255,.12); transform: skewX(-6deg); }
.tab.active { background: var(--gold); color: #2a1600; }
.locker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(calc(var(--u) * 16), 1fr)); gap: 10px; overflow-y: auto; padding: 4px 4px 20px; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.item { position: relative; border-radius: 14px; padding: 10px 8px 8px; min-height: calc(var(--u) * 18); display: flex; flex-direction: column; align-items: center; justify-content: flex-end; text-align: center; font-family: 'Lilita One'; font-size: calc(var(--u) * 2.2); border: 3px solid transparent; box-shadow: 0 4px 0 rgba(0,0,0,.35); overflow: hidden; }
.item .sw { width: 70%; aspect-ratio: 1; border-radius: 50%; margin-bottom: 6px; box-shadow: inset 0 -6px 0 rgba(0,0,0,.2), 0 3px 0 rgba(0,0,0,.25); border: 3px solid rgba(255,255,255,.6); }
.item .price { position: absolute; top: 6px; right: 6px; display: flex; align-items: center; gap: 2px; background: rgba(0,0,0,.5); border-radius: 999px; padding: 0 6px; font-size: calc(var(--u) * 2); }
.item .price .ico { width: calc(var(--u) * 2.2); height: calc(var(--u) * 2.2); }
.item.equipped { border-color: #fff; box-shadow: 0 0 0 3px var(--gold), 0 4px 0 rgba(0,0,0,.35); }
.item .pet-ico { width: 70%; aspect-ratio: 1; border-radius: 50%; margin-bottom: 4px; display: flex; align-items: center; justify-content: center; font-size: calc(var(--u) * 6.5); background: radial-gradient(circle at 50% 40%, rgba(255,255,255,.55), rgba(255,255,255,.12)); border: 3px solid rgba(255,255,255,.6); box-shadow: inset 0 -6px 0 rgba(0,0,0,.15), 0 3px 0 rgba(0,0,0,.25); }
.item .pet-ico.unknown { filter: grayscale(1) brightness(.35); }
.item .pet-stage { font-size: .72em; opacity: .9; }
.item .pet-how { font-size: .62em; line-height: 1.1; opacity: .9; font-family: 'Nunito', sans-serif; font-weight: 800; }
.item .xpbar { width: 86%; height: 7px; border-radius: 4px; background: rgba(0,0,0,.3); margin-top: 4px; overflow: hidden; }
.item .xpbar i { display: block; height: 100%; background: linear-gradient(90deg, #7fffb0, #ffe066); }
.item .rename { position: absolute; top: 6px; left: 6px; width: calc(var(--u) * 4); height: calc(var(--u) * 4); border-radius: 50%; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; font-size: calc(var(--u) * 2.2); }
.res-pet { margin: 4px auto 6px; padding: 4px 14px; border-radius: 999px; background: rgba(0,0,0,.28); font-family: 'Lilita One'; font-size: calc(var(--u) * 2.6); color: #fff; display: inline-block; }
.res-pet b { color: #7fffb0; }
.res-pet em { color: #ffe066; font-style: normal; }
.item.locked::after { content: '🔒'; position: absolute; left: 8px; top: 6px; font-size: calc(var(--u) * 2.4); }
.r-common { background: linear-gradient(180deg, #9aa7b0, #5a6670); }
.r-uncommon { background: linear-gradient(180deg, #6fd86a, #2a8a2a); }
.r-rare { background: linear-gradient(180deg, #5fc8ff, #1a6ad0); }
.r-epic { background: linear-gradient(180deg, #c78bff, #6a2ad0); }
.r-legendary { background: linear-gradient(180deg, #ffcf5a, #e07a10); }

/* ---------- settings ---------- */
.toggle { display: flex; align-items: center; justify-content: space-between; font-size: calc(var(--u) * 3); padding: 4px 0; }
.toggle input { display: none; }
.toggle i { width: calc(var(--u) * 9); height: calc(var(--u) * 4.8); border-radius: 999px; background: rgba(255,255,255,.2); position: relative; transition: background .2s; }
.toggle i::after { content: ''; position: absolute; top: 4px; left: 4px; width: calc(var(--u) * 4.8 - 8px); height: calc(var(--u) * 4.8 - 8px); border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + i { background: var(--leaf); }
.toggle input:checked + i::after { transform: translateX(calc(var(--u) * 4.2)); }
.seg { display: flex; flex-direction: column; gap: 6px; font-size: calc(var(--u) * 3); }
.seg > div { display: flex; gap: 6px; }
.seg button { flex: 1; font-family: 'Lilita One'; font-size: calc(var(--u) * 2.4); padding: 8px 4px; border-radius: 10px; background: rgba(255,255,255,.14); }
.seg button.on { background: var(--gold); color: #2a1600; }

/* ---------- misc ---------- */
#rotate { position: fixed; inset: 0; z-index: 50; background: radial-gradient(circle at center, #1d5a2a, #0a1f14); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; font-family: 'Lilita One'; font-size: 6vw; gap: 20px; }
#rotate .phone { width: 22vw; height: 38vw; border: 1.6vw solid #fff; border-radius: 4vw; animation: rot 2s ease-in-out infinite; }
@keyframes rot { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
#iosTip { position: fixed; bottom: calc(var(--sab) + 10px); left: 50%; transform: translateX(-50%); background: rgba(255,255,255,.95); color: #1a3a12; padding: 10px 40px 10px 16px; border-radius: 14px; font-size: 14px; z-index: 40; box-shadow: 0 6px 20px rgba(0,0,0,.3); }
#iosTip button { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); color: #1a3a12; font-size: 16px; }
#loading { position: fixed; inset: 0; z-index: 60; background: radial-gradient(circle at 50% 40%, #2a6a3a, #0a1f14 70%); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; transition: opacity .5s; }
#loading.done { opacity: 0; pointer-events: none; }
.load-logo { font-size: 12vmin; background: linear-gradient(180deg, #fff6a8, #ffd23f 40%, #ff8a1f); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-stroke: 1.2vmin #12231a; paint-order: stroke fill; transform: rotate(-3deg); }
.load-bar { width: 40vmin; height: 2.4vmin; border-radius: 999px; background: rgba(255,255,255,.15); overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 10%; background: linear-gradient(90deg, #8cf27a, #ffd23f); border-radius: 999px; transition: width .3s; }
.load-tip { font-size: 3.4vmin; color: #cfeeb0; }

/* compact title once the menu is visible (short landscape phones) */
#title.started .logo { transform: rotate(-3deg) scale(.72); margin: calc(var(--u) * -4) 0 calc(var(--u) * -4); }
#title.started .badge-bday { margin-top: 0; font-size: calc(var(--u) * 2); }
.btn.pets { color: #fff; background: linear-gradient(180deg, #ffc2e2 0%, #ff6fae 50%, #e0408a 100%); box-shadow: 0 calc(var(--u) * .7) 0 #a0245e, 0 calc(var(--u) * 1.2) calc(var(--u) * 1.6) rgba(0,0,0,.35), inset 0 2px 0 rgba(255,255,255,.5); text-shadow: 0 2px 0 rgba(0,0,0,.25); }
.btn.pets:active { box-shadow: 0 calc(var(--u) * .2) 0 #a0245e, inset 0 2px 0 rgba(255,255,255,.5); }
#title.started .menu { margin-top: calc(var(--u) * 1.4); }
#title.started .title-gems { margin-top: calc(var(--u) * 1.2); font-size: calc(var(--u) * 2.4); }
#hint { top: calc(var(--sat) + var(--u) * 12); }
#hint span { font-size: calc(var(--u) * 2.5); padding: calc(var(--u) * .9) calc(var(--u) * 2.4); }

/* boss */
#bossbar { position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--sat) + var(--u) * 11); z-index: 5; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; animation: hintIn .5s cubic-bezier(.2,1.6,.4,1); }
#bossbar .bname { font-family: 'Lilita One'; font-size: calc(var(--u) * 3); color: #ffd6ea; -webkit-text-stroke: calc(var(--u) * .3) #3a0f24; paint-order: stroke fill; letter-spacing: .06em; }
#bossbar .bhp { display: flex; gap: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(40,8,24,.6); box-shadow: inset 0 0 0 2px rgba(255,160,200,.5); }
#bossbar .bhp i { width: calc(var(--u) * 7); height: calc(var(--u) * 1.8); border-radius: 999px; background: linear-gradient(90deg, #ff5fa2, #ffb3d6); box-shadow: 0 0 8px #ff5fa2; transition: all .3s; }
#bossbar .bhp i.gone { background: rgba(255,255,255,.15); box-shadow: none; }
#speech { position: fixed; z-index: 6; transform: translate(-50%, -100%); pointer-events: none; max-width: 46vw; padding: calc(var(--u) * 1) calc(var(--u) * 2); background: #fff; color: #3a0f24; border-radius: 18px; font-family: 'Lilita One'; font-size: calc(var(--u) * 2.6); text-align: center; box-shadow: 0 5px 0 rgba(0,0,0,.25); }
#speech::after { content: ''; position: absolute; left: 50%; bottom: -12px; margin-left: -10px; border: 10px solid transparent; border-top-color: #fff; border-bottom: 0; }
#party { position: fixed; inset: 0; z-index: 7; display: flex; flex-direction: column; align-items: center; padding-top: calc(var(--u) * 3); pointer-events: auto; text-align: center; }
#party.hidden { display: none; }
#party .party-title { font-family: 'Lilita One'; font-size: calc(var(--u) * 7.2); line-height: 1.02; color: #fff; -webkit-text-stroke: calc(var(--u) * .55) #5a1840; paint-order: stroke fill; text-shadow: 0 7px 0 rgba(0,0,0,.28); }
#party .party-title span, #party .party-title b { display: inline-block; animation: partyIn .8s cubic-bezier(.2,1.6,.4,1) both, partyBob 1.4s ease-in-out infinite; }
#party .party-title span:nth-child(1) { color: #ffd23f; animation-delay: .1s, .9s; }
#party .party-title span:nth-child(2) { color: #ff6fae; animation-delay: .25s, 1.05s; }
#party .party-title span:nth-child(3) { color: #6fe3ff; animation-delay: .4s, 1.2s; }
#party .party-title b { font-size: 1.45em; color: #ffe066; background: linear-gradient(90deg, #ff6fae, #ffd23f, #6fe3a0, #6fb8ff, #c58bff); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; -webkit-text-stroke: 0; filter: drop-shadow(0 5px 0 #5a1840) drop-shadow(0 0 2px #5a1840); animation-delay: .7s, 1.5s; }
#party .party-sub { margin-top: calc(var(--u) * 1); font-family: 'Lilita One'; font-size: calc(var(--u) * 2.6); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.45); animation: partyIn .8s 1.2s both; }
#party .party-tap { position: absolute; bottom: calc(var(--u) * 3); font-family: 'Lilita One'; font-size: calc(var(--u) * 2.2); color: #fff; opacity: 0; animation: tapIn .6s 3s forwards, partyBob 1.2s 3.6s ease-in-out infinite; text-shadow: 0 2px 0 rgba(0,0,0,.5); }
@keyframes partyIn { from { transform: scale(0) rotate(-12deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes partyBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(var(--u) * -.6)); } }
@keyframes tapIn { to { opacity: .9; } }
#speech .who { display: block; font-size: .62em; letter-spacing: .08em; color: #d81b72; text-transform: uppercase; margin-bottom: 1px; }
#speech.pop { animation: hintIn .4s cubic-bezier(.2,1.6,.4,1); }
/* keep the play area clear: dance button lives under the pause button */
.cbtn.emote { position: fixed; top: calc(var(--sat) + var(--u) * 9.5); right: calc(var(--sar) + var(--u) * 2.4); bottom: auto; width: calc(var(--u) * 6.4); height: calc(var(--u) * 6.4); }
.cbtn { opacity: .92; }
.item .rename::before { content: ''; position: absolute; inset: -10px; } /* bigger thumb target */

/* results: buttons in their own column on short landscape phones, so NEXT is never cut off */
.res-actions { display: flex; flex-direction: column; gap: calc(var(--u) * 1.4); }
@media (max-height: 460px) and (orientation: landscape) {
  .panel.results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(calc(var(--u) * 24), auto); column-gap: calc(var(--u) * 3); row-gap: calc(var(--u) * .8); align-items: center; padding: calc(var(--u) * 2) calc(var(--u) * 3); }
  .panel.results > :not(.res-actions) { grid-column: 1; }
  .panel.results > .res-actions { grid-column: 2; grid-row: 1 / span 6; align-self: center; }
  .panel.results .res-actions .row { flex-direction: column; }
  .panel.results h1 { font-size: calc(var(--u) * 5.2); }
  .res-candles .candle-ico { width: calc(var(--u) * 5.6); height: calc(var(--u) * 8.4); }
}

/* Uncle Dorian's treasure map card + compass */
.map-card { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(10,20,12,.55); z-index: 45; pointer-events: auto; } /* above the touch controls */
.map-paper { position: relative; width: min(86vw, 640px); transform: rotate(-2deg); animation: pop .4s cubic-bezier(.2,1.5,.4,1) both; filter: drop-shadow(0 14px 30px rgba(0,0,0,.55)); }
.map-paper canvas { width: 100%; height: auto; display: block; border-radius: 6px 14px 8px 18px; clip-path: polygon(0 3%, 6% 0, 30% 2%, 55% 0, 80% 2%, 100% 0, 99% 30%, 100% 62%, 98% 100%, 70% 98%, 45% 100%, 20% 97%, 0 100%, 2% 60%); }
.map-tap { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: -14px; font-family: 'Lilita One'; font-size: calc(var(--u) * 2.8); color: #fff; background: #d01818; padding: 4px 16px; border-radius: 999px; white-space: nowrap; animation: pulse 1s infinite; }
.treasure-hud { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 12px 3px 8px; border-radius: 999px; background: linear-gradient(90deg, #7a4a24, #c9a066); box-shadow: 0 0 0 2px #ffd84a inset; font-family: 'Lilita One'; font-size: calc(var(--u) * 2.6); color: #fff; }
.treasure-hud i { display: inline-block; font-style: normal; color: #ff3d3d; text-shadow: 0 0 4px #fff; transition: transform .15s; }
.heart.bracelet { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cdefs%3E%3ClinearGradient id='r' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23ff4f7b'/%3E%3Cstop offset='.35' stop-color='%23ffd23f'/%3E%3Cstop offset='.65' stop-color='%234fc3ff'/%3E%3Cstop offset='1' stop-color='%239b6bff'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M16 29 C6 21 1 15 1 9.5 C1 5 4.5 2 8.5 2 C11.5 2 14 3.8 16 6.5 C18 3.8 20.5 2 23.5 2 C27.5 2 31 5 31 9.5 C31 15 26 21 16 29Z' fill='url(%23r)' stroke='%23400a1a' stroke-width='2.2'/%3E%3Cellipse cx='9.5' cy='9' rx='3.5' ry='2.4' fill='%23fff' opacity='.6'/%3E%3C/svg%3E"); } /* Mom's bracelet heart */

/* boss fights: the how-to-win tip sits under the boss name + HP bar */
body.bossfight #hint { top: calc(var(--sat) + var(--u) * 19); }
body.bossfight #toast { top: calc(var(--sat) + var(--u) * 30); } /* below the boss title + HP bar */
/* short landscape phones: the intro card and settings fit without scrolling */
@media (max-height: 460px) and (orientation: landscape) {
  #intro .panel.card { max-width: calc(var(--u) * 110); gap: calc(var(--u) * 1); padding: calc(var(--u) * 2) calc(var(--u) * 4); }
  #intro .cake { font-size: calc(var(--u) * 5); line-height: 1; }
  #intro h1 { font-size: calc(var(--u) * 5); }
  #intro .panel.card p { font-size: calc(var(--u) * 2.5); }
  #settings .panel { display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(var(--u) * 3); row-gap: calc(var(--u) * 1); align-items: center; padding: calc(var(--u) * 2) calc(var(--u) * 3); }
  #settings .panel h2 { grid-column: 1 / -1; }
  #settings .panel .seg { grid-column: 1 / -1; }
}
