:root {
  --bg: #FFF4DC; --ink: #2B1B12; --muted: #6B5444; --accent: #7B3F9E; --accent-deep: #4A2260;
  --card: #FFFBF0; --wood: #B5713A; --wood-dark: #7A4421; --board: #24352C; --chalk: #F3EEDC;
  --px: 4px; /* one art pixel at the default scale */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #1B1224; --ink: #F3E6C8; --muted: #B9A6C9; --accent: #C9A0E0; --accent-deep: #9B6BB5; --card: #2A1E36; }
}
/* In the dark theme the art's near-black outlines vanish, so give stage sprites a pale pixel rim */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stage :is(img[data-spr], #berries) { filter: var(--rim); } }
:root[data-theme="dark"] .stage :is(img[data-spr], #berries) { filter: var(--rim); }
:root { --rim: drop-shadow(2px 0 0 rgba(243, 230, 200, .55)) drop-shadow(-2px 0 0 rgba(243, 230, 200, .55)) drop-shadow(0 2px 0 rgba(243, 230, 200, .55)) drop-shadow(0 -2px 0 rgba(243, 230, 200, .55)); }
:root[data-theme="dark"] { --bg: #1B1224; --ink: #F3E6C8; --muted: #B9A6C9; --accent: #C9A0E0; --accent-deep: #9B6BB5; --card: #2A1E36; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 18px/1.5 "Pixelify Sans", system-ui, sans-serif; overflow-x: hidden; }
img[data-spr] { image-rendering: pixelated; display: block; }
a { color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 3px dashed var(--accent); outline-offset: 3px; }

/* Awning: tiled pixel sprite set from JS */
.awning { height: 48px; background-repeat: repeat-x; background-size: auto 48px; image-rendering: pixelated; position: relative; z-index: 3; }
/* Gemini's awning has end caps and perspective, so it's shown once, stretched across the page */
.awning.art { height: clamp(56px, 8vw, 120px); background-repeat: no-repeat; background-size: 100% 100%; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 8px clamp(16px, 4vw, 48px); gap: 16px; position: relative; z-index: 3; }
.brand { display: flex; align-items: center; gap: 10px; font: 700 20px/1 "Silkscreen", monospace; color: var(--ink); text-decoration: none; } /* Pixelify's Z reads as a 2 */
.brand img { width: 27px; }
nav { display: flex; align-items: center; gap: 20px; font-family: "Silkscreen", monospace; font-size: 15px; }
nav a { color: var(--ink); }
.counter { display: inline-flex; align-items: center; gap: 6px; background: var(--card); padding: 4px 10px; box-shadow: 0 -3px 0 var(--ink), 0 3px 0 var(--ink), -3px 0 0 var(--ink), 3px 0 0 var(--ink); }
.counter img { width: 21px; }
.counter.bump { animation: bump .3s steps(3); }

/* Stage */
.stage { --k: 1; --kb: 1; --kt: 1; --kf: 1; position: relative; min-height: max(640px, calc(100svh - 110px)); overflow: hidden; touch-action: pan-y; }
#berries { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; } /* a canvas is sized by its pixels unless told otherwise, which doubles it on 2x screens */
.counter-top { position: absolute; left: 0; right: 0; bottom: 0; height: 64px; z-index: 1;
  background:
    repeating-linear-gradient(90deg, transparent 0 156px, var(--wood-dark) 156px 160px),
    linear-gradient(var(--ink) 0 4px, #D08A4E 4px 12px, var(--wood) 12px 52px, var(--wood-dark) 52px);
}

.banana-hang { position: absolute; left: clamp(12px, 5vw, 80px); top: -4px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; }
.hang-string { width: 4px; height: 40px; background: var(--ink); }
.tag-rig { position: absolute; left: 0; top: 0; transform-origin: 0 0; z-index: 5; }
.tag-string { position: absolute; left: -2px; top: 0; width: 3px; height: 70px; background: var(--ink); }
.tag { position: absolute; display: block; text-decoration: none; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.tag:active { cursor: grabbing; }
.tag span { position: absolute; white-space: nowrap; font: 700 14px/1 "Silkscreen", monospace; color: #2B1B12; } /* placed on the paper by app.js */

.hero-copy { position: relative; z-index: 2; margin-left: clamp(190px, 21vw, 330px); margin-right: clamp(16px, 4vw, 48px); max-width: 620px; padding-top: clamp(32px, 7vh, 88px); }
.eyebrow { font: 15px/1 "Silkscreen", monospace; color: var(--accent); margin: 0 0 16px; text-transform: uppercase; letter-spacing: .05em; }
h1 { font: 700 clamp(2.4rem, 5.6vw, 4.4rem)/1.02 "Pixelify Sans", sans-serif; margin: 0 0 20px; letter-spacing: -.01em; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.3rem); color: var(--muted); margin: 0 0 20px; max-width: 34ch; }
.hint { font: 13px/1.6 "Silkscreen", monospace; color: var(--muted); margin: 0; opacity: .85; }

/* Basket */
/* Layers, back to front: basket (with its dark opening and handle), back-row fruit, front-row fruit,
   basket-front (just the front rim and body), so the fruit sits inside the basket. */
.basket-wrap { position: absolute; right: clamp(16px, 9vw, 160px); bottom: 34px; z-index: 2; }
.basket { position: relative; z-index: 0; pointer-events: none; }
.basket-front { position: absolute; left: 0; top: 0; width: 100%; z-index: 3; pointer-events: none; }
.fruit { position: absolute; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .18s steps(3); }
.fruit[data-tool="2"] { left: 24%; bottom: 47%; z-index: 1; }
.fruit[data-tool="3"] { left: 47%; bottom: 50%; z-index: 1; }
.fruit[data-tool="0"] { left: 5%; bottom: 37%; z-index: 2; }
.fruit[data-tool="1"] { left: 63%; bottom: 36%; z-index: 2; }
.fruit:hover, .fruit:focus-visible { transform: translateY(-14px) rotate(-4deg); }
.fruit.out { transform: translateY(-96px) rotate(8deg); z-index: 4; animation: pop .45s steps(6); }
.basket-wrap.bump .basket, .basket-wrap.bump .basket-front { animation: bump .3s steps(3); }

.card { position: absolute; bottom: calc(100% + 96px); right: -8px; width: min(320px, calc(100vw - 32px)); background: var(--card); padding: 16px 18px 14px; z-index: 6;
  box-shadow: 0 -4px 0 var(--ink), 0 4px 0 var(--ink), -4px 0 0 var(--ink), 4px 0 0 var(--ink), 8px 8px 0 var(--accent-deep); animation: pop .25s steps(4); }
.card h2 { font: 700 20px/1.2 "Silkscreen", monospace; margin: 0 0 6px; padding-right: 24px; }
.card p { margin: 0 0 10px; color: var(--muted); font-size: 16px; }
.card a { font-family: "Silkscreen", monospace; font-size: 14px; }
.card-close { position: absolute; top: 6px; right: 8px; border: 0; background: none; font: 700 24px/1 "Silkscreen", monospace; color: var(--ink); cursor: pointer; }

/* Chalkboard */
.board-wrap { padding: 64px clamp(16px, 4vw, 48px); }
.board { max-width: 960px; margin: 0 auto; background: var(--board); color: var(--chalk); padding: clamp(20px, 4vw, 40px);
  box-shadow: 0 0 0 8px var(--wood), 0 0 0 12px var(--ink), 12px 16px 0 12px rgba(0,0,0,.18); }
.board h2 { font: 400 clamp(1.4rem, 3vw, 2rem)/1.2 "Silkscreen", monospace; margin: 0 0 24px; }
.board ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px 32px; }
.board li { display: flex; gap: 14px; align-items: flex-start; }
.board li img { width: 56px; flex: none; }
.board a { color: #FFD93D; font: 700 19px/1.3 "Silkscreen", monospace; }
.board p { margin: 4px 0 0; color: #CFC8B4; font-size: 16px; }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding: 24px clamp(16px, 4vw, 48px) 32px; font: 14px "Silkscreen", monospace; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--card); color: var(--ink); padding: 12px 18px; z-index: 20; max-width: calc(100vw - 32px);
  font: 15px/1.4 "Silkscreen", monospace; box-shadow: 0 -4px 0 var(--ink), 0 4px 0 var(--ink), -4px 0 0 var(--ink), 4px 0 0 var(--ink), 6px 6px 0 var(--accent-deep); animation: pop .3s steps(4); }
.plus { position: absolute; z-index: 7; font: 700 18px "Silkscreen", monospace; color: var(--accent); pointer-events: none; animation: rise .8s steps(8) forwards; }

@keyframes pop { from { transform: scale(.6); opacity: 0; } }
@keyframes bump { 50% { transform: translateY(4px) scaleY(.94); } }
@keyframes rise { to { transform: translateY(-40px); opacity: 0; } }

@media (max-width: 760px) {
  .stage { min-height: 820px; --k: .7; --kb: .55; --kt: .6; --kf: .52; }
  .brand { font-size: 15px; }
  .hang-string { height: 24px; }
  .hero-copy { margin-left: 96px; padding-top: 24px; }
  .basket-wrap { right: 50%; transform: translateX(50%); }
  .card { right: 50%; transform: translateX(50%); bottom: calc(100% + 80px); }
  nav a { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
