/* ==========================================================================
   ¡MI BEBÉ GATITO TITO Y MIMI! - Infant & Toddler Game (2-4 Years)
   ========================================================================== */

:root {
  --font-main: 'Fredoka', 'Comic Sans MS', 'Chalkboard SE', sans-serif;
  --wall-day: #FFF5D6;
  --floor-day: #F6C59E;
  --rug-color: #FF7597;
  --rug-border: #FFE066;

  --wall-night: #12163A;
  --floor-night: #1E214A;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  font-family: var(--font-main);
  background: #FFE5B4;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   START / WELCOME SPLASH SCREEN WITH TITO & MIMI SELECTOR
   ========================================================================== */
.start-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: linear-gradient(180deg, #80FFDB 0%, #A9DEF9 50%, #FFF3B0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.start-screen.fade-out {
  opacity: 0;
  transform: scale(1.1);
  pointer-events: none;
}

.start-card {
  background: #FFFFFF;
  border: 6px solid #FFD166;
  border-radius: 42px;
  padding: 24px 20px 28px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 0 #F4A261, 0 26px 45px rgba(0, 0, 0, 0.22);
  animation: floatCard 3s ease-in-out infinite;
}

@keyframes floatCard {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-7px); }
}

.start-title {
  font-size: 2rem;
  color: #FF4D8D;
  text-shadow: 2px 3px 0 #FFE3EC;
  margin-bottom: 6px;
}

.start-subtitle {
  font-size: 1.05rem;
  color: #5C5470;
  margin-bottom: 18px;
  line-height: 1.3;
}

/* Character Choice Grid (Tito vs Mimi) */
.char-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.char-choice-card {
  background: #FFFDF7;
  border: 5px solid #E2E8F0;
  border-radius: 28px;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: var(--font-main);
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 6px 0 #CBD5E1;
}

.char-choice-card.selected {
  transform: scale(1.05);
  border-color: #FF4D8D;
  background: #FFF0F6;
  box-shadow: 0 8px 0 #FF85A1, 0 0 20px rgba(255, 77, 141, 0.35);
}

.choice-avatar-circle {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid #FFFFFF;
}

.tito-circle {
  background: radial-gradient(circle, #FFF8E7 0%, #FFD166 100%);
}

.mimi-circle {
  background: radial-gradient(circle, #FFF0F5 0%, #FFAFCC 100%);
}

.mini-tito-svg {
  width: 96px;
  height: 96px;
}

.choice-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: #2D3142;
}

.choice-tag {
  font-size: 0.82rem;
  color: #6C757D;
  font-weight: 600;
}

.btn-giant-play {
  background: linear-gradient(180deg, #06D6A0 0%, #04A77D 100%);
  color: #FFFFFF;
  border: 5px solid #FFFFFF;
  border-radius: 999px;
  padding: 16px 42px;
  font-family: var(--font-main);
  font-size: 1.75rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 0 #037E5E, 0 15px 25px rgba(0, 0, 0, 0.25);
  animation: pulsePlay 1.4s infinite ease-in-out;
  transition: transform 0.12s;
}

.btn-giant-play:active {
  transform: translateY(6px) scale(0.96);
  box-shadow: 0 4px 0 #037E5E;
}

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

/* ==========================================================================
   MAIN GAME CONTAINER & ROOM BACKGROUNDS
   ========================================================================== */
.game-container {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: background 0.6s ease;
}

.game-container.shake-screen {
  animation: megaTootShake 0.55s ease-in-out;
}

@keyframes megaTootShake {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  15% { transform: translate(-10px, -6px) rotate(-1.5deg); }
  30% { transform: translate(10px, 6px) rotate(1.5deg); }
  45% { transform: translate(-8px, 5px) rotate(-1deg); }
  60% { transform: translate(8px, -5px) rotate(1deg); }
  75% { transform: translate(-5px, 3px) rotate(-0.5deg); }
}

#particle-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 25;
  pointer-events: none;
}

/* Room Background Layer */
.room-bg {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: var(--wall-day);
  transition: background 0.8s ease;
}

.game-container.room-night .room-bg {
  background: radial-gradient(circle at 50% 25%, #242058 0%, #101334 85%);
}

.game-container.room-disco .room-bg {
  animation: discoWall 2.5s linear infinite;
}

@keyframes discoWall {
  0%   { background: #FF6B8B; }
  25%  { background: #7209B7; }
  50%  { background: #3A86FF; }
  75%  { background: #06D6A0; }
  100% { background: #FF6B8B; }
}

/* Nighttime Twinkling Stars & Owl on the Nursery Wall */
.night-stars-wall {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
  z-index: 2;
}

.game-container.room-night .night-stars-wall {
  opacity: 1;
}

.twinkle-star {
  position: absolute;
  font-size: 1.7rem;
  filter: drop-shadow(0 0 10px rgba(255, 235, 130, 0.9));
  animation: starTwinkle 2.4s ease-in-out infinite alternate;
}

.twinkle-star.s1 { top: 14%; left: 32%; animation-delay: 0s; }
.twinkle-star.s2 { top: 22%; left: 72%; animation-delay: 0.6s; font-size: 1.4rem; }
.twinkle-star.s3 { top: 10%; left: 54%; animation-delay: 1.1s; font-size: 2rem; }
.twinkle-star.s4 { top: 32%; left: 18%; animation-delay: 0.3s; font-size: 1.3rem; }
.twinkle-star.s5 { top: 28%; right: 20%; animation-delay: 1.5s; }
.twinkle-star.s6 { top: 16%; right: 32%; animation-delay: 0.9s; font-size: 2.1rem; }
.twinkle-star.s7 { top: 38%; left: 10%; animation-delay: 0.4s; font-size: 2.2rem; }

@keyframes starTwinkle {
  0%   { transform: scale(0.82) rotate(-6deg); opacity: 0.45; }
  100% { transform: scale(1.18) rotate(6deg); opacity: 1; }
}

/* Cute Nursery Window */
.room-window {
  position: absolute;
  top: 76px;
  left: 5%;
  width: 108px;
  height: 128px;
  border-radius: 60px 60px 16px 16px;
  border: 7px solid #FFFFFF;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.12);
  overflow: hidden;
  cursor: pointer;
  z-index: 3;
  transition: transform 0.2s, box-shadow 0.6s;
}

.game-container.room-night .room-window {
  border-color: #BDE0FE;
  box-shadow: 0 0 28px rgba(169, 222, 249, 0.45);
}

.room-window:active {
  transform: scale(0.92);
}

.window-sky {
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #48CAE4 0%, #ADE8F4 100%);
  position: relative;
  transition: background 0.6s ease;
}

.game-container.room-night .window-sky {
  background: linear-gradient(180deg, #0B0F29 0%, #1E1B4B 100%);
}

.window-sun {
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 2.1rem;
  transition: transform 0.6s ease, opacity 0.5s;
  animation: spinSlow 14s linear infinite;
}

.window-moon,
.window-stars {
  position: absolute;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease;
}

.window-moon {
  top: 12px;
  right: 16px;
  font-size: 2rem;
  filter: drop-shadow(0 0 8px #FFF3B0);
}

.window-stars {
  bottom: 16px;
  left: 10px;
  font-size: 0.95rem;
}

.game-container.room-night .window-sun {
  opacity: 0;
  transform: translateY(40px);
}

.game-container.room-night .window-moon,
.game-container.room-night .window-stars {
  opacity: 1;
  transform: translateY(0);
}

.window-cloud {
  position: absolute;
  bottom: 8px;
  left: 8px;
  font-size: 1.7rem;
  animation: cloudDrift 5s ease-in-out infinite;
}

@keyframes cloudDrift {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(18px); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Hat Switcher Frame on Wall */
.wall-frame {
  position: absolute;
  top: 86px;
  right: 5%;
  width: 74px;
  height: 74px;
  background: #FFF9EC;
  border: 6px solid #FFB703;
  border-radius: 22px;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  cursor: pointer;
  z-index: 4;
  transition: transform 0.15s;
}

.wall-frame:active {
  transform: scale(0.88) rotate(8deg);
}

/* Disco Ball */
.disco-ball {
  position: absolute;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 4rem;
  z-index: 6;
  animation: discoSwing 1.2s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 18px #FFFFFF);
}

@keyframes discoSwing {
  from { transform: translateX(-50%) rotate(-12deg); }
  to   { transform: translateX(-50%) rotate(12deg); }
}

/* Floor & Rug */
.room-floor {
  position: absolute;
  bottom: 0;
  width: 100%;
  height: 33%;
  background: var(--floor-day);
  border-top: 8px solid #E2A36E;
  transition: background 0.8s ease, border-color 0.8s ease;
}

.game-container.room-night .room-floor {
  background: var(--floor-night);
  border-top-color: #141738;
}

.room-rug {
  position: absolute;
  top: 25%;
  left: 50%;
  transform: translateX(-50%);
  width: min(84vw, 420px);
  height: 96px;
  background: var(--rug-color);
  border: 8px solid var(--rug-border);
  border-radius: 50%;
  box-shadow: 0 8px 0 rgba(0, 0, 0, 0.12);
  transition: filter 0.8s;
}

.game-container.room-night .room-rug {
  filter: brightness(0.75);
}

/* ==========================================================================
   TOP BAR (MIC INDICATOR, TITO/MIMI SWITCHER & BIG PHONE BUTTON)
   ========================================================================== */
.top-bar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 12px 6px;
  gap: 8px;
}

.top-pill {
  background: #FFFFFF;
  border: 4px solid #4ECDC4;
  border-radius: 999px;
  padding: 7px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 700;
  color: #2D3142;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: all 0.2s;
}

.top-pill.listening-active {
  background: #E0FBF8;
  border-color: #06D6A0;
  transform: scale(1.05);
  box-shadow: 0 0 18px rgba(6, 214, 160, 0.7);
}

.top-pill.repeating-active {
  background: #FFF0F5;
  border-color: #FF5C8A;
}

.mic-icon {
  font-size: 1.25rem;
}

.voice-meter {
  width: 30px;
  height: 11px;
  background: #E9ECEF;
  border-radius: 10px;
  overflow: hidden;
  display: inline-block;
}

#voice-meter-bar {
  display: block;
  height: 100%;
  width: 15%;
  background: linear-gradient(90deg, #06D6A0, #FFD166, #FF5C8A);
  border-radius: 10px;
  transition: width 0.08s ease;
}

.top-right-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Switch Gatito Tito / Gatita Mimi Button */
.btn-char-toggle {
  background: linear-gradient(180deg, #FF85A1 0%, #FF4D8D 100%);
  color: #FFFFFF;
  border: 3.5px solid #FFFFFF;
  border-radius: 999px;
  padding: 7px 14px;
  font-family: var(--font-main);
  font-size: 0.98rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 5px 0 #C9184A;
  cursor: pointer;
  transition: transform 0.12s;
}

.btn-char-toggle.mode-tito {
  background: linear-gradient(180deg, #FFB703 0%, #FB8500 100%);
  box-shadow: 0 5px 0 #C95200;
}

.btn-char-toggle:active {
  transform: translateY(4px) scale(0.95);
}

.btn-phone-cta {
  background: linear-gradient(180deg, #38B000 0%, #2B9348 100%);
  color: #FFFFFF;
  border: 4px solid #FFFFFF;
  border-radius: 999px;
  padding: 8px 15px;
  font-family: var(--font-main);
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 6px 0 #1B602F, 0 8px 18px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.12s;
}

.btn-phone-cta:active {
  transform: translateY(4px) scale(0.95);
}

.pulse-phone {
  animation: phoneCtaBounce 2.2s infinite ease-in-out;
}

.btn-phone-cta.incoming-ring {
  background: linear-gradient(180deg, #FF5C8A 0%, #E01E5A 100%);
  box-shadow: 0 6px 0 #9E143F, 0 0 24px rgba(255, 92, 138, 0.85);
  animation: ringShake 0.45s infinite;
}

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

@keyframes ringShake {
  0%, 100% { transform: rotate(0deg) scale(1.08); }
  25% { transform: rotate(-8deg) scale(1.1); }
  75% { transform: rotate(8deg) scale(1.1); }
}

.btn-round-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid #FFFFFF;
  background: rgba(255, 255, 255, 0.85);
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   SPEECH BUBBLE
   ========================================================================== */
.speech-bubble {
  position: absolute;
  top: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 18;
  background: #FFFFFF;
  border: 4px solid #FFB703;
  border-radius: 28px;
  padding: 10px 20px;
  font-size: 1.18rem;
  font-weight: 700;
  color: #3D348B;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.12);
  max-width: 92vw;
  text-align: center;
  animation: popBubble 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}

.speech-bubble::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 14px 12px 0;
  border-style: solid;
  border-color: #FFB703 transparent;
}

@keyframes popBubble {
  from { transform: translateX(-50%) scale(0.4); opacity: 0; }
  to   { transform: translateX(-50%) scale(1); opacity: 1; }
}

/* ==========================================================================
   CHARACTER STAGE & ARTICULATED SVG ANIMATIONS
   ========================================================================== */
.character-stage {
  position: relative;
  z-index: 10;
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
  overflow: visible;
}

.sound-halo {
  position: absolute;
  width: 280px;
  height: 280px;
  bottom: 90px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(78, 205, 196, 0.45) 0%, rgba(78, 205, 196, 0) 70%);
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
}

.sound-halo.active {
  opacity: 1;
  animation: haloPulse 0.9s infinite alternate ease-in-out;
}

@keyframes haloPulse {
  from { transform: scale(0.95); }
  to   { transform: scale(1.25); }
}

.character-wrapper {
  width: min(86vw, 375px);
  height: min(60vh, 415px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  transform-origin: bottom center;
  transition: transform 0.2s;
}

#tito-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.touch-zone {
  cursor: pointer;
}

/* Idle Breathing & Tail Wag */
.character-wrapper.state-idle {
  animation: charBreathe 2.8s ease-in-out infinite;
}

@keyframes charBreathe {
  0%, 100% { transform: scale(1, 1); }
  50%      { transform: scale(1.025, 0.98); }
}

.tail-group {
  transform-origin: 268px 355px;
  animation: tailWag 2.2s ease-in-out infinite alternate;
  cursor: pointer;
}

@keyframes tailWag {
  0%   { transform: rotate(-8deg); }
  100% { transform: rotate(14deg); }
}

.ear-left {
  transform-origin: 125px 105px;
}

.ear-right {
  transform-origin: 275px 105px;
}

/* Listening State */
.character-wrapper.state-listening {
  animation: listenLean 0.8s ease-in-out infinite alternate;
}

.character-wrapper.state-listening .ear-left {
  transform: rotate(-12deg) scale(1.08);
}

@keyframes listenLean {
  from { transform: scale(1.04) rotate(-2deg); }
  to   { transform: scale(1.06) rotate(2deg); }
}

/* Talking / Repeating State */
.character-wrapper.state-talking {
  animation: talkBounce 0.32s ease-in-out infinite alternate;
}

@keyframes talkBounce {
  from { transform: scale(1, 1) translateY(0); }
  to   { transform: scale(1.03, 0.97) translateY(-6px); }
}

/* Laughing / Tickle State */
.character-wrapper.state-laughing {
  animation: bellyLaugh 0.18s ease-in-out infinite alternate;
}

@keyframes bellyLaugh {
  0%   { transform: translateY(0) rotate(-4deg) scale(1.04, 0.96); }
  100% { transform: translateY(-10px) rotate(4deg) scale(0.96, 1.04); }
}

/* Dancing State */
.character-wrapper.state-dancing {
  animation: danceGroove 0.45s cubic-bezier(0.36, 0, 0.66, -0.56) infinite alternate;
}

@keyframes danceGroove {
  0%   { transform: translateY(0) rotate(-9deg) scale(1.05, 0.95); }
  50%  { transform: translateY(-22px) rotate(0deg) scale(0.95, 1.06); }
  100% { transform: translateY(0) rotate(9deg) scale(1.05, 0.95); }
}

/* Jumping / Paws Boing State */
.character-wrapper.state-jumping {
  animation: charJump 0.55s cubic-bezier(0.28, 0.84, 0.42, 1);
}

@keyframes charJump {
  0%   { transform: scale(1.12, 0.86) translateY(0); }
  40%  { transform: scale(0.92, 1.12) translateY(-55px); }
  75%  { transform: scale(1.06, 0.94) translateY(0); }
  100% { transform: scale(1, 1) translateY(0); }
}

/* Sleeping State */
.character-wrapper.state-sleeping {
  animation: sleepBreathe 3.6s ease-in-out infinite;
}

@keyframes sleepBreathe {
  0%, 100% { transform: scale(1, 0.96) translateY(6px); }
  50%      { transform: scale(1.035, 0.93) translateY(10px); }
}

/* Flying Food Item Animation */
.food-item-flying {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 4.2rem;
  z-index: 30;
  pointer-events: none;
  animation: flyToMouth 0.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes flyToMouth {
  0%   { bottom: 20px; transform: translateX(-50%) scale(0.6) rotate(-20deg); opacity: 1; }
  70%  { bottom: 235px; transform: translateX(-50%) scale(1.25) rotate(10deg); opacity: 1; }
  100% { bottom: 245px; transform: translateX(-50%) scale(0.2); opacity: 0; }
}

/* ==========================================================================
   SLEEP MODE MENU: BEDTIME STORIES & LULLABIES ("LA LECHUZA", CUENTOS)
   ========================================================================== */
.sleep-menu {
  position: relative;
  z-index: 22;
  margin: 0 auto 6px;
  width: min(96vw, 480px);
  background: rgba(25, 29, 75, 0.88);
  border: 3.5px solid #A9DEF9;
  border-radius: 28px;
  padding: 8px 10px 10px;
  box-shadow: 0 0 25px rgba(169, 222, 249, 0.35), 0 8px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  animation: popSleepMenu 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes popSleepMenu {
  from { opacity: 0; transform: translateY(20px) scale(0.9); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.sleep-menu-title {
  text-align: center;
  color: #FFF3B0;
  font-size: 0.98rem;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
}

.sleep-menu-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.sleep-card-btn {
  background: linear-gradient(180deg, #3F37C9 0%, #240046 100%);
  border: 3px solid #BDB2FF;
  border-radius: 20px;
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #FFFFFF;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 5px 0 #10002B;
  transition: transform 0.12s, border-color 0.2s, box-shadow 0.2s;
}

.sleep-card-btn:active {
  transform: translateY(4px) scale(0.94);
}

.sleep-card-btn.playing {
  background: linear-gradient(180deg, #7209B7 0%, #560BAD 100%);
  border-color: #FFD166;
  box-shadow: 0 0 16px rgba(255, 209, 102, 0.8);
  animation: pulsePlay 1.4s infinite ease-in-out;
}

.sleep-card-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.sleep-card-text {
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
  display: flex;
  flex-direction: column;
}

.sleep-card-text small {
  font-size: 0.66rem;
  color: #CAFFBF;
  font-weight: 600;
}

/* ==========================================================================
   BOTTOM ACTION DOCK (TOY BUTTONS FOR 2-4 YEAR OLDS)
   ========================================================================== */
.action-dock {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  padding: 9px 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  border-top: 4px solid rgba(255, 255, 255, 0.8);
}

.game-container.room-night .action-dock {
  background: rgba(18, 22, 58, 0.65);
  border-top-color: rgba(169, 222, 249, 0.35);
}

.dock-btn {
  border: 4px solid #FFFFFF;
  border-radius: 24px;
  padding: 9px 4px 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  font-family: var(--font-main);
  color: #FFFFFF;
  box-shadow: 0 7px 0 rgba(0, 0, 0, 0.18), 0 10px 15px rgba(0, 0, 0, 0.12);
  transition: transform 0.12s, box-shadow 0.12s;
}

.dock-btn:active {
  transform: translateY(5px) scale(0.93);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.18);
}

.dock-icon {
  font-size: 1.95rem;
  line-height: 1;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.15));
}

.dock-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.btn-feed   { background: linear-gradient(180deg, #FF758F 0%, #FF4D6D 100%); }
.btn-tickle { background: linear-gradient(180deg, #FFB703 0%, #FB8500 100%); }
.btn-bubbles{ background: linear-gradient(180deg, #4CC9F0 0%, #4361EE 100%); }
.btn-dance  { background: linear-gradient(180deg, #B5179E 0%, #7209B7 100%); }
.btn-toot   { background: linear-gradient(180deg, #80ED99 0%, #38B000 100%); }
.btn-sleep  { background: linear-gradient(180deg, #5E60CE 0%, #3A0CA3 100%); }

/* ==========================================================================
   PHONE CALL MODE OVERLAY ("TELÉFONO MÁGICO")
   ========================================================================== */
.phone-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 18, 45, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  animation: fadeInModal 0.25s ease;
}

@keyframes fadeInModal {
  from { opacity: 0; transform: scale(0.9); }
  to   { opacity: 1; transform: scale(1); }
}

.toy-phone-shell {
  width: 100%;
  max-width: 420px;
  height: min(92vh, 720px);
  background: linear-gradient(180deg, #FF9E00 0%, #FF6D00 100%);
  border: 7px solid #FFFFFF;
  border-radius: 46px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 0 #C95200, 0 24px 50px rgba(0, 0, 0, 0.45);
  position: relative;
}

.toy-phone-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 4px 0 10px;
}

.phone-speaker-slot {
  width: 76px;
  height: 12px;
  background: #8A3800;
  border-radius: 999px;
  border: 2px solid #FFB703;
}

.btn-phone-close {
  position: absolute;
  right: 4px;
  top: -2px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid #FFFFFF;
  background: #EF476F;
  color: #FFFFFF;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 0 #A82043;
}

.phone-view {
  flex: 1;
  background: #FFFDF7;
  border-radius: 32px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
  border: 4px solid #FFE082;
}

.phone-title {
  text-align: center;
  font-size: 1.35rem;
  color: #E01E5A;
  margin-bottom: 6px;
}

/* Contacts Grid (4 Animal Friends) */
.contacts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.contact-card {
  border: 4px solid #FFFFFF;
  border-radius: 24px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font-family: var(--font-main);
  color: #FFFFFF;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.16);
  transition: transform 0.12s;
}

.contact-card:active {
  transform: scale(0.93);
}

.contact-cat   { background: linear-gradient(180deg, #FFB703, #FB8500); }
.contact-dog   { background: linear-gradient(180deg, #4CC9F0, #4895EF); }
.contact-bunny { background: linear-gradient(180deg, #FF85A1, #F72585); }
.contact-cow   { background: linear-gradient(180deg, #80ED99, #38B000); }

.contact-avatar {
  font-size: 2.9rem;
  line-height: 1.05;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.15));
}

.contact-name {
  font-size: 1rem;
  font-weight: 700;
}

.contact-call-badge {
  background: rgba(255, 255, 255, 0.28);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}

/* Toy Musical Keypad (1-6) */
.toy-keypad-title {
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  color: #5C5470;
  margin: 6px 0 2px;
}

.toy-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.key-btn {
  border: 3px solid #FFFFFF;
  border-radius: 20px;
  padding: 8px 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.15);
  transition: transform 0.1s;
}

.key-btn:active {
  transform: translateY(4px) scale(0.92);
}

.key-num {
  font-size: 1.45rem;
  font-weight: 700;
  color: #FFFFFF;
}

.key-emoji {
  font-size: 1.65rem;
}

.key-1 { background: #FF595E; }
.key-2 { background: #8AC926; }
.key-3 { background: #FFCA3A; }
.key-4 { background: #1982C4; }
.key-5 { background: #FF924C; }
.key-6 { background: #9B5DE5; }

/* VIEW 2: Ringing Screen */
#phone-view-ringing {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, #FFF3B0 0%, #FFD166 100%);
  text-align: center;
  gap: 16px;
}

.ringing-avatar-wrap {
  position: relative;
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ringing-ripple {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 6px solid #FF5C8A;
  animation: rippleOut 1.2s infinite ease-out;
}

@keyframes rippleOut {
  0%   { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.45); opacity: 0; }
}

.ringing-avatar {
  width: 132px;
  height: 132px;
  background: #FFFFFF;
  border-radius: 50%;
  border: 6px solid #FF5C8A;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  animation: ringShake 0.45s infinite;
}

.ringing-name {
  font-size: 2rem;
  color: #2D3142;
}

.ringing-status {
  font-size: 1.3rem;
  color: #E01E5A;
  font-weight: 700;
}

.ringing-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}

.btn-call-action {
  border: 5px solid #FFFFFF;
  border-radius: 999px;
  font-family: var(--font-main);
  font-weight: 700;
  cursor: pointer;
  color: #FFFFFF;
}

.btn-answer {
  background: linear-gradient(180deg, #06D6A0 0%, #049A72 100%);
  padding: 16px 32px;
  font-size: 1.5rem;
  box-shadow: 0 8px 0 #036B4E;
  animation: pulsePlay 1s infinite ease-in-out;
}

.btn-hangup-small {
  width: 62px;
  height: 62px;
  background: #EF476F;
  font-size: 1.5rem;
  box-shadow: 0 6px 0 #A82043;
}

/* VIEW 3: Active Video Call Screen */
.video-call-stage {
  position: relative;
  flex: 1;
  background: linear-gradient(180deg, #A9DEF9 0%, #E4C1F9 100%);
  border-radius: 26px;
  border: 4px solid #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  overflow: hidden;
}

.call-status-pill {
  background: rgba(255, 255, 255, 0.92);
  border: 3px solid #06D6A0;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1B4332;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 5;
}

.baby-pip-window {
  position: absolute;
  top: 52px;
  right: 10px;
  width: 82px;
  height: 98px;
  background: #2D3142;
  border: 4px solid #FFFFFF;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
}

#baby-camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.baby-pip-fallback {
  font-size: 2.3rem;
}

.call-friend-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: auto 0;
  cursor: pointer;
}

.call-friend-avatar {
  font-size: 7.4rem;
  line-height: 1;
  filter: drop-shadow(0 10px 12px rgba(0, 0, 0, 0.2));
  transition: transform 0.15s;
  animation: friendCallIdle 2.2s ease-in-out infinite;
}

.call-friend-stage.talking .call-friend-avatar {
  animation: friendCallTalk 0.26s ease-in-out infinite alternate;
}

@keyframes friendCallIdle {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50%      { transform: translateY(-8px) rotate(3deg); }
}

@keyframes friendCallTalk {
  from { transform: scale(1, 1) translateY(0); }
  to   { transform: scale(1.08, 0.93) translateY(-10px); }
}

.call-peekaboo-hands {
  position: absolute;
  top: 12px;
  font-size: 5.5rem;
  animation: popBubble 0.2s ease;
}

.call-speech-bubble {
  background: #FFFFFF;
  border: 4px solid #FF5C8A;
  border-radius: 22px;
  padding: 8px 16px;
  font-size: 1.15rem;
  font-weight: 700;
  color: #2D3142;
  text-align: center;
  box-shadow: 0 5px 0 rgba(0, 0, 0, 0.1);
  z-index: 5;
  max-width: 95%;
}

.incall-reactions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 10px 0;
}

.call-react-btn {
  background: #FFF3B0;
  border: 3px solid #FFB703;
  border-radius: 20px;
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-family: var(--font-main);
  cursor: pointer;
  box-shadow: 0 5px 0 #E09F00;
  transition: transform 0.1s;
}

.call-react-btn:active {
  transform: translateY(4px) scale(0.92);
}

.call-react-btn span {
  font-size: 1.85rem;
  line-height: 1;
}

.call-react-btn small {
  font-size: 0.78rem;
  font-weight: 700;
  color: #5C5470;
}

.btn-hangup-giant {
  background: linear-gradient(180deg, #EF476F 0%, #D90429 100%);
  color: #FFFFFF;
  border: 4px solid #FFFFFF;
  border-radius: 999px;
  padding: 12px;
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 0 #9B001E;
}

.btn-hangup-giant:active {
  transform: translateY(4px);
}

/* ==========================================================================
   RESPONSIVE TWEAKS FOR SMALL PHONES OR LANDSCAPE
   ========================================================================== */
@media (max-width: 400px) {
  .action-dock {
    gap: 5px;
    padding: 8px 6px 10px;
  }
  .dock-icon {
    font-size: 1.65rem;
  }
  .dock-label {
    font-size: 0.7rem;
  }
  .room-window {
    width: 88px;
    height: 104px;
  }
  .btn-phone-cta .phone-cta-label {
    display: none;
  }
}

@media (max-height: 680px) {
  .character-wrapper {
    height: 50vh;
  }
  .call-friend-avatar {
    font-size: 5.4rem;
  }
}
