/* 中学生英語クイズ styles.css
   テーマ: 淡い黄色の背景＋水色＋赤のアクセント（承認済みアイコンの色味に合わせたもの） */
:root {
  --bg: #fff6d8;
  --bg-soft: #fffdf2;
  --ink: #33302a;
  --muted: #8a7f68;
  --blue: #5aa9e6;
  --blue-dark: #3d8fd1;
  --red: #e94f4f;
  --green: #3fa66a;
  --green-soft: #dff3e6;
  --yellow: #ffe9a8;
  --card: #ffffff;
  --line: #eadfc0;
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  line-height: 1.6;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, .round { font-family: "M PLUS Rounded 1c", system-ui, sans-serif; }
button { font-family: inherit; cursor: pointer; }
.app-header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: var(--yellow);
  border-bottom: 2px solid #f2d98a;
}
.app-title { font-size: 20px; margin: 0; flex: 1; text-align: center; }
.home-btn { border: none; background: #fff; border-radius: 12px; font-size: 20px; padding: 4px 10px; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.header-dice { font-size: 22px; }
.app { max-width: 720px; margin: 0 auto; padding: 16px 14px 32px; }
.app-footer { max-width: 720px; margin: 0 auto; padding: 0 14px 32px; color: var(--muted); font-size: 12px; text-align: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 2px 6px rgba(90,70,20,.06); }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card h3 { margin: 14px 0 6px; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }

/* ホーム: レベルバー */
.level-box { text-align: center; }
.level-title { font-size: 18px; font-weight: 800; }
.xp-bar { height: 14px; background: #f0e6c8; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.xp-fill { height: 100%; background: linear-gradient(90deg, var(--blue), #7cc4f5); border-radius: 999px; transition: width .4s; }

/* 項目カード */
.item-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .item-grid { grid-template-columns: 1fr 1fr; } }
.item-card { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px 12px; text-align: left; }
.item-card:active { transform: scale(.98); }
.item-num { display: inline-block; width: 30px; height: 30px; line-height: 30px; text-align: center; border-radius: 50%; background: var(--blue); color: #fff; font-weight: 800; }
.item-name { font-family: "M PLUS Rounded 1c", sans-serif; font-weight: 700; font-size: 16px; margin-top: 6px; }
.item-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-progress { font-size: 12px; margin-top: 6px; color: var(--ink); }
.badge { display: inline-block; background: var(--green-soft); color: #2c7a4b; border-radius: 999px; padding: 1px 8px; font-size: 12px; margin-left: 4px; }

/* ボタン */
.btn { display: inline-block; border: none; border-radius: 999px; padding: 10px 20px; font-size: 15px; font-weight: 700; background: var(--blue); color: #fff; box-shadow: 0 2px 0 var(--blue-dark); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.secondary { background: #fff; color: var(--ink); border: 2px solid var(--line); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; font-weight: 500; }
.btn.danger { background: var(--red); box-shadow: 0 2px 0 #c73a3a; }
.btn.big { width: 100%; padding: 13px; font-size: 17px; }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.btn-row .btn { flex: 1; min-width: 120px; }

/* セット一覧 */
.set-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.set-row.locked { opacity: .5; }
.set-row .set-name { flex: 1; font-weight: 700; }
.set-row .set-meta { font-size: 12px; color: var(--muted); }
.level-head { width: 100%; text-align: left; background: var(--yellow); border: none; border-radius: 12px; padding: 10px 12px; font-weight: 800; font-size: 15px; margin: 12px 0 8px; }
.review-entry { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: #fff8e1; border: 2px solid #f2d98a; border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.review-entry .count { margin-left: auto; font-weight: 800; color: var(--red); }
.review-entry.hall { background: #f3e8ff; border-color: #c9a8e8; }
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab { flex: 1; padding: 10px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 700; }
.tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* クイズ共通 */
.q-progress { font-size: 13px; color: var(--muted); text-align: center; margin-bottom: 8px; }
.q-box { background: var(--card); border: 2px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; font-size: 19px; font-weight: 700; margin-bottom: 12px; }
.q-box .q-ja { font-size: 20px; }
.q-box .q-en { font-size: 18px; }
.choices { display: grid; gap: 10px; }
.choice { width: 100%; text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 13px 14px; font-size: 16px; }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.wrong { border-color: var(--red); background: #fde8e8; }
.choice:disabled { opacity: 1; }
.mark { font-size: 26px; font-weight: 800; margin-right: 6px; }
.mark.ok { color: var(--red); }
.mark.ng { color: var(--red); }
.feedback { text-align: center; font-size: 18px; font-weight: 800; margin: 12px 0; min-height: 28px; }
.feedback .big-mark { font-size: 44px; display: block; line-height: 1.1; }
.correct-answer { text-align: center; font-size: 17px; margin: 6px 0; }

/* ①スペル */
.spell-display { font-size: 30px; letter-spacing: 4px; min-height: 48px; font-weight: 800; }
.spell-display .cursor { color: var(--blue); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.meaning-block { position: relative; overflow: hidden; }
.meaning-block.bounce { animation: bounceBack .45s ease; }
@keyframes bounceBack {
  0% { transform: translateX(0); }
  25% { transform: translateX(10px); }
  50% { transform: translateX(-8px); }
  75% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
.meaning-block.flash { animation: flash .45s ease; }
@keyframes flash { 0%,100% { background: #fff; } 40% { background: #ffe9a8; } }
.meaning-block.shatter { animation: shatter .45s ease forwards; }
@keyframes shatter {
  0% { opacity: 1; transform: scale(1) rotate(0); }
  35% { opacity: .9; transform: scale(1.05) rotate(1deg); }
  100% { opacity: 0; transform: scale(.72) translateY(16px) rotate(-3deg); }
}
.meaning-block.simple-fade { animation: simpleFade .4s ease forwards; }
@keyframes simpleFade { 0% { opacity: 1; } 100% { opacity: 0; transform: scale(.96); } }
.kb { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin: 12px 0; }
.kb button { padding: 11px 0; font-size: 16px; font-weight: 700; border-radius: 8px; border: 1px solid var(--line); background: #fff; text-transform: lowercase; }
.kb button.wide { grid-column: span 2; }

/* ③⑤ 並べ替え・断片 */
.token-pool { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; margin-bottom: 12px; }
.token-slot { min-width: 44px; }
.token { display: inline-block; padding: 9px 13px; border-radius: 999px; border: 2px solid var(--blue); background: #fff; font-size: 16px; font-weight: 700; }
.token.placeholder { border-color: transparent; background: transparent; color: transparent; visibility: hidden; }
.token.placed { border-color: var(--green); background: var(--green-soft); }
.assemble-frame { position: relative; border: 2px dashed var(--line); border-radius: 12px; padding: 12px; min-height: 60px; background: var(--bg-soft); }
.assemble-ghost { visibility: hidden; font-size: 17px; font-weight: 700; line-height: 1.8; }
.assemble-chips { position: absolute; inset: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-content: flex-start; }
.assemble-chips .token { cursor: pointer; }
.speak-btn { display: block; margin: 10px auto; padding: 7px 16px; border-radius: 999px; border: 1px solid var(--blue); background: #eaf4fd; color: #2a6ea8; font-size: 13px; font-weight: 700; }
.role-label { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.role-label.ok { color: var(--green); border-bottom: 3px solid var(--green); display: inline-block; }
.role-label.ng { color: var(--red); border-bottom: 3px wavy var(--red); display: inline-block; }
.chunk-options { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.chunk-options .choice { width: auto; }

/* 結果スタンプ */
.stamp { text-align: center; margin: 10px 0; }
.stamp .excellent { font-size: 22px; font-weight: 800; letter-spacing: 2px; color: var(--red); }
.stamp .big-circle { font-size: 84px; line-height: 1; color: var(--red); font-weight: 800; }
.stamp .perfect-text { font-size: 16px; font-weight: 700; color: var(--red); }
.result-score { text-align: center; font-size: 22px; font-weight: 800; }

/* 設定・引き継ぎ */
.toggle-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.toggle-row label { flex: 1; font-weight: 700; }
.toggle-row .desc { font-size: 12px; color: var(--muted); font-weight: 400; }
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: #d8cfae; border-radius: 999px; transition: .2s; }
.switch .slider:before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider:before { transform: translateX(22px); }
.code-box { background: #f4eecf; border-radius: 10px; padding: 10px; font-size: 19px; font-weight: 800; letter-spacing: 2px; text-align: center; word-break: break-all; }
input[type="text"] { width: 100%; padding: 11px 12px; font-size: 16px; border: 2px solid var(--line); border-radius: 10px; }
.review-list-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.review-list-row .q { flex: 1; }
.status-chip { font-size: 12px; border-radius: 999px; padding: 2px 8px; background: #f0e6c8; }
.status-chip.hall { background: #e6d6f5; }
.status-chip.grad { background: var(--green-soft); }
.cert-mark { color: #b8860b; font-weight: 800; }
