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

body {
  font-family: "Rajdhani", sans-serif;
  background: #000000;
  background-image: url("../img/bg.png");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #ffffff;
  overflow: hidden;
  min-height: 100vh;
  position: relative;
}

/* Jerry Cut theme accents */
:root {
  --jc-accent-a: #00ff88; /* neon green */
  --jc-accent-b: #ff6b9d; /* neon pink */
  --jc-surface: rgba(15, 15, 25, 0.78);
  --jc-surface-2: rgba(15, 15, 25, 0.55);
  --jc-border: rgba(0, 255, 136, 0.28);
  --jc-text-dim: rgba(255, 255, 255, 0.78);
}

/* ===== BACKGROUND EFFECTS ===== */
#background-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  /* Background is now the bg.png (body + canvas). Keep this inert. */
  background: transparent;
  animation: none;
}

/* ===== CANVAS STYLING ===== */
canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  filter: drop-shadow(0 0 20px rgba(255, 107, 107, 0.15))
    drop-shadow(0 0 40px rgba(78, 205, 196, 0.1))
    drop-shadow(0 0 60px rgba(69, 183, 209, 0.05));
  border-radius: 0;
  background: transparent;
}

/* ===== GAME UI ===== */
.game-ui {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
}

/* Top bar: full width, fixed height, void starts below this */
.game-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  pointer-events: auto;
  z-index: 1000;
  box-sizing: border-box;
}

.header-left {
  flex: 1;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  min-width: 0;
}

.header-center {
  flex: 0 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
}

/* ===== GAME TITLE ===== */
.game-title {
  position: absolute;
  top: 30px;
  left: 30px;
  pointer-events: auto;
  z-index: 10;
  display: none; /* Hide the game title on the game page */
}

.title-text {
  font-family: "Orbitron", monospace;
  font-size: 3rem;
  font-weight: 900;
  margin-bottom: 8px;
  letter-spacing: 4px;
  text-shadow: 0 0 30px rgba(255, 255, 255, 0.4);
}

.title-void {
  color: #00ff88; /* Bright green color like in the image */
}

.title-painter {
  color: #ff6b9d; /* Bright pink color like in the image */
}

.subtitle-text {
  font-family: "Rajdhani", sans-serif;
  font-size: 1.2rem;
  color: #ffffff;
  font-weight: 400;
  letter-spacing: 3px;
  text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

/* ===== GAME STATS (top-center, inside header) ===== */
.game-stats {
  display: flex;
  flex-direction: row;
  gap: 10px;
  background: rgba(15, 15, 25, 0.6);
  backdrop-filter: blur(10px);
  padding: 8px 12px;
  border-radius: 15px;
  border: 1px solid rgba(0, 255, 136, 0.3);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 255, 136, 0.05);
  overflow: hidden;
  width: auto;
  opacity: 0.9;
  align-items: center;
  justify-content: center;
}

/* ===== CONTROL BUTTONS (left side of top bar) ===== */
.control-buttons {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.control-button {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(15, 15, 25, 0.6);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(0, 255, 136, 0.3);
  color: #00ff88;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 10px rgba(0, 255, 136, 0.05);
  font-size: 1.2rem;
  opacity: 0.8;
}

.control-button:hover {
  background: rgba(0, 255, 136, 0.15);
  border-color: rgba(0, 255, 136, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 255, 136, 0.1);
  transform: translateY(-2px);
  opacity: 1;
}

.control-button:active {
  transform: translateY(0);
}

.control-icon {
  filter: drop-shadow(0 0 8px currentColor);
}

/* Home button – same color as sound button (green) */
.home-button {
  border-color: rgba(0, 255, 136, 0.3);
  color: #00ff88;
}

.home-button:hover {
  background: rgba(0, 255, 136, 0.15);
  border-color: rgba(0, 255, 136, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 255, 136, 0.1);
}

/* Extra life button (right of score panel) – same color as sound button */
.extra-life-button {
  border-color: rgba(0, 255, 136, 0.3);
  color: #00ff88;
  display: none; /* Shown only when lives === 1 */
}

.extra-life-button.extra-life-button--visible {
  display: flex;
}

.extra-life-button:hover {
  background: rgba(0, 255, 136, 0.15);
  border-color: rgba(0, 255, 136, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(0, 255, 136, 0.1);
}

.extra-life-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.extra-life-button .control-icon {
  font-size: 1.1rem;
}

.extra-life-plus {
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 0.5rem;
  opacity: 0.95;
}

/* Sound button specific styles */
.sound-button.muted {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.3);
}

.sound-button.muted:hover {
  background: rgba(255, 107, 107, 0.15);
  border-color: rgba(255, 107, 107, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 15px rgba(255, 107, 107, 0.1);
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid rgba(0, 255, 136, 0.2);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  width: auto;
  animation: fadeInUp 0.6s ease-out;
}

.stat-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(0, 255, 136, 0.4);
}

.stat-icon {
  font-size: 1rem;
  filter: drop-shadow(0 0 6px rgba(0, 255, 136, 0.4));
  color: #00ff88;
}

.stat-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1; /* Take remaining space */
}

.stat-label {
  font-size: 0.6rem;
  font-weight: 600;
  color: #a0a0a0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.stat-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

/* ===== POPUP STYLES ===== */
.game-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-popup.active {
  opacity: 1;
  visibility: visible;
}

.popup-content {
  background: linear-gradient(180deg, rgba(15, 15, 25, 0.92) 0%, rgba(10, 10, 16, 0.92) 100%);
  border-radius: 20px;
  padding: 30px;
  max-width: 700px;
  width: 90%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  position: relative;
  overflow: hidden;
  transform: scale(0.8);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.game-popup.active .popup-content {
  transform: scale(1);
  animation: fadeInUp 0.6s ease-out;
}

.popup-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--jc-accent-a), rgba(78, 205, 196, 0.9), var(--jc-accent-b), var(--jc-accent-a));
  background-size: 200% 100%;
  animation: borderGlow 3s ease-in-out infinite;
  border-radius: 20px 20px 0 0;
}

/* ===== POPUP HEADER ===== */
.popup-header {
  text-align: center;
  margin-bottom: 20px;
}

.popup-title {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.popup-logo {
  width: min(380px, 82vw);
  max-height: 120px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.45));
}

.game-over-title {
  background: linear-gradient(45deg, #8b4513, #a0522d, #8b4513);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.success-title {
  background: linear-gradient(45deg, #b8860b, #daa520, #b8860b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-underline {
  width: 100px;
  height: 4px;
  background: linear-gradient(90deg, #b8860b, #d4a017, #b8860b);
  margin: 0 auto;
  border-radius: 2px;
  animation: underlineGlow 2s ease-in-out infinite;
}

@keyframes underlineGlow {
  0%,
  100% {
    box-shadow: 0 0 12px rgba(218, 165, 32, 0.6);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
  }
}

/* ===== POPUP BODY ===== */
.popup-body {
  margin-bottom: 30px;
}

.game-description {
  text-align: center;
  margin-bottom: 0;
}

.description-text {
  font-size: 1rem;
  line-height: 1.5;
  color: var(--jc-text-dim);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Layout for side-by-side sections */
.sections-container {
  display: flex;
  gap: 25px;
  margin-bottom: 20px;
}

.how-to-play {
  flex: 1;
  margin-right: 15px;
}

.game-goals {
  flex: 1;
  margin-left: 15px;
}

/* ===== SECTION STYLES ===== */
.section-title {
  font-family: "Orbitron", monospace;
  font-size: 1.2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: 1px;
  text-shadow: 0 0 18px rgba(0, 255, 136, 0.16);
  position: relative;
  padding-bottom: 8px;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(0, 255, 136, 0.35), transparent);
}

.instructions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 12px 16px;
  background: var(--jc-surface-2);
  border-radius: 12px;
  border: 1px solid rgba(0, 255, 136, 0.18);
  transition: all 0.3s ease;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.instruction-item:hover {
  background: rgba(15, 15, 25, 0.72);
  transform: translateX(3px);
  border-color: rgba(0, 255, 136, 0.35);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

.instruction-icon {
  font-size: 1.4rem;
  min-width: 50px;
  text-align: center;
  flex-shrink: 0;
  color: var(--jc-accent-a);
  filter: drop-shadow(0 0 10px rgba(0, 255, 136, 0.25));
}

.instruction-text {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  flex: 1;
  word-wrap: break-word;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.goals-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.goal-item {
  padding: 6px 12px;
  background: var(--jc-surface-2);
  border-radius: 6px;
  border-left: 3px solid var(--jc-accent-b);
  color: rgba(255, 255, 255, 0.9);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
  transition: all 0.3s ease;
}

.goal-item:hover {
  background: rgba(15, 15, 25, 0.72);
  transform: translateX(3px);
}

/* ===== START SCREEN: full-screen, theme-matched popup ===== */
#start-screen.game-popup {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  align-items: stretch;
  justify-content: stretch;
  padding: 0;
  position: relative;
}

#start-screen.game-popup::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(40, 24, 10, 0.30) 0%,
    rgba(0, 0, 0, 0.18) 55%,
    rgba(0, 0, 0, 0.26) 100%
  );
  pointer-events: none;
  z-index: 0;
}

#start-screen .popup-content {
  width: 100%;
  height: 100vh;
  height: 100dvh;
  max-height: 100vh;
  max-height: 100dvh;
  max-width: none;
  border-radius: 0;
  padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  transform: none;
  transition: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  background: url("../img/bg.png") center / cover no-repeat;
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
}

#start-screen .popup-content::before {
  display: none;
}

#start-screen .popup-header,
#start-screen .popup-body,
#start-screen .popup-footer {
  width: 100%;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

#start-screen.game-popup.active .popup-content {
  animation: fadeInUp 0.45s ease-out;
}

#start-screen .popup-header {
  margin-bottom: 0;
  padding-bottom: 2px;
  border-bottom: none;
}

#start-screen .popup-title {
  margin-bottom: 0;
}

#start-screen .popup-logo {
  width: min(500px, 94vw);
  max-height: 180px;
}

#start-screen .popup-body {
  margin-bottom: 0;
  flex: none;
  overflow: visible;
  padding: 2px 0 0;
}

#start-screen .sections-container {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  gap: 18px;
  margin-bottom: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
}

#start-screen .how-to-play,
#start-screen .game-goals {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  margin: 0;
}

#start-screen .how-to-play {
  padding-right: 0;
  border-right: none;
}

#start-screen .game-goals {
  padding-left: 18px;
}

#start-screen .start-goal {
  margin-top: 14px;
  padding-top: 6px;
  font-family: "Orbitron", monospace;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
  text-align: center;
}

#start-screen .section-title {
  font-size: 1.1rem;
}

#start-screen .section-title::after {
  width: 72px;
}

#start-screen .instruction-item {
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 10px 0;
}

#start-screen .instruction-item:hover {
  background: transparent;
  transform: none;
  border-color: transparent;
  box-shadow: none;
}

#start-screen .instruction-item + .instruction-item {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#start-screen .goal-item {
  background: transparent;
  border-radius: 0;
  border-left: 3px solid rgba(255, 107, 157, 0.75);
  padding: 10px 12px;
}

#start-screen .goal-item + .goal-item {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

#start-screen .goal-item:hover {
  background: transparent;
  transform: none;
}

#start-screen .popup-footer {
  padding-top: 10px;
  border-top: none;
}

#start-screen .instructions {
  align-items: center;
}

#start-screen .start-card {
  background: transparent;
  border: 2px solid rgba(0, 255, 136, 0.32);
  border-radius: 16px;
  padding: 14px 14px 10px;
  box-shadow: none;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}

#start-screen .instruction-item {
  justify-content: center;
}

#start-screen .instruction-text {
  text-align: center;
}

#start-screen .game-button {
  width: min(320px, 86vw);
  font-size: 0.95rem;
  padding: 12px 18px;
  border-radius: 14px;
  border: 2px solid rgba(0, 255, 136, 0.3);
  background: rgba(15, 15, 25, 0.6);
  color: #00ff88;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#start-screen .game-button:hover {
  transform: translateY(-2px);
  background: rgba(0, 255, 136, 0.15);
  border-color: rgba(0, 255, 136, 0.5);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4), 0 0 18px rgba(0, 255, 136, 0.12);
}

#start-screen .game-button:active {
  transform: translateY(0);
}

@media (max-width: 900px) {
  #start-screen .sections-container {
    flex-direction: column;
  }

  #start-screen .how-to-play {
    padding-right: 0;
    border-right: none;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  #start-screen .game-goals {
    padding-left: 0;
    padding-top: 16px;
  }
}

/* ===== STATS DISPLAY ===== */
.final-stats,
.level-stats {
  margin-bottom: 20px;
}

.stat-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
}

/* Level complete specific layout - side by side */
#level-complete-screen .stat-display {
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.final-stat,
.level-stat {
  text-align: center;
  padding: 12px;
  background: rgba(255, 248, 220, 0.5);
  border-radius: 12px;
  border: 2px solid rgba(184, 134, 11, 0.5);
  transition: all 0.3s ease;
}

.final-stat:hover,
.level-stat:hover {
  background: rgba(255, 248, 220, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 90, 43, 0.3);
}

.final-stat .stat-label,
.level-stat .stat-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #6b5a2d;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.final-stat .stat-value,
.level-stat .stat-value {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
  color: #5c4a1a;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
}

/* ===== MESSAGE STYLES ===== */
.performance-message,
.celebration-message {
  text-align: center;
  margin-bottom: 15px;
}

.message-text {
  font-size: 1rem;
  color: #5c4a1a;
  font-weight: 500;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.4);
}

/* ===== BUTTON STYLES ===== */
.popup-footer {
  text-align: center;
}

.game-button {
  position: relative;
  background: linear-gradient(180deg, #f0d98c 0%, #e8d04a 50%, #d4a017 100%);
  color: #5c4a1a;
  border: 3px solid #8b6914;
  padding: 12px 25px;
  font-size: 1rem;
  font-weight: 700;
  font-family: "Orbitron", monospace;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 4px 0 #8b6914, 0 6px 20px rgba(139, 90, 43, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.game-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #8b6914, 0 8px 25px rgba(139, 90, 43, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  background: linear-gradient(180deg, #f5e6b8 0%, #f0d98c 50%, #e8d04a 100%);
}

.game-button:active {
  transform: translateY(1px);
  box-shadow: 0 2px 0 #8b6914, 0 4px 15px rgba(139, 90, 43, 0.3);
}

.button-glow {
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  transition: left 0.5s ease;
}

.game-button:hover .button-glow {
  left: 100%;
}

/* ===== GAME OVER & LEVEL COMPLETE POPUPS ===== */
#game-over-screen .popup-content,
#level-complete-screen .popup-content {
  padding: 25px;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .title-text {
    font-size: 2rem;
    letter-spacing: 2px;
  }

  /* Mobile portrait mode - keep stats in corner but make them more compact */
  .game-stats {
    flex-direction: row !important;
    width: auto !important;
    padding: 6px 8px !important;
    gap: 6px !important;
  }

  /* Control buttons on mobile (stay in header left) */
  .control-buttons {
    gap: 6px !important;
  }

  .control-button {
    width: 40px !important;
    height: 40px !important;
    font-size: 1rem !important;
  }

  .stat-item {
    padding: 3px 5px !important;
  }

  .stat-label {
    font-size: 0.5rem !important;
  }

  .stat-value {
    font-size: 0.8rem !important;
  }

  .stat-icon {
    font-size: 0.9rem !important;
  }

  .popup-content {
    padding: 30px 20px;
    margin: 20px;
    max-width: 95%;
    width: 95%;
  }

  .popup-title {
    font-size: 2rem;
  }

  .popup-logo {
    width: min(320px, 86vw);
    max-height: 104px;
  }

  .stat-display {
    grid-template-columns: 1fr;
  }

  .game-button {
    padding: 12px 25px;
    font-size: 1rem;
  }

  /* Stack sections vertically on mobile */
  .sections-container {
    flex-direction: column;
    gap: 15px;
  }

  .how-to-play,
  .game-goals {
    margin: 0;
  }

  /* Adjust instruction items for mobile */
  .instruction-item {
    gap: 10px;
    padding: 10px 12px;
  }

  .instruction-icon {
    min-width: 40px;
    font-size: 1.2rem;
  }

  .instruction-text {
    font-size: 0.9rem;
  }

  .goal-item {
    font-size: 0.9rem; /* match instruction-text at this breakpoint */
  }

  .section-title {
    font-size: 1.1rem;
    margin-bottom: 12px;
  }
}

@media (max-width: 480px) {
  .title-text {
    font-size: 1.5rem;
  }

  .game-stats {
    flex-direction: row;
    gap: 6px;
    padding: 8px 8px;
    width: auto;
  }

  .popup-title {
    font-size: 1.5rem;
  }

  .popup-logo {
    width: min(280px, 88vw);
    max-height: 92px;
  }

  .section-title {
    font-size: 1.1rem;
  }

  /* Further adjust instruction items for very small screens */
  .instruction-item {
    gap: 8px;
    padding: 8px 10px;
  }

  .instruction-icon {
    min-width: 35px;
    font-size: 1rem;
  }

  .instruction-text {
    font-size: 0.85rem;
  }

  .goal-item {
    font-size: 0.85rem; /* match instruction-text at this breakpoint */
  }

  .section-title {
    font-size: 1rem;
    margin-bottom: 10px;
  }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-5px);
  }
}

.stat-item:nth-child(1) {
  animation-delay: 0.1s;
}
.stat-item:nth-child(2) {
  animation-delay: 0.2s;
}
.stat-item:nth-child(3) {
  animation-delay: 0.3s;
}
.stat-item:nth-child(4) {
  animation-delay: 0.4s;
}

/* Add pulse animation to important stats */
.stat-value {
  animation: pulse 3s ease-in-out infinite;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(45deg, #ff5252, #26a69a);
}

/* ===== CIRCLE CONTROLLER ===== */
.circle-controller {
  position: fixed;
  bottom: 30px;
  left: 30px;
  width: 120px;
  height: 120px;
  z-index: 20;
  pointer-events: auto;
  display: none;
}

.circle-controller.circle-controller--visible {
  display: flex;
  align-items: center;
  justify-content: center;
}

.controller-outer {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(15, 15, 25, 0.95);
  backdrop-filter: blur(15px);
  border: 2px solid rgba(0, 255, 136, 0.5);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 255, 136, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.controller-outer:hover {
  border-color: rgba(0, 255, 136, 0.7);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 255, 136, 0.2);
}

.controller-inner {
  --controller-x: 0;
  --controller-y: 0;
  --controller-glow: 0.3;
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(
    45deg,
    rgba(0, 255, 136, 0.3),
    rgba(78, 205, 196, 0.3)
  );
  border: 2px solid rgba(0, 255, 136, 0.8);
  box-shadow: 0 4px 15px rgba(0, 255, 136, var(--controller-glow));
  transform: translate(var(--controller-x), var(--controller-y));
  transition: box-shadow 0.1s ease;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

.controller-inner:active {
  cursor: grabbing;
  transform: translate(var(--controller-x), var(--controller-y)) scale(0.95);
  box-shadow: 0 2px 10px rgba(0, 255, 136, 0.4);
}

.controller-hint {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* ===== RESPONSIVE CONTROLLER ===== */
@media (max-width: 768px) {
  .circle-controller {
    width: 100px;
    height: 100px;
    bottom: 20px;
    left: 20px;
  }

  .controller-inner {
    width: 50px;
    height: 50px;
  }

  .controller-hint {
    font-size: 0.7rem;
    bottom: -35px;
  }
}

@media (max-width: 480px) {
  .circle-controller {
    width: 90px;
    height: 90px;
    bottom: 15px;
    left: 15px;
  }

  .controller-inner {
    width: 45px;
    height: 45px;
  }

  .controller-hint {
    font-size: 0.65rem;
    bottom: -30px;
  }
}

/* ===== CONTROLLER ANIMATIONS ===== */
@keyframes controllerGlow {
  0%,
  100% {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(0, 255, 136, 0.1);
  }
  50% {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 255, 136, 0.3);
  }
}

.controller-outer {
  animation: controllerGlow 3s ease-in-out infinite;
}

/* ===== TOUCH OPTIMIZATION ===== */
.circle-controller {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.controller-inner {
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
