/* ═══════════════════════════════════════════
   Game mode selection screen
   ═══════════════════════════════════════════ */

/* ── Full-screen wrapper ── */
#gamemode-selection {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  pointer-events: all;
}

/* ── Blurred background image ── */
#gamemode-selection::before {
  content: '';
  position: absolute;
  top: -10px;
  left: -10px;
  right: -10px;
  bottom: -10px;
  background: url('../images/2D_overlay.jpg') center/cover no-repeat;
  background-size: cover;
  background-position: center;
  -webkit-background-size: cover;
  image-rendering: high-quality;
  -webkit-image-rendering: high-quality;
  filter: blur(0px);
  opacity: 0;
  transition: filter 1.8s ease-in-out, opacity 0.6s ease-in-out;
  z-index: -2;
}

/* ── Dark gradient vignette ── */
#gamemode-selection::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 36, 73, 0.0) 0%, rgba(0, 36, 73, 0.6) 100%);
  opacity: 0;
  transition: opacity 1.8s ease-in-out;
  z-index: -1;
}

/* ── Intro animation triggers ── */
#gamemode-selection.intro-active::before {
  filter: blur(12px);
  opacity: 1;
}

#gamemode-selection.intro-active::after {
  opacity: 1;
}

#gamemode-selection.hidden {
  display: none;
}

/* ── Central card ── */
.gamemode-container {
  text-align: center;
  padding: 5vh 6vw;
  background: rgba(0, 36, 73, 0.85);
  border-radius: 1.6vmin;
  border: 2px solid rgba(180, 151, 77, 0.6);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 0.8vmin 3.2vmin rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(3vh);
  transition: opacity 1s ease 0.8s, transform 1s ease 0.8s;
}

#gamemode-selection.intro-active .gamemode-container {
  opacity: 1;
  transform: translateY(0);
}

/* ── Title & subtitle ── */
.gamemode-title {
  font-size: 3.6vmin;
  font-weight: bold;
  color: #B4974D;
  margin-bottom: 1.2vmin;
  text-shadow: 0 0.2vmin 1.2vmin rgba(0, 0, 0, 0.6);
  letter-spacing: 0.1vmin;
}

.gamemode-subtitle {
  font-size: 1.4vmin;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 4vh;
  font-weight: 300;
  letter-spacing: 0.2vmin;
  text-transform: uppercase;
}

/* ── Mode buttons ── */
.gamemode-buttons {
  display: flex;
  gap: 2.4vmin;
  justify-content: center;
}

.gamemode-btn {
  padding: 1.4vmin 4.4vmin;
  font-size: 1.6vmin;
  font-weight: 600;
  color: #B4974D;
  background: transparent;
  border: 2px solid rgba(180, 151, 77, 0.5);
  border-radius: 0.8vmin;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: none;
  letter-spacing: 0.05vmin;
}

.gamemode-btn:hover {
  background: rgba(180, 151, 77, 0.15);
  border-color: #B4974D;
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(180, 151, 77, 0.25);
  color: #D4B85E;
}

.gamemode-btn:active {
  transform: translateY(0px);
}

/* ── How to Play link button ── */
.gamemode-howto-btn {
  margin-top: 3vh;
  background: transparent;
  border: none;
  color: rgba(180, 151, 77, 0.75);
  font-size: 1.3vmin;
  font-weight: 500;
  letter-spacing: 0.1vmin;
  text-transform: uppercase;
  cursor: pointer;
  padding: 0.6vmin 1.2vmin;
  text-decoration: underline;
  text-underline-offset: 0.4vmin;
  transition: color 0.2s ease;
}

.gamemode-howto-btn:hover {
  color: #D4B85E;
}

/* ── How to Play overlay ── */
#how-to-play-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 16000;
  background: rgba(3, 8, 20, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 4vh 4vw;
  box-sizing: border-box;
}

#how-to-play-overlay.visible {
  display: flex;
}

#how-to-play-box {
  background: #0c1430;
  border: 1px solid rgba(180, 151, 77, 0.45);
  border-radius: 1vmin;
  padding: 4vh 4vw;
  max-width: 50vw;
  width: 100%;
  color: #e9edf8;
  text-align: center;
  box-shadow: 0 0 6vmin rgba(180, 151, 77, 0.2);
}

#how-to-play-title {
  margin: 0 0 2vh;
  color: #D4B85E;
  font-size: clamp(1.2rem, 2.4vw, 3rem);
  font-weight: 700;
  letter-spacing: 0.1vmin;
}

.how-to-play-mode {
  margin-bottom: 2.5vh;
  text-align: left;
}

.how-to-play-mode h3 {
  margin: 0 0 0.8vh;
  color: #B4974D;
  font-size: clamp(0.9rem, 1.4vw, 1.8rem);
  font-weight: 700;
}

.how-to-play-mode p {
  margin: 0;
  font-size: clamp(0.75rem, 1vw, 1.4rem);
  line-height: 1.55;
  color: rgba(233, 237, 248, 0.88);
}

#how-to-play-close-btn {
  margin-top: 1vh;
  padding: 1.2vmin 4vmin;
  font-size: clamp(0.8rem, 1.1vw, 1.5rem);
  font-weight: 600;
  color: #B4974D;
  background: transparent;
  border: 2px solid rgba(180, 151, 77, 0.6);
  border-radius: 0.8vmin;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.05vmin;
}

#how-to-play-close-btn:hover {
  background: rgba(180, 151, 77, 0.15);
  border-color: #B4974D;
  color: #D4B85E;
}

/* ── Exit animation ── */
@keyframes diveBlurandFade {
  0%   { opacity: 1; filter: blur(0px) scale(1); }
  50%  { filter: blur(8px) scale(1.05); }
  100% { opacity: 0; filter: blur(15px) scale(1.1); }
}

#gamemode-selection.hide-animation {
  animation: diveBlurandFade 1.2s ease-in forwards;
}
