/* ==========================================================================
   ĐẠI BÀNG BÌNH TĨNH (CALM EAGLE) - SEL EDUCATIONAL GAME STYLESHEET
   Dành cho web độc lập hoặc nhúng vào WordPress: hungtuoi.com/calmeagle
   ========================================================================== */

:root {
  --primary-color: #0ea5e9;
  --primary-hover: #0284c7;
  --accent-gold: #f59e0b;
  --accent-gold-light: #fef08a;
  --calm-green: #10b981;
  --calm-teal: #14b8a6;
  --alert-red: #ef4444;
  --font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: var(--font-family);
  background-color: #0b1329;
  color: #1e293b;
  position: relative;
}

/* Canvas Styling */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Animations */
@keyframes floatGentle {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(1deg); }
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.4), 0 0 30px rgba(245, 158, 11, 0.15);
  }
  50% {
    box-shadow: 0 0 28px rgba(245, 158, 11, 0.75), 0 0 50px rgba(245, 158, 11, 0.35);
  }
}

@keyframes heartBeat {
  0% { transform: scale(1); }
  25% { transform: scale(1.22); }
  40% { transform: scale(0.96); }
  60% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

@keyframes slideDownFade {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes toastPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -10px) scale(0.85);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1.05);
  }
  30% {
    transform: translate(-50%, 0) scale(1);
  }
  90% {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -15px) scale(0.9);
  }
}

.animate-float {
  animation: floatGentle 3.2s ease-in-out infinite;
}

.animate-glow {
  animation: pulseGlow 2.4s ease-in-out infinite;
}

.heart-active {
  display: inline-block;
  animation: heartBeat 1.8s ease-in-out infinite;
}

/* Overlay & Modals Backdrop */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  transition: opacity 0.3s ease;
}

.modal-backdrop.hidden {
  display: none !important;
}

/* Modal Card */
.modal-card {
  width: 100%;
  max-width: 600px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 28px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.6);
  padding: 14px 24px 16px;
  text-align: center;
  position: relative;
  margin: auto;
  max-height: 94vh;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .modal-card {
    padding: 18px 18px;
    border-radius: 22px;
  }
}

/* Compact Layout for Laptop / Desktop screens with height <= 800px */
@media (min-width: 641px) and (max-height: 800px) {
  #startScreen .modal-card {
    padding: 12px 22px 14px;
    border-radius: 22px;
    max-height: 96vh;
  }

  /* Mascot Icon Circle: ~64px x 64px */
  #startScreen .animate-float {
    width: 64px !important;
    height: 64px !important;
    margin-top: 2px !important;
    margin-bottom: 2px !important;
  }

  #startScreen #mascotIcon {
    font-size: 32px !important;
  }

  #startScreen .animate-float > div.absolute {
    font-size: 8px !important;
    padding: 1px 5px !important;
    bottom: -2px !important;
    right: -2px !important;
  }

  /* Headings & Subtitles */
  #startScreen h1 {
    font-size: 1.25rem !important;
    margin-top: 2px !important;
    line-height: 1.15 !important;
  }

  #startScreen h1 + p {
    font-size: 11px !important;
    margin-top: 1px !important;
    line-height: 1.2 !important;
  }

  /* Spacing between sections */
  #startScreen .mt-4 {
    margin-top: 7px !important;
  }

  #startScreen .mt-3\.5 {
    margin-top: 6px !important;
    padding: 5px 10px !important;
    border-radius: 12px !important;
  }

  #startScreen label {
    margin-bottom: 3px !important;
    font-size: 11px !important;
  }

  #startScreen label span.w-5 {
    width: 17px !important;
    height: 17px !important;
    font-size: 10px !important;
  }

  /* Theme Cards */
  #startScreen .theme-card {
    padding: 7px 10px !important;
    border-radius: 14px !important;
  }

  #startScreen .theme-card .theme-title {
    font-size: 12px !important;
  }

  #startScreen .theme-card .line-clamp-2 {
    font-size: 9.5px !important;
    line-height: 1.2 !important;
  }

  #startScreen .theme-card .mt-2 {
    margin-top: 3px !important;
    gap: 3px !important;
  }

  #startScreen .theme-card .mt-2 span {
    font-size: 8.5px !important;
    padding: 1px 4px !important;
  }

  /* Mode Cards */
  #startScreen .mode-card {
    padding: 7px 6px !important;
    border-radius: 14px !important;
  }

  #startScreen .mode-card span.text-2xl {
    font-size: 1.2rem !important;
    margin-bottom: 1px !important;
  }

  #startScreen .mode-card .font-extrabold {
    font-size: 11px !important;
  }

  #startScreen .mode-card .text-\[11px\] {
    font-size: 9.5px !important;
    line-height: 1.2 !important;
    margin-top: 1px !important;
  }

  /* Quick Instruction */
  #startScreen .mt-3\.5 span {
    font-size: 10.5px !important;
  }

  #startScreen .mt-3\.5 span.text-lg {
    font-size: 14px !important;
  }

  /* Start Game Button */
  #startScreen #startGameBtn {
    padding-top: 9px !important;
    padding-bottom: 9px !important;
    font-size: 14.5px !important;
    border-radius: 14px !important;
  }
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.04);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb {
  background: rgba(245, 158, 11, 0.5);
  border-radius: 99px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(245, 158, 11, 0.8);
}

/* Theme Selector Cards */
.theme-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 13px 14px;
  border-radius: 20px;
  border: 2px solid transparent;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}

.theme-title {
  font-weight: 800;
  font-size: 13.5px;
  line-height: 1.25;
  white-space: nowrap;
  letter-spacing: -0.01em;
  overflow: visible;
}

@media (min-width: 641px) and (max-width: 768px) {
  .theme-title {
    font-size: 12.5px;
  }
}

@media (max-width: 640px) {
  .theme-card {
    padding: 14px 16px;
  }
  .theme-title {
    font-size: 14.5px;
    white-space: nowrap;
  }
}

.theme-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
}

.theme-card.active {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25), 0 8px 20px rgba(14, 165, 233, 0.15);
}

.theme-card[data-theme="anger"].active {
  border-color: #0284c7;
  background: #f0f9ff;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25), 0 8px 20px rgba(14, 165, 233, 0.15);
}

.theme-card[data-theme="study"].active {
  border-color: #059669;
  background: #ecfdf5;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 8px 20px rgba(16, 185, 129, 0.15);
}

.theme-card[data-theme="relationship"].active {
  border-color: #db2777;
  background: #fdf2f8;
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.25), 0 8px 20px rgba(236, 72, 153, 0.15);
}

/* Level Mode Cards */
.mode-card {
  padding: 12px 10px;
  border-radius: 18px;
  border: 2px solid #e2e8f0;
  background: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .mode-card {
    padding: 12px 14px;
  }
}

.mode-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.06);
}

.mode-card.active {
  border-color: #f59e0b;
  background: #fffbeb;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.25);
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 18px;
  font-weight: 800;
  font-size: 15px;
  color: #ffffff;
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  border: none;
  cursor: pointer;
  box-shadow: 0 10px 22px -4px rgba(234, 88, 12, 0.45);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 14px 28px -4px rgba(234, 88, 12, 0.55);
}

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

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 18px;
  font-weight: 700;
  font-size: 14px;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

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

/* Round Sound Button */
.sound-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  color: #334155;
}

.sound-btn:hover {
  background: #ffffff;
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.sound-btn:active {
  transform: scale(0.94);
}

/* HUD Overlay */
#hudOverlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

#hudOverlay > * {
  pointer-events: auto;
}

/* Floating Feedback Toast */
#floatingFeedback {
  position: fixed;
  top: 26%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  pointer-events: none;
  animation: toastPop 1.3s ease forwards;
}

/* Mindful Pause Breathing Circle */
.breathing-wrapper {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 20px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.breathing-guide-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 4px dashed rgba(20, 184, 166, 0.35);
  animation: rotateGuide 30s linear infinite;
}

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

#breathPhaseText {
  line-height: 1.25;
  text-align: center;
  font-size: 12px;
}

#breathCircle {
  width: 105px;
  height: 105px;
  border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(13, 148, 136, 0.4);
  transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1), background 1s ease, box-shadow 1s ease;
}

@media (max-width: 480px) {
  #hudOverlay {
    padding: 8px 10px;
  }
  .sound-btn {
    width: 38px;
    height: 38px;
    font-size: 17px;
  }
}
#gameOverOverlay .grid.grid-cols-3 > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#bestScoreModeLabel {
  line-height: 1.15;
}