/* =========================================================
   THEME VARIABLES - whole palette
   ========================================================= */
:root {
  --lavender: #a99cd6;
  --button-purple: #8176b6;
  --button-purple-hover: #7568ab;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: "Press Start 2P", monospace; /* pixel font from index.html */
  color: var(--button-purple);
  text-align: center;
  background-image: url("../images/bgOverall.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

h1,
h2 {
  color: var(--lavender);
  letter-spacing: 2px;
  line-height: 1.6;
}

h1 {
  font-size: clamp(28px, 5vw, 48px);
}

.subtitle {
  color: var(--white);
  font-size: clamp(11px, 1.6vw, 16px);
  line-height: 1.8;
}

.bonus-text {
  line-height: 1.8;
  font-size: clamp(9px, 1.2vw, 12px);
}

.bonus-text-end {
  line-height: 1.8;
  color: var(--button-purple);
}

/* =========================================================
   SOUND TOGGLE
   ========================================================= */

#sound-toggle {
  position: fixed;
  top: 20px;
  right: 20px;

  width: 70px;
  height: 70px;

  cursor: pointer;
  z-index: 10;

  transition: transform 0.15s ease;
}

#sound-toggle:hover {
  transform: scale(1.1);
}

/* =========================================================
   BUTTONS 
   ========================================================= */
button {
  display: inline-block;
  background-color: var(--button-purple);
  color: var(--white);
  font-family: inherit;
  font-size: clamp(12px, 1.8vw, 16px);
  text-decoration: none;
  padding: 18px 28px;
  margin-top: 20px;
  margin-bottom: 20px;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.25);
  transition: background-color 0.15s ease-in-out;
}

button:hover {
  background-color: var(--button-purple-hover);
}

/* =========================================================
   SCREEN CONTAINERS
   Each one fills the full viewport so decorative sprites can be
   positioned anywhere on screen, not just around the centered content.
   ========================================================= */
.container {
  position: relative; /* anchor point for .deco absolutely-positioned children */
  min-height: 100vh;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  overflow: hidden; /* keeps decorative sprites from causing scrollbars */
  padding: 20px;
}

#game-screen,
#game-over-screen {
  display: none; /* toggled by JS */
  position: relative;
}

/* =========================================================
   DECORATIVE SPRITES (non-interactive, purely visual)
   ========================================================= */
.deco {
  position: absolute;
  pointer-events: none;
  user-select: none;
}

/* ---- Start screen ---- */
.deco-start-dolphin {
  width: 140px;
  left: 6%;
  top: 58%;
}

.deco-start-fish-1 {
  width: 50px;
  right: 20%;
  top: 45%;
}

.deco-start-fish-2 {
  width: 45px;
  right: 6%;
  bottom: 18%;
}

/* =========================================================
   MANTA ANIMATION
   ========================================================= */

#manta-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}


/* =========================================================
   GAME BOX - the actual play area
   ========================================================= */
#scoreboard {
  font-size: clamp(12px, 1.8vw, 18px);
  margin-bottom: 16px;
  justify-self: center;
}

#score-value,
#final-score-value {
  color: var(--white);
}

#game-box {
  /* Gameplay-area background - it tiles + scrolls independently
     via JS (see scrollBackground() in main.js), so kept it separate from
     the static page background above. */
  background-image: url("../images/bg.png");
  background-repeat: repeat-x;
  background-size: auto 100%;
  background-color: #061826; /* fallback while the image loads */

  width: min(90vw, 900px);
  aspect-ratio: 2 / 1;

  position: relative;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  z-index: 2;
}

#game-box * {
  pointer-events: none;
}

/* =========================================================
   LIVES (hearts) 
   ========================================================= */
#game-header {
  width: min(90vw, 900px);

  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;

  margin-bottom: 16px;
  z-index: 3;
}

#game-rules {
  display: flex;
  gap: 20px;
  justify-self: start;
}

.rule {
  display: flex;
  align-items: center;
  gap: 4px;

  font-size: 12px;
}

.rule img {
  width: 28px;
}

.minus {
  line-height: 2;
  transform: translateY(-1px);
}

#lives {
  display: flex;
  justify-self: end;
  gap: 8px;
}

.heart {
  width: 32px;
  height: 32px;
}

/* =========================================================
   GAME OVER SCREEN 
   ========================================================= */

/* Crabs flanking the GAME OVER title */
.game-over-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.crab {
  width: 80px;
}

/* Video container */
.video-container {
  width: min(90vw, 560px);
  aspect-ratio: 16 / 9;
  margin: 25px 0;
}

.video-container iframe {
  width: 100%;
  height: 100%;
  border: 4px solid var(--button-purple);
  border-radius: 16px;
}
