/* === RESET & BASE === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --pink: #FFB6C1;
  --lavender: #E6E6FA;
  --peach: #FFDAB9;
  --rose: #FF69B4;
  --soft-purple: #DDA0DD;
  --cream: #FFF5EE;
  --deep-pink: #FF1493;
  --gold: #FFD700;
  --bg-dark: rgba(30, 20, 40, 0.85);
  --glass: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.25);
  --font-main: 'Outfit', sans-serif;
  --font-fancy: 'Dancing Script', cursive;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-main);
  background: #1a0a1f;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* === OVERLAYS === */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(20, 5, 30, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* === TITLE SCREEN === */
.title-content {
  text-align: center;
  color: white;
  animation: floatUp 1s ease;
}

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

.title-hearts {
  font-size: 3rem;
  animation: pulse 2s ease-in-out infinite;
  margin-bottom: 0.5rem;
}

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

.game-title {
  font-family: var(--font-fancy);
  font-size: 4rem;
  background: linear-gradient(135deg, var(--pink), var(--rose), var(--soft-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  margin-bottom: 0.25rem;
  line-height: 1.2;
}

.game-subtitle {
  font-size: 1.1rem;
  color: var(--lavender);
  font-weight: 300;
  margin-bottom: 1.5rem;
  letter-spacing: 0.5px;
}

.title-names {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  font-size: 1.5rem;
  font-weight: 600;
}

.name-rahul {
  color: #7EB8FF;
  text-shadow: 0 0 20px rgba(126, 184, 255, 0.5);
}

.name-amp {
  color: var(--rose);
  font-family: var(--font-fancy);
  font-size: 2rem;
}

.name-rashmi {
  color: var(--pink);
  text-shadow: 0 0 20px rgba(255, 182, 193, 0.5);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 2.5rem;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--rose), var(--deep-pink));
  color: white;
  font-family: var(--font-main);
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 25px rgba(255, 105, 180, 0.4);
  letter-spacing: 0.5px;
}

.btn-primary:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 35px rgba(255, 105, 180, 0.6);
}

.btn-primary:active {
  transform: translateY(0) scale(0.98);
}

.btn-hearts {
  animation: pulse 1.5s ease-in-out infinite;
}

.title-note {
  margin-top: 1.5rem;
  color: var(--soft-purple);
  font-size: 0.95rem;
  font-style: italic;
  animation: glow 3s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; text-shadow: 0 0 15px rgba(255, 182, 193, 0.6); }
}

/* === HUD === */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: 10px 16px;
  pointer-events: none;
}

.hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.health-container {
  display: flex;
  gap: 4px;
  font-size: 1.4rem;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.health-container .heart-empty {
  opacity: 0.3;
  filter: grayscale(1);
}

.score-display {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 4px 12px;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  backdrop-filter: blur(10px);
}

.score-icon {
  font-size: 1rem;
}

.wave-display {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 4px 16px;
  color: var(--lavender);
  font-weight: 600;
  font-size: 0.9rem;
  backdrop-filter: blur(10px);
}

.btn-gift {
  pointer-events: auto;
  padding: 8px 16px;
  border: none;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--rose), var(--soft-purple));
  color: white;
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 15px rgba(255, 105, 180, 0.3);
}

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

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

/* === HEAL METER === */
.heal-meter-container {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.heal-meter-label {
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.heal-meter-track {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.2);
}

.heal-meter-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--rose), var(--deep-pink), #FF6B9D);
  border-radius: 10px;
  transition: width 0.5s ease;
  box-shadow: 0 0 10px rgba(255, 20, 147, 0.5);
  position: relative;
}

.heal-meter-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* === GIFT SHOP === */
.shop-panel {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2rem;
  max-width: 400px;
  width: 90%;
  text-align: center;
  backdrop-filter: blur(20px);
  animation: floatUp 0.4s ease;
}

.shop-title {
  font-family: var(--font-fancy);
  font-size: 2rem;
  color: var(--pink);
  margin-bottom: 0.25rem;
}

.shop-subtitle {
  color: var(--lavender);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  font-weight: 300;
}

.shop-balance {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 6px 18px;
  color: white;
  font-weight: 700;
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.gift-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin-bottom: 1.5rem;
}

.gift-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  background: var(--glass);
  color: white;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-main);
}

.gift-item:hover {
  background: rgba(255, 105, 180, 0.2);
  border-color: var(--rose);
  transform: translateY(-2px);
}

.gift-item:active {
  transform: translateY(0) scale(0.95);
}

.gift-emoji {
  font-size: 2rem;
}

.gift-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.gift-cost {
  font-size: 0.7rem;
  color: var(--pink);
  font-weight: 600;
}

.btn-close {
  padding: 10px 24px;
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  background: var(--glass);
  color: white;
  font-family: var(--font-main);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-close:hover {
  background: rgba(255,255,255,0.25);
}

/* === DIALOGUE POPUP === */
.dialogue-popup {
  position: fixed;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  animation: popIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

@keyframes popIn {
  from { opacity: 0; transform: translateX(-50%) scale(0.5) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
}

.dialogue-content {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 12px 24px;
  backdrop-filter: blur(15px);
  max-width: 350px;
}

.dialogue-emoji {
  font-size: 1.5rem;
}

.dialogue-text {
  color: white;
  font-size: 0.95rem;
  line-height: 1.4;
}

/* === SECRET MESSAGE === */
.secret-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 90;
  animation: secretReveal 0.6s ease;
  pointer-events: none;
}

@keyframes secretReveal {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-10deg); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0deg); }
}

.secret-content {
  display: flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, rgba(255, 105, 180, 0.9), rgba(221, 160, 221, 0.9));
  border: 2px solid var(--gold);
  border-radius: 20px;
  padding: 16px 28px;
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.4);
}

.secret-text {
  color: white;
  font-family: var(--font-fancy);
  font-size: 1.3rem;
  font-weight: 700;
}

.secret-icon {
  font-size: 1.3rem;
}

/* === CUTSCENE === */
.cutscene-content {
  text-align: center;
  color: white;
  animation: floatUp 0.8s ease;
}

.cutscene-emoji {
  font-size: 5rem;
  animation: pulse 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

.cutscene-text {
  font-family: var(--font-fancy);
  font-size: 2rem;
  color: var(--pink);
  margin-bottom: 1rem;
  max-width: 350px;
  line-height: 1.4;
}

.cutscene-sparkles {
  font-size: 1.5rem;
  animation: glow 2s ease-in-out infinite;
}

/* === GAME OVER === */
.gameover-content {
  text-align: center;
  color: white;
  animation: floatUp 0.6s ease;
}

.gameover-title {
  font-family: var(--font-fancy);
  font-size: 2.5rem;
  color: var(--pink);
  margin-bottom: 0.5rem;
}

.gameover-text {
  color: var(--lavender);
  font-size: 1.1rem;
  margin-bottom: 1.5rem;
}

.gameover-stats {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 16px 24px;
  margin-bottom: 1.5rem;
  display: inline-block;
  backdrop-filter: blur(10px);
}

.gameover-stats p {
  font-size: 1rem;
  margin: 4px 0;
  color: var(--peach);
}

/* === MOBILE CONTROLS === */
.mobile-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  pointer-events: none;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.joystick-area {
  pointer-events: auto;
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joystick-base {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.joystick-thumb {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 105, 180, 0.5);
  border: 2px solid rgba(255, 105, 180, 0.7);
  position: absolute;
  transition: none;
}

.attack-btn {
  pointer-events: auto;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid rgba(255, 105, 180, 0.6);
  background: rgba(255, 105, 180, 0.25);
  color: white;
  font-size: 1.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  backdrop-filter: blur(5px);
}

.attack-btn:active {
  background: rgba(255, 105, 180, 0.5);
  transform: scale(0.9);
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .game-title {
    font-size: 2.8rem;
  }
  .title-names {
    font-size: 1.2rem;
  }
  .btn-primary {
    padding: 14px 28px;
    font-size: 1.1rem;
  }
  .shop-panel {
    padding: 1.5rem;
  }
  .gift-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .cutscene-text {
    font-size: 1.5rem;
  }
}

@media (min-width: 769px) {
  .mobile-controls {
    display: none !important;
  }
}

/* === ROLE SELECTION === */
.role-buttons {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.btn-role {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 20px 28px;
  border: 2px solid var(--glass-border);
  border-radius: 20px;
  background: var(--glass);
  color: white;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  min-width: 160px;
}

.btn-role:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(255, 105, 180, 0.3);
}

.btn-role:active { transform: scale(0.97); }

.btn-rahul:hover { border-color: #7EB8FF; background: rgba(126, 184, 255, 0.15); }
.btn-rashmi:hover { border-color: var(--rose); background: rgba(255, 105, 180, 0.15); }

.role-emoji { font-size: 2.5rem; }
.role-name { font-size: 1.1rem; font-weight: 600; }
.role-desc { font-size: 0.75rem; color: var(--lavender); font-weight: 300; }

/* === ROOM SCREEN === */
.room-panel {
  background: var(--bg-dark);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 2.5rem;
  text-align: center;
  backdrop-filter: blur(20px);
  animation: floatUp 0.4s ease;
  max-width: 380px;
  width: 90%;
}

.room-title {
  font-family: var(--font-fancy);
  font-size: 1.8rem;
  color: var(--pink);
  margin-bottom: 0.5rem;
}

.room-subtitle {
  color: var(--lavender);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.room-code-display {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 2px dashed var(--rose);
  border-radius: 16px;
  padding: 16px 28px;
  margin-bottom: 1rem;
}

.room-code-display span:first-child {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 8px;
  color: var(--gold);
  font-family: 'Outfit', monospace;
}

.btn-copy {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  padding: 4px;
  transition: transform 0.2s;
}

.btn-copy:active { transform: scale(0.85); }

.loader-dots {
  font-size: 2rem;
  color: var(--lavender);
  margin-bottom: 0.5rem;
  animation: pulse 1.5s ease-in-out infinite;
}

.room-hint {
  color: rgba(255,255,255,0.5);
  font-size: 0.8rem;
}

.room-input {
  display: block;
  width: 100%;
  max-width: 220px;
  margin: 0 auto 8px;
  padding: 14px;
  border: 2px solid var(--glass-border);
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  color: white;
  font-family: 'Outfit', monospace;
  font-size: 1.8rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: 6px;
  text-transform: uppercase;
  outline: none;
  transition: border-color 0.3s;
}

.room-input:focus { border-color: var(--rose); }
.room-input::placeholder { color: rgba(255,255,255,0.2); letter-spacing: 4px; font-weight: 400; font-size: 1.2rem; }

.join-error { color: #FF6B6B; font-size: 0.85rem; margin-bottom: 8px; }

/* === PARTNER STATUS === */
.partner-status {
  font-size: 0.75rem;
  color: #7BC950;
  margin-top: 4px;
  text-align: center;
}

.partner-status.disconnected { color: #FF6B6B; }

/* === RASHMI HINT === */
.rashmi-hint {
  text-align: center;
  color: var(--lavender);
  font-size: 0.75rem;
  margin-top: 6px;
  background: var(--glass);
  border-radius: 12px;
  padding: 4px 12px;
  display: inline-block;
  width: 100%;
}

/* === TAP EFFECT === */
.tap-effect {
  position: fixed;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid var(--rose);
  pointer-events: none;
  z-index: 70;
  animation: tapRipple 0.6s ease forwards;
  transform: translate(-50%, -50%);
}

@keyframes tapRipple {
  from { transform: translate(-50%, -50%) scale(0.3); opacity: 1; }
  to { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* === RASHMI POWERS BAR === */
.rashmi-powers {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 12px 16px 20px;
  background: linear-gradient(transparent, rgba(20, 5, 30, 0.85));
}

.power-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 16px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  font-family: var(--font-main);
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
  min-width: 70px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

.power-btn:active {
  transform: scale(0.9);
  background: rgba(255, 105, 180, 0.3);
  border-color: var(--rose);
}

.power-btn.on-cooldown {
  opacity: 0.5;
  pointer-events: none;
}

.power-icon {
  font-size: 1.8rem;
}

.power-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.power-cd-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0%;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 0 0 14px 14px;
  transition: height 0.3s linear;
  pointer-events: none;
}

/* === MOBILE OPTIMIZATIONS === */
@media (max-width: 768px) {
  .game-title { font-size: 2.5rem; }
  .title-names { font-size: 1.1rem; gap: 0.6rem; margin-bottom: 1.2rem; }
  .role-buttons { gap: 10px; }
  .btn-role { padding: 14px 20px; min-width: 140px; }
  .role-emoji { font-size: 2rem; }
  .role-name { font-size: 0.95rem; }

  .hud-top { gap: 4px; }
  .health-container { font-size: 1.2rem; gap: 2px; }
  .score-display { font-size: 0.85rem; padding: 3px 8px; }
  .wave-display { font-size: 0.75rem; padding: 3px 10px; }
  .btn-gift { font-size: 0.8rem; padding: 6px 12px; }
  .heal-meter-container { margin-top: 4px; }
  .heal-meter-label { font-size: 0.65rem; }

  .rashmi-hint { font-size: 0.7rem; padding: 3px 8px; }

  .dialogue-popup { bottom: 22%; }
  .dialogue-content { padding: 10px 16px; max-width: 280px; }
  .dialogue-text { font-size: 0.85rem; }

  .shop-panel { padding: 1.2rem; max-width: 340px; }
  .shop-title { font-size: 1.5rem; }
  .gift-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .gift-emoji { font-size: 1.5rem; }
  .gift-item { padding: 10px 6px; }

  .joystick-base { width: 90px; height: 90px; }
  .joystick-thumb { width: 36px; height: 36px; }
  .attack-btn { width: 65px; height: 65px; font-size: 1.6rem; }

  .power-btn { padding: 10px 12px; min-width: 60px; border-radius: 14px; }
  .power-icon { font-size: 1.5rem; }
  .power-label { font-size: 0.55rem; }

  .cutscene-emoji { font-size: 3.5rem; }
  .cutscene-text { font-size: 1.3rem; max-width: 280px; }

  .room-code-display span:first-child { font-size: 1.8rem; letter-spacing: 6px; }
  .room-input { font-size: 1.5rem; max-width: 190px; }
}

@media (max-width: 380px) {
  .power-btn { padding: 8px 8px; min-width: 52px; }
  .power-icon { font-size: 1.3rem; }
  .rashmi-powers { gap: 8px; padding: 8px 10px 16px; }
}

