:root {
  --primary-pink: #ff6b9d;
  --secondary-pink: #ff8fb7;
  --accent-purple: #7057ff;
  --bg-gradient: linear-gradient(135deg, #181938 0%, #2b1f4d 50%, #442456 100%);
  --bubble-bg: rgba(255, 255, 255, 0.95);
  --bubble-text: #2c2541;
  --gold-star: #ffd15c;
  --card-bg: rgba(255, 255, 255, 0.12);
  --glass-border: rgba(255, 255, 255, 0.2);
  --shadow-soft: 0 12px 36px rgba(0, 0, 0, 0.35);
}

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

body {
  font-family: 'Fredoka', 'Nunito', sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  color: #fff;
  overflow-x: hidden;
  position: relative;
}

/* Background Twinkling Stars */
.stars-bg {
  position: fixed;
  inset: 0;
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 140px, #ffd15c, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 150px 70px, #ffffff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 240px 320px, #ff9ff3, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 320px 180px, #54a0ff, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 350px 350px;
  opacity: 0.6;
  z-index: 0;
  pointer-events: none;
}

/* Screens */
.screen {
  display: none;
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* 1. Login Card */
#login-screen {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow-soft);
  max-width: 440px;
  width: 100%;
  padding: 36px 28px;
  text-align: center;
  animation: floatUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.brand-header h1 {
  font-size: 32px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #ffd15c 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 4px;
}

.subtitle {
  font-size: 14px;
  color: #ffb8d2;
  letter-spacing: 0.5px;
}

.pixie-preview-badge {
  margin: 20px auto 14px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 157, 0.35) 0%, rgba(255,255,255,0) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: softPulse 3s infinite ease-in-out;
}

.mini-pixie-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,0.3));
}

.login-body h2 {
  font-size: 24px;
  margin-bottom: 6px;
  color: #fff;
}

.login-hint {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 20px;
}

.input-wrapper {
  position: relative;
  margin-bottom: 18px;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
}

.input-wrapper input {
  width: 100%;
  padding: 16px 16px 16px 50px;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  font-size: 16px;
  font-family: inherit;
  outline: none;
  transition: all 0.25s ease;
}

.input-wrapper input:focus {
  border-color: var(--primary-pink);
  box-shadow: 0 0 16px rgba(255, 107, 157, 0.4);
  background: rgba(0, 0, 0, 0.4);
}

.btn {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  border: none;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, #ff6b9d 0%, #7057ff 100%);
  color: #fff;
  box-shadow: 0 8px 24px rgba(255, 107, 157, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 107, 157, 0.6);
}

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

.card-footer {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

/* 2. Chat HUD */
.hud-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: rgba(20, 20, 45, 0.6);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.student-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  padding: 6px 14px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
}

.quota-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(255, 209, 92, 0.2) 0%, rgba(255, 107, 157, 0.2) 100%);
  border: 1px solid rgba(255, 209, 92, 0.4);
  padding: 6px 16px;
  border-radius: 24px;
}

.quota-details {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.quota-label {
  font-size: 10px;
  color: #ffd15c;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quota-time {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 16px;
  cursor: pointer;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* Stage Area */
.stage-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
}

.mascot-wrapper {
  position: relative;
  width: 260px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mascot-aura {
  position: absolute;
  inset: -15px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 107, 157, 0.4) 0%, rgba(112, 87, 255, 0.15) 50%, rgba(0,0,0,0) 70%);
  animation: auraFloat 4s infinite ease-in-out;
  pointer-events: none;
}

.mascot-image {
  width: 220px;
  height: 220px;
  object-fit: contain;
  filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.45));
  animation: mascotHover 3.5s infinite ease-in-out;
  transition: transform 0.3s ease;
}

/* Mascot Listening / Speaking States */
.mascot-wrapper.listening .mascot-aura {
  background: radial-gradient(circle, rgba(255, 209, 92, 0.6) 0%, rgba(255, 107, 157, 0.3) 60%, rgba(0,0,0,0) 75%);
  animation: auraPulseFast 1s infinite alternate;
}

.mascot-wrapper.speaking .mascot-image {
  animation: mascotTalk 0.4s infinite alternate ease-in-out;
}

.mascot-status-tag {
  position: absolute;
  bottom: 0;
  background: rgba(18, 18, 38, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 5px 14px;
  border-radius: 16px;
  font-size: 13px;
  font-weight: 600;
  backdrop-filter: blur(8px);
}

/* Dialogue Speech Bubble */
.speech-bubble-container {
  margin-top: 18px;
  width: 100%;
}

.speech-bubble {
  background: var(--bubble-bg);
  color: var(--bubble-text);
  border-radius: 22px;
  padding: 18px 22px;
  font-size: 17px;
  line-height: 1.45;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  position: relative;
  text-align: center;
  font-weight: 600;
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.speech-bubble::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  border-width: 0 10px 10px 10px;
  border-style: solid;
  border-color: transparent transparent var(--bubble-bg) transparent;
}

/* Sleepy Banner */
.sleepy-banner {
  margin-top: 14px;
  background: linear-gradient(135deg, rgba(255, 209, 92, 0.9) 0%, rgba(255, 143, 183, 0.9) 100%);
  color: #3b2200;
  padding: 10px 18px;
  border-radius: 16px;
  font-size: 14px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
  text-align: center;
  animation: softPulse 2s infinite ease-in-out;
}

/* Nap Notice Card (Quota Finished) */
.nap-notice-card {
  margin-top: 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 2px dashed rgba(255, 209, 92, 0.5);
  padding: 24px;
  border-radius: 22px;
  text-align: center;
  backdrop-filter: blur(16px);
  width: 100%;
}

.nap-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.nap-notice-card h3 {
  font-size: 20px;
  color: #ffd15c;
  margin-bottom: 8px;
}

.nap-notice-card p {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  line-height: 1.4;
}

.return-countdown-box {
  margin: 14px auto 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  padding: 6px 18px;
  border-radius: 20px;
}

.return-countdown-box strong {
  color: #ff8fb7;
  font-size: 16px;
}

.keep-drawing-note {
  font-size: 12px !important;
  color: #ffd15c !important;
  margin-top: 8px;
}

/* Bottom Controls */
.control-dock {
  padding: 20px;
  background: rgba(18, 18, 38, 0.85);
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* Waveform Box */
.waveform-box {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 28px;
}

.wave-bar {
  width: 5px;
  height: 10px;
  background: var(--primary-pink);
  border-radius: 4px;
  animation: wavePulse 0.6s infinite alternate ease-in-out;
}

.wave-bar:nth-child(2) { animation-delay: 0.15s; height: 18px; background: #ffd15c; }
.wave-bar:nth-child(3) { animation-delay: 0.3s; height: 26px; background: #ff8fb7; }
.wave-bar:nth-child(4) { animation-delay: 0.15s; height: 16px; background: #7057ff; }
.wave-bar:nth-child(5) { animation-delay: 0.05s; height: 12px; background: var(--primary-pink); }

/* Microphone Button */
.mic-button {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 64px;
  border-radius: 32px;
  border: none;
  background: linear-gradient(135deg, #ff6b9d 0%, #7057ff 100%);
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(255, 107, 157, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: transform 0.15s, box-shadow 0.2s;
}

.mic-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 34px rgba(255, 107, 157, 0.65);
}

.mic-button:active, .mic-button.recording {
  transform: scale(0.97);
  background: linear-gradient(135deg, #ff3b7c 0%, #ff8fb7 100%);
  box-shadow: 0 0 30px rgba(255, 107, 157, 0.85);
}

.mic-icon {
  font-size: 24px;
}

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  padding: 6px 14px;
  border-radius: 18px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  border-color: #ffd15c;
}

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

@keyframes mascotTalk {
  0% { transform: scale(1) translateY(-4px); }
  100% { transform: scale(1.05) translateY(-8px); }
}

@keyframes auraFloat {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

@keyframes auraPulseFast {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.25); opacity: 1; }
}

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

@keyframes wavePulse {
  0% { transform: scaleY(0.4); }
  100% { transform: scaleY(1.3); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translateY(24px); }
  100% { opacity: 1; transform: translateY(0); }
}
