/* ===== English Learning Hub — styles ===== */
:root {
  --indigo: #4f46e5;
  --indigo-dark: #3730a3;
  --violet: #7c3aed;
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1e2337;
  --muted: #6b7280;
  --border: #e5e7eb;
  --good: #059669;
  --good-bg: #ecfdf5;
  --bad: #e11d48;
  --bad-bg: #fff1f2;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(30, 35, 55, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang HK", "Microsoft JhengHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 20px; }

/* ===== Header ===== */
.site-header {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { font-weight: 800; font-size: 1.05rem; color: var(--text); text-decoration: none; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 18px; }
.nav-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.95rem; padding: 6px 10px; border-radius: 8px; transition: all 0.15s; }
.nav-links a:hover { color: var(--indigo); background: #eef2ff; }

/* ===== Views ===== */
.view { display: none; padding: 32px 0 56px; animation: fadeIn 0.25s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== Hero / Home ===== */
.hero { text-align: center; padding: 26px 0 30px; }
.hero h1 { font-size: 2.3rem; letter-spacing: -0.03em; line-height: 1.15; }
.hero .grad {
  background: linear-gradient(90deg, var(--indigo), var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.hero-sub { color: var(--muted); max-width: 560px; margin: 14px auto 0; font-size: 1.02rem; }

.section-title { font-size: 1.15rem; margin: 26px 0 14px; color: var(--text); }

.modules-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.module-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; text-align: left; cursor: pointer; box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  font-family: inherit; color: var(--text);
}
.module-card:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 14px 34px rgba(30, 35, 55, 0.12); }
.module-card.active-card { border-color: var(--indigo); }
.module-card.disabled-card { opacity: 0.55; cursor: not-allowed; }
.module-icon { font-size: 1.8rem; }
.module-name { font-weight: 800; font-size: 1.05rem; }
.module-desc { font-size: 0.88rem; color: var(--muted); }
.module-badge {
  margin-top: 6px; font-size: 0.74rem; font-weight: 700; padding: 3px 10px; border-radius: 999px;
  background: #eef2ff; color: var(--indigo);
}
.disabled-card .module-badge { background: #f3f4f6; color: var(--muted); }

/* ===== Quiz module page ===== */
.module-hero { text-align: center; padding: 12px 0 8px; }
.module-hero h1 { font-size: 1.9rem; letter-spacing: -0.02em; }
.module-hero p { color: var(--muted); margin-top: 10px; font-size: 1rem; }

.quiz-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-top: 26px; }
.quiz-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.quiz-card-icon { font-size: 2.1rem; }
.quiz-card h3 { font-size: 1.2rem; }
.quiz-card p { color: var(--muted); font-size: 0.92rem; flex-grow: 1; }
.quiz-meta { font-size: 0.8rem; font-weight: 700; color: var(--indigo); background: #eef2ff; padding: 4px 10px; border-radius: 999px; align-self: flex-start; }

/* ===== Buttons ===== */
.btn {
  font-family: inherit; font-size: 0.97rem; font-weight: 700;
  padding: 12px 22px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; transition: all 0.15s; text-decoration: none; display: inline-block;
}
.btn-primary { background: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-dark); transform: translateY(-1px); }
.btn-outline { background: #fff; color: var(--indigo); border-color: var(--indigo); }
.btn-outline:hover { background: #eef2ff; }
.btn-ghost { background: transparent; color: var(--muted); padding: 8px 12px; }
.btn-ghost:hover { color: var(--text); background: #f1f2f7; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.hidden { display: none !important; }

/* ===== Quiz in progress ===== */
.quiz-topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.quiz-title { font-weight: 800; font-size: 1.05rem; }

.progress-text { font-size: 0.85rem; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.progress-track { height: 8px; background: #e8eaf1; border-radius: 999px; overflow: hidden; margin-bottom: 18px; }
.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--indigo), var(--violet));
  border-radius: 999px; transition: width 0.3s ease;
}

.quiz-note {
  font-size: 0.86rem; color: var(--muted); background: #eef2ff; border: 1px solid #dfe4ff;
  padding: 10px 14px; border-radius: 12px; margin-bottom: 18px;
}

.question-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.question-text { font-size: 1.12rem; font-weight: 700; margin-bottom: 20px; }

.option-list { display: flex; flex-direction: column; gap: 12px; }
.option-btn {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  font-family: inherit; font-size: 1rem; color: var(--text);
  background: #fff; border: 2px solid var(--border); border-radius: 12px;
  padding: 14px 16px; cursor: pointer; transition: all 0.15s;
}
.option-btn:hover { border-color: #a5b4fc; background: #fafbff; }
.option-btn .opt-letter {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  background: #f1f2f7; color: var(--muted); font-weight: 800; font-size: 0.85rem;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.option-btn.selected { border-color: var(--indigo); background: #eef2ff; }
.option-btn.selected .opt-letter { background: var(--indigo); color: #fff; }

.quiz-nav { display: flex; align-items: center; gap: 10px; margin-top: 18px; }
.quiz-nav-spacer { flex-grow: 1; }

.quiz-error { color: var(--bad); font-weight: 700; font-size: 0.9rem; margin-top: 14px; text-align: center; background: var(--bad-bg); padding: 10px; border-radius: 10px; }

/* ===== Results ===== */
.results-hero { text-align: center; padding: 10px 0 8px; }
.score-ring-wrap { position: relative; width: 150px; height: 150px; margin: 0 auto 4px; }
.score-ring { width: 150px; height: 150px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #e8eaf1; stroke-width: 12; }
.ring-fg {
  fill: none; stroke: var(--indigo); stroke-width: 12; stroke-linecap: round;
  stroke-dasharray: 326.7; stroke-dashoffset: 326.7; transition: stroke-dashoffset 1s ease;
}
.score-number {
  position: absolute; inset: 0; display: flex; align-items: baseline; justify-content: center;
  font-size: 2.6rem; font-weight: 900; padding-top: 52px;
}
.score-number small { font-size: 1.1rem; color: var(--muted); font-weight: 700; }

#score-message { font-size: 1.5rem; margin-top: 6px; letter-spacing: -0.02em; }

.stats-chips { display: flex; justify-content: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.chip { font-size: 0.88rem; font-weight: 700; padding: 7px 16px; border-radius: 999px; }
.chip-good { background: var(--good-bg); color: var(--good); }
.chip-bad { background: var(--bad-bg); color: var(--bad); }

.review-list { display: flex; flex-direction: column; gap: 14px; }
.review-item { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); border-left: 5px solid var(--good); }
.review-item.wrong { border-left-color: var(--bad); }
.review-q { font-weight: 700; margin-bottom: 10px; font-size: 0.98rem; }
.review-answer { display: flex; align-items: center; gap: 8px; font-size: 0.93rem; padding: 8px 12px; border-radius: 10px; margin-top: 6px; }
.review-answer.good { background: var(--good-bg); color: var(--good); font-weight: 700; }
.review-answer.bad { background: var(--bad-bg); color: var(--bad); font-weight: 700; }
.review-answer.correct { background: var(--good-bg); color: var(--good); font-weight: 700; }
.review-tag { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }

.results-actions { display: flex; justify-content: center; gap: 14px; margin-top: 26px; flex-wrap: wrap; }

/* ===== Footer ===== */
.site-footer { margin-top: auto; border-top: 1px solid var(--border); padding: 20px 0; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* ===== Responsive ===== */
@media (max-width: 520px) {
  .hero h1 { font-size: 1.8rem; }
  .module-hero h1 { font-size: 1.5rem; }
  .question-text { font-size: 1.02rem; }
  .btn { padding: 11px 16px; }
}