/* Brush Your Teeth — Styles */

:root {
  --bg-top: #e0f7fa;
  --bg-bottom: #b2ebf2;
  --stage-border: #00acc1;
  --mouth-bg: #880e4f;
  --mouth-interior: #ad1457;
  --tooth-white: #ffffff;
  --tooth-border: #e0e0e0;
  --foam-color: rgba(255, 255, 255, 0.92);
}

body {
  background: radial-gradient(circle at 50% 20%, #ffffff 0%, var(--bg-top) 50%, var(--bg-bottom) 100%);
  margin: 0;
  padding: 0;
  color: #006064;
  font-family: inherit;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overflow-x: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 16px 16px;
  box-sizing: border-box;
}

.status-bar {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 4px;
}

.score-badge {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 800;
  color: #00838f;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.instruction-banner {
  margin: 4px 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: center;
  color: #006064;
}

/* Bathroom Stage */
.bathroom-stage {
  position: relative;
  width: 100%;
  height: 290px;
  max-width: 640px;
  background: linear-gradient(180deg, #e0f7fa 0%, #b2ebf2 70%, #80deea 100%);
  border: 6px solid var(--stage-border);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 172, 193, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.bathroom-decor {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 40px;
  pointer-events: none;
}

.bath-bubble {
  position: absolute;
  font-size: 1.5rem;
  opacity: 0.75;
}

.b1 { left: 12%; top: 4px; animation: floatBubble 6s infinite ease-in-out; }
.b2 { right: 18%; top: 10px; animation: floatBubble 7.5s infinite ease-in-out 1s; }
.b3 { left: 82%; top: 6px; animation: floatBubble 6.8s infinite ease-in-out 2s; }

.patient-title {
  position: absolute;
  top: 12px;
  background: #00838f;
  color: #ffffff;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 1.1rem;
  font-weight: 800;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  z-index: 5;
}

/* Patient Card */
.patient-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 24px;
}

.patient-avatar {
  font-size: 3.5rem;
  line-height: 1;
  margin-bottom: -16px;
  z-index: 2;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15));
  transition: transform 0.3s;
}

.patient-card.is-happy .patient-avatar {
  animation: happyBounce 0.8s infinite alternate ease-in-out;
}

/* Mouth Box */
.mouth-box {
  position: relative;
  width: 280px;
  height: 140px;
  background: radial-gradient(circle at 50% 50%, var(--mouth-interior) 0%, var(--mouth-bg) 100%);
  border: 5px solid #d81b60;
  border-radius: 50px 50px 60px 60px;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 16px;
  box-sizing: border-box;
  overflow: hidden;
  z-index: 1;
  touch-action: none;
  cursor: pointer;
}

.teeth-row {
  display: flex;
  justify-content: space-around;
  width: 100%;
}

.teeth-top {
  align-items: flex-start;
}

.teeth-bottom {
  align-items: flex-end;
}

.tooth {
  position: relative;
  width: 38px;
  height: 38px;
  background: #ffffff;
  border: 2px solid var(--tooth-border);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s, background-color 0.25s, border-color 0.25s;
  touch-action: none;
  outline: none;
}

.tooth:focus-visible {
  outline: 3px solid #00acc1;
  outline-offset: 2px;
}

.teeth-top .tooth {
  border-radius: 4px 4px 14px 14px;
}

.teeth-bottom .tooth {
  border-radius: 14px 14px 4px 4px;
}

.tooth:hover {
  transform: scale(1.08);
}

.tooth:active {
  transform: scale(0.96);
}

.tooth .germ {
  font-size: 1.35rem;
  line-height: 1;
  pointer-events: none;
  transition: transform 0.25s, opacity 0.25s;
}

.tooth.foamed {
  background: var(--foam-color);
  border-color: #80deea;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.tooth.sparkling {
  background: #ffffff;
  box-shadow: 0 0 16px #ffeb3b, 0 0 8px #ffffff;
  animation: shineGleam 1.2s infinite alternate ease-in-out;
}

.tooth.reminder {
  animation: toothReminder 0.5s ease-in-out 2;
}

.tongue-area {
  font-size: 2.2rem;
  line-height: 1;
  text-align: center;
  opacity: 0.9;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
  pointer-events: none;
}

/* Water Splash Overlay */
.water-splash {
  position: absolute;
  inset: 0;
  background: rgba(0, 229, 255, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.water-splash.active {
  animation: splashSweep 0.8s ease-out;
}

/* Clean Progress Meter */
.clean-meter {
  position: absolute;
  bottom: 8px;
  width: 220px;
  height: 12px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid #00acc1;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

.meter-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00e676 0%, #1de9b6 100%);
  border-radius: 8px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Tools Palette */
.tools-palette {
  display: flex;
  justify-content: center;
  gap: 16px;
  width: 100%;
  max-width: 580px;
  margin: 6px 0 10px;
}

.tool-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 3px solid #b2ebf2;
  border-radius: 24px;
  padding: 10px 22px;
  min-height: 58px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.1rem;
  color: #006064;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
  outline: none;
}

.tool-btn:hover:not(:disabled) {
  transform: translateY(-3px) scale(1.04);
  border-color: #00acc1;
  box-shadow: 0 6px 16px rgba(0, 172, 193, 0.25);
}

.tool-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.tool-btn:disabled {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.tool-btn.active-tool {
  background: linear-gradient(135deg, #e0f7fa 0%, #ffffff 100%);
  border-color: #00acc1;
  box-shadow: 0 0 18px rgba(0, 172, 193, 0.4), 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: scale(1.05);
}

.tool-btn.pulse-prompt {
  animation: toolPulse 1.2s infinite ease-in-out;
  border-color: #ff9800;
}

.tool-btn.wobble {
  animation: wobble 0.45s ease-in-out;
}

.tool-icon {
  font-size: 1.8rem;
  line-height: 1;
}

/* Action Controls */
.action-bar {
  display: flex;
  justify-content: center;
  min-height: 54px;
  width: 100%;
}

.action-btn {
  border: 3px solid #fff;
  border-radius: 40px;
  color: #fff;
  font-family: inherit;
  font-weight: 800;
  font-size: 1.25rem;
  padding: 12px 36px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.next-btn {
  background: linear-gradient(135deg, #00e676 0%, #00c853 100%);
  box-shadow: 0 6px 18px rgba(0, 230, 118, 0.4), 0 3px 0 #009624;
}

.again-btn {
  background: linear-gradient(135deg, #29b6f6 0%, #0288d1 100%);
  box-shadow: 0 6px 18px rgba(41, 182, 246, 0.4), 0 3px 0 #01579b;
}

.action-btn:hover {
  transform: translateY(-2px) scale(1.05);
}

.action-btn:active {
  transform: translateY(2px) scale(0.97);
}

/* Sparkles Overlay */
.sparkle-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  overflow: hidden;
}

.sparkle-particle {
  position: absolute;
  font-size: 1.8rem;
  animation: sparkleRise 1.2s forwards ease-out;
}

/* Keyframe Animations */
@keyframes floatBubble {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}

@keyframes happyBounce {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(-12px) scale(1.08); }
}

@keyframes shineGleam {
  0% { filter: drop-shadow(0 0 2px #fff); }
  100% { filter: drop-shadow(0 0 10px #ffeb3b); }
}

@keyframes splashSweep {
  0% { opacity: 0; transform: scaleY(0.5); }
  40% { opacity: 1; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(1.2); }
}

@keyframes toolPulse {
  0%, 100% { transform: scale(1.02); box-shadow: 0 0 8px rgba(255, 152, 0, 0.4); }
  50% { transform: scale(1.08); box-shadow: 0 0 22px rgba(255, 152, 0, 0.8); }
}

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

@keyframes sparkleRise {
  0% { transform: translateY(0) scale(0.5); opacity: 1; }
  100% { transform: translateY(-60px) scale(1.2); opacity: 0; }
}

@keyframes wobble {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px) rotate(-3deg); }
  40%, 80% { transform: translateX(6px) rotate(3deg); }
}

@keyframes toothReminder {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); }
  50% { transform: scale(1.2); box-shadow: 0 0 14px #ff9800; border-color: #ff9800; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .bath-bubble, .patient-avatar, .water-splash, .tool-btn, .action-btn, .sparkle-particle, .tooth.reminder {
    animation: none !important;
    transition: none !important;
  }
}

/* Mobile responsive */
@media (max-width: 540px) {
  .bathroom-stage {
    height: 250px;
  }
  .mouth-box {
    width: 240px;
    height: 120px;
    padding: 6px 12px;
  }
  .tooth {
    width: 32px;
    height: 32px;
  }
  .tooth .germ {
    font-size: 1.15rem;
  }
  .tool-btn {
    padding: 8px 14px;
    font-size: 0.95rem;
  }
  .tool-icon {
    font-size: 1.5rem;
  }
}

/* Compact height / Landscape screen */
@media (max-height: 600px) {
  .game-container {
    padding: 4px 12px 8px;
    justify-content: flex-start;
  }
  .status-bar {
    margin-bottom: 2px;
  }
  .score-badge {
    padding: 4px 10px;
    font-size: 0.95rem;
  }
  .instruction-banner {
    margin: 2px 0 4px;
    font-size: 0.98rem;
  }
  .bathroom-stage {
    height: 195px;
    margin-bottom: 6px;
    border-radius: 20px;
    border-width: 4px;
  }
  .patient-title {
    top: 6px;
    padding: 3px 14px;
    font-size: 0.9rem;
  }
  .patient-card {
    margin-top: 14px;
  }
  .patient-avatar {
    font-size: 2.6rem;
    margin-bottom: -12px;
  }
  .mouth-box {
    width: 230px;
    height: 105px;
    padding: 4px 10px;
    border-width: 4px;
    border-radius: 36px 36px 44px 44px;
  }
  .tooth {
    width: 28px;
    height: 28px;
  }
  .tooth .germ {
    font-size: 1rem;
  }
  .tongue-area {
    font-size: 1.6rem;
  }
  .clean-meter {
    height: 8px;
    bottom: 4px;
    width: 170px;
  }
  .tools-palette {
    margin: 4px 0 6px;
    gap: 10px;
  }
  .tool-btn {
    min-height: 44px;
    padding: 6px 14px;
    font-size: 0.95rem;
    border-radius: 18px;
  }
  .tool-icon {
    font-size: 1.35rem;
  }
  .action-bar {
    min-height: 42px;
  }
  .action-btn {
    padding: 8px 24px;
    font-size: 1.05rem;
  }
}
