@font-face { font-family: 'Bungee'; src: url(bungee.woff2) format('woff2'); font-display: swap; }
:root {
  --ink: #2b2233; --cream: #fff6e0; --sun: #ffcf3f; --sun2: #f5a623; --grass: #7cc456; --grass2: #4f9a3a;
  --tomato: #ff5a4e; --sky: #8fd3f5; --panel: #fff6e0; --shadow: rgba(43, 34, 51, .35);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #7cc456; overscroll-behavior: none; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
#app { position: fixed; inset: 0; overflow: hidden; }
#cv { position: absolute; inset: 0; display: block; touch-action: none; }
#vig { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(20, 10, 40, .28) 100%); }
#flash { position: absolute; inset: 0; pointer-events: none; background: #fff; opacity: 0; transition: opacity .25s; }
#flash.on { opacity: .55; transition: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
[hidden] { display: none !important; }

.coin { display: inline-block; width: 1em; height: 1em; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff3b0 0 18%, #ffd23f 20% 55%, #f0a020 57%); box-shadow: inset 0 0 0 .09em #c77c0e; vertical-align: -.14em; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; font-family: 'Bungee', system-ui, sans-serif; }
#hScoreBox { position: absolute; left: calc(14px + var(--safe-l)); top: calc(10px + var(--safe-t)); }
#hScore { font-size: clamp(40px, 9vmin, 64px); line-height: 1; color: #fff; text-shadow: 0 3px 0 var(--ink), 3px 3px 0 var(--ink), -2px 3px 0 var(--ink), 0 -2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 6px 10px rgba(0,0,0,.25); transition: transform .08s; }
#hScore.pop { transform: scale(1.12); }
#hBest { font-size: 13px; color: #fff; text-shadow: 0 2px 0 var(--ink), 1px 1px 0 var(--ink), -1px 1px 0 var(--ink); margin-top: 4px; letter-spacing: .04em; }
#hRight { position: absolute; right: calc(12px + var(--safe-r)); top: calc(12px + var(--safe-t)); display: flex; gap: 10px; align-items: center; pointer-events: auto; }
#hCoins { background: var(--ink); color: #fff; border-radius: 999px; padding: 6px 14px 6px 8px; font-size: 18px; display: flex; gap: 8px; align-items: center; box-shadow: 0 3px 0 rgba(0,0,0,.25); }
#hCoins.pop { animation: cpop .3s; }
@keyframes cpop { 40% { transform: scale(1.18); } }
#hCoins .coin { font-size: 22px; }
.iconbtn { width: 46px; height: 46px; border-radius: 14px; background: var(--cream); box-shadow: 0 4px 0 var(--ink), inset 0 0 0 3px var(--ink); display: grid; place-items: center; }
.iconbtn svg { width: 22px; height: 22px; fill: var(--ink); stroke: var(--ink); }
.iconbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink), inset 0 0 0 3px var(--ink); }
#hDaily { position: absolute; left: calc(14px + var(--safe-l)); top: calc(96px + var(--safe-t)); background: var(--tomato); color: #fff; font-size: 12px; padding: 3px 8px; border-radius: 6px; box-shadow: 0 2px 0 var(--ink); }
#eagleWarn { position: absolute; left: 50%; top: calc(16px + var(--safe-t)); transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; opacity: 0; transition: opacity .2s; color: #fff; font-size: 14px; text-shadow: 0 2px 0 var(--ink); }
#eagleWarn svg { width: 54px; height: 32px; fill: var(--tomato); stroke: var(--ink); stroke-width: 2; filter: drop-shadow(0 2px 0 var(--ink)); }
#eagleWarn.on { animation: wpulse .5s infinite alternate; }
@keyframes wpulse { from { transform: translateX(-50%) scale(1); } to { transform: translateX(-50%) scale(1.12); } }
#hint { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); color: #fff; font-size: 15px; text-shadow: 0 2px 0 var(--ink), 1px 1px 0 var(--ink); white-space: nowrap; transition: opacity .5s; animation: hintb 1.2s infinite alternate ease-in-out; }
@keyframes hintb { to { transform: translateX(-50%) translateY(-6px); } }
#hint.gone { opacity: 0; }

#banner { position: absolute; left: 50%; top: 24%; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none; text-align: center; font-family: 'Bungee', system-ui; color: #fff; text-shadow: 0 3px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink); }
#banner small { display: block; font-size: 14px; letter-spacing: .1em; }
#banner b { display: block; font-size: clamp(30px, 8vmin, 54px); font-weight: 400; white-space: nowrap; }
#banner.on { animation: bannerIn 2.6s forwards; }
@keyframes bannerIn { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 20% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }
#toast { position: absolute; left: 50%; bottom: calc(80px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 14px; font-weight: 700; font-size: 15px; opacity: 0; transition: .3s; pointer-events: none; white-space: nowrap; box-shadow: 0 4px 0 rgba(0,0,0,.3); }
#toast.on { opacity: 1; transform: translateX(-50%); }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); }
.screen.dim { background: rgba(30, 20, 46, .45); }
.panel { background: var(--panel); border-radius: 24px; box-shadow: 0 8px 0 var(--ink), inset 0 0 0 4px var(--ink), 0 18px 40px rgba(0,0,0,.3); padding: 22px 24px 24px; width: min(360px, 100%); display: flex; flex-direction: column; align-items: center; gap: 12px; animation: panelIn .28s cubic-bezier(.2,1.5,.4,1); }
@keyframes panelIn { from { transform: scale(.85) translateY(20px); opacity: 0; } }
.panel h2 { font-family: 'Bungee', system-ui; font-weight: 400; font-size: 34px; margin: 0; color: var(--ink); }
.row { display: flex; gap: 10px; width: 100%; justify-content: center; }
.row .btn { flex: 1; }
.btn { position: relative; font-family: 'Bungee', system-ui; font-size: 16px; background: #fff; color: var(--ink); padding: 12px 14px; border-radius: 14px; box-shadow: 0 5px 0 var(--ink), inset 0 0 0 3px var(--ink); display: inline-flex; align-items: center; justify-content: center; gap: 8px; flex-direction: row; white-space: nowrap; transition: transform .06s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink), inset 0 0 0 3px var(--ink); }
.btn small { display: block; font-family: system-ui; font-size: 11px; font-weight: 700; opacity: .7; }
.btn.big { font-size: 26px; padding: 14px 24px; width: 100%; border-radius: 18px; box-shadow: 0 7px 0 var(--ink), inset 0 0 0 4px var(--ink); }
.btn.big:active { transform: translateY(5px); box-shadow: 0 2px 0 var(--ink), inset 0 0 0 4px var(--ink); }
.btn.primary { background: linear-gradient(#ffe066, var(--sun) 55%, var(--sun2)); }
.btn.disabled { background: #ddd6c8; color: #7b7186; }
.badge { position: absolute; top: -8px; right: -6px; background: var(--tomato); color: #fff; width: 22px; height: 22px; border-radius: 50%; font-size: 13px; display: grid; place-items: center; box-shadow: 0 2px 0 var(--ink), inset 0 0 0 2px var(--ink); animation: wpulse2 .6s infinite alternate; }
@keyframes wpulse2 { to { transform: scale(1.15); } }
.toggles { display: flex; gap: 10px; justify-content: center; }
.tgl { width: 46px; height: 46px; border-radius: 50%; background: #fff; box-shadow: 0 4px 0 var(--ink), inset 0 0 0 3px var(--ink); display: grid; place-items: center; font-size: 22px; font-weight: 700; position: relative; }
.tgl svg { width: 22px; height: 22px; fill: var(--ink); stroke: var(--ink); }
.tgl.off { background: #d6cfc2; opacity: .85; }
.tgl.off::after { content: ''; position: absolute; width: 30px; height: 4px; background: var(--tomato); transform: rotate(-45deg); border-radius: 2px; box-shadow: 0 0 0 2px var(--ink); }
.gclink { font-size: 12px; color: #6b6176; text-decoration: none; margin-top: 2px; }
.gclink:hover { text-decoration: underline; }

/* ---------- title ---------- */
#title { justify-content: space-between; background: linear-gradient(rgba(255,255,255,.0), rgba(40, 20, 60, .0) 60%, rgba(30,15,45,.35)); cursor: pointer; }
.titleTop { text-align: center; margin-top: 2vh; animation: drop .6s cubic-bezier(.2,1.6,.4,1); }
@keyframes drop { from { transform: translateY(-60px); opacity: 0; } }
.logo { margin: 0; font-family: 'Bungee', system-ui; font-weight: 400; line-height: .88; display: flex; flex-direction: column; align-items: center; }
.logo span { display: block; color: #fff; -webkit-text-stroke: 0; }
.logo .l1 { font-size: clamp(56px, 15vmin, 120px); color: var(--cream); text-shadow: 0 2px 0 #e9d6b0, 0 4px 0 #d9bf8f, 0 6px 0 #c9a774, 0 8px 0 var(--ink), 4px 8px 0 var(--ink), -4px 8px 0 var(--ink), 4px 0 0 var(--ink), -4px 0 0 var(--ink), 0 -4px 0 var(--ink), 0 14px 18px rgba(0,0,0,.3); transform: rotate(-3deg); }
.logo .l2 { font-size: clamp(34px, 9vmin, 72px); color: var(--sun); text-shadow: 0 2px 0 #f0a52a, 0 4px 0 #d9861a, 0 6px 0 var(--ink), 3px 6px 0 var(--ink), -3px 6px 0 var(--ink), 3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 -3px 0 var(--ink), 0 12px 16px rgba(0,0,0,.3); transform: rotate(-3deg) translateX(4%); margin-top: 6px; }
.tag { margin: 18px 0 0; color: #fff; font-weight: 800; font-size: clamp(14px, 2.6vmin, 18px); text-shadow: 0 2px 0 var(--ink), 1px 1px 0 var(--ink), -1px 1px 0 var(--ink); }
.titleMid { width: min(340px, 100%); display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
#btnPlay { font-size: 34px; padding: 16px; animation: playPulse 1.4s infinite ease-in-out; }
@keyframes playPulse { 50% { transform: scale(1.04); } }
#btnPlay:active { animation: none; }
.btn.gift { background: linear-gradient(#b8f08c, #7cc456); animation: wpulse2 .8s infinite alternate; }
.btn .mini-goat { width: 18px; height: 16px; background: #fff; box-shadow: inset 0 0 0 2px var(--ink); border-radius: 3px; position: relative; }
.btn .mini-goat::before, .btn .mini-goat::after { content: ''; position: absolute; top: -5px; width: 3px; height: 6px; background: var(--ink); }
.btn .mini-goat::before { left: 3px; } .btn .mini-goat::after { right: 3px; }
.titleBot { display: flex; flex-direction: column; align-items: center; gap: 10px; width: 100%; }
.stats { display: flex; gap: 18px; font-family: 'Bungee', system-ui; color: #fff; font-size: 18px; text-shadow: 0 2px 0 var(--ink), 1px 1px 0 var(--ink), -1px 1px 0 var(--ink); }
.stats b { font-weight: 400; }
.keys { margin: 0; color: #fff; font-size: 12px; font-weight: 700; text-shadow: 0 1px 0 var(--ink), 1px 1px 0 var(--ink); text-align: center; opacity: .95; }
@media (pointer: coarse) { .keys { display: none; } }

/* landscape phones: put the menu beside the logo */
@media (orientation: landscape) and (max-height: 500px) {
  #title { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr auto; align-items: center; justify-items: center; gap: 6px 20px; }
  .titleTop { margin: 0; grid-row: 1; grid-column: 1; }
  .titleMid { grid-row: 1; grid-column: 2; }
  .titleBot { grid-row: 2; grid-column: 1 / 3; flex-direction: row; justify-content: center; gap: 24px; }
  .logo .l1 { font-size: clamp(48px, 15vh, 90px); } .logo .l2 { font-size: clamp(28px, 9vh, 56px); }
  .tag { margin-top: 10px; }
  .keys { display: none; }
  .panel { padding: 14px 20px 18px; gap: 8px; }
  .panel h2 { font-size: 26px; }
  .btn.big { font-size: 22px; padding: 10px 20px; }
  .panel.over { width: min(560px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; }
  .panel.over > h2, .panel.over > #oSub { grid-column: 1 / 3; }
  .panel.over .oScore { grid-row: span 2; }
}

/* ---------- game over ---------- */
#oTitle { font-size: 38px; color: var(--tomato); text-shadow: 0 3px 0 var(--ink); transform: rotate(-2deg); animation: wobble .6s; }
@keyframes wobble { 0% { transform: scale(.3) rotate(-12deg); } 60% { transform: scale(1.15) rotate(3deg); } 100% { transform: scale(1) rotate(-2deg); } }
#oSub { margin: -6px 0 0; font-weight: 700; font-size: 14px; color: #6b6176; text-align: center; }
.oScore { text-align: center; line-height: 1; }
.oScore small { display: block; font-family: 'Bungee'; font-size: 13px; color: #6b6176; }
.oScore b { font-family: 'Bungee'; font-weight: 400; font-size: 64px; }
.oBest { font-family: 'Bungee'; font-size: 15px; color: #6b6176; }
.ribbon { background: var(--tomato); color: #fff; font-family: 'Bungee'; padding: 4px 16px; border-radius: 8px; box-shadow: 0 3px 0 var(--ink), inset 0 0 0 2px var(--ink); animation: wpulse2 .5s infinite alternate; }
.oCoins { font-family: 'Bungee'; font-size: 20px; display: flex; align-items: center; gap: 6px; }
.oCoins span { font-family: system-ui; font-size: 13px; color: #6b6176; font-weight: 700; }
.oUnlock { background: #e6f7d8; border-radius: 12px; padding: 8px 12px; font-weight: 800; text-align: center; box-shadow: inset 0 0 0 2px var(--grass2); color: #2f6b22; }
.prog { position: relative; width: 100%; height: 22px; background: #e6dcc8; border-radius: 11px; box-shadow: inset 0 0 0 2px var(--ink); overflow: hidden; }
.prog div { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(#ffe066, var(--sun2)); width: 0; transition: width .8s cubic-bezier(.2,.8,.2,1); box-shadow: inset 0 0 0 2px var(--ink); border-radius: 11px; }
.prog span { position: absolute; inset: 0; display: grid; place-items: center; font-size: 11px; font-weight: 800; }

/* ---------- buddies ---------- */
#chars { justify-content: space-between; padding-top: calc(12px + var(--safe-t)); }
.cTop { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cHead { font-family: 'Bungee'; font-size: 26px; color: var(--ink); }
.cHead small { font-size: 14px; color: #8a6a3a; }
.pill { background: var(--ink); color: #fff; border-radius: 999px; padding: 7px 14px 7px 9px; font-family: 'Bungee'; font-size: 17px; display: flex; gap: 6px; align-items: center; }
.pill b { font-weight: 400; }
.arrow { position: absolute; top: 44%; transform: translateY(-50%); width: 54px; height: 64px; border-radius: 16px; background: #fff; box-shadow: 0 5px 0 var(--ink), inset 0 0 0 3px var(--ink); font-size: 44px; line-height: 1; font-weight: 900; display: grid; place-items: center; padding-bottom: 6px; }
.arrow.left { left: calc(14px + var(--safe-l)); } .arrow.right { right: calc(14px + var(--safe-r)); }
.arrow:active { transform: translateY(calc(-50% + 4px)); box-shadow: 0 1px 0 var(--ink), inset 0 0 0 3px var(--ink); }
.cBot { width: min(380px, 100%); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cName { font-family: 'Bungee'; font-size: 34px; color: #fff; text-shadow: 0 3px 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink); }
.cDesc { font-weight: 800; text-align: center; min-height: 2.4em; color: var(--ink); }
.btn.prize { flex-direction: column; gap: 2px; width: 100%; background: linear-gradient(#ffd0e4, #ff9ec7); }
.btn.prize > span:nth-child(2) { display: flex; align-items: center; gap: 6px; }
.machine { display: none; }
@media (orientation: landscape) and (max-height: 500px) {
  .cBot { width: min(640px, 100%); display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; align-items: center; }
  .cName, .cDesc { grid-column: 1 / 3; text-align: center; }
  .cName { font-size: 26px; } .cDesc { min-height: 0; font-size: 13px; }
  .cBot .btn.big { font-size: 20px; padding: 10px; }
}
#capsule { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(30,20,46,.55); }
.cap { width: 140px; height: 140px; position: relative; animation: shake .12s infinite; }
.capTop, .capBot { position: absolute; left: 0; right: 0; height: 70px; box-shadow: inset 0 0 0 5px var(--ink); }
.capTop { top: 0; border-radius: 70px 70px 0 0; background: linear-gradient(#ff9ec7, #ff5aa0); transition: transform .4s cubic-bezier(.3,1.6,.5,1); }
.capBot { bottom: 0; border-radius: 0 0 70px 70px; background: #fff; }
#capsule.open .capTop { transform: translateY(-80px) rotate(-30deg); }
#capsule.open .cap { animation: none; }
.capText { position: absolute; font-family: 'Bungee'; font-size: 48px; color: var(--ink); }
@keyframes shake { 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }

#nogl { position: absolute; inset: 0; display: grid; place-items: center; background: #7cc456; }

/* big screens (tablets, desktops): scale the menus up */
@media (min-width: 760px) and (min-height: 880px) {
  .titleMid, .titleBot, .panel, .cBot, .cTop, #hRight { zoom: 1.3; }
  .cTop { width: calc(100% / 1.3); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
