/* Ask to Play – prototype.kids brand */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --cream:  #FAF3EC;
  --navy:   #1D2433;
  --coral:  #E8523A;
  --sage:   #8DAF9C;
  --sand:   #D4C5A9;
  --purple: #7C5CBF;
  --white:  #FFFFFF;

  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;

  --shadow-sm: 0 2px 8px rgba(29,36,51,0.08);
  --shadow-md: 0 6px 24px rgba(29,36,51,0.12);
  --shadow-lg: 0 12px 40px rgba(29,36,51,0.16);
}

* { box-sizing: border-box; }

/* ── Base ──────────────────────────────────────────────────── */
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: var(--cream);
  background-image: url('/img/bg-art.png');
  background-size: cover;
  background-position: bottom center;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--navy);
  text-align: center;
  padding: 0 20px 60px;
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Footer / logo bar ─────────────────────────────────────── */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 0 24px;
  margin-top: 8px;
}

.site-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: contain;
}

.site-wordmark {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.2px;
}

.site-wordmark .dot {
  color: var(--coral);
}

/* ── Container ─────────────────────────────────────────────── */
.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 0 0;
}

/* ── Page title ────────────────────────────────────────────── */
h1 {
  font-size: 38px;
  font-weight: 800;
  color: var(--navy);
  margin: 8px 0 4px;
  letter-spacing: -1px;
  line-height: 1.1;
}

/* ── Buddy face ────────────────────────────────────────────── */
.buddy-face {
  font-size: 90px;
  margin: 16px 0;
  display: inline-block;
  animation: bounce 2.4s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(29,36,51,0.12));
  transition: all 0.3s ease;
}

.buddy-face.speaking { animation: speak 0.45s ease-in-out infinite alternate; }
.buddy-face.listening { animation: listen 1.1s ease-in-out infinite; }

@keyframes bounce {
  0%,100% { transform: translateY(0) scale(1); }
  40%      { transform: translateY(-10px) scale(1.05); }
  60%      { transform: translateY(-4px) scale(1.02); }
}
@keyframes speak {
  0%   { transform: scale(1); }
  100% { transform: scale(1.08); }
}
@keyframes listen {
  0%   { transform: scale(1);    box-shadow: 0 0 0 0   rgba(141,175,156,0.6); }
  70%  { transform: scale(1.05); box-shadow: 0 0 0 14px rgba(141,175,156,0); }
  100% { transform: scale(1);    box-shadow: 0 0 0 0   rgba(141,175,156,0); }
}

/* ── Status card ───────────────────────────────────────────── */
.status {
  font-size: 17px;
  font-weight: 500;
  margin: 16px 0;
  padding: 20px 24px;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid rgba(29,36,51,0.07);
  color: var(--navy);
}

/* ── Progress bar ──────────────────────────────────────────── */
.progress-bar {
  width: 100%;
  height: 5px;
  background: rgba(29,36,51,0.1);
  border-radius: 3px;
  margin: 10px 0 0;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--coral), #f0845a);
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ── Controls ──────────────────────────────────────────────── */
.controls {
  margin: 24px 0;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

button {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 15px;
  font-weight: 600;
  padding: 13px 26px;
  border: none;
  border-radius: 50px;
  background: var(--navy);
  color: var(--white);
  cursor: pointer;
  transition: all 0.22s ease;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

button:hover {
  background: #2c3650;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

button:disabled {
  background: var(--sand);
  color: rgba(29,36,51,0.4);
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* Primary action button */
#startBtn {
  background: var(--coral);
  font-size: 16px;
  padding: 15px 32px;
}
#startBtn:hover { background: #d14530; }

/* Listening state */
.listening {
  background: var(--sage) !important;
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%,100% { transform: scale(1) translateY(0); }
  50%      { transform: scale(1.04) translateY(-2px); }
}

/* ── Learning stats ────────────────────────────────────────── */
.learning-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
  gap: 10px;
  margin: 20px 0;
}

.stat-card {
  background: var(--white);
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  border: 1.5px solid rgba(29,36,51,0.06);
  font-size: 13px;
  font-weight: 500;
  color: rgba(29,36,51,0.65);
}

.stat-number {
  font-size: 26px;
  font-weight: 700;
  color: var(--coral);
  margin-bottom: 2px;
}

/* ── Video container ───────────────────────────────────────── */
.video-container {
  margin: 24px 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--navy);
  box-shadow: var(--shadow-lg);
}

.video-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  flex-wrap: wrap;
  background: rgba(29,36,51,0.04);
}

.video-controls button {
  padding: 9px 18px;
  font-size: 13px;
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid rgba(29,36,51,0.1);
}
.video-controls button:hover {
  background: var(--cream);
  color: var(--navy);
}

/* ── Conversation log ──────────────────────────────────────── */
.conversation-log {
  text-align: left;
  max-height: 280px;
  overflow-y: auto;
  background: var(--white);
  padding: 18px 20px;
  border-radius: var(--radius-md);
  margin: 20px 0;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
  border: 1.5px solid rgba(29,36,51,0.07);
}

.conversation-log::-webkit-scrollbar { width: 5px; }
.conversation-log::-webkit-scrollbar-track { background: var(--cream); border-radius: 3px; }
.conversation-log::-webkit-scrollbar-thumb { background: var(--sand); border-radius: 3px; }

.user-message {
  color: var(--navy);
  margin: 8px 0;
  padding: 9px 14px;
  background: rgba(29,36,51,0.04);
  border-radius: 10px;
  border-left: 3px solid var(--sage);
}

.ai-message {
  color: var(--navy);
  margin: 8px 0;
  padding: 9px 14px;
  background: rgba(232,82,58,0.06);
  border-radius: 10px;
  border-left: 3px solid var(--coral);
}

/* ── API status (fixed top-right) ──────────────────────────── */
.api-status {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--white);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  border: 1.5px solid rgba(29,36,51,0.07);
  z-index: 1000;
  color: var(--navy);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 7px;
  animation: statusPulse 2s infinite;
}
@keyframes statusPulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.status-ok       { background: #4caf50; }
.status-fallback { background: #ff9800; }
.status-error    { background: #f44336; }

/* ── Microphone indicator (fixed bottom) ───────────────────── */
.microphone-indicator {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sage);
  color: var(--white);
  padding: 11px 22px;
  border-radius: 50px;
  display: none;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-md);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.microphone-indicator.active { display: flex; }

.volume-bars {
  display: flex;
  gap: 3px;
  align-items: flex-end;
}
.volume-bar {
  width: 3px;
  background: var(--white);
  border-radius: 2px;
  animation: volumeAnimation 0.5s ease-in-out infinite alternate;
}
.volume-bar:nth-child(1) { height: 10px; animation-delay: 0s;   }
.volume-bar:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.volume-bar:nth-child(3) { height: 8px;  animation-delay: 0.2s; }
.volume-bar:nth-child(4) { height: 13px; animation-delay: 0.3s; }
@keyframes volumeAnimation {
  0%   { transform: scaleY(0.3); }
  100% { transform: scaleY(1); }
}

/* ── Notification toast ────────────────────────────────────── */
.notification {
  position: fixed;
  top: 80px;
  right: 20px;
  background: var(--navy);
  color: var(--white);
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  transform: translateX(calc(100% + 24px));
  transition: transform 0.3s ease;
  z-index: 1001;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
}
.notification.show { transform: translateX(0); }

/* ── Mobile ────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: 0 0 16px; }
  h1 { font-size: 26px; }
  .buddy-face { font-size: 72px; }
  .controls { flex-direction: column; align-items: center; }
  .api-status { position: relative; top: auto; right: auto; margin: 12px 0; }
  .learning-stats { grid-template-columns: repeat(2, 1fr); }
}
