/* Game Styles - 童趣卡通風格 */

:root {
  /* 童趣色彩 */
  --color-primary: #4A90E2;
  --color-success: #7ED321;
  --color-warning: #F5A623;
  --color-danger: #FF6B6B;
  --color-info: #FF69B4;
  
  /* 背景漸變 */
  --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --bg-light: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
  
  /* 圓角 */
  --radius-small: 12px;
  --radius-medium: 20px;
  --radius-large: 25px;
  
  /* 陰影 */
  --shadow-small: 0 4px 12px rgba(0, 0, 0, 0.1);
  --shadow-medium: 0 6px 20px rgba(0, 0, 0, 0.15);
  --shadow-large: 0 10px 30px rgba(0, 0, 0, 0.2);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg-gradient);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #333;
}

/* 遊戲容器 */
.game-container {
  width: 100%;
  max-width: 600px;
  min-height: 600px;
  position: relative;
}

/* 畫面切換 */
.screen {
  display: none;
  width: 100%;
  padding: 20px;
}

.screen.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* ===== 開始畫面 ===== */
.start-content {
  text-align: center;
  background: white;
  padding: 60px 40px;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-large);
  max-width: 500px;
  width: 100%;
}

.game-title {
  font-size: 3rem;
  color: var(--color-primary);
  margin-bottom: 16px;
  font-weight: 700;
}

.game-subtitle {
  font-size: 1.3rem;
  color: #666;
  margin-bottom: 40px;
}

/* 模式選擇 */
.mode-selection,
.difficulty-selection {
  margin-bottom: 32px;
}

.selection-title {
  font-size: 1.1rem;
  color: #333;
  margin-bottom: 16px;
  font-weight: 600;
}

.mode-options {
  display: grid;
  gap: 12px;
}

.mode-option {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-medium);
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
}

.mode-option:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-small);
}

.mode-option.active {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(126, 211, 33, 0.1));
  box-shadow: var(--shadow-small);
}

.option-icon {
  font-size: 2.5rem;
  margin-right: 16px;
}

.option-content {
  text-align: left;
  flex: 1;
}

.option-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.option-desc {
  font-size: 0.9rem;
  color: #666;
}

/* 難度選擇 */
.difficulty-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.difficulty-option {
  padding: 16px 12px;
  border: 2px solid #e0e0e0;
  border-radius: var(--radius-medium);
  cursor: pointer;
  transition: all 0.3s ease;
  background: white;
  text-align: center;
}

.difficulty-option:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-small);
}

.difficulty-option.active {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, rgba(74, 144, 226, 0.1), rgba(126, 211, 33, 0.1));
  box-shadow: var(--shadow-small);
}

.difficulty-badge {
  font-size: 1.3rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--radius-small);
  margin-bottom: 12px;
  display: inline-block;
}

.difficulty-badge.level-1 {
  background: linear-gradient(135deg, #7ED321, #5FA31A);
  color: white;
}

.difficulty-badge.level-2 {
  background: linear-gradient(135deg, #F5A623, #FF8C00);
  color: white;
}

.difficulty-badge.level-3 {
  background: linear-gradient(135deg, #FF6B6B, #D32F2F);
  color: white;
}

.difficulty-info {
  font-size: 0.9rem;
}

.difficulty-time {
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.difficulty-desc {
  color: #666;
  font-size: 0.85rem;
}

.back-link {
  display: inline-block;
  margin-top: 24px;
  color: #666;
  text-decoration: none;
  font-size: 1rem;
  transition: color 0.3s ease;
}

.back-link:hover {
  color: var(--color-primary);
}

/* ===== 遊戲畫面 ===== */
#game-screen {
  background: white;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-large);
  padding: 24px;
  min-height: 600px;
}

/* 頂部資訊欄 */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.icon-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: #666;
  cursor: pointer;
  padding: 8px 16px;
  border-radius: var(--radius-small);
  transition: all 0.3s ease;
}

.icon-btn:hover {
  background: #f0f0f0;
  color: var(--color-primary);
}

.level-display {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.level-label {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 4px;
}

.level-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-warning);
  background: linear-gradient(135deg, #F5A623, #FF8C00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.score-display {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-label {
  font-size: 0.85rem;
  color: #999;
  margin-bottom: 4px;
}

.score-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
}

.mood-icon {
  font-size: 2.5rem;
}

/* 計時器 */
.timer-container {
  margin-bottom: 20px;
}

.timer-bar {
  width: 100%;
  height: 20px;
  background: #e0e0e0;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 8px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), var(--color-warning));
  width: 100%;
  transition: width 0.1s linear;
  border-radius: 12px;
}

.timer-fill.warning {
  background: linear-gradient(90deg, var(--color-warning), var(--color-danger));
  animation: pulse-timer 0.5s ease-in-out infinite;
}

.timer-fill.danger {
  background: var(--color-danger);
  animation: pulse-timer 0.3s ease-in-out infinite;
}

.timer-text {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #666;
}

.timer-text.warning {
  color: var(--color-warning);
}

.timer-text.danger {
  color: var(--color-danger);
  animation: shake 0.3s ease-in-out infinite;
}

@keyframes pulse-timer {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* 進度條 */
.progress-container {
  margin-bottom: 30px;
}

.progress-bar {
  width: 100%;
  height: 12px;
  background: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-success), var(--color-info));
  width: 10%;
  transition: width 0.5s ease;
  border-radius: 10px;
}

.progress-text {
  text-align: center;
  font-size: 0.95rem;
  color: #666;
  font-weight: 600;
}

/* 題目顯示 */
.question-container {
  margin-bottom: 40px;
}

.question-display {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  font-size: 5rem;
  font-weight: 700;
  color: var(--color-primary);
  padding: 20px;
}

.number {
  min-width: 80px;
  text-align: center;
}

.operator {
  color: #666;
  font-size: 4rem;
}

.question-mark {
  color: var(--color-warning);
  animation: pulse 1.5s ease-in-out infinite;
}

/* 答案區 */
.answer-container {
  margin-bottom: 30px;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.answer-display {
  font-size: 4rem;
  font-weight: 700;
  color: var(--color-primary);
  min-height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 8px;
}

.feedback {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 16px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 結果畫面 ===== */
#result-screen {
  background: white;
  border-radius: var(--radius-large);
  box-shadow: var(--shadow-large);
  padding: 40px 30px;
}

.result-content {
  text-align: center;
  width: 100%;
}

.result-emoji {
  font-size: 6rem;
  margin-bottom: 20px;
  animation: bounceIn 0.8s ease;
}

.result-title {
  font-size: 2.5rem;
  color: var(--color-primary);
  margin-bottom: 30px;
  font-weight: 700;
}

.result-stats {
  display: flex;
  justify-content: space-around;
  margin-bottom: 30px;
  gap: 20px;
}

.stat-item {
  flex: 1;
  background: var(--bg-light);
  padding: 20px;
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-small);
}

.stat-label {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--color-primary);
}

.stat-value.correct {
  color: var(--color-success);
}

.stat-value.wrong {
  color: var(--color-danger);
}

.stat-value.level {
  color: var(--color-warning);
}

.result-message {
  font-size: 1.2rem;
  color: #666;
  margin-bottom: 30px;
  line-height: 1.6;
}

.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* 通用按鈕 */
.btn {
  display: inline-block;
  padding: 16px 40px;
  font-size: 1.2rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  border: none;
  border-radius: var(--radius-medium);
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-small);
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-medium);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-large {
  padding: 20px 50px;
  font-size: 1.4rem;
}

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), #357ABD);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, var(--color-success), #5FA31A);
  color: white;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .game-title {
    font-size: 2.2rem;
  }
  
  .question-display {
    font-size: 3.5rem;
    gap: 12px;
  }
  
  .number {
    min-width: 60px;
  }
  
  .operator {
    font-size: 3rem;
  }
  
  .answer-display {
    font-size: 3rem;
  }
  
  .result-emoji {
    font-size: 4.5rem;
  }
  
  .result-title {
    font-size: 2rem;
  }
  
  .stat-value {
    font-size: 2rem;
  }
  
  .result-stats {
    flex-direction: column;
    gap: 12px;
  }
}
