/* ==========================================================================
   style.css — 小狀元・升小一面試特訓室
   設計語言：香港小學「作業簿方格紙 + 老師紅印章」
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+TC:wght@500;700;900&family=Noto+Sans+TC:wght@400;500;700&family=Ma+Shan+Zheng&display=swap');

:root {
  /* --- 色彩：企鵝藍 + 活力黃 + 友善綠 (小小企鵝品牌) --- */
  --ink: #1e88e5;
  --ink-light: #42a5f5;
  --ink-soft: #1565c0;
  --stamp: #1e88e5;
  --stamp-dark: #1565c0;
  --gold: #ffca28;
  --gold-light: #ffd54f;
  --paper: #ffffff;
  --bg: #f3f8ff;
  --grid-line: rgba(30, 136, 229, 0.05);
  --text: #1a2b3c;
  --text-muted: #6b7c8f;
  --border: #d6e6f5;

  --radius: 18px;
  --radius-sm: 10px;
  --shadow: 0 4px 14px rgba(30, 136, 229, 0.12);
  --shadow-lift: 0 10px 24px rgba(30, 136, 229, 0.18);

  --font-display: 'Noto Sans TC', 'PingFang HK', -apple-system, 'Microsoft YaHei', sans-serif;
  --font-body: 'Noto Sans TC', 'PingFang HK', -apple-system, 'Microsoft YaHei', sans-serif;
  --font-hand: 'Ma Shan Zheng', cursive;

  --header-h: 64px;
  --tabbar-h: 60px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background-color: var(--bg);
  padding-bottom: calc(var(--tabbar-h) + 12px);
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

:focus-visible {
  outline: 3px solid var(--gold-light);
  outline-offset: 2px;
}

/* ============================== 頁首 / 導覽 ============================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--ink), var(--ink-light));
  box-shadow: 0 2px 12px rgba(30,136,229,0.25);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}

.brand__mark {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--gold-light);
  flex-shrink: 0;
  font-size: 15px;
}

.brand__text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  line-height: 1.15;
}
.brand__text small {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.02em;
}

.site-nav {
  display: none;
  gap: 4px;
}

.nav-link {
  color: rgba(255,255,255,0.78);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 20px;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.nav-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-link--active { background: var(--stamp); color: #fff; }

@media (min-width: 860px) {
  .site-nav { display: flex; }
}

/* 手機底部分頁列（App 慣用手勢） */
.tab-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  height: var(--tabbar-h);
  background: var(--paper);
  border-top: 1px solid var(--border);
  display: flex;
  box-shadow: 0 -4px 16px rgba(30,136,229,0.12);
}
@media (min-width: 860px) {
  .tab-bar { display: none; }
}
.tab-bar__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.tab-bar__item span.ico { font-size: 18px; line-height: 1; }
.tab-bar__item.nav-link--active { color: var(--stamp); background: none; border-radius: 0; }
.tab-bar__item.nav-link--active span.ico { transform: translateY(-1px); }

/* ============================== 按鈕 ============================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14.5px;
  border: 2px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }

.btn--primary { background: var(--stamp); color: #fff; box-shadow: 0 6px 16px rgba(214,67,46,0.35); }
.btn--primary:hover { background: var(--stamp-dark); }

.btn--ink { background: var(--ink); color: #fff; }
.btn--ink:hover { background: var(--ink-light); }

.btn--ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn--ghost:hover { border-color: var(--ink); }

.btn--sm { padding: 8px 16px; font-size: 13px; }
.btn--block { width: 100%; }

/* ============================== Hero ============================== */
.hero {
  position: relative;
  padding: 44px 0 36px;
  overflow: hidden;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--stamp);
  background: rgba(214,67,46,0.08);
  border: 1px solid rgba(214,67,46,0.25);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.hero__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(28px, 5.5vw, 44px);
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 14px;
}
.hero__title em {
  font-style: normal;
  color: var(--stamp);
  position: relative;
}
.hero__sub {
  font-size: 15.5px;
  color: var(--text-muted);
  max-width: 560px;
  line-height: 1.75;
  margin: 0 0 26px;
}
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }

.hero__layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: start;
}
@media (min-width: 900px) {
  .hero__layout { grid-template-columns: 1.15fr 0.85fr; }
}

/* ============================== 印章（品牌簽名元件） ============================== */
.stamp {
  --stamp-color: var(--stamp);
  width: 88px;
  height: 88px;
  border-radius: 50%;
  border: 3px solid var(--stamp-color);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--stamp-color);
  font-family: var(--font-hand);
  transform: rotate(-8deg);
  position: relative;
  mix-blend-mode: multiply;
  flex-shrink: 0;
}
.stamp::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px dashed var(--stamp-color);
  border-radius: 50%;
  opacity: 0.6;
}
.stamp__text { font-size: 20px; line-height: 1.15; padding: 0 6px; }
.stamp--gold { --stamp-color: var(--gold); }
.stamp--ink { --stamp-color: var(--ink); }
.stamp--sm { width: 56px; height: 56px; }
.stamp--sm .stamp__text { font-size: 14px; }

/* ============================== 統計卡 / 進度 ============================== */
.stat-panel {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.stat-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.stat-panel__head h3 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0;
  color: var(--ink);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stat-cell {
  text-align: center;
  padding: 12px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.stat-cell__value {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 22px;
  color: var(--stamp);
  display: block;
}
.stat-cell__label { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

.badge-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(181,137,43,0.10);
  border: 1px solid rgba(181,137,43,0.3);
  padding: 5px 10px;
  border-radius: 999px;
}
.badge-pill--locked { color: var(--text-muted); background: var(--bg); border-color: var(--border); opacity: 0.7; }

/* ============================== Section 共用 ============================== */
.section { padding: 34px 0; }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.section__title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(20px, 3vw, 26px);
  color: var(--ink);
  margin: 0 0 6px;
}
.section__sub { color: var(--text-muted); font-size: 14px; margin: 0; max-width: 60ch; }
.section__link { font-size: 13.5px; font-weight: 700; color: var(--stamp); white-space: nowrap; }
.section__link:hover { text-decoration: underline; }

/* ============================== 功能卡 grid ============================== */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}
.feature-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}
.feature-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.feature-card__icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  background: var(--bg);
  color: var(--ink);
}
.feature-card__title { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; color: var(--ink); margin: 0; }
.feature-card__desc { font-size: 13.5px; color: var(--text-muted); line-height: 1.6; margin: 0; flex: 1; }
.feature-card__cta { font-size: 13px; font-weight: 700; color: var(--stamp); }
.feature-card--soon { opacity: 0.62; }
.feature-card__tag {
  position: absolute; top: 14px; right: 14px;
  font-size: 10.5px; font-weight: 700; color: var(--gold);
  background: rgba(181,137,43,0.12); padding: 3px 8px; border-radius: 999px;
}

/* ============================== 每日一題卡 ============================== */
.daily-card {
  background: var(--ink);
  border-radius: var(--radius);
  padding: 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lift);
}
.daily-card::after {
  content: "";
  position: absolute;
  right: -40px; top: -40px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,169,59,0.25), transparent 70%);
}
.daily-card__eyebrow { font-size: 12px; font-weight: 700; color: var(--gold-light); letter-spacing: 0.04em; text-transform: uppercase; }
.daily-card__q { font-family: var(--font-display); font-size: 19px; line-height: 1.6; margin: 10px 0 16px; position: relative; z-index: 1; }
.daily-card__meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.14);
  color: #fff;
}
.daily-card__done { display: inline-flex; align-items: center; gap: 6px; color: var(--gold-light); font-weight: 700; font-size: 13.5px; }

/* ============================== 卡片列表（題庫 / 學校 通用） ============================== */
.card-list { display: flex; flex-direction: column; gap: 14px; }

.q-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.q-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
}
.q-card__tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.q-card__tag { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--bg); color: var(--ink-soft); }
.q-card__tag--diff1 { color: #2E7D4F; background: rgba(46,125,79,0.1); }
.q-card__tag--diff2 { color: var(--gold); background: rgba(181,137,43,0.1); }
.q-card__tag--diff3 { color: var(--stamp); background: rgba(214,67,46,0.1); }
.q-card__prompt { font-size: 15.5px; font-weight: 600; color: var(--ink); line-height: 1.55; margin: 0; }
.q-card__toggle {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  transition: transform 0.2s ease;
}
.q-card.is-open .q-card__toggle { transform: rotate(45deg); background: var(--stamp); border-color: var(--stamp); color: #fff; }

.q-card__body {
  display: none;
  padding: 0 18px 20px;
  border-top: 1px dashed var(--border);
}
.q-card.is-open .q-card__body { display: block; padding-top: 16px; }

.q-card__tip {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13.5px;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 14px;
}
.q-card__tip b { color: var(--stamp); font-family: var(--font-hand); font-size: 15px; }

.q-card__sample { font-size: 13.5px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.6; }
.q-card__sample b { color: var(--ink); }

.practice-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--border);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn--rec.is-recording { background: var(--stamp); border-color: var(--stamp); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(214,67,46,0.4); }
  50% { box-shadow: 0 0 0 8px rgba(214,67,46,0); }
}

.transcript-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: #FBF6EC;
  border: 1px dashed var(--gold);
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  color: var(--text);
  min-height: 20px;
  font-family: var(--font-hand);
  font-size: 16px;
  line-height: 1.6;
}
.transcript-box:empty::before { content: "（辨識結果會顯示喺呢度……）"; color: var(--text-muted); font-family: var(--font-body); font-size: 12.5px; }

.rating-row { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.rating-row__label { font-size: 12.5px; color: var(--text-muted); margin-right: 4px; }
.rating-star {
  font-size: 20px;
  color: var(--border);
}
.rating-star.is-active { color: var(--gold-light); }
.rating-btn-group { display: flex; gap: 4px; cursor: pointer; }

.done-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 700; color: #2E7D4F;
}

/* ============================== 篩選列 ============================== */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.filter-chip {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--paper);
  color: var(--text-muted);
}
.filter-chip.is-active { background: var(--ink); border-color: var(--ink); color: #fff; }

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  margin-bottom: 18px;
}
.search-box input {
  border: none; outline: none; font-size: 14px; width: 100%;
  font-family: inherit; background: transparent; color: var(--text);
}

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-muted); }

/* ============================== 學校卡片 ============================== */
.school-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.school-card__top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.school-card__name { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--ink); margin: 0 0 2px; }
.school-card__name-en { font-size: 12px; color: var(--text-muted); }
.school-card__meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.meta-chip { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--bg); color: var(--ink-soft); }

.school-card__unverified {
  font-size: 12px;
  color: var(--stamp-dark);
  background: rgba(214,67,46,0.08);
  border: 1px solid rgba(214,67,46,0.25);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 12px;
}

.highlight-list { margin: 0 0 16px; padding-left: 18px; font-size: 13.5px; color: var(--text); line-height: 1.7; }
.highlight-list li { margin-bottom: 4px; }

.round-list { display: flex; flex-direction: column; gap: 8px; }
.round-item { background: var(--bg); border-radius: var(--radius-sm); padding: 10px 12px; }
.round-item__title { font-size: 13px; font-weight: 700; color: var(--ink); margin-bottom: 2px; }
.round-item__desc { font-size: 12.5px; color: var(--text-muted); line-height: 1.55; }

/* ============================== Disclaimer / Footer ============================== */
.disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  background: rgba(29,43,79,0.05);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  line-height: 1.7;
  margin: 26px 0;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 26px 0 40px;
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
}

/* ============================== Stub page ============================== */
.stub {
  min-height: 40vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex-direction: column;
  gap: 14px;
  padding: 60px 20px;
}
.stub h1 { font-family: var(--font-display); color: var(--ink); }
.stub p { color: var(--text-muted); max-width: 40ch; }

/* ============================== Utility ============================== */
.mt-0 { margin-top: 0; }
.flex-center { display: flex; align-items: center; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
