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

:root {
  --status-bar-height: 44px;
  --nav-bar-height: 32px;
  --bg-gradient: linear-gradient(135deg, #f7f5ed 0%, #fbfaf5 50%, #f4f1e6 100%);
  --bg-card: #fdfbf7;
  --bg-card-border: #e2dbca;
  --text-primary: #685c4c;     /* Elegant warm charcoal-brown */
  --text-secondary: rgba(104, 92, 76, 0.7);
  
  --primary: #ab364f;         /* Rose Red from screenshot */
  --accent: #3a69a4;          /* Classic Blue */
  
  --font-main: 'Outfit', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --transition-fast: 0.08s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Simple Cozy Splash Screen Styles */
#splash-screen {
  background: radial-gradient(circle at 50% 35%, #fdfbf7 0%, #f4eee0 60%, #e8decb 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}

.splash-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px;
}

.splash-badge-img,
.logo-icon-img {
  width: 84px;
  height: 84px;
  border-radius: 24px;
  box-shadow: 0 10px 24px rgba(90, 75, 55, 0.18);
  object-fit: cover;
  margin-bottom: 16px;
  border: 2px solid #d9cbab;
  animation: splashPulse 1.8s ease-in-out infinite alternate;
}

@keyframes splashPulse {
  0% { transform: scale(1); }
  100% { transform: scale(1.08); }
}

.splash-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #ab364f;
  font-family: var(--font-main);
  margin-bottom: 4px;
}

.splash-subtitle {
  font-size: 0.9rem;
  font-weight: 700;
  color: #3a69a4;
  letter-spacing: 1px;
  margin-bottom: 32px;
}

.splash-loading-bar {
  width: 180px;
  height: 6px;
  background: #e5dfcf;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.splash-loading-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #ab364f, #3a69a4, #5e9554);
  border-radius: 10px;
  animation: splashFill 1.5s ease-in-out forwards;
}

@keyframes splashFill {
  0% { width: 0%; }
  100% { width: 100%; }
}

html {
  font-size: 16px !important;
  -webkit-text-size-adjust: 100% !important;
  text-size-adjust: 100% !important;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent !important;
  -webkit-touch-callout: none !important;
  outline: none !important;
}

button, a, div, span, input, canvas, .level-card, .btn, .btn-3d {
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
}

body {
  font-family: var(--font-main);
  background-color: #eae5d8;
  color: var(--text-primary);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

.phone-wrapper {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #fbfaf5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.phone-notch {
  display: none;
}

.app-container {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--bg-gradient);
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)) 16px;
  display: flex;
  flex-direction: column;
}

body.banner-active #gameplay-screen {
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px)) !important;
}

.screen {
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 10;
}

.screen.active {
  opacity: 1 !important;
  pointer-events: auto !important;
}

.screen-header {
  display: flex;
  align-items: center;
  gap: 15px;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 20px;
  background: transparent;
  z-index: 20;
}

.screen-header h2 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: uppercase;
}

/* Elegant Skeuomorphic 3D Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 16px;
  border-radius: 18px;
  font-family: var(--font-main);
  font-weight: 800;
  font-size: min(4vw, 1rem);
  cursor: pointer;
  border: 1px solid var(--bg-card-border);
  outline: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn:active {
  transform: translateY(3px);
}

.btn-primary {
  background: linear-gradient(to bottom, #fdfbf7 0%, #edeae0 100%);
  color: var(--text-primary);
  box-shadow: 0 5px 0 #cfc7b0, 0 8px 12px rgba(104, 92, 76, 0.08);
}
.btn-primary:active {
  box-shadow: 0 2px 0 #cfc7b0, 0 3px 6px rgba(104, 92, 76, 0.08);
}

.btn-secondary {
  background: linear-gradient(to bottom, #ffffff 0%, #f4f1e6 100%);
  color: var(--text-primary);
  box-shadow: 0 4px 0 #ded7be, 0 6px 10px rgba(104, 92, 76, 0.05);
}
.btn-secondary:active {
  box-shadow: 0 1px 0 #ded7be, 0 2px 4px rgba(104, 92, 76, 0.05);
}

.btn-danger {
  background: linear-gradient(to bottom, #fdfbf7 0%, #edeae0 100%);
  color: #ab364f;
  box-shadow: 0 4px 0 #cfc7b0;
}
.btn-danger:active {
  box-shadow: 0 1px 0 #cfc7b0;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 1.1rem;
  box-shadow: 0 3px 0 #ded7be, 0 4px 8px rgba(0,0,0,0.03);
}
.btn-icon:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #ded7be, 0 1px 2px rgba(0,0,0,0.03);
}

#menu-screen {
  justify-content: space-evenly;
  align-items: center;
  gap: clamp(16px, 4vh, 48px);
  position: relative;
  overflow-y: auto;
}

#menu-screen::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  /* Abstract winding paths watermark */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M20,20 Q40,50 60,30 T90,60 M10,80 Q30,50 50,70 T80,40' stroke='rgba(171,54,79,0.06)' stroke-width='3' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 300%;
  background-position: center 30%;
  opacity: 0.6;
  z-index: -1;
  pointer-events: none;
}

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

.logo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
  max-width: 100%;
  padding: 0 8px;
  box-sizing: border-box;
  animation: float 4s ease-in-out infinite;
}

.logo-icon-badge {
  width: clamp(54px, 14vw, 68px);
  height: clamp(54px, 14vw, 68px);
  background: linear-gradient(135deg, #fdfbf7 0%, #ebe7d8 100%);
  border: 2.5px solid #ab364f;
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 8px 24px rgba(171, 54, 79, 0.25), inset 0 2px 4px #ffffff;
  margin-bottom: 8px;
  animation: logoBadgePulse 3s ease-in-out infinite alternate;
}

@keyframes logoBadgePulse {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.08) rotate(5deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.game-title {
  font-size: min(17vw, 4.2rem);
  font-weight: 900;
  letter-spacing: -0.5px;
  line-height: 0.95;
  color: #ab364f;
  text-shadow: 0 4px 16px rgba(171, 54, 79, 0.3);
  text-transform: uppercase;
  max-width: 100%;
  white-space: nowrap;
}

.game-title-sub {
  font-size: min(11vw, 2.8rem);
  font-weight: 800;
  letter-spacing: 1px;
  color: #3a69a4;
  margin-top: 2px;
  text-shadow: 0 4px 16px rgba(58, 105, 164, 0.3);
  max-width: 100%;
  white-space: nowrap;
}

.game-subtitle {
  font-size: clamp(0.7rem, 2.2vw, 0.8rem);
  color: var(--text-secondary);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: 6px;
  font-weight: 600;
  background: linear-gradient(90deg, #ab364f, #3a69a4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  max-width: 100%;
}

.menu-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

@keyframes pulseGlow {
  0% { box-shadow: 0 8px 15px rgba(171, 54, 79, 0.2), 0 0 0 0 rgba(171, 54, 79, 0.4); }
  70% { box-shadow: 0 8px 15px rgba(171, 54, 79, 0.2), 0 0 0 15px rgba(171, 54, 79, 0); }
  100% { box-shadow: 0 8px 15px rgba(171, 54, 79, 0.2), 0 0 0 0 rgba(171, 54, 79, 0); }
}

.btn-start-hero {
  background: linear-gradient(135deg, #ab364f 0%, #d84b6b 100%);
  color: #ffffff;
  border: none;
  padding: 18px 24px;
  font-size: min(5vw, 1.2rem);
  border-radius: 20px;
  box-shadow: 0 6px 0 #8a2a3e, 0 10px 20px rgba(171, 54, 79, 0.3);
  animation: pulseGlow 2s infinite;
}

.btn-start-hero:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #8a2a3e, 0 5px 10px rgba(171, 54, 79, 0.3);
}

.menu-footer {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.1rem;
}

#level-select-screen {
  padding: 0;
}

.levels-scroll-area {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
}

.levels-scroll-area::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.levels-grid {
  position: relative;
  width: 100%;
  /* Dynamic height will be set by main.js based on total level count */
  min-height: 100%;
  overflow: hidden;
  /* Ultra-cute Cotton Candy Dreamscape transition */
  background: linear-gradient(
    180deg,
    #ffcbf2 0%,       /* Soft baby pink */
    #f3c4fb 15%,      /* Pastel lilac */
    #e2c6ff 25%,      /* Soft violet */
    #bde0fe 40%,      /* Baby blue sky */
    #a2d2ff 55%,      /* Clear pastel blue */
    #b9fbc0 75%,      /* Minty green */
    #ffd6a5 90%,      /* Soft peach/orange */
    #fdffb6 100%      /* Creamy yellow */
  );
  padding: 0;
  box-sizing: border-box;
}

.saga-path-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.saga-path-svg path {
  stroke: rgba(255, 255, 255, 0.4);
  stroke-width: 6;
  stroke-dasharray: none;
  stroke-linecap: round;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
  animation: none;
}

.saga-path-svg path.path-dash {
  stroke: #ffffff;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 0 32; /* Sequence of magical floating dots */
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 1));
  animation: dash-scroll 40s linear infinite;
}

@keyframes dash-scroll {
  to { stroke-dashoffset: -1000; }
}

/* Subtle distant birds */
.nature-bird {
  position: absolute;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 1;
  animation: fly-across 25s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes fly-across {
  0% { transform: translate(-100px, 20px) scale(0.6) rotate(-5deg); opacity: 0; }
  10% { opacity: 0.9; }
  90% { opacity: 0.9; }
  100% { transform: translate(400px, -40px) scale(1) rotate(5deg); opacity: 0; }
}

/* Subtle atmospheric clouds */
.nature-cloud {
  position: absolute;
  /* Simple, soft cloud shape without facial features */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 60'%3E%3Cpath d='M25,50 A20,20 0 0,1 25,10 A30,30 0 0,1 75,15 A20,20 0 0,1 75,50 Z' fill='%23ffffff' opacity='0.3'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: blur(2px);
  pointer-events: none;
  animation: float-cloud 60s linear infinite;
  z-index: 0;
  background-color: transparent !important;
  border-radius: 0 !important;
}
.nature-cloud::before, .nature-cloud::after {
  display: none !important;
}
.nature-cloud.small { width: 120px; height: 72px; }
.nature-cloud.large { width: 180px; height: 108px; }

@keyframes float-cloud {
  0% { transform: translateX(-200px); opacity: 0; }
  10% { opacity: 1; }
  90% { opacity: 1; }
  100% { transform: translateX(500px); opacity: 0; }
}

.level-card {
  position: absolute;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
  backdrop-filter: blur(8px);
}

.level-card:active {
  transform: translate(-50%, -50%) scale(0.9);
}

.level-card.locked {
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid rgba(0,0,0,0.06);
  box-shadow: 0 4px 10px rgba(0,0,0,0.05);
  cursor: not-allowed;
}

.level-card.locked .level-num {
  color: rgba(0,0,0,0.25);
  text-shadow: none;
}

.level-card.locked .level-stars {
  filter: grayscale(1) opacity(0.3);
}

.level-card.cleared {
  background: linear-gradient(135deg, #ffb3c6, #ff8fab);
  border: 3px solid #ffffff;
  box-shadow: 0 8px 16px rgba(255, 143, 171, 0.4), inset 0 -4px 8px rgba(0,0,0,0.1);
}

.level-card.active-unlocked {
  background: linear-gradient(135deg, #a0c4ff, #9bf6ff);
  border: 4px solid #ffffff;
  width: 72px; /* Much larger to stand out */
  height: 72px;
  box-shadow: 0 10px 20px rgba(155, 246, 255, 0.6), inset 0 -4px 8px rgba(0,0,0,0.15);
  animation: pulse-ring-active 2s infinite cubic-bezier(0.455, 0.03, 0.515, 0.955);
  z-index: 5; /* Ensure it floats above others */
}

@keyframes pulse-ring-active {
  0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 10px 20px rgba(155, 246, 255, 0.6), inset 0 -4px 8px rgba(0,0,0,0.15), 0 0 0 0 rgba(155, 246, 255, 0.6); }
  50% { transform: translate(-50%, -50%) scale(1.1); box-shadow: 0 15px 30px rgba(155, 246, 255, 0.7), inset 0 -4px 8px rgba(0,0,0,0.15), 0 0 0 16px rgba(155, 246, 255, 0); }
  100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 10px 20px rgba(155, 246, 255, 0.6), inset 0 -4px 8px rgba(0,0,0,0.15), 0 0 0 0 rgba(155, 246, 255, 0); }
}

.level-num {
  color: #ffffff;
  font-size: 1.5rem; /* Slightly larger since there are no stars */
  font-weight: 800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.level-stars {
  font-size: 0.65rem;
  color: #ffffff;
  margin-top: -2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.gameplay-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.btn-pause-float {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid #e7e3d4;
  color: #685c4c;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast);
  outline: none;
}

.btn-pause-float:active {
  background: rgba(104, 92, 76, 0.05);
  transform: scale(0.92);
}

.btn-speed-float {
  height: 32px;
  padding: 0 10px;
  border-radius: 16px;
  background: transparent;
  border: 1px solid #e7e3d4;
  color: #685c4c;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: background var(--transition-fast), transform var(--transition-fast);
  outline: none;
}

.btn-speed-float:active {
  background: rgba(104, 92, 76, 0.05);
  transform: scale(0.92);
}

/* Gameplay Screen Full-Screen Backdrop & Ambient Polish */
#gameplay-screen {
  background: radial-gradient(circle at 50% -10%, #fffefc 0%, #f7f2e6 55%, #eae1cd 100%);
  overflow: hidden;
}

/* Ambient Floating Background Light Orbs */
.screen-bg-orb {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0.65;
  animation: orbFloat 10s ease-in-out infinite alternate;
}

.orb-top {
  width: 240px;
  height: 240px;
  top: -40px;
  left: -40px;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.22) 0%, rgba(251, 191, 36, 0.08) 50%, transparent 70%);
}

.orb-bottom {
  width: 280px;
  height: 280px;
  bottom: -60px;
  right: -60px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.18) 0%, rgba(244, 114, 182, 0.06) 50%, transparent 70%);
  animation-delay: 5s;
}

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

/* Cozy Wooden Tabletop & Soft Lamp Light Backdrop for Gameplay Screen */
#gameplay-screen {
  background: radial-gradient(circle at 50% 25%, #f6efe0 0%, #ebdebe 45%, #d4c19c 85%, #beaa83 100%),
              repeating-linear-gradient(45deg, rgba(160, 140, 100, 0.04) 0px, rgba(160, 140, 100, 0.04) 2px, transparent 2px, transparent 6px);
  overflow: hidden;
}

.tabletop-spotlight {
  position: absolute;
  top: -10%;
  left: 50%;
  transform: translateX(-50%);
  width: 140%;
  height: 80%;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 240, 0.55) 0%, rgba(255, 255, 240, 0.15) 50%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.gameplay-header-row,
.hearts-row,
.canvas-wrapper,
.action-footer {
  position: relative;
  z-index: 1;
}

.gameplay-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2px;
}

.gameplay-header-text {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #574d3e;
  font-family: var(--font-main);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.btn-pause-float {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffffff 0%, #f4eee1 100%);
  border: 1.5px solid #d9cbab;
  color: #574d3e;
  font-size: 0.85rem;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
  box-shadow: 0 3px 6px rgba(90, 75, 55, 0.15), inset 0 1px 2px #ffffff;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 0;
  margin-bottom: 12px;
  overflow: hidden;
}

#game-canvas {
  background: radial-gradient(circle at 50% 45%, #ffffff 0%, #fdfbf7 70%, #f4eee0 100%);
  border: 2px solid #cbb792;
  border-radius: 26px;
  box-shadow: 0 16px 38px rgba(90, 75, 55, 0.22), inset 0 2px 4px #ffffff;
  touch-action: none;
  display: block;
}

.action-footer {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

/* Skeuomorphic Cozy Wooden Tokens (Undo, Hint, Restart, Grid) */
.btn-3d {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 6px 8px 6px;
  background: linear-gradient(180deg, #fdfbf7 0%, #eae1cf 100%);
  border: 1.5px solid #c7b897;
  border-radius: 18px;
  box-shadow: 0 4px 0 #b3a280, 0 6px 14px rgba(90, 75, 55, 0.15), inset 0 1.5px 2px #ffffff;
  color: #574d3e;
  font-weight: 800;
  cursor: pointer;
  outline: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn-3d:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #b3a280, 0 2px 5px rgba(90, 75, 55, 0.1);
  background: linear-gradient(180deg, #eae1cf 0%, #d8caa7 100%);
}

.btn-3d-icon {
  font-size: 1.35rem;
  color: #574d3e;
  margin-bottom: 2px;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

.btn-3d-label {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #574d3e;
}

.shop-balance {
  background: #fdfbf7;
  border: 1px solid var(--bg-card-border);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  font-family: var(--font-mono);
  margin-bottom: 20px;
}

.shop-items-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.shop-item-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 0 #ded7be, 0 6px 10px rgba(0,0,0,0.03);
}

.shop-item-info h3 {
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.shop-item-info p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(247, 245, 237, 0.95);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 100;
  padding: 20px;
}

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

.overlay-card {
  background: #fdfbf7;
  border: 1px solid #e7e3d4;
  border-radius: 32px;
  padding: 36px 24px;
  width: 100%;
  max-width: 320px;
  text-align: center;
  box-shadow: 0 15px 35px rgba(104, 92, 76, 0.08);
  margin: auto;
  flex-shrink: 0;
}

.overlay-title {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.overlay-subtitle {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.45;
}

.overlay-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.overlay-actions .btn {
  width: 100%;
}

.success-icon {
  font-size: 3.2rem;
  margin-bottom: 12px;
  animation: pulse-icon 1.5s infinite;
}

.victory-stats {
  display: flex;
  justify-content: space-around;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  margin-bottom: 20px;
  background: rgba(0,0,0,0.02);
  padding: 12px;
  border-radius: 14px;
}

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

@media (max-width: 420px) {
  .phone-wrapper {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .phone-notch {
    display: none;
  }
}





/* Mobile Responsiveness */
@media (max-width: 500px), (max-height: 850px) {
  .phone-wrapper {
    width: 100vw;
    height: 100vh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
  .phone-notch {
    display: none;
  }
  .screen {
    padding: 16px 12px calc(12px + env(safe-area-inset-bottom, 0px)) 12px;
  }
}

/* Skeuomorphic Cream Pill FAB */
.fab-cream-pill {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px 10px 14px;
  background: linear-gradient(to bottom, #ffffff 0%, #f4f1e6 100%);
  border: 2px solid #e2dbca;
  border-radius: 28px;
  box-shadow: 0 5px 0 #ded7be, 0 8px 18px rgba(104, 92, 76, 0.12);
  cursor: pointer;
  outline: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
  white-space: nowrap;
  animation: fab-pill-float 3s infinite ease-in-out;
}

.fab-cream-pill:active {
  transform: translateX(-50%) translateY(3px) scale(0.97);
  box-shadow: 0 2px 0 #ded7be, 0 3px 8px rgba(104, 92, 76, 0.08);
}

.fab-pill-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ab364f 0%, #d84b6b 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  padding-left: 2px;
  box-shadow: 0 2px 5px rgba(171, 54, 79, 0.3);
}

.fab-pill-text {
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 0.95rem;
  color: #685c4c;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.fab-pill-text span {
  color: #ab364f;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.05rem;
  margin-left: 2px;
}

@keyframes fab-pill-float {
  0%, 100% { 
    transform: translateX(-50%) translateY(0); 
    box-shadow: 0 5px 0 #ded7be, 0 8px 18px rgba(104, 92, 76, 0.12); 
  }
  50% { 
    transform: translateX(-50%) translateY(-3px); 
    box-shadow: 0 8px 0 #ded7be, 0 12px 22px rgba(104, 92, 76, 0.16); 
  }
}

/* Minimalist Train Control Bar */
.train-control-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 360px;
  margin: 10px auto 4px auto;
}

.train-control-bar.hidden {
  display: none !important;
}

.train-pill-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: linear-gradient(180deg, #ffffff 0%, #f4f1e6 100%);
  border: 2px solid #e2dbca;
  border-radius: 20px;
  box-shadow: 0 4px 0 #ded7be, 0 6px 14px rgba(104, 92, 76, 0.12);
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 0.9rem;
  cursor: pointer;
  outline: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.train-pill-btn:active {
  transform: translateY(2px) scale(0.97);
  box-shadow: 0 2px 0 #ded7be, 0 3px 8px rgba(104, 92, 76, 0.08);
}

.btn-speed-toggle {
  color: #ab364f;
}

.btn-speed-toggle .pill-text {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1rem;
}

.btn-horn-pill {
  color: #92400e;
  background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
  border-color: #fcd34d;
  box-shadow: 0 4px 0 #d97706, 0 6px 14px rgba(217, 119, 6, 0.15);
}

.btn-horn-pill:active {
  box-shadow: 0 2px 0 #d97706;
}

/* Interactive Train Walkthrough Overlay Styles */
.walkthrough-steps-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e2dbca;
  transition: background 0.3s ease, transform 0.3s ease;
}

.step-dot.active {
  background: #ab364f;
  transform: scale(1.3);
}

.wt-step-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.wt-step-panel.active {
  display: flex;
}

.wt-icon {
  font-size: 2.8rem;
  line-height: 1;
  margin-bottom: 8px;
}

.wt-title {
  font-family: var(--font-main);
  font-weight: 800;
  font-size: 1.25rem;
  color: #44403c;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.wt-desc {
  font-size: 0.85rem;
  color: #685c4c;
  line-height: 1.45;
  margin-bottom: 12px;
}

.wt-highlight-box {
  background: rgba(171, 54, 79, 0.08);
  border: 1.5px dashed #ab364f;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: #44403c;
  width: 100%;
  line-height: 1.4;
}

.wt-demo-box {
  position: relative;
  width: 100%;
  height: 90px;
  background: #f4f1e6;
  border: 2px solid #e2dbca;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 8px;
}

.demo-track {
  position: absolute;
  top: 12px;
  left: 0;
  width: 100%;
  height: 28px;
  background: #e5dfcf;
  border-top: 2px solid #cbd5e1;
  border-bottom: 2px solid #cbd5e1;
}

.demo-carriage {
  position: absolute;
  top: 2px;
  left: 10px;
  padding: 4px 12px;
  background: #ab364f;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  transition: left 0.8s ease;
}

.demo-arrow {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 4px 14px;
  background: #ab364f;
  color: #ffffff;
  font-weight: 800;
  font-size: 0.78rem;
  border-radius: 20px;
  box-shadow: 0 3px 0 #8c2a3f;
  transition: bottom 0.5s ease, opacity 0.5s ease;
}

.wt-control-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.03);
  padding: 8px 12px;
  border-radius: 12px;
  width: 100%;
  text-align: left;
  font-size: 0.78rem;
  color: #57534e;
}

.pill-preview {
  background: #fdfbf7;
  border: 1.5px solid #e2dbca;
  color: #ab364f;
  font-weight: 800;
  font-size: 0.82rem;
  padding: 4px 10px;
  border-radius: 14px;
  white-space: nowrap;
}

.pill-preview.horn-preview {
  background: #fef3c7;
  border-color: #fcd34d;
  color: #92400e;
}

/* ================= LEADERBOARD & ACHIEVEMENTS WORLD-CLASS STYLES ================= */
.lb-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 420px;
  padding: 12px 4px 8px 4px;
  box-sizing: border-box;
}

.btn-clean-back {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #fdfbf7;
  border: 1.5px solid #e7dfd0;
  color: #574d3e;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
}

.lb-header-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #443d33;
  letter-spacing: -0.5px;
  margin: 0;
  text-align: center;
  flex: 1;
}

.btn-profile-edit {
  background: linear-gradient(135deg, #ffffff 0%, #fdfbf7 100%);
  border: 1.5px solid #ab364f;
  color: #ab364f;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 8px 14px;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(171, 54, 79, 0.15);
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.leaderboard-container, .achievements-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 420px;
  height: calc(100% - 65px);
  padding: 0;
  box-sizing: border-box;
}

.hall-of-fame-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 22px;
  padding: 14px 16px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.25);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.hof-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #92400e;
  background: rgba(255, 255, 255, 0.8);
  padding: 4px 12px;
  border-radius: 12px;
  border: 1px solid rgba(245, 158, 11, 0.4);
}

.hof-player-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.hof-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: #ffffff;
  border: 2px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.2);
}

.hof-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.hof-name {
  font-size: 1.15rem;
  font-weight: 800;
  color: #78350f;
  letter-spacing: -0.3px;
}

.hof-sub {
  font-size: 0.8rem;
  color: #92400e;
  font-weight: 600;
  margin-top: 2px;
}

.leaderboard-scroll-area, .achievements-scroll-area {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fdfbf7;
  border: 1.5px solid #e7dfd0;
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
}

.leaderboard-item.top-three {
  border-color: #f59e0b;
  background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

.leaderboard-item.lb-item-me {
  border-color: #ab364f;
  background: linear-gradient(135deg, #ffffff 0%, #fff1f2 100%);
}

.lb-rank {
  font-size: 1.15rem;
  font-weight: 800;
  width: 34px;
  color: #78350f;
}

.lb-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0 8px;
}

.lb-name {
  font-size: 0.98rem;
  font-weight: 800;
  color: #44403c;
}

.lb-detail {
  font-size: 0.76rem;
  color: #78716c;
  margin-top: 2px;
}

.lb-level {
  font-size: 0.88rem;
  font-weight: 800;
  color: #ab364f;
  background: rgba(171, 54, 79, 0.08);
  padding: 6px 12px;
  border-radius: 14px;
}

.player-rank-card {
  background: #292524;
  color: #ffffff;
  border-radius: 20px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  margin-top: 8px;
  margin-bottom: calc(12px + env(safe-area-inset-bottom, 12px));
}

.player-rank-info {
  display: flex;
  flex-direction: column;
}

.player-rank-label {
  font-size: 0.68rem;
  color: #a8a29e;
  font-weight: 800;
  letter-spacing: 1px;
}

.player-rank-num {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fbbf24;
}

.player-rank-progress {
  font-size: 0.8rem;
  color: #e7e5e4;
  text-align: right;
  max-width: 65%;
  font-weight: 600;
}

.achievement-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fdfbf7;
  border: 1.5px solid #e7dfd0;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: transform 0.2s ease;
}

.achievement-card.unlocked {
  border-color: #10b981;
  background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
}

.ach-icon {
  font-size: 2rem;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.04);
  border-radius: 14px;
}

.ach-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ach-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: #44403c;
}

.ach-desc {
  font-size: 0.76rem;
  color: #78716c;
  margin-top: 2px;
}

.ach-progress-bar {
  width: 100%;
  height: 6px;
  background: #e7e5e4;
  border-radius: 4px;
  margin-top: 6px;
  overflow: hidden;
}

.ach-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.ach-status {
  font-size: 0.75rem;
  font-weight: 800;
  color: #059669;
  background: #d1fae5;
  padding: 4px 8px;
  border-radius: 10px;
}

/* ================= PROFILE MODAL STYLES ================= */
.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.profile-avatar-preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);
  border: 3px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.3);
  overflow: hidden;
  position: relative;
}

.avatar-presets-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: center;
  flex-wrap: wrap;
  max-width: 260px;
}

.avatar-preset-item {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fdfbf7;
  border: 1.5px solid #e7dfd0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.avatar-preset-item:hover, .avatar-preset-item.selected {
  border-color: #ab364f;
  transform: scale(1.15);
  background: #fff1f2;
}

.profile-stats-grid {
  display: flex;
  gap: 10px;
  width: 100%;
  margin-top: 12px;
}

.p-stat-box {
  flex: 1;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 14px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.p-stat-num {
  font-size: 1.15rem;
  font-weight: 800;
  color: #ab364f;
}

.p-stat-lbl {
  font-size: 0.65rem;
  font-weight: 800;
  color: #78716c;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

/* ================= AD SPINNER STYLES ================= */
.ad-spinner-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 4px solid rgba(171, 54, 79, 0.15);
  border-top-color: #ab364f;
  border-right-color: #f59e0b;
  animation: adSpin 0.9s linear infinite;
  margin-bottom: 8px;
}

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

/* ================= LEADERBOARD TOP TABS & MILESTONE STYLES ================= */
.lb-nav-tabs {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  margin-bottom: 8px;
  background: rgba(0, 0, 0, 0.04);
  padding: 4px;
  border-radius: 18px;
  box-sizing: border-box;
}

.lb-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #78716c;
  font-weight: 800;
  font-size: 0.8rem;
  padding: 8px 12px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.lb-tab-btn.active {
  background: #fdfbf7;
  color: #ab364f;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}

.lb-tab-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

.milestones-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.milestone-card {
  background: linear-gradient(135deg, #fffbeb 0%, #fde68a 100%);
  border: 2px solid #f59e0b;
  border-radius: 20px;
  padding: 14px 16px;
  box-shadow: 0 6px 18px rgba(245, 158, 11, 0.2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.milestone-card:active {
  transform: scale(0.98);
}

.ms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.ms-badge {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #92400e;
  background: rgba(255, 255, 255, 0.85);
  padding: 4px 12px;
  border-radius: 12px;
}

.ms-tag {
  font-size: 0.7rem;
  font-weight: 800;
  color: #b45309;
}

.ms-player-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ms-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #f59e0b;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  overflow: hidden;
}

.ms-info {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.ms-name {
  font-size: 1.05rem;
  font-weight: 800;
  color: #78350f;
}

.ms-sub {
  font-size: 0.78rem;
  color: #92400e;
  font-weight: 600;
  margin-top: 2px;
}
.revive-gameover-card {
  max-width: 320px;
  padding: 28px 22px;
  border-radius: 28px;
  background: rgba(253, 251, 247, 0.98);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.revive-heart-badge {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffe4e6 0%, #fecdd3 100%);
  border: 3px solid #f43f5e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  box-shadow: 0 8px 20px rgba(244, 63, 94, 0.3);
  animation: heartPulse 2s ease-in-out infinite;
}

@keyframes heartPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.revive-plus-tag {
  position: absolute;
  top: -4px;
  right: -6px;
  background: #10b981;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.4);
}

.btn-revive-hero {
  width: 100%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  border: none;
  border-radius: 18px;
  padding: 14px 18px;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.35);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.revive-btn-icon {
  font-size: 1.3rem;
}

