/* ==========================================================================
   國小數學學習網 — 全站樣式
   ========================================================================== */

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Microsoft JhengHei", "PingFang TC", "Heiti TC",
               "Noto Sans CJK TC", "Hiragino Sans GB", system-ui,
               -apple-system, sans-serif;
  font-size: 18px;
  line-height: 1.6;
  color: #1f2937;
  background: #fafaf9;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }

/* ---- Layout ---- */
.container { max-width: 1080px; margin: 0 auto; padding: 24px; }
header.site-header {
  background: #1e3a8a; color: #fff; padding: 16px 24px;
  display: flex; align-items: center; justify-content: space-between;
}
header.site-header h1 { font-size: 22px; margin: 0; }
header.site-header a { color: #fde68a; }

/* ==========================================================================
   首頁（index.html）
   ========================================================================== */

.search-box {
  width: 100%; padding: 12px 16px; font-size: 18px;
  border: 2px solid #d1d5db; border-radius: 8px; margin-bottom: 24px;
}
.search-box:focus { outline: none; border-color: #2563eb; }

.empty-state {
  text-align: center; padding: 80px 24px; color: #6b7280;
}
.empty-state .icon { font-size: 64px; }
.empty-state h2 { margin: 16px 0 8px; }

.grade-group { margin-bottom: 32px; }
.grade-group h2 {
  font-size: 24px; color: #1e3a8a; border-bottom: 3px solid #1e3a8a;
  padding-bottom: 8px; margin-bottom: 16px;
}
.unit-group, .subject-group { margin-bottom: 20px; }
.unit-group h3, .subject-group h3 {
  font-size: 18px; color: #4b5563; margin: 0 0 8px;
}
.concept-list { list-style: none; padding: 0; margin: 0; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 720px) {
  .concept-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .concept-list { grid-template-columns: 1fr; }
}
.concept-card .unit-tag {
  display: inline-block; margin-top: 6px; font-size: 12px;
  padding: 2px 10px; background: #e5e7eb; color: #4b5563;
  border-radius: 999px; font-weight: 500;
}
.concept-card {
  display: block; padding: 16px; background: #fff; border-radius: 12px;
  border: 1px solid #e5e7eb; transition: transform 0.1s, box-shadow 0.1s;
}
.concept-card:hover {
  transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  text-decoration: none;
}
.concept-card .icon { font-size: 32px; }
.concept-card .title { font-size: 18px; font-weight: 600; color: #1f2937;
  margin-top: 8px; display: block; }

/* 互動實驗室卡片：橘色強調，跟一般概念頁區分 */
.concept-card.is-lab { border-color: #fb923c; background: #fff7ed; }
.concept-card.is-lab:hover { box-shadow: 0 4px 12px rgba(251, 146, 60, 0.25); }
.concept-card .badge {
  display: inline-block; margin-top: 8px; font-size: 12px;
  padding: 2px 10px; background: #fb923c; color: #fff;
  border-radius: 999px; font-weight: 600;
}

/* ==========================================================================
   概念頁（_template.html 與所有 concepts/**/*.html）
   ========================================================================== */

.concept-page section.step {
  background: #fff; border-radius: 16px; padding: 24px 32px;
  margin: 24px 0; border: 1px solid #e5e7eb;
}
.concept-page .step-label {
  display: inline-block; background: #1e3a8a; color: #fff;
  padding: 4px 12px; border-radius: 999px; font-size: 14px;
  margin-bottom: 12px;
}
.concept-page h2.step-title {
  font-size: 24px; margin: 0 0 16px; color: #1e3a8a;
}

/* 動畫舞台（step 2 / step 3 共用） */
.stage {
  width: 100%; min-height: 360px; background: #f3f4f6;
  border-radius: 12px; display: flex; align-items: center;
  justify-content: center; margin: 16px 0; overflow: hidden;
}
.stage svg { max-width: 100%; height: auto; }

.stage-controls { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.btn {
  padding: 8px 16px; border: none; border-radius: 8px;
  background: #2563eb; color: #fff; font-size: 16px;
}
.btn:hover { background: #1d4ed8; }
.btn.secondary { background: #6b7280; }
.btn.secondary:hover { background: #4b5563; }
.progress {
  flex: 1; height: 8px; background: #e5e7eb; border-radius: 4px;
  overflow: hidden;
}
.progress > .bar { height: 100%; background: #2563eb; width: 0%;
  transition: width 0.2s; }

/* 練習題 */
.quiz { background: #fef3c7; border-left: 4px solid #f59e0b;
  padding: 16px; border-radius: 8px; margin: 12px 0; }
.quiz .question { font-weight: 600; margin-bottom: 8px; }
.quiz .choices { display: flex; flex-direction: column; gap: 6px; }
.quiz .choice {
  padding: 8px 12px; background: #fff; border: 1px solid #d1d5db;
  border-radius: 6px; cursor: pointer; text-align: left;
}
.quiz .choice:hover { border-color: #2563eb; }
.quiz .choice.correct { background: #dcfce7; border-color: #16a34a; }
.quiz .choice.wrong   { background: #fee2e2; border-color: #dc2626; }
.quiz .feedback { margin-top: 8px; font-weight: 600; }

/* 易錯提醒 */
.pitfall {
  background: #fee2e2; border-left: 4px solid #dc2626;
  padding: 12px 16px; border-radius: 8px; margin: 8px 0;
}

/* footer 導覽 */
footer.page-nav {
  display: flex; justify-content: space-between; padding: 16px 0;
  border-top: 1px solid #e5e7eb; margin-top: 32px;
}
