/* ============================================
   GAMBA中学理科 化学変化  全体スタイル(再構築版)
   ============================================ */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Maru Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  background: linear-gradient(135deg, #FFF8E7 0%, #FFE8F0 100%);
  color: #2C3E50;
  line-height: 1.7;
  min-height: 100vh;
}

/* ===== ナビゲーション ===== */
.topnav {
  background: linear-gradient(90deg, #FF8C42 0%, #FFA94D 100%);
  color: white;
  padding: 12px 24px;
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topnav .brand { font-size: 18px; }
.topnav .sep { opacity: 0.5; }
.topnav a {
  color: white;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.2s;
}
.topnav a:hover { background: rgba(255,255,255,0.2); }

.wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 16px;
}

/* ===== ヒーロー ===== */
.hero {
  background: white;
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  border-left: 6px solid #FF8C42;
}
.hero .crumb {
  color: #FF8C42;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 8px;
}
.hero h1 {
  font-size: 28px;
  margin: 0 0 12px;
  color: #2C3E50;
}
.hero .stars { color: #FFB400; font-size: 22px; margin-left: 12px; }
.hero .sub { color: #555; font-size: 15px; margin: 0; }

/* ===== 単元(Unit) ===== */
.unit {
  background: white;
  border-radius: 16px;
  padding: 20px 24px;
  margin: 24px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border: 2px solid #FFE0B2;
}
.unit-title {
  background: linear-gradient(90deg, #4FC3F7 0%, #29B6F6 100%);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: bold;
  font-size: 18px;
  margin: -20px -24px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.unit-title .num {
  background: white;
  color: #29B6F6;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: bold;
}

/* ===== ステージ ===== */
.stage {
  margin: 18px 0;
}
.stage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.stage-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.stage-label {
  display: inline-block;
  font-weight: bold;
  font-size: 14px;
  padding: 4px 14px;
  border-radius: 16px;
}
.stage-label.read    { background: #FFF3E0; color: #E67838; border: 2px solid #FFB74D; }
.stage-label.challenge { background: #E8F5E9; color: #388E3C; border: 2px solid #66BB6A; }
.stage-label.minitest  { background: #E3F2FD; color: #1976D2; border: 2px solid #42A5F5; }

/* ===== 説明文(読む/聞く) ===== */
.read-box {
  background: #FFFDF5;
  border-radius: 10px;
  padding: 14px 18px;
  border-left: 4px solid #FFB74D;
  position: relative;
}
.read-box p { margin: 0 0 10px; }
.read-box p:last-child { margin-bottom: 0; }

/* 音声ボタン */
.audio-btn {
  background: #9C27B0;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 18px;
  font-weight: bold;
  cursor: pointer;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
}
.audio-btn:hover { background: #7B1FA2; }
.audio-btn:active { transform: scale(0.95); }
.audio-btn .ico { font-size: 14px; }

/* 図 */
.figure {
  background: white;
  text-align: center;
  margin: 14px 0;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #FFB74D;
}
.figure img {
  max-width: 100%;
  max-height: 280px;
  height: auto;
}
.figure .caption {
  margin-top: 6px;
  font-size: 13px;
  color: #777;
}

/* ===== 図+説明表(横並び/レスポンシブ) ===== */
.fig-with-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0;
  align-items: start;
}
.fig-with-table .figure {
  margin: 0;
}
.fig-side {
  background: #FFFDF5;
  border: 2px solid #FFB74D;
  border-radius: 10px;
  padding: 12px 14px;
}
.fig-side .fig-side-title {
  font-weight: bold;
  color: #E67838;
  font-size: 14px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 2px solid #FFB74D;
}
.fig-side dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  align-items: start;
}
.fig-side dt {
  font-weight: bold;
  background: #FF8C42;
  color: white;
  padding: 2px 10px;
  border-radius: 14px;
  text-align: center;
  font-size: 14px;
  min-width: 30px;
}
.fig-side dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
}
.fig-side dd .term {
  font-weight: bold;
  color: #C0392B;
}
/* スマホでは縦積みに */
@media (max-width: 600px) {
  .fig-with-table {
    grid-template-columns: 1fr;
  }
}

/* キーワード */
.kw {
  background: #FFE082;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: bold;
  color: #2C3E50;
}

/* チャレンジ対象キーワード(通常時はキーワードと同じ見た目、チャレンジ時に空欄化) */
.kw-blank {
  background: #FFE082;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: bold;
  color: #2C3E50;
  border-bottom: 2px dashed #FF8C42;
}

/* 説明文がチャレンジモードに入っているときの強調 */
.read-box.challenge-mode {
  background: #FFFAE0;
  border-left-color: #FF8C42;
  border-left-width: 6px;
  position: relative;
}
.read-box.challenge-mode::before {
  content: "🎯 チャレンジ中:語群から選んで空欄を埋めよう!";
  display: block;
  background: #FF8C42;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 10px;
}

/* ===== 比較表 ===== */
.tbl {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
  font-size: 14px;
}
.tbl thead th {
  background: #4FC3F7;
  color: white;
  padding: 10px 12px;
  text-align: center;
  font-weight: bold;
  border: 1px solid #29B6F6;
}
.tbl tbody th, .tbl tbody td {
  padding: 10px 12px;
  border: 1px solid #E0E0E0;
  text-align: center;
}
.tbl tbody tr:first-child td:first-child,
.tbl tbody tr td:first-child {
  background: #FFF3E0;
  color: #E67838;
  font-weight: bold;
  text-align: left;
}
.tbl small { color: #888; font-size: 12px; }

/* ===== ★覚えようボックス ===== */
.point-box {
  background: linear-gradient(135deg, #FFF9C4 0%, #FFF59D 100%);
  border: 3px solid #FFB300;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 14px 0;
}
.point-box .label {
  display: inline-block;
  background: #FFB300;
  color: white;
  padding: 3px 14px;
  border-radius: 16px;
  font-weight: bold;
  font-size: 13px;
  margin-bottom: 8px;
}
.point-box ul { margin: 6px 0 0; padding-left: 20px; }
.point-box li { margin-bottom: 4px; font-weight: bold; }

/* ===== チャレンジ(セクションごと) ===== */
.challenge {
  background: #F1F8E9;
  border: 2px solid #66BB6A;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 14px 0;
}
.challenge-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.challenge-head .title {
  font-weight: bold;
  color: #2E7D32;
  font-size: 15px;
}
.challenge-head .ctrls {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.challenge-timer {
  background: white;
  padding: 4px 10px;
  border-radius: 14px;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 14px;
  color: #C0392B;
  border: 2px solid #66BB6A;
  min-width: 70px;
  text-align: center;
}
.ch-btn {
  background: white;
  border: 2px solid #66BB6A;
  color: #2E7D32;
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 13px;
  transition: all 0.2s;
}
.ch-btn:hover { background: #66BB6A; color: white; }
.ch-btn:active { transform: scale(0.95); }
.ch-btn.start {
  background: #66BB6A;
  color: white;
}
.ch-btn.start:hover { background: #4CAF50; }

.challenge-body {
  background: white;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 2.2;
}

/* 空欄 */
.blank-q {
  display: inline-block;
  background: #FFE082;
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: bold;
  color: #2C3E50;
  border-bottom: 2px solid #FF8C42;
}
.blank-slot {
  display: inline-block;
  min-width: 80px;
  padding: 2px 10px;
  background: #FFFDE7;
  border: 2px dashed #FF8C42;
  border-radius: 6px;
  text-align: center;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
  color: #2C3E50;
}
.blank-slot:empty::before {
  content: "ここ";
  color: #BBB;
  font-weight: normal;
  font-size: 12px;
}
.blank-slot.filled {
  background: #C8E6C9;
  border: 2px solid #4CAF50;
}
.blank-slot.correct {
  background: #4CAF50;
  color: white;
  border: 2px solid #2E7D32;
  animation: bounce 0.4s;
}
.blank-slot.wrong {
  background: #FFCDD2;
  border: 2px solid #C62828;
  animation: shake 0.4s;
}
@keyframes bounce {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* 語群(画面下部に固定表示) */
.word-bank-inline {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #FFF3E0;
  border-top: 3px solid #FF8C42;
  padding: 12px 16px;
  margin: 0;
  z-index: 90;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
  max-height: 35vh;
  overflow-y: auto;
}
/* 手本表示中は語群を非表示にして、その分閉じる帯を表示 */
body.example-showing .word-bank-inline { display: none !important; }

/* 手本モード:空欄に正答が入った見た目(緑) */
.blank-slot.example-mode {
  background: #4CAF50;
  color: white;
  border: 2px solid #2E7D32;
  cursor: default;
}
.blank-slot.example-mode::before { content: ""; }

/* 説明文ボックスが手本表示中の状態 */
.read-box.example-showing {
  background: #F1F8E9;
  border-left-color: #4CAF50;
  border-left-width: 6px;
  position: relative;
}
.read-box.example-showing::before {
  content: "📖 手本(正答)を表示中";
  display: block;
  background: #4CAF50;
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 10px;
}

/* 手本を閉じる帯(画面下部) */
.example-close-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #4CAF50;
  color: white;
  padding: 12px 16px;
  z-index: 95;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.2);
  text-align: center;
}
.example-close-bar.show { display: block; }
.example-close-bar .ecb-msg {
  font-weight: bold;
  font-size: 14px;
  margin-bottom: 10px;
}
.example-close-bar .ecb-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.example-close-bar .ecb-btn {
  background: white;
  color: #2E7D32;
  border: none;
  padding: 10px 20px;
  border-radius: 22px;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}
.example-close-bar .ecb-btn:hover {
  background: #E8F5E9;
  transform: translateY(-2px);
}
.example-close-bar .ecb-btn.primary {
  background: #FFC107;
  color: #2C3E50;
  font-size: 15px;
  padding: 10px 24px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.example-close-bar .ecb-btn.primary:hover {
  background: #FFB300;
}
.word-bank-inline.show { display: block; }
.wb-title {
  font-weight: bold;
  font-size: 13px;
  color: #FF8C42;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.wb-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}
.wb-word {
  background: #FFE082;
  border: 2px solid #FF8C42;
  color: #2C3E50;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 15px;
}
.wb-word:hover {
  background: #FFB300;
  color: white;
}
.wb-word.selected {
  background: #FF8C42;
  color: white;
  transform: scale(1.1);
  box-shadow: 0 4px 10px rgba(255,140,66,0.6);
}
.wb-word.used { display: none; }

/* チャレンジ中は本文の余白を確保(語群分) */
body.challenge-active {
  padding-bottom: 200px;
}

/* 手本モーダル */
.example-modal {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  justify-content: center;
  align-items: center;
}
.example-modal.show { display: flex; }
.example-content {
  background: white;
  border-radius: 14px;
  padding: 20px 24px;
  max-width: 90%;
  max-height: 80vh;
  overflow-y: auto;
  border: 4px solid #4CAF50;
}
.example-content h3 { color: #4CAF50; margin: 0 0 10px; }
.example-close {
  background: #4CAF50;
  color: white;
  border: none;
  padding: 8px 24px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 10px;
}

/* ===== ミニテスト(○×) ===== */
.minitest-block {
  background: #E3F2FD;
  border: 2px solid #42A5F5;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 14px 0;
}
.minitest-block .mt-block-title {
  font-weight: bold;
  color: #1976D2;
  font-size: 15px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.minitest-block .minitest {
  background: white;
  border: 2px solid #BBDEFB;
  border-left: 5px solid #42A5F5;
  margin: 10px 0;
  padding: 12px 14px;
}
.minitest-block .minitest:first-child { margin-top: 0; }
.mt-block-result {
  display: none;
  text-align: center;
  font-size: 16px;
  margin-top: 12px;
  padding: 10px;
  background: white;
  border-radius: 8px;
  border: 2px solid #FFB300;
}
.mt-block-reset {
  display: none;
  background: #2196F3;
  color: white;
  border: none;
  padding: 6px 16px;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  font-size: 13px;
  margin: 8px auto 0;
}

.minitest {
  background: #E3F2FD;
  border: 2px solid #42A5F5;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 14px 0;
}
.mt-stem {
  background: white;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: bold;
  margin-bottom: 10px;
}
.mt-num {
  display: inline-block;
  background: #2196F3;
  color: white;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: bold;
  margin-right: 8px;
}
.mt-choices {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}
.mt-c {
  background: white;
  border: 2px solid #2196F3;
  color: #2196F3;
  padding: 6px 22px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 16px;
  transition: all 0.15s;
}
.mt-c:hover { background: #E3F2FD; }
.mt-c.selected { background: #2196F3; color: white; }
.mt-c.correct {
  background: #4CAF50; border-color: #2E7D32; color: white;
}
.mt-c.wrong {
  background: #E57373; border-color: #C62828; color: white;
}
.mt-exp {
  display: none;
  background: #FFF9C4;
  padding: 8px 12px;
  border-radius: 6px;
  margin-top: 6px;
  font-size: 14px;
}
.mt-exp.show { display: block; }
.mt-result {
  text-align: center;
  font-weight: bold;
  font-size: 16px;
  margin-top: 10px;
  color: #1976D2;
}

/* ===== 4択(練習問題ページ用) ===== */
.q4 {
  background: white;
  border-radius: 12px;
  padding: 18px 22px;
  margin: 16px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  border-left: 5px solid #4CAF50;
}
.q4-stem {
  font-weight: bold;
  margin-bottom: 12px;
  font-size: 16px;
}
.q4-num {
  display: inline-block;
  background: #4CAF50;
  color: white;
  padding: 3px 12px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: bold;
  margin-right: 8px;
}
.q4-choices {
  display: grid;
  gap: 8px;
}
.q4-c {
  background: #F1F8E9;
  border: 2px solid #C5E1A5;
  color: #2C3E50;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  text-align: left;
  font-size: 15px;
  transition: all 0.15s;
}
.q4-c:hover {
  background: #DCEDC8;
  border-color: #66BB6A;
}
.q4-c.selected {
  background: #66BB6A;
  border-color: #388E3C;
  color: white;
}
.q4-c.correct {
  background: #4CAF50;
  border-color: #2E7D32;
  color: white;
}
.q4-c.wrong {
  background: #FFCDD2;
  border-color: #C62828;
  color: #C62828;
}
.q4-exp {
  display: none;
  background: #FFF9C4;
  padding: 10px 14px;
  border-radius: 6px;
  margin-top: 10px;
  font-size: 14px;
}
.q4-exp.show { display: block; }

/* ===== 進捗バー ===== */
.progress {
  background: #FFF3E0;
  padding: 10px 14px;
  border-radius: 10px;
  margin: 16px 0;
  text-align: center;
  font-weight: bold;
  color: #E67838;
  border: 1px dashed #FFB74D;
}

/* ===== ナビ次のページ ===== */
.next-actions {
  background: linear-gradient(135deg, #FFE0B5 0%, #FFCC80 100%);
  border-radius: 14px;
  padding: 20px 24px;
  margin: 24px 0;
  text-align: center;
}
.next-actions h3 {
  margin: 0 0 12px;
  color: #2C3E50;
}
.next-actions .links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}
.next-actions a {
  background: white;
  color: #FF8C42;
  padding: 10px 20px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: bold;
  border: 2px solid #FF8C42;
  transition: all 0.2s;
}
.next-actions a:hover {
  background: #FF8C42;
  color: white;
}

/* ページナビ */
.pagenav {
  display: flex;
  justify-content: space-between;
  margin: 32px 0;
  gap: 12px;
}
.pagenav a {
  flex: 1;
  background: white;
  padding: 14px 18px;
  border-radius: 12px;
  text-decoration: none;
  color: #2C3E50;
  border: 2px solid #FF8C42;
  transition: all 0.2s;
}
.pagenav a:hover { background: #FFF3E0; }
.pagenav .label {
  display: block;
  font-size: 12px;
  color: #FF8C42;
  font-weight: bold;
}
.pagenav .title { display: block; font-weight: bold; margin-top: 4px; }
.pagenav .next { text-align: right; }

/* ===== ランキング ===== */
.ranking {
  background: linear-gradient(135deg, #FFF8E1 0%, #FFECB3 100%);
  border: 2px solid #FFB300;
  border-radius: 12px;
  padding: 14px 18px;
  margin: 16px 0;
}
.ranking h3 {
  margin: 0 0 10px;
  color: #C77800;
  font-size: 15px;
}
.ranking-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ranking-list li {
  background: white;
  padding: 6px 12px;
  margin-bottom: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.ranking-list .medal { font-size: 18px; width: 28px; }
.ranking-list .time {
  font-family: "Courier New", monospace;
  font-weight: bold;
  color: #C0392B;
  margin-left: auto;
}
.ranking-list .date { font-size: 11px; color: #999; }
.ranking-empty {
  text-align: center;
  color: #999;
  font-size: 13px;
}

/* ===== 合格モーダル ===== */
.pass-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  justify-content: center;
  align-items: center;
}
.pass-overlay.show { display: flex; }
.pass-dialog {
  background: white;
  border-radius: 20px;
  padding: 28px 36px;
  text-align: center;
  max-width: 90%;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
  animation: zoomIn 0.4s;
}
@keyframes zoomIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.pass-emoji { font-size: 56px; margin-bottom: 8px; }
.pass-dialog h2 {
  color: #FF8C42;
  margin: 0 0 8px;
  font-size: 28px;
}
.pass-time {
  display: inline-block;
  background: #FFE082;
  color: #C0392B;
  padding: 6px 18px;
  border-radius: 20px;
  font-family: "Courier New", monospace;
  font-weight: bold;
  font-size: 22px;
  margin: 10px 0;
}
.pass-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 14px;
  flex-wrap: wrap;
}
.btn {
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn.outline {
  background: white;
  border: 2px solid #FF8C42;
  color: #FF8C42;
}
.btn.outline:hover { background: #FFF3E0; }
.btn.accent {
  background: #FF8C42;
  color: white;
}
.btn.accent:hover { background: #E67838; }

/* 花吹雪 */
.confetti {
  position: fixed;
  pointer-events: none;
  z-index: 250;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
  display: none;
}
.confetti.show { display: block; }
.confetti span {
  position: absolute;
  width: 12px;
  height: 12px;
  top: -20px;
  animation: fall linear forwards;
}
@keyframes fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0.3; }
}

/* 失敗トースト */
.fail-toast {
  display: none;
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #E57373;
  color: white;
  padding: 12px 22px;
  border-radius: 30px;
  font-weight: bold;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  font-size: 14px;
}
.fail-toast.show {
  display: block;
  animation: slideDown 0.3s;
}
@keyframes slideDown {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* スマホ最適化 */
@media (max-width: 600px) {
  .wrap { padding: 12px; }
  .hero { padding: 18px 20px; }
  .hero h1 { font-size: 22px; }
  .unit { padding: 16px 18px; }
  .unit-title { margin: -16px -18px 14px; padding: 10px 14px; font-size: 15px; }
  .topnav { padding: 10px 14px; gap: 10px; font-size: 14px; }
}
