/* YACHT DOCK — 8-bit CSS
   NES palette: deep navy, bright cyan, hot red, yellow, bone white, lime */

:root {
  --nes-navy:   #0c1a3b;
  --nes-dark:   #050814;
  --nes-blue:   #2a6df2;
  --nes-cyan:   #7cdfff;
  --nes-white:  #f8f8f8;
  --nes-bone:   #e8d9a8;
  --nes-yellow: #ffd23f;
  --nes-orange: #ff8a1f;
  --nes-red:    #ff3b3b;
  --nes-lime:   #b8ff3b;
  --nes-green:  #1fa84f;
  --nes-grey:   #7a7a9a;
  --nes-brown:  #6b3a1f;
}

@font-face {
  font-family: 'NesFont';
  /* Press Start 2P is the reference; fall back to monospace */
  src: local('Press Start 2P'), local('VT323'), local('Courier New');
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--nes-dark);
  color: var(--nes-white);
  font-family: 'Press Start 2P', 'VT323', 'Courier New', monospace;
  font-size: 11px;
  line-height: 1.4;
  letter-spacing: 0.5px;
  -webkit-font-smoothing: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

body {
  position: fixed;
  inset: 0;
  background:
    /* Scanlines */
    repeating-linear-gradient(0deg, rgba(255,255,255,0.015) 0 1px, transparent 1px 3px),
    /* Nautical chart grid */
    repeating-linear-gradient(90deg, rgba(124,223,255,0.022) 0 1px, transparent 1px 110px),
    repeating-linear-gradient(0deg,  rgba(124,223,255,0.022) 0 1px, transparent 1px 110px),
    /* Depth contours (diagonal) */
    repeating-linear-gradient(45deg,  rgba(42,109,242,0.032) 0 1px, transparent 1px 55px),
    repeating-linear-gradient(-45deg, rgba(42,109,242,0.032) 0 1px, transparent 1px 55px),
    /* Bioluminescent glow from depths */
    radial-gradient(ellipse 130% 55% at 50% 110%, rgba(7,25,90,0.65) 0%, transparent 55%),
    radial-gradient(ellipse 65% 65% at 12% 88%, rgba(0,70,130,0.18) 0%, transparent 50%),
    radial-gradient(ellipse 65% 65% at 88% 88%, rgba(0,70,130,0.18) 0%, transparent 50%),
    /* Base ocean gradient */
    radial-gradient(ellipse at 50% 38%, #0d2255, #050814 72%);
}

.hidden { display: none !important; }

/* ============================================================= */
/*  BOOT SCREEN                                                  */
/* ============================================================= */
.boot-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  text-align: center;
  z-index: 20;
  background:
    repeating-linear-gradient(180deg, rgba(124,223,255,0.05) 0 2px, transparent 2px 6px),
    radial-gradient(ellipse at 50% 40%, #102755, #050814 75%);
}

.boot-title {
  font-size: 46px;
  line-height: 1.1;
  color: var(--nes-yellow);
  text-shadow:
    3px 3px 0 var(--nes-red),
    6px 6px 0 var(--nes-navy),
    0 0 20px rgba(255,210,63,0.4);
  letter-spacing: 4px;
  animation: titleBob 1.4s ease-in-out infinite alternate;
}

.boot-sub {
  margin-top: 14px;
  font-size: 10px;
  color: var(--nes-cyan);
  text-shadow: 2px 2px 0 var(--nes-navy);
  letter-spacing: 2px;
}

.boot-flag {
  margin-top: 22px;
  font-size: 28px;
  color: var(--nes-red);
  animation: flagBlink 0.8s steps(2) infinite;
}

.boot-credit {
  position: absolute;
  bottom: 20px;
  font-size: 8px;
  color: var(--nes-grey);
  letter-spacing: 1px;
}
.boot-btns { display: flex; gap: 10px; align-items: center; }

/* Fixed feedback tab — left edge, always visible */
.fb-trigger {
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 1000;
  transform: translateY(-50%) rotate(180deg);
  writing-mode: vertical-rl;
  font: inherit;
  font-size: 8px;
  letter-spacing: 2px;
  padding: 12px 8px;
  background: var(--nes-navy);
  color: var(--nes-grey);
  border: 2px solid var(--nes-grey);
  border-right: none;
  cursor: pointer;
  white-space: nowrap;
}
.fb-trigger:hover { color: var(--nes-cyan); border-color: var(--nes-cyan); }

/* Feedback / Cameo modal */
.fb-modal {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(5,8,20,0.92);
  display: flex; align-items: center; justify-content: center;
}
.fb-box {
  background: var(--nes-navy);
  border: 4px solid var(--nes-cyan);
  box-shadow: 6px 6px 0 var(--nes-red);
  padding: 18px;
  width: 340px;
  max-width: 92vw;
  position: relative;
}
.fb-tabs { display: flex; gap: 4px; margin-bottom: 12px; }
.fb-tab {
  flex: 1; background: var(--nes-dark); border: 2px solid var(--nes-grey);
  color: var(--nes-grey); font: inherit; font-size: 8px; letter-spacing: 1px;
  padding: 6px 4px; cursor: pointer;
}
.fb-tab.active { border-color: var(--nes-cyan); color: var(--nes-cyan); background: var(--nes-navy); }
.fb-label { font-size: 8px; color: var(--nes-cyan); letter-spacing: 1px; margin-bottom: 8px; }
.fb-textarea, .fb-input {
  width: 100%; background: var(--nes-dark); border: 2px solid var(--nes-grey);
  color: var(--nes-white); font: inherit; font-size: 10px; padding: 6px 8px;
  resize: none; margin-bottom: 8px;
}
.fb-textarea:focus, .fb-input:focus { border-color: var(--nes-cyan); outline: none; }
.fb-submit { width: 100%; font-size: 10px !important; }
.fb-close-btn {
  position: absolute; top: 6px; right: 8px;
  background: none; border: none; color: var(--nes-grey); font-size: 16px; cursor: pointer;
}
.fb-close-btn:hover { color: var(--nes-white); }
.fb-thanks-msg { font-size: 18px; color: var(--nes-yellow); text-align: center; padding: 30px 0; letter-spacing: 3px; }

@keyframes titleBob { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@keyframes flagBlink { 50% { opacity: 0; } }
@keyframes blink { 50% { opacity: 0.3; } }

/* ============================================================= */
/*  NES BUTTONS                                                  */
/* ============================================================= */
.nes-btn {
  display: inline-block;
  font: inherit;
  font-size: 12px;
  padding: 14px 22px;
  background: var(--nes-white);
  color: var(--nes-navy);
  border: none;
  border-top: 4px solid #fff;
  border-left: 4px solid #fff;
  border-bottom: 4px solid #8a8a9a;
  border-right: 4px solid #8a8a9a;
  box-shadow: 0 0 0 4px var(--nes-dark), 4px 4px 0 4px rgba(0,0,0,0.5);
  cursor: pointer;
  letter-spacing: 2px;
  text-transform: uppercase;
  image-rendering: pixelated;
}
.nes-btn:active {
  border-top: 4px solid #8a8a9a;
  border-left: 4px solid #8a8a9a;
  border-bottom: 4px solid #fff;
  border-right: 4px solid #fff;
  transform: translate(2px, 2px);
}
.nes-btn-yellow {
  background: var(--nes-yellow);
  animation: blink 1.2s infinite;
}
.nes-btn-green {
  background: var(--nes-lime);
  color: var(--nes-dark);
}
.nes-btn-cyan {
  background: var(--nes-cyan);
  color: var(--nes-navy);
}

/* ============================================================= */
/*  CONFIG SCREEN                                                */
/* ============================================================= */
.config-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 15;
  padding: 12px;
  overflow-y: auto;
}
.config-header {
  text-align: center;
  padding: 8px 0 16px;
  border-bottom: 3px dashed var(--nes-cyan);
  margin-bottom: 12px;
}
.config-title {
  font-size: 18px;
  color: var(--nes-yellow);
  text-shadow: 2px 2px 0 var(--nes-red);
  letter-spacing: 2px;
}
.config-sub {
  margin-top: 6px;
  font-size: 9px;
  color: var(--nes-cyan);
  letter-spacing: 1px;
}
.config-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.config-section { display: flex; flex-direction: column; gap: 6px; }
.config-label {
  font-size: 10px;
  color: var(--nes-bone);
  letter-spacing: 1px;
}
.config-options {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 4px;
}
.config-options-wrap { flex-wrap: wrap; }
.opt-btn {
  font: inherit;
  font-size: 9px;
  padding: 10px 10px;
  min-width: 56px;
  background: var(--nes-navy);
  color: var(--nes-cyan);
  border: 2px solid var(--nes-cyan);
  cursor: pointer;
  letter-spacing: 1px;
  white-space: nowrap;
  text-transform: uppercase;
}
.opt-btn.active {
  background: var(--nes-yellow);
  color: var(--nes-navy);
  border-color: var(--nes-white);
  box-shadow: inset 0 0 0 1px var(--nes-red);
}
.opt-btn:active { transform: translate(1px, 1px); }
.config-footer {
  padding: 14px 0 8px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
}

/* Challenge banner on config screen */
.challenge-banner {
  margin: 0 auto 8px;
  padding: 10px 12px;
  background: var(--nes-red);
  border: 2px solid var(--nes-yellow);
  text-align: center;
  animation: challenge-pulse 2s ease-in-out infinite;
}
.challenge-banner.hidden { display: none; }
.challenge-vs {
  font-size: 10px;
  color: var(--nes-white);
  letter-spacing: 1px;
}
.challenge-go-btn { min-width: 120px; }
#config-start      { min-width: 120px; }
@keyframes challenge-pulse {
  0%, 100% { border-color: var(--nes-yellow); }
  50% { border-color: var(--nes-white); }
}

/* ============================================================= */
/*  GAME SCREEN                                                  */
/* ============================================================= */
.game-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  z-index: 10;
  background: transparent; /* body background shows on sides of centered panels */
}

.hud {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background:
    linear-gradient(180deg, rgba(12,26,59,0.9), rgba(5,8,20,0.95));
  border-bottom: 3px solid var(--nes-cyan);
  min-height: 56px;
  z-index: 3;
}
.hud-left, .hud-center, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.hud-center { flex-direction: column; text-align: center; flex: 1; }
.hud-right { justify-content: flex-end; gap: 10px; }
.hud-label {
  font-size: 7px;
  color: var(--nes-cyan);
  letter-spacing: 1px;
}
.hud-wind { display: flex; flex-direction: column; align-items: center; }
.hud-wind-arrow {
  font-size: 22px;
  color: var(--nes-yellow);
  line-height: 1;
  transition: transform 0.2s;
}
.hud-wind-val { font-size: 9px; color: var(--nes-white); margin-top: 2px; }
.hud-status {
  font-size: 10px;
  color: var(--nes-yellow);
  margin-top: 3px;
  letter-spacing: 1px;
}
.hud-challenge {
  font-size: 7px;
  color: var(--nes-red);
  letter-spacing: 1px;
  padding: 2px 6px;
  background: rgba(255,59,59,0.15);
  border: 1px solid var(--nes-red);
}
.hud-challenge.hidden { display: none; }
#hud-dock-label { font-size: 9px; color: var(--nes-bone); }
.hud-speed { display: flex; flex-direction: column; align-items: center; }
.hud-speed-val { font-size: 9px; color: var(--nes-lime); margin-top: 2px; }
.hud-menu-btn {
  font: inherit;
  font-size: 8px;
  padding: 8px 10px;
  background: var(--nes-red);
  color: var(--nes-white);
  border: 2px solid var(--nes-white);
  cursor: pointer;
  letter-spacing: 1px;
}

#canvas {
  flex: 1;
  width: 100%;
  display: block;
  background: #0a2340;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  min-height: 0;
}

/* ============================================================= */
/*  DASHBOARD (bottom instrument bar)                            */
/* ============================================================= */
.dashboard {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  padding: 4px 10px;
  background: linear-gradient(0deg, rgba(12,26,59,0.97), rgba(5,8,20,0.92));
  border-top: 3px solid var(--nes-cyan);
  z-index: 3;
  flex-shrink: 0;
}
.dash-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.dash-icon {
  font-size: 20px;
  color: var(--nes-yellow);
  line-height: 1;
  transition: transform 0.2s;
}
.dash-val {
  font-size: 9px;
  color: var(--nes-white);
  letter-spacing: 1px;
}
.dash-big {
  font-size: 11px;
  color: var(--nes-lime);
}
.dash-lbl {
  font-size: 6px;
  color: var(--nes-grey);
  letter-spacing: 1px;
}
.dash-gust-bar {
  width: 36px;
  height: 4px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  overflow: hidden;
  border-radius: 1px;
}
.dash-gust-bar > div {
  height: 100%;
  width: 0%;
  background: var(--nes-orange);
  transition: width 0.1s linear, background 0.2s;
}
.dash-gust {
  font-size: 6px;
  color: var(--nes-orange);
  letter-spacing: 1px;
  min-height: 8px;
  line-height: 1;
}
.dash-sep {
  width: 2px;
  height: 36px;
  background: var(--nes-cyan);
  opacity: 0.25;
}
.dash-rudder-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}
#axiometer {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  display: block;
}

/* Radio widget */
.dash-radio-widget { min-width: 46px; }
.radio-lcd {
  background: #050e08;
  border: 1px solid #1a3a1a;
  color: #b8ff3b;
  font-size: 9px;
  font-family: monospace;
  letter-spacing: 1px;
  padding: 2px 4px;
  text-align: center;
  white-space: nowrap;
  image-rendering: pixelated;
}
.radio-sel-btn {
  background: #1a2535;
  border: 2px solid #7cdfff;
  color: #7cdfff;
  font-family: monospace;
  font-size: 7px;
  letter-spacing: 1px;
  padding: 2px 5px;
  cursor: pointer;
  width: 100%;
}
.radio-sel-btn:active { background: #7cdfff; color: #050814; }
.radio-btn-row { display: flex; gap: 2px; }
.radio-btn-row .radio-sel-btn { flex: 1; }
.radio-mute-btn {
  background: #1a3518;
  border: 2px solid #b8ff3b;
  color: #b8ff3b;
  font-family: monospace;
  font-size: 7px;
  letter-spacing: 1px;
  padding: 2px 4px;
  cursor: pointer;
  min-width: 22px;
}
.radio-mute-btn:active { background: #b8ff3b; color: #050814; }
.radio-mute-btn.muted { background: #351a1a; border-color: #ff3b3b; color: #ff3b3b; }

/* ============================================================= */
/*  CONTROLS                                                     */
/* ============================================================= */
.controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  align-items: stretch;
  gap: 5px;
  padding: 6px 8px 8px;
  background: linear-gradient(0deg, rgba(12,26,59,0.97), rgba(5,8,20,0.92));
  border-top: 3px solid var(--nes-cyan);
  z-index: 3;
}
.ctrl-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 3px;
}
.ctrl-col-thruster { gap: 2px; }

/* Base instrument button — same panel language as dashboard */
.ctrl-btn {
  font: inherit;
  font-size: 18px;
  width: 100%;
  height: 38px;
  background: rgba(8, 18, 48, 0.9);
  color: var(--nes-cyan);
  border: 2px solid rgba(124, 223, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(124, 223, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: background 0.06s, border-color 0.06s, box-shadow 0.06s;
}
.ctrl-btn.active, .ctrl-btn:active {
  background: rgba(124, 223, 255, 0.18);
  color: var(--nes-white);
  border-color: var(--nes-cyan);
  box-shadow:
    inset 0 0 14px rgba(124, 223, 255, 0.30),
    0 0 8px rgba(124, 223, 255, 0.20);
}

/* Rudder left/right — fills column height */
.ctrl-lr { flex: 1; min-height: 52px; height: auto; font-size: 26px; }

/* Bow thruster — yellow accent (special equipment, matches wind arrow) */
.ctrl-sm {
  flex: 1;
  min-height: 20px;
  height: auto;
  font-size: 12px;
  color: var(--nes-yellow);
  border-color: rgba(255, 210, 63, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 210, 63, 0.08),
    inset 0 -1px 0 rgba(0,0,0,0.4);
}
.ctrl-sm.active, .ctrl-sm:active {
  background: rgba(255, 210, 63, 0.18);
  color: var(--nes-yellow);
  border-color: var(--nes-yellow);
  box-shadow:
    inset 0 0 14px rgba(255, 210, 63, 0.30),
    0 0 8px rgba(255, 210, 63, 0.20);
}

/* Throttle — height only */
.ctrl-throttle { height: 28px; font-size: 14px; }

/* Throttle UP — lime (forward = go) */
.ctrl-throttle.ctrl-up {
  color: var(--nes-lime);
  border-color: rgba(184, 255, 59, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(184, 255, 59, 0.08),
    inset 0 -1px 0 rgba(0,0,0,0.4);
}
.ctrl-throttle.ctrl-up.active, .ctrl-throttle.ctrl-up:active {
  background: rgba(184, 255, 59, 0.18);
  color: var(--nes-lime);
  border-color: var(--nes-lime);
  box-shadow:
    inset 0 0 14px rgba(184, 255, 59, 0.30),
    0 0 8px rgba(184, 255, 59, 0.20);
}

/* Throttle DOWN — red (reverse / stop) */
.ctrl-throttle.ctrl-down {
  color: var(--nes-red);
  border-color: rgba(255, 59, 59, 0.38);
  box-shadow:
    inset 0 1px 0 rgba(255, 59, 59, 0.08),
    inset 0 -1px 0 rgba(0,0,0,0.4);
}
.ctrl-throttle.ctrl-down.active, .ctrl-throttle.ctrl-down:active {
  background: rgba(255, 59, 59, 0.18);
  color: var(--nes-red);
  border-color: var(--nes-red);
  box-shadow:
    inset 0 0 14px rgba(255, 59, 59, 0.30),
    0 0 8px rgba(255, 59, 59, 0.20);
}

/* Throttle bar */
.ctrl-throttle-bar {
  width: 100%;
  height: 10px;
  background: rgba(8, 18, 48, 0.9);
  border: 2px solid rgba(124, 223, 255, 0.35);
  position: relative;
  margin: 1px 0;
}
#throttle-fill {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  background: var(--nes-lime);
  width: 0%;
  transform-origin: left;
}
#throttle-fill.reverse {
  background: var(--nes-red);
}
.ctrl-label {
  font-size: 5px;
  color: var(--nes-grey);
  letter-spacing: 1px;
}
.gear-label {
  font-size: 6px;
  letter-spacing: 1px;
  text-align: center;
  color: var(--nes-grey);
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
}

/* Landscape / desktop tweaks */
@media (min-width: 700px) and (orientation: landscape) {
  /* Bars are full-width so background + cyan borders reach browser edges.
     Content is kept in the center 960px zone via calculated padding. */
  .hud {
    min-height: 64px;
    padding-left:  max(10px, calc((100% - 960px) / 2 + 10px));
    padding-right: max(10px, calc((100% - 960px) / 2 + 10px));
  }
  .dashboard {
    padding-left:  max(10px, calc((100% - 960px) / 2 + 10px));
    padding-right: max(10px, calc((100% - 960px) / 2 + 10px));
  }
  .controls {
    padding-left:  max(8px, calc((100% - 960px) / 2 + 8px));
    padding-right: max(8px, calc((100% - 960px) / 2 + 8px));
  }

  .ctrl-btn   { height: 46px; font-size: 20px; }
  .ctrl-lr    { height: auto; min-height: 72px; font-size: 30px; }
  .ctrl-sm    { height: auto; min-height: 26px; font-size: 14px; }
  .ctrl-throttle { height: 32px; }
  .config-body { max-width: 560px; margin: 0 auto; width: 100%; }
}

/* ============================================================= */
/*  OVERLAYS (seagull, poop)                                     */
/* ============================================================= */
.seagull-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
}
.seagull {
  position: absolute;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  will-change: transform;
}
.seagull-sprite {
  width: 32px;
  height: 24px;
  image-rendering: pixelated;
  animation: seagullFlap 0.55s ease-in-out infinite alternate;
}
.seagull-callout {
  font-family: inherit;
  font-size: 10px;
  background: var(--nes-white);
  color: var(--nes-dark);
  padding: 6px 8px;
  border: 2px solid var(--nes-dark);
  border-radius: 8px;
  position: relative;
  white-space: nowrap;
  box-shadow: 3px 3px 0 var(--nes-red);
  letter-spacing: 1px;
}
.seagull-callout::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 10px;
  border: 6px solid transparent;
  border-right-color: var(--nes-dark);
}
@keyframes seagullFlap { from { transform: translateY(0px) scaleY(1); } to { transform: translateY(-3px) scaleY(0.88); } }

.poop-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  overflow: hidden;
}
.poop {
  position: absolute;
  width: 64px;
  height: 64px;
  background: radial-gradient(ellipse at 50% 40%, #f8f8f8 0%, #e0e0d0 40%, #c8c8b0 70%, transparent 85%);
  border-radius: 50% 50% 60% 60% / 40% 40% 70% 70%;
  box-shadow: 0 0 8px rgba(255,255,255,0.4);
  filter: blur(0.5px);
  transform: translate(-50%, -50%) scale(0);
  animation: poopAppear 0.3s ease-out forwards, poopDrip 8s linear 0.4s forwards;
  mix-blend-mode: screen;
}
@keyframes poopAppear {
  to { transform: translate(-50%, -50%) scale(1); }
}
@keyframes poopDrip {
  0%   { transform: translate(-50%, -50%) scale(1, 1); opacity: 1; }
  60%  { transform: translate(-50%, 40%) scale(0.6, 2.2); opacity: 0.8; }
  100% { transform: translate(-50%, 200%) scale(0.2, 3); opacity: 0; }
}

/* Anchor panel */
.anchor-panel {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  padding-bottom: 6px;
}
.anchor-btn {
  font: inherit;
  font-size: 10px;
  padding: 10px 20px;
  background: var(--nes-navy);
  color: var(--nes-yellow);
  border: 2px solid var(--nes-yellow);
  cursor: pointer;
  letter-spacing: 1px;
  animation: blink 0.9s infinite;
  box-shadow: 0 0 10px rgba(255,210,63,0.35);
}
.anchor-btn:active  { transform: translate(1px,1px); }
.anchor-btn.dropped {
  color: var(--nes-grey);
  border-color: var(--nes-grey);
  animation: none;
  box-shadow: none;
}

/* Toast */
.toast {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: var(--nes-navy);
  color: var(--nes-yellow);
  border: 3px solid var(--nes-yellow);
  padding: 16px 22px;
  font-size: 11px;
  letter-spacing: 1px;
  text-align: center;
  box-shadow: 5px 5px 0 var(--nes-red);
  max-width: 80%;
  z-index: 30;
  animation: toastIn 0.25s ease-out;
}
.toast-fade { animation: toastOut 0.4s ease-in forwards; }
@keyframes toastIn  { from { opacity:0; transform:translate(-50%,-60%); } to { opacity:1; transform:translate(-50%,-50%); } }
@keyframes toastOut { to   { opacity:0; transform:translate(-50%,-40%); } }

/* ============================================================= */
/*  WIN / GAME OVER OVERLAYS                                     */
/* ============================================================= */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  background: rgba(5,8,20,0.88);
  animation: overlayIn 0.35s ease-out;
}
@keyframes overlayIn { from { opacity:0; } to { opacity:1; } }

.overlay-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  max-width: 320px;
  width: 90%;
  text-align: center;
  position: relative;
  z-index: 2;
}

/* WIN */
.overlay-win { }
.win-box {
  border: 4px solid var(--nes-yellow);
  box-shadow: 6px 6px 0 var(--nes-red), 0 0 40px rgba(255,210,63,0.25);
  background: var(--nes-navy);
}
.overlay-title { font-size: 20px; letter-spacing: 3px; }
.win-title {
  color: var(--nes-yellow);
  text-shadow: 3px 3px 0 var(--nes-red);
  animation: titleBob 1s ease-in-out infinite alternate;
}
.win-woman {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  margin: 6px 0;
}
/* Pixel woman sprite (inline SVG, 96×160) */
.woman-sprite {
  flex-shrink: 0;
  image-rendering: pixelated;
  animation: womanWave 0.8s steps(2) infinite;
}
@keyframes womanWave {
  0%   { transform: rotate(-4deg) translateY(0); }
  100% { transform: rotate(4deg)  translateY(-2px); }
}
.woman-bubble {
  background: var(--nes-white);
  color: var(--nes-dark);
  border: 2px solid var(--nes-dark);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 9px;
  line-height: 1.7;
  letter-spacing: 0.5px;
  box-shadow: 3px 3px 0 var(--nes-green);
  text-align: left;
  position: relative;
}
.woman-bubble::before {
  content: '';
  position: absolute;
  left: -8px; top: 10px;
  border: 6px solid transparent;
  border-right-color: var(--nes-dark);
}
.win-score {
  font-size: 26px;
  color: var(--nes-yellow);
  letter-spacing: 3px;
  text-shadow: 3px 3px 0 var(--nes-red);
  margin-top: 2px;
}
.win-tier {
  font-size: 12px;
  letter-spacing: 3px;
  padding: 4px 10px;
  border: 2px solid currentColor;
  margin-bottom: 4px;
}
.win-tier.tier-gold   { color: var(--nes-yellow); }
.win-tier.tier-silver { color: #c8d0e0; }
.win-tier.tier-bronze { color: #d08850; }
.win-stat { font-size: 8px; color: var(--nes-cyan); letter-spacing: 1px; }
.win-diff { color: var(--nes-grey); }
.win-challenge-result {
  font-size: 9px;
  letter-spacing: 1px;
  padding: 4px 8px;
  margin-bottom: 4px;
}
.win-challenge-result.hidden { display: none; }
.win-challenge-result.ch-won { color: var(--nes-lime); }
.win-challenge-result.ch-lost { color: var(--nes-red); }
.win-name-row { width: 100%; margin: 4px 0; }
.win-name-input {
  font: inherit;
  font-size: 9px;
  width: 110px;
  padding: 8px 10px;
  background: rgba(5,8,20,0.7);
  color: var(--nes-white);
  border: 2px solid var(--nes-cyan);
  letter-spacing: 1px;
  text-align: center;
  text-transform: uppercase;
  outline: none;
}
.win-name-input::placeholder { color: var(--nes-grey); opacity: 1; }
.win-name-input:focus { border-color: var(--nes-yellow); }

/* GAME OVER */
.go-box {
  border: 4px solid var(--nes-red);
  box-shadow: 6px 6px 0 var(--nes-dark), 0 0 40px rgba(255,59,59,0.3);
  background: var(--nes-dark);
}
.go-title {
  color: var(--nes-red);
  text-shadow: 3px 3px 0 #5c0000;
  animation: goFlash 0.5s steps(2) infinite;
}
@keyframes goFlash { 50% { opacity: 0.5; } }
.go-sub  { font-size: 13px; color: var(--nes-orange); letter-spacing: 2px; }
.go-stat { font-size: 9px; color: var(--nes-white); margin: 4px 0; }
.go-tip  { font-size: 8px; color: var(--nes-grey); line-height: 1.8; margin: 6px 0; }

/* Кнопки оверлея */
.overlay-btns { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; justify-content: center; }

/* Confetti */
.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}
.confetti-bit {
  position: absolute;
  top: -10px;
  width: 6px;
  height: 6px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  to { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}
