/* Pirate Treasure Island — tropical pirate theme. Large fonts throughout. */
:root {
  --gold: #ffcf3f;
  --deep: #0b2233;
  --panel: #f7e8c3;
  --wood: #7a4a1e;
  --red: #d33a2c;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: linear-gradient(180deg, #0b2233 0%, #10425e 60%, #0a2a3f 100%);
  color: #fff;
  font-family: "Treasure", "Comic Sans MS", "Chalkboard SE", Verdana, sans-serif;
  min-height: 100vh;
}
#wrap { max-width: 1040px; margin: 0 auto; padding: 18px 14px 28px; }
#topbar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
#logo {
  font-family: "Press Start 2P", monospace;
  font-size: 26px; color: var(--gold);
  text-shadow: 3px 3px 0 #5b2d0e, 6px 6px 0 rgba(0,0,0,.45);
  letter-spacing: 1px;
}
#top-hint { font-size: 19px; color: #ffe9a8; }

#stage {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  border: 6px solid var(--wood); border-radius: 14px; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.55), inset 0 0 0 3px #3d2410;
  background: #79c7e8;
}
#game { width: 100%; height: 100%; display: block; image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- HUD ---------- */
#hud {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 10px 12px; pointer-events: none;
  font-size: 21px; font-weight: bold;
  text-shadow: 2px 2px 0 rgba(0,0,0,.75);
}
#hud.hidden { display: none; }
.hud-left, .hud-right { display: flex; gap: 12px; align-items: center; }
.hud-mid { text-align: center; }
#hearts { font-size: 26px; letter-spacing: 2px; }
#coins, #keystat, #skulls {
  background: rgba(20, 12, 4, .62); border: 3px solid var(--gold);
  border-radius: 12px; padding: 4px 12px; font-size: 22px;
}
#mutestate {
  background: rgba(20, 12, 4, .62); border: 3px solid #fff;
  border-radius: 12px; padding: 4px 10px; font-size: 22px;
}
#keystat.got { background: rgba(46, 110, 20, .75); border-color: #9dff57; }
#score {
  font-family: "Press Start 2P", monospace; font-size: 19px; color: #fff;
  background: rgba(20,12,4,.62); border: 3px solid #fff; border-radius: 12px;
  padding: 7px 16px; display: inline-block;
}
#objective {
  margin-top: 6px; font-size: 21px; color: #ffe9a8;
  background: rgba(20,12,4,.55); border-radius: 10px; padding: 3px 14px;
  display: inline-block;
}
#timer-frame {
  font-family: "Press Start 2P", monospace; font-size: 20px; color: #fff;
  background: #4a2c10 url("") ; border: 4px solid var(--gold); border-radius: 14px;
  padding: 8px 16px; box-shadow: 0 0 0 3px #3d2410, 0 4px 10px rgba(0,0,0,.5);
}
#timer-frame.warn { color: #ff5b4d; border-color: #ff5b4d; animation: pulse .6s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.1); } }

/* floating toast + interact prompt */
#toast {
  position: absolute; top: 84px; left: 50%; transform: translateX(-50%);
  background: rgba(20,12,4,.85); border: 3px solid var(--gold); border-radius: 12px;
  padding: 8px 22px; font-size: 23px; font-weight: bold; color: #ffe9a8;
  text-shadow: 2px 2px 0 rgba(0,0,0,.8);
  pointer-events: none; white-space: nowrap;
}
#toast.hidden, #prompt.hidden { display: none; }
#toast.pop { animation: toastpop .35s ease-out; }
@keyframes toastpop { 0% { transform: translateX(-50%) scale(.6); } 60% { transform: translateX(-50%) scale(1.12); } 100% { transform: translateX(-50%) scale(1); } }
#prompt {
  position: absolute; bottom: 88px; left: 50%; transform: translateX(-50%);
  background: #1d7a1d; border: 3px solid #fff; border-radius: 12px;
  padding: 6px 20px; font-size: 22px; font-weight: bold; pointer-events: none;
  text-shadow: 2px 2px 0 rgba(0,0,0,.8);
  animation: bob 0.7s infinite alternate ease-in-out;
}
#objective { font-size: 22px; }
@keyframes bob { from { transform: translateX(-50%) translateY(0); } to { transform: translateX(-50%) translateY(-7px); } }

/* ---------- overlays ---------- */
.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 18, 28, .72); z-index: 5;
}
.overlay.hidden { display: none; }
.panel {
  background: var(--panel); color: #3a2208; border: 6px solid var(--wood);
  border-radius: 18px; padding: 26px 38px; text-align: center; max-width: 640px;
  box-shadow: 0 14px 50px rgba(0,0,0,.6);
}
.panel h1 {
  font-family: "Press Start 2P", monospace; font-size: 30px; line-height: 1.5;
  color: #7a2d12; margin: 0 0 14px;
}
.panel .story { font-size: 20px; line-height: 1.55; }
.controls-grid {
  display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; text-align: left;
  font-size: 19px; background: rgba(122,74,30,.12); border-radius: 12px;
  padding: 12px 18px; margin: 14px 0 18px;
}
.controls-grid span:nth-child(odd) { font-weight: bold; color: #7a2d12; }
.big-btn {
  font-family: "Press Start 2P", monospace; font-size: 22px; cursor: pointer;
  background: linear-gradient(180deg, #e04c3a, #a32415); color: #fff;
  border: 4px solid #5e150c; border-radius: 14px; padding: 14px 30px;
  box-shadow: 0 6px 0 #5e150c, 0 10px 18px rgba(0,0,0,.4);
}
.big-btn:hover { filter: brightness(1.12); }
.big-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #5e150c; }
.stats { font-size: 21px; font-weight: bold; margin: 10px 0 18px; line-height: 1.8; }

#help {
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  margin-top: 12px; font-size: 19px; color: #ffe9a8;
}
#version {
  position: absolute; right: 8px; bottom: 6px; z-index: 6;
  font-size: 12px; color: rgba(255, 255, 255, .75);
  text-shadow: 1px 1px 0 rgba(0,0,0,.8);
  pointer-events: none;
}
#help b { color: var(--gold); }
