* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #2a3a3a;
  font-family: m6x11, monospace;
}

#wrap {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e2a2a;
}

#game {
  display: block;
  background: #C8DCE0;
  width: min(100vw, calc(100vh * 9 / 16));
  height: min(100vh, calc(100vw * 16 / 9));
  max-width: 420px;
  max-height: 100vh;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  cursor: grab;
  /* v0.1.25: CSS upscale from 360×640 → ≤420px without pixelated → Chrome bilinear hairlines while pan */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  touch-action: none; /* never let browser pan/zoom steal the steer finger */
  -ms-touch-action: none;
}

#game:active {
  cursor: grabbing;
}

#hud {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, calc(100vh * 9 / 16), 420px);
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  row-gap: 2px;
  pointer-events: none;
  color: #3d5a5a;
  font-weight: 700;
  text-shadow: 0 1px 0 rgba(245, 230, 200, 0.8);
  z-index: 2;
}

#score {
  font-size: 16px;
  letter-spacing: 0px;
}

#hiscore {
  font-size: 16px;
  opacity: 0.85;
}

#coin-wrap {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0px;
  color: #8a6a18;
  opacity: 0.95;
  margin: 0 8px;
}

#coin-glyph {
  color: #c9a227;
  font-size: 16px;
}


#vitals {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #c45a5a;
  opacity: 0.95;
  margin: 0 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

#health.hearts,
#health {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: #d45a5a;
  text-shadow: none;
  line-height: 0;
}

#health .hud-heart {
  width: 18px;
  height: 18px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
  flex-shrink: 0;
}

#lives {
  color: #3d6b6b;
  letter-spacing: 1px;
  font-size: 16px;
}

/* 0.2.9 fuel gauge (fuel mode): Shiela's car-style gauge, 64x14 CSS px at 1:1 (hud_layout.json).
   frame (0,0) → fill strip (12,2) w = f<=0 ? 0 : max(1, round(40f)) → overlay (ticks + E + F) (0,0). */
#fuel {
  display: inline-block;
  position: relative;
  width: 64px;
  height: 14px;
  vertical-align: middle;
  background: url(assets/hud/hud_fuel_frame.png) 0 0 / 64px 14px no-repeat;
  image-rendering: pixelated;
}
#fuel.hidden { display: none; }
#vitals:has(> #fuel:not(.hidden)) { opacity: 1; } /* gauge colours exactly as authored */
#fuel-fill {
  position: absolute;
  left: 12px;
  top: 2px;
  width: 0;
  height: 10px;
  background: url(assets/hud/hud_fuel_fill_slice.png) 0 0 / 1px 10px repeat-x;
  image-rendering: pixelated;
}
#fuel::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 64px;
  height: 14px;
  background: url(assets/hud/hud_fuel_overlay.png) 0 0 / 64px 14px no-repeat;
  image-rendering: pixelated;
}
/* f < 0.25: red fill + E flash at 2.5 Hz (200 ms on / 200 ms off, starts on); .off = flash-off phase */
#fuel.low #fuel-fill { background-image: url(assets/hud/hud_fuel_fill_low_slice.png); }
#fuel.low::after { background-image: url(assets/hud/hud_fuel_overlay_low.png); }
#fuel.low.off #fuel-fill { background-image: url(assets/hud/hud_fuel_fill_low_off_slice.png); }
#fuel.low.off::after { background-image: url(assets/hud/hud_fuel_overlay_low_off.png); }

#lives-sep { /* 0.9.14 #14: m6x11 has no U+00B7, so the "·" fell back to a system font; now a 2x2 px dot in the same colour */
  display: inline-block;
  width: 2px;
  height: 2px;
  margin: 0 3px;
  vertical-align: middle;
  color: #8a9e9e;
  background: currentColor; /* the HUD gold from ui/px_dialogs_0800.css, like the "·" it replaces */
  opacity: 0.7;
}


#overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 70, 70, 0.45);
  z-index: 4;
  padding: 20px;
}

#overlay.hidden {
  display: none;
}

#overlay-card {
  background: #F5E6C8;
  color: #2f4a4a;
  border-radius: 18px;
  padding: 28px 24px;
  max-width: 300px;
  width: 100%;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  border: 3px solid #7eb8b8;
  max-height: min(92vh, 640px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

#overlay-card h1 {
  font-size: 32px;
  margin-bottom: 10px;
  color: #3d6b6b;
}

#overlay-card p {
  font-size: 16px;
  line-height: 1.45;
  margin-bottom: 18px;
  opacity: 0.92;
}

#start-btn, #overlay {
  touch-action: manipulation;
}

#start-btn {
  appearance: none;
  border: none;
  background: #e07a6a;
  color: #fff8f0;
  font-weight: 800;
  font-size: 16px;
  padding: 12px 28px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 0 #b85a4e;
}

#start-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #b85a4e;
}

#proto-version {
  flex: 1 0 100%;
  order: 3;
  margin-top: 1px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  text-align: center;
  opacity: 0.72;
  color: #3d5a5a;
  text-shadow: 0 1px 0 rgba(245, 230, 200, 0.8);
}

#overlay-version {
  margin-top: 14px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  opacity: 0.65;
  color: #3d5a5a;
}


/* --- v0.8.0 Marketing / stamps / share --- */
#stamp-progress {
  flex: 1 0 100%;
  order: 2;
  margin-top: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0px;
  text-align: center;
  color: #3D5A5C;
  opacity: 0.88;
}

#proto-version {
  order: 4;
}

#overlay-card {
  max-width: 320px;
  padding: 22px 18px 24px;
}

#share-card {
  margin: 0 auto 12px;
  padding: 0;
  background: transparent;
  border: none;
  color: #3D5A5C;
  text-align: center;
}

#share-card .share-pc {
  position: relative;
  margin: 0 auto;
  padding: 14px 16px 16px;
  max-width: 280px;
  background: #F5E6C8;
  border: 3px solid #B47830;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px #E8C460;
  overflow: hidden;
}

#share-card .share-pc-stamp {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 48px;
  height: 48px;
  background: #EDE4D4;
  border: 2px dashed #B47830;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  image-rendering: pixelated;
}

#share-card .share-pc-stamp img {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 36px;
  height: 36px;
}

#share-card .share-postmark {
  position: absolute;
  bottom: 10px;
  right: 12px;
  width: 36px;
  height: 36px;
  border: 2px solid #E07A6A;
  border-radius: 50%;
  color: #E07A6A;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transform: rotate(-12deg);
}

#share-card.hidden {
  display: none;
}

#share-card .share-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #7BA8A0;
  margin-bottom: 4px;
}

#share-card .share-meters {
  font-size: 32px;
  font-weight: 800;
  color: #3D5A5C;
  line-height: 1.1;
}

#share-card .share-meta {
  font-size: 16px;
  margin-top: 4px;
  opacity: 0.85;
}

#share-card .share-stamps {
  font-size: 16px;
  margin-top: 6px;
  color: #C9A227;
  font-weight: 700;
}

#stamp-atlas {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 12px;
}

#stamp-atlas.hidden {
  display: none;
}

.stamp-slot {
  background: #EDE4D4;
  border: 2px solid #D4C4A8;
  border-radius: 8px;
  padding: 6px 2px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.stamp-slot.unlocked {
  border-color: #E8C460;
  background: #F5E6C8;
}

.stamp-slot.fresh {
  box-shadow: 0 0 0 2px #E07A6A;
}

.stamp-slot.locked {
  opacity: 0.45;
}

.stamp-badge {
  font-size: 16px;
  line-height: 1;
  color: #C9A227;
}

.stamp-slot.locked .stamp-badge {
  color: #7BA8A0;
}

.stamp-label {
  font-size: 16px;
  font-weight: 700;
  color: #3D5A5C;
}

.daily-line {
  font-size: 16px !important;
  margin-bottom: 12px !important;
  color: #3D5A5C;
  opacity: 0.9;
}

#overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

#share-btn {
  appearance: none;
  border: 2px solid #7BA8A0;
  background: #F5E6C8;
  color: #3D5A5C;
  font-weight: 800;
  font-size: 16px;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
}

#share-btn.hidden {
  display: none;
}

#share-btn:active {
  transform: translateY(1px);
}


/* --- v0.8.3 Milestone freeze postcard (Shiela) --- */
#milestone-card {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(61, 90, 92, 0.38);
  pointer-events: auto;
  cursor: pointer;
}

#milestone-card.hidden {
  display: none;
}

#milestone-card .pc-board {
  width: min(92vw, 300px);
  pointer-events: none;
}

#milestone-card .pc-rim {
  position: relative;
  background: #F5E6C8;
  border: 3px solid #B47830;
  border-radius: 3px;
  padding: 14px 14px 16px;
  box-shadow: inset 0 0 0 2px #E8C460;
  overflow: hidden;
}

/* Thin UL gold_highlight on rim corners only — no drop shadow / neon */
#milestone-card .pc-ul-hi {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  border-top: 3px solid #FFF8DC;
  border-left: 3px solid #FFF8DC;
  pointer-events: none;
  opacity: 0.95;
}

#milestone-card .pc-stamp-inset {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 72px;
  height: 84px;
  background: #EDE4D4;
  border: 2px solid #3D5A5C;
  border-radius: 2px;
  overflow: hidden;
}

/* Perforated postage motif */
#milestone-card .pc-stamp-perf {
  position: absolute;
  inset: -2px;
  border: 2px dashed #B47830;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0.9;
}

#milestone-card .pc-cavern {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  background: linear-gradient(180deg, transparent 0%, #7BA8A0 55%, #3D5A5C 100%);
  opacity: 0.85;
}

#milestone-card .pc-hero {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  z-index: 1;
  image-rendering: pixelated;
}

#milestone-card .pc-hero img {
  width: 48px;
  height: 48px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

#milestone-card .pc-body {
  position: relative;
  padding-right: 84px;
  text-align: left;
  color: #3D5A5C;
  min-height: 110px;
}

#milestone-card .pc-kicker {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #7BA8A0;
  margin-bottom: 4px;
}

#milestone-card .pc-title {
  font-size: 16px;
  font-weight: 800;
  color: #3D5A5C;
  line-height: 1.15;
  margin-bottom: 6px;
}

#milestone-card .pc-meters {
  font-size: 32px;
  font-weight: 800;
  color: #3D5A5C;
  line-height: 1;
}

#milestone-card .pc-meta {
  margin-top: 6px;
  font-size: 16px;
  color: #7BA8A0;
  font-weight: 700;
}

#milestone-card .pc-postmark {
  position: absolute;
  left: 8px;
  bottom: 28px;
  width: 40px;
  height: 40px;
  border: 2px solid #E07A6A;
  border-radius: 50%;
  color: #E07A6A;
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.7;
  transform: rotate(-18deg);
}

#milestone-card .pc-hint {
  margin-top: 14px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #B47830;
  opacity: 0.9;
}

/* --- 48h leaderboard panel (Bit Bite v1) --- */
#board-btn {
  appearance: none;
  border: 2px solid #7BA8A0;
  background: #E8F0EE;
  color: #3D5A5C;
  font-weight: 800;
  font-size: 16px;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
}
#board-btn:active {
  transform: translateY(1px);
}
#board-btn.hidden {
  display: none;
}

#leaderboard-panel {
  text-align: left;
  margin: 0 0 14px;
  padding: 10px 12px 12px;
  background: rgba(125, 168, 160, 0.18);
  border: 2px solid #7BA8A0;
  border-radius: 14px;
  max-height: 220px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#leaderboard-panel.hidden {
  display: none;
}
#lb-head {
  font-size: 16px;
  font-weight: 800;
  color: #3d6b6b;
  letter-spacing: 0px;
  text-align: center;
}
#lb-countdown {
  font-size: 16px;
  font-weight: 700;
  color: #2f4a4a;
  text-align: center;
}
#lb-status {
  font-size: 16px;
  font-weight: 600;
  color: #3D5A5C;
  opacity: 0.9;
  text-align: center;
}
#lb-status.lb-offline {
  color: #B85A4E;
}
#lb-you {
  font-size: 16px;
  font-weight: 700;
  color: #3d6b6b;
  text-align: center;
  margin-bottom: 2px;
}
#lb-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  max-height: 140px;
}
#lb-list .lb-row,
#lb-list .lb-empty {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 6px;
  align-items: center;
  padding: 5px 6px;
  border-radius: 8px;
  font-size: 16px;
  color: #2f4a4a;
}
#lb-list .lb-empty {
  display: block;
  text-align: center;
  opacity: 0.8;
  font-weight: 600;
}
#lb-list .lb-row:nth-child(odd) {
  background: rgba(245, 230, 200, 0.55);
}
#lb-list .lb-self {
  background: rgba(224, 122, 106, 0.28) !important;
  border: 1.5px solid #E07A6A;
  font-weight: 800;
}
#lb-list .lb-rank {
  font-weight: 800;
  color: #3d6b6b;
}
#lb-list .lb-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#lb-list .lb-height {
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}


/* --- End-of-run board toast (Matt calm; non-blocking) --- */
#lb-run-toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translateX(-50%) translateY(8px);
  z-index: 40;
  max-width: min(300px, 88%);
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(61, 90, 92, 0.92);
  color: #F5E6C8;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0px;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: 0 4px 14px rgba(45, 70, 72, 0.35);
}
#lb-run-toast.hidden {
  display: none;
}
#lb-run-toast.lb-toast-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}


/* --- Analytics consent (soft launch; EEA/UK/CA-aware stub) --- */
/* Hit-test: wrapper must accept pointers when visible — pointer-events:none here
   let Tap-to-Fly / canvas steal Accept/Refuse (card auto alone was unreliable). */
#analytics-consent {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200;
  width: min(100vw, calc(100vh * 9 / 16), 420px);
  padding: 0 12px;
  pointer-events: auto;
}
#analytics-consent.hidden {
  display: none !important;
  pointer-events: none;
}
#analytics-consent-card {
  pointer-events: auto;
  position: relative;
  z-index: 1;
  background: rgba(245, 230, 200, 0.96);
  color: #2f4a4a;
  border: 2px solid #3d6b6b;
  border-radius: 14px;
  padding: 12px 14px 10px;
  box-shadow: 0 6px 20px rgba(30, 42, 42, 0.35);
}
#analytics-consent-title {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
}
#analytics-consent-body {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
  opacity: 0.92;
  margin-bottom: 10px;
}
#analytics-consent-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
#analytics-consent-actions button {
  font: inherit;
  font-size: 16px;
  font-weight: 800;
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  border: 2px solid #3d6b6b;
  touch-action: manipulation;
}
#analytics-consent-refuse {
  background: transparent;
  color: #2f4a4a;
}
#analytics-consent-accept {
  background: #E07A6A;
  color: #F5E6C8;
  border-color: #c45f52;
}


/* ---------- 0.3.0 coin -> fuel sprites + gauge bump ---------- */
#coin-fly-layer { position: fixed; left: 0; top: 0; z-index: 30; pointer-events: none; image-rendering: pixelated; }
/* 0.3.2: the bar pulse is a whole-px lift + flat flash (no scale: keeps the gauge pixels crisp) */
#fuel-gain {
  position: absolute; left: 12px; top: 2px; width: 0; height: 10px; opacity: 0;
  background: #FFF6C8; mix-blend-mode: screen; pointer-events: none; z-index: 1;
}
#fuel-flash {
  position: absolute; left: 12px; top: 2px; width: 40px; height: 10px; opacity: 0;
  background: #FFF6C8; mix-blend-mode: screen; pointer-events: none; z-index: 1;
}

/* ---------- 0.3.0 note card (PLACEHOLDER card until Shiela's in-game note card) ---------- */
#note-card {
  position: absolute; left: 50%; top: 22%; z-index: 25; width: min(250px, 72vw);
  transform: translate(-50%, -14px) rotate(-1.5deg); opacity: 0;
  background: #FFF8F0; border: 2px solid #3D5A5C; box-shadow: 0 3px 0 rgba(61, 90, 92, 0.35);
  padding: 10px 12px 12px; color: #2A2A2A; font: 400 16px/1.35 m6x11, monospace; pointer-events: none;
  transition: opacity 0.35s ease-out, transform 0.45s ease-out;
}
#note-card.hidden { display: none; }
#note-card.in { opacity: 1; transform: translate(-50%, 0) rotate(-1.5deg); }
#note-card.out { opacity: 0; transform: translate(-50%, 8px) rotate(-1.5deg); transition-duration: 0.4s; }
/* 0.3.1: Shiela's baked card (324x248 at (18,140) on 360x640, placed over the canvas by placeNoteCard) */
#note-card.baked {
  width: auto; padding: 0; background: none; border: 0; box-shadow: none; transform: translate(0, -10px); top: 0; left: 0;
}
#note-card.baked.in { transform: translate(0, 0); }
#note-card.baked.out { transform: translate(0, 8px); }
/* 0.3.4 zoom from the note: game.js sets left/top/width/height per frame (whole device px) and the opacity; no CSS
   transition / transform may fight it. Nearest-neighbour scaling: image-rendering pixelated (+ crisp-edges fallback). */
#note-card.baked.zoom, #note-card.baked.zoom.in, #note-card.baked.zoom.out { transition: none; transform: none; opacity: 1; }
#note-card.baked.zoom .note-card-img, #note-card.baked.zoom .note-cue img { image-rendering: crisp-edges; image-rendering: pixelated; }
#note-card.baked .note-card-img { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
#note-card.baked .note-cue {
  position: absolute; left: 4.938%; top: 84.677%; width: 90.123%; height: 7.258%; background: #FFF8F0;
}
#note-card.baked .note-cue img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; image-rendering: pixelated; }
#note-card.baked .note-cue img.off { visibility: hidden; }
#note-card .note-tap { margin-top: 8px; font: 400 16px/1 m6x11, monospace; color: #3D5A5C; text-align: right; }
.note-list-card { display: block; width: 100%; max-width: 240px; image-rendering: pixelated; margin-top: 4px; }
#note-card .note-tag { font: 400 16px/1 m6x11, monospace; letter-spacing: 1px; color: #B47830; margin-bottom: 6px; }

/* ---------- 0.3.0 overlay sub-actions + name / notes panels ---------- */
#overlay-sub-actions { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 0 0 10px; }
#overlay-sub-actions button, #notes-panel button {
  appearance: none; border: 2px solid #7BA8A0; background: #E8F0EE; color: #3D5A5C;
  font-weight: 800; font-size: 16px; padding: 7px 14px; border-radius: 999px; cursor: pointer; touch-action: manipulation;
}
#overlay-sub-actions button:active, #notes-panel button:active { transform: translateY(1px); }
#overlay-sub-actions .hidden, #notes-panel.hidden, #notes-empty.hidden { display: none; }
#notes-panel {
  text-align: left; background: #FFF8F0; border: 2px solid #7BA8A0; border-radius: 10px;
  padding: 10px 12px; margin: 0 0 10px; color: #3D5A5C;
}
#notes-panel .panel-head { font-weight: 800; font-size: 16px; margin-bottom: 6px; }
.panel-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.panel-hint { font-size: 16px; opacity: 0.75; margin-top: 6px; }
#notes-list { list-style: none; margin: 0 0 8px; padding: 0; max-height: 34vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
#notes-list li { border-top: 1px dashed #B9CFCB; padding: 6px 0; }
#notes-list .note-head { font: 400 16px/1.2 m6x11, monospace; letter-spacing: 1px; color: #B47830; }
#notes-list .note-body { font-size: 16px; margin-top: 2px; }

/* 0.4.6 avatar HUD + editor (avatar/avatar.js). Tile 40x40 CSS px = 1 art px per CSS px (whole device px at DPR 1/2/3), top-left inside
   the safe area; caps name plate below (no number). The score row starts right of the avatar column. */
#hud { padding-left: calc(max(16px, env(safe-area-inset-left)) + 80px); }
#hud-avatar {
  position: absolute; left: max(16px, env(safe-area-inset-left)); top: 0; width: 40px; height: 40px;
  pointer-events: auto; cursor: pointer; image-rendering: pixelated; image-rendering: crisp-edges; touch-action: manipulation; z-index: 3;
}
#hud-avatar:focus-visible { outline: 2px solid #A8674A; outline-offset: 1px; }
#hud-name {
  position: absolute; top: 44px; height: 16px; pointer-events: none; image-rendering: pixelated; image-rendering: crisp-edges;
}
#avatar-editor { position: fixed; inset: 0; z-index: 60; background: #1A363C; touch-action: none; }
#avatar-editor.hidden { display: none; }
#avatar-editor-canvas { position: absolute; image-rendering: pixelated; image-rendering: crisp-edges; }
#avatar-name-input {
  position: absolute; opacity: 0; border: 0; padding: 0; margin: 0; background: transparent; color: transparent; caret-color: transparent;
  font-size: 16px; /* >= 16 px: no iOS focus zoom */ text-transform: uppercase; outline: none;
}

/* 0.5.4 board avatars: 16 px, nearest-neighbour */
#lb-list .lb-avatar { width: 16px; height: 16px; image-rendering: pixelated; flex: 0 0 16px; margin-right: 6px; vertical-align: middle; }

/* 0.5.4 start splash (text placeholder; Shiela's art at assets/splash/splash.png replaces it) */
#splash { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: #1A363C; color: #FFF8F0; cursor: pointer; text-align: center; font-family: inherit; image-rendering: pixelated; }
#splash.hidden { display: none; }
#splash-art { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; }
#splash.has-art #splash-text { visibility: hidden; } /* text stays in the DOM for screen readers via aria-label */
#splash-text { position: relative; text-transform: none; }
#splash .sp-title { font-size: 32px; letter-spacing: 2px; }
#splash .sp-by { font-size: 16px; color: #C8DCE0; margin-top: 6px; }
#splash .sp-go { font-size: 16px; color: #A8674A; margin-top: 48px; animation: spblink 1s steps(1) infinite; }
@keyframes spblink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #splash .sp-go { animation: none; } }

/* 0.5.4 portal builds only: opt-in rewarded fuel refill (hidden on the web build: no CavernPortal) */
/* 0.5.5 'Keep flying?' (lives out): Continue and Reset share ONE button style (same size / font / colour); Reset is live at once */
#keep-flying { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(20, 30, 36, 0.72); }
#keep-flying.hidden { display: none; }
#keep-flying .kf-card { background: #FFF8F0; color: #2A2A2A; border: 3px solid #86503C; padding: 16px 18px 14px; min-width: 240px; text-align: center; image-rendering: pixelated; }
#keep-flying .kf-title { font-size: 16px; font-weight: 800; letter-spacing: 0px; }
/* 0.5.5 B: Shiela's continue rotor-spin loop (05_continue _4x strip) centred above the title at exactly 4x: 64x68 CSS px, the
   canvas holds the 4x frame 1:1 (no fractional scale), pixelated. Frames are driven by game.js (16 x 70 ms, blink every 3rd loop). */
#keep-flying .kf-spin { margin: 0 auto 6px; width: 64px; height: 68px; }
#keep-flying .kf-spin canvas { display: block; width: 64px; height: 68px; image-rendering: pixelated; image-rendering: crisp-edges; }
#keep-flying .kf-count { font-size: 32px; font-weight: 800; margin: 2px 0 10px; font-variant-numeric: tabular-nums; }
#keep-flying .kf-btns { display: flex; gap: 10px; justify-content: center; }
#keep-flying .kf-btn { flex: 1 1 0; min-width: 104px; height: 44px; font: inherit; font-size: 16px; font-weight: 800; color: #FFF8F0; background: #A8674A; border: 2px solid #86503C; border-radius: 0; padding: 0 10px; cursor: pointer; }
#keep-flying .kf-btn:disabled { opacity: 0.6; cursor: default; }
#keep-flying .kf-btn.hidden { display: none; }
#lb-list .lb-row { grid-template-columns: 36px 16px 1fr auto; } /* 0.5.4: rank | avatar | name | height on one line */
#lb-list .lb-row .lb-avatar { margin-right: 0; }

/* 0.5.5 item 5: Shiela's stopwatch (batch 0.5.5 A, built from parts) top-right, 92x52 art px = CSS px. Her placement:
   right max(16px, safe-area right), top max(12px, safe-area top). #stopwatch sits inside #hud, whose own top is already
   max(12px, env(safe-area-inset-top)), so top: 0 here = 12 px from the top or below the notch. The flex rows keep clear of it
   (padding-right). Coins stay in row 2 beside Best (Dan's call, kept for 0.5.5: Shiela's suggestion A, coins under the board,
   would end at ~84 px, past the 76 px HUD band; B would crowd the avatar plate). */
#hud { padding-right: calc(max(16px, env(safe-area-inset-right)) + 92px + 6px); }
#stopwatch {
  position: absolute; right: max(16px, env(safe-area-inset-right)); top: 0; width: 92px; height: 52px;
  image-rendering: pixelated; image-rendering: crisp-edges; pointer-events: none;
}
#stopwatch.hidden { display: none; }
#hud .hud-break { flex: 1 0 100%; height: 0; order: 2; }
#score { order: 1; }
#vitals { order: 1; margin: 0; }
#hiscore { order: 3; }
#coin-wrap { order: 3; margin: 0 0 0 10px; }
#hud #proto-version { order: 5; }
#hud { justify-content: flex-start; column-gap: 8px; }

/* 0.5.7 item 8a turbo button: 52x54 art (+2 px glow pad = 56x58 canvas) in a 64x64 touch box, bottom-right of the game
   area (left with .left). Game area width = min(100vw, 100vh * 9 / 16, 420px), centred. */
#turbo-btn {
  position: absolute; z-index: 6; width: 64px; height: 64px; padding: 0; border: 0; background: transparent;
  bottom: calc((100vh - min(100vh, calc(100vw * 16 / 9))) / 2 + max(20px, calc(env(safe-area-inset-bottom) + 8px)));
  right: calc((100vw - min(100vw, calc(100vh * 9 / 16), 420px)) / 2 + max(16px, env(safe-area-inset-right)));
  display: flex; align-items: center; justify-content: center; touch-action: none; -webkit-tap-highlight-color: transparent; cursor: pointer;
}
#turbo-btn.left { right: auto; left: calc((100vw - min(100vw, calc(100vh * 9 / 16), 420px)) / 2 + max(16px, env(safe-area-inset-left))); }
#turbo-btn.hidden { display: none; }
#turbo-btn canvas { width: 56px; height: 58px; image-rendering: pixelated; pointer-events: none; }
/* 0.5.8 item 6: charge count under the button, burst countdown inside it */
#turbo-btn .turbo-count { position: absolute; left: 0; right: 0; top: 100%; margin-top: 2px; text-align: center; font: 400 16px/1 m6x11, monospace; color: #EAE0FF; text-shadow: 0 1px 2px #000; pointer-events: none; }
#turbo-btn .turbo-countdown { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 400 16px/1 m6x11, monospace; color: #fff; text-shadow: 0 0 3px #6436BE, 0 1px 2px #000; pointer-events: none; }
#turbo-btn .turbo-countdown[hidden] { display: none; }

/* 0.5.7 item 8b level map (DOM version of Shiela's 10-09 sketch: plates L6..L1 top to bottom, cleared = dark plate + REPLAY,
   current = cream + FLY, locked = near-black + lock). */
#levelmap-panel { margin: 8px 0; background: #141418; border-radius: 6px; padding: 6px; max-height: 58vh; overflow-y: auto; color: #F5E6C8; text-align: left; }
#levelmap-panel .lm-head { display: flex; align-items: center; gap: 8px; height: 44px; position: sticky; top: 0; background: #141418; }
#levelmap-panel .lm-head button { width: 44px; height: 44px; font: 400 16px m6x11, monospace; }
#levelmap-panel .lm-title { font: 400 16px/1 m6x11, monospace; letter-spacing: 2px; flex: 1; text-align: center; }
#levelmap-panel .lm-sp { width: 44px; }
#lm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
#lm-list li { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 8px; border-radius: 4px; background: #24242C; border-top: 2px solid #3A3A46; cursor: pointer; }
#lm-list li.current { background: #F5E6C8; color: #2A2018; border-top-color: #FFF6E0; }
#lm-list li.locked { background: #0B0A10; color: #5A5A66; border-top-color: #18181E; cursor: default; }
#lm-list li:active:not(.locked) { transform: translateY(2px); border-top-color: transparent; }
#lm-list .lm-n { font: 400 16px m6x11, monospace; padding: 3px 6px; border-radius: 3px; color: #141418; }
#lm-list .lm-name { flex: 1; font: 400 16px/1.15 m6x11, monospace; }
#lm-list .lm-time { font: 400 16px m6x11, monospace; opacity: .85; display: block; }
#lm-list .lm-chip { font: 400 16px m6x11, monospace; padding: 6px 8px; border-radius: 3px; background: #3FA79A; color: #0E1E1C; }
#lm-list li.current .lm-chip { background: #E8705A; color: #fff; }
#lm-list li.locked .lm-chip { background: transparent; color: #5A5A66; }

/* 0.5.7 item 8c time-board tabs */
#lb-tabs { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 4px 0 6px; }
#lb-tabs button { font: 400 16px m6x11, monospace; padding: 5px 7px; min-width: 34px; border-radius: 4px; border: 1px solid rgba(0,0,0,.2); background: rgba(255,255,255,.5); }
#lb-tabs button.on { background: #2E6E6A; color: #fff; }

/* ===== 0.5.7 dialog kit (Shiela monday-batch-2026-10-12 A/2_dialogs/dialog_system.json, approved by Bit Bite) =====
   scrim #1A363C, panel #2A474E, title bar #325057 (44 px), wells #1A363C, text #FFF8F0 / #A6BCC1.
   primary clay #A8674A (lit #B47830, foot #86503C), secondary #557177 (#688389 / #223F45), destructive #A83E30 (#B44628 / #7A2A22).
   4 px grid, 16 px padding, 12 px gaps, 48 px buttons, nothing under 44 px, 2 px chipped corners, no outline / shadow.
   Morgan's ad-rule layout kept on Keep flying?: Continue (🎬) and Reset in one row, the SAME size / style, Reset live at once. */
:root { --dk-scrim:#1A363C; --dk-panel:#2A474E; --dk-bar:#325057; --dk-well:#1A363C; --dk-text:#FFF8F0; --dk-text2:#A6BCC1;
  --dk-pri:#A8674A; --dk-pri-lit:#B47830; --dk-pri-ft:#86503C; --dk-sec:#557177; --dk-sec-lit:#688389; --dk-sec-ft:#223F45;
  --dk-des:#A83E30; --dk-des-lit:#B44628; --dk-des-ft:#7A2A22; --dk-focus:#C8DCE0;
  --dk-chip: polygon(2px 0, calc(100% - 2px) 0, 100% 2px, 100% calc(100% - 2px), calc(100% - 2px) 100%, 2px 100%, 0 calc(100% - 2px), 0 2px); }
#overlay { background: rgba(26, 54, 60, 0.85); }
#overlay-card, #keep-flying .kf-card { background: var(--dk-panel); color: var(--dk-text); border: none; border-radius: 0; box-shadow: none;
  clip-path: var(--dk-chip); padding: 0 16px 16px; text-transform: uppercase; letter-spacing: 1px; image-rendering: pixelated; }
#overlay-card { max-width: 320px; }
#overlay-card h1, #keep-flying .kf-title { display: flex; align-items: center; min-height: 44px; margin: 0 -16px 12px; padding: 0 16px;
  background: var(--dk-bar); color: var(--dk-text); font-size: 16px; font-weight: 800; text-align: left; letter-spacing: 1px; }
#overlay-card p, #overlay-card .daily-line, #overlay-version, #lb-countdown, #lb-status, .panel-hint { color: var(--dk-text2); font-size: 16px; }
#overlay-card p#overlay-msg { color: var(--dk-text); text-align: left; }
#leaderboard-panel, #notes-panel, #levelmap-panel, #share-card { background: var(--dk-well) !important; color: var(--dk-text) !important; border: none !important;
  border-radius: 0 !important; box-shadow: none !important; clip-path: var(--dk-chip); padding: 12px !important; margin: 0 0 12px !important; }
#lb-head, #notes-panel .panel-head, #levelmap-panel .lm-title { color: var(--dk-text) !important; font-size: 16px; letter-spacing: 1px; }
#lb-list, #lb-you, #notes-list, #lm-list { color: var(--dk-text) !important; }
#overlay-card button, #keep-flying .kf-btn { min-height: 48px; min-width: 44px; border: none !important; border-radius: 0 !important; box-shadow: none !important;
  clip-path: var(--dk-chip); font: inherit; font-size: 16px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--dk-text) !important;
  background: var(--dk-sec) !important; box-shadow: inset 0 2px 0 var(--dk-sec-lit), inset 0 -4px 0 var(--dk-sec-ft) !important; cursor: pointer; }
#overlay-card #start-btn, #overlay-card #replay-level-btn, #keep-flying .kf-btn { background: var(--dk-pri) !important;
  box-shadow: inset 0 2px 0 var(--dk-pri-lit), inset 0 -4px 0 var(--dk-pri-ft) !important; }
#overlay-card #restart-l1-btn { background: var(--dk-des) !important; box-shadow: inset 0 2px 0 var(--dk-des-lit), inset 0 -4px 0 var(--dk-des-ft) !important; }
#overlay-card #start-btn { width: 100%; font-size: 16px; }
#overlay-actions, #overlay-sub-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 12px; }
#overlay-actions button, #overlay-sub-actions button { flex: 1 1 120px; }
#overlay-card button:focus-visible, #keep-flying .kf-btn:focus-visible { outline: 2px solid var(--dk-focus); outline-offset: 2px; }
#keep-flying { background: rgba(26, 54, 60, 0.85); }
#keep-flying .kf-card { min-width: 288px; text-align: center; }
#keep-flying .kf-count { color: var(--dk-text); font-size: 32px; }
#keep-flying .kf-btns { gap: 12px; } /* equal flex: 1 1 0 buttons kept from 0.5.5 (Morgan) */
#keep-flying .kf-btn { flex: 1 1 0; height: 48px; font-size: 16px; }

/* 0.5.8 item 7: pause button (top right, under the stopwatch; placeholder two-bar icon) + pause / settings dialog */
#pause-btn { position: absolute; z-index: 7; top: calc(max(12px, env(safe-area-inset-top)) + 58px); right: calc((100vw - min(100vw, calc(100vh * 9 / 16), 420px)) / 2 + max(16px, env(safe-area-inset-right)));
  width: 40px; height: 40px; border: 2px solid #1E1A26; border-radius: 8px; background: rgba(30, 26, 38, 0.72); display: flex; gap: 6px; align-items: center; justify-content: center; padding: 0; cursor: pointer; touch-action: none; }
#pause-btn i { display: block; width: 6px; height: 18px; background: #F2E8D8; border-radius: 1px; }
#pause-btn.hidden { display: none; }
#pause-dialog { position: absolute; inset: 0; z-index: 65; display: flex; align-items: center; justify-content: center; background: rgba(10, 8, 16, 0.6); }
#pause-dialog.hidden { display: none; }
#pause-dialog .pd-card { width: min(320px, 86vw); background: #1E1A26; color: #F2E8D8; border: 2px solid #A8674A; border-radius: 10px; padding: 14px 16px; font: 400 16px/1.3 m6x11, monospace; }
#pause-dialog .pd-title { font-size: 16px; font-weight: 800; text-align: center; margin-bottom: 8px; letter-spacing: 1px; }
#pause-dialog .pd-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
#pause-dialog .pd-row input[type=range] { width: 55%; }
#pause-dialog .pd-check { justify-content: flex-start; }
#pause-dialog .pd-btns { display: grid; gap: 8px; margin-top: 12px; }
#pause-dialog .pd-btns button { font: 400 16px m6x11, monospace; padding: 10px; border-radius: 8px; border: 0; background: #A8674A; color: #fff; }
#pause-dialog .pd-btns button#pause-resume { background: #5FA85A; }
/* 0.5.8 item 3: level select (canvas, Shiela slices) + O1 banner / O4 chip */
#ls-screen { position: fixed; inset: 0; z-index: 70; background: #1A363C; touch-action: none; }
#ls-screen.hidden { display: none; }
#ls-canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
#lvl-banner, #lvl-chip { position: fixed; z-index: 45; pointer-events: none; image-rendering: pixelated; }
#lvl-banner.hidden, #lvl-chip.hidden { display: none; }
/* 0.7.0 item 4: settings / pause dialog layout B (Shiela settings-dialog-prod-2026-10-15). Art is drawn on #pd-art at 360x640
   native, integer-scaled; the real controls (same ids) sit transparent on the spec tap rects. Fallback = the old card above. */
#pause-dialog.pd-b { background: rgba(26, 54, 60, 0.85); display: block; }
#pause-dialog.pd-b.hidden { display: none; }
#pause-dialog.pd-b .pd-card { position: absolute; left: 50%; top: 50%; width: 360px; height: 640px; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; transform-origin: 0 0; }
#pause-dialog.pd-b #pd-art { position: absolute; left: 0; top: 0; width: 360px; height: 640px; image-rendering: pixelated; pointer-events: none; }
#pause-dialog.pd-b .pd-title, #pause-dialog.pd-b .pd-row { font-size: 0; margin: 0; }
#pause-dialog.pd-b .pd-btns { display: block; margin: 0; }
#pause-dialog.pd-b .pd-card button, #pause-dialog.pd-b .pd-card input { position: absolute; margin: 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: transparent; font-size: 0; -webkit-appearance: none; appearance: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
#pause-dialog.pd-b .pd-card button:focus-visible, #pause-dialog.pd-b .pd-card input:focus-visible { outline: 2px solid #C8DCE0; outline-offset: -2px; }
#pause-dialog.pd-b .pd-card input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 28px; background: transparent; border: 0; }
#pause-dialog.pd-b .pd-card input[type=range]::-moz-range-thumb { width: 16px; height: 28px; background: transparent; border: 0; }
#pause-dialog.pd-b .pd-card input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 44px; }
#pause-dialog.pd-b .pd-card input[type=range]::-moz-range-track { background: transparent; }
#pause-dialog.pd-b #pause-resume { left: 36px; top: 84px; width: 288px; height: 48px; }
#pause-dialog.pd-b #pause-restart { left: 36px; top: 144px; width: 138px; height: 48px; }
#pause-dialog.pd-b #pause-quit { left: 186px; top: 144px; width: 138px; height: 48px; }
#pause-dialog.pd-b #pd-close { left: 296px; top: 24px; width: 44px; height: 44px; }
#pause-dialog.pd-b #set-music { left: 36px; top: 248px; width: 196px; height: 44px; }
#pause-dialog.pd-b #set-sfx { left: 36px; top: 308px; width: 196px; height: 44px; }
#pause-dialog.pd-b #set-mute { left: 252px; top: 236px; width: 80px; height: 56px; }
#pause-dialog.pd-b #set-motion { left: 36px; top: 392px; width: 288px; height: 44px; }
#pause-dialog.pd-b #set-vibrate { left: 36px; top: 440px; width: 288px; height: 44px; }
#pause-dialog.pd-b #set-autopause { left: 36px; top: 488px; width: 288px; height: 44px; }
#pause-dialog.pd-b #pd-confirm { position: absolute; left: 0; top: 0; width: 360px; height: 640px; }
#pause-dialog.pd-b #pd-confirm.hidden { display: none; }
#pause-dialog.pd-b #pd-confirm-ok { left: 36px; top: 296px; width: 288px; height: 48px; }
#pause-dialog.pd-b #pd-keep { left: 36px; top: 356px; width: 288px; height: 48px; }
#pause-dialog:not(.pd-b) #pd-close, #pause-dialog:not(.pd-b) #pd-confirm { display: none; }
#pause-dialog.pd-b .pd-card button#pause-resume { background: transparent; }
#pause-dialog.pd-b #set-ghost { left: 36px; top: 532px; width: 288px; height: 44px; } /* 0.8.0: 44 px tap rect [36,532,288,44] */
/* 0.7.0 item 5: height meter glow every 100 m */
#score.meter-glow { animation: meterGlow0700 0.7s ease-out 1; }
@keyframes meterGlow0700 { 0% { text-shadow: 0 0 6px #F0C878, 0 0 2px #FFF8F0; color: #FFF8F0; } 100% { text-shadow: none; color: #F0C878; } } /* 0.8.3: HUD gold #F0C878 (was #F0C02C) */
