body {
  margin: 0;
  font-family: 'Merriweather', 'Amatic SC', Arial, sans-serif;
  background: linear-gradient(180deg, #fceabb 0%, #f8c291 50%, rgba(255,160,60,0.6) 100%), url('Assets/bg.jpg') no-repeat center center fixed;
  background-size: cover;
  color: #3b2f2f;
  text-align: center;
  cursor: url('Assets/acorn.cur'), auto; /* fallback - if acorn.cur exists */
}


/* App-wide: force non-scrollable layout (hide scrollbars) */
html, body { overflow: hidden; height: 100%; }

body.game-active {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.6)), url('Assets/bg.jpg') no-repeat center center fixed;
  background-size: cover;
}

/* make title more visible */
h1 {
  font-size: 68px; /* larger title */
  font-weight: 900;
  color: #fff9e6; /* brighter text to contrast */
  margin-top: 6px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-shadow: 0 8px 26px rgba(25,10,0,0.55);
  display: inline-block;
  padding: 8px 18px;
  background: linear-gradient(180deg, rgba(40,24,8,0.22), rgba(80,40,12,0.06)); /* subtle stronger backdrop just for title */
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}

/* Make game page headings (inside HUD) look like the main Pumpkin Raider header */
.hud-panel h1, .game-panel header h1 {
  font-size: 44px; /* slightly larger so game names pop */
  font-weight: 900;
  color: #0b0b0b; /* near-black for maximum contrast */
  letter-spacing: 0.6px;
  text-transform: none; /* keep natural casing for readability */
  text-shadow: 0 3px 8px rgba(0,0,0,0.35);
  display: inline-block;
  padding: 6px 14px;
  /* default boxed look removed for game pages via .game-page rules */
}

/* For game pages, show the title cleanly without the white box */
.game-page .hud-panel h1,
.game-page .game-panel header h1,
.pumpkin-page .hud-panel h1 {
  background: transparent !important;
  padding: 6px 8px !important;
  border: none !important;
  border-radius: 0 !important;
  /* Fall-themed title: use a warm serif and near-black text for contrast */
  color: #0b0b0b; /* near-black */
  font-family: 'Merriweather', 'Georgia', serif;
  font-weight: 800;
  letter-spacing: 0.4px;
  font-style: normal;
  text-shadow: 0 2px 6px rgba(160,80,20,0.08); /* subtle warm shadow for depth */
}

/* Pumpkin-specific title styling */
/* Pumpkin title customizations removed (undo). */

/* Game-like display font for Pumpkin page title */
/* Chunky display font for Pumpkin title - use Luckiest Guy for a playful arcade look */
/* Pumpkin uses the same game-page header styling as the Leaf page; no special badge/font */

.site-header {
  /* banner removed - keep header minimal */
  background: transparent;
  color: inherit;
  padding: 6px 0;
  font-size: 1.6rem;
  font-weight: 700;
  text-shadow: none;
}

#soundToggle {
  background: transparent;
  border: none;
  color: #ffd166;
  font-size: 20px;
  cursor: pointer;
  margin-left: 8px;
}
  
#highscore {
  color: #ffd166;
  font-weight: 700;
  margin-top: 6px;
}

/* new highscore animation */
.new-highscore {
  animation: hs-pop 1s ease forwards;
}
.hs-new {
  margin-left: 8px;
  color: #fff3d6;
  font-weight: 800;
}
@keyframes hs-pop {
  0% { transform: scale(1); text-shadow: none; }
  40% { transform: scale(1.2); text-shadow: 0 6px 18px rgba(255,200,80,0.6); }
  100% { transform: scale(1); text-shadow: 0 2px 8px rgba(255,200,80,0.4); }
}

.game-wrap {
  display: flex;
  justify-content: center;
  padding: 18px 0;
}

/* Page-specific: center the GameBoy on game pages */
.game-page .game-wrap,
.pumpkin-page .game-wrap {
  /* Stack the instructions and the GameBoy vertically and center them so
     the GameBoy isn't pushed to the side by the left panel. */
  flex-direction: column;
  justify-content: center; /* center children vertically in viewport */
  align-items: center; /* center children horizontally */
  min-height: calc(100vh - 200px); /* reduce total vertical space so game sits higher */
  padding: 8px 0 12px 0;
  gap: 8px; /* reduce space between header/instructions and GameBoy */
}
.game-page .gameboy,
.pumpkin-page .gameboy {
  margin: 0 auto; /* ensure horizontal center */
  max-width: 92%;
}
.game-page .game-panel,
.pumpkin-page .game-panel {
  width: 100%;
  max-width: 980px; /* keep instructions readable */
  margin-top: 0;
}

/* Pumpkin help toggle (floating) */
.game-help, .pumpkin-help {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffffcc;
  color: #2b1600;
  border: 2px solid rgba(0,0,0,0.08);
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10010;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
}

.game-help:hover, .pumpkin-help:hover { transform: translateY(-2px); }

.game-help-overlay, .pumpkin-help-overlay {
  position: fixed;
  left: 0; right: 0; top: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 10009;
}
.game-help-card, .pumpkin-help-card {
  background: #fffdf6;
  padding: 18px 20px;
  border-radius: 12px;
  max-width: 560px;
  width: calc(100% - 48px);
  box-shadow: 0 18px 40px rgba(0,0,0,0.28);
  position: relative;
  color: #2b1600;
}
.game-help-card h2 { margin-top: 0; }
.help-close { position: absolute; right: 8px; top: 8px; background: transparent; border: none; font-size: 16px; cursor: pointer; }
.game-help-overlay.hidden { display: none; }

.game-panel {
  /* make panel minimal so the GameBoy frame remains the visual focus */
  background: transparent; /* allow the GameBoy frame to be fully visible */
  padding: 8px 0 0 0;
  border-radius: 6px;
  display: inline-block;
  z-index: 10002; /* sit above page background but below fixed HUD */
}
canvas {
  /* keep a dark canvas background so UI text is readable */
  background: rgba(15,23,42,0.7);
  border: 2px solid #e5e7eb;
  display: block;
  margin: 10px auto;
}
.controls {
  margin: 10px;
}

/* main menu styles */
.menu-panel {
  margin: 50px auto;
  padding: 18px;
  max-width: 760px;
  background: linear-gradient(180deg, rgba(255,255,255,0.95), rgba(255,250,240,0.9));
  border-radius: 14px;
  box-shadow: 0 8px 20px rgba(60, 20, 0, 0.2);
}

/* Make 'Choose Your Adventure' visible in a yellow box */
.menu-sub {
  background: linear-gradient(90deg, #ffd84d, #ffcc33);
  color: #2b1600;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.18);
  font-weight: 800;
  display: inline-block;
}

/* Landing / Star Wars-like crawl */
.landing-screen { position: relative; padding: 40px 20px; }
.crawl-container { width: 100%; height: 260px; perspective: 400px; overflow: hidden; display:flex; align-items:center; justify-content:center; }
.crawl { font-family: 'Merriweather', serif; color: #ffd94d; width: 86%; margin: 0 auto; text-align: center; transform-origin: 50% 100%; }
.crawl p { font-size: 22px; line-height: 1.5; margin: 6px 0; font-weight: 800; color: #ffd94d; text-shadow: 0 2px 3px rgba(0,0,0,0.45); }
.crawl p .char { visibility: hidden; display: inline-block; margin-right: 0; opacity: 0; transform: translateY(6px); transition: opacity 120ms linear, transform 120ms ease; }
.crawl p .char.visible { visibility: visible; opacity: 1; transform: translateY(0); }
/* typewriter caret */
.typewriter-caret { display: inline-block; width: 10px; background: #d18b00; margin-left: 6px; animation: blink 1s steps(2,start) infinite; height: 28px; vertical-align: bottom; }
@keyframes blink { 0% { opacity: 1 } 50% { opacity: 0 } 100% { opacity: 1 } }

/* Enter button */
.enter-btn { margin-top: 18px; background: #2fbd63; border: none; padding: 10px 20px; border-radius: 8px; color: white; font-size: 18px; cursor: pointer; }
.enter-btn.fade-in { animation: enterFade 600ms ease forwards; }
@keyframes enterFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* bottom squirrel chat bubble */
.bottom-squirrel { position: fixed; bottom: 18px; left: 20px; display: flex; align-items: center; gap: 8px; z-index: 9999; }
.squirrel-emoji { font-size: 34px; transform-origin: center right; }
.chat-bubble { background: #fff8e6; padding: 10px 14px; border-radius: 12px; box-shadow: 0 8px 18px rgba(0,0,0,0.15); color: #5a3b1f; font-family: 'Shadows Into Light', cursive; }

/* tail swish animation: we fake by rotating the emoji a little */
.squirrel-swish { animation: swish 1s ease-in-out infinite; }
@keyframes swish { 0% { transform: rotate(0deg); } 50% { transform: rotate(-12deg); } 100% { transform: rotate(0deg); } }

/* make squirrel bob/move horizontally */
.squirrel-move { animation: squirrelMove 6s ease-in-out infinite; }
@keyframes squirrelMove {
  0% { transform: translateX(0); }
  25% { transform: translateX(8px); }
  50% { transform: translateX(0); }
  75% { transform: translateX(-6px); }
  100% { transform: translateX(0); }
}

/* visible box around the crawl text */
.crawl-box { display:flex; align-items:center; justify-content:center; width:100%; }
.crawl-box .crawl-container { max-width: 780px; }
.crawl-box { background: rgba(20,12,6,0.78); padding: 22px; border-radius: 12px; box-shadow: 0 14px 30px rgba(0,0,0,0.6); }

/* when a paragraph has been typed, make it visible */
.crawl p.visible { visibility: visible; }

/* Heading emoji animation: gentle bob + rotate for a playful effect */
.heading-emoji {
  display: inline-block;
  margin-left: 8px;
  transform-origin: 50% 50%;
  animation: emoji-bob 2200ms ease-in-out infinite;
}

@keyframes emoji-bob {
  0% { transform: translateY(0px) rotate(0deg); }
  25% { transform: translateY(-4px) rotate(-6deg); }
  50% { transform: translateY(0px) rotate(0deg); }
  75% { transform: translateY(-3px) rotate(6deg); }
  100% { transform: translateY(0px) rotate(0deg); }
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .heading-emoji { animation: none !important; }
}
.menu-title {
  font-size: 34px;
  margin: 6px 0 4px 0;
  color: #fff6e8;
}
.menu-sub {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: #555;
}
.game-cards { display:flex; gap:18px; justify-content:center; flex-wrap:wrap; }
.game-card {
  width: 260px;
  height: 200px;
  background: linear-gradient(180deg, #fff8ef 0%, #fff0dc 100%);
  border-radius: 14px;
  box-shadow: 0 8px 18px rgba(60, 20, 0, 0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, filter 220ms ease;
  border: 2px solid rgba(255,160,60,0.06);
}
.game-card:hover {
  transform: translateY(-8px) rotate(-1deg);
  box-shadow: 0 18px 30px rgba(80, 30, 0, 0.18);
  filter: saturate(1.05);
}
.card-icon { font-size: 60px; margin-bottom: 8px; }
.card-icon { position: relative; width: 84px; height: 84px; display:flex; align-items:center; justify-content:center; }
.card-gif { width: 84px; height: 84px; object-fit: contain; display: block; }
.card-emoji { font-size: 64px; position: absolute; display: none; }
.card-title { font-family: 'Amatic SC', cursive; font-size: 28px; color: #6a3b1e; text-transform: uppercase; letter-spacing: 1px; }

/* Translucent HUD for in-game title, highscore, lives etc. */
.hud-panel {
  display: inline-block;
  background: transparent; /* remove translucent background */
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
  padding: 8px 12px;
  border-radius: 0;
  color: #fff7ec;
  box-shadow: none;
}

/* Exit log button - a small 'log' with a flame icon */
.exit-log {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg,#5a2810,#703216);
  color: #fffaf0;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,220,140,0.12);
  box-shadow: 0 10px 28px rgba(30,12,6,0.45);
  cursor: pointer;
  font-weight: 800;
}
.exit-log .flame { font-size: 18px; transform: translateY(-1px); }
.exit-log small { font-size: 12px; opacity: 0.95; }

/* position exit-log at bottom center on game pages */
.game-wrap .exit-log {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 9999;
}

/* Global override: if `.exit-log` is placed inside the header (or elsewhere),
   pin it to top-right so it appears in the corner consistently. */
.exit-log {
  position: fixed !important;
  right: 18px !important;
  top: 18px !important;
  left: auto !important;
  bottom: auto !important;
  transform: none !important;
  z-index: 10010 !important;
}

/* utility to keep words from breaking across lines */
.no-break { white-space: nowrap; }
.menu-btn[disabled] {
  background: #ccc;
  cursor: not-allowed;
}

/* utility: hidden */
.hidden { display: none !important; }
/* button hover/active states */
.controls button {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.controls button:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}
.controls button:active {
  transform: translateY(0);
  box-shadow: none;
}

/* HUD layout in header */
#hud {
  margin-top: 6px;
}
#hud #score {
  font-size: 16px;
  color: #fff;
}
button {
  background: #22c55e;
  color: white;
  border: none;
  padding: 8px 14px;
  margin: 5px;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
}
/* controls buttons: Start (1), Reset (2), Quit (3) */
.controls button:nth-child(1) {
  background: #22c55e; /* Start - green */
}
.controls button:nth-child(2) {
  background: #f59e0b; /* Reset - amber */
  color: #fff;
}
.controls button:nth-child(3) {
  background: #ef4444; /* Quit - red */
}

/* HUD (score/lives) styling */
#score {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
  margin-top: 8px;
}

.menu-icon {
  width: 40px;
  height: 40px;
}

#mainMenu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: transparent;
  padding: 8px;
  border-radius: 12px;
  box-shadow: none;
}

#npcMascot {
  position: absolute;
  bottom: 10%;
  left: 5%;
  display: flex;
  align-items: center;
  animation: moveSquirrel 10s infinite alternate;
}

#npcMascot img {
  width: 64px;
  height: 64px;
}

#speechBubble {
  background: rgba(255, 255, 255, 0.9);
  border-radius: 8px;
  padding: 10px;
  margin-left: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  font-family: 'Comic Sans MS', cursive;
  font-size: 14px;
  color: #333;
}

@keyframes moveSquirrel {
}

#bgCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1; /* behind menu */
  background: url('Assets/bg.jpg') no-repeat center center fixed; /* Updated background */
  background-size: cover; /* Ensure the image covers the entire canvas */
}

/* loading splash */
.loading-splash {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 250, 240, 0.95);
  color: #6a3b1e;
  padding: 18px 22px;
  border-radius: 10px;
  box-shadow: 0 14px 32px rgba(60, 20, 0, 0.25);
  font-family: 'Amatic SC', cursive;
  font-size: 20px;
  z-index: 9999;
}

/* leaf animation removed per request */

/* create a subtle night mode */
/* night mode removed per user request */

/* extra spacing for words: give a little width before each word (space char) */
.crawl p .char.space { display: inline-block; width: 18px; }

/* squirrel removed from titlebar per request */

/* footer */
.site-footer {
  position: fixed;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 245, 235, 0.7);
  padding: 6px 12px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(60, 20, 0, 0.12);
  font-size: 14px;
  color: #6a3b1e;
}

/* Fixed top-left highscore display - unified style for all games */
#highscore, #gameHighscore, #cnHighscore {
  position: fixed;
  top: 16px; /* slightly lower for better spacing with header */
  left: 18px;
  z-index: 10001;
  background: linear-gradient(180deg, rgba(8,40,8,0.72), rgba(6,30,6,0.56));
  color: #a8ff7a; /* pleasant pale green */
  padding: 10px 14px; /* more breathing room */
  border-radius: 10px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: 0.6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
}

/* Current score shown under the highscore - visually subordinate */
#score, #cnScore, #gameScore {
  position: fixed;
  top: 64px; /* below the highscore box */
  left: 18px;
  z-index: 10001;
  background: linear-gradient(180deg, rgba(10,50,10,0.34), rgba(6,30,6,0.24));
  color: #eaffd6; /* softer off-white-green for readability */
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.34);
}

/* GameBoy frame wrapper - put the canvas inside the visible screen area of the frame */
.gameboy {
  /* Pure-CSS GameBoy frame: outer bezel */
  position: relative;
  width: 420px; /* slightly smaller so surrounding controls are visible */
  max-width: 86vw;
  aspect-ratio: 12 / 17; /* slightly squatter to fit better */
  margin: 0 auto;
  display: block;
  background: linear-gradient(180deg, #e6d5b8 0%, #d6b88a 100%);
  border-radius: 16px;
  padding: 14px; /* tighter bezel to reduce footprint */
  box-shadow: 0 14px 36px rgba(0,0,0,0.42), inset 0 6px 10px rgba(255,255,255,0.2);
  border: 5px solid rgba(40,28,18,0.10);
  z-index: 10003; /* ensure GameBoy sits above translucent panels so buttons are clickable */
}
.gameboy::before {
  /* little speaker grille at top */
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 12px;
  width: 120px;
  height: 10px;
  border-radius: 6px;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,0.08) 0 4px, rgba(0,0,0,0.02) 4px 8px);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.25);
}
.gameboy::after {
  /* brand badge */
  content: 'PUMPKIN';
  position: absolute;
  right: 18px;
  top: 14px;
  font-size: 12px;
  color: rgba(20,12,6,0.8);
  font-weight: 800;
  letter-spacing: 1px;
  opacity: 0.9;
}
.gameboy .gb-screen {
  /* the visible glass area where the canvas sits */
  position: relative;
  width: calc(100% - 60px);
  height: calc(100% - 140px);
  margin: 28px auto 10px auto;
  background: linear-gradient(180deg, rgba(10,12,14,0.9), rgba(20,24,30,0.85));
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 8px 18px rgba(255,255,255,0.02), 0 6px 18px rgba(0,0,0,0.35);
}
.gameboy .gb-screen::after {
  /* subtle glass glare */
  content: '';
  position: absolute;
  left: -20%;
  top: -10%;
  width: 60%;
  height: 60%;
  transform: rotate(-18deg);
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.02));
  filter: blur(10px);
  opacity: 0.9;
  pointer-events: none;
}
.gameboy .gb-screen canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  background: transparent !important; /* let the game's canvas draw its own background if desired */
}

/* decorative buttons / directional pad area */
.gameboy .gb-controls {
  display:flex;
  gap:12px;
  justify-content:center;
  align-items:center;
  margin-top: 10px;
}
.gb-dpad {
  width: 74px;
  height: 74px;
  background: linear-gradient(180deg,#2b2b2b,#111);
  border-radius: 12px;
  box-shadow: inset 0 6px 10px rgba(255,255,255,0.04), 0 6px 18px rgba(0,0,0,0.4);
}
.gb-button {
  width: 36px;
  height: 36px;
  background: radial-gradient(circle at 30% 30%, #ffd07a, #ff8a33);
  border-radius: 50%;
  box-shadow: 0 6px 12px rgba(0,0,0,0.45), inset 0 -3px 6px rgba(0,0,0,0.12);
}

/* responsive tweaks */
@media (max-width: 720px) {
  .gameboy { width: 320px; }
}

