/* Reset and Base */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #030308;
  font-family: 'Outfit', sans-serif;
  color: #fff;
}

:root {
  --brand-teal: #208b7d;
  --brand-neon-teal: #24bfae;
  --brand-yellow: #ece213;
  --brand-neon-yellow: #f7f01e;
  --brand-white: #ffffff;
}

/* Core Wrapper (Dynamic Aspect Ratio Lock & Centering) */
.game-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(circle at center, #0a0a20 0%, #030308 100%);
  padding: 10px;
}

/* Canvas Container */
.canvas-container {
  position: relative;
  width: 100%;
  max-width: 450px; /* High scale constraint */
  height: 100%;
  max-height: 800px;
  aspect-ratio: 9/16;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.9), 0 0 30px rgba(36, 191, 174, 0.05);
  border: 1px solid rgba(36, 191, 174, 0.1);
  background-color: #000;
}

/* Responsive Canvas */
#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto; /* Enable smooth bilinear filtering and anti-aliasing for high-res cartoon sprites */
}

/* Overlay Layers (Menus & HUD) */
.overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(3, 3, 8, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  transition: opacity 0.3s ease;
}

.overlay-layer.hidden, .hud-layer.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Overlay Card Style (Glassmorphism) */
.overlay-card {
  width: 85%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 20px;
  padding: 20px 20px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(255, 255, 255, 0.02);
  transform: translateY(0);
  animation: float-up 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Specific optimizations for Start Menu Card to fit the 320x250 ad perfectly on mobile */
.start-card {
  width: 97%;
  padding: 20px 8px;
}

/* Game Over Menu Card optimizations */
.game-over-card {
  width: 90%;
  padding: 20px 15px;
}

@keyframes float-up {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Title & Text styling */
.logo-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 4px;
  line-height: 1.2;
  margin-bottom: 5px;
}

.subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 25px;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.info-box {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 30px;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Neon Glow Classes */
.neon-text-blue {
  color: var(--brand-neon-teal);
  text-shadow: 0 0 15px rgba(36, 191, 174, 0.7);
}

.neon-text-pink {
  color: var(--brand-neon-yellow);
  text-shadow: 0 0 15px rgba(247, 240, 30, 0.7);
}

.neon-text-green {
  color: var(--brand-neon-teal);
  text-shadow: 0 0 10px rgba(36, 191, 174, 0.5);
}

.neon-text-yellow {
  color: var(--brand-neon-yellow);
  text-shadow: 0 0 15px rgba(247, 240, 30, 0.6);
}

.neon-text-red {
  color: #ff3333;
  text-shadow: 0 0 15px rgba(255, 51, 51, 0.7);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 20px;
}

/* HUD Panel */
.hud-layer {
  position: absolute;
  top: 75px; /* Pushed down to clear the gameplay top ad banner */
  left: 15px;
  right: 15px;
  display: flex;
  justify-content: space-between;
  z-index: 5;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.hud-left, .hud-right {
  background: rgba(10, 10, 25, 0.6);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 1px;
}

.hud-value {
  font-size: 16px;
  font-weight: 800;
}

/* Custom Neon Border Buttons */
.menu-btn {
  background: transparent;
  border: none;
  outline: none;
  cursor: pointer;
  position: relative;
  padding: 14px 28px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 1px;
  width: 100%;
  border-radius: 30px;
  overflow: hidden;
  transition: all 0.3s ease;
}

.button-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.neon-border-blue {
  border: 2px solid var(--brand-neon-teal);
  box-shadow: 0 0 10px rgba(36, 191, 174, 0.2);
}

.neon-border-blue:hover {
  background: var(--brand-neon-teal);
  color: #030308;
  box-shadow: 0 0 20px rgba(36, 191, 174, 0.6);
  transform: translateY(-2px);
}

.neon-border-green {
  border: 2px solid var(--brand-neon-teal);
  box-shadow: 0 0 10px rgba(36, 191, 174, 0.2);
}

.neon-border-green:hover {
  background: var(--brand-neon-teal);
  color: #030308;
  box-shadow: 0 0 20px rgba(36, 191, 174, 0.6);
  transform: translateY(-2px);
}

.neon-border-pink {
  border: 2px solid var(--brand-neon-yellow);
  box-shadow: 0 0 10px rgba(247, 240, 30, 0.2);
}

.neon-border-pink:hover {
  background: var(--brand-neon-yellow);
  color: #030308;
  box-shadow: 0 0 20px rgba(247, 240, 30, 0.6);
  transform: translateY(-2px);
}

/* Score Display */
.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 25px;
  background: rgba(255, 255, 255, 0.02);
  padding: 15px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.score-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 2px;
  margin-bottom: 5px;
}

.score-value {
  font-size: 32px;
  font-weight: 800;
}

/* Premium Glassmorphic Ad Slot Styles */
.ad-container-slot {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.ad-label {
  font-size: 8px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 2px;
  margin-bottom: 5px;
  text-transform: uppercase;
  font-weight: 800;
}

.ad-box {
  width: 100%;
  height: 52px; /* Perfectly sized standard mobile banner layout (approx. 320x50 ratio) */
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ad-box:hover {
  border-color: rgba(36, 191, 174, 0.25);
  background: rgba(36, 191, 174, 0.015);
  box-shadow: 0 0 12px rgba(36, 191, 174, 0.04);
}

.ad-text {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
}

/* 320x250 Large Ad Box for Start Menu */
.ad-box-large {
  width: 100%;
  max-width: 320px;
  height: 250px; /* High-value 320x250 medium rectangle */
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-top: 5px;
}

.ad-box-large:hover {
  border-color: rgba(36, 191, 174, 0.25);
  background: rgba(36, 191, 174, 0.015);
  box-shadow: 0 0 15px rgba(36, 191, 174, 0.04);
}

/* Gameplay Top Ad Banner (320x50 Monetization layer) */
.gameplay-ad-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px; /* 50px standard ad banner + labels & padding padding */
  background: rgba(10, 10, 25, 0.65);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 8;
  transition: opacity 0.3s ease;
}

.gameplay-ad-layer.hidden {
  opacity: 0;
  pointer-events: none;
}

.ad-label-top {
  font-size: 7px;
  color: rgba(255, 255, 255, 0.2);
  letter-spacing: 1.5px;
  margin-bottom: 2px;
  font-weight: 800;
  text-transform: uppercase;
}

.ad-box-top {
  width: 320px;
  height: 50px;
  background: rgba(255, 255, 255, 0.015);
  border-radius: 4px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ad-text-top {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.25);
  letter-spacing: 0.5px;
}

/* Home Link styling inside overlay cards */
.home-link {
  display: inline-block;
  margin-top: 15px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  text-decoration: none;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.04);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.home-link:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.home-link.neon-text-blue:hover {
  border-color: var(--brand-neon-teal);
  box-shadow: 0 0 12px rgba(36, 191, 174, 0.2);
}

.home-link.neon-text-pink:hover {
  border-color: var(--brand-neon-yellow);
  box-shadow: 0 0 12px rgba(247, 240, 30, 0.2);
}
