/* =============================================================
   Mind Battery — Theme CSS
   Modern Prompt font, cute animations, watercolor backgrounds,
   responsive for all devices
   ============================================================= */

:root {
  --mf-bg: #FFF5EC;
  --mf-text: #2A1B3D;
  --mf-text-secondary: rgba(60, 40, 80, 0.85);
  --mf-text-dim: rgba(90, 70, 110, 0.7);
  --mf-accent: #A855F7;
  --mf-accent-glow: rgba(168, 85, 247, 0.3);
  --mf-border: rgba(168, 85, 247, 0.2);
  --mf-btn-text: #fff;
  --mf-coral: #E85D75;
  --mf-purple: #A855F7;
  --mf-blue: #3B82F6;
  --mf-green: #34D399;
  --mf-yellow: #F59E0B;
  --mf-peach: #FFB893;
  --mf-font: 'Prompt', sans-serif;
}

/* --- Override base.css font to Prompt (rounded Thai font) --- */
body {
  font-family: var(--mf-font) !important;
  background: linear-gradient(160deg, #FFF5EC 0%, #FFE8D6 30%, #E8D5F5 65%, #D4EAFF 100%);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
}

/* --- Fix screen centering: prevent content cut-off --- */
.screen {
  align-items: flex-start !important;
  justify-content: flex-start !important;
  padding: 0 !important;
}

.screen > div {
  margin: auto;
  width: 100%;
  padding: 24px 20px;
  padding-top: max(24px, env(safe-area-inset-top));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* =====================================================
   Background watercolor decorations
   ===================================================== */
.bg-decor {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}

.bg-splash {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
}

.bg-splash-1 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(255,182,147,0.35), transparent 70%);
  top: -80px; left: -60px;
  animation: mf-drift 20s ease-in-out infinite;
}
.bg-splash-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(186,152,255,0.3), transparent 70%);
  top: -100px; right: -80px;
  animation: mf-drift 25s ease-in-out infinite reverse;
}
.bg-splash-3 {
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(134,216,189,0.3), transparent 70%);
  bottom: 10%; left: -40px;
  animation: mf-drift 22s ease-in-out 3s infinite;
}
.bg-splash-4 {
  width: 320px; height: 320px;
  background: radial-gradient(circle, rgba(255,214,130,0.25), transparent 70%);
  bottom: -80px; right: -60px;
  animation: mf-drift 18s ease-in-out 5s infinite reverse;
}
.bg-splash-5 {
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(255,170,200,0.2), transparent 70%);
  top: 40%; left: 50%;
  transform: translateX(-50%);
  animation: mf-drift 30s ease-in-out 2s infinite;
}

/* Floating background icons with watercolor splotch */
.bg-icon {
  position: absolute;
  font-size: 24px;
  opacity: 0.15;
  filter: blur(0.5px);
  animation: mf-float-icon 12s ease-in-out infinite;
}
.bg-icon::before {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 60px; height: 60px;
  border-radius: 50%;
  filter: blur(20px);
  z-index: -1;
}
.bg-icon-1 { top: 8%;  left: 12%;  animation-delay: 0s;   font-size: 22px; }
.bg-icon-1::before { background: rgba(255,200,100,0.4); }
.bg-icon-2 { top: 15%; right: 10%; animation-delay: 1.5s; font-size: 28px; }
.bg-icon-2::before { background: rgba(100,180,255,0.4); }
.bg-icon-3 { top: 35%; left: 5%;   animation-delay: 3s;   font-size: 20px; }
.bg-icon-3::before { background: rgba(200,130,255,0.4); }
.bg-icon-4 { top: 50%; right: 8%;  animation-delay: 4.5s; font-size: 26px; }
.bg-icon-4::before { background: rgba(255,150,100,0.4); }
.bg-icon-5 { top: 65%; left: 8%;   animation-delay: 2s;   font-size: 22px; }
.bg-icon-5::before { background: rgba(255,200,150,0.4); }
.bg-icon-6 { top: 75%; right: 12%; animation-delay: 5s;   font-size: 24px; }
.bg-icon-6::before { background: rgba(180,140,255,0.4); }
.bg-icon-7 { top: 88%; left: 15%;  animation-delay: 3.5s; font-size: 20px; }
.bg-icon-7::before { background: rgba(100,220,180,0.4); }
.bg-icon-8 { top: 92%; right: 15%; animation-delay: 1s;   font-size: 22px; }
.bg-icon-8::before { background: rgba(120,130,255,0.4); }

/* =====================================================
   Music toggle
   ===================================================== */
.music-toggle {
  position: fixed;
  top: 16px; right: 16px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(168,85,247,0.2);
  background: rgba(255,255,255,0.6);
  backdrop-filter: blur(10px);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  font-size: 20px;
  line-height: 1;
  padding: 0;
}
.music-toggle:hover {
  background: rgba(255,255,255,0.85);
  border-color: rgba(168,85,247,0.4);
  transform: scale(1.1);
}
.music-toggle.playing {
  border-color: var(--mf-purple);
  background: rgba(168,85,247,0.1);
}
.music-toggle.playing .music-icon {
  animation: mf-pulse 2s ease-in-out infinite;
}

/* =====================================================
   Animations
   ===================================================== */
@keyframes mf-drift {
  0%, 100% { transform: translate(0, 0); }
  25%      { transform: translate(20px, -15px); }
  50%      { transform: translate(-10px, 20px); }
  75%      { transform: translate(15px, 10px); }
}

@keyframes mf-float-icon {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25%      { transform: translateY(-12px) rotate(5deg); }
  50%      { transform: translateY(-5px) rotate(-3deg); }
  75%      { transform: translateY(-15px) rotate(3deg); }
}

@keyframes mf-wiggle {
  0%, 100% { transform: rotate(0deg) scale(1); }
  10%  { transform: rotate(3deg) scale(1.02); }
  20%  { transform: rotate(-3deg) scale(1.02); }
  30%  { transform: rotate(2deg) scale(1.01); }
  40%  { transform: rotate(-2deg) scale(1.01); }
  50%  { transform: rotate(0deg) scale(1); }
}

@keyframes mf-bounce-in {
  0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
  50%  { transform: scale(1.15) rotate(3deg); opacity: 1; }
  70%  { transform: scale(0.95) rotate(-2deg); }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes mf-hop {
  0%, 100% { transform: translateY(0); }
  40%      { transform: translateY(-8px); }
  60%      { transform: translateY(-4px); }
}

/* =====================================================
   SCREEN: Landing
   ===================================================== */
.landing-container {
  text-align: center;
  max-width: 480px;
}

.landing-battery {
  font-size: 80px;
  line-height: 1;
  margin-bottom: 12px;
  animation: mf-float 4s ease-in-out infinite;
}

.landing-title {
  font-family: var(--mf-font);
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--mf-coral), var(--mf-purple), var(--mf-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.landing-subtitle {
  font-size: 20px;
  font-weight: 500;
  color: var(--mf-text-secondary);
  margin-bottom: 16px;
}

.landing-desc {
  font-size: 17px;
  color: var(--mf-text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
}

/* --- Landing animals row: cute, wiggly --- */
.landing-animals {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  padding: 0 10px;
}

.landing-animal {
  width: 64px;
  height: 64px;
  object-fit: contain;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  border: 2px solid rgba(168,85,247,0.15);
  padding: 4px;
  cursor: default;
  transition: transform 0.3s ease;
  animation: mf-hop 3s ease-in-out infinite;
}

.landing-animal.a-1 { animation-delay: 0s; }
.landing-animal.a-2 { animation-delay: 0.35s; }
.landing-animal.a-3 { animation-delay: 0.7s; }
.landing-animal.a-4 { animation-delay: 1.05s; }
.landing-animal.a-5 { animation-delay: 1.4s; }
.landing-animal.a-6 { animation-delay: 1.75s; }
.landing-animal.a-7 { animation-delay: 2.1s; }
.landing-animal.a-8 { animation-delay: 2.45s; }

.landing-animal:hover {
  transform: scale(1.2) rotate(5deg);
}

.landing-features {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: 50px;
  font-size: 15px;
  font-weight: 600;
  color: var(--mf-text);
  backdrop-filter: blur(10px);
}

.landing-time {
  font-size: 13px;
  color: var(--mf-text-dim);
  margin-top: 16px;
}

.landing-science {
  margin-top: 20px;
  font-size: 13px;
  color: var(--mf-text-dim);
  line-height: 1.6;
}

.science-badge {
  display: inline-block;
  background: rgba(168, 85, 247, 0.1);
  color: var(--mf-purple);
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}

/* =====================================================
   SCREEN: Question
   ===================================================== */
.question-container {
  text-align: center;
  max-width: 480px;
}

/* Progress bar */
.progress-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.progress-track {
  flex: 1;
  height: 6px;
  background: rgba(168, 85, 247, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--mf-coral), var(--mf-purple));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--mf-text-dim);
  min-width: 32px;
}

/* Question text */
.question-number {
  font-size: 15px;
  font-weight: 600;
  color: var(--mf-purple);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.question-text {
  font-family: var(--mf-font);
  font-size: 28px;
  font-weight: 700;
  color: var(--mf-text);
  margin-bottom: 8px;
  line-height: 1.5;
}

.question-subtitle {
  font-size: 16px;
  color: var(--mf-text-dim);
  margin-bottom: 24px;
}

/* Choices */
.choices-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.65);
  border: 2px solid rgba(168, 85, 247, 0.1);
  border-radius: 16px;
  font-family: var(--mf-font);
  font-size: 18px;
  font-weight: 500;
  color: var(--mf-text);
  cursor: pointer;
  transition: all 0.25s ease;
  text-align: left;
  backdrop-filter: blur(10px);
  animation: mf-fadeUp 0.4s ease forwards;
  opacity: 0;
}

.choice-btn:hover {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(168, 85, 247, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.1);
}

.choice-btn:active {
  transform: translateY(0);
}

.choice-btn.selected {
  background: linear-gradient(135deg, rgba(232, 93, 117, 0.15), rgba(168, 85, 247, 0.15));
  border-color: var(--mf-purple);
  transform: scale(0.97);
}

.choice-btn.disabled {
  pointer-events: none;
  opacity: 0.5;
}

.choice-btn.disabled.selected {
  opacity: 1;
}

.choice-emoji {
  font-size: 28px;
  line-height: 1;
  flex-shrink: 0;
}

.choice-label {
  flex: 1;
}

/* =====================================================
   SCREEN: Analyzing
   ===================================================== */
.analyzing-container {
  text-align: center;
  max-width: 320px;
}

.analyzing-battery {
  position: relative;
  width: 140px;
  height: 200px;
  margin: 0 auto 24px;
}

.analyzing-body {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  border: 3px solid rgba(168, 85, 247, 0.25);
  border-radius: 24px;
  overflow: hidden;
  backdrop-filter: blur(10px);
}

.analyzing-cap {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  width: 46px;
  height: 18px;
  background: rgba(255, 255, 255, 0.5);
  border: 2.5px solid rgba(168, 85, 247, 0.25);
  border-radius: 8px 8px 0 0;
  border-bottom: none;
  z-index: 2;
}

.analyzing-fill {
  position: absolute;
  bottom: 6px;
  left: 6px;
  right: 6px;
  height: 0%;
  background: linear-gradient(to top, var(--mf-green), var(--mf-yellow), var(--mf-coral));
  border-radius: 18px;
  transition: height 0.3s ease;
}

.analyzing-bolt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  z-index: 3;
  animation: mf-pulse 1.5s ease-in-out infinite;
}

.analyzing-percent {
  font-family: var(--mf-font);
  font-size: 40px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--mf-coral), var(--mf-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.analyzing-text {
  font-size: 16px;
  color: var(--mf-text-secondary);
  animation: mf-pulse 2s ease-in-out infinite;
}

/* =====================================================
   SCREEN: Result
   ===================================================== */
.result-container {
  text-align: center;
  max-width: 500px;
}

.result-header {
  font-size: 17px;
  font-weight: 600;
  color: var(--mf-purple);
  letter-spacing: 1px;
  margin-bottom: 16px;
}

/* Battery display in result */
.result-battery-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
}

.battery-visual {
  width: 80px;
  height: 110px;
}

.battery-body {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.6);
  border: 2.5px solid rgba(168, 85, 247, 0.25);
  border-radius: 16px;
  overflow: hidden;
}

.battery-cap {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  width: 30px;
  height: 12px;
  background: rgba(255, 255, 255, 0.5);
  border: 2px solid rgba(168, 85, 247, 0.2);
  border-radius: 6px 6px 0 0;
  border-bottom: none;
  z-index: 2;
}

.battery-fill {
  position: absolute;
  bottom: 5px;
  left: 5px;
  right: 5px;
  height: 0%;
  background: linear-gradient(to top, var(--mf-green), var(--mf-yellow), var(--mf-coral));
  border-radius: 11px;
  transition: height 1s ease-out;
}

.battery-bolt {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  z-index: 3;
}

.battery-number {
  font-family: var(--mf-font);
  font-size: 64px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--mf-coral), var(--mf-purple), var(--mf-blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.battery-percent {
  font-size: 32px;
  font-weight: 700;
}

/* Archetype section — BIG image + cute animation */
.result-archetype {
  margin-bottom: 12px;
}

.archetype-image {
  width: 220px;
  height: 220px;
  object-fit: contain;
  display: block;
  margin: 0 auto 12px;
  border-radius: 24px;
  filter: drop-shadow(0 8px 24px rgba(168, 85, 247, 0.2));
  animation: mf-bounce-in 0.8s ease forwards, mf-wiggle 4s ease-in-out 0.8s infinite;
}

.archetype-name {
  font-family: var(--mf-font);
  font-size: 40px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--mf-coral), var(--mf-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.archetype-title {
  font-size: 20px;
  font-weight: 600;
  color: var(--mf-text);
}

.archetype-desc {
  font-size: 17px;
  color: var(--mf-text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
  padding: 0 10px;
}

/* Dimension bars */
.result-dimensions {
  text-align: left;
  margin-bottom: 20px;
}

.dim-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.dim-label {
  font-size: 16px;
  font-weight: 600;
  color: var(--mf-text);
  min-width: 95px;
}

.dim-bar-track {
  flex: 1;
  height: 12px;
  background: rgba(168, 85, 247, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.dim-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 1s ease-out;
}

.dim-value {
  font-family: var(--mf-font);
  font-size: 16px;
  font-weight: 700;
  color: var(--mf-text);
  min-width: 40px;
  text-align: right;
}

/* Tip box */
.result-tip {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(168, 85, 247, 0.12);
  border-radius: 16px;
  text-align: left;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

.tip-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.tip-text {
  font-size: 16px;
  color: var(--mf-text);
  line-height: 1.7;
}

/* Card preview */
.card-preview {
  display: none;
  margin-bottom: 16px;
}

.card-preview img {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
}

/* =====================================================
   Buttons (theme overrides)
   ===================================================== */
.btn-primary {
  font-family: var(--mf-font);
  background: linear-gradient(135deg, var(--mf-coral), var(--mf-purple));
}

.btn-primary:hover {
  box-shadow: 0 8px 24px rgba(168, 85, 247, 0.25);
}

.btn-secondary {
  font-family: var(--mf-font);
}

/* =====================================================
   Cross-promo
   ===================================================== */
.cross-promo {
  margin-top: 16px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 16px;
  border: 1px solid rgba(168, 85, 247, 0.1);
}

.cross-promo-text {
  font-size: 13px;
  color: var(--mf-text-dim);
  margin-bottom: 8px;
}

.cross-promo-link {
  display: inline-block;
  font-size: 14px;
  font-weight: 600;
  color: var(--mf-purple);
  text-decoration: none;
  transition: color 0.3s ease;
}

.cross-promo-link:hover {
  color: var(--mf-coral);
}

/* =====================================================
   Responsive — Mobile first
   ===================================================== */

/* Small phones (< 360px) */
@media (max-width: 360px) {
  .landing-title { font-size: 36px; }
  .landing-battery { font-size: 60px; }
  .landing-animal { width: 48px; height: 48px; }
  .landing-animals { gap: 6px; }
  .landing-features { gap: 6px; }
  .feature-pill { padding: 6px 10px; font-size: 12px; }
  .question-text { font-size: 20px; }
  .choice-btn { padding: 12px 14px; font-size: 15px; }
  .choice-emoji { font-size: 24px; }
  .archetype-image { width: 160px; height: 160px; }
  .archetype-name { font-size: 28px; }
  .battery-number { font-size: 48px; }
}

/* Standard phones (360-480px) */
@media (min-width: 361px) and (max-width: 480px) {
  .landing-title { font-size: 42px; }
  .landing-battery { font-size: 70px; }
  .landing-animal { width: 56px; height: 56px; }
  .archetype-image { width: 180px; height: 180px; }
  .battery-number { font-size: 56px; }
}

/* Tablets (481-768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .landing-animal { width: 72px; height: 72px; }
  .landing-animals { gap: 12px; }
  .choice-btn { padding: 18px 24px; font-size: 18px; }
  .archetype-image { width: 240px; height: 240px; }
}

/* Large tablets & desktop (769px+) */
@media (min-width: 769px) {
  .landing-container,
  .question-container,
  .result-container {
    max-width: 560px;
  }
  .landing-title { font-size: 56px; }
  .landing-battery { font-size: 100px; }
  .landing-animal { width: 80px; height: 80px; }
  .landing-animals { gap: 16px; }
  .archetype-image { width: 260px; height: 260px; }
  .battery-number { font-size: 72px; }
  .choice-btn { padding: 20px 28px; font-size: 19px; }
}

/* Landscape phones */
@media (max-height: 500px) and (orientation: landscape) {
  .landing-battery { font-size: 48px; margin-bottom: 8px; }
  .landing-title { font-size: 32px; }
  .landing-desc { display: none; }
  .landing-animals { margin-bottom: 12px; }
  .landing-animal { width: 40px; height: 40px; }
  .landing-science { display: none; }
  .analyzing-battery { width: 100px; height: 140px; }
  .analyzing-percent { font-size: 32px; }
  .archetype-image { width: 120px; height: 120px; }
}
