/* ============================================================
   BASE — shared across all levels. iPad/mobile first,
   large touch targets, no hover-dependent interactions.
   ============================================================ */

:root {
  --c-english: #f97316;
  --c-math: #2563eb;
  --c-science: #16a34a;
  --c-chinese: #dc2626;
  --c-curiosity: #9333ea;
  --bg: #f6f7fb;
  --card: #ffffff;
  --ink: #1e293b;
  --ink-soft: #64748b;
  --radius: 18px;
  --shadow: 0 2px 10px rgba(30, 41, 59, .08);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: 17px; }

body {
  margin: 0;
  font-family: -apple-system, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

main, .wrap { max-width: 880px; margin: 0 auto; padding: 16px 16px 60px; }

h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.25rem; display: flex; align-items: center; gap: 8px; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  min-height: 52px;          /* big touch target */
  padding: 12px 20px;
}

/* ---------- dashboard header ---------- */
.dash-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 0 8px;
}
.dash-avatar { font-size: 2.6rem; }
.dash-sub { color: var(--ink-soft); margin: 2px 0 0; }
.switch-link, .back-link {
  margin-left: auto; color: var(--ink-soft);
  padding: 10px 14px; border-radius: 12px; background: #e8eaf2;
}
.back-link { margin-left: 0; margin-right: auto; }

/* ---------- subject sections ---------- */
.subject-section { margin-top: 26px; }
.subject-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }
.empty-note { color: var(--ink-soft); font-style: italic; }

.chapter-block { margin: 10px 0 18px; }
.chapter-title { font-size: 1.02rem; color: var(--ink-soft); margin: 8px 0; font-weight: 600; }

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.module-card {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
  min-height: 110px;
  border-top: 5px solid var(--ink-soft);
  transition: transform .12s ease;
}
.module-card:active { transform: scale(.97); }
.module-icon { font-size: 1.7rem; }
.module-title { font-weight: 700; line-height: 1.25; }
.module-meta { color: var(--ink-soft); font-size: .85rem; }

.subject-english   { border-top-color: var(--c-english); }
.subject-math      { border-top-color: var(--c-math); }
.subject-science   { border-top-color: var(--c-science); }
.subject-chinese   { border-top-color: var(--c-chinese); }
.subject-curiosity { border-top-color: var(--c-curiosity); }

.badge-new {
  position: absolute; top: 10px; right: 10px;
  background: #facc15; color: #713f12;
  font-size: .68rem; font-weight: 800;
  padding: 3px 8px; border-radius: 999px;
}

/* ---------- PIN gate + profile picker (home) ---------- */
.gate-wrap {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; padding: 24px;
  text-align: center;
}
.gate-logo { font-size: 3rem; }
.pin-dots { display: flex; gap: 14px; height: 26px; }
.pin-dot {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--ink-soft); background: transparent;
}
.pin-dot.filled { background: var(--ink); border-color: var(--ink); }
.pin-pad {
  display: grid; grid-template-columns: repeat(3, 76px); gap: 12px;
}
.pin-pad button {
  height: 76px; font-size: 1.5rem; font-weight: 700;
  background: var(--card); box-shadow: var(--shadow); border-radius: 50%;
}
.pin-error { color: #dc2626; font-weight: 700; min-height: 1.4em; }

.profile-grid { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.profile-card {
  background: var(--card); border-radius: 24px; box-shadow: var(--shadow);
  padding: 26px 34px; display: flex; flex-direction: column; gap: 8px;
  align-items: center; min-width: 170px; border: 0; cursor: pointer;
}
.profile-card:active { transform: scale(.96); }
.profile-avatar { font-size: 3.4rem; }
.profile-name { font-weight: 800; font-size: 1.2rem; }
.profile-level { color: var(--ink-soft); }

.hidden { display: none !important; }
