@font-face { font-family: "Fredoka"; src: url("fonts/Fredoka.ttf") format("truetype"); font-weight: 300 700; font-display: block; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; background: #7cc957; }
body { font-family: "Fredoka", system-ui, sans-serif; color: #4a2b0b; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; touch-action: none; }
#app { position: fixed; inset: 0; --fs: clamp(13px, 2vmin, 18px); font-size: var(--fs); }
canvas#game { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
.hidden { display: none !important; }
.ic { display: inline-flex; width: 1.6em; height: 1.6em; flex: none; }
.ic svg { width: 100%; height: 100%; }
button { font-family: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }

/* HUD */
#hud { position: absolute; display: flex; align-items: center; gap: .45em; flex-wrap: wrap; pointer-events: none; z-index: 5; }
.pill { display: flex; align-items: center; gap: .35em; background: rgba(110,55,0,.78); color: #fff; border-radius: 999px; padding: .25em .75em .25em .3em; box-shadow: 0 .15em 0 rgba(70,30,0,.35); font-weight: 600; }
.pill b { font-size: 1.1em; letter-spacing: .01em; }
.pill.big { padding-right: 1em; }
.pill.big .ic { width: 2.2em; height: 2.2em; }
.pill.big b { font-size: 1.45em; color: #ffd23f; display: block; line-height: 1; }
.pill.big small { display: block; font-size: .85em; opacity: .95; line-height: 1.15; }
.pill.bump { animation: bump .25s; }
@keyframes bump { 50% { transform: scale(1.08); } }
#combo { position: relative; width: 6.5em; height: 1.3em; background: rgba(110,55,0,.6); border-radius: 999px; overflow: hidden; }
#combo-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #ffe14a, #ff9f2e); border-radius: 999px; transition: width .1s linear; }
#combo span { position: absolute; inset: 0; text-align: center; font-size: .82em; font-weight: 600; color: #fff; line-height: 1.6em; text-shadow: 0 1px 0 rgba(0,0,0,.4); }
#combo.on #combo-fill { width: 100% !important; animation: glow .4s infinite alternate; }
@keyframes glow { to { filter: brightness(1.3); } }
#hud-right { position: absolute; display: flex; gap: .45em; z-index: 5; }
.round { position: relative; width: 2.7em; height: 2.7em; border-radius: 50%; background: #fff8e8; box-shadow: 0 .18em 0 #c98a3a, 0 .3em .6em rgba(0,0,0,.15); display: grid; place-items: center; }
.round .ic { width: 1.7em; height: 1.7em; }
.round:active { transform: translateY(2px); box-shadow: 0 .05em 0 #c98a3a; }
#btn-boost span { position: absolute; bottom: -1.1em; left: 50%; transform: translateX(-50%); font-size: .8em; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); white-space: nowrap; }
#btn-boost.active { background: #fff3a6; animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
#biome-tag { position: absolute; z-index: 4; font-weight: 600; font-size: .9em; color: #fff; background: rgba(60,120,40,.7); padding: .2em .7em; border-radius: 999px; pointer-events: none; }

/* goal bar */
#goalbar { position: absolute; z-index: 5; display: flex; align-items: center; gap: .5em; background: rgba(255,250,236,.95); border-radius: 999px; padding: .3em .45em .3em .5em; box-shadow: 0 .2em 0 #d9a24a, 0 .4em 1em rgba(0,0,0,.15); }
#goalbar .ic { width: 1.8em; height: 1.8em; }
.goal-main { flex: 1; min-width: 0; }
#goal-text { display: block; font-weight: 600; font-size: .95em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { height: .55em; background: #f0dcb4; border-radius: 999px; overflow: hidden; margin-top: .2em; }
#goal-fill { height: 100%; width: 0; background: linear-gradient(90deg, #8fd14f, #5cc93a); border-radius: 999px; transition: width .3s; }
#goalbar.done { animation: pulse 0.9s infinite; }

/* buttons */
.btn { font-weight: 700; font-size: 1em; border-radius: .8em; padding: .45em .8em; min-width: 4.6em; color: #fff; background: #5cc93a; box-shadow: 0 .2em 0 #3a8a22; text-shadow: 0 1px 0 rgba(0,0,0,.25); display: inline-flex; align-items: center; justify-content: center; gap: .3em; white-space: nowrap; }
.btn:active { transform: translateY(2px); box-shadow: 0 .05em 0 #3a8a22; }
.btn.purple { background: #9a6cff; box-shadow: 0 .2em 0 #5f3fc0; }
.btn.orange { background: #ff9f2e; box-shadow: 0 .2em 0 #c06a10; }
.btn.plain { background: #fff8e8; color: #6b4220; text-shadow: none; box-shadow: 0 .2em 0 #d9b77a; }
.btn.off, .btn:disabled, .btn.purple.off, .btn.orange.off { background: #cdbfa6; color: #fff; box-shadow: 0 .2em 0 #a8977a; cursor: default; }
.btn.plain.off { background: #efe6d4; color: #a8977a; box-shadow: 0 .2em 0 #d6c8ae; }
.btn.off:active { transform: none; }
.btn.big { font-size: 1.15em; padding: .55em 1.1em; }
.btn .ic { width: 1.25em; height: 1.25em; }
.btn .cost { display: inline-flex; align-items: center; gap: .15em; }

/* panel */
#panel { position: absolute; z-index: 6; background: #fff8e8; border: .22em solid #e6a83e; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 0 1.2em rgba(80,40,0,.25); }
#panel.land { border-radius: 1.1em; }
#panel.port { border-radius: 1.1em 1.1em 0 0; border-bottom: 0; }
#tabs { display: flex; gap: .25em; padding: .35em .35em 0; background: #f6dfae; }
#tabs button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: .05em; padding: .3em 0 .35em; border-radius: .7em .7em 0 0; font-weight: 600; font-size: .88em; color: #8a5a2a; }
#tabs button .ic { width: 1.5em; height: 1.5em; }
#tabs button.on { background: #fff8e8; color: #4a2b0b; }
#tabs .dot { position: absolute; top: .3em; right: 22%; width: .6em; height: .6em; border-radius: 50%; background: #ff4f6a; box-shadow: 0 0 0 2px #fff; }
#tab-body { flex: 1; overflow-y: auto; padding: .45em .5em .8em; touch-action: pan-y; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#tab-body::-webkit-scrollbar { width: 6px; } #tab-body::-webkit-scrollbar-thumb { background: #e0b878; border-radius: 3px; }
.card { display: flex; align-items: center; gap: .55em; background: #fff; border: 2px solid #f2d59a; border-radius: .9em; padding: .4em .45em .4em .5em; margin-bottom: .4em; }
.card .ic, .card img.bee { width: 2.3em; height: 2.3em; flex: none; object-fit: contain; }
.card .txt { flex: 1; min-width: 0; }
.card .t { font-weight: 600; line-height: 1.15; }
.card .d { font-size: .86em; color: #9a7348; line-height: 1.2; }
.card.hl { border-color: #8fd14f; background: #f6ffe9; }
.card.locked { opacity: .6; }
.card.gold { border-color: #ffcf3f; background: #fffbe6; }
.sec { font-weight: 700; color: #a8641c; margin: .55em .2em .3em; font-size: .92em; display: flex; justify-content: space-between; align-items: center; }
.row { display: flex; gap: .4em; flex-wrap: wrap; }
.pips { display: inline-flex; gap: .2em; margin-left: .3em; vertical-align: middle; }
.pips i { width: .55em; height: .55em; border-radius: 50%; background: #ead7b4; }
.pips i.on { background: #ff8fd0; }
.prog { height: .5em; background: #f0dcb4; border-radius: 999px; overflow: hidden; margin-top: .25em; }
.prog > div { height: 100%; background: linear-gradient(90deg, #ff9fd8, #b07cff); border-radius: 999px; }
.prog.g > div { background: linear-gradient(90deg, #8fd14f, #5cc93a); }
.beegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(4.2em, 1fr)); gap: .35em; }
.beecard { position: relative; background: #fff; border: 2px solid #f2d59a; border-radius: .8em; padding: .15em; text-align: center; font-size: .8em; font-weight: 600; cursor: pointer; }
.beecard img { width: 100%; height: 3.2em; object-fit: contain; display: block; }
.beecard.v1 { border-color: #ffcf3f; background: #fff8d6; }
.beecard.v2 { border-color: #c38bff; background: linear-gradient(135deg,#ffe4f2,#e4f4ff,#f0ffe4); }
.beecard.sel { border-color: #5cc93a; box-shadow: 0 0 0 3px #b8f08f; transform: translateY(-2px); }
.beecard.match { border-color: #8fd14f; animation: pulse 1s infinite; }
.beecard.dim { opacity: .45; }
.small { font-size: .86em; color: #9a7348; }

/* cell popup */
#cellpop { position: absolute; z-index: 8; width: min(19em, 92vw); background: #fff8e8; border: .2em solid #e6a83e; border-radius: 1em; padding: .55em .6em .6em; box-shadow: 0 .5em 1.5em rgba(60,30,0,.35); }
#cellpop h3 { margin: 0 1.6em .3em 0; font-size: 1.1em; display: flex; align-items: center; gap: .35em; }
#cellpop .x { position: absolute; top: .35em; right: .4em; width: 1.8em; height: 1.8em; color: #a8641c; }
#cellpop .opt { display: flex; align-items: center; gap: .45em; padding: .3em .2em; border-top: 1px solid #f2dcae; }
#cellpop .opt .ic { width: 2em; height: 2em; }
#cellpop .opt .txt { flex: 1; min-width: 0; }

/* modal */
#modal { position: absolute; inset: 0; z-index: 20; background: rgba(60,30,0,.45); display: grid; place-items: center; padding: 1em; }
#modal-card { position: relative; background: #fff8e8; border: .25em solid #e6a83e; border-radius: 1.2em; padding: 1em 1.2em; width: min(26em, 94vw); max-height: 92vh; overflow-y: auto; text-align: center; box-shadow: 0 1em 3em rgba(0,0,0,.35); animation: popin .25s cubic-bezier(.2,1.6,.4,1); touch-action: pan-y; }
@keyframes popin { from { transform: scale(.7); opacity: 0; } }
#modal-card h2 { margin: 0 0 .3em; font-size: 1.5em; color: #a8641c; }
#modal-card p { margin: .35em 0; line-height: 1.3; }
#modal-card .big-num { font-size: 2em; font-weight: 700; color: #f08a00; display: flex; align-items: center; justify-content: center; gap: .2em; }
#modal-card .big-num .ic { width: 1.3em; height: 1.3em; }
#modal-card .btns { display: flex; gap: .5em; justify-content: center; flex-wrap: wrap; margin-top: .7em; }
#modal-card .btns .btn { min-width: 8.5em; }
#modal-card .x { position: absolute; top: .4em; right: .5em; width: 2em; height: 2em; color: #a8641c; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: .5em; padding: .45em .2em; border-bottom: 1px solid #f2dcae; font-weight: 600; }
.toggle .ic { width: 1.6em; height: 1.6em; }
.credits { font-size: .85em; color: #8a6a44; line-height: 1.4; }
.credits img { width: 13em; max-width: 70%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; border-radius: .6em; margin: .4em auto; display: block; }
.dexgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: .3em; margin-top: .5em; }
.dexgrid div { background: #fff; border: 2px solid #f2d59a; border-radius: .6em; font-size: .7em; padding: .1em; }
.dexgrid div.v1 { border-color: #ffcf3f; background: #fff8d6; } .dexgrid div.v2 { border-color: #c38bff; }
.dexgrid img { width: 100%; height: 2.6em; object-fit: contain; display: block; }
.dexgrid .unk img { filter: brightness(0) opacity(.25); }

/* ad block overlay */
#adblock { position: absolute; inset: 0; z-index: 30; background: rgba(40,20,0,.55); display: grid; place-content: center; text-align: center; color: #fff; font-weight: 600; }
.spinner { width: 3em; height: 3em; margin: 0 auto .5em; border-radius: 50%; border: .4em solid rgba(255,255,255,.3); border-top-color: #ffd23f; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* toasts */
#toasts { position: absolute; z-index: 25; display: flex; flex-direction: column; gap: .35em; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: .45em; background: rgba(70,35,5,.92); color: #fff; padding: .45em .9em .45em .5em; border-radius: 999px; font-weight: 600; box-shadow: 0 .3em 1em rgba(0,0,0,.25); animation: toastin .35s cubic-bezier(.2,1.5,.4,1); max-width: 92vw; }
.toast img, .toast .ic { width: 2em; height: 2em; }
.toast.out { opacity: 0; transform: translateY(-10px); transition: all .35s; }
@keyframes toastin { from { transform: translateY(-14px) scale(.8); opacity: 0; } }

/* tutorial */
#tut { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
#tut-hand { position: absolute; width: 3.4em; height: 3.4em; margin: -.4em 0 0 -1.1em; animation: tap 1s ease-in-out infinite; filter: drop-shadow(0 .2em .2em rgba(0,0,0,.35)); }
@keyframes tap { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(.3em,.5em) scale(.9); } }
#tut-bubble { position: absolute; background: #fff; border: .18em solid #4a2b0b; border-radius: .9em; padding: .4em .6em; font-weight: 600; display: flex; align-items: center; gap: .6em; pointer-events: auto; box-shadow: 0 .3em .8em rgba(0,0,0,.2); max-width: 17em; }
#tut-skip { font-size: .85em; color: #9a7348; text-decoration: underline; white-space: nowrap; }

/* loading */
#loading { position: absolute; inset: 0; z-index: 40; background: linear-gradient(#6ec9ff, #c6efff 60%, #79c84f 60%); display: grid; place-content: center; text-align: center; font-weight: 600; color: #4a2b0b; }
.load-hex { width: 4em; height: 4.6em; margin: 0 auto .6em; background: #ffb21f; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); animation: pulse .8s infinite; }
