@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@300..700&family=Outfit:wght@300;400;600;800&display=swap');

:root {
  --primary-pink: #ff7ebb;
  --primary-pink-glow: rgba(255, 126, 187, 0.4);
  --secondary-pink: #ffb7d6;
  --magic-purple: #c38eff;
  --gold: #ffe359;
  --mint: #8effd0;
  --dark-bg: rgba(26, 15, 30, 0.85);
  --glass-bg: rgba(255, 255, 255, 0.15);
  --glass-border: rgba(255, 255, 255, 0.35);
  --font-title: 'Fredoka', sans-serif;
  --font-body: 'Outfit', sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #11091c;
  font-family: var(--font-body);
  color: #fff;
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* Loading Screen */
#loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #2a0845 0%, #6441a5 100%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transition: opacity 0.8s ease-out;
}

.loader-logo {
  font-family: var(--font-title);
  font-size: 3.5rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 15px var(--primary-pink), 0 0 30px var(--magic-purple);
  margin-bottom: 2rem;
  animation: float 3s ease-in-out infinite;
}

.loader-bar-container {
  width: 300px;
  height: 12px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  border: 1px solid var(--glass-border);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.4);
}

.loader-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary-pink), var(--magic-purple));
  box-shadow: 0 0 10px var(--primary-pink);
  border-radius: 10px;
  transition: width 0.3s ease-out;
}

.loader-text {
  margin-top: 1rem;
  font-size: 1.1rem;
  color: var(--secondary-pink);
  letter-spacing: 2px;
  animation: pulse 1.5s infinite;
}

/* HUD elements */
#game-hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 2.8rem 1.5rem 1.5rem 1.5rem;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.hud-group {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  pointer-events: auto;
}

.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 2px solid var(--glass-border);
  border-radius: 20px;
  padding: 0.8rem 1.2rem;
  box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.heart-container {
  display: flex;
  gap: 0.4rem;
}

.heart {
  width: 28px;
  height: 28px;
  fill: #ff3366;
  filter: drop-shadow(0 0 5px rgba(255, 51, 102, 0.6));
  animation: pulse-heart 1.2s infinite alternate;
}

.heart.empty {
  fill: rgba(255, 255, 255, 0.2);
  filter: none;
  animation: none;
}

.crystal-counter, .weapon-status {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.crystal-icon {
  width: 26px;
  height: 26px;
  filter: drop-shadow(0 0 5px var(--mint));
}

.time-panel {
  font-family: var(--font-title);
  color: var(--gold);
}

.time-icon {
  width: 24px;
  height: 24px;
  animation: spin-slow 20s linear infinite;
}

/* Floating Action Button (Inventory/Menu) */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

/* Interaction Prompt */
#interact-prompt {
  position: absolute;
  bottom: 25%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 126, 187, 0.85);
  border: 2px solid #fff;
  border-radius: 12px;
  padding: 0.6rem 1.5rem;
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: #fff;
  box-shadow: 0 0 15px rgba(255,126,187,0.8);
  display: none;
  z-index: 100;
  pointer-events: none;
  animation: pulse-interact 1s infinite alternate;
}

/* Menu Panels Overlay (Wardrobe, Armory, Cozy Bed, Main Menu) */
.overlay-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--dark-bg);
  z-index: 500;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}

.overlay-panel.active {
  opacity: 1;
  pointer-events: auto;
}

.panel-container {
  width: 90%;
  max-width: 750px;
  max-height: 85vh;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid var(--glass-border);
  border-radius: 28px;
  backdrop-filter: blur(25px);
  -webkit-backdrop-filter: blur(25px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 0 30px rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scale-up 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.panel-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 126, 187, 0.15);
}

.panel-title {
  font-family: var(--font-title);
  font-size: 2rem;
  color: #fff;
  text-shadow: 0 2px 10px var(--primary-pink);
}

.close-btn {
  background: none;
  border: none;
  color: #fff;
  font-size: 2.2rem;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.2s, color 0.2s;
}

.close-btn:hover {
  color: var(--primary-pink);
  transform: scale(1.15);
}

.panel-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

/* Customization grid (Wardrobe) */
.customization-section {
  margin-bottom: 2rem;
}

.section-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--secondary-pink);
  margin-bottom: 1rem;
  border-left: 4px solid var(--primary-pink);
  padding-left: 0.6rem;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 1rem;
}

.option-card {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  padding: 1rem 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  text-align: center;
}

.option-card:hover {
  background: rgba(255, 126, 187, 0.2);
  border-color: var(--primary-pink);
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(255, 126, 187, 0.3);
}

.option-card.selected {
  background: linear-gradient(135deg, rgba(255, 126, 187, 0.4) 0%, rgba(195, 142, 255, 0.4) 100%);
  border-color: var(--primary-pink);
  box-shadow: 0 0 15px var(--primary-pink-glow);
}

.option-thumb {
  width: 45px;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-size: 1.8rem;
}

.option-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #eee;
}

/* Armory Selection Grid */
.weapon-card {
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 24px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.weapon-card:hover {
  background: rgba(195, 142, 255, 0.15);
  border-color: var(--magic-purple);
  transform: scale(1.02);
}

.weapon-card.selected {
  background: linear-gradient(90deg, rgba(195, 142, 255, 0.3), rgba(255, 126, 187, 0.1));
  border-color: var(--magic-purple);
  box-shadow: 0 0 20px rgba(195, 142, 255, 0.3);
}

.weapon-icon {
  width: 70px;
  height: 70px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 2.5rem;
}

.weapon-info {
  flex: 1;
}

.weapon-name {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: #fff;
  margin-bottom: 0.3rem;
}

.weapon-desc {
  font-size: 0.9rem;
  color: #ccc;
  line-height: 1.3;
}

.weapon-stats {
  display: flex;
  gap: 1rem;
  margin-top: 0.5rem;
}

.stat-tag {
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
}

.stat-tag.power {
  color: #ff6e6e;
  background: rgba(255, 110, 110, 0.15);
}

.stat-tag.range {
  color: #8ec3ff;
  background: rgba(142, 195, 255, 0.15);
}

/* Sleep / Resting Fade Overlay */
#sleep-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #080312;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease-in-out;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

#sleep-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.sleep-animation {
  font-size: 5rem;
  animation: float 4s ease-in-out infinite;
  margin-bottom: 1rem;
}

.sleep-text {
  font-family: var(--font-title);
  font-size: 1.8rem;
  color: var(--secondary-pink);
  letter-spacing: 3px;
  animation: pulse-interact 2s infinite alternate;
}

/* Faint Screen (Restart) */
#faint-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(43, 8, 30, 0.9);
  z-index: 1001;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease-out;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
}

#faint-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.faint-title {
  font-family: var(--font-title);
  font-size: 3rem;
  color: #ff4785;
  text-shadow: 0 0 15px rgba(255, 71, 133, 0.5);
  text-align: center;
}

.faint-subtitle {
  font-size: 1.2rem;
  color: #bbb;
  margin-bottom: 1rem;
}

.btn-game {
  background: linear-gradient(135deg, var(--primary-pink) 0%, var(--magic-purple) 100%);
  border: none;
  border-radius: 16px;
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.3rem;
  padding: 0.8rem 2rem;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(255, 126, 187, 0.4);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-game:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 25px rgba(255, 126, 187, 0.6);
}

.btn-game:active {
  transform: translateY(-1px);
}

/* Main Menu Overlay */
#main-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at center, #6441a5 0%, #2a0845 100%);
  z-index: 5000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  transition: opacity 0.8s ease-out;
}

.menu-title {
  font-family: var(--font-title);
  font-size: 4rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 20px var(--primary-pink), 0 0 40px var(--magic-purple), 0 5px 15px rgba(0,0,0,0.5);
  text-align: center;
  animation: float 4s ease-in-out infinite;
}

.menu-desc {
  font-size: 1.3rem;
  color: var(--secondary-pink);
  max-width: 450px;
  text-align: center;
  line-height: 1.6;
  margin-top: -1rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Mobile Virtual Controls */
#mobile-controls {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  pointer-events: none;
  display: none;
}

.joystick-zone {
  position: absolute;
  bottom: 50px;
  left: 50px;
  width: 130px;
  height: 130px;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  backdrop-filter: blur(5px);
  pointer-events: auto;
  touch-action: none;
}

.joystick-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 50px;
  height: 50px;
  background: linear-gradient(135deg, var(--primary-pink) 0%, var(--magic-purple) 100%);
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

.mobile-actions {
  position: absolute;
  bottom: 50px;
  right: 50px;
  display: flex;
  gap: 1.2rem;
  pointer-events: auto;
}

.action-btn {
  width: 65px;
  height: 65px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.5rem;
  backdrop-filter: blur(5px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: all 0.1s ease;
  touch-action: none;
}

.action-btn:active {
  transform: scale(0.9);
  background: var(--primary-pink);
  border-color: #fff;
  box-shadow: 0 0 15px rgba(255,126,187,0.8);
}

.action-btn#attack-btn {
  width: 80px;
  height: 80px;
  font-size: 2rem;
  background: linear-gradient(135deg, rgba(255, 126, 187, 0.6) 0%, rgba(195, 142, 255, 0.6) 100%);
  border-color: var(--secondary-pink);
  margin-top: -10px;
}

/* Instruction Helper */
.controls-guide {
  font-size: 0.9rem;
  color: rgba(255,255,255,0.7);
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  padding: 0.6rem 1rem;
  margin-top: 2rem;
  pointer-events: auto;
}

.guide-row {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  margin: 0.3rem 0;
}

.key-cap {
  background: #333;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-family: monospace;
  box-shadow: 0 2px 0 #000;
  color: var(--secondary-pink);
}

/* Animations */
@keyframes float {
  0% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
  100% { transform: translateY(0px); }
}

@keyframes pulse {
  0% { opacity: 0.6; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

@keyframes spin-slow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-heart {
  0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(255, 51, 102, 0.6)); }
  100% { transform: scale(1.1); filter: drop-shadow(0 0 12px rgba(255, 51, 102, 0.9)); }
}

@keyframes pulse-interact {
  0% { transform: translate(-50%, 0) scale(1); opacity: 0.85; }
  100% { transform: translate(-50%, -5px) scale(1.05); opacity: 1; }
}

@keyframes scale-up {
  from { transform: scale(0.85); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Custom Scrollbar for Webkit */
.panel-body::-webkit-scrollbar {
  width: 8px;
}

.panel-body::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.02);
  border-radius: 10px;
}

.panel-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 10px;
}

.panel-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 126, 187, 0.4);
}

/* ==========================================================================
   CHRISTMAS TOWN & MINI-GAMES STYLE ADDITIONS
   ========================================================================== */

.shop-intro {
  text-align: center;
  font-size: 1.1rem;
  color: var(--secondary-pink);
  margin-bottom: 1.5rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.shop-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
}

@media (min-width: 600px) {
  .shop-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.shop-card {
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 1.2rem;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  transition: all 0.3s ease;
}

.shop-card:hover {
  background: rgba(255, 126, 187, 0.15);
  border-color: var(--primary-pink);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(255, 126, 187, 0.25);
}

.shop-icon {
  font-size: 3rem;
  width: 70px;
  height: 70px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 15px rgba(255,255,255,0.1);
}

.shop-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.shop-item-name {
  font-family: var(--font-title);
  font-size: 1.3rem;
  color: #fff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.shop-item-desc {
  font-size: 0.85rem;
  color: #ccc;
  line-height: 1.3;
}

.shop-cost-tag {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--gold);
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.btn-buy {
  background: linear-gradient(135deg, var(--primary-pink) 0%, var(--magic-purple) 100%);
  border: none;
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: bold;
  padding: 0.6rem 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(255, 126, 187, 0.3);
  transition: all 0.2s ease;
}

.btn-buy:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 15px rgba(255, 126, 187, 0.5);
}

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

/* Game Selection */
.game-menu-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1rem;
}

@media (min-width: 600px) {
  .game-menu-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.game-menu-card {
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.game-menu-card:hover {
  background: rgba(195, 142, 255, 0.15);
  border-color: var(--magic-purple);
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(195, 142, 255, 0.3);
}

.game-card-icon {
  font-size: 4rem;
  animation: float 3s ease-in-out infinite;
}

.game-menu-card h3 {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: #fff;
}

.game-menu-card p {
  font-size: 0.9rem;
  color: #ccc;
  line-height: 1.4;
  flex: 1;
}

.game-reward-badge {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: var(--mint);
  background: rgba(142, 255, 208, 0.15);
  border: 1px solid var(--mint);
  border-radius: 12px;
  padding: 0.3rem 1rem;
  box-shadow: 0 4px 10px rgba(142, 255, 208, 0.15);
  margin-top: 0.5rem;
}

.back-to-menu-btn {
  background: none;
  border: none;
  color: var(--secondary-pink);
  font-family: var(--font-title);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
  transition: color 0.2s;
}

.back-to-menu-btn:hover {
  color: var(--primary-pink);
}

/* Game Play Workspace */
.game-workspace {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.game-instruction {
  font-size: 1.1rem;
  color: #eee;
  text-align: center;
  line-height: 1.4;
}

.scrambled-letters-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.8rem;
  margin: 1rem 0;
}

.letter-btn {
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.03) 100%);
  border: 2px solid var(--glass-border);
  border-radius: 14px;
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.8rem;
  width: 55px;
  height: 55px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.letter-btn:hover:not(:disabled) {
  background: var(--primary-pink);
  border-color: #fff;
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 6px 15px var(--primary-pink-glow);
}

.letter-btn:active:not(:disabled) {
  transform: scale(0.95);
}

.letter-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: scale(0.9);
}

.spelled-word-container {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  min-height: 55px;
  margin: 0.5rem 0;
}

.word-slot {
  border-bottom: 3px solid var(--primary-pink);
  font-family: var(--font-title);
  font-size: 2rem;
  width: 45px;
  text-align: center;
  color: #fff;
  text-shadow: 0 0 10px var(--primary-pink-glow);
  height: 45px;
  line-height: 40px;
}

.word-slot.filled {
  border-color: var(--mint);
  animation: scale-up 0.2s ease-out;
}

.game-feedback {
  font-family: var(--font-title);
  font-size: 1.4rem;
  min-height: 2rem;
  text-align: center;
  font-weight: bold;
}

.game-feedback.success {
  color: var(--mint);
  text-shadow: 0 0 10px rgba(142, 255, 208, 0.4);
}

.game-feedback.error {
  color: #ff6e6e;
  text-shadow: 0 0 10px rgba(255, 110, 110, 0.4);
}

.game-actions {
  display: flex;
  gap: 1.5rem;
}

.btn-game-action {
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.2rem;
  padding: 0.6rem 1.8rem;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-game-action:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
}

.btn-game-action.submit {
  background: linear-gradient(135deg, var(--mint) 0%, #3cd8a0 100%);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 12px rgba(142, 255, 208, 0.3);
}

.btn-game-action.submit:hover {
  transform: scale(1.03);
  box-shadow: 0 6px 18px rgba(142, 255, 208, 0.5);
}

/* Hangman specific */
.hangman-stats {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  width: 100%;
}

.balloons-area {
  font-size: 2.5rem;
  letter-spacing: 0.3rem;
  min-height: 3.5rem;
  animation: float 4s ease-in-out infinite;
}

.bunny-avatar {
  font-size: 1.3rem;
  font-family: var(--font-title);
  color: var(--secondary-pink);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.4rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.1);
}

.hangman-word-slots {
  font-family: var(--font-title);
  font-size: 2.2rem;
  letter-spacing: 0.8rem;
  color: #fff;
  text-shadow: 0 2px 5px rgba(0,0,0,0.5);
  margin: 1rem 0;
  text-align: center;
  min-height: 3rem;
}

.hangman-keyboard {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  max-width: 520px;
}

.hangman-key {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #fff;
  font-family: var(--font-title);
  font-size: 1.2rem;
  width: 38px;
  height: 38px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hangman-key:hover:not(:disabled) {
  background: var(--magic-purple);
  border-color: #fff;
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(195, 142, 255, 0.4);
}

.hangman-key:disabled.correct {
  background: rgba(142, 255, 208, 0.25);
  border-color: var(--mint);
  color: var(--mint);
  cursor: not-allowed;
}

.hangman-key:disabled.wrong {
  background: rgba(255, 110, 110, 0.2);
  border-color: #ff6e6e;
  color: #ff6e6e;
  opacity: 0.5;
  cursor: not-allowed;
}

/* Responsive Styles for Mobile & Landscape Views */
@media (max-width: 768px), (max-height: 520px) {
  /* Bring HUD closer to the top and make it smaller */
  #game-hud {
    padding: max(10px, env(safe-area-inset-top)) 10px 10px 10px !important;
  }
  .hud-top {
    gap: 10px !important;
  }
  .hud-group {
    gap: 0.4rem !important;
  }
  .glass-panel {
    padding: 0.4rem 0.8rem !important;
    border-radius: 12px !important;
    gap: 0.5rem !important;
  }
  .crystal-counter, .weapon-status {
    font-size: 0.95rem !important;
  }
  .heart {
    width: 20px !important;
    height: 20px !important;
  }
  .crystal-icon, .time-icon {
    width: 20px !important;
    height: 20px !important;
  }
  .hud-bottom {
    display: none !important; /* Hide long quest text box on mobile screens to avoid overlap with canvas and virtual joystick */
  }
  
  /* Optimize panel sizes for small devices */
  .panel-container {
    max-height: 95vh !important;
    border-radius: 16px !important;
  }
  .panel-header {
    padding: 0.8rem 1.2rem !important;
  }
  .panel-title {
    font-size: 1.3rem !important;
  }
  .panel-body {
    padding: 1rem !important;
  }
  .section-title {
    font-size: 1.1rem !important;
    margin-bottom: 0.6rem !important;
  }
  .option-grid {
    grid-template-columns: repeat(auto-fill, minmax(85px, 1fr)) !important;
    gap: 0.6rem !important;
  }
  .option-card {
    border-radius: 12px !important;
    padding: 0.6rem 0.3rem !important;
  }
  .option-thumb {
    width: 32px !important;
    height: 32px !important;
    font-size: 1.3rem !important;
  }
  .option-label {
    font-size: 0.75rem !important;
  }
  .weapon-card {
    padding: 0.8rem !important;
    gap: 0.8rem !important;
    border-radius: 16px !important;
  }
  .weapon-icon {
    width: 50px !important;
    height: 50px !important;
    font-size: 1.8rem !important;
  }
  .weapon-name {
    font-size: 1.1rem !important;
  }
  .weapon-desc {
    font-size: 0.75rem !important;
  }
}

/* Recent Features Box in Main Menu */
.recent-features-box {
  width: 100%;
  max-width: 460px;
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid var(--glass-border);
  border-radius: 18px;
  padding: 1rem;
  margin: 0.6rem 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 200px;
}

.recent-features-title {
  font-family: var(--font-title);
  font-size: 1.15rem;
  color: var(--secondary-pink);
  margin-bottom: 0.6rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.recent-features-list {
  width: 100%;
  overflow-y: auto;
  padding-right: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  text-align: left;
}

/* Custom scrollbar for recent features */
.recent-features-list::-webkit-scrollbar {
  width: 5px;
}
.recent-features-list::-webkit-scrollbar-track {
  background: rgba(0,0,0,0.15);
  border-radius: 4px;
}
.recent-features-list::-webkit-scrollbar-thumb {
  background: var(--primary-pink);
  border-radius: 4px;
}

.recent-feature-item {
  border-bottom: 1px dashed rgba(255, 255, 255, 0.15);
  padding-bottom: 0.6rem;
}
.recent-feature-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.recent-feature-item strong {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--gold);
}

.recent-feature-item p {
  font-size: 0.82rem;
  color: #ddd;
  margin-top: 0.2rem;
  line-height: 1.35;
}

/* Hunger Panel and Bar in HUD */
.hunger-panel {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem !important;
}

.hunger-bar-bg {
  width: 100px;
  height: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.5);
}

.hunger-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffaa00, #ff5500);
  box-shadow: 0 0 8px rgba(255, 120, 0, 0.65);
  border-radius: 6px;
  transition: width 0.3s ease-out;
}

/* Flashing critical hunger animation */
.hunger-bar-fill.critical {
  animation: hunger-flash 0.8s infinite alternate;
}

@keyframes hunger-flash {
  from { background: #ff3300; box-shadow: 0 0 4px #ff3300; }
  to { background: #ffaa00; box-shadow: 0 0 12px #ff8800; }
}
