a design document โ how beelieveInYourself was built, what broke, and how we fixed it
// what is this project
beelieveInYourself is a GitHub Pages website that renders the entire Bee Movie script
word by word, filling the screen with alternating yellow and black text while a text-to-speech
voice reads it aloud. It has a progress bar with 15 collectible milestones mapped to
exact moments in the script, and a start screen where you can configure voice, pitch, and speed.
It was built entirely through a conversation with Claude (AI), iterating on bugs, ideas, and vibes.
This document is a record of that process.
HTMLCSSJavaScriptWeb Speech APIGitHub Pagesthe bee movie (2007)
// tl;dr
A single index.html page that reads the entire Bee Movie script aloud, word by word, using the browser's text-to-speech API.
Words fill the screen in alternating yellow and black โ the whole script eventually covers everything.
15 collectible milestone badges tied to exact moments in the script (Barry's first flight, the tennis match, the lawsuit, etc.).
A casino panel lets you gamble your accumulated honey ๐ฏ on blackjack or roulette โ you earn honey by listening to the script.
Gambling is blocked while the script is paused. Honey persists in localStorage.
Entire project is one file, built iteratively through AI conversations, deployed on GitHub Pages.
// how it started
If you had the bee movie script could we somehow make it play each word one by one and fill up the entire page? You go there and hit start and then the words of the bee movie will run and fill the webpage. Make a new folder for this project called beelieveInYourself.
The initial idea was simple: word by word, filling the screen. The bee movie script was sourced
locally from the Downloads folder. The first build used fetch() to load a
script.txt file, with a speed slider and a start button.
// build timeline
1. the first build
Basic HTML page. Words appended one at a time using setInterval.
Speed slider (1โ10). Auto-scroll to bottom. Dark background, yellow text.
2. visual redesign
The background should be grey and the words should alternate between yellow and black.
Background changed to grey. Every even-indexed word renders yellow (#f5c800),
every odd word renders near-black (#111). The script file was renamed to
vibes.txt to match what was already in the folder.
3. pushing to github pages
The repo was created manually on GitHub and pushed via git. During this process
we hit a diverged history problem โ the README was created on GitHub directly,
which conflicted with local commits. A force push resolved it.
๐ bug โ file picker opening on start
The fetch() call to load vibes.txt was failing silently when
opening the file directly in a browser via file:// protocol. The fallback
code opened a file picker dialog instead of just starting.
โ fix
Removed the file picker fallback entirely. fetch() works correctly
on GitHub Pages (HTTP), just not locally via file://.
Replaced the fallback with a simple alert.
4. bigger speed slider + milestone markers
Can you make the slider bigger so there are more speed options? Also there should be
milestones in the progress bar if you can find some of those.
Speed slider expanded from 1โ10 to 1โ50. Progress bar upgraded from a plain bar
to one with 14 milestone dot markers. Each dot has a hover label. A toast notification
pops up at the top of the screen when a milestone is reached.
5. text-to-speech added
Let's do the Web Speech API โ I'd also like that before you press start you set the pitch and voice.
Added the browser's built-in window.speechSynthesis API. No library,
no API key, works entirely in the browser. The start screen gained a pitch slider
and a voice dropdown populated from the browser's installed voices.
The speed slider now also controls the TTS rate.
๐ bug โ text speed and voice speed out of sync
The setInterval word timer ran independently from the TTS,
so words appeared on screen at a different rate than the voice was speaking them.
โ fix โ TTS drives the display
Removed setInterval entirely. Words now appear when the voice speaks them,
using utterance.onend to chain to the next word. The voice became the clock.
6. natural speech chunks
Can we make it more human by saying 4 words at a time? Or if the end is less than 4 words,
it finishes a sentence to make it sound more human.
Switched from single-word utterances to sentence-aware chunks. The engine collects
up to 4 words, then peeks ahead up to 3 more to find the nearest sentence-ending
punctuation (.!?) and extends to it.
This made the TTS sound dramatically more natural.
7. eliminating the gap between chunks
Once it's finished speaking there is still a pause. Can you make it 67% less of a pause?
๐ bug โ audible pause between utterances
Each chunk finished speaking, then the browser overhead of creating the next
SpeechSynthesisUtterance caused a noticeable gap before the next chunk started.
โ fix โ pipeline queuing via onstart
Instead of queuing the next utterance in onend of the current one,
the next utterance is queued inside onstart of the current one.
This means by the time chunk N finishes, chunk N+1 is already loaded and waiting โ
eliminating most of the gap.
8. pre-rendering + onboundary lighting
What if we render the whole script as grey as the background and then once the voice says it
it goes black or yellow? That way the voice is reading in a flow with commas and periods.
Complete architectural rethink. All 9,157 words are pre-rendered to the page as grey
<span> elements (same colour as background, so invisible) the moment
you press start. The TTS now speaks full sentences rather than 4-word chunks.
The onboundary event fires at each word boundary mid-speech and lights
up the corresponding span yellow or black in real time. The page scrolls to follow
the current word.
A fallback in onend catches any words that onboundary missed
(some browsers fire it inconsistently).
9. milestone positions corrected
The milestones don't seem to add up. The yellow and black one is too late compared to
where it is in the movie.
๐ bug โ milestone positions were estimated, not measured
The original milestone percentages were rough guesses based on line numbers.
"Yellow, black." was set at 2% when it actually appears at word 47 out of 9,157 โ just 0.5%.
โ fix โ PowerShell word search
Used PowerShell to scan the actual text and find the exact word index of each iconic phrase.
All 15 milestones were remapped to their real positions. A word-positions.txt
file was added to the repo with the full breakdown.
10. english-only voices
Can you get rid of the German speakers?
The voice dropdown was filtered to only show voices where lang.startsWith('en').
No more accidentally selecting a German synthesiser to read the bee movie script.
// milestone map
There are 15 milestones. Here's where they actually fall in the script:
#
milestone
word #
%
1
๐ Yellow, black. Yellow, black.
47
0.5%
2
๐ Graduation Day
298
3.3%
3
๐ป Pollen Jocks!
692
7.6%
4
๐ธ She saved my life
2,187
23.9%
5
๐ท You like jazz?
2,251
24.6%
6
๐ง Thinking bee!
3,118
34.1%
7
๐ฏ Honey Farms discovered
3,760
41.1%
8
โ๏ธ The trial begins
4,998
54.6%
9
๐ค Mr. Sting takes the stand
5,395
58.9%
10
โ FREE THE BEES!
6,817
74.4%
11
๐ The bees win!
6,833
74.6%
12
๐บ Flowers are dying...
7,284
79.5%
13
โ๏ธ Barry flies the plane
8,142
88.9%
14
๐ฌ Barry, we did it!
8,759
95.7%
15
๐ฌ No rehearsal for that.
9,157
100%
// architecture overview
files in the repo
index.html โ the main experience
vibes.txt โ the bee movie script (9,157 words)
beelieve.html โ this document
word-positions.txt โ exact word indices for all 15 milestones
README.md โ the repo readme with milestone table
how the display works
On start, all 9,157 words are rendered as grey <span> elements โ invisible against the background
The script is split into sentences by punctuation
Sentences are fed to SpeechSynthesisUtterance one at a time
Each sentence pre-queues the next in its onstart handler to minimise gaps
The onboundary event fires at each spoken word, lighting the matching span yellow or black
The page scrolls to follow the current word
Milestone dots on the progress bar light up as their percentage is crossed
11. leaderboard
Now let's add a leaderboard. Before you hit start you enter a name, this name gets recorded and scored by how many words they listened to. You should be able to see the leaderboard on the left side of the screen.
GitHub Pages is static hosting โ it can't write to files. We used
JSONBin.io as a free JSON storage backend. Scores are stored as
{"scores": [{name, score, date}]}. A name input was added to the start screen.
Score = number of words lit up by the voice. Saves on pause, on finish, and on tab close
via beforeunload. Top 50 scores kept, top 10 shown.
The API key and Bin ID are stored in a config.js file that is
listed in .gitignore so it is never committed to the repo.
๐ bug โ CONFIG not defined on GitHub Pagesconfig.js was gitignored, so it didn't exist on GitHub Pages.
The page threw ReferenceError: CONFIG is not defined and nothing worked.
โ fix
Inlined the config directly into the HTML. The gitignored file still exists locally
for clean separation, but the live site has the values baked in.
๐ bug โ voices not loading on start screenspeechSynthesis.getVoices() returns an empty array on first call in Chrome โ
voices load asynchronously. The dropdown showed "loading voices..." forever.
โ fix
Added a retry loop that polls every 300ms up to 10 times alongside the
onvoiceschanged event handler. Whichever fires first populates the dropdown.
12. infinite recursion bug kills TTS
๐ bug โ no voice, no word lighting after leaderboard added
To hook score-saving into the end of the script, a wrapper function was written:
const _orig = speakSentence; function speakSentence(si) { _orig(si); }.
JavaScript hoists function declarations to the top of scope, so
_orig ended up pointing at the wrapper itself โ instant infinite recursion.
The whole TTS system crashed silently before a single word was spoken.
โ fix
Removed the wrapper entirely. The saveScore() call was placed directly
inside the real speakSentence function at the point where
si >= sentences.length โ the natural finish condition.
13. bees
bee.png is in the project folder. Can you add a bunch moving across the screen at all times?
22 <img> elements are spawned via JS on page load. Each gets a random
size (108โ324px after two rounds of "BIGGER"), random vertical position, random direction
(left or right, flipped via scaleX(-1)), random speed (6โ24s per pass),
staggered negative animation delay so they're already mid-flight on load, and a wobble
keyframe animation so they bob up and down as they fly.
14. fixed gameplay header + display modes
We need to make a save progress button when you start. This button should be at the top left as a header. We also need a few more buttons in the header. The way the text is being read right now is called LIST and it's on by default. Also add a text mode where once it's read after 3 seconds the text falls to the bottom of the page and collects at the bottom with physics.
A fixed 44px header bar was added that appears once the script starts. It contains a SAVE button,
display mode buttons (LIST / FALL / FLOAT / BOUNCE), and color mode buttons (BEE / RAINBOW / MATRIX / CHAOS).
Four display modes were built:
LIST โ default. Words light up in place, page scrolls to follow.
FALL โ words fall to the bottom of the document using Matter.js physics. Bodies are created in Matter.js world space, mirrored to position: absolute DOM elements each frame. A static ground body sits at the document bottom and only moves down with scroll โ never up, preventing the pile from being destroyed.
FLOAT โ words float upward with a CSS @keyframes float-up animation and fade out.
BOUNCE โ words ricochet around the viewport using simple JS physics with edge collision detection, tracked in a bouncingWords array updated in a requestAnimationFrame loop.
๐ bug โ scrollIntoView fighting user scroll in FALL/FLOAT/BOUNCE
The auto-scroll that follows the current word in LIST mode was still running in other modes, constantly fighting the user's manual scroll.
โ fix
Wrapped scrollIntoView() in a if (displayMode === 'list') check.
๐ bug โ FALL words destroyed when scrolling up
The scroll listener moved the Matter.js ground body to track the viewport bottom. When the user scrolled back up, the ground moved above the fallen pile, causing Matter.js to violently resolve all the bodies that were now below it.
โ fix
Added a guard: if (ny <= fallFloorY) return; โ the ground only ever moves downward.
15. color modes
We need to make it so that the username is the same... Also what other types of 'funny' text options can we build? Can we make a rainbow text option?
Four color modes were added, selectable via header buttons. A getWordColor(i)
function dispatches based on colorMode:
BEE โ default yellow/black alternating pattern
RAINBOW โ cycles through 6 hues using i % 6
MATRIX โ random shades of green for each word
CHAOS โ fully random hsl() color every time a word lights
Also fixed in this pass: username deduplication on the leaderboard. Previously the same name accumulated multiple entries. Fixed by filtering out the existing entry for a name before pushing the new one.
16. bee catching + bee respawn
We need to make it so that the bees respawn so there's always 22 on the screen. Also if you click a bee you collect a bee. At the top show 'Bees Collected' and track this on the leaderboard.
Bees became interactive. A catchBee(bee) function was extracted and shared
between click handlers and the later virtual mouse system. When caught, a bee scales to zero
and fades out, then a new one spawns 800โ2000ms later via a spawnBee() function.
An activeBeeCount counter keeps the total at 22.
beesCollected tracks session catches. The header shows a live count.
The leaderboard entry was extended with a bees field.
17. achievements system
Can we add achievements that store locally? Bee catching milestones: 1, 50, 100, 1k, 10k, 50k, 100k, 1M. Time listening: 1 minute, 10 minutes, 1 hour, 10 hours, 24 hours, 72 hours, 1 week. Mode discovery achievements, one per display/color mode.
A full achievement system was added. All data lives in localStorage under a single
beelieve_progress key as a JSON object. The ACHIEVEMENTS array defines
every achievement with an id, cat, threshold, icon,
name, and desc.
Bee catching โ 8 milestones from 1 to 1,000,000 bees
Time listening โ 7 milestones from 1 minute to 1 week (only ticks while actively playing, not paused)
Discoveries โ one per display mode and color mode, unlocked on first use
Script completions โ 1, 10, 100, 1,000 full runs of the script
A toast notification slides in from the bottom-right when an achievement unlocks.
An achievements modal (opened from the header or landing page) shows all achievements
in a grid, locked ones dimmed, with progress bars for threshold-based ones.
18. cookie-clicker shop + BPS
Make this like cookie clicker. We need next to the bee collected a shop icon. Buy upgrades with the total bees collected. One of the upgrades should be a virtual mouse that zooms around the screen and clicks on bees. We also need bees per second (BPS) as a tracker.
A full idle-game economy was built around honey (๐ฏ) as currency:
Catching bees or auto-generation adds to progress.beesTotal (spendable, persisted)
7 upgrade tiers in a slide-in shop panel: Virtual Mouse โ Bee Drone โ Mini Hive โ Pollen Farm โ Honey Distillery โ Barry's Lawyer โ Bee Movie Studio
Each tier has a base cost, BPS contribution, and owned count. Cost scales at 1.15^owned
A 100ms interval accumulates fractional BPS into whole honey increments
BPS auto-gen only runs while actively listening โ paused or on home screen = no honey
The header shows three distinct elements: total honey | BPS rate | SHOP button
The Virtual Mouse upgrade spawns animated ๐ฑ๏ธ cursor elements that visually
hunt bees โ they transition to a random bee's position every ~700ms, trigger a click animation,
and call catchBee() on whatever bee they reach. They freeze when paused.
๐ bug โ TDZ crash: can't access 'fallBodies' before initialization (ร2)
The masterRAF IIFE ran immediately at parse time and referenced fallBodies
and bouncingWords, which were declared with let further down in the script.
JavaScript's temporal dead zone (TDZ) throws a ReferenceError for let before its declaration.
The same issue appeared later with syncVirtualMice() referencing running.
โ fix
Moved all let fallBodies, let bouncingWords declarations to before the
IIFE. Moved syncVirtualMice() call to after the let running = false declaration.
19. mobile + iOS Safari support
We now need a solid mobile update so it works on mobile. Currently going to the site on Safari on my iPhone doesn't do anything โ no text gets read or changed to colors.
iOS Safari has several specific restrictions on the Web Speech API and touch handling:
๐ bug โ speech never starts on iOS SafarispeechSynthesis.speak() on iOS must be called synchronously within a direct user
gesture. The start button handler did await fetch(SCRIPT_FILE) before calling
speakSentence(). The await breaks the gesture context โ iOS blocks
the speech call as non-user-initiated.
โ fix โ gesture priming
A silent SpeechSynthesisUtterance('') is spoken and immediately cancelled
synchronously at the very top of the click handler, before any await.
This primes the browser's gesture context, allowing the real speech to start later.
๐ bug โ onboundary never fires on iOS Safari
iOS Safari does not fire onboundary events at all. Without them, no words light up.
โ fix โ character-rate fallback timer
Added a fallback: when onstart fires and no boundary has ever been seen,
a scheduleFallback() function advances words one at a time using a timer
calculated from (charLen / charsPerSec) * 1000. If real boundary events
start arriving, the fallback cancels itself.
๐ bug โ iOS speech silently stalls after ~30 seconds
A known iOS Safari bug causes speechSynthesis to silently pause mid-playback,
with speaking still returning true.
โ fix โ watchdog interval
A 5-second interval checks if speechSynthesis.paused is true while it should be
playing, and calls .resume(). Also detects if no boundary event has fired in
over 8 seconds and nudges the synthesiser.
Additional mobile fixes: header scrolls horizontally instead of wrapping; all interactive
elements got touch-action: manipulation and -webkit-tap-highlight-color: transparent;
bees got a touchstart handler with preventDefault for instant tap response;
overlay, leaderboard, and shop panel use min(X, 90vw) for small screens.
20. start fresh / resume + completion tracking
On the landing page show two buttons โ either start from beginning or resume from last session. Track how many times they completed the script as an achievement: 1, 10, 100, 1000 times.
progress.savedLitCount stores the last word index in localStorage every 10 seconds
while listening, and immediately when the home button is pressed. On the landing page, if
savedLitCount > 0, a RESUME button appears alongside START FRESH.
Resuming lights all previously-heard words instantly (no speech), then finds the correct sentence
index and calls speakSentence(si) to pick up from there.
When the script finishes, progress.completions increments, savedLitCount
resets to 0, and four new achievements are checked: You Watched It (1ร),
Bee On Repeat (10ร), Hive Mind (100ร), According to All Known Laws (1,000ร).
21. daily login bonus
Can you add a daily login bonus of 69 honey that doubles each day you log in? Today it's 69, tomorrow 138, next day 276, etc.
On page load, the script compares today's date (new Date().toISOString().slice(0,10))
against progress.lastLoginDate. If it's a new day, and yesterday matches the
last login date, the streak increments. Otherwise it resets to 1.
Bonus = 69 ร 2^(streak โ 1) added directly to progress.beesTotal.
A toast pops up 800ms after page load showing the bonus amount and current streak day.
22. leaderboard โ coming soon
The original leaderboard used JSONBin.io as a free REST JSON store. Scores were saved on
pause, finish, tab close (beforeunload with keepalive: true),
and every 30 seconds via setInterval. The leaderboard score was migrated from
"words read" to "total bees ever caught" (stored in progress.beesCaught) so
spending honey in the shop can't lower your rank.
The JSONBin backend was removed and the leaderboard stubbed with a "coming soon" placeholder.
A Supabase database integration is planned as the replacement.
All local progress (honey, bees, shop, achievements, streak) continues to persist in localStorage.
23. username persistence + speed "Normal" label
It should save the username you use. We should rename the 12 next to speed to Normal just so it's easy to find.
The player name input now saves to localStorage under beelieve_username
on every keystroke and is auto-filled on page load. No more re-entering your name every visit.
The speed slider's value label shows "Normal" when set to 12 (the default TTS rate),
and a number for everything else. In the gameplay HUD, the speed label turns green when you're at Normal speed.
Value 12 maps to a TTS rate of roughly 1ร โ the most natural-sounding pace.
24. ElevenLabs TTS integration
Is there an API users could plug in for a text to speech they could use themselves?
An optional ElevenLabs API key field was added to the landing page. When a key is present,
speech is routed through the ElevenLabs streaming TTS API instead of the
browser's built-in voice. The audio is fetched as an ArrayBuffer, decoded via
the Web Audio API (AudioContext.decodeAudioData), and played
through a BufferSource node. Since ElevenLabs returns raw audio with no word
boundary events, the existing character-rate fallback timer lights words as the audio plays.
If the API key is invalid or the request fails, the system shows a toast and automatically
falls back to browser TTS. The key is saved to localStorage so it only needs
to be entered once.
A ? help button sits next to the label. Hovering it opens a tooltip with
step-by-step instructions for getting an ElevenLabs key, including a direct signup link.
The tooltip stays open when you move the mouse onto it (120ms grace period) so you can
click the link without it disappearing.
25. daily rewards calendar
Can you add a daily login bonus of 69 honey that doubles each day you log in? The icon should be a book and clicking on it should open like a book and show a calendar with checkmarks if you claimed that day's daily gift.
A ๐ DAILY REWARDS button sits on the landing page. When today's reward is
unclaimed it gains a dark honey background and a pulsing red notification dot.
Clicking it opens a panel with a CSS 3D book-open animation
(perspective(800px) rotateY(-90deg โ 0deg)).
The panel shows a 7-day calendar grid (6 past days + today + tomorrow locked).
Each cell shows its state: โ claimed ยท ๐ฏ claimable today ยท ๐บ missed (watch ad) ยท ๐ future.
Clicking CLAIM starts a 3-second countdown bar โ the reward button only
activates once it completes, preventing accidental instant claims.
Claimed dates are stored as an array of ISO date strings in progress.claimedDates.
Streak is calculated by counting consecutive claimed days ending at today. Bonus = 69 ร 2^(streak โ 1).
๐ bug โ daily bonus banner never showed after first deploy
The original implementation auto-granted the bonus and set lastLoginDate = today on load.
On next visit the date check saw today was already set and skipped the bonus entirely โ the banner
was invisible because _dailyBonus was 0.
โ fix
Replaced the auto-grant model with a claimedDates array. The bonus is only credited
when the user explicitly clicks CLAIM and survives the countdown. Old loginStreak
and lastLoginDate data is migrated into claimedDates on first load.
26. ad-watch for missed days
If you hover over a past day, you can click and watch an ad to get the reward. If I watched an ad I would get 138 honey, then if I watched an ad for the day before that, I get double 138?
Missed past days (unclaimed and not ad-claimed) show a ๐บ icon in the calendar.
Hovering reveals a tooltip: "โถ watch ad ยท +X ๐ฏ".
Clicking starts a 5-second countdown that simulates an ad view.
When the countdown completes, a โ CLAIM button appears and the honey is credited on click.
The ad reward doubles the further back in time: yesterday = 138, 2 days ago = 276,
3 days ago = 552, and so on (138 ร 2^(daysBack โ 1)).
Each day can only be ad-claimed once โ tracked in progress.adDays.
The countdown is currently simulated (no real ad SDK). To integrate a real ad network
(e.g. Google AdSense Rewarded, AdMob Web), replace the showCountdown() call
with the ad SDK's show method and invoke the onComplete callback in the
ad's reward event handler.
27. header layout + polish
The buttons and text options need to be moved so that CHAOS is touching the right side of the header.
A flex: 1 spacer div was inserted between the BPS display and the SHOP button.
This pushes all mode/color buttons to the right edge so CHAOS sits flush against it,
while ๐, honey count, and BPS stay anchored to the left.
28. shop flash fix + in-place rendering
When we open the shop, we hover over what we want to buy and we can't click because it's flashing like we are clicking when we are not. We need to change that ASAP so it only flashes when we click and that it lets us buy upgrades.
๐ bug โ shop items flash on hover and freeze on click
Every purchase called renderShop() which wiped innerHTML and rebuilt
all items from scratch. The full DOM teardown/rebuild caused a visible flash. On mobile, touch
states were also triggering the hover style on items that couldn't be bought.
โ fix โ in-place DOM updaterenderShop(initial) now uses data-upg attributes to find existing
item elements and only updates their cost and count text. Items are created once and reused.
The :hover style was scoped to :not(.unaffordable) so grey/locked
items never highlight. A brief .buying class (150ms) gives tactile feedback on
actual clicks without a full re-render.
29. landing page stats panel
On the landing page see our total amount of honey and our honey per second as well as a % of how far we are in the script.
A dark stats panel was added to the landing page controls, sitting above the Daily Rewards button.
It displays three live values read from progress on load:
๐ฏ HONEY โ current spendable balance
โก PER SECOND โ current BPS from all owned upgrades
๐ PROGRESS โ savedLitCount / 9157 ร 100% with a progress bar
Progress is 0% if there is no saved session. All values are calculated via the existing
fmtN() and calcBPS() helpers, so they use the same formatting
(k/M/B suffixes) as the in-game HUD.
Resume, achievements, and how this was made should all be the same width and style as the other buttons. When hovering you should see an info box appear so the user gets more info as to what the button does.
All landing page buttons โ Daily Rewards, Resume, Achievements, How Was This Made, and Start Fresh โ
were unified to the same style: transparent background ยท 1px solid #f5c80066 border ยท full width ยท centered text.
Resume was previously a thicker-border standout button; it now matches the others.
The "how was this made?" link was restyled to look like a button while remaining an <a> tag.
Each button was wrapped in a .landing-btn-wrap relative container. On hover,
the container shows a .landing-tip tooltip above the button with a title and description:
โถ Start Fresh โ clarifies that honey, BPS, and achievements are NOT reset, only script position
โฉ Resume โ explains saved word position
๐ Daily Rewards โ explains streak doubling and ad retroactive claims
๐ Achievements โ describes the four categories
๐ ๏ธ How Was This Made โ points to the build log
Hovering any button triggers a scale(1.03) + box-shadow glow identical
to the Start Fresh button's existing expand effect. All buttons shrink on click with scale(0.97).
๐ bug โ resume button wrapper hidden state
The Resume button's display:none was moved to its wrapper div so the tooltip and
hover effect don't appear for a button that isn't visible. JS was updated to show/hide the wrapper
by ID (resume-wrap) rather than the button itself.
โ fix
Added id="resume-wrap" to the wrapper and updated both JS call sites
(home-btn handler and initial load check) to target the wrapper.
31. ๐ฐ bee casino
Next to the shop button I need you to make a casino button please >:D time to gamble honey.
A ๐ฐ CASINO button was added to the header next to SHOP. It opens a purple-themed
slide-in panel (same pattern as the shop, but styled with deep purple/violet accents) containing
three gambling mini-games:
๐ฐ Bee Slots โ three animated reels spin with a cascade delay (600ms / 250ms / 250ms).
Six weighted symbols: ๐ (most common) through โ๏ธ (rarest). Payouts: pair = 2ร, three of a kind = 10ร,
three ๐ฏ jackpot = 50ร with a panel flash animation.
๐ช Honey Flip โ pick ๐ BEE or ๐ป FLOWER. 50/50 outcome. Win pays 1.9ร (5% house edge).
๐ฒ High or Low โ roll 1โ10. Guess HIGH (6โ10) or LOW (1โ5). Win pays 1.9ร.
All games share quick-bet buttons: fixed amounts (10, 50, 100) and percentage bets (10%, 50%, ALL IN).
The ALL IN button sets the bet input to your entire current balance. Bets are floor'd to whole numbers,
and the bet is deducted before the animation plays โ no double-spending possible.
The casino balance display stays live via updateCurrencyDisplay().
Opening the casino auto-closes the shop and vice versa.
Two bugs on the landing page: the start fresh button should match the rest of the website buttons. Also remove the leaderboard entirely from the site, and move the header down by 40 pixels, it's cut off from the top of the website.
Three issues addressed in one pass:
START FRESH button mismatch โ the button had a bespoke gold-fill style (background:#f5c800; color:#0a0a00; padding:16px 48px; font-size:1.4rem)
left over from the very first version of the landing page. It was replaced with the same transparent-border style as every other landing button, and the
.landing-btn-wrap hover glow/expand effect now covers it automatically.
Leaderboard removed โ the "coming soon" leaderboard placeholder was removed from both the HTML and CSS.
The JSONBin backend was already stubbed out; this cleans up the dead UI entirely.
Header offset attempt โ reverted โ adding top:40px to the fixed header caused 40px of script content
to show above the bar (visible in a screenshot). All dependent offsets (shop/casino panels top:44โ84px, words padding-top, milestone toast) were
also reverted back to their original values.
34. casino replacement โ blackjack & roulette
Remove all casino games (BEE SLOTS, HONEY FLIP, HIGH OR LOW) and replace with blackjack and roulette ported from a React/TypeScript demo. Use honey instead of money. Style to match bee theme. Blackjack should bet honey per hand slot via chips. Splitting and doubling should cost honey. Natural blackjack pays 3:1. Insurance when dealer shows Ace with auto-decline toggle. Gambling blocked while script is paused.
Ported both games from blackjack-play-demo/src/routes/blackjack.tsx and roulette.tsx to vanilla JS with no framework dependencies.
The casino panel was widened from 320px to 480px to fit the 360px SVG roulette wheel.
A casinoBlocked() helper gates all bet/spin entry points on running && !paused.
Blackjack: 6-deck shoe with Fisher-Yates shuffle; reshuffle at <20 cards remaining.
Before dealing, 3 hand slots accept chip bets (click to add, "clear" to remove); each slot with honey becomes an active hand.
Hit / Stand / Double (deducts same bet again, doubles stake) / Split (deducts again, inserts second hand; limit raised to 8 hands).
Animated deal-in via @keyframes bj-deal-in; hole card reveal via @keyframes bj-flip.
Card animation bug fixed with bjRenderedCards Set โ already-rendered cards get animation:none so only the new card animates on hit.
bjRender() called before bjStartDealerTurn() so double-down face-down card is visible before dealer sequence starts.
Insurance prompts when dealer shows Ace; takes half total bet at 2:1 payout; auto-decline checkbox skips the prompt.
Natural blackjack pays 3:1 (returns 4ร bet).
Roulette: SVG wheel generated from RL_WHEEL_ORDER array with sector paths computed in JS.
Full CSS-grid betting table: 37 numbers, 2:1 column buttons, dozens, outside bets (red/black/even/odd/high/low).
Split (17:1), corner (8:1), and street (11:1) bets placed via hover crossroad dots positioned as grid items in the split columns/rows.
Spin uses CSS transition: transform 4s cubic-bezier(โฆ) on the wheel disc; transitionend event triggers payout.
Canvas particle fireworks on any winning spin.
Honey balance deducted before spin, winnings added after.
Outside-click bug fix: Betting buttons rebuild panel HTML via innerHTML, detaching the clicked element from the DOM.
The old panel.contains(e.target) check returned false for detached nodes, closing the casino on every click inside it.
Fixed by adding e.stopPropagation() at the panel level so clicks inside never reach the document-level close handler.
Chips: 25 / 50 / 100 / 500 / 1000. Max 10,000 honey per hand slot. Cards wrap to a new row when a hand overflows the panel width.
33. auto-scroll pause on user scroll
Scrolling up when I'm listening to the script will push me back down to where the voice is saying words.
In LIST mode, lightWord() calls scrollIntoView({block:'center',behavior:'smooth'}) on every lit word.
This fought any manual scroll โ the page immediately snapped back to the current word.
Fixed with a userScrolled flag. A wheel listener sets the flag when deltaY < 0 (scroll up).
A touchmove listener sets it when the touch Y increases (finger moving down = page scrolling up).
A scroll listener resets a 4-second debounce timer; when the timer fires, userScrolled is cleared and auto-scroll resumes.
lightWord() skips the scrollIntoView call while userScrolled is true, so the user can freely read ahead or back without the page fighting them.
// local storage schema
All persistent progress lives under the key beelieve_progress in localStorage:
beesTotal โ current spendable honey balance
beesCaught โ all-time bees caught by click or virtual mouse
listeningSeconds โ total seconds spent actively listening (not paused)
completions โ number of times the full script was finished
savedLitCount โ word index to resume from (0 if no active session)
claimedDates โ array of ISO date strings for claimed daily rewards
adDays โ array of ISO date strings for days claimed via ad-watch
shop โ object mapping upgrade IDs to owned counts
unlocked โ object mapping achievement IDs to unlock date strings
header top:40px offset โ reverted; content was visible above the fixed bar
Auto-scroll always follows current word โ paused when user scrolls up; resumes 4s after idle
Casino: BEE SLOTS, HONEY FLIP, HIGH OR LOW โ replaced with full blackjack + roulette
Casino outside-click handler closing panel on bets โ fixed with stopPropagation at panel level (detached DOM nodes caused false negatives in contains())
BJ all cards reanimate on hit โ bjRenderedCards Set suppresses bj-deal-in for already-seen cards
BJ double-down face-down card invisible โ bjRender() called before bjStartDealerTurn()