/* ============================================
   AlphaClicker — Full Styles (v2)
   ============================================ */

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

body {
  font-family: 'Poppins', sans-serif;
  overflow: hidden;
  height: 100vh;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  transition: background 1s ease;
}

/* ---- Header ---- */
#header {
  padding: 10px 24px;
  padding-right: 364px;
  text-align: center;
  position: relative;
  z-index: 10;
}

#header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

#game-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2.2rem;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: funkyGradient 3s ease infinite;
}

@keyframes funkyGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

#menu-buttons {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 6px;
}

#menu-buttons button {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#menu-buttons button:hover {
  background: rgba(255,255,255,0.2);
  transform: scale(1.1);
}

#player-name-display {
  font-family: 'Fredoka One', cursive;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 2px;
}

#version-display {
  position: fixed;
  bottom: 6px;
  right: 10px;
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.2);
  font-family: 'Poppins', sans-serif;
  z-index: 5;
  pointer-events: none;
}

#prestige-stars {
  font-size: 0.9rem;
  color: #feca57;
  margin-top: 2px;
}

#prestige-stars.hidden { display: none; }

#stats-bar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  margin-top: 4px;
  font-size: 1.1rem;
}

#count-display {
  font-family: 'Fredoka One', cursive;
  font-size: 1.8rem;
  color: #feca57;
}

#per-sec-display {
  color: #a29bfe;
  font-weight: 600;
}

#multiplier-display {
  color: #ff6b6b;
  font-weight: 700;
  font-size: 1.3rem;
  animation: pulse 0.5s ease infinite;
}

#multiplier-display.hidden { display: none; }

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

/* ---- Progress Bar ---- */
#progress-bar-container {
  margin: 6px auto 0;
  width: 70%;
  max-width: 600px;
  height: 22px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 11px;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

#progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb);
  background-size: 200% 100%;
  animation: funkyGradient 2s ease infinite;
  border-radius: 11px;
  transition: width 0.3s ease;
}

#progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ---- Letter Collection Bar ---- */
#letter-bar {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 6px;
  flex-wrap: wrap;
}

.letter-pip {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka One', cursive;
  font-size: 0.55rem;
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.25);
  transition: all 0.3s;
}

.letter-pip.unlocked {
  color: #fff;
  text-shadow: 0 0 4px currentColor;
}

.letter-pip.current {
  animation: pipPulse 1s ease infinite;
  transform: scale(1.3);
  color: #fff;
}

@keyframes pipPulse {
  0%, 100% { box-shadow: 0 0 4px currentColor; }
  50% { box-shadow: 0 0 12px currentColor; }
}

/* ---- Game Area ---- */
#game-area {
  display: flex;
  height: calc(100vh - 140px);
  position: relative;
  z-index: 10;
}

/* ---- Click Zone (Left) ---- */
#click-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-right: 340px;
}

#letter-button-wrapper {
  position: relative;
}

#letter-button {
  font-family: 'Fredoka One', cursive;
  font-size: 12rem;
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #667eea, #764ba2);
  border-radius: 30px;
  cursor: pointer;
  transition: transform 0.1s ease;
  box-shadow: 0 10px 40px rgba(102, 126, 234, 0.4),
              0 0 60px rgba(118, 75, 162, 0.2);
  text-shadow: 0 4px 8px rgba(0,0,0,0.3);
  position: relative;
}

#letter-button:hover {
  box-shadow: 0 10px 50px rgba(102, 126, 234, 0.6),
              0 0 80px rgba(118, 75, 162, 0.3);
}

#letter-button.clicked {
  animation: clickPop 0.2s ease;
}

@keyframes clickPop {
  0% { transform: scale(1); }
  30% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

#click-info {
  margin-top: 16px;
  font-size: 1rem;
  color: rgba(255,255,255,0.5);
}

#per-click-display {
  margin-top: 4px;
  font-size: 0.9rem;
  color: #feca57;
  font-weight: 600;
}

/* ---- Combo Display ---- */
#combo-display {
  position: absolute;
  top: 15px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  z-index: 5;
  pointer-events: none;
}

#combo-display.hidden { display: none; }

#combo-count {
  font-family: 'Fredoka One', cursive;
  font-size: 2.5rem;
  display: block;
  transition: color 0.1s, transform 0.1s;
}

#combo-label {
  display: block;
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 3px;
  font-weight: 600;
}

/* ---- Upgrades Panel (Right) — fixed sidebar ---- */
#upgrades-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  height: 100vh;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  padding: 16px;
  overflow-y: auto;
  z-index: 10;
}

#upgrades-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  margin-bottom: 12px;
  text-align: center;
  color: #48dbfb;
}

.upgrade-card {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upgrade-card:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  transform: translateX(-3px);
}

.upgrade-card.affordable {
  border-color: #00b894;
  box-shadow: 0 0 15px rgba(0, 184, 148, 0.2);
}

.upgrade-card.affordable:hover {
  box-shadow: 0 0 25px rgba(0, 184, 148, 0.4);
}

.upgrade-card.locked {
  opacity: 0.4;
  cursor: not-allowed;
}

.upgrade-name {
  font-weight: 700;
  font-size: 1rem;
  color: #feca57;
}

.upgrade-desc {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
  margin-top: 2px;
}

.upgrade-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.upgrade-cost {
  font-weight: 600;
  color: #ff6b6b;
  font-size: 0.85rem;
}

.upgrade-level {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

.upgrade-card.vowel-special {
  border-color: #ff9ff3;
  background: rgba(255, 159, 243, 0.1);
}

.upgrade-card.vowel-special .upgrade-name {
  color: #ff9ff3;
}

.upgrade-card.boss-unlock {
  border-color: #ff6b6b;
  background: rgba(255, 107, 107, 0.1);
}

.upgrade-card.boss-unlock .upgrade-name {
  color: #ff6b6b;
}

/* ---- Multiplier Bubbles ---- */
#multiplier-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 12;
}

.multiplier-bubble {
  position: absolute;
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  padding: 10px 18px;
  border-radius: 50%;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  animation: bubbleAppear 0.3s ease;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.multiplier-bubble.x2 {
  background: linear-gradient(135deg, #00b894, #00cec9);
  color: #fff;
}

.multiplier-bubble.x5 {
  background: linear-gradient(135deg, #fdcb6e, #e17055);
  color: #fff;
}

.multiplier-bubble.x10 {
  background: linear-gradient(135deg, #e84393, #fd79a8);
  color: #fff;
  font-size: 1.5rem;
}

.multiplier-bubble.x100 {
  background: linear-gradient(135deg, #feca57, #ff6b6b, #e056fd, #48dbfb, #feca57);
  background-size: 300% 300%;
  animation: bubbleAppear 0.3s ease, funkyGradient 1.5s ease infinite, x100glow 0.5s ease infinite;
  color: #fff;
  font-size: 1.3rem;
  width: 80px;
  height: 80px;
  box-shadow: 0 0 25px rgba(254, 202, 87, 0.6), 0 0 50px rgba(254, 202, 87, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.5);
}

@keyframes x100glow {
  0%, 100% { box-shadow: 0 0 25px rgba(254, 202, 87, 0.6), 0 0 50px rgba(254, 202, 87, 0.3); }
  50% { box-shadow: 0 0 35px rgba(255, 107, 107, 0.8), 0 0 70px rgba(255, 107, 107, 0.4); }
}

@keyframes bubbleAppear {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Particle Trail ---- */
#particle-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

.trail-particle {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  animation: particleFade 0.6s ease forwards;
}

@keyframes particleFade {
  0% { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(0); }
}

/* ---- Floating Numbers ---- */
#float-numbers {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
}

.float-number {
  position: absolute;
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: #feca57;
  animation: floatUp 1s ease forwards;
  pointer-events: none;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.float-number.multiplied {
  color: #ff6b6b;
  font-size: 2rem;
}

.float-number.combo {
  color: #48dbfb;
  font-size: 1.8rem;
}

.float-number.boss-damage {
  color: #ff6b6b;
  font-size: 2.5rem;
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-80px) scale(0.5); }
}

/* ---- Celebrations ---- */
#celebration-layer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

.celebration-text {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Fredoka One', cursive;
  font-size: 4rem;
  animation: celebrationPop 1.5s ease forwards;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
  z-index: 25;
  pointer-events: none;
}

@keyframes celebrationPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.3); }
  40% { transform: translate(-50%, -50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.8) translateY(-40px); }
}

.firework {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  animation: fireworkBurst 1s ease forwards;
  pointer-events: none;
}

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

/* ---- Screen Shake ---- */
@keyframes shake {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-6px, 3px); }
  40% { transform: translate(6px, -3px); }
  60% { transform: translate(-4px, 5px); }
  80% { transform: translate(4px, -5px); }
}

#game-container.shaking {
  animation: shake 0.3s ease;
}

/* ---- Achievement Popup ---- */
#achievement-popup {
  position: fixed;
  top: -80px;
  right: 20px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  border: 2px solid #feca57;
  border-radius: 12px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 35;
  transition: top 0.4s ease;
  box-shadow: 0 4px 20px rgba(254, 202, 87, 0.3);
}

#achievement-popup.show {
  top: 20px;
}

#achievement-popup.hidden { /* just hidden by top position */ }

#achievement-popup-icon {
  font-size: 2rem;
}

#achievement-popup-name {
  display: block;
  font-family: 'Fredoka One', cursive;
  font-size: 1rem;
  color: #feca57;
}

#achievement-popup-desc {
  display: block;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.6);
}

/* ---- Word Bonus Popup ---- */
#word-bonus-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-family: 'Fredoka One', cursive;
  text-align: center;
  z-index: 35;
  pointer-events: none;
  transition: transform 0.3s ease;
}

#word-bonus-popup.show {
  transform: translate(-50%, -50%) scale(1);
}

#word-bonus-popup.hidden { display: block; }

#word-bonus-word {
  display: block;
  font-size: 3rem;
  color: #48dbfb;
  text-shadow: 0 4px 20px rgba(72, 219, 251, 0.5);
}

#word-bonus-reward {
  display: block;
  font-size: 1.5rem;
  color: #feca57;
  margin-top: 4px;
}

/* ---- Boss Fight Overlay ---- */
#boss-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 0, 0, 0.9);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

#boss-overlay.hidden { display: none; }

#boss-content {
  text-align: center;
  width: 90%;
  max-width: 600px;
}

#boss-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2.5rem;
  color: #ff6b6b;
  animation: pulse 0.5s ease infinite;
  margin-bottom: 10px;
}

#boss-letter-display {
  font-family: 'Fredoka One', cursive;
  font-size: 12rem;
  cursor: pointer;
  transition: transform 0.05s;
  text-shadow: 0 0 40px currentColor;
  line-height: 1;
}

#boss-letter-display:active {
  transform: scale(0.95);
}

#boss-hp-container {
  width: 100%;
  max-width: 400px;
  height: 30px;
  background: rgba(255,255,255,0.1);
  border-radius: 15px;
  margin: 15px auto;
  position: relative;
  overflow: hidden;
  border: 2px solid rgba(255,255,255,0.2);
}

#boss-hp-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff6b6b, #e17055);
  border-radius: 15px;
  transition: width 0.1s;
}

#boss-hp-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.8rem;
  font-weight: 700;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
}

#boss-timer-display {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: #feca57;
  margin-top: 10px;
}

#boss-info {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.5);
  margin-top: 8px;
}

/* ---- Mini-game Overlay ---- */
#minigame-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 20, 0.9);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}

#minigame-overlay.hidden { display: none; }

#minigame-content {
  text-align: center;
  width: 90%;
  max-width: 500px;
}

#minigame-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: #48dbfb;
  margin-bottom: 10px;
}

#minigame-info {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 15px;
}

#minigame-progress-bar {
  width: 100%;
  height: 20px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

#minigame-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00b894, #00cec9);
  border-radius: 10px;
  transition: width 0.1s;
}

#minigame-timer-display {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: #feca57;
  margin-bottom: 15px;
}

#minigame-area {
  position: relative;
  min-height: 200px;
}

.minigame-click-btn {
  font-family: 'Fredoka One', cursive;
  font-size: 3rem;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(145deg, #667eea, #764ba2);
  color: #fff;
  cursor: pointer;
  transition: transform 0.05s;
  box-shadow: 0 8px 30px rgba(102, 126, 234, 0.5);
  touch-action: manipulation;
}

.minigame-click-btn:active {
  transform: scale(0.95);
}

.minigame-bubble {
  position: absolute;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  color: #fff;
  animation: bubbleAppear 0.3s ease;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* ---- Achievements Overlay ---- */
#achievements-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

#achievements-overlay.hidden { display: none; }

#achievements-page {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
}

#achievements-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

#achievements-header h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  color: #feca57;
}

#achievements-header button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background 0.2s;
}

#achievements-header button:hover { background: rgba(255,255,255,0.2); }

#achievements-count {
  font-size: 0.85rem;
  color: rgba(255,255,255,0.5);
  margin-bottom: 16px;
}

#achievements-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.achievement-card {
  background: rgba(255,255,255,0.05);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  transition: all 0.2s;
}

.achievement-card.earned {
  border-color: #feca57;
  background: rgba(254, 202, 87, 0.08);
}

.achievement-card.locked {
  opacity: 0.35;
}

.achievement-card-icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 4px;
}

.achievement-card-name {
  font-family: 'Fredoka One', cursive;
  font-size: 0.8rem;
  color: #feca57;
  display: block;
}

.achievement-card-desc {
  font-size: 0.65rem;
  color: rgba(255,255,255,0.5);
  display: block;
  margin-top: 2px;
}

/* ---- Stats Overlay ---- */
#stats-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

#stats-overlay.hidden { display: none; }

#stats-page {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

#stats-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

#stats-header h2 {
  font-family: 'Fredoka One', cursive;
  font-size: 1.6rem;
  color: #48dbfb;
}

#stats-header button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background 0.2s;
}

#stats-header button:hover { background: rgba(255,255,255,0.2); }

#stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.stat-value {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: #feca57;
  display: block;
}

.stat-label {
  font-size: 0.7rem;
  color: rgba(255,255,255,0.5);
  display: block;
  margin-top: 2px;
}

/* ---- Prestige Overlay ---- */
#prestige-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.9);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
}

#prestige-overlay.hidden { display: none; }

#prestige-content {
  text-align: center;
  max-width: 450px;
  padding: 30px;
}

.prestige-title {
  font-family: 'Fredoka One', cursive;
  font-size: 3rem;
  background: linear-gradient(90deg, #feca57, #ff9ff3, #48dbfb);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: funkyGradient 2s ease infinite;
  margin-bottom: 15px;
}

#prestige-desc {
  font-size: 1rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 20px;
  line-height: 1.5;
}

#prestige-bonus-info {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: #feca57;
  margin-bottom: 25px;
}

#prestige-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
}

#prestige-buttons button {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  padding: 12px 30px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

#prestige-confirm {
  background: linear-gradient(145deg, #feca57, #ff9ff3);
  color: #1a1a2e;
  box-shadow: 0 4px 20px rgba(254, 202, 87, 0.4);
}

#prestige-confirm:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(254, 202, 87, 0.6);
}

#prestige-cancel {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.2);
}

#prestige-cancel:hover {
  background: rgba(255,255,255,0.2);
}

/* ---- Multiplier Timer Bar ---- */
.multiplier-timer {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  background: linear-gradient(90deg, #ff6b6b, #feca57);
  z-index: 30;
  transition: width 0.1s linear;
}

/* ---- Cutscene ---- */
#cutscene-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

#cutscene-overlay.hidden { display: none; }

#cutscene-content {
  text-align: center;
  position: relative;
  width: 100%;
  height: 100%;
}

.cutscene-letter {
  font-family: 'Fredoka One', cursive;
  font-size: 4rem;
  position: absolute;
  opacity: 0;
  animation: cutsceneLetterIn 0.5s ease forwards;
}

.cutscene-congrats {
  font-family: 'Fredoka One', cursive;
  font-size: 5rem;
  position: absolute;
  top: 15%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: funkyGradient 2s ease infinite;
  white-space: nowrap;
}

@keyframes cutsceneLetterIn {
  0% { opacity: 0; transform: scale(0) rotate(-180deg); }
  60% { opacity: 1; transform: scale(1.3) rotate(10deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

.cutscene-rocket {
  position: absolute;
  font-size: 3rem;
  animation: rocketFly 2s ease-in forwards;
}

@keyframes rocketFly {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-120vh) rotate(-10deg); }
}

.cutscene-buttons {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  z-index: 101;
}

.cutscene-buttons button {
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  padding: 12px 30px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.cutscene-btn-prestige {
  background: linear-gradient(145deg, #feca57, #ff9ff3);
  color: #1a1a2e;
  box-shadow: 0 4px 20px rgba(254, 202, 87, 0.4);
}

.cutscene-btn-prestige:hover { transform: scale(1.05); }

.cutscene-btn-continue {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 2px solid rgba(255,255,255,0.2) !important;
}

.cutscene-btn-continue:hover { background: rgba(255,255,255,0.2); }

/* ---- Vowel Special Active Effects ---- */
.avalanche-letter {
  position: absolute;
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: #ff6b6b;
  pointer-events: all;
  cursor: pointer;
  animation: avalancheFall 3s linear forwards;
  z-index: 15;
  text-shadow: 0 2px 8px rgba(255, 107, 107, 0.5);
}

@keyframes avalancheFall {
  0% { transform: translateY(-50px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateY(100vh); opacity: 0; }
}

.echo-indicator {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  color: #48dbfb;
  z-index: 25;
  animation: pulse 1s ease infinite;
}

.invisible-letter {
  position: absolute;
  font-family: 'Fredoka One', cursive;
  font-size: 2.5rem;
  color: rgba(255, 255, 255, 0.08);
  pointer-events: all;
  cursor: pointer;
  z-index: 15;
  transition: color 0.2s;
}

.invisible-letter:hover {
  color: rgba(255, 255, 255, 0.25);
}

.orbit-ring {
  position: absolute;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  animation: orbitSpin 3s linear infinite;
  pointer-events: none;
  z-index: 6;
}

.orbit-letter {
  position: absolute;
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: #ff9ff3;
  text-shadow: 0 0 10px rgba(255, 159, 243, 0.5);
}

@keyframes orbitSpin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.ultra-mode-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 3px solid #a29bfe;
  box-shadow: inset 0 0 60px rgba(162, 155, 254, 0.3);
  pointer-events: none;
  z-index: 4;
  animation: ultraPulse 0.5s ease infinite;
}

@keyframes ultraPulse {
  0%, 100% { border-color: #a29bfe; }
  50% { border-color: #6c5ce7; }
}

/* ---- Scrollbar ---- */
#upgrades-panel::-webkit-scrollbar { width: 6px; }
#upgrades-panel::-webkit-scrollbar-track { background: transparent; }
#upgrades-panel::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
  border-radius: 3px;
}

/* ---- Offline Earnings Modal ---- */
#offline-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
}

#offline-overlay.hidden { display: none; }

#offline-content {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 2px solid rgba(72, 219, 251, 0.3);
  border-radius: 16px;
  padding: 30px;
  width: 90%;
  max-width: 380px;
  text-align: center;
  box-shadow: 0 8px 40px rgba(72, 219, 251, 0.15);
}

#offline-title {
  font-family: 'Fredoka One', cursive;
  font-size: 2rem;
  color: #48dbfb;
  margin-bottom: 20px;
}

#offline-details {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
}

.offline-stat {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
}

.offline-stat.offline-total {
  border: 1px solid rgba(254, 202, 87, 0.3);
  background: rgba(254, 202, 87, 0.08);
}

.offline-stat-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
}

.offline-stat-value {
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  color: #feca57;
}

.offline-total .offline-stat-value {
  font-size: 1.4rem;
  color: #feca57;
}

#offline-collect {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  padding: 14px 50px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(145deg, #48dbfb, #0abde3);
  color: #1a1a2e;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(72, 219, 251, 0.4);
}

#offline-collect:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(72, 219, 251, 0.6);
}

/* ---- Name Entry Screen ---- */
#name-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

#name-screen.hidden { display: none; }

.name-screen-title {
  font-family: 'Fredoka One', cursive;
  font-size: 4rem;
  background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #54a0ff);
  background-size: 300% 300%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: funkyGradient 3s ease infinite;
}

.name-screen-sub {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.6);
}

#name-input {
  font-family: 'Poppins', sans-serif;
  font-size: 1.4rem;
  padding: 12px 24px;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: center;
  outline: none;
  width: 300px;
  transition: border-color 0.2s;
}

#name-input:focus {
  border-color: #48dbfb;
  box-shadow: 0 0 20px rgba(72, 219, 251, 0.2);
}

#name-input::placeholder { color: rgba(255, 255, 255, 0.3); }

#name-submit {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  padding: 12px 40px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(145deg, #667eea, #764ba2);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

#name-submit:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 30px rgba(102, 126, 234, 0.6);
}

/* ---- Number Formatting ---- */
.big-number { font-variant-numeric: tabular-nums; }

/* ---- Crit Float Number ---- */
.float-number.crit {
  color: #ff3838 !important;
  font-size: 1.8rem !important;
  font-weight: 900;
  text-shadow: 0 0 10px #ff3838, 0 0 20px #ff000066;
}

/* ---- Lucky Event Banner ---- */
#lucky-banner {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  padding: 8px 20px;
  text-align: center;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  color: #fff;
  z-index: 200;
  transform: translateY(-100%);
  transition: transform 0.4s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
}

#lucky-banner.show { transform: translateY(0); }
#lucky-banner-timer { font-size: 1.3rem; font-weight: 700; }

/* ---- Daily Challenges ---- */
#daily-overlay.hidden { display: none; }
#daily-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); z-index: 100;
  display: flex; justify-content: center; align-items: center;
}

#daily-page {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border-radius: 16px; padding: 24px; width: 90%; max-width: 500px;
  max-height: 80vh; overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
}

#daily-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
#daily-header h2 { font-family: 'Fredoka One', cursive; font-size: 1.5rem; }
#daily-close { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

.daily-card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 14px; margin-bottom: 12px;
  transition: all 0.3s;
}
.daily-card.completed { border-color: #00b894; background: rgba(0,184,148,0.1); }
.daily-card-desc { font-size: 0.95rem; margin-bottom: 8px; }
.daily-progress-bar { height: 8px; background: rgba(255,255,255,0.1); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.daily-progress-fill { height: 100%; background: linear-gradient(90deg, #48dbfb, #00b894); border-radius: 4px; transition: width 0.3s; }
.daily-card-status { font-size: 0.8rem; color: rgba(255,255,255,0.5); text-align: right; }

#daily-reward-btn.hidden { display: none; }
#daily-reward-btn {
  width: 100%; margin-top: 12px; padding: 12px;
  font-family: 'Fredoka One', cursive; font-size: 1.1rem;
  border: none; border-radius: 12px; cursor: pointer;
  background: linear-gradient(145deg, #feca57, #ff9f43);
  color: #1a1a2e;
  box-shadow: 0 4px 20px rgba(254, 202, 87, 0.4);
  transition: all 0.2s;
}
#daily-reward-btn:hover { transform: scale(1.03); }

/* ---- Skins ---- */
#skins-overlay.hidden { display: none; }
#skins-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); z-index: 100;
  display: flex; justify-content: center; align-items: center;
}

#skins-page {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border-radius: 16px; padding: 24px; width: 90%; max-width: 550px;
  max-height: 80vh; overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
}

#skins-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
#skins-header h2 { font-family: 'Fredoka One', cursive; font-size: 1.5rem; }
#skins-close { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

#skins-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 12px; }

.skin-card {
  background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 12px; text-align: center; cursor: pointer;
  transition: all 0.3s;
}
.skin-card:hover:not(.locked) { transform: scale(1.05); border-color: rgba(255,255,255,0.3); }
.skin-card.active { border-color: #48dbfb; box-shadow: 0 0 20px rgba(72,219,251,0.3); }
.skin-card.locked { opacity: 0.4; cursor: not-allowed; }

.skin-preview {
  width: 60px; height: 60px; border-radius: 12px; margin: 0 auto 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}
.skin-name { font-family: 'Fredoka One', cursive; font-size: 0.9rem; margin-bottom: 2px; }
.skin-desc { font-size: 0.7rem; color: rgba(255,255,255,0.5); }

@keyframes galaxySpin {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}
@keyframes rainbowShift {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(360deg); }
}

/* ---- Skill Tree ---- */
#skill-tree-overlay.hidden { display: none; }
#skill-tree-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); z-index: 100;
  display: flex; justify-content: center; align-items: center;
}

#skill-tree-page {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border-radius: 16px; padding: 24px; width: 90%; max-width: 700px;
  max-height: 85vh; overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
}

#skill-tree-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
#skill-tree-header h2 { font-family: 'Fredoka One', cursive; font-size: 1.5rem; }
#skill-tree-close { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

#skill-tree-points {
  text-align: center; font-family: 'Fredoka One', cursive;
  font-size: 1.1rem; color: #feca57; margin-bottom: 16px;
}

#skill-tree-grid { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.skill-branch {
  flex: 1; min-width: 180px; max-width: 220px;
  background: rgba(255,255,255,0.03); border-radius: 12px; padding: 12px;
  border: 1px solid rgba(255,255,255,0.06);
}
.skill-branch-title {
  font-family: 'Fredoka One', cursive; font-size: 1rem;
  text-align: center; margin-bottom: 10px; color: #48dbfb;
}

.skill-node {
  background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px; padding: 10px; margin-bottom: 8px; cursor: pointer;
  transition: all 0.3s;
}
.skill-node.owned { border-color: #00b894; background: rgba(0,184,148,0.15); }
.skill-node.available { border-color: #feca57; cursor: pointer; }
.skill-node.available:hover { transform: scale(1.03); box-shadow: 0 0 15px rgba(254,202,87,0.3); }
.skill-node.locked { opacity: 0.35; cursor: not-allowed; }

.skill-node-name { font-family: 'Fredoka One', cursive; font-size: 0.85rem; margin-bottom: 3px; }
.skill-node-desc { font-size: 0.72rem; color: rgba(255,255,255,0.6); margin-bottom: 4px; }
.skill-node-cost { font-size: 0.75rem; color: #feca57; font-weight: 600; }
.skill-node.owned .skill-node-cost { color: #00b894; }

/* ---- Leaderboard ---- */
#leaderboard-overlay.hidden { display: none; }
#leaderboard-overlay {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.85); z-index: 100;
  display: flex; justify-content: center; align-items: center;
}

#leaderboard-page {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border-radius: 16px; padding: 24px; width: 90%; max-width: 500px;
  max-height: 80vh; overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.1);
}

#leaderboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
#leaderboard-header h2 { font-family: 'Fredoka One', cursive; font-size: 1.5rem; }
#leaderboard-close { background: none; border: none; color: #fff; font-size: 1.5rem; cursor: pointer; }

#leaderboard-tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.lb-tab {
  flex: 1; min-width: 80px; padding: 8px 12px;
  font-family: 'Poppins', sans-serif; font-size: 0.8rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.15); border-radius: 8px;
  background: rgba(255,255,255,0.05); color: rgba(255,255,255,0.6);
  cursor: pointer; transition: all 0.2s; text-align: center;
}
.lb-tab.active { background: rgba(72,219,251,0.15); border-color: #48dbfb; color: #48dbfb; }
.lb-tab:hover { background: rgba(255,255,255,0.1); }

.lb-entry {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px;
  background: rgba(255,255,255,0.03); margin-bottom: 4px;
  transition: background 0.2s;
}
.lb-entry:hover { background: rgba(255,255,255,0.06); }
.lb-entry.lb-top { background: rgba(255,215,0,0.05); border: 1px solid rgba(255,215,0,0.1); }

.lb-rank { font-size: 1.1rem; min-width: 30px; text-align: center; }
.lb-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.lb-value { font-size: 0.85rem; color: rgba(255,255,255,0.6); font-family: 'Fredoka One', cursive; }

.lb-loading, .lb-empty {
  text-align: center; padding: 30px; color: rgba(255,255,255,0.4);
  font-size: 0.95rem;
}

/* ============================================
   Action Mode Bubbles & Overlay
   ============================================ */
.action-bubble {
  position: absolute;
  font-family: 'Fredoka One', cursive;
  font-size: 0.85rem;
  padding: 8px;
  border-radius: 16px;
  width: 80px;
  height: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: all;
  animation: bubbleAppear 0.3s ease;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  color: #fff;
  text-align: center;
  line-height: 1.1;
  z-index: 50;
}
.action-bubble .action-bubble-icon { font-size: 1.6rem; }
.action-bubble .action-bubble-label { font-size: 0.55rem; letter-spacing: 0.5px; }

.action-bubble.swipe {
  background: linear-gradient(135deg, #6c5ce7, #a29bfe);
  border: 2px solid rgba(255,255,255,0.3);
}
.action-bubble.hold {
  background: linear-gradient(135deg, #e17055, #fdcb6e);
  border: 2px solid rgba(255,255,255,0.3);
}
.action-bubble.rhythm {
  background: linear-gradient(135deg, #00b894, #55efc4);
  border: 2px solid rgba(255,255,255,0.3);
}
.action-bubble.shake {
  background: linear-gradient(135deg, #e84393, #fd79a8);
  border: 2px solid rgba(255,255,255,0.3);
}
.action-bubble.trace {
  background: linear-gradient(135deg, #0984e3, #74b9ff);
  border: 2px solid rgba(255,255,255,0.3);
}

@keyframes actionPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.action-bubble { animation: bubbleAppear 0.3s ease, actionPulse 2s ease infinite; }

#action-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
#action-overlay.hidden { display: none; }

#action-content {
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border-radius: 20px;
  padding: 30px;
  width: 90%;
  max-width: 400px;
  text-align: center;
  border: 2px solid rgba(255,255,255,0.1);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

#action-title {
  font-family: 'Fredoka One', cursive;
  font-size: 1.8rem;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #feca57, #ff6b6b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#action-info {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  margin-bottom: 15px;
}

#action-progress-bar {
  width: 100%;
  height: 14px;
  background: rgba(255,255,255,0.1);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 10px;
}
#action-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 7px;
  transition: width 0.1s ease;
  background: linear-gradient(90deg, #00b894, #55efc4);
}

#action-timer {
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: #feca57;
  margin-bottom: 15px;
}

#action-area {
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: none;
}

#action-reward {
  font-family: 'Fredoka One', cursive;
  font-size: 1.5rem;
  color: #55efc4;
  margin-top: 10px;
  animation: bounceIn 0.5s ease;
}
#action-reward.hidden { display: none; }

/* Swipe Frenzy */
.action-swipe-letter {
  font-family: 'Fredoka One', cursive;
  font-size: 6rem;
  cursor: grab;
  user-select: none;
  transition: transform 0.05s ease;
  touch-action: none;
}
.action-swipe-letter:active { cursor: grabbing; }
.action-swipe-counter {
  position: absolute;
  top: 5px; right: 10px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.3rem;
  color: #a29bfe;
}

/* Hold & Charge */
.action-hold-btn {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.3);
  background: linear-gradient(135deg, #e17055, #fdcb6e);
  font-family: 'Fredoka One', cursive;
  font-size: 3rem;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  touch-action: manipulation;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.action-hold-btn.charging {
  box-shadow: 0 0 30px rgba(253,203,110,0.6), 0 0 60px rgba(253,203,110,0.3);
}
.action-charge-ring {
  position: absolute;
  width: 160px; height: 160px;
  border-radius: 50%;
  border: 4px solid transparent;
  border-top-color: #feca57;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) rotate(0deg);
  pointer-events: none;
}
.action-charge-pct {
  position: absolute;
  bottom: -35px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.2rem;
  color: #fdcb6e;
}

/* Tap Rhythm */
.action-rhythm-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  background: linear-gradient(135deg, #00b894, #55efc4);
  font-family: 'Fredoka One', cursive;
  font-size: 2.5rem;
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.1s ease;
}
.action-rhythm-btn.beat { transform: scale(1.15); box-shadow: 0 0 30px rgba(85,239,196,0.6); }
.action-rhythm-btn.tap-perfect { background: linear-gradient(135deg, #feca57, #fdcb6e); }
.action-rhythm-btn.tap-good { background: linear-gradient(135deg, #74b9ff, #0984e3); }
.action-rhythm-btn.tap-miss { background: linear-gradient(135deg, #ff6b6b, #e17055); }
.action-rhythm-score {
  position: absolute;
  top: 5px; right: 10px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  color: #55efc4;
}
.action-rhythm-feedback {
  position: absolute;
  bottom: 10px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.4rem;
  animation: floatUp 0.6s ease forwards;
  pointer-events: none;
}
@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-40px); }
}

/* Shake It */
.action-shake-icon {
  font-size: 5rem;
  animation: shakeAnim 0.3s ease infinite;
  touch-action: none;
}
@keyframes shakeAnim {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-8deg); }
  75% { transform: rotate(8deg); }
}
.action-shake-meter {
  position: absolute;
  bottom: 10px; left: 10px; right: 10px;
  height: 18px;
  background: rgba(255,255,255,0.1);
  border-radius: 9px;
  overflow: hidden;
}
.action-shake-fill {
  height: 100%;
  width: 0%;
  border-radius: 9px;
  background: linear-gradient(90deg, #fd79a8, #e84393);
  transition: width 0.15s ease;
}

/* Trace the Letter */
.action-trace-canvas {
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  touch-action: none;
  cursor: crosshair;
}
.action-trace-score {
  position: absolute;
  top: 5px; right: 10px;
  font-family: 'Fredoka One', cursive;
  font-size: 1.1rem;
  color: #74b9ff;
}

/* ============================================
   Responsive — Tablet (≤ 1024px)
   ============================================ */
@media (max-width: 1024px) {
  #header { padding-right: 304px; }
  #upgrades-panel { width: 280px; padding: 12px; }
  #click-zone { margin-right: 280px; }

  #letter-button {
    font-size: 9rem;
    width: 220px;
    height: 220px;
    border-radius: 24px;
  }

  .orbit-ring { width: 320px; height: 320px; }
}

/* ============================================
   Responsive — Mobile (≤ 768px)
   ============================================ */
@media (max-width: 768px) {
  body {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
    -webkit-overflow-scrolling: touch;
  }

  #header {
    padding: 8px 12px;
    padding-right: 12px;
  }

  #game-title { font-size: 1.6rem; }
  #stats-bar { gap: 12px; font-size: 0.95rem; }
  #count-display { font-size: 1.4rem; }
  #progress-bar-container { width: 85%; height: 20px; }
  #progress-text { font-size: 0.65rem; }

  #header-top { flex-wrap: wrap; gap: 4px; }
  #menu-buttons { position: static; transform: none; gap: 3px; flex-wrap: wrap; justify-content: center; }
  #menu-buttons button { width: 28px; height: 28px; font-size: 0.8rem; }

  .letter-pip { width: 16px; height: 16px; font-size: 0.45rem; }

  #game-area {
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 130px);
  }

  #click-zone { padding: 15px 0; flex: none; margin-right: 0; }

  #letter-button {
    font-size: 7rem;
    width: 180px;
    height: 180px;
    border-radius: 24px;
  }

  #click-info { font-size: 0.85rem; margin-top: 10px; }
  #per-click-display { font-size: 0.8rem; }

  #combo-display { top: 5px; }
  #combo-count { font-size: 1.8rem; }

  #upgrades-panel {
    position: static;
    width: 100%;
    height: auto;
    border-left: none;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
    padding: 12px 16px;
    overflow-y: visible;
  }

  #upgrades-title { font-size: 1.2rem; margin-bottom: 8px; }
  .upgrade-card { padding: 10px; margin-bottom: 8px; }
  .upgrade-name { font-size: 0.9rem; }
  .upgrade-desc { font-size: 0.7rem; }
  .upgrade-cost { font-size: 0.8rem; }

  .multiplier-bubble { width: 55px; height: 55px; font-size: 1.5rem; padding: 8px 14px; }
  .action-bubble { width: 65px; height: 65px; font-size: 0.7rem; }
  .action-bubble .action-bubble-icon { font-size: 1.3rem; }
  #action-content { padding: 20px; }
  #action-title { font-size: 1.4rem; }
  #action-area { min-height: 150px; }
  .action-swipe-letter { font-size: 4.5rem; }
  .action-hold-btn { width: 110px; height: 110px; font-size: 2.5rem; }
  .action-charge-ring { width: 130px; height: 130px; }
  .action-rhythm-btn { width: 100px; height: 100px; font-size: 2rem; }
  .multiplier-bubble.x10 { font-size: 1.2rem; }
  .celebration-text { font-size: 2.5rem; }

  .name-screen-title { font-size: 2.5rem; }
  .name-screen-sub { font-size: 1rem; }
  #name-input { font-size: 1.1rem; width: 260px; padding: 10px 20px; }
  #name-submit { font-size: 1.1rem; padding: 10px 32px; }

  .cutscene-letter { font-size: 2.2rem; }
  .cutscene-congrats { font-size: 2rem; top: 8%; white-space: normal; width: 90%; text-align: center; }
  .cutscene-rocket { font-size: 2rem; }
  .orbit-ring { width: 260px; height: 260px; }
  #player-name-display { font-size: 0.8rem; }

  #boss-letter-display { font-size: 8rem; }
  #boss-title { font-size: 1.8rem; }

  #achievements-grid { grid-template-columns: 1fr; }
  #stats-grid { grid-template-columns: 1fr; }
  #skins-grid { grid-template-columns: repeat(2, 1fr); }
  #skill-tree-grid { flex-direction: column; }
  .skill-branch { max-width: 100%; }
  #lucky-banner { font-size: 0.85rem; padding: 6px 12px; }
  .lb-tab { font-size: 0.7rem; padding: 6px 8px; }
  #leaderboard-tabs { gap: 4px; }

  .prestige-title { font-size: 2rem; }
  #prestige-buttons { flex-direction: column; }
  #prestige-buttons button { width: 100%; }

  .cutscene-buttons { flex-direction: column; width: 80%; }
  .cutscene-buttons button { width: 100%; }
}

/* ============================================
   Responsive — Small Mobile (≤ 400px)
   ============================================ */
@media (max-width: 400px) {
  #game-title { font-size: 1.3rem; }

  #letter-button {
    font-size: 5rem;
    width: 140px;
    height: 140px;
    border-radius: 20px;
  }

  .name-screen-title { font-size: 2rem; }
  .cutscene-congrats { font-size: 1.5rem; }
  .cutscene-letter { font-size: 1.6rem; }
  #boss-letter-display { font-size: 6rem; }

  .letter-pip { width: 13px; height: 13px; font-size: 0.4rem; gap: 2px; }
}
