  html, body { margin: 0; padding: 0; overflow: hidden; background: #140d2e; height: 100%; font-family: "DynaPuff", "Comic Sans MS", "Segoe UI", Arial, sans-serif; user-select: none; -webkit-user-select: none; }
  canvas { display: block; touch-action: none; }
  #hud { position: fixed; top: 14px; left: 16px; color: #cfe8ff; pointer-events: none; }
  #hud h1 { font-family: "Fascinate Inline", cursive; font-size: clamp(28px, 4vw, 50px); font-weight: 400; line-height: 1.05; max-width: calc(100vw - 160px); margin: 0 0 4px; letter-spacing: 2px; color: #ffd166; }
  #hud p { font-size: 32px; margin: 3px 0; opacity: 0.95; font-weight: 700; }
  #stars.bump { animation: pop 0.35s ease-out; }
  #runstars { font-size: 19px !important; opacity: 0.7 !important; margin-top: 0 !important; }
  #hint { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); color: #fff; background: rgba(20,13,46,0.6); border: 1px solid rgba(120,200,255,0.35); padding: 8px 16px; border-radius: 10px; font-size: 13px; letter-spacing: 0.5px; transition: opacity 1s; pointer-events: none; }
  #debug-labels { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
  #debug-labels .dbg { position: absolute; top: 0; left: 0; transform: translate(-50%, -100%); background: rgba(10,8,28,0.85); border: 1px solid rgba(120,200,255,0.5); color: #9fe8ff; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; font-family: 'JetBrains Mono', monospace; }
  #flash { position: fixed; inset: 0; background: radial-gradient(ellipse at center, rgba(140,210,255,0.25), rgba(20,60,140,0.65)); opacity: 0; pointer-events: none; transition: opacity 0.6s; }
  #flash.show { opacity: 1; transition: opacity 0.05s; }
  #win { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; flex-direction: column; gap: 12px; overflow-y: auto; box-sizing: border-box; padding: 24px 16px; background: rgba(10,8,28,0.76); color: #fff; text-align: center; z-index: 10; }
  #win.show { display: flex; }
  #win h1 { font-size: clamp(36px, 6vw, 76px); margin: 0; font-weight: 900; background: linear-gradient(90deg, #ffd166, #ff8c42, #ff4d6d, #9b5de5); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 20px rgba(255,140,66,0.8)); animation: pop 0.6s ease-out; }
  #win p { font-size: 22px; margin: 0; color: #d8f6ff; font-weight: 700; letter-spacing: 0.5px; }
  #winSplits { display: grid; grid-template-columns: repeat(2, minmax(155px, 1fr)); gap: 5px 20px; width: min(480px, 100%); padding: 13px 18px; box-sizing: border-box; border: 1px solid rgba(124,246,255,0.4); border-radius: 16px; background: rgba(20,13,46,0.84); font: 700 15px/1.4 "Segoe UI", sans-serif; }
  #winSplits .split { display: flex; justify-content: space-between; gap: 12px; white-space: nowrap; }
  #winSplits .split span:last-child { color: #ffd166; }
  @media (max-width: 410px) { #winSplits { grid-template-columns: 1fr; } }
  #win button { font-size: 20px; padding: 12px 34px; border: none; border-radius: 14px; background: #2dd4bf; color: #04211d; cursor: pointer; font-weight: 800; letter-spacing: 0.5px; box-shadow: 0 0 18px rgba(45,212,191,0.6); }
  #win button:hover { background: #4fe6d3; }
  #win .row { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
  #win .storebtn { font-size: 20px; padding: 12px 34px; border-radius: 14px; background: #3b3b6b; color: #cfe8ff;
                   font-weight: 800; letter-spacing: 0.5px; text-decoration: none; }
  #win .storebtn:hover { background: #4b4b84; }
  /* #hud is pointer-events: none, so this sits outside it and re-enables them. */
  #storelink { position: fixed; top: 16px; right: 18px; z-index: 6; color: #ffd166; text-decoration: none;
               font-size: 15px; font-weight: 800; letter-spacing: 0.5px; background: rgba(20,13,46,0.6);
               border: 1px solid rgba(255,209,102,0.35); border-radius: 10px; padding: 7px 14px; }
  #storelink:hover { background: rgba(40,28,80,0.85); }
  #lvlclear { position: fixed; top: 34%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 900; letter-spacing: 2px; background: linear-gradient(90deg, #ffd166, #ff8c42, #ff4d6d, #9b5de5); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 18px rgba(255,209,102,0.8)); opacity: 0; pointer-events: none; z-index: 9; white-space: nowrap; }
  #lvlclearMain { font-size: 72px; }
  #lvlclearSub { font-size: 30px; letter-spacing: 3px; }
  #lvlclear.show { animation: clearpop 2.6s ease-out forwards; }
  @keyframes clearpop { 0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; } 22% { transform: translate(-50%, -50%) scale(1); opacity: 1; } 78% { opacity: 1; } 100% { transform: translate(-50%, -62%) scale(1.05); opacity: 0; } }
  #win .record { color: #ffd166; text-shadow: 0 0 12px rgba(255,209,102,0.9); }
  #jump { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; background: rgba(10,8,28,0.6); color: #fff; z-index: 12; }
  #jump.show { display: flex; }
  #jump .box { background: rgba(20,13,46,0.95); border: 1px solid rgba(120,200,255,0.4); border-radius: 14px; padding: 22px 28px; text-align: center; }
  #jump h2 { margin: 0 0 14px; font-size: 26px; }
  #jump input { font: inherit; font-size: 20px; padding: 8px 12px; border-radius: 8px; border: 1px solid rgba(120,200,255,0.5); background: #140d2e; color: #cfe8ff; width: 220px; text-align: center; outline: none; }
  #jump .row { margin-top: 14px; display: flex; gap: 10px; justify-content: center; }
  #jump button { font: inherit; font-size: 17px; padding: 8px 22px; border: none; border-radius: 10px; cursor: pointer; font-weight: 800; }
  #jump-go { background: #2dd4bf; color: #04211d; }
  #jump-go:hover { background: #4fe6d3; }
  #jump-cancel { background: #3b3b6b; color: #cfe8ff; }
  #jump .small { font-size: 12px; opacity: 0.75; margin: 12px 0 0; line-height: 1.5; }
  @keyframes pop { 0% { transform: scale(0.2); opacity: 0; } 80% { transform: scale(1.15); } 100% { transform: scale(1); opacity: 1; } }

/* Persistent lesson and charge display, only visible in The Stormworks. */
#dash-hud {
  position: fixed; bottom: 72px; left: 50%; transform: translateX(-50%);
  z-index: 8; width: min(510px, calc(100vw - 44px)); box-sizing: border-box;
  padding: 12px 18px; border: 1px solid #7cf6ff88; border-radius: 14px;
  background: #10172de8; color: #ecfbff; text-align: center;
  font: 14px/1.45 "Segoe UI", sans-serif; pointer-events: none;
}
#dash-hud[hidden] { display: none; }
#dash-status { display: block; color: #a4ff68; letter-spacing: 1px; }
#dash-hud span { font-size: 12px; color: #b8d3e9; }
#dash-lesson { margin: 6px 0 0; }
#glide-hud { position: fixed; bottom: 180px; left: 50%; transform: translateX(-50%);
  z-index: 8; padding: 8px 16px; border: 1px solid #9de8ff; border-radius: 14px;
  background: #10284de8; color: #d9f8ff; font: 800 14px "Segoe UI", sans-serif;
  letter-spacing: 1px; pointer-events: none; }
#glide-hud[hidden] { display: none; }
#glide-hud span { font-size: 22px; vertical-align: -2px; margin-right: 5px; }
#glide-time { margin-left: 8px; }
