/* Cute & Playful Theme Variables */
:root {
  --bg-color: #e0f2fe;      /* Soft sky blue */
  --bg-darker: #bae6fd;     /* Darker sky blue */
  --panel-bg: rgba(255, 255, 255, 0.9);
  --panel-border: rgba(14, 165, 233, 0.15);
  --panel-border-hover: rgba(14, 165, 233, 0.4);
  
  --neon-cyan: #0284c7;     /* Sky blue highlights */
  --neon-blue: #0ea5e9;
  --neon-pink: #f43f5e;     /* Cute pink */
  --neon-purple: #a855f7;   /* Pastel purple */
  --neon-gold: #f59e0b;     /* Sunny gold */
  --neon-red: #ef4444;      /* Soft red */
  
  --font-title: 'Fredoka', sans-serif;
  --font-body: 'Fredoka', sans-serif;
  
  --cursor-size: 50px;
}

/* Reset */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: var(--font-body);
  background: linear-gradient(180deg, var(--bg-color) 0%, var(--bg-darker) 100%);
  color: #334155;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  position: relative;
}

/* Clouds and Meadow Background */
.bg-grid {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 20%;
  background: linear-gradient(180deg, #4ade80 0%, #22c55e 100%); /* Green grass at bottom */
  z-index: 1;
  pointer-events: none;
  border-top: 8px solid #86efac;
}

.bg-clouds {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 100px;
  filter: blur(2px);
}

.cloud::before, .cloud::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 100px;
}

.cloud-1 {
  width: 120px;
  height: 40px;
  top: 15%;
  left: -150px;
  animation: float-cloud 45s linear infinite;
}
.cloud-1::before {
  width: 50px;
  height: 50px;
  top: -25px;
  left: 15px;
}
.cloud-1::after {
  width: 70px;
  height: 70px;
  top: -35px;
  left: 40px;
}

.cloud-2 {
  width: 180px;
  height: 60px;
  top: 35%;
  right: -200px;
  animation: float-cloud-reverse 55s linear infinite;
  opacity: 0.6;
}
.cloud-2::before {
  width: 70px;
  height: 70px;
  top: -35px;
  left: 25px;
}
.cloud-2::after {
  width: 90px;
  height: 90px;
  top: -45px;
  left: 65px;
}

@keyframes float-cloud {
  from { left: -150px; }
  to { left: 100%; }
}

@keyframes float-cloud-reverse {
  from { right: -200px; }
  to { right: 100%; }
}

/* App Container (Board Size 125%) */
.app-container {
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: 580px; /* Increased from 460px to 580px (~125%) */
  height: 100%;
  max-height: 95vh;
  display: flex;
  flex-direction: column;
  padding: 15px;
}

.game-header {
  text-align: center;
  margin-bottom: 15px;
}

.logo {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 2.8rem;
  letter-spacing: 1px;
  color: #0369a1;
  text-shadow: 0 4px 0px rgba(255, 255, 255, 0.8), 0 8px 15px rgba(2, 132, 199, 0.2);
}

.logo .highlight {
  color: #fb7185; /* Cute pink highlight */
  text-shadow: 0 4px 0px rgba(255, 255, 255, 0.8);
}

.subtitle {
  font-family: var(--font-body);
  font-size: 0.9rem;
  letter-spacing: 0.5px;
  color: #0284c7;
  font-weight: 600;
  margin-top: 5px;
}

/* Panels (Screens) */
.panel {
  display: none;
  flex-direction: column;
  background: var(--panel-bg);
  border: 4px solid #fff;
  border-radius: 24px;
  padding: 24px;
  box-shadow: 0 12px 24px rgba(2, 132, 199, 0.15), inset 0 -4px 0 rgba(0,0,0,0.05);
  transition: all 0.3s ease;
  overflow-y: auto;
  max-height: calc(100vh - 130px);
}

.panel.active {
  display: flex;
  animation: panel-pop-in 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes panel-pop-in {
  from {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Preview mole image */
.cute-moles-preview {
  text-align: center;
  margin-bottom: 15px;
}

.preview-mole-container {
  position: relative;
  display: inline-block;
  animation: bounce-mole 2s ease-in-out infinite;
  cursor: pointer;
  touch-action: none;
}

.preview-mole-img {
  width: 90px;
  height: 90px;
  object-fit: contain;
  transition: filter 0.15s ease, transform 0.15s ease;
}

.preview-mole-img.dizzy {
  filter: hue-rotate(60deg) saturate(1.8);
  transform: scaleY(0.7) scaleX(1.2);
}

.preview-mole-container.shaking {
  animation: local-shake 0.12s ease-in-out infinite;
}

.x-eyes {
  position: absolute;
  top: 36%;
  left: 0;
  width: 100%;
  height: 20%;
  pointer-events: none;
  z-index: 10;
}

.x-eye {
  font-family: var(--font-title);
  font-size: 1.6rem;
  font-weight: 900;
  color: #ef4444;
  text-shadow: 0 0 5px #fff, 0 0 10px rgba(239, 68, 68, 0.7);
  display: inline-block;
  animation: dizzy-spin 0.8s linear infinite;
}

.x-eye.left {
  position: absolute;
  left: 28%;
}

.x-eye.right {
  position: absolute;
  right: 28%;
}

@keyframes dizzy-spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes local-shake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  25% { transform: translate(-3px, 1px) rotate(-4deg); }
  75% { transform: translate(3px, -1px) rotate(4deg); }
}

@keyframes bounce-mole {
  0%, 100% { transform: translateY(0) scaleY(1); }
  50% { transform: translateY(-12px) scaleY(0.95); }
}

/* Inputs & Form styling */
.form-group {
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
}

.form-group label {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #0369a1;
}

.form-group input {
  background: #f0f9ff;
  border: 3px solid #bae6fd;
  border-radius: 12px;
  padding: 10px 14px;
  color: #0f172a;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  outline: none;
  transition: all 0.2s ease;
  text-align: center;
}

.form-group input:focus {
  border-color: #38bdf8;
  background: #fff;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.15);
}

/* Difficulty buttons */
.difficulty-selector {
  margin-bottom: 20px;
}

.difficulty-selector h3 {
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #0369a1;
  text-align: center;
}

.difficulty-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.diff-btn {
  background: #f8fafc;
  border: 3px solid #e2e8f0;
  border-radius: 10px;
  color: #64748b;
  padding: 8px 0;
  font-family: var(--font-title);
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.diff-btn:hover {
  border-color: #cbd5e1;
  color: #475569;
}

.diff-btn.active {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0369a1;
}

.diff-btn.danger.active {
  background: #ffe4e6;
  border-color: #f43f5e;
  color: #be123c;
}

/* Instructions on main screen */
.instructions {
  background: #f8fafc;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 20px;
  border: 2px solid #e2e8f0;
}

.instruction-item {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.instruction-item:last-child {
  margin-bottom: 0;
}

.instruction-item .icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.normal-icon {
  background: radial-gradient(circle, #86efac 0%, #22c55e 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.capybara-icon {
  background: radial-gradient(circle, #fed7aa 0%, #f97316 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.gold-icon {
  background: radial-gradient(circle, #fde047 0%, #eab308 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.rabbit-icon {
  background: radial-gradient(circle, #f1f5f9 0%, #cbd5e1 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.glitch-icon {
  background: radial-gradient(circle, #fca5a5 0%, #ef4444 100%);
  border: 2px solid #fff;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.instruction-item h4 {
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 700;
  color: #1e293b;
}

.instruction-item p {
  font-size: 0.75rem;
  color: #64748b;
}

/* Leaderboard */
.high-score-board {
  margin-top: 15px;
  border-top: 2px dashed #cbd5e1;
  padding-top: 15px;
}

.high-score-board h3 {
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: #fb7185;
  margin-bottom: 8px;
  text-align: center;
}

#leaderboard {
  list-style: none;
}

#leaderboard li {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  margin-bottom: 4px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #475569;
  border-left: 4px solid var(--neon-cyan);
}

#leaderboard li:nth-child(1) {
  border-left-color: var(--neon-gold);
  background: #fef9c3;
  color: #854d0e;
}

.empty-leaderboard {
  justify-content: center !important;
  color: #94a3b8;
  font-style: italic;
  border-left: none !important;
}

/* Buttons */
.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border: none;
  border-radius: 14px;
  color: #fff;
  padding: 12px 0;
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.25), inset 0 -3px 0 rgba(0,0,0,0.15);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(2, 132, 199, 0.35), inset 0 -3px 0 rgba(0,0,0,0.15);
}

.btn-primary:active {
  transform: translateY(1px);
  box-shadow: 0 2px 5px rgba(2, 132, 199, 0.2);
}

.btn-secondary {
  width: 100%;
  background: #f1f5f9;
  border: 2px solid #e2e8f0;
  border-radius: 14px;
  color: #64748b;
  padding: 10px 0;
  font-family: var(--font-title);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 8px;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #475569;
}

/* HUD System */
.hud-top {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.hud-item {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
}

.hud-item.highlight-border {
  border-color: #0ea5e9;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.08);
}

.hud-label {
  font-family: var(--font-title);
  font-size: 0.75rem;
  color: #64748b;
  font-weight: 700;
  margin-bottom: 1px;
}

.hud-val {
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: #1e293b;
}

.text-neon-blue {
  color: #0284c7;
}

.text-neon-pink {
  color: #e11d48;
}

.text-neon-cyan {
  color: #0ea5e9;
}

.text-neon-gold {
  color: #d97706;
}

.hud-bar {
  margin-bottom: 15px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f43f5e, #fb7185);
  border-radius: 4px;
  transition: width 0.15s linear;
}

/* Dirt Hole Grid Layout */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  margin: 5px 0 15px 0;
  aspect-ratio: 1;
  touch-action: none;
}

.grid-hole {
  position: relative;
  background: radial-gradient(circle, #78350f 10%, #451a03 90%); /* Dirt color */
  border-radius: 50%;
  aspect-ratio: 1;
  overflow: hidden;
  border: 4px solid #854d0e; /* Soil rim */
  box-shadow: inset 0 6px 12px rgba(0,0,0,0.6), 0 4px 6px rgba(0,0,0,0.1);
  display: flex;
  justify-content: center;
  align-items: flex-end;
  transition: border-color 0.2s, background 0.3s, transform 0.1s;
  touch-action: none;
}

.grid-hole.kbd-active {
  border-color: #38bdf8 !important;
  box-shadow: inset 0 6px 12px rgba(0,0,0,0.7), 0 0 15px rgba(56, 189, 248, 0.6) !important;
  transform: scale(0.96);
}

/* Keyboard Numpad Hints */
.numpad-hint {
  position: absolute;
  top: 8px;
  left: 12px;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.25);
  z-index: 5;
  pointer-events: none !important;
  display: none;
}

@media (pointer: fine) {
  .numpad-hint {
    display: block; /* Show only on desktop/mouse users */
  }
}

/* Active Ring Glow */
.portal-ring {
  position: absolute;
  top: -6px;
  left: -6px;
  right: -6px;
  bottom: -6px;
  border-radius: 50%;
  border: 4px solid transparent;
  pointer-events: none !important;
  z-index: 5;
  transition: all 0.25s ease;
}

.grid-hole.active-portal .portal-ring {
  border-color: #4ade80; /* Grass outline glow */
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.4);
}

.grid-hole[class*='react-'] .portal-ring {
  animation: portal-reaction-pulse 0.45s ease-out;
}

.grid-hole.react-normal .portal-ring {
  border-color: rgba(14, 165, 233, 0.92);
  box-shadow: 0 0 14px rgba(14, 165, 233, 0.32);
}

.grid-hole.react-capybara .portal-ring {
  border-color: rgba(168, 85, 247, 0.92);
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.30);
}

.grid-hole.react-gold .portal-ring {
  border-color: rgba(245, 158, 11, 0.98);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.34);
}

.grid-hole.react-mashimaro .portal-ring {
  border-color: rgba(244, 114, 182, 0.95);
  box-shadow: 0 0 16px rgba(244, 114, 182, 0.32);
}

.grid-hole.react-bomb .portal-ring {
  border-color: rgba(239, 68, 68, 0.98);
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.36);
}

.grid-hole.react-miss .portal-ring,
.grid-hole.react-crack .portal-ring,
.grid-hole.react-broken .portal-ring {
  border-color: rgba(100, 116, 139, 0.88);
  box-shadow: 0 0 12px rgba(100, 116, 139, 0.20);
}

.grid-hole.react-combo .portal-ring {
  border-color: rgba(124, 58, 237, 0.98);
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.38);
}

@keyframes portal-reaction-pulse {
  0% {
    transform: scale(0.92);
    filter: brightness(0.92);
  }
  45% {
    transform: scale(1.08);
    filter: brightness(1.12);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

/* Cracking & Breaking Overlays */
.grid-hole.cracked-1::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M30,30 L50,55 L70,40 M50,55 L45,80 M50,55 L65,70' stroke='rgba(0,0,0,0.45)' stroke-width='3.5' stroke-linecap='round' fill='none'/></svg>");
  background-size: cover;
  pointer-events: none;
  z-index: 4;
}

.grid-hole.cracked-2::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M30,30 L50,55 L70,40 M50,55 L45,80 M50,55 L65,70 M30,30 L15,25 M30,30 L25,45 M70,40 L85,30 M70,40 L78,55 M45,80 L35,90 M45,80 L58,85 M65,70 L80,75' stroke='rgba(0,0,0,0.55)' stroke-dasharray='1,1' stroke-width='4.5' fill='none'/><path d='M30,30 L50,55 L70,40 M50,55 L45,80 M50,55 L65,70 M30,30 L15,25 M30,30 L25,45 M70,40 L85,30 M70,40 L78,55 M45,80 L35,90 M45,80 L58,85 M65,70 L80,75' stroke='rgba(0,0,0,0.65)' stroke-width='2.5' stroke-linecap='round' fill='none'/></svg>");
  background-size: cover;
  pointer-events: none;
  z-index: 4;
}

.grid-hole.broken {
  background: radial-gradient(circle, #475569 10%, #1e293b 90%) !important; /* Stone gray */
  border-color: #64748b !important;
  box-shadow: inset 0 8px 16px rgba(0,0,0,0.9);
  pointer-events: none; /* No interaction */
}

.grid-hole.broken::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><path d='M30,30 L70,70 M70,30 L30,70' stroke='%2364748b' stroke-width='4' opacity='0.75'/></svg>"); /* Gray X lines */
  background-size: cover;
  pointer-events: none;
  z-index: 4;
}

.grid-hole.broken::after {
  content: attr(data-broken-text);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #64748b; /* Gray warning tag */
  color: white;
  padding: 3px 6px;
  border-radius: 8px;
  font-family: var(--font-title);
  font-size: 0.65rem;
  font-weight: 800;
  z-index: 6;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  letter-spacing: 0.5px;
}

/* Cute Mole Container & Image sizes */
.mole-container {
  width: 90%;
  height: 90%;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  transform: translateY(100%);
  transition: transform 0.14s cubic-bezier(0.175, 0.885, 0.32, 1.15);
  pointer-events: none !important;
  z-index: 2;
}

.grid-hole.up .mole-container {
  transform: translateY(10%);
}

.mole-img {
  width: 95%;
  height: 95%;
  object-fit: contain;
  display: block;
  pointer-events: none !important;
  transition: filter 0.18s ease, transform 0.18s ease;
}

.grid-hole.react-normal .mole-img {
  filter: brightness(1.04) saturate(1.10) drop-shadow(0 0 4px rgba(14, 165, 233, 0.18));
}

.grid-hole.react-capybara .mole-img {
  filter: brightness(1.05) saturate(1.18) drop-shadow(0 0 5px rgba(168, 85, 247, 0.18));
}

.grid-hole.react-gold .mole-img {
  filter: brightness(1.10) saturate(1.18) drop-shadow(0 0 6px rgba(245, 158, 11, 0.24));
}

.grid-hole.react-mashimaro .mole-img {
  filter: brightness(1.08) saturate(1.22) drop-shadow(0 0 6px rgba(244, 114, 182, 0.22));
}

.grid-hole.react-bomb .mole-img {
  filter: brightness(1.03) saturate(1.08) drop-shadow(0 0 6px rgba(239, 68, 68, 0.24));
}

.grid-hole.react-combo .mole-img {
  filter: brightness(1.12) saturate(1.30) drop-shadow(0 0 8px rgba(124, 58, 237, 0.34));
}

.grid-hole.react-miss .mole-img,
.grid-hole.react-crack .mole-img,
.grid-hole.react-broken .mole-img {
  filter: grayscale(0.12) brightness(0.98);
}

/* Hit visual particles */
.hit-effect {
  position: absolute;
  pointer-events: none;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  mix-blend-mode: screen;
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 1;
  animation: particle-explode 0.4s ease-out forwards;
}

@keyframes particle-explode {
  0% {
    transform: translate(0, 0) scale(1.2);
    opacity: 1;
  }
  100% {
    transform: translate(var(--tx), var(--ty)) scale(0.2);
    opacity: 0;
  }
}

/* Points float numbers */
.points-float {
  position: absolute;
  font-family: var(--font-title);
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  pointer-events: none;
  z-index: 11;
  animation: float-up 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  -webkit-text-stroke: 1px rgba(0, 0, 0, 0.2);
}

.reaction-badge {
  position: absolute;
  left: 50%;
  top: 8%;
  transform: translate(-50%, 10px) scale(0.75) rotate(-4deg);
  z-index: 12;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 92%;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 4px 8px;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-title);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.45px;
  white-space: nowrap;
  pointer-events: none;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: reaction-badge-pop 0.62s ease-out forwards;
}

@keyframes reaction-badge-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, 12px) scale(0.65) rotate(-8deg);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, 2px) scale(1.06) rotate(3deg);
  }
  65% {
    opacity: 1;
    transform: translate(-50%, -8px) scale(1) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -20px) scale(0.90) rotate(0deg);
  }
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translateY(15px) scale(0.7);
  }
  30% {
    opacity: 1;
    transform: translateY(-5px) scale(1.25);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.9);
  }
}

/* Stats screen details */
.final-stats {
  background: #f8fafc;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
  padding: 15px;
  margin: 15px 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 2px solid #f1f5f9;
}

.stat-row:last-child {
  border-bottom: none;
}

.stat-row span:first-child {
  font-family: var(--font-title);
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 700;
}

.stat-val {
  font-family: var(--font-title);
  font-weight: 800;
  font-size: 1.05rem;
  color: #1e293b;
}

.new-record-banner {
  background: #fef9c3;
  border: 3px solid #f59e0b;
  border-radius: 12px;
  color: #b45309;
  padding: 10px;
  text-align: center;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 800;
  margin-bottom: 15px;
  animation: pulse-border 1.5s infinite ease-in-out;
}

@keyframes pulse-border {
  0%, 100% {
    border-color: #f59e0b;
    transform: scale(1);
  }
  50% {
    border-color: #fbbf24;
    transform: scale(1.02);
  }
}

/* In-game Gameplay Tip Box */
.game-tip-box {
  background: rgba(14, 165, 233, 0.05);
  border: 2px dashed #bae6fd;
  border-radius: 12px;
  padding: 6px 10px;
  font-size: 0.58rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #0369a1;
  font-weight: 600;
  margin-bottom: 12px;
  text-align: center;
  line-height: 1.35;
}

/* Record Input Panel for Top 10 Entry */
.record-input-panel {
  background: #fef9c3;
  border: 3px solid #f59e0b;
  border-radius: 16px;
  padding: 12px;
  margin-bottom: 15px;
  text-align: center;
  animation: pulse-border 1.5s infinite ease-in-out;
}

.record-input-panel h3 {
  font-size: 0.85rem;
  color: #854d0e;
  margin-bottom: 8px;
  font-weight: 800;
}

.input-row {
  display: flex;
  gap: 6px;
}

.record-input-panel input {
  flex: 1;
  background: #fff;
  border: 2px solid #fde047;
  border-radius: 10px;
  padding: 8px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 700;
  outline: none;
  text-align: center;
}

.record-input-panel button {
  padding: 8px 16px;
  font-size: 0.9rem;
  border-radius: 10px;
  width: auto;
}

/* Game Over Ranking list (TOP 10) */
.game-over-ranking {
  margin-top: 15px;
  border-top: 2px dashed #cbd5e1;
  padding-top: 15px;
}

.game-over-ranking h3 {
  font-family: var(--font-title);
  font-size: 0.9rem;
  color: #fb7185;
  margin-bottom: 8px;
  text-align: center;
}

#game-over-leaderboard {
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 2px;
}

#game-over-leaderboard li {
  display: flex;
  justify-content: space-between;
  padding: 5px 8px;
  margin-bottom: 4px;
  background: #f1f5f9;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  border-left: 4px solid var(--neon-cyan);
}

#game-over-leaderboard li:nth-child(1) {
  border-left-color: var(--neon-gold);
  background: #fef9c3;
  color: #854d0e;
}

.hidden {
  display: none !important;
}

/* Float controls (Top Right) */
.float-controls {
  position: absolute;
  top: 15px;
  right: 15px;
  display: flex;
  gap: 8px;
  z-index: 100;
}

.audio-toggle-btn, .lang-toggle-btn {
  background: #fff;
  border: 3px solid #bae6fd;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  color: #0284c7;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(2, 132, 199, 0.1);
  transition: all 0.2s ease;
  font-family: var(--font-title);
  font-size: 0.85rem;
  font-weight: 800;
}

.audio-toggle-btn:hover, .lang-toggle-btn:hover {
  border-color: #0ea5e9;
  color: #0369a1;
  transform: scale(1.05);
}

.audio-icon {
  width: 20px;
  height: 20px;
}

/* Mallet Custom Cursor */
.custom-cursor {
  position: fixed;
  width: var(--cursor-size);
  height: var(--cursor-size);
  left: 0;
  top: 0;
  pointer-events: none !important;
  transform: translate(-30%, -70%); /* offset to align mallet head impact center */
  z-index: 10000;
  display: none;
}

@media (pointer: fine) {
  body, button, input, .grid-hole {
    cursor: none !important;
  }
  .custom-cursor {
    display: block;
  }
}

/* Toy wooden hammer visual */
.mallet {
  position: relative;
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
  transform-origin: bottom center;
  transition: transform 0.05s ease;
  pointer-events: none !important;
}

.mallet-head {
  position: absolute;
  width: 32px;
  height: 16px;
  background: #b45309; /* Wooden color */
  border-radius: 4px;
  border: 2px solid #78350f;
  top: 8px;
  left: 8px;
  box-shadow: 0 3px 5px rgba(0,0,0,0.15);
  pointer-events: none !important;
}

.mallet-handle {
  position: absolute;
  width: 6px;
  height: 32px;
  background: #fbbf24;
  border: 2px solid #b45309;
  border-radius: 3px;
  top: 22px;
  left: 21px;
  pointer-events: none !important;
}

/* When whacking, rotate mallet back and down rapidly */
.custom-cursor.active .mallet {
  transform: rotate(-35deg);
}

/* Vibrational Screen Shake */
.shake-screen {
  animation: shake-anim 0.2s ease-in-out;
}

@keyframes shake-anim {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-3px, 3px); }
  40% { transform: translate(3px, -3px); }
  60% { transform: translate(-2px, -2px); }
  80% { transform: translate(2px, 2px); }
}

.glitch-flash {
  animation: glitch-flash-anim 0.15s ease-out;
}

@keyframes glitch-flash-anim {
  0% { background-color: rgba(255, 255, 255, 0.25); } /* Soft white flash */
  100% { background-color: transparent; }
}

/* Responsive fixes */
@media (max-width: 600px) {
  .app-container {
    max-width: 100vw;
    padding: 10px;
    max-height: 100vh;
  }
  
  .logo {
    font-size: 2.2rem;
  }
  
  .panel {
    padding: 16px;
    max-height: calc(100vh - 100px);
  }
  
  .game-grid {
    gap: 8px;
  }
  
  .hud-top {
    gap: 5px;
  }
  
  .hud-val {
    font-size: 1.05rem;
  }

  .float-controls {
    top: 10px;
    right: 10px;
  }

  .audio-toggle-btn, .lang-toggle-btn {
    width: 34px;
    height: 34px;
    font-size: 0.75rem;
  }

  .audio-icon {
    width: 16px;
    height: 16px;
  }

  .reaction-badge {
    top: 9%;
    font-size: 0.58rem;
    padding: 3px 6px;
    letter-spacing: 0.3px;
  }

  .points-float {
    font-size: 1rem;
  }
}
