/* ==========================================================================
   STEMA Math Practice Platform - shared styles
   Palette: mint #b6e2d3 | coral #eb7a61 | blue #4378a5 | green #61af8e
   ========================================================================== */
:root {
  --mint: #b6e2d3;
  --coral: #eb7a61;
  --blue: #4378a5;
  --green: #61af8e;
  --cream: #fff7f5;
  --cream-border: #f0d1cb;
  --ink: #333;
  --muted: #777;
  --ok: #2e8b57;
  --bad: #d64545;
  --radius: 20px;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Nunito", "Trebuchet MS", Arial, sans-serif;
  background: var(--mint);
  color: var(--ink);
  min-height: 100vh;
}

a { color: var(--blue); }

/* ---------- top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand img { height: 40px; }
.topbar .brand span { font-weight: 800; color: var(--coral); font-size: 1.15rem; }
.topbar .user { display: flex; align-items: center; gap: 14px; font-weight: 700; }
.topbar .user .who { color: var(--blue); }

/* ---------- generic page wrapper ---------- */
.wrap { max-width: 1000px; margin: 0 auto; padding: 26px 18px 60px; }
.page-head { text-align: center; margin-bottom: 26px; }
.page-head h1 { color: var(--coral); font-size: 2rem; margin: 6px 0; }
.page-head p { color: var(--muted); margin: 0; }
.breadcrumb { text-align: center; margin-bottom: 6px; font-weight: 700; color: var(--blue); }
.breadcrumb a { text-decoration: none; }

/* ---------- buttons ---------- */
.btn {
  border: none;
  border-radius: 14px;
  padding: 13px 22px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  background: var(--green);
  color: #fff;
  transition: transform 0.12s ease, opacity 0.12s ease;
  font-family: inherit;
}
.btn:hover { transform: translateY(-2px); opacity: 0.95; }
.btn.blue { background: var(--blue); }
.btn.coral { background: var(--coral); }
.btn.ghost { background: #eee; color: var(--ink); }
.btn:disabled { background: #cccccc; cursor: not-allowed; transform: none; opacity: 0.7; }
.btn.small { padding: 8px 14px; font-size: 0.9rem; }

/* ---------- card grid (grades / topics) ---------- */
.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.tile {
  position: relative;
  background: #fff;
  border: 3px solid var(--cream-border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  justify-content: center;
}
.tile:hover { transform: translateY(-3px); border-color: var(--coral); }
.tile .tile-num { font-size: 2.2rem; font-weight: 900; color: var(--blue); line-height: 1; }
.tile .tile-title { font-weight: 800; font-size: 1rem; }
.tile .tile-sub { font-size: 0.8rem; color: var(--muted); }
.tile.done { border-color: var(--green); background: #f2fbf7; }
.tile.locked { opacity: 0.55; cursor: not-allowed; filter: grayscale(0.4); }
.tile.locked:hover { transform: none; border-color: var(--cream-border); }

/* check / progress badges */
.check {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}
.tile .score-pill {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--green);
}
.progress-bar {
  height: 8px;
  border-radius: 8px;
  background: #eee;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar > span { display: block; height: 100%; background: var(--green); }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 34px 30px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.auth-card img.logo { height: 46px; margin-bottom: 8px; }
.auth-card h1 { color: var(--coral); font-size: 1.6rem; margin: 6px 0 4px; }
.auth-card p.sub { color: var(--muted); margin: 0 0 20px; font-size: 0.95rem; }
.field { text-align: left; margin-bottom: 14px; }
.field label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 5px; color: var(--blue); }
.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 12px;
  outline: none;
  font-family: inherit;
}
.field input:focus { border-color: var(--green); }
.auth-card .btn { width: 100%; margin-top: 6px; }
.auth-switch { margin-top: 16px; font-size: 0.9rem; color: var(--muted); }
.form-msg { min-height: 20px; margin: 8px 0 2px; font-weight: 700; font-size: 0.9rem; }
.form-msg.bad { color: var(--bad); }
.form-msg.ok { color: var(--ok); }

/* ---------- practice / quiz ---------- */
.quiz-card {
  background: #fff;
  border-radius: 24px;
  box-shadow: var(--shadow);
  max-width: 720px;
  margin: 0 auto;
  padding: 26px 24px 30px;
  text-align: center;
}
.quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.quiz-top .qcount { font-weight: 800; color: var(--blue); }
.quiz-top .qscore { font-weight: 800; color: var(--green); }
.quiz-progress { height: 10px; border-radius: 10px; background: #eee; overflow: hidden; margin-bottom: 22px; }
.quiz-progress > span { display: block; height: 100%; background: var(--coral); transition: width 0.3s ease; }
.prompt { font-size: 1.5rem; font-weight: 800; color: var(--blue); margin: 10px auto 18px; line-height: 1.5; max-width: 600px; }
.prompt.big { font-size: 2.4rem; color: var(--blue); }
.visual { margin: 6px auto 20px; max-width: 460px; }
.visual svg { max-width: 100%; height: auto; }

.answer-number input {
  width: 220px; max-width: 100%;
  padding: 14px;
  font-size: 1.6rem;
  text-align: center;
  border: 3px solid #d9d9d9;
  border-radius: 16px;
  outline: none;
  font-family: inherit;
}
.answer-number input:focus { border-color: var(--green); }

.choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  max-width: 520px;
  margin: 0 auto;
}
.choice {
  border: 3px solid #e2e2e2;
  background: #fff;
  border-radius: 16px;
  padding: 16px 12px;
  font-size: 1.3rem;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease;
  font-family: inherit;
  color: var(--ink);
}
.choice:hover { transform: translateY(-2px); border-color: var(--blue); }
.choice.selected { border-color: var(--blue); background: #eef4fb; }
.choice.correct { border-color: var(--green); background: #eafaf2; }
.choice.wrong { border-color: var(--bad); background: #fdeeee; }
.choice svg { display: block; margin: 0 auto; }
.choice:disabled { cursor: default; }

.quiz-msg { min-height: 30px; margin: 18px 0 8px; font-size: 1.15rem; font-weight: 800; }
.quiz-msg.correct { color: var(--ok); }
.quiz-msg.wrong { color: var(--bad); }
.quiz-actions { margin-top: 16px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* results */
.result .emoji { font-size: 4rem; }
.result h2 { color: var(--coral); margin: 6px 0; }
.result .big-score { font-size: 2.6rem; font-weight: 900; color: var(--blue); margin: 10px 0; }
.result .verdict { font-size: 1.2rem; font-weight: 800; margin-bottom: 18px; }
.result .verdict.pass { color: var(--ok); }
.result .verdict.fail { color: var(--coral); }

.loading { text-align: center; color: var(--muted); padding: 40px; font-weight: 700; }
.hidden { display: none !important; }

@media (max-width: 600px) {
  .prompt.big { font-size: 2rem; }
  .page-head h1 { font-size: 1.6rem; }
}
