/* =============================================================================
   style.css - 英検ライティング練習ツール スタイル
   ============================================================================= */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Hiragino Sans', 'Meiryo', sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  color: #333;
}

/* ヘッダー */
header {
  background: rgba(255, 255, 255, 0.95);
  padding: 1rem 2rem;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

header h1 {
  font-size: 1.5rem;
  color: #4a5568;
  margin: 0;
}

/* ヘッダーボタンエリア */
.header-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 虎の巻ボタン */
.btn-tiger {
  background-color: #f59e0b; /* 虎っぽい色 */
  color: white;
  border: none;
  padding: 8px 16px;
  font-size: 0.95rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
  transition:
    transform 0.2s,
    background-color 0.2s;
}
.btn-tiger:hover {
  background-color: #d97706;
  transform: scale(1.05);
}

/* 言語切り替えボタン */
.btn-lang {
  background-color: #4a5568;
  color: white;
  border: none;
  padding: 8px 16px;
  font-size: 0.95rem;
  border-radius: 20px;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s;
}
.btn-lang:hover {
  background-color: #2d3748;
  transform: scale(1.05);
}

/* メイン */
main {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  padding: 1.5rem;
  max-width: 1400px;
  margin: 0 auto;
}

/* パネル */
.panel {
  background: white;
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.panel h2 {
  font-size: 1.25rem;
  color: #2d3748;
  border-bottom: 2px solid #667eea;
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
}

.panel h3 {
  font-size: 1.1rem;
  color: #4a5568;
  margin: 1rem 0 0.5rem;
}

.panel h4 {
  font-size: 1rem;
  color: #718096;
  margin: 0.75rem 0 0.25rem;
}

/* フォーム要素 */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-weight: bold;
  margin-bottom: 0.5rem;
  color: #4a5568;
}

select {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  background: white;
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: #667eea;
}

textarea {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 1rem;
  resize: vertical;
  font-family: inherit;
}

textarea:focus {
  outline: none;
  border-color: #667eea;
}

/* ボタン */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(72, 187, 120, 0.4);
}

/* トピック表示 */
.topic-box {
  background: #f7fafc;
  border-left: 4px solid #667eea;
  padding: 1rem;
  border-radius: 0 8px 8px 0;
  font-size: 1.1rem;
  line-height: 1.6;
}

.original-box {
  background: #fffaf0;
  border-left: 4px solid #ed8936;
  padding: 1rem;
  border-radius: 0 8px 8px 0;
  font-size: 0.95rem;
  line-height: 1.8;
  /* ★ここを変更: 高さを大きく */
  min-height: 200px;
  max-height: 600px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* POINTS リスト */
#points-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  list-style: none;
}

#points-list li {
  background: #ebf4ff;
  color: #4c51bf;
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-weight: bold;
}

/* 語数カウント */
.word-count {
  text-align: right;
  font-size: 0.9rem;
  color: #718096;
  margin-top: 0.25rem;
}

/* スコア表示 */
.score-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 1rem 0;
}

.score-item {
  text-align: center;
  padding: 0.75rem;
  background: #f7fafc;
  border-radius: 8px;
}

.score-label {
  display: block;
  font-size: 0.85rem;
  color: #718096;
  margin-bottom: 0.25rem;
}

.score-value {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: #4c51bf;
}

/* フィードバック */
#feedback-text {
  background: #f0fff4;
  padding: 1rem;
  border-radius: 8px;
  line-height: 1.8;
}

/* ゴールデンフレーズ */
.golden-box {
  background: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%);
  padding: 1rem;
  border-radius: 8px;
  font-size: 1.2rem;
  font-weight: bold;
  text-align: center;
}

/* 修正提案 */
.correction-item {
  background: #fff5f5;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.correction-original {
  color: #c53030;
  text-decoration: line-through;
}

.correction-arrow {
  margin: 0 0.5rem;
  color: #718096;
}

.correction-fixed {
  color: #2f855a;
  font-weight: bold;
}

.correction-reason {
  margin-top: 0.5rem;
  font-size: 0.9rem;
  color: #4a5568;
  padding-left: 1rem;
  border-left: 2px solid #e2e8f0;
}

/* 模範解答 */
.model-box {
  background: #ebf8ff;
  border-left: 4px solid #4299e1;
  padding: 1rem;
  border-radius: 0 8px 8px 0;
  line-height: 1.8;
}

/* Emailセクション */
#email-section h4 {
  color: #4a5568;
}

#email-sender,
#email-context {
  font-weight: normal;
  color: #667eea;
}

#questions-list {
  list-style: decimal;
  padding-left: 1.5rem;
}

#questions-list li {
  margin: 0.25rem 0;
}

/* ローディング */
#loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#loading p {
  color: white;
  font-size: 1.2rem;
  margin-top: 1rem;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ユーティリティ */
.hidden {
  display: none !important;
}

/* フッター */
footer {
  text-align: center;
  padding: 1rem;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
}

/* 安全性チェック失敗 */
.safety-warning {
  background: #fff5f5;
  border: 2px solid #fc8181;
  border-radius: 8px;
  padding: 1rem;
  color: #c53030;
  text-align: center;
}

/* 語数判定用カラー */
.count-ok {
  color: #2f855a;
  font-weight: bold;
}

.count-warn {
  color: #dd6b20;
  font-weight: bold;
}

.count-ng {
  color: #e53e3e;
  font-weight: bold;
}

/* 目標語数バッジ */
.badge {
  background-color: #edf2f7;
  color: #4a5568;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: bold;
  border: 1px solid #cbd5e0;
}

/* ★新規: 虎の巻 モーダル用スタイル */
.modal {
  position: fixed;
  z-index: 2000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
}

.modal-content {
  background-color: #fefefe;
  padding: 30px;
  border: 1px solid #888;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

.close {
  color: #aaa;
  position: absolute;
  top: 15px;
  right: 25px;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s;
}

.close:hover,
.close:focus {
  color: #e53e3e;
  text-decoration: none;
  cursor: pointer;
}

.tiger-section {
  margin-bottom: 25px;
  padding: 20px;
  background: #fffbeb;
  border-radius: 10px;
  border: 2px solid #fcd34d;
}

.tiger-section h3 {
  color: #b45309;
  border-bottom: 2px dashed #f59e0b;
  padding-bottom: 8px;
  margin-top: 0;
  font-size: 1.2rem;
}

.tiger-section p {
  margin-bottom: 10px;
  line-height: 1.6;
}

/* テーブルスタイル */
.ammo-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  margin-top: 10px;
  border-radius: 8px;
  overflow: hidden;
}
.ammo-table th,
.ammo-table td {
  border: 1px solid #e2e8f0;
  padding: 12px;
  text-align: left;
}
.ammo-table th {
  background-color: #f59e0b;
  color: white;
}
.ammo-table tr:nth-child(even) {
  background-color: #f9fafb;
}
.ammo-table tr:hover {
  background-color: #fef3c7;
}

/* ========================================= */
/* Vocab Dojo Styles (New)                   */
/* ========================================= */

.tab-nav {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  gap: 15px;
}

.tab-btn {
  background: transparent;
  border: 2px solid white;
  color: white;
  padding: 10px 20px;
  border-radius: 25px;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.3s;
}

.tab-btn.active {
  background: white;
  color: #667eea;
  opacity: 1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.tab-btn:hover {
  opacity: 1;
  transform: translateY(-2px);
}

.dojo-panel {
  max-width: 800px;
  margin: 0 auto;
  min-height: 500px;
}

.dojo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 15px;
  margin-bottom: 20px;
}

.dojo-controls {
  display: flex;
  gap: 10px;
}

.dojo-controls select {
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e0;
}

.quiz-card {
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  margin-bottom: 20px;
}

.quiz-question-box {
  text-align: center;
  margin-bottom: 20px;
}

.quiz-label {
  display: inline-block;
  background: #edf2f7;
  color: #718096;
  font-size: 0.8rem;
  font-weight: bold;
  padding: 4px 8px;
  border-radius: 4px;
  margin-bottom: 10px;
}

#quiz-definition {
  font-size: 1.4rem;
  font-weight: bold;
  color: #2d3748;
}

.quiz-hint-box {
  background: #f0fff4;
  border: 1px dashed #68d391;
  padding: 10px;
  border-radius: 8px;
  text-align: center;
  margin-bottom: 20px;
}

#quiz-synonyms {
  font-size: 1.1rem;
  color: #2f855a;
  font-style: italic;
}

.quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.quiz-option-btn {
  background: white;
  border: 2px solid #e2e8f0;
  padding: 15px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #4a5568;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.quiz-option-btn:hover:not(:disabled) {
  border-color: #667eea;
  background: #f7fafc;
}

.quiz-option-btn.correct {
  background: #c6f6d5 !important;
  border-color: #48bb78 !important;
  color: #22543d !important;
}

.quiz-option-btn.wrong {
  background: #fed7d7 !important;
  border-color: #f56565 !important;
  color: #742a2a !important;
  opacity: 0.6;
}

.result-banner {
  padding: 15px;
  text-align: center;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 8px;
  margin-bottom: 15px;
}
.banner-correct {
  background: #c6f6d5;
  color: #22543d;
}
.banner-wrong {
  background: #fed7d7;
  color: #742a2a;
}

.quiz-explanation-box {
  background: #ebf8ff;
  border-left: 4px solid #4299e1;
  padding: 15px;
  border-radius: 0 8px 8px 0;
  line-height: 1.6;
}

/* スピーカーアイコンとテキストの並び調整 */
.quiz-option-btn {
  display: flex !important;
  align-items: center;
  text-align: left;
  padding: 10px 15px;
}
.opt-speaker {
  margin-right: 15px;
  font-size: 1.2rem;
  padding: 5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.05);
  cursor: pointer;
  transition: transform 0.1s;
}
.opt-speaker:hover {
  transform: scale(1.2);
  background: rgba(0, 0, 0, 0.1);
}
.opt-text {
  flex-grow: 1;
}

.btn-audio {
  background: #f8fafc;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1.5;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-audio:hover {
  background: #edf2f7;
  transform: scale(1.1);
}

/* ========================================= */
/* Progress Header Bar                       */
/* ========================================= */
.progress-header-bar {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 20px;
  text-align: center;
  font-size: 1rem;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  letter-spacing: 0.5px;
}

/* ========================================= */
/* Notification Toast System                 */
/* ========================================= */
.notification-toast {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  color: #2d3748;
  padding: 15px 30px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  font-size: 1rem;
  font-weight: bold;
  z-index: 3000;
  transition: top 0.3s ease-in-out;
  min-width: 300px;
  max-width: 500px;
  text-align: center;
}

.notification-toast.show {
  top: 20px;
}

.notification-success {
  background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
  color: white;
}

.notification-info {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
  color: white;
}

.notification-warning {
  background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
  color: white;
}

.notification-error {
  background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
  color: white;
}

.topic-badge {
  display: inline-block;
  color: #d97706; /* オレンジ系 */
  font-weight: bold;
  font-size: 0.9em;
  margin-bottom: 8px;
  font-style: normal; /* 斜体解除 */
}
