/* リセットとベーススタイル */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: #333;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ユーティリティクラス */
.hidden {
  display: none !important;
}

/* ローディング画面 */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.loading-content {
  text-align: center;
  color: white;
}

.turtle-logo {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: bounce 2s infinite;
}

@keyframes bounce {
  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.loading-content h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.loading-content p {
  font-size: 1.2rem;
  opacity: 0.8;
}

/* メインアプリケーション */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.game-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  margin-top: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

/* ヘッダー */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  border-bottom: 2px solid #e0e0e0;
  margin-bottom: 2rem;
}

.game-title {
  font-size: 2rem;
  color: #2c3e50;
  font-weight: bold;
}

.game-controls {
  display: flex;
  gap: 1rem;
}

/* ボタンスタイル */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 25px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(240, 147, 251, 0.3);
}

.btn-danger {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(231, 76, 60, 0.3);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* メインゲームエリア */
.game-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* ストーリーセクション */
.story-section {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.story-section h2 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.story-content {
  font-size: 1.1rem;
  line-height: 1.8;
  color: #34495e;
}

.story-placeholder {
  font-style: italic;
  color: #7f8c8d;
  text-align: center;
  padding: 2rem;
}

/* 履歴セクション */
.history-section {
  background: white;
  padding: 1.5rem;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  max-height: 400px;
  overflow-y: auto;
}

.history-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.history-header h4 {
  color: #2c3e50;
  font-size: 1.1rem;
  margin: 0;
}

.clear-history-btn {
  background: #e74c3c;
  color: white;
  border: none;
  padding: 0.3rem 0.8rem;
  border-radius: 15px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.clear-history-btn:hover {
  background: #c0392b;
  transform: translateY(-1px);
}

.history-empty {
  text-align: center;
  padding: 2rem;
  color: #7f8c8d;
}

.history-placeholder {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.history-hint {
  font-size: 0.9rem;
  opacity: 0.7;
}

.question-history {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.question-item {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1rem;
  border-left: 4px solid #3498db;
  transition: all 0.3s ease;
}

.question-item:hover {
  transform: translateX(5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.question-number {
  background: #3498db;
  color: white;
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: bold;
}

.question-time {
  color: #7f8c8d;
  font-size: 0.8rem;
}

.question-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.question-text,
.answer-text {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.question-label,
.answer-label {
  font-weight: bold;
  color: #2c3e50;
  min-width: 40px;
  font-size: 0.9rem;
}

.question-value {
  color: #34495e;
  flex: 1;
}

.answer-value {
  flex: 1;
  font-weight: 600;
}

.answer-yes .answer-value {
  color: #27ae60;
}

.answer-no .answer-value {
  color: #e74c3c;
}

.answer-unknown .answer-value {
  color: #f39c12;
}

.answer-other .answer-value {
  color: #f39c12;
}

.question-text {
  color: #34495e;
}

.answer-text {
  font-weight: 600;
}

/* 音声セクション */
.voice-section {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.voice-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.voice-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
  position: relative;
  overflow: hidden;
}

.voice-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.voice-btn.recording {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  animation: pulse 1.5s infinite;
  transform: scale(1.1);
  box-shadow: 0 15px 40px rgba(231, 76, 60, 0.4);
}

.voice-btn.recording::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100px;
  height: 100px;
  background: rgba(231, 76, 60, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: ripple 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 15px 40px rgba(231, 76, 60, 0.4);
  }
  50% {
    box-shadow: 0 15px 40px rgba(231, 76, 60, 0.6);
  }
  100% {
    box-shadow: 0 15px 40px rgba(231, 76, 60, 0.4);
  }
}

@keyframes ripple {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(2);
    opacity: 0;
  }
}

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

.voice-text {
  font-size: 0.9rem;
  font-weight: 600;
}

.voice-status {
  font-size: 1rem;
  color: #7f8c8d;
  min-height: 1.5rem;
}

.voice-feedback {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 10px;
  font-weight: 500;
  text-align: center;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.voice-feedback.info {
  background: linear-gradient(135deg, #74b9ff 0%, #0984e3 100%);
  color: white;
}

.voice-feedback.success {
  background: linear-gradient(135deg, #00b894 0%, #00a085 100%);
  color: white;
}

.voice-feedback.warning {
  background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
  color: white;
}

.voice-feedback.error {
  background: linear-gradient(135deg, #e17055 0%, #d63031 100%);
  color: white;
}

/* 現在のQ&Aセクション */
.current-qa {
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  padding: 1.5rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  margin-bottom: 1rem;
  animation: slideIn 0.5s ease-out;
}

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

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

.fade-in {
  animation: fadeIn 0.3s ease-in;
}

.current-question,
.current-answer {
  margin-bottom: 1rem;
}

.current-question h4,
.current-answer h4 {
  color: #2c3e50;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.current-question p {
  color: #34495e;
  font-size: 1.1rem;
  font-weight: 500;
}

.current-answer p {
  font-size: 1.2rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  display: inline-block;
}

.current-answer .answer-yes {
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
  border: 2px solid #27ae60;
}

.current-answer .answer-no {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  border: 2px solid #e74c3c;
}

.current-answer .answer-unknown {
  background: rgba(243, 156, 18, 0.2);
  color: #f39c12;
  border: 2px solid #f39c12;
}

.current-answer .answer-other {
  background: rgba(243, 156, 18, 0.2);
  color: #f39c12;
  border: 2px solid #f39c12;
}

/* ヒントセクション */
.hint-section {
  background: linear-gradient(135deg, #ffeaa7 0%, #fab1a0 100%);
  padding: 1.5rem;
  border-radius: 15px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.hint-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.hint-content {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hint-word {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  margin: 0.25rem;
  display: inline-block;
  font-weight: 600;
}

/* フッター */
.game-footer {
  margin-top: 2rem;
  padding: 1rem 0;
  border-top: 2px solid #e0e0e0;
}

.game-stats {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  color: #7f8c8d;
  font-weight: 500;
}

/* エラーコンテナ */
.error-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.error-content {
  background: white;
  padding: 2rem;
  border-radius: 15px;
  max-width: 500px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.error-content h3 {
  color: #e74c3c;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}

.error-content p {
  color: #2c3e50;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
  .game-container {
    margin: 0.5rem;
    padding: 0.5rem;
    border-radius: 15px;
  }

  .game-header {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .game-title {
    font-size: 1.5rem;
  }

  .game-controls {
    width: 100%;
    justify-content: center;
  }

  .story-section {
    padding: 1rem;
  }

  .story-content {
    font-size: 1rem;
  }

  .voice-btn {
    width: 100px;
    height: 100px;
  }

  .voice-icon {
    font-size: 2rem;
  }

  .voice-text {
    font-size: 0.8rem;
  }

  .game-stats {
    flex-direction: column;
    gap: 0.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .game-container {
    margin: 0;
    border-radius: 0;
    min-height: 100vh;
  }

  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
  }

  .voice-btn {
    width: 80px;
    height: 80px;
  }

  .voice-icon {
    font-size: 1.5rem;
  }

  .voice-text {
    font-size: 0.7rem;
  }
}

/* 音声認識確認エリア */
.voice-confirmation {
  margin-top: 1rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.5s ease-out;
}

.recognition-result {
  margin-bottom: 1rem;
}

.recognition-result h4 {
  color: #2c3e50;
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.recognition-text {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  border: 2px solid #3498db;
  font-size: 1.1rem;
  color: #34495e;
  font-weight: 500;
  min-height: 60px;
  display: flex;
  align-items: center;
}

.confirmation-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
}

.confirmation-buttons .btn {
  min-width: 120px;
}

/* 正解表示エリア */
.answer-section {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  animation: slideIn 0.5s ease-out;
}

.answer-section h3 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  text-align: center;
}

.answer-content {
  background: white;
  padding: 1.5rem;
  border-radius: 10px;
  border: 3px solid #e74c3c;
  font-size: 1.1rem;
  line-height: 1.8;
  color: #2c3e50;
  text-align: center;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.answer-reveal {
  font-weight: bold;
  color: #e74c3c;
  font-size: 1.2rem;
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(231, 76, 60, 0.1);
  border-radius: 8px;
  border: 2px solid #e74c3c;
}

.key-questions-content {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 2px solid rgba(231, 76, 60, 0.3);
}

.key-questions-content h4 {
  color: #2c3e50;
  margin-bottom: 1rem;
  font-size: 1.2rem;
  text-align: center;
}

.key-questions-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.key-question-item {
  background: rgba(255, 255, 255, 0.8);
  padding: 1rem;
  border-radius: 8px;
  border-left: 4px solid #3498db;
  font-size: 1rem;
  color: #2c3e50;
  transition: all 0.3s ease;
}

.key-question-item:hover {
  background: rgba(255, 255, 255, 0.95);
  transform: translateX(5px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
}

.key-question-number {
  font-weight: bold;
  color: #3498db;
  margin-right: 0.5rem;
}

/* 正解に近いバッジ */
.correct-badge {
  color: #e67e22;
  font-weight: bold;
  margin-left: 0.5em;
  font-size: 0.9em;
  border: 1px solid #e67e22;
  border-radius: 8px;
  padding: 0 0.5em;
  background: #fffbe6;
}
