/* Ollie英语智能体 - 样式文件 */
/* 设计规范：流畅度 > 稳定性 > 响应速度 > 功能丰富度 */
/* 儿童iPad友好：最小触摸目标80px，核心按钮120px */

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

:root {
  /* 色彩系统 */
  --pink: #FFB6C1;
  --sky-blue: #87CEEB;
  --gold: #FFD700;
  --warm-white: #FFF8E7;
  --dark-brown: #5D4E37;
  --success-green: #90EE90;
  --light-gray: #D3D3D3;
  --white: #FFFFFF;
  --orange: #FF6B35;
  --brown: #8B4513;
  --forest-green: #228B22;
}

body {
  font-family: 'PingFang SC', 'Noto Sans SC', 'Arial Rounded MT Bold', sans-serif;
  background: var(--warm-white);
  color: var(--dark-brown);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Toast提示 */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(93, 78, 55, 0.9);
  color: white;
  padding: 16px 32px;
  border-radius: 16px;
  font-size: 18px;
  z-index: 1000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

/* 页面切换 */
.page {
  display: none;
  min-height: 100vh;
  padding: 20px;
  padding-bottom: 100px;
}

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

/* 首页背景 */
.home-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #FFF8E7 0%, #FFE4E1 100%);
  z-index: -1;
}

/* 首页标题 */
.home-header {
  text-align: center;
  padding: 40px 0 30px;
}

.home-title {
  font-size: 36px;
  font-weight: bold;
  color: var(--dark-brown);
}

.home-subtitle {
  font-size: 20px;
  color: var(--pink);
  margin-top: 8px;
}

/* 场景卡片网格 */
.scene-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 0 20px;
}

.scene-card {
  background: var(--white);
  border-radius: 24px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 20px;
  cursor: pointer;
  border: 3px solid var(--pink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(255, 182, 193, 0.2);
  min-height: 100px;
}

.scene-card:active {
  transform: scale(0.98);
  box-shadow: 0 2px 6px rgba(255, 182, 193, 0.2);
}

.scene-icon {
  font-size: 48px;
}

.scene-name {
  font-size: 22px;
  font-weight: bold;
  color: var(--dark-brown);
  flex: 1;
}

.scene-progress {
  font-size: 16px;
  color: #999;
}

/* Step页面头部 */
.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  margin-bottom: 20px;
}

.back-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--pink);
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-indicator {
  display: flex;
  gap: 8px;
}

.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #DDD;
  transition: background 0.3s;
}

.step-dot.active {
  background: var(--pink);
}

/* Mimi角色 */
.mimi-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 20px 0;
}

.mimi-character {
  font-size: 80px;
  animation: bounce 1s ease infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.mimi-dialogue {
  background: var(--white);
  border-radius: 20px;
  padding: 16px 24px;
  font-size: 20px;
  color: var(--dark-brown);
  max-width: 85%;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: relative;
}

.mimi-dialogue::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom-color: var(--white);
}

/* 单词显示 */
.word-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin: 30px 0;
}

.word-letters {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 60px;
  background: var(--pink);
  color: white;
  border-radius: 12px;
  font-size: 32px;
  font-weight: bold;
  animation: letterPop 0.3s ease backwards;
}

@keyframes letterPop {
  from { transform: scale(0) rotate(-20deg); opacity: 0; }
  to { transform: scale(1) rotate(0); opacity: 1; }
}

.word-emoji {
  font-size: 80px;
  animation: bounce 1s ease infinite;
}

.word-spelling {
  font-size: 24px;
  color: var(--pink);
  font-weight: bold;
}

/* 录音按钮 */
.record-btn-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  margin: 40px 0;
}

.record-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: var(--gold);
  border: none;
  font-size: 48px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
  transition: transform 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-btn:active, .record-btn.recording {
  transform: scale(0.95);
}

.record-btn.waiting {
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4); }
  50% { opacity: 0.6; box-shadow: 0 2px 6px rgba(255, 215, 0, 0.2); }
}

.record-btn.recording {
  background: var(--pink);
}

.record-hint {
  font-size: 18px;
  color: #999;
}

/* 音量指示器 */
.volume-indicator {
  display: flex;
  gap: 4px;
  height: 20px;
  align-items: flex-end;
}

.volume-bar {
  width: 6px;
  background: var(--pink);
  border-radius: 3px;
  animation: volume 0.3s ease infinite;
}

@keyframes volume {
  0%, 100% { height: 6px; }
  50% { height: 20px; }
}

/* Step3星星爆炸 */
.success-text {
  font-size: 36px;
  color: var(--gold);
  font-weight: bold;
  margin-top: 20px;
  text-align: center;
}

.star {
  animation: starExplode 1s ease forwards;
}

@keyframes starExplode {
  0% { transform: translate(0, 0) scale(0); opacity: 1; }
  100% { transform: translate(var(--tx), var(--ty)) scale(1); opacity: 0; }
}

/* 画布 */
.tool-btns {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 12px;
}

.tool-btn {
  padding: 12px 24px;
  border-radius: 16px;
  background: var(--white);
  border: 2px solid var(--pink);
  color: var(--dark-brown);
  font-size: 16px;
  cursor: pointer;
  transition: all 0.15s;
}

.tool-btn.active {
  background: var(--pink);
  color: white;
}

.canvas-container {
  display: flex;
  justify-content: center;
  margin: 0 auto;
}

#drawCanvas {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  touch-action: none;
}

.color-palette {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.color-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.color-btn.selected {
  border-color: var(--dark-brown);
  transform: scale(1.1);
}

.canvas-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 16px;
}

.action-btn {
  padding: 16px 32px;
  border-radius: 16px;
  background: var(--white);
  border: 2px solid var(--pink);
  color: var(--dark-brown);
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
}

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

.action-btn.primary {
  background: var(--pink);
  color: white;
}

/* 底部导航 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--white);
  display: flex;
  justify-content: center;
  gap: 40px;
  padding: 12px 0;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
  z-index: 100;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: #999;
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 12px;
  transition: all 0.15s;
}

.nav-btn.active {
  color: var(--pink);
}

.nav-btn-icon {
  font-size: 28px;
}

/* 探险日记 */
.diary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px 0;
}

.diary-item {
  background: var(--white);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.diary-word {
  font-size: 14px;
  color: var(--dark-brown);
  font-weight: bold;
}

.diary-image {
  font-size: 40px;
}

/* 响应式适配 */
@media (min-width: 768px) {
  .scene-grid {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .scene-card {
    flex: 1;
    min-width: 280px;
  }
}
