/* --- Reset & Global Variables --- */
:root {
  --bg-dark: #070814;
  --panel-bg: rgba(255, 255, 255, 0.06);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text-light: #f3f4f6;
  --text-muted: #9ca3af;
  --color-primary: #8b5cf6; /* Magic Purple */
  --color-secondary: #ec4899; /* Pink magic */
  --color-accent: #f59e0b; /* Gold */
  --color-success: #10b981; /* Green */
  --color-glow: rgba(139, 92, 246, 0.5);
  
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

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

body {
  font-family: 'Outfit', 'M PLUS Rounded 1c', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-light);
  min-height: 100vh;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* --- Magical Background --- */
.magic-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background: radial-gradient(circle at 50% 20%, #1a103c 0%, #070814 80%);
  overflow: hidden;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.25;
  mix-blend-mode: screen;
  animation: orbFloat 20s infinite alternate ease-in-out;
}

.glow-orb-1 {
  width: 300px;
  height: 300px;
  background: var(--color-primary);
  top: 10%;
  left: -50px;
}

.glow-orb-2 {
  width: 400px;
  height: 400px;
  background: var(--color-secondary);
  bottom: 10%;
  right: -100px;
  animation-delay: -5s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, 40px) scale(1.1); }
  100% { transform: translate(-20px, -20px) scale(0.9); }
}

/* --- App Container (iPhone Centered) --- */
.app-container {
  width: 100%;
  max-width: 430px; /* iPhone 14/15 Pro Max Width */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(7, 8, 20, 0.6);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(255, 255, 255, 0.05);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: calc(75px + var(--safe-bottom));
  position: relative;
}

/* --- Glassmorphism Helper --- */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Header --- */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(16px + var(--safe-top)) 20px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(7, 8, 20, 0.4);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  font-size: 1.25rem;
  background: linear-gradient(135deg, var(--color-secondary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 8px var(--color-secondary));
  animation: logoSparkle 3s infinite alternate;
}

@keyframes logoSparkle {
  0% { transform: scale(1) rotate(0deg); filter: drop-shadow(0 0 5px var(--color-secondary)); }
  100% { transform: scale(1.1) rotate(15deg); filter: drop-shadow(0 0 12px var(--color-accent)); }
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.3rem;
  letter-spacing: 0.5px;
  background: linear-gradient(to right, #ffffff, #d8b4fe);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.stat-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: background 0.2s;
}

.stat-badge:active {
  background: rgba(255, 255, 255, 0.15);
}

.icon-gem {
  color: var(--color-accent);
  filter: drop-shadow(0 0 4px rgba(245, 158, 11, 0.6));
}

.unit-text {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Main Layout --- */
.app-main {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.screen {
  display: none;
  animation: fadeIn 0.4s ease-out;
  flex-direction: column;
  gap: 20px;
}

.screen.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- SCREEN: HOME --- */
/* Welcome Card */
.welcome-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-left: 4px solid var(--color-primary);
}

.luna-avatar-container {
  position: relative;
  width: 60px;
  height: 60px;
  flex-shrink: 0;
}

.luna-avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.luna-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  box-shadow: 0 0 15px var(--color-primary);
  animation: pulseGlow 2.5s infinite ease-in-out;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.15); opacity: 0.9; }
}

.welcome-content {
  flex: 1;
}

.welcome-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-secondary);
}

.luna-dialogue {
  font-size: 0.85rem;
  color: var(--text-light);
  line-height: 1.4;
  margin-top: 2px;
}

/* Progress Card */
.progress-card {
  padding: 18px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 600;
}

.progress-label {
  color: var(--text-light);
}

.progress-percent {
  color: var(--color-accent);
}

.progress-bar-container {
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary));
  box-shadow: 0 0 8px var(--color-primary);
  border-radius: 6px;
  transition: width 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.progress-details {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 10px;
  color: var(--text-light);
}

/* Unit Cards */
.unit-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.unit-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}

.unit-card:hover, .unit-card:active {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
}

.unit-card.locked {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.02);
}

.unit-card.locked:hover, .unit-card.locked:active {
  transform: none;
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--panel-border);
}

.unit-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.unit-num {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--color-secondary);
  letter-spacing: 1px;
}

.unit-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-light);
}

.unit-grammar {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.unit-action-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: center;
  align-items: center;
  color: var(--text-light);
}

.unit-card.locked .unit-action-icon {
  color: var(--text-muted);
}

.unit-card.completed {
  border-left: 4px solid var(--color-success);
}

.unit-card.completed .unit-action-icon {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success);
}

/* --- SCREEN: STUDY --- */
/* Steps indicator */
.steps-indicator {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 10px;
  margin-bottom: 10px;
}

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  position: relative;
  transition: all 0.3s ease;
}

.step-dot.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
  box-shadow: 0 0 10px var(--color-primary);
}

.step-dot.completed {
  background: var(--color-success);
  border-color: var(--color-success);
  color: #fff;
}

.step-line {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  margin: 0 4px;
}

.step-dot.completed + .step-line,
.step-dot.active + .step-line {
  background: linear-gradient(90deg, var(--color-primary), rgba(255, 255, 255, 0.1));
}

.step-dot.completed + .step-line {
  background: var(--color-success);
}

/* Content cards wrapper */
.study-card-wrapper {
  position: relative;
  min-height: 380px;
}

.step-content {
  display: none;
  padding: 22px;
  flex-direction: column;
  gap: 16px;
  min-height: 380px;
}

.step-content.active {
  display: flex;
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.step-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.step-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Step 1: Visual */
.story-image-container {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.story-scene-img {
  width: 100%;
  aspect-ratio: 1/1;
  object-fit: cover;
  display: block;
}

.magic-hint-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  padding: 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  color: #c084fc;
}

.hint-icon {
  font-size: 1rem;
  color: var(--color-accent);
}

/* Step 2-4: Interactive reading boxes */
.interactive-text-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  padding: 20px;
  font-size: 1.25rem;
  line-height: 1.8;
  font-family: 'Outfit', sans-serif;
  min-height: 160px;
  letter-spacing: 0.5px;
  position: relative;
}

/* Text elements */
.interactive-text-box span.word {
  display: inline-block;
  cursor: pointer;
  padding: 0 2px;
  margin: 2px 1px;
  border-bottom: 2px dotted rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  transition: all 0.2s;
}

.interactive-text-box span.word:hover {
  background: rgba(139, 92, 246, 0.2);
  color: #fff;
  border-bottom-color: var(--color-primary);
}

.interactive-text-box span.word.clicked {
  background: var(--color-primary);
  color: #fff;
  border-bottom-color: transparent;
  box-shadow: 0 0 8px var(--color-primary);
}

.interactive-text-box span.punctuation {
  display: inline-block;
  margin-right: 6px;
}

/* Highlight mode (Listening) */
.interactive-text-box.highlight-mode span.word {
  cursor: default;
  border-bottom: none;
}

.interactive-text-box.highlight-mode span.word.highlight {
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  color: #fff;
  border-radius: 4px;
  box-shadow: 0 0 12px var(--color-primary);
  transform: scale(1.05);
}

/* Readonly Mode */
.interactive-text-box.readonly-mode span.word {
  cursor: default;
  border-bottom: none;
}

/* Word Popup Card */
.word-popup-card {
  position: absolute;
  background: rgba(26, 20, 50, 0.95);
  border: 1px solid var(--color-primary);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: 0 4px 15px rgba(139, 92, 246, 0.4);
  display: none;
  z-index: 100;
  pointer-events: none;
  animation: popUp 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popUp {
  from { opacity: 0; transform: scale(0.8) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.word-popup-word {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-secondary);
}

.word-popup-meaning {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-top: 2px;
}

.word-popup-arrow {
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--color-primary);
}

/* Audio panel style */
.audio-controls-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
}

.audio-btn {
  background: linear-gradient(135deg, var(--color-primary), #6d28d9);
  border: none;
  padding: 12px;
  border-radius: 12px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
  transition: all 0.2s;
}

.audio-btn:active {
  transform: scale(0.98);
  box-shadow: 0 2px 4px rgba(139, 92, 246, 0.2);
}

.audio-btn.secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.audio-btn.secondary:active {
  background: rgba(255, 255, 255, 0.15);
}

.speed-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.speed-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.speed-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* Translation toggle */
.translation-toggle-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-toggle-translation {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  padding: 10px;
  border-radius: 12px;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}

.translation-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #d1d5db;
  animation: fadeIn 0.3s ease-out;
}

.hidden {
  display: none !important;
}

/* Step 5: Speak mode */
.interactive-text-box.speak-mode span.word {
  border-bottom: none;
}

.interactive-text-box.speak-mode span.word.recognized {
  color: var(--color-success);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(16, 185, 129, 0.6);
  animation: textSuccessSparkle 0.4s ease;
}

@keyframes textSuccessSparkle {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

.speech-controls-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.speech-mic-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-secondary), #db2777);
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

.speech-mic-btn.recording {
  background: linear-gradient(135deg, var(--color-success), #059669);
  box-shadow: 0 0 20px var(--color-success);
}

.pulse-ring {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--color-secondary);
  opacity: 0;
  pointer-events: none;
}

.speech-mic-btn.recording .pulse-ring {
  border-color: var(--color-success);
  animation: ripple 1.5s infinite linear;
}

@keyframes ripple {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

.speech-status-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.speech-fallback-panel {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

.btn-fallback-success {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-fallback-success:active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-light);
}

/* Step 6: Result */
.magic-bottle-container {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px 0;
}

.magic-bottle {
  width: 80px;
  height: 120px;
  border: 4px solid var(--text-light);
  border-radius: 20px 20px 30px 30px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.1), inset 0 0 15px rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.02);
}

.magic-bottle::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 20px;
  width: 32px;
  height: 12px;
  border: 4px solid var(--text-light);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.magic-bottle .liquid {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, var(--color-primary), var(--color-secondary));
  transition: height 1.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 15px var(--color-secondary);
}

.bottle-sparkle {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.5rem;
  color: var(--color-accent);
  text-shadow: 0 0 10px var(--color-accent);
  opacity: 0;
  animation: resultGlow 2s infinite ease-in-out;
}

@keyframes resultGlow {
  0%, 100% { opacity: 0.3; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -55%) scale(1.2); }
}

.result-title {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--color-accent);
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

.result-desc {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.result-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 10px;
}

.result-stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.result-stat-val {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
}

.result-stat-lbl {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-back-home {
  background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
  border: none;
  padding: 14px;
  border-radius: 16px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
  transition: transform 0.2s;
}

.btn-back-home:active {
  transform: scale(0.98);
}

/* Study Nav Area */
.study-navigation {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.nav-btn {
  flex: 1;
  padding: 14px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  transition: all 0.2s;
}

.btn-prev {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
}

.btn-prev:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-next {
  background: var(--color-primary);
  border: none;
  color: #fff;
  box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-next:active:not(:disabled) {
  transform: scale(0.97);
}

/* --- BOTTOM NAVIGATION BAR --- */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 430px;
  background: rgba(7, 8, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 12px calc(8px + var(--safe-bottom));
  z-index: 99;
}

.bottom-nav {
  display: flex;
  justify-content: space-around;
  align-items: center;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all 0.2s;
  flex: 1;
}

.nav-item i {
  font-size: 1.25rem;
}

.nav-item.active {
  color: var(--color-secondary);
  background: rgba(236, 72, 153, 0.08);
}

/* --- SCREEN OVERLAY MODALS --- */
.screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 8, 20, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.screen-overlay.active {
  display: flex;
  animation: modalFadeIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  width: 100%;
  max-width: 380px;
  padding: 24px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: modalScaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes modalScaleUp {
  from { transform: scale(0.9) translateY(10px); }
  to { transform: scale(1) translateY(0); }
}

.btn-close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-light);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text-light);
  text-align: center;
}

/* Luna Room Specific */
.luna-large-avatar-container {
  display: flex;
  justify-content: center;
  position: relative;
  margin: 10px 0;
}

.luna-large-avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.25);
  z-index: 2;
}

.luna-large-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 130px;
  height: 130px;
  border-radius: 50%;
  box-shadow: 0 0 35px var(--color-primary);
  animation: pulseGlow 2s infinite ease-in-out;
  z-index: 1;
}

.luna-stats-detail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.luna-rank {
  font-size: 0.8rem;
  color: var(--color-accent);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.xp-bar-container {
  width: 80%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}

.xp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-secondary), var(--color-primary));
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.xp-text {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.luna-dialogue-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 14px;
  border-radius: 16px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--text-light);
  min-height: 60px;
}

/* Info Specific */
.info-scroll-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 350px;
  overflow-y: auto;
  padding-right: 6px;
}

/* Custom scrollbar for info */
.info-scroll-container::-webkit-scrollbar {
  width: 4px;
}

.info-scroll-container::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
}

.info-scroll-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.info-step-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 12px;
}

.info-step-card h4 {
  font-size: 0.9rem;
  color: var(--color-secondary);
  margin-bottom: 4px;
}

.info-step-card p {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --- Purring Cat Animation --- */
.purr {
  animation: catPurr 0.5s ease-in-out;
}

@keyframes catPurr {
  0%, 100% { transform: scale(1) rotate(0deg); }
  20% { transform: scale(1.08) rotate(-3deg); filter: drop-shadow(0 0 15px var(--color-primary)); }
  40% { transform: scale(1.08) rotate(3deg); filter: drop-shadow(0 0 15px var(--color-secondary)); }
  60% { transform: scale(1.05) rotate(-2deg); filter: drop-shadow(0 0 10px var(--color-primary)); }
  80% { transform: scale(1.05) rotate(2deg); filter: drop-shadow(0 0 10px var(--color-secondary)); }
}
