:root {
  --paper: #f4e9d0;
  --wood: #6b4423;
  --red: #c0201f;
  --gold: #ffcf4d;
  --green: #3a7d2e;
  --ink: #2a1c10;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #160d08;
  font-family: 'Bricolage Grotesque', sans-serif; color: var(--paper);
  -webkit-user-select: none; user-select: none; touch-action: none; }
#scene-container { position: fixed; inset: 0; }
canvas { display: block; }
.hidden { display: none !important; }

/* ---- scanline CRT overlay ---- */
.scanlines { position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.14) 0px, rgba(0,0,0,0.14) 1px, transparent 2px, transparent 4px);
  mix-blend-mode: multiply; opacity: 0.5; }

/* ================= HUD ================= */
#hud { position: fixed; inset: 0; z-index: 20; pointer-events: none;
  font-family: 'JetBrains Mono', monospace; }
#hud-top-left { position: absolute; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 8px; }
.led-panel { background: rgba(20,12,6,0.75); border: 2px solid var(--gold);
  border-radius: 8px; padding: 4px 12px; display: flex; align-items: baseline; gap: 10px;
  box-shadow: 0 0 12px rgba(255,207,77,0.25); }
.led-label { font-size: 10px; letter-spacing: 1px; color: #d8b060; }
.led-value { font-size: 22px; font-weight: 700; color: var(--gold);
  text-shadow: 0 0 8px rgba(255,207,77,0.7); }

#hud-top-right { position: absolute; top: 14px; right: 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.happy-wrap { background: rgba(20,12,6,0.75); border: 2px solid var(--gold); border-radius: 8px; padding: 6px 10px; width: 170px; }
.happy-bar { height: 12px; background: #3a2416; border-radius: 6px; overflow: hidden; margin-top: 4px; }
#happy-fill { height: 100%; width: 100%; background: #4ade80; transition: width 0.3s, background 0.3s; }
#minimap { border: 2px solid var(--gold); border-radius: 8px; background: #140c06;
  box-shadow: 0 0 12px rgba(255,207,77,0.2); }

#prompt-bar { position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%);
  background: rgba(20,12,6,0.82); border: 2px solid var(--red); color: #fff;
  padding: 8px 20px; border-radius: 30px; font-size: 16px; font-weight: 700; min-height: 20px;
  text-shadow: 0 1px 2px #000; transition: opacity 0.2s; }
#prompt-bar:empty { opacity: 0; }

.tip-flash { position: fixed; top: 45%; left: 50%; transform: translate(-50%,-50%);
  font-family: 'JetBrains Mono', monospace; font-size: 42px; font-weight: 700; color: var(--gold);
  text-shadow: 0 0 14px rgba(255,207,77,0.9), 0 2px 4px #000; z-index: 40; pointer-events: none;
  animation: tipfly 0.9s ease-out forwards; }
@keyframes tipfly { 0% { opacity: 0; transform: translate(-50%,-30%) scale(0.6); }
  25% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-90%) scale(1.1); } }

/* ============= mobile controls ============= */
#mobile-controls { position: fixed; inset: 0; z-index: 25; pointer-events: none; }
#joystick { position: absolute; bottom: 30px; left: 30px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255,207,77,0.12); border: 2px solid rgba(255,207,77,0.5);
  pointer-events: auto; }
#stick { position: absolute; top: 35px; left: 35px; width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255,207,77,0.6); }
#action-btn { position: absolute; bottom: 44px; right: 30px; width: 96px; height: 96px;
  border-radius: 50%; background: var(--red); color: #fff; border: 3px solid var(--gold);
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 16px; pointer-events: auto;
  box-shadow: 0 0 16px rgba(192,32,31,0.6); }

/* ============= start / end screens ============= */
#start-screen, #end-screen { position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 24px; gap: 16px; overflow-y: auto;
  background:
    radial-gradient(circle at 50% 20%, rgba(255,207,77,0.12), transparent 60%),
    linear-gradient(160deg, #2a1206, #160d08 60%, #0f0a05);
}
.marquee { animation: flicker 4s infinite; }
.neon-sign { font-size: clamp(38px, 9vw, 90px); font-weight: 800; letter-spacing: 2px;
  color: #fff; text-shadow: 0 0 8px var(--red), 0 0 22px var(--red), 0 0 40px #ff5c2a; }
.neon-sub { font-size: clamp(20px, 5vw, 44px); font-weight: 700; margin-top: 4px;
  color: var(--gold); text-shadow: 0 0 8px var(--gold), 0 0 24px rgba(255,207,77,0.6); }
@keyframes flicker { 0%,19%,21%,23%,80%,100% { opacity: 1; } 20%,22% { opacity: 0.5; } }
.tagline { font-family: 'JetBrains Mono', monospace; color: #d8b060; font-size: 14px; letter-spacing: 1px; }
.story { max-width: 480px; font-size: 15px; line-height: 1.5; color: #e9d9b8;
  background: rgba(0,0,0,0.3); border-left: 3px solid var(--red); padding: 12px 16px; border-radius: 6px; text-align: left; }

#start-btn, #again-btn { font-family: 'Bricolage Grotesque', sans-serif; font-weight: 800;
  font-size: 20px; padding: 14px 30px; background: var(--red); color: #fff;
  border: 3px solid var(--gold); border-radius: 12px; cursor: pointer; letter-spacing: 1px;
  box-shadow: 0 6px 0 #7a1010, 0 0 20px rgba(192,32,31,0.5); transition: transform 0.1s; }
#start-btn:active, #again-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #7a1010; }

.controls-legend { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #cbb58c;
  max-width: 520px; line-height: 1.7; background: rgba(0,0,0,0.25); padding: 10px 14px; border-radius: 8px; }
#loading-note { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: #8a7550; }

#end-title { font-size: clamp(30px, 7vw, 60px); font-weight: 800; color: var(--gold);
  text-shadow: 0 0 20px rgba(255,207,77,0.6); }
#end-summary { font-size: 17px; line-height: 1.6; color: #e9d9b8; max-width: 440px; }
#end-summary b { color: var(--gold); }
.lb-title { font-size: 22px; color: #fff; }
#leaderboard { width: min(360px, 90vw); font-family: 'JetBrains Mono', monospace; }
.lb-row { display: flex; justify-content: space-between; padding: 6px 12px;
  border-bottom: 1px dashed rgba(255,207,77,0.3); font-size: 15px; }
.lb-row span:last-child { color: var(--gold); font-weight: 700; }
.lb-note { font-size: 11px; color: #8a7550; padding-top: 8px; text-align: center; }

.footer { margin-top: 14px; font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.footer a { color: var(--gold); text-decoration: none; border-bottom: 1px dotted var(--gold); }
.footer a:hover { color: #fff; }
</parameter>
</invoke>