/**
 * style.css — 英単語クイズ
 * Design: ゴシック体中心・清潔な教育アプリ
 */

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@300;400;500;700;900&display=swap');

/* ===== CSS 変数 ===== */
:root {
  /* カラー */
  --orange:       #F5821F;
  --orange-mid:   #F9A054;
  --orange-light: #FDECD8;
  --orange-pale:  #FEF6EE;

  --text-dark:    #1C1C1E;
  --text-mid:     #555555;
  --text-light:   #999999;

  --bg:           #F7F5F2;
  --surface:      #FFFFFF;
  --border:       #E8E4DF;
  --border-light: #F0EDE9;

  --green:        #2F855A;
  --green-light:  #EBF8F1;
  --red:          #C0392B;
  --red-light:    #FDECEA;

  /* タイポグラフィ */
  --font: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "游ゴシック", "YuGothic", "Meiryo", sans-serif;

  /* シャドウ */
  --shadow-card: 0 1px 4px rgba(0,0,0,0.06), 0 4px 16px rgba(0,0,0,0.07);
  --shadow-btn:  0 2px 8px rgba(245,130,31,0.30);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ===== リセット ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  -webkit-font-smoothing: antialiased;
}

/* ===== アプリラッパー ===== */
#app {
  width: 100%;
  max-width: 480px;
}

/* ===== 画面切り替え ===== */
.screen {
  display: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.38s var(--ease), transform 0.38s var(--ease);
}
.screen.active {
  display: block;
  opacity: 1;
  transform: none;
}

/* ===== カード ===== */
.card {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* カード上部のオレンジアクセントライン */
.card-accent {
  height: 4px;
  background: var(--orange);
}

.card-body {
  padding: 36px 36px 40px;
}

/* ===== 共通ボタン ===== */
.btn-primary {
  display: block;
  width: 100%;
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 16px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1em;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: background 0.18s, transform 0.14s, box-shadow 0.18s;
}
.btn-primary:hover {
  background: #E06E10;
  box-shadow: 0 4px 16px rgba(245,130,31,0.38);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: none; }

.btn-secondary {
  display: block;
  width: 100%;
  background: transparent;
  color: var(--text-mid);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 15px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.btn-secondary:hover {
  border-color: var(--orange-mid);
  color: var(--orange);
  background: var(--orange-pale);
}

/* ===================================== */
/*  タイトル画面                         */
/* ===================================== */
.title-tag {
  display: inline-block;
  background: var(--orange-light);
  color: var(--orange);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.title-heading {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: var(--text-dark);
  line-height: 1.15;
  margin-bottom: 32px;
}

.title-heading span {
  display: block;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--text-light);
  margin-top: 6px;
}

/* ルール一覧 */
.rules {
  background: var(--orange-pale);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-mid);
  font-weight: 400;
  line-height: 1.5;
}

.rule-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}

/* ===================================== */
/*  難易度選択画面                        */
/* ===================================== */
.section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--orange);
  margin-bottom: 8px;
}

.section-heading {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-dark);
  margin-bottom: 28px;
}

.difficulty-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.difficulty-btn {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 18px 20px;
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
  transition: border-color 0.18s, background 0.18s, transform 0.14s, box-shadow 0.18s;
}

.difficulty-btn:hover {
  border-color: var(--orange);
  background: var(--orange-pale);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(245,130,31,0.14);
}

.difficulty-btn:active { transform: none; }

/* 難易度インジケーター（バー3本） */
.diff-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 24px;
}

.diff-bar {
  width: 7px;
  border-radius: 3px;
  background: var(--border);
  transition: background 0.2s;
}

.difficulty-btn[data-difficulty="easy"]   .diff-bar:nth-child(1) { height: 8px;  background: var(--orange); }
.difficulty-btn[data-difficulty="easy"]   .diff-bar:nth-child(2) { height: 14px; }
.difficulty-btn[data-difficulty="easy"]   .diff-bar:nth-child(3) { height: 22px; }

.difficulty-btn[data-difficulty="normal"] .diff-bar:nth-child(1) { height: 8px;  background: var(--orange); }
.difficulty-btn[data-difficulty="normal"] .diff-bar:nth-child(2) { height: 14px; background: var(--orange); }
.difficulty-btn[data-difficulty="normal"] .diff-bar:nth-child(3) { height: 22px; }

.difficulty-btn[data-difficulty="hard"]   .diff-bar { background: var(--orange); }
.difficulty-btn[data-difficulty="hard"]   .diff-bar:nth-child(1) { height: 8px; }
.difficulty-btn[data-difficulty="hard"]   .diff-bar:nth-child(2) { height: 14px; }
.difficulty-btn[data-difficulty="hard"]   .diff-bar:nth-child(3) { height: 22px; }

.diff-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.diff-desc {
  font-size: 12px;
  font-weight: 300;
  color: var(--text-light);
  letter-spacing: 0.02em;
}

.diff-time {
  text-align: right;
}

.diff-time-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1;
  letter-spacing: -0.01em;
}

.diff-time-label {
  display: block;
  font-size: 10px;
  font-weight: 300;
  color: var(--text-light);
  letter-spacing: 0.08em;
  margin-top: 2px;
}

/* ===================================== */
/*  クイズ画面                           */
/* ===================================== */
#quiz-screen .card-body {
  padding: 28px 32px 36px;
}

/* ヘッダー行 */
.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.quiz-qnum {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--orange);
}

.quiz-score-wrap {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-light);
}

.quiz-score-wrap strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
  margin-left: 4px;
}

/* 進行ドット */
.progress-dots {
  display: flex;
  gap: 4px;
  justify-content: center;
  margin-bottom: 20px;
}

.progress-dot {
  width: 24px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.progress-dot.done    { background: var(--orange-mid); }
.progress-dot.current { background: var(--orange); }

/* タイマー */
.timer-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.timer-track {
  flex: 1;
  height: 5px;
  background: var(--border-light);
  border-radius: 3px;
  overflow: hidden;
}

#timer-bar {
  height: 100%;
  background: var(--orange);
  border-radius: 3px;
  transition: width 0.9s linear, background 0.5s;
}

#timer-count {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-dark);
  min-width: 32px;
  text-align: right;
  line-height: 1;
  letter-spacing: -0.02em;
}

/* コンボバッジ */
#combo-display {
  display: inline-block;
  background: var(--orange-light);
  color: var(--orange);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  border-radius: 6px;
  padding: 5px 14px;
  margin-bottom: 16px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.22s, transform 0.22s var(--ease);
}

#combo-display.visible {
  opacity: 1;
  transform: scale(1);
}

/* 英単語表示 */
.word-box {
  background: var(--orange-pale);
  border-radius: 12px;
  padding: 32px 20px;
  text-align: center;
  margin-bottom: 24px;
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#quiz-word {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-dark);
  line-height: 1;
}

/* 選択肢 */
#choices-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0 14px;
  min-height: 68px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dark);
  letter-spacing: 0.04em;
  cursor: pointer;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  line-height: 1.4;
}

/* A/B/C/D ラベル */
.choice-btn::before {
  content: attr(data-label);
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--border-light);
  color: var(--text-light);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.choice-btn:not(:disabled):hover {
  border-color: var(--orange-mid);
  background: var(--orange-pale);
  transform: translateY(-1px);
}

.choice-btn:not(:disabled):hover::before {
  background: var(--orange-light);
  color: var(--orange);
}

.choice-btn:disabled { cursor: default; }

/* 正解 */
.choice-btn.correct {
  border-color: var(--green);
  background: var(--green-light);
  color: var(--green);
  font-weight: 700;
}
.choice-btn.correct::before {
  background: var(--green);
  color: #fff;
}

/* 不正解 */
.choice-btn.wrong {
  border-color: var(--red);
  background: var(--red-light);
  color: var(--red);
}
.choice-btn.wrong::before {
  background: var(--red);
  color: #fff;
}

/* フィードバックバナー */
#feedback-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 480px;
  padding: 14px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 200;
  border-radius: 0;
  transition: transform 0.32s var(--ease);
  border-top: 3px solid transparent;
}

#feedback-panel.show {
  transform: translateX(-50%) translateY(0);
}

#feedback-panel.correct {
  background: var(--green-light);
  border-color: var(--green);
}

#feedback-panel.wrong {
  background: var(--red-light);
  border-color: var(--red);
}

#feedback-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

#feedback-panel.correct #feedback-title { color: var(--green); }
#feedback-panel.wrong   #feedback-title { color: var(--red); }

#feedback-sub {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-mid);
}

/* ===================================== */
/*  結果画面                             */
/* ===================================== */
#result-screen .card-body {
  padding: 40px 36px 44px;
}

.result-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--orange);
  margin-bottom: 12px;
}

.result-score-block {
  margin-bottom: 8px;
}

#final-score {
  font-size: 72px;
  font-weight: 900;
  color: var(--text-dark);
  letter-spacing: -0.04em;
  line-height: 1;
}

.result-score-unit {
  font-size: 20px;
  font-weight: 400;
  color: var(--text-light);
  margin-left: 4px;
}

#result-message {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-mid);
  letter-spacing: 0.06em;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border-light);
}

/* 詳細 */
.result-stats {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 36px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.stat-row:first-child { border-top: 1px solid var(--border-light); }

.stat-key {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-light);
  letter-spacing: 0.04em;
}

.stat-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  letter-spacing: -0.01em;
}

.result-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ===================================== */
/*  アニメーション                        */
/* ===================================== */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeUp 0.28s var(--ease) both;
}

@keyframes pop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.07); }
  70%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

.pop { animation: pop 0.42s var(--ease); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.shake { animation: shake 0.38s ease; }

/* ===================================== */
/*  レスポンシブ                          */
/* ===================================== */
@media (max-width: 440px) {
  body { padding: 16px 12px; }

  .card-body { padding: 28px 24px 32px; }

  #title-screen .card-body { padding: 28px 24px 32px; }

  .title-heading { font-size: 26px; }

  #quiz-word { font-size: 34px; }

  #final-score { font-size: 56px; }

  #choices-container { grid-template-columns: 1fr; }

  .choice-btn { min-height: 56px; }

  #feedback-panel { padding: 12px 20px; }

  .progress-dot { width: 18px; }
}
