/* ═══════════════════════════════════════════════════════════
   DOBBY HUNT — style.css
   Aesthetic: 90s NES Duck Hunt — pixel-perfect, chunky fonts,
   flat sprite colours, scanline overlay, CRT warmth.
   Font: Press Start 2P (the quintessential NES font)
═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  /* NES palette */
  --sky:        #5c94fc;
  --sky-dark:   #3060c0;
  --grass:      #58b800;
  --grass-dark: #007800;
  --ground:     #c84000;
  --ground-mid: #e87038;
  --tree-green: #006800;
  --tree-light: #00a800;
  --cloud-col:  #fcfcfc;
  --sun-col:    #fcfc00;

  /* UI palette */
  --nes-bg:     #000000;
  --nes-white:  #fcfcfc;
  --nes-yellow: #f8d800;
  --nes-red:    #e40058;
  --nes-green:  #00b800;
  --nes-grey:   #7c7c7c;
  --nes-orange: #f87858;
  --nes-brown:  #503000;
  --nes-dark:   #1c1c1c;
  --nes-panel:  #0038a8;
  --nes-border: #fcfcfc;

  --font: 'Press Start 2P', monospace;

  /* Dobby/Duck sprite colours */
  --dobby-skin:  #f0c090;
  --dobby-robe:  #c0c0c0;
  --dobby-eye:   #000000;
  --dobby-ear:   #e0a060;
  --dobby-wing:  #a0a0a0;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--sky);
  font-family: var(--font);
  cursor: none;
  user-select: none;
  image-rendering: pixelated;
}

/* CRT scanlines over everything */
body::after {
  content: '';
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0) 0px,
    rgba(0,0,0,0) 3px,
    rgba(0,0,0,0.10) 3px,
    rgba(0,0,0,0.10) 4px
  );
  pointer-events: none;
  z-index: 9999;
}

/* ── SCREENS ── */
.screen {
  position: fixed; inset: 0;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
  z-index: 10;
}
.screen.active { opacity: 1; pointer-events: all; }

/* ═══════════════════════════════════
   SHARED SCENERY LAYERS
═══════════════════════════════════ */
.sky-layer {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, #3870c8 0%, #5c94fc 40%, #80b4fc 100%);
  z-index: 0;
}

/* Circular sun */
.sun-sprite {
  position: absolute;
  top: 8%; right: 12%;
  width: 52px; height: 52px;
  background: var(--sun-col);
  border-radius: 50%;
  box-shadow:
    0 0 0 6px rgba(252,252,0,0.35),
    0 0 24px 8px rgba(252,220,0,0.5);
}

/* Pixel clouds */
.cloud {
  position: absolute;
  background: var(--cloud-col);
  animation: drift linear infinite;
}
.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: var(--cloud-col);
}
.c1 { width: 48px; height: 16px; top: 15%; left: -60px;
      animation-duration: 35s; animation-delay: 0s;
      box-shadow: 8px -8px 0 0 var(--cloud-col), 16px -8px 0 0 var(--cloud-col),
                  24px -8px 0 0 var(--cloud-col), 8px -16px 0 0 var(--cloud-col),
                  16px -16px 0 0 var(--cloud-col); }
.c2 { width: 64px; height: 16px; top: 28%; left: -80px;
      animation-duration: 50s; animation-delay: -20s;
      box-shadow: 8px -8px 0 0 var(--cloud-col), 24px -8px 0 0 var(--cloud-col),
                  40px -8px 0 0 var(--cloud-col), 16px -16px 0 0 var(--cloud-col),
                  32px -16px 0 0 var(--cloud-col); }
.c3 { width: 40px; height: 16px; top: 10%; left: -50px;
      animation-duration: 42s; animation-delay: -8s;
      box-shadow: 8px -8px 0 0 var(--cloud-col), 16px -8px 0 0 var(--cloud-col),
                  8px -16px 0 0 var(--cloud-col); }
.c4 { width: 56px; height: 16px; top: 20%; left: -70px;
      animation-duration: 46s; animation-delay: -30s;
      box-shadow: 8px -8px 0 0 var(--cloud-col), 24px -8px 0 0 var(--cloud-col),
                  40px -8px 0 0 var(--cloud-col), 16px -16px 0 0 var(--cloud-col),
                  24px -16px 0 0 var(--cloud-col); }
.c5 { width: 36px; height: 16px; top: 6%; left: -45px;
      animation-duration: 58s; animation-delay: -44s;
      box-shadow: 8px -8px 0 0 var(--cloud-col), 16px -8px 0 0 var(--cloud-col),
                  8px -16px 0 0 var(--cloud-col), 16px -16px 0 0 var(--cloud-col); }
@keyframes drift {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 120px)); }
}

/* Pixel trees */
.trees-layer {
  position: absolute;
  bottom: 18%; left: 0; right: 0;
  height: 220px;
  z-index: 2;
  display: flex; align-items: flex-end;
  pointer-events: none;
}
.tree {
  position: absolute;
  bottom: 0;
}
/* Tree trunk */
.tree::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 18px; height: 48px;
  background: var(--nes-brown);
}
/* Tree canopy */
.tree::before {
  content: '';
  position: absolute;
  bottom: 44px; left: 50%;
  transform: translateX(-50%);
  width: 80px; height: 100px;
  background: var(--tree-green);
  box-shadow:
    0 -12px 0 0 var(--tree-green),
    -12px 0 0 0 var(--tree-green),
    12px  0 0 0 var(--tree-green),
    0 -24px 0 0 var(--tree-light),
    -6px -12px 0 0 var(--tree-light),
    6px  -12px 0 0 var(--tree-light);
  clip-path: polygon(50% 0%, 100% 60%, 80% 60%, 100% 100%, 0% 100%, 20% 60%, 0% 60%);
}
.tr1 { left: 2%; }
.tr2 { left: 12%; }
.tr3 { left: 72%; }
.tr4 { left: 85%; }
.tr5 { left: 55%; }

/* Ground */
.ground-layer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 18%;
  background: var(--ground);
  z-index: 3;
}
.ground-layer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 8px;
  background: var(--ground-mid);
}

/* Grass strip */
.grass-layer {
  position: absolute;
  bottom: 18%; left: 0; right: 0;
  height: 36px;
  background: var(--grass);
  z-index: 3;
}
.grass-layer::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 10px;
  background: var(--grass-dark);
}
.grass-layer::after {
  content: '';
  position: absolute;
  top: -14px; left: 0;
  width: 8px; height: 14px;
  background: var(--grass);
  box-shadow:
    24px 0 0 var(--grass), 48px 0 0 var(--grass), 72px 0 0 var(--grass),
    96px 0 0 var(--grass), 120px 0 0 var(--grass), 144px 0 0 var(--grass),
    168px 0 0 var(--grass), 192px 0 0 var(--grass), 216px 0 0 var(--grass),
    240px 0 0 var(--grass), 264px 0 0 var(--grass), 288px 0 0 var(--grass),
    312px 0 0 var(--grass), 336px 0 0 var(--grass), 360px 0 0 var(--grass),
    384px 0 0 var(--grass), 408px 0 0 var(--grass), 432px 0 0 var(--grass),
    456px 0 0 var(--grass), 480px 0 0 var(--grass), 504px 0 0 var(--grass),
    528px 0 0 var(--grass), 552px 0 0 var(--grass), 576px 0 0 var(--grass),
    600px 0 0 var(--grass), 640px 0 0 var(--grass), 700px 0 0 var(--grass),
    760px 0 0 var(--grass), 820px 0 0 var(--grass), 880px 0 0 var(--grass),
    940px 0 0 var(--grass), 1000px 0 0 var(--grass), 1060px 0 0 var(--grass),
    1120px 0 0 var(--grass), 1180px 0 0 var(--grass), 1240px 0 0 var(--grass),
    1300px 0 0 var(--grass), 1360px 0 0 var(--grass), 1420px 0 0 var(--grass),
    1480px 0 0 var(--grass), 1540px 0 0 var(--grass), 1600px 0 0 var(--grass),
    1660px 0 0 var(--grass), 1720px 0 0 var(--grass), 1780px 0 0 var(--grass);
}

/* ═══════════════════════════════════
   NES PANEL (reusable)
═══════════════════════════════════ */
.nes-panel {
  position: relative; z-index: 20;
  background: var(--nes-panel);
  border: 4px solid var(--nes-border);
  box-shadow:
    inset -4px -4px 0 0 rgba(0,0,0,0.4),
    inset 4px 4px 0 0 rgba(255,255,255,0.15),
    0 0 0 4px #000,
    8px 8px 0 0 #000;
  padding: 20px 24px 24px;
  color: var(--nes-white);
}
.nes-panel-title {
  font-size: 0.9rem;
  color: var(--nes-yellow);
  letter-spacing: 0.15em;
  text-align: center;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--nes-yellow);
  padding-bottom: 8px;
  text-shadow: 2px 2px 0 #000;
}

/* ═══════════════════════════════════
   TITLE SCREEN
═══════════════════════════════════ */
#screen-landing {
  align-items: center;
  justify-content: flex-start;
  flex-direction: column;
  display: flex;
  padding-top: 10vh;
}

.title-box {
  position: relative; z-index: 10;
  background: var(--nes-panel);
  border: 4px solid var(--nes-white);
  box-shadow: 0 0 0 4px #000, 8px 8px 0 0 #000;
  padding: 28px 44px 32px;
  text-align: center;
  max-width: 680px;
  width: 92%;
}
.title-top-label {
  font-size: 0.55rem;
  color: var(--nes-grey);
  letter-spacing: 0.2em;
  margin-bottom: 14px;
}
.title-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 12px;
}
.title-line1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  color: var(--nes-yellow);
  text-shadow: 4px 4px 0 #a06000, -2px -2px 0 #000;
  line-height: 1;
}
.title-line2 {
  font-size: clamp(1.4rem, 4.5vw, 2rem);
  color: var(--nes-white);
  text-shadow: 3px 3px 0 var(--nes-grey), -2px -2px 0 #000;
  line-height: 1;
}

/* Pixel duck / dobby icon on title */
.title-duck-icon {
  width: 32px; height: 32px;
  background: var(--dobby-skin);
  clip-path: polygon(
    30% 0%, 70% 0%, 100% 30%, 100% 70%,
    70% 100%, 30% 100%, 0% 70%, 0% 30%
  );
  box-shadow: inset -4px -4px 0 0 var(--dobby-ear);
  animation: duckBob 1s ease-in-out infinite alternate;
}
.title-duck-icon.flip { transform: scaleX(-1); animation-delay: 0.5s; }
@keyframes duckBob {
  from { transform: translateY(0); }
  to   { transform: translateY(-6px); }
}
.title-duck-icon.flip { animation-name: duckBobFlip; }
@keyframes duckBobFlip {
  from { transform: scaleX(-1) translateY(0); }
  to   { transform: scaleX(-1) translateY(-6px); }
}

.title-sub {
  font-size: 0.58rem;
  color: var(--nes-orange);
  letter-spacing: 0.12em;
  margin-bottom: 20px;
  animation: blink-text 1.2s step-end infinite;
}
@keyframes blink-text {
  0%,100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* Title menu */
.title-menu-box {
  background: #000;
  border: 3px solid var(--nes-white);
  padding: 12px 20px;
  margin-bottom: 16px;
  text-align: left;
}
.tmenu-item {
  font-size: 0.70rem;
  color: var(--nes-grey);
  padding: 6px 0;
  cursor: pointer;
  transition: color 0.1s;
  letter-spacing: 0.1em;
}
.tmenu-item.active { color: var(--nes-white); }
.tmenu-item:hover  { color: var(--nes-yellow); }
.tmenu-arrow { color: var(--nes-red); margin-right: 6px; }

.title-howto {
  font-size: 0.50rem;
  letter-spacing: 0.08em;
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
}
.howto-aim  { color: #00e8ff; text-shadow: 0 0 6px rgba(0,232,255,0.5); }
.howto-fire { color: #ff5555; text-shadow: 0 0 6px rgba(255,85,85,0.5); }
.howto-hit  { color: #55ff55; text-shadow: 0 0 6px rgba(85,255,85,0.5); }
.dot-sep { color: var(--nes-yellow); }

.title-reminder {
  font-size: 0.52rem;
  color: var(--nes-white);
  letter-spacing: 0.06em;
  margin-top: 14px;
  padding: 10px 14px;
  border: 2px solid var(--nes-yellow);
  background: rgba(0,0,0,0.4);
  line-height: 2;
}

.title-tip {
  font-size: 0.48rem;
  color: var(--nes-orange);
  letter-spacing: 0.05em;
  margin-top: 10px;
  line-height: 2;
}

/* ═══════════════════════════════════
   CALIBRATION SCREEN
═══════════════════════════════════ */
#screen-calibration {
  display: flex;
  align-items: center;
  justify-content: center;
}
.calib-panel {
  max-width: 440px;
  width: 90%;
  position: relative; z-index: 20;
}
.calib-desc {
  font-size: 0.45rem;
  color: var(--nes-white);
  text-align: center;
  line-height: 2.2;
  margin-bottom: 20px;
}
.yellow-text { color: var(--nes-yellow); }

/* Pixel eyes display */
.calib-eyes-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}
.big-eye {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.be-white {
  width: 56px; height: 40px;
  background: #fff;
  border: 3px solid #000;
  border-radius: 40%;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.be-pupil {
  width: 20px; height: 20px;
  background: #000;
  border-radius: 50%;
  transition: transform 0.1s, background 0.1s;
}
.be-pupil.closed { transform: scaleY(0.1); }
.be-pupil.blink-flash { background: var(--nes-red); }
.be-label {
  font-size: 0.4rem;
  color: var(--nes-grey);
}

/* Gun sight icon between eyes */
.calib-gun-sight {
  width: 28px; height: 28px;
  border: 3px solid var(--nes-yellow);
  border-radius: 50%;
  position: relative;
  flex-shrink: 0;
}
.calib-gun-sight::before, .calib-gun-sight::after {
  content: '';
  position: absolute;
  background: var(--nes-yellow);
}
.calib-gun-sight::before {
  width: 2px; height: 10px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.calib-gun-sight::after {
  width: 10px; height: 2px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}

/* Calibration duck icons */
.calib-ducks-row {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
}
.calib-duck-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.calib-duck-sprite {
  width: 24px; height: 24px;
  background: var(--dobby-skin);
  border-radius: 50%;
  box-shadow:
    0 -6px 0 0 var(--dobby-skin),
    -8px 4px 0 0 var(--dobby-ear),
    8px 4px 0 0 var(--dobby-ear),
    2px -8px 0 0 #000,
    -2px -8px 0 0 #000;
  transition: background 0.2s, box-shadow 0.2s;
}
.calib-duck-sprite.empty {
  background: var(--nes-grey);
  box-shadow:
    0 -6px 0 0 var(--nes-grey),
    -8px 4px 0 0 #555,
    8px 4px 0 0 #555;
}
.calib-duck-sprite.hit {
  background: var(--nes-yellow);
  box-shadow:
    0 -6px 0 0 var(--nes-yellow),
    -8px 4px 0 0 var(--nes-orange),
    8px 4px 0 0 var(--nes-orange),
    2px -8px 0 0 #000,
    -2px -8px 0 0 #000;
}
.cslot-label {
  font-size: 0.4rem;
  color: var(--nes-grey);
}

.calib-status-text {
  text-align: center;
  font-size: 0.45rem;
  color: var(--nes-orange);
  margin-bottom: 12px;
  min-height: 1.5em;
  letter-spacing: 0.08em;
  animation: blink-text 1s step-end infinite;
}
.noface-warning {
  background: var(--nes-red);
  color: var(--nes-white);
  font-size: 0.4rem;
  text-align: center;
  padding: 8px;
  margin-bottom: 12px;
  animation: blink-text 0.5s step-end infinite;
}
.calib-btns {
  display: flex;
  gap: 16px;
  justify-content: center;
}

/* ── NES BUTTONS ── */
.nes-btn {
  font-family: var(--font);
  font-size: 0.5rem;
  padding: 10px 18px;
  border: 3px solid var(--nes-white);
  cursor: pointer;
  letter-spacing: 0.1em;
  box-shadow: 4px 4px 0 0 #000;
  transition: transform 0.08s, box-shadow 0.08s;
  outline: none;
}
.nes-btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 0 #000;
}
.green-btn {
  background: var(--nes-green);
  color: var(--nes-white);
  border-color: #004400;
}
.green-btn:hover { background: #00e000; }
.grey-btn {
  background: var(--nes-grey);
  color: var(--nes-white);
  border-color: #444;
}
.grey-btn:hover { background: #999; }

.hidden { display: none !important; }

/* ═══════════════════════════════════
   GAME SCREEN
═══════════════════════════════════ */
#screen-game { overflow: hidden; }

#game-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: 1;
}
.game-trees  { z-index: 4; }
.game-ground { z-index: 5; }
.game-grass  { z-index: 5; }

/* ── NES HUD BAR (bottom) ── */
.nes-hud-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--nes-panel);
  border-top: 4px solid var(--nes-white);
  box-shadow: 0 -2px 0 0 #000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 100;
}
.hud-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 80px;
}
.hud-col-center { min-width: 140px; }
.hud-lbl {
  font-size: 0.52rem;
  color: var(--nes-yellow);
  letter-spacing: 0.15em;
  text-shadow: 1px 1px 0 #000;
}
.hud-num {
  font-size: 1.1rem;
  color: var(--nes-white);
  letter-spacing: 0.05em;
  text-shadow: 2px 2px 0 #000;
}

/* Hit tracker — mini duck icons */
.hit-tracker {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}
.ht-icon {
  width: 8px; height: 8px;
  background: var(--nes-grey);
  border-radius: 50%;
}
.ht-icon.filled { background: var(--nes-yellow); }

/* ── TOP STRIP HUD ── */
.top-strip-hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 42px;
  background: #5c94fc;
  border-bottom: 3px solid var(--nes-panel);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 100;
}
.tsh-left, .tsh-right {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.52rem;
  color: var(--nes-white);
}
.tsh-val { color: var(--nes-yellow); font-size: 0.60rem; }

/* BANG! text */
.bang-text {
  font-size: 0.85rem;
  color: var(--nes-red);
  text-shadow: 3px 3px 0 #000, -2px -2px 0 #000;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.06s, transform 0.06s;
  letter-spacing: 0.05em;
}
.bang-text.show {
  opacity: 1;
  transform: scale(1.2);
}

/* Face LED */
.face-led-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--nes-grey);
}
.face-led-dot.ok   { background: var(--nes-green); box-shadow: 0 0 6px var(--nes-green); }
.face-led-dot.lost { background: var(--nes-red);   box-shadow: 0 0 6px var(--nes-red);   animation: blink-text 0.4s step-end infinite; }
#face-lbl { font-size: 0.52rem; color: var(--nes-white); }

/* ── NES GUN SIGHT CROSSHAIR ── */
.nes-gunsight {
  position: fixed;
  width: 40px; height: 40px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 200;
}
.gs-ring {
  position: absolute; inset: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000;
}
.gs-dot {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--nes-red);
  border: 1px solid #000;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.gs-tick {
  position: absolute;
  background: #fff;
  box-shadow: 1px 1px 0 0 #000;
}
.gs-top, .gs-bottom { width: 2px; height: 8px; left: 50%; transform: translateX(-50%); }
.gs-top    { top: -12px; }
.gs-bottom { bottom: -12px; }
.gs-left, .gs-right { height: 2px; width: 8px; top: 50%; transform: translateY(-50%); }
.gs-left  { left: -12px; }
.gs-right { right: -12px; }

.nes-gunsight.firing .gs-ring {
  animation: gunfire 0.2s steps(2) forwards;
}
@keyframes gunfire {
  0%   { border-color: var(--nes-yellow); box-shadow: 0 0 0 2px var(--nes-red); transform: scale(1.5); }
  100% { border-color: #fff; box-shadow: 0 0 0 1px #000, inset 0 0 0 1px #000; transform: scale(1); }
}

/* ── WEBCAM CORNER ── */
.cam-corner {
  position: fixed;
  bottom: 72px; right: 12px;
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cam-frame {
  position: relative;
  background: #000;
  border: 3px solid var(--nes-white);
  box-shadow: 4px 4px 0 0 #000;
  overflow: hidden;
  width: 128px;
}
.cam-label {
  font-size: 0.35rem;
  color: var(--nes-red);
  background: #000;
  padding: 2px 6px;
  letter-spacing: 0.15em;
  border-bottom: 2px solid var(--nes-white);
  animation: blink-text 1s step-end infinite;
}
#webcam-video {
  width: 128px; height: 96px;
  object-fit: cover;
  display: block;
  transform: scaleX(-1);
  image-rendering: pixelated;
}
#webcam-overlay {
  position: absolute;
  top: 18px; left: 0;
  width: 128px; height: 96px;
  transform: scaleX(-1);
  pointer-events: none;
}
/* EAR meter */
.ear-meter {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #000;
  border: 2px solid var(--nes-white);
  padding: 3px 5px;
  box-shadow: 3px 3px 0 0 #000;
}
.ear-m-lbl {
  font-size: 0.32rem;
  color: var(--nes-grey);
  flex-shrink: 0;
}
.ear-m-track {
  flex: 1;
  height: 6px;
  background: #333;
  border: 1px solid #555;
  position: relative;
  overflow: hidden;
}
.ear-m-fill {
  height: 100%;
  width: 60%;
  background: var(--nes-green);
  transition: width 0.07s steps(4), background 0.1s;
}
.ear-m-fill.blink-low { background: var(--nes-red); }
.ear-m-line {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--nes-yellow);
  left: 40%;
}

/* ── Score pop ── */
.score-pop {
  position: fixed;
  font-family: var(--font);
  font-size: 0.6rem;
  color: var(--nes-yellow);
  text-shadow: 2px 2px 0 #000;
  pointer-events: none;
  z-index: 300;
  animation: scorePop 0.7s steps(6) forwards;
  white-space: nowrap;
}
@keyframes scorePop {
  0%   { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-48px) scale(1.3); }
}

/* ═══════════════════════════════════
   GAME OVER SCREEN
═══════════════════════════════════ */
#screen-gameover {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 8vh;
  overflow-y: auto;
}
.go-panel {
  max-width: 640px;
  width: 92%;
  position: relative; z-index: 20;
}
.go-scene {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid rgba(255,255,255,0.2);
}
.go-caught-dobbies {
  display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; justify-content: center;
}
.go-caught-dobby {
  width: 20px; height: 20px;
  background: var(--dobby-skin);
  border-radius: 50%;
  box-shadow:
    0 -6px 0 0 var(--dobby-skin),
    -6px 4px 0 0 var(--dobby-ear),
    6px 4px 0 0 var(--dobby-ear),
    2px -8px 0 0 #000,
    -2px -8px 0 0 #000;
  animation: caughtBob 0.8s ease-in-out infinite alternate;
}
@keyframes caughtBob {
  from { transform: translateY(0) rotate(-10deg); }
  to   { transform: translateY(-4px) rotate(10deg); }
}

/* Stats table */
.go-table {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.go-row {
  display: flex;
  align-items: baseline;
  font-size: 0.68rem;
  gap: 4px;
}
.go-lbl { color: var(--nes-white); white-space: nowrap; text-shadow: 1px 1px 0 #000; }
.go-dots {
  flex: 1;
  border-bottom: 2px dotted rgba(255,255,255,0.3);
  margin: 0 8px;
  margin-bottom: 3px;
}
.go-val { color: var(--nes-yellow); white-space: nowrap; font-size: 0.75rem; text-shadow: 2px 2px 0 #000; }

.go-rank {
  text-align: center;
  font-size: 0.90rem;
  color: var(--nes-yellow);
  text-shadow: 3px 3px 0 #a06000;
  margin-bottom: 20px;
  animation: blink-text 0.8s step-end infinite;
  letter-spacing: 0.1em;
}

.go-btns {
  display: flex; gap: 16px; justify-content: center;
  margin-bottom: 16px;
}

/* Screenshot / share button */
.go-share {
  display: flex;
  justify-content: center;
}
.share-btn {
  background: var(--nes-green);
  color: var(--nes-white);
  border-color: #004400;
  font-size: 0.60rem;
  letter-spacing: 0.08em;
}

/* ═══════════════════════════════════
   RESPONSIVE
═══════════════════════════════════ */
@media (max-width: 600px) {
  .title-box { padding: 16px 16px 20px; }
  .title-line1 { font-size: 1.4rem; }
  .title-line2 { font-size: 1.2rem; }
  .nes-hud-bar { height: 52px; padding: 0 10px; }
  .hud-num { font-size: 0.6rem; }
  .cam-corner { bottom: 58px; right: 6px; }
  .cam-frame { width: 96px; }
  #webcam-video { width: 96px; height: 72px; }
  #webcam-overlay { width: 96px; height: 72px; }
  .go-panel { padding: 16px; }
}

/* Normal cursor outside game */
body {
  cursor: default;
}

/* Hide cursor only in game */
#screen-game {
  cursor: none;
}

#go-caught {
  display: none;
}