/* Ayishu — kid-friendly mobile/iPad UI */
*,*::before,*::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: 'Comic Sans MS', 'Chalkboard SE', 'Arial Rounded MT Bold', system-ui, -apple-system, sans-serif;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
  background: linear-gradient(160deg, #ffe6f0 0%, #e0f4ff 60%, #fff7d6 100%);
  min-height: 100vh;
  min-height: 100dvh;
  color: #2b2b3a;
  overscroll-behavior: none;
  touch-action: manipulation;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
img { max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { font: inherit; }
.hidden { display: none !important; }

/* Tappable word — works everywhere by default. .no-words opts an element out. */
.w {
  display: inline-block;
  cursor: pointer;
  border-radius: 6px;
  padding: 0 3px;
  margin: 0 1px;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.w:active, .w.tapped { background: #ffe9a0; transform: scale(1.05); }

/* ----- HOME ----- */
.hero {
  text-align: center; padding: 56px 20px 14px;
  position: relative;
}
.hero .hello { font-size: 22px; opacity: 0.85; }
.hero h1 { margin: 6px 0 4px; font-size: 44px; color: #6b3fa0; }
.hero h1 span { display: inline-block; animation: bob 1.5s ease-in-out infinite; }
.hero .sub { margin: 0; font-size: 18px; color: #555; }
@keyframes bob { 0%,100% {transform: translateY(0);} 50%{transform: translateY(-6px);} }

.days {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 14px 14px 80px; max-width: 720px; margin: 0 auto;
}
@media (min-width: 700px) { .days { grid-template-columns: 1fr 1fr 1fr; } }

.day-tile {
  position: relative; background: #fff; border-radius: 22px;
  padding: 18px 14px 16px; box-shadow: 0 6px 0 rgba(0,0,0,0.08), 0 12px 24px rgba(80,40,120,0.10);
  display: flex; flex-direction: column; align-items: center; min-height: 160px;
  transition: transform 0.1s;
}
.day-tile:active { transform: translateY(2px); }
.day-tile .emoji { font-size: 56px; line-height: 1; margin-bottom: 6px; }
.day-tile .day-meta { text-align: center; }
.day-tile .day-num { font-size: 14px; color: #888; }
.day-tile .day-title { font-size: 18px; font-weight: bold; color: #4a2680; }
.day-tile .progress {
  width: 100%; height: 8px; background: #efe7f7; border-radius: 99px;
  margin-top: 12px; overflow: hidden;
}
.day-tile .progress .bar { height: 100%; background: linear-gradient(90deg,#9b7ee0,#6bcfe6); transition: width 0.4s; }
.day-tile.done { background: linear-gradient(160deg,#fff7c2,#ffe9a0); }
.day-tile.done .day-title { color: #8a5a00; }
.day-tile .badge {
  position: absolute; top: -10px; right: -8px; font-size: 32px;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.2));
}
.day-tile .tile-audio {
  position: absolute; top: 8px; left: 8px;
  width: 38px; height: 38px; background: #fff;
  border-radius: 50%; display: grid; place-items: center;
  font-size: 18px; box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  cursor: pointer; z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.day-tile .tile-audio:active { transform: scale(0.92); background: #ffe9a0; }
.foot { text-align: center; padding: 10px 0 24px; color: #777; }

/* ----- LESSON ----- */
.lesson-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: rgba(255,255,255,0.7);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px);
}
.lesson-bar .back {
  font-size: 28px; width: 44px; height: 44px; display: grid; place-items: center;
  background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.lesson-bar .lbl { font-size: 18px; font-weight: bold; color: #6b3fa0; }
.lesson-bar .prog-wrap {
  flex: 1; height: 12px; background: #ece1f5; border-radius: 99px; overflow: hidden;
}
.lesson-bar .prog-wrap .bar { height: 100%; width: 0%; background: linear-gradient(90deg,#ffb84d,#ff7eb3); transition: width 0.3s; }

.stage {
  padding: 16px; display: flex; flex-direction: column; align-items: center;
  min-height: calc(100vh - 80px); justify-content: center;
}

.card {
  background: #fff; border-radius: 28px; padding: 22px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.06), 0 14px 30px rgba(80,40,120,0.12);
  width: 100%; max-width: 560px; text-align: center;
}

.big-letter {
  font-size: 180px; line-height: 1; font-weight: bold;
  color: #6b3fa0; margin: 8px 0 4px;
}
.big-emoji { font-size: 96px; }
.example { font-size: 28px; color: #555; }

.cvc-row {
  display: flex; justify-content: center; gap: 14px; margin: 12px 0;
}
.cvc-row .ltr {
  font-size: 84px; font-weight: bold; color: #6b3fa0;
  background: #f3edff; border-radius: 22px; padding: 8px 22px;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08);
  cursor: pointer;
}
.cvc-row .ltr:active { transform: translateY(2px); }

.word-big {
  font-size: 96px; font-weight: bold; color: #2b2b3a; margin: 10px 0;
}
.word-medium { font-size: 56px; font-weight: bold; color: #2b2b3a; }
.passage {
  font-size: 30px; line-height: 1.7; color: #2b2b3a;
  text-align: left; padding: 6px 4px;
}
.passage .w {
  padding: 2px 6px; margin: 2px 1px;
  border-radius: 8px;
}
.passage .w:active, .passage .w.tapped { background: #ffe9a0; }

.q-text { font-size: 26px; margin: 8px 0 14px; color: #333; }
.choices { display: flex; flex-direction: column; gap: 12px; }
.choice {
  background: #f3edff; border: none; border-radius: 18px;
  padding: 18px 16px; font-size: 24px; color: #2b2b3a;
  box-shadow: 0 4px 0 rgba(0,0,0,0.08);
  text-align: left; cursor: pointer;
}
.choice:active { transform: translateY(2px); }
.choice.correct { background: #c4f0c1; }
.choice.wrong { background: #ffd4d4; }

.btn-row { display: flex; gap: 12px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.btn {
  font-size: 22px; padding: 14px 22px; border-radius: 18px; border: none;
  background: #ddd; color: #222; box-shadow: 0 4px 0 rgba(0,0,0,0.1); cursor: pointer;
}
.btn:active { transform: translateY(2px); }
.btn.primary { background: linear-gradient(180deg, #ff8eb8, #ff5c92); color: #fff; }
.btn.success { background: linear-gradient(180deg, #6ee2a4, #2ec27e); color: #fff; }
.btn.warn { background: linear-gradient(180deg, #ffd166, #ffa94d); color: #4a2200; }
.btn.audio { background: linear-gradient(180deg, #7ec8ff, #3a99ff); color: #fff; font-size: 28px; padding: 12px 18px; border-radius: 50%; width: 60px; height: 60px; }
.btn.big { font-size: 26px; padding: 18px 28px; }

.celebrate {
  position: fixed; inset: 0; background: rgba(255,255,255,0.94);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 50; gap: 16px;
}
.celebrate .big-star { font-size: 160px; animation: pop 0.6s ease-out; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.2);} 100% { transform: scale(1);} }
.praise { font-size: 36px; color: #6b3fa0; font-weight: bold; }

.intro {
  text-align: center; padding: 12px 0;
}
.intro h2 { font-size: 32px; color: #6b3fa0; margin: 0 0 8px; }
.intro p { font-size: 20px; color: #555; margin: 0 0 12px; }
.intro .emoji { font-size: 80px; }

.start-gate {
  position: fixed; inset: 0; background: rgba(75,30,140,0.92);
  display: grid; place-items: center; color: #fff; z-index: 100;
  text-align: center; padding: 24px;
}
.start-gate h2 { font-size: 36px; margin: 0 0 8px; }
.start-gate p  { font-size: 20px; margin: 0 0 24px; opacity: 0.9; }
.start-gate .btn.primary { font-size: 30px; padding: 20px 36px; border-radius: 99px; }

/* ----- PROFILE PICKER ----- */
.profiles-page .hero h1 { color: #4a2680; }
.profile-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  padding: 14px 14px 80px; max-width: 720px; margin: 0 auto;
}
@media (min-width: 700px) { .profile-grid { grid-template-columns: 1fr 1fr 1fr; } }
.profile-tile {
  background: #fff; border-radius: 22px; padding: 18px 12px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.08), 0 12px 24px rgba(80,40,120,0.10);
  display: flex; flex-direction: column; align-items: center; min-height: 170px;
  transition: transform 0.1s;
}
.profile-tile:active { transform: translateY(2px); }
.profile-tile .avatar { font-size: 80px; line-height: 1; }
.profile-tile .pname  { font-size: 24px; font-weight: bold; color: #4a2680; margin-top: 6px; }
.profile-tile .plevel { font-size: 14px; color: #888; margin-top: 2px; }
.profile-tile.active  { background: linear-gradient(160deg,#fff7c2,#ffe9a0); }

.foot .parent-link {
  display: inline-block; margin-top: 4px; padding: 10px 20px;
  background: rgba(255,255,255,0.7); border-radius: 99px;
  color: #6b3fa0; font-weight: bold;
}

/* ----- PROFILE CHIP (top of home + lesson bar avatar) ----- */
.profile-chip {
  position: absolute; top: 14px; right: 14px; z-index: 4;
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.85); border-radius: 99px;
  padding: 6px 12px 6px 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  color: #4a2680; font-weight: bold;
}
.profile-chip .chip-avatar { font-size: 24px; }
.profile-chip .chip-name   { font-size: 15px; }
.profile-chip .chip-switch { font-size: 13px; opacity: 0.6; }

.lesson-bar .bar-avatar {
  font-size: 24px; padding: 0 6px;
}

/* ----- TEST RESULT ----- */
.test-result h2 { color: #6b3fa0; font-size: 32px; margin: 4px 0; }
.test-result .big-pct { font-size: 64px; font-weight: bold; color: #2ec27e; }
.test-result .big-meter {
  height: 16px; background: #efe7f7; border-radius: 99px; overflow: hidden;
  margin: 12px auto; max-width: 360px;
}
.test-result .big-meter .bar { height: 100%; background: linear-gradient(90deg,#9b7ee0,#6bcfe6); }
.choice.locked { opacity: 0.85; }
.choice.chosen { background: #d8f0ff; outline: 3px solid #3a99ff; }
.day-tile.test-tile { background: linear-gradient(160deg,#ffe6f0,#ffd1e6); }
.day-tile.test-tile .day-title { color: #b03060; }

.last-score { margin: 6px 0 0; font-size: 15px; color: #555; }
.last-score strong { color: #6b3fa0; }

.stickers-pill {
  display: inline-block; margin-top: 10px;
  background: linear-gradient(180deg, #ffe28a, #ffb84d);
  color: #5a3000; font-weight: bold;
  padding: 8px 16px; border-radius: 99px;
  box-shadow: 0 4px 0 #c98c2e, 0 6px 12px rgba(0,0,0,0.1);
  font-size: 16px;
  animation: stickersBob 2.4s ease-in-out infinite;
}
.stickers-pill:active { transform: translateY(2px); box-shadow: 0 2px 0 #c98c2e; }
@keyframes stickersBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-3px); }
}

/* ----- PROGRESS PAGE ----- */
.progress-page { background: linear-gradient(160deg,#f4f0fc 0%,#e9f4ff 100%); }
.prog-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: rgba(255,255,255,0.8);
  position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px);
}
.prog-header .back {
  font-size: 24px; width: 40px; height: 40px; display: grid; place-items: center;
  background: #fff; border-radius: 50%; box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.prog-header .lbl { font-size: 18px; font-weight: bold; color: #6b3fa0; }
.progress-main { padding: 14px 14px 60px; max-width: 720px; margin: 0 auto; }
.profile-card {
  background: #fff; border-radius: 20px; padding: 16px;
  box-shadow: 0 6px 18px rgba(80,40,120,0.08); margin-bottom: 14px;
}
.profile-card .profile-head { display: flex; align-items: center; gap: 12px; }
.profile-card .big-avatar { font-size: 56px; }
.profile-card .pname { font-size: 22px; font-weight: bold; color: #4a2680; }
.profile-card .plevel { font-size: 13px; color: #888; }
.profile-card h3 { margin: 16px 0 6px; font-size: 16px; color: #6b3fa0; }
.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin: 12px 0; }
.stat { background: #f6f1ff; border-radius: 14px; padding: 10px 6px; text-align: center; }
.stat .num { font-size: 22px; font-weight: bold; color: #4a2680; }
.stat .lbl { font-size: 11px; color: #888; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 6px 4px; text-align: left; border-bottom: 1px solid #eee; }
.tbl th { font-size: 12px; color: #888; font-weight: normal; }
.tbl td.pass { color: #2ec27e; font-weight: bold; }
.tbl td.mid  { color: #ffa94d; font-weight: bold; }
.tbl td.low  { color: #d04545; font-weight: bold; }
.lesson-list { padding-left: 18px; font-size: 14px; }
.lesson-list .when { color: #aaa; margin-left: 6px; font-size: 12px; }
.empty { color: #aaa; font-style: italic; }

/* ----- LISTEN MODE ----- */
.btn.listen {
  background: linear-gradient(180deg, #ff8a8a, #ff5050); color: #fff;
}
.btn.listening {
  background: linear-gradient(180deg, #ff6464, #c63939) !important; color: #fff !important;
  animation: micPulse 1s ease-in-out infinite;
}
@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(208,69,69,0.6); }
  50%      { box-shadow: 0 0 0 14px rgba(208,69,69,0); }
}
.passage .w.correct {
  background: #c4f0c1 !important; color: #1f6e3f;
  font-weight: bold; transition: background 0.2s;
}
.passage .w.wrong {
  background: #ffd4d4 !important; color: #b03030;
  text-decoration: underline wavy #d04545;
  animation: shake 0.4s;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}
.word-medium.correct, .word-big.correct { color: #2ec27e; transform: scale(1.05); }
.word-medium.wrong,  .word-big.wrong   { color: #d04545; animation: shake 0.4s; }

/* ----- MOBILE-FRIENDLINESS ----- */
@media (max-width: 480px) {
  .hero { padding-top: calc(56px + env(safe-area-inset-top)); }
  .hero h1 { font-size: 36px; }
  .hero .hello { font-size: 18px; }
  .days { grid-template-columns: 1fr; gap: 12px; padding: 12px 12px 100px; }
  .day-tile { min-height: 130px; padding: 16px 14px; flex-direction: row; gap: 14px; align-items: center; }
  .day-tile .emoji { font-size: 48px; margin: 0; }
  .day-tile .day-meta { flex: 1; text-align: left; }
  .day-tile .day-num { font-size: 13px; }
  .day-tile .day-title { font-size: 18px; }
  .day-tile .progress { margin-top: 8px; }
  .day-tile .tile-audio { top: 6px; left: auto; right: 6px; }

  .profile-grid { grid-template-columns: 1fr 1fr; gap: 10px; padding: 8px 12px 90px; }
  .profile-tile { min-height: 150px; padding: 14px 8px; }
  .profile-tile .avatar { font-size: 64px; }
  .profile-tile .pname { font-size: 20px; }

  .profile-chip {
    top: calc(10px + env(safe-area-inset-top));
    right: 10px;
    padding: 5px 10px 5px 5px;
  }
  .profile-chip .chip-avatar { font-size: 22px; }
  .profile-chip .chip-name   { font-size: 14px; }

  .stage { padding: 12px; min-height: calc(100vh - 60px); min-height: calc(100dvh - 60px); }
  .card  { padding: 16px; border-radius: 22px; }
  .big-letter { font-size: 140px; }
  .big-emoji  { font-size: 80px; }
  .word-big   { font-size: 80px; }
  .word-medium{ font-size: 48px; }
  .passage    { font-size: 24px; line-height: 1.6; }
  .cvc-row .ltr { font-size: 64px; padding: 6px 16px; }
  .q-text { font-size: 22px; }
  .choice { font-size: 20px; padding: 16px 14px; }
  .btn { font-size: 18px; padding: 12px 16px; }
  .btn.big { font-size: 22px; padding: 14px 22px; }
  .btn.audio { width: 56px; height: 56px; font-size: 24px; padding: 0; }
  .btn-row { gap: 8px; }

  .lesson-bar { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }

  .stat-row { grid-template-columns: 1fr 1fr; }
  .progress-main { padding: 10px 10px 60px; }
  .profile-card { padding: 14px; }
}

/* Stop iOS double-tap zoom on the lesson stage */
.stage, .card, .day-tile, .profile-tile, .choice, .btn { touch-action: manipulation; }

/* Bottom safe-area padding for footer */
.foot, .progress-main { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

/* ----- ADMIN ----- */
.admin-page { background: linear-gradient(160deg,#f4f0fc 0%,#e9f4ff 100%); }
.admin-main { padding: 14px 14px 80px; max-width: 720px; margin: 0 auto; }
.admin-card {
  background: #fff; border-radius: 18px; padding: 16px;
  box-shadow: 0 4px 14px rgba(80,40,120,0.08); margin-bottom: 14px;
}
.admin-card h2, .admin-card h3 { margin: 0 0 8px; color: #4a2680; font-size: 20px; }
.admin-card p, .admin-card .hint { font-size: 14px; color: #777; margin: 6px 0 10px; }
.admin-card .hint code { background: #f6f1ff; padding: 1px 4px; border-radius: 4px; }
.admin-card label { display: block; font-size: 13px; color: #555; margin-top: 10px; font-weight: bold; }
.admin-card input[type="text"],
.admin-card input[type="number"],
.admin-card input[type="password"],
.admin-card select,
.admin-card textarea {
  width: 100%; padding: 12px; border: 2px solid #e6def4; border-radius: 12px;
  font-size: 16px; margin-top: 4px; background: #fff;
  font-family: inherit;
}
.admin-card textarea { resize: vertical; min-height: 120px; }
.admin-card input:focus, .admin-card select:focus, .admin-card textarea:focus {
  outline: none; border-color: #6b3fa0;
}
.btn.block { display: block; width: 100%; text-align: center; margin-top: 10px; }
.file-input { position: absolute; left: -9999px; }
.photo-preview { margin: 12px 0; border-radius: 12px; overflow: hidden; background: #f4f0fc; }
.photo-preview img { width: 100%; max-height: 360px; object-fit: contain; display: block; }
.ocr-status { font-size: 14px; color: #6b3fa0; margin-top: 8px; padding: 8px; background: #f4f0fc; border-radius: 8px; }
.err { color: #d04545; font-weight: bold; margin: 8px 0; }
.ok-banner {
  background: linear-gradient(180deg,#c4f0c1,#a8e6a3); color: #1f6e3f;
  padding: 12px; border-radius: 12px; font-weight: bold; margin-bottom: 14px;
  text-align: center;
}
.err-banner {
  background: linear-gradient(180deg,#ffd4d4,#ffb3b3); color: #8a1f1f;
  padding: 12px; border-radius: 12px; font-weight: bold; margin-bottom: 14px;
  text-align: center;
}
.estimate-box {
  background: linear-gradient(180deg,#f4f0fc,#e9dff8);
  border-radius: 12px; padding: 12px 16px;
  margin-top: 12px; text-align: center;
  color: #4a2680; font-size: 16px;
}
.estimate-box strong { color: #6b3fa0; }

.key-status {
  background: #f4f0fc; border-radius: 12px; padding: 10px 12px;
  margin: 8px 0 12px; font-size: 15px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.key-mask { font-family: monospace; font-size: 16px; color: #4a2680; }
.ok-pill   { background: #2ec27e; color: #fff; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: bold; }
.not-set   { color: #b03060; font-weight: bold; }
.pin-input {
  font-size: 32px !important; text-align: center; letter-spacing: 12px;
  padding: 18px !important;
}
.admin-actions { margin: 14px 0; }
.admin-actions .btn { display: block; }

.q-block {
  background: #f9f5ff; border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.q-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.q-head .rm-q {
  background: transparent; border: none; color: #b03060; font-size: 18px; cursor: pointer;
}
.choice-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.choice-row input[type="radio"] { width: 22px; height: 22px; }
.choice-row input[type="text"] { flex: 1; margin-top: 0 !important; }

/* Custom-lesson grid in admin */
.custom-grid { display: flex; flex-direction: column; gap: 12px; }
.custom-card {
  background: #fff; border-radius: 14px; padding: 12px;
  display: grid; grid-template-columns: 80px 1fr; gap: 12px; align-items: center;
  box-shadow: 0 2px 8px rgba(80,40,120,0.06);
}
.custom-card .thumb {
  width: 80px; height: 80px; border-radius: 12px; overflow: hidden;
  background: #f4f0fc; display: grid; place-items: center; font-size: 40px;
}
.custom-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.custom-card .meta .title { font-size: 16px; font-weight: bold; color: #4a2680; }
.custom-card .meta .sub { font-size: 12px; color: #888; margin-top: 2px; }
.custom-card .meta .when { font-size: 11px; color: #aaa; margin-top: 2px; }
.custom-card .row-actions {
  grid-column: 1 / -1; display: flex; gap: 8px; padding-top: 8px;
  border-top: 1px solid #f0e8fa;
}
.custom-card .row-actions .btn { font-size: 14px; padding: 8px 12px; flex: 1; }
.custom-card .row-actions form { flex: 0; }

/* "From mom" tag on home tiles */
.day-tile.custom-tile { background: linear-gradient(160deg,#fff8e1,#ffe9b3); }
.day-tile.custom-tile .day-title { color: #8a5a00; }
.day-tile .from-mom {
  position: absolute; top: 8px; right: 8px;
  background: #6b3fa0; color: #fff; font-size: 10px;
  padding: 2px 8px; border-radius: 99px; font-weight: bold;
}
.hidden { display: none !important; }

/* Multi-page chapter form */
.warn-card { background: linear-gradient(180deg,#fff7d6,#ffeba3); border-left: 4px solid #c98c2e; }
.warn-card h3 { color: #8a5a00; }
.pages-wrap {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px;
}
@media (max-width: 480px) {
  .pages-wrap { grid-template-columns: repeat(2, 1fr); }
}
.page-thumb {
  position: relative; border-radius: 12px; overflow: hidden; background: #f4f0fc;
  aspect-ratio: 3 / 4;
  box-shadow: 0 2px 6px rgba(80,40,120,0.10);
}
.page-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.page-thumb .num {
  position: absolute; top: 6px; left: 6px;
  background: #6b3fa0; color: #fff; font-weight: bold;
  padding: 2px 8px; border-radius: 99px; font-size: 13px;
}
.page-thumb .rm {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,0.6); color: #fff; border: none;
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; font-size: 14px;
}

/* Preview cards */
.preview-card .page-photo {
  margin: 8px 0 12px; border-radius: 12px; overflow: hidden; background: #f4f0fc;
}
.preview-card .page-photo img { width: 100%; max-height: 420px; object-fit: contain; display: block; }
.preview-card h4 { margin: 14px 0 6px; font-size: 16px; color: #4a2680; }
.page-section {
  display: inline-block; background: #6b3fa0; color: #fff;
  font-size: 12px; padding: 2px 10px; border-radius: 99px;
  margin-left: 8px; vertical-align: middle;
}

/* ----- KID GRID in admin ----- */
.kid-grid { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 16px; }
.kid-row {
  display: grid; grid-template-columns: 56px 1fr 32px; gap: 10px; align-items: center;
  background: #fff; border-radius: 14px; padding: 10px 14px;
  box-shadow: 0 2px 6px rgba(80,40,120,0.06); text-decoration: none; color: inherit;
}
.kid-row:active { transform: translateY(1px); }
.kid-row .kavatar { font-size: 36px; text-align: center; }
.kid-row .kname  { font-weight: bold; color: #4a2680; font-size: 17px; }
.kid-row .klevel { display: block; color: #888; font-size: 12px; margin-top: 1px; }
.kid-row .kedit  { color: #aaa; font-size: 18px; text-align: right; }

/* Avatar picker grid (in edit_profile) */
.avatar-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px;
  margin: 6px 0 10px;
}
@media (max-width: 480px) { .avatar-grid { grid-template-columns: repeat(6, 1fr); } }
.ava-pick {
  position: relative; aspect-ratio: 1; display: grid; place-items: center;
  border-radius: 12px; background: #f4f0fc; font-size: 28px;
  cursor: pointer; transition: transform 0.1s;
}
.ava-pick input { position: absolute; opacity: 0; pointer-events: none; }
.ava-pick:has(input:checked),
.ava-pick.checked {
  background: linear-gradient(160deg,#fff7c2,#ffe9a0);
  box-shadow: 0 0 0 3px #ff8eb8 inset;
  transform: scale(1.08);
}

/* ----- LANDING PAGE ----- */
.landing-page {
  background: linear-gradient(160deg, #ffe6f0 0%, #e0f4ff 60%, #fff7d6 100%);
  min-height: 100vh; min-height: 100dvh;
}
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; max-width: 1100px; margin: 0 auto;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: bold; color: #4a2680; font-size: 22px; }
.brand .logo { font-size: 30px; }
.brand.small { font-size: 16px; }
.brand.small .logo { font-size: 22px; }
.cta-mini {
  background: #6b3fa0; color: #fff; padding: 8px 16px; border-radius: 99px; font-weight: bold; font-size: 14px;
}

.hero-l {
  position: relative; padding: 30px 24px 60px;
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 30px; align-items: center;
}
@media (max-width: 800px) { .hero-l { grid-template-columns: 1fr; gap: 10px; padding-bottom: 30px; } }
.hero-l h1 {
  font-size: 56px; line-height: 1.05; margin: 0 0 16px; color: #2b2b3a;
}
@media (max-width: 600px) { .hero-l h1 { font-size: 38px; } }
.hero-l .lede { font-size: 18px; line-height: 1.5; color: #444; margin: 0 0 24px; max-width: 580px; }
.hero-l .hero-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.hero-l .trust { font-size: 14px; color: #777; }
.hero-l-art {
  position: relative; height: 320px; pointer-events: none;
}
@media (max-width: 800px) { .hero-l-art { height: 180px; } }
.hero-l-art .float-icon {
  position: absolute; font-size: 64px; line-height: 1;
  animation: floatY 3s ease-in-out infinite;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.08));
}
.float-icon.i1 { top: 10%;  left: 10%;  animation-delay: 0s; }
.float-icon.i2 { top: 20%;  right: 15%; animation-delay: 0.4s; font-size: 56px; }
.float-icon.i3 { top: 55%;  left: 30%;  animation-delay: 0.8s; font-size: 52px; }
.float-icon.i4 { bottom: 5%; right: 25%; animation-delay: 1.2s; font-size: 60px; }
.float-icon.i5 { bottom: 25%; left: 55%; animation-delay: 1.6s; font-size: 48px; }
.float-icon.i6 { top: 0; right: 45%; animation-delay: 2s; font-size: 50px; }
@keyframes floatY { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-14px) rotate(3deg); } }

.features, .grades, .how, .cta-final {
  max-width: 1100px; margin: 0 auto; padding: 60px 24px;
}
.features h2, .grades h2, .how h2, .cta-final h2 {
  font-size: 36px; color: #4a2680; margin: 0 0 30px; text-align: center;
}
.features .feat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
}
@media (max-width: 900px) { .features .feat-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .features .feat-grid { grid-template-columns: 1fr; } }
.feat {
  background: #fff; border-radius: 18px; padding: 22px;
  box-shadow: 0 4px 14px rgba(80,40,120,0.06);
}
.feat .fem { font-size: 44px; line-height: 1; margin-bottom: 10px; }
.feat h3 { margin: 0 0 6px; font-size: 18px; color: #4a2680; }
.feat p  { margin: 0; color: #555; font-size: 14px; line-height: 1.5; }

.lede.center { text-align: center; max-width: 720px; margin: 0 auto 24px; }
.grade-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.grade-chips span {
  background: #fff; border-radius: 99px; padding: 8px 18px; font-weight: bold; color: #4a2680;
  box-shadow: 0 2px 6px rgba(80,40,120,0.08);
}

.steps { list-style: none; padding: 0; max-width: 720px; margin: 0 auto; }
.steps li {
  display: grid; grid-template-columns: 48px 1fr; gap: 16px; align-items: start;
  margin-bottom: 18px; font-size: 16px; line-height: 1.5; color: #444;
}
.snum {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(160deg,#ff8eb8,#ff5c92); color: #fff;
  display: grid; place-items: center; font-weight: bold; font-size: 20px;
}

.cta-final { text-align: center; }
.cta-final p { font-size: 18px; color: #555; margin: 0 0 24px; }
.cta-final .hint { font-size: 14px; color: #888; margin-top: 18px; }

.landing-foot {
  max-width: 1100px; margin: 0 auto; padding: 30px 24px;
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  border-top: 1px solid rgba(0,0,0,0.06); color: #888; font-size: 13px;
}

/* Lesson page image (kid-facing inside the lesson card) */
.lesson-page-photo {
  margin: 4px -6px 12px;
  border-radius: 16px; overflow: hidden;
  background: #f4f0fc; box-shadow: 0 2px 8px rgba(80,40,120,0.08);
}
.lesson-page-photo img { width: 100%; max-height: 60vh; object-fit: contain; display: block; }
.page-section-tag {
  display: inline-block; background: #6b3fa0; color: #fff;
  padding: 4px 12px; border-radius: 99px; font-size: 13px; font-weight: bold;
  margin-bottom: 8px;
}

/* ----- FUN: confetti, star pop, mascot, bouncy ----- */
.confetti-layer { position: fixed; inset: 0; pointer-events: none; z-index: 9999; overflow: hidden; }
.cfetti {
  position: absolute; top: -20px;
  animation-name: cfettiFall; animation-timing-function: cubic-bezier(.2,.8,.2,1);
  animation-fill-mode: forwards;
}
@keyframes cfettiFall {
  0%   { transform: translate(0,0) rotate(0deg); opacity: 1; }
  100% { transform: translate(var(--drift,0), 110vh) rotate(720deg); opacity: 0.6; }
}

.star-pop {
  position: fixed; transform: translate(-50%, -50%);
  font-size: 30px; font-weight: bold; color: #ff9800;
  text-shadow: 0 2px 4px rgba(0,0,0,0.25);
  pointer-events: none; z-index: 9998;
  animation: starPop 1.2s cubic-bezier(.2,.7,.2,1) forwards;
  white-space: nowrap;
}
@keyframes starPop {
  0%   { transform: translate(-50%,-50%) scale(0.4); opacity: 0; }
  20%  { transform: translate(-50%,-65%) scale(1.25); opacity: 1; }
  100% { transform: translate(-50%,-200%) scale(0.9); opacity: 0; }
}

/* Mascot in lesson bar */
.mascot {
  font-size: 28px; line-height: 1; padding: 0 4px;
  display: inline-block; transform-origin: center bottom;
  animation: mascotIdle 2.4s ease-in-out infinite;
}
@keyframes mascotIdle {
  0%, 100% { transform: rotate(-5deg); }
  50%      { transform: rotate(5deg) translateY(-2px); }
}
.mascot.cheer { animation: mascotCheer 0.6s ease-out; }
.mascot.sad   { animation: mascotSad 0.7s ease-out; }
.mascot.wiggle{ animation: mascotWiggle 0.5s ease-in-out; }
@keyframes mascotCheer {
  0%   { transform: scale(1) rotate(0); }
  30%  { transform: scale(1.6) rotate(-15deg) translateY(-10px); }
  60%  { transform: scale(1.4) rotate(15deg) translateY(-6px); }
  100% { transform: scale(1) rotate(0); }
}
@keyframes mascotSad {
  0%   { transform: scale(1); filter: none; }
  40%  { transform: scale(0.9) translateY(2px); filter: grayscale(0.4); }
  100% { transform: scale(1); filter: none; }
}
@keyframes mascotWiggle {
  0%, 100% { transform: rotate(0); }
  25%      { transform: rotate(-12deg); }
  75%      { transform: rotate(12deg); }
}

/* Star HUD in lesson bar */
.star-hud {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,0.85); border-radius: 99px;
  padding: 4px 10px; font-weight: bold; color: #b86b00;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  font-size: 16px; line-height: 1;
}
.star-hud .s-icon { font-size: 18px; }
.star-hud .streak-pill {
  background: linear-gradient(180deg, #ff9d4d, #ff5050); color: #fff;
  border-radius: 99px; padding: 2px 8px; font-size: 13px;
  display: inline-flex; align-items: center; gap: 2px;
  animation: streakPulse 0.7s ease-in-out infinite alternate;
}
@keyframes streakPulse {
  from { transform: scale(1); }
  to   { transform: scale(1.06); }
}

/* Reveal-correct on wrong answer */
.choice.correct-opt.show-correct {
  background: #c4f0c1 !important;
  outline: 3px solid #2ec27e; outline-offset: -3px;
  animation: revealCorrect 0.5s ease-out;
}
@keyframes revealCorrect {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Bouncy buttons */
.btn { transition: transform 0.08s, box-shadow 0.08s; }
.btn:active { transform: translateY(3px) scale(0.97); }
.btn.primary, .btn.success, .btn.warn, .btn.listen {
  animation: btnBobIn 0.5s cubic-bezier(.5,1.6,.5,1) backwards;
}
@keyframes btnBobIn {
  from { transform: scale(0.7); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Card slide-in */
.card { animation: cardSlideIn 0.45s cubic-bezier(.2,.7,.2,1) backwards; }
@keyframes cardSlideIn {
  from { transform: translateY(30px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* Tile entrance — staggered */
.day-tile, .profile-tile {
  animation: tileIn 0.5s cubic-bezier(.5,1.6,.5,1) backwards;
}
.day-tile:nth-child(1), .profile-tile:nth-child(1) { animation-delay: 0.05s; }
.day-tile:nth-child(2), .profile-tile:nth-child(2) { animation-delay: 0.10s; }
.day-tile:nth-child(3), .profile-tile:nth-child(3) { animation-delay: 0.15s; }
.day-tile:nth-child(4), .profile-tile:nth-child(4) { animation-delay: 0.20s; }
.day-tile:nth-child(5), .profile-tile:nth-child(5) { animation-delay: 0.25s; }
.day-tile:nth-child(6), .profile-tile:nth-child(6) { animation-delay: 0.30s; }
.day-tile:nth-child(7), .profile-tile:nth-child(7) { animation-delay: 0.35s; }
@keyframes tileIn {
  from { transform: translateY(20px) scale(0.85); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

/* Treasure chest reveal */
.chest-overlay {
  position: fixed; inset: 0; background: radial-gradient(circle at 50% 40%, #6b3fa0ee, #2a1144ee);
  display: grid; place-items: center; z-index: 9999; padding: 24px;
  animation: chestFadeIn 0.3s ease-out;
}
@keyframes chestFadeIn { from { opacity: 0; } to { opacity: 1; } }
.chest-overlay.closing { animation: chestFadeOut 0.3s ease-in forwards; }
@keyframes chestFadeOut { to { opacity: 0; } }
.chest-stage {
  text-align: center; color: #fff; max-width: 90vw;
  position: relative;
}
.chest-emoji {
  font-size: 140px; line-height: 1;
  transform: scale(1) rotate(0); transition: transform 0.5s cubic-bezier(.5,1.6,.5,1);
}
.chest-overlay.open .chest-emoji {
  transform: scale(1.1) rotate(-8deg);
  animation: chestShake 0.5s ease-in-out 2;
}
@keyframes chestShake {
  0%, 100% { transform: rotate(-8deg) scale(1.1); }
  25%      { transform: rotate(8deg) scale(1.15); }
  75%      { transform: rotate(-12deg) scale(1.1); }
}
.chest-sticker {
  position: absolute; left: 50%; top: 70px;
  transform: translate(-50%, 0) scale(0); opacity: 0;
  font-size: 140px; line-height: 1;
  filter: drop-shadow(0 0 16px #ffd76a) drop-shadow(0 0 32px #ffb84d);
  pointer-events: none;
  transition: transform 0.7s cubic-bezier(.4,1.8,.4,1), opacity 0.4s;
}
.chest-overlay.open .chest-sticker {
  transform: translate(-50%, -180px) scale(1.4);
  opacity: 1;
  animation: stickerSpin 1.2s ease-out 0.6s;
  transition-delay: 0.6s;
}
@keyframes stickerSpin {
  0%   { transform: translate(-50%, -120px) scale(0.5) rotate(0); }
  60%  { transform: translate(-50%, -200px) scale(1.6) rotate(360deg); }
  100% { transform: translate(-50%, -180px) scale(1.4) rotate(360deg); }
}
.chest-stage h2 { font-size: 32px; margin: 80px 0 8px; color: #fff; text-shadow: 0 2px 4px rgba(0,0,0,0.4); }
.chest-stage p  { font-size: 22px; margin: 0 0 24px; color: #ffeba0; }

/* Sticker collection grid */
.sticker-collection {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px;
  padding: 12px; max-width: 720px; margin: 0 auto;
}
@media (max-width: 480px) { .sticker-collection { grid-template-columns: repeat(4, 1fr); } }
.sticker-cell {
  background: #fff; border-radius: 16px; padding: 10px 6px;
  text-align: center; box-shadow: 0 3px 10px rgba(80,40,120,0.08);
  position: relative;
}
.sticker-cell .sem { font-size: 48px; line-height: 1; transition: transform 0.2s; }
.sticker-cell.locked .sem { filter: grayscale(1) opacity(0.25); }
.sticker-cell .snm { font-size: 12px; color: #555; margin-top: 4px; }
.sticker-cell .sct {
  position: absolute; top: 6px; right: 8px;
  background: #6b3fa0; color: #fff; border-radius: 99px;
  font-size: 11px; padding: 1px 6px;
}
.sticker-cell.unlocked .sem:hover { transform: scale(1.15) rotate(-5deg); }
.collection-summary {
  text-align: center; padding: 14px;
  font-size: 18px; color: #4a2680;
}

/* Bouncing emoji helper */
.bouncing { display: inline-block; animation: bounceLoop 1s ease-in-out infinite; }
@keyframes bounceLoop {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* Prettier start gate */
.start-gate { background: radial-gradient(circle at 30% 30%, #8a4dd4, #4a1d80); }
.start-content {
  text-align: center;
  animation: gateIn 0.6s cubic-bezier(.5,1.6,.5,1);
}
@keyframes gateIn { from { transform: scale(0.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.floating-star {
  font-size: 110px; line-height: 1;
  animation: floatStar 2s ease-in-out infinite;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,0.15));
}
@keyframes floatStar {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50%      { transform: translateY(-12px) rotate(6deg); }
}
.play-btn {
  font-size: 36px !important; padding: 22px 48px !important;
  border-radius: 99px !important;
  box-shadow: 0 8px 0 #b03b6e, 0 12px 24px rgba(0,0,0,0.2) !important;
  animation: playPulse 1.2s ease-in-out infinite;
}
@keyframes playPulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.06); }
}

@media (max-width: 480px) {
  .star-hud .s-count { font-size: 16px; }
  .star-hud { padding: 4px 8px; }
  .floating-star { font-size: 90px; }
  .play-btn { font-size: 28px !important; padding: 18px 36px !important; }
  .mascot { font-size: 24px; }
}

/* ----- SUBJECT PICKER (home) ----- */
.hero-compact { padding: 56px 20px 8px; }
.hero-compact .hello { font-size: 24px; }
.hero-compact .sub { font-size: 16px; margin: 2px 0 8px; }

.recent-stickers-row {
  display: flex; justify-content: center; gap: 8px; padding: 0 16px 8px; flex-wrap: wrap;
}
.recent-st {
  font-size: 28px; line-height: 1;
  background: rgba(255,255,255,0.7); padding: 6px 8px; border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
  animation: stickerWiggle 4s ease-in-out infinite;
}
.recent-st:nth-child(1) { animation-delay: 0s; }
.recent-st:nth-child(2) { animation-delay: 0.3s; }
.recent-st:nth-child(3) { animation-delay: 0.6s; }
.recent-st:nth-child(4) { animation-delay: 0.9s; }
.recent-st:nth-child(5) { animation-delay: 1.2s; }
@keyframes stickerWiggle {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

.subject-picker {
  padding: 14px 16px 24px; max-width: 720px; margin: 0 auto;
  display: grid; gap: 16px;
}
.subject-card-big {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: 110px 1fr 50px; align-items: center;
  gap: 16px;
  border-radius: 28px;
  padding: 20px 22px;
  min-height: 130px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.08), 0 14px 30px rgba(80,40,120,0.15);
  color: #fff;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s;
  animation: cardEnter 0.5s cubic-bezier(.5,1.6,.5,1) backwards;
}
.subject-card-big:nth-child(1) { animation-delay: 0.05s; }
.subject-card-big:nth-child(2) { animation-delay: 0.15s; }
.subject-card-big:nth-child(3) { animation-delay: 0.25s; }
@keyframes cardEnter {
  from { transform: translateY(20px) scale(0.9); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}
.subject-card-big:active {
  transform: translateY(4px) scale(0.98);
  box-shadow: 0 4px 0 rgba(0,0,0,0.08), 0 8px 18px rgba(80,40,120,0.15);
}
.subject-card-big.sub-reading { background: linear-gradient(135deg,#ff8eb8 0%,#ff5c92 100%); }
.subject-card-big.sub-math    { background: linear-gradient(135deg,#7ec8ff 0%,#3a99ff 100%); }
.subject-card-big.sub-evs     { background: linear-gradient(135deg,#82d6a0 0%,#3aa86a 100%); }

.subject-card-big .subj-emoji-lg {
  font-size: 84px; line-height: 1;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.15));
  animation: emojiBob 2.5s ease-in-out infinite;
  z-index: 1;
}
@keyframes emojiBob {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%      { transform: translateY(-6px) rotate(4deg); }
}

.subject-card-big .subj-info { z-index: 1; }
.subject-card-big h2 {
  margin: 0; font-size: 32px; color: #fff;
  text-shadow: 0 2px 0 rgba(0,0,0,0.15);
}
.subject-card-big .subj-tag {
  margin: 2px 0 8px; font-size: 14px; opacity: 0.92;
  font-weight: bold;
}
.subject-card-big .subj-stats-line {
  font-size: 13px; opacity: 0.95; margin-bottom: 6px;
}
.subject-card-big .subj-stats-line strong { font-size: 16px; }
.subject-card-big .subj-progress-bar {
  height: 8px; background: rgba(255,255,255,0.3); border-radius: 99px;
  overflow: hidden;
}
.subject-card-big .subj-progress-bar .bar {
  height: 100%; background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.6);
  transition: width 0.5s;
}
.subject-card-big .enter-cta {
  font-size: 36px; opacity: 0.85;
  display: grid; place-items: center; z-index: 1;
}

/* Floating decorative shapes inside subject cards */
.subject-card-big .deco-shape {
  position: absolute; opacity: 0.12;
  pointer-events: none;
}
.subject-card-big .deco-shape.ds1 { top: -20px; right: 80px;  width: 90px; height: 90px; animation: shapeDrift 7s ease-in-out infinite; }
.subject-card-big .deco-shape.ds2 { bottom: -30px; right: 30px; width: 80px; height: 80px; animation: shapeDrift 9s ease-in-out -2s infinite reverse; }
.subject-card-big .deco-shape.ds3 { top: 30%; right: -20px; width: 70px; height: 70px; animation: shapeDrift 8s ease-in-out -4s infinite; }
@keyframes shapeDrift {
  0%, 100% { transform: translate(0, 0) rotate(0); }
  50%      { transform: translate(-8px, -10px) rotate(180deg); }
}

@media (max-width: 480px) {
  .subject-card-big { grid-template-columns: 80px 1fr 36px; padding: 16px 18px; min-height: 110px; }
  .subject-card-big .subj-emoji-lg { font-size: 64px; }
  .subject-card-big h2 { font-size: 26px; }
  .subject-card-big .subj-tag { font-size: 13px; }
  .subject-card-big .enter-cta { font-size: 28px; }
}

/* ----- SUBJECT PAGE (one subject's chapters) ----- */
.subject-page { background: linear-gradient(160deg, #fbf7ff, #f4eefc); }
.subject-page.sub-reading { background: linear-gradient(160deg, #fff0f6, #ffe6ee); }
.subject-page.sub-math    { background: linear-gradient(160deg, #eaf3ff, #d8ecff); }
.subject-page.sub-evs     { background: linear-gradient(160deg, #eaf8ee, #d8f0e0); }

.subj-hero {
  position: relative; overflow: hidden;
  padding: 36px 24px 28px; text-align: center; color: #fff;
  border-radius: 0 0 32px 32px;
  box-shadow: 0 8px 20px rgba(80,40,120,0.12);
  margin-bottom: 14px;
}
.subj-hero.sub-reading { background: linear-gradient(135deg,#ff8eb8 0%,#ff5c92 100%); }
.subj-hero.sub-math    { background: linear-gradient(135deg,#7ec8ff 0%,#3a99ff 100%); }
.subj-hero.sub-evs     { background: linear-gradient(135deg,#82d6a0 0%,#3aa86a 100%); }

.subj-hero .back-circle {
  position: absolute; top: 14px; left: 14px;
  width: 44px; height: 44px;
  background: rgba(255,255,255,0.25); border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 22px; backdrop-filter: blur(4px);
  z-index: 2;
}

.subj-hero .subj-hero-emoji {
  font-size: 80px; line-height: 1; margin: 12px 0 8px;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.15));
  animation: emojiBob 2.5s ease-in-out infinite;
}
.subj-hero h1 {
  margin: 0; font-size: 36px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.15);
}
.subj-hero .subj-tagline {
  margin: 4px 0 14px; font-size: 16px; opacity: 0.92; font-weight: bold;
}
.subj-hero .subj-progress {
  max-width: 360px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
}
.subj-hero .progress-track {
  flex: 1; height: 12px; background: rgba(255,255,255,0.25);
  border-radius: 99px; overflow: hidden;
}
.subj-hero .progress-fill {
  height: 100%; background: #fff;
  box-shadow: 0 0 8px rgba(255,255,255,0.6);
  transition: width 0.6s;
}
.subj-hero .progress-text { font-size: 14px; font-weight: bold; }

.subj-hero .deco-shape {
  position: absolute; opacity: 0.10; pointer-events: none;
}
.subj-hero .deco-shape.ds1 { top: -30px; right: -10px;  width: 140px; height: 140px; animation: shapeDrift 8s ease-in-out infinite; }
.subj-hero .deco-shape.ds2 { bottom: -40px; left: -20px; width: 120px; height: 120px; animation: shapeDrift 10s ease-in-out -3s infinite reverse; }
.subj-hero .deco-shape.ds3 { top: 30%; left: 10%; width: 60px; height: 60px; animation: shapeDrift 6s ease-in-out -1s infinite; }
.subj-hero .deco-shape.ds4 { bottom: 30%; right: 8%; width: 70px; height: 70px; animation: shapeDrift 9s ease-in-out -5s infinite reverse; }

.empty-subject {
  text-align: center; padding: 30px 20px;
  background: #fff; border-radius: 20px; margin: 14px;
  box-shadow: 0 4px 14px rgba(80,40,120,0.06);
}
.empty-subject .emoji-big { font-size: 80px; }
.empty-subject p { color: #555; margin: 12px 0 6px; }
.empty-subject .hint { color: #999; font-size: 14px; }

/* Keep the old subjects/section styles for any pages still using them (deprecated) */
.subjects { padding: 6px 14px 80px; max-width: 720px; margin: 0 auto; }
.subj-section {
  background: rgba(255,255,255,0.55); border-radius: 22px;
  padding: 14px 12px 18px; margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(80,40,120,0.05);
}
.subj-section.sub-reading { background: linear-gradient(160deg,#fff0f6 0%,#ffe6f0 100%); }
.subj-section.sub-math    { background: linear-gradient(160deg,#e8f4ff 0%,#d6ecff 100%); }
.subj-section.sub-evs     { background: linear-gradient(160deg,#e8f8e8 0%,#d6f0d6 100%); }
.subj-title {
  margin: 4px 0 10px; font-size: 24px; color: #4a2680;
  display: flex; align-items: center; gap: 8px;
}
.subj-emoji { font-size: 30px; }

.subj-section .days {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  padding: 0;
}
@media (max-width: 480px) {
  .subj-section .days { grid-template-columns: 1fr; }
  .subj-section { padding: 12px 10px 14px; }
  .subj-title { font-size: 20px; }
}

/* ----- COUNT (Math day 1-2) — interactive tap-each-to-count ----- */
.count-display {
  transition: transform 0.2s, color 0.2s;
  color: #6b3fa0;
  text-shadow: 0 4px 0 rgba(0,0,0,0.08);
}
.count-display.pop { animation: countPop 0.25s ease-out; color: #ff5c92; }
@keyframes countPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}
.count-hint { text-align: center; color: #888; font-size: 14px; margin: 0 0 12px; }
.count-tappable {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 6px; padding: 14px 10px;
  background: linear-gradient(160deg, #fff9e6, #fff3c2);
  border-radius: 18px; margin: 6px 0 10px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.04);
}
.count-em {
  display: inline-block; font-size: 50px; line-height: 1;
  padding: 4px 6px; cursor: pointer;
  transition: transform 0.15s, filter 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.count-em:active { transform: scale(0.9); }
.count-em.tapped {
  animation: emTapPop 0.4s ease-out forwards;
  filter: drop-shadow(0 0 10px rgba(255,184,77,0.85));
}
@keyframes emTapPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.6) rotate(8deg); }
  70%  { transform: scale(1.3) rotate(-4deg); }
  100% { transform: scale(1.15) rotate(0); }
}
.count-visual {
  font-size: 56px; line-height: 1.2; letter-spacing: 4px;
  margin: 8px 0; word-break: break-all;
}
.count-name { font-size: 32px; color: #555; margin-bottom: 8px; text-transform: capitalize; }
@media (max-width: 480px) {
  .count-em { font-size: 42px; padding: 3px 4px; }
}

/* ----- QUIZ visual (Math/EVS) ----- */
.quiz-visual {
  font-size: 56px; line-height: 1.4; padding: 14px 8px;
  background: #fff7d6; border-radius: 16px; margin: 8px 0;
}
@media (max-width: 480px) {
  .quiz-visual { font-size: 42px; }
  .count-visual { font-size: 44px; letter-spacing: 2px; }
  .count-name { font-size: 26px; }
}

/* ----- PROGRESS subject mini-bars ----- */
.subj-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 8px 0 4px; }
.subj-stat { background: #f4eefb; border-radius: 12px; padding: 8px 6px; text-align: center; }
.subj-stat .lbl { font-size: 12px; color: #555; }
.subj-stat .num { font-size: 18px; font-weight: bold; color: #4a2680; }
.subj-stat .meter { height: 6px; background: #fff; border-radius: 99px; overflow: hidden; margin-top: 4px; }
.subj-stat .meter .bar { height: 100%; background: linear-gradient(90deg,#9b7ee0,#6bcfe6); }
@media (max-width: 480px) {
  .subj-stats { grid-template-columns: 1fr 1fr 1fr; }
}
