/* Star Mission — one stylesheet. Bright, high-contrast, giant targets, landscape-first. */
:root {
  --bg: #1a1040;            /* night sky */
  --bg2: #2a1b5e;
  --card: #ffffff;
  --ink: #2a2350;
  --ink-soft: #6a639a;
  --go: #ffcd2e;            /* THE interactive highlight colour (one, consistent) */
  --go-ink: #4a3400;
  --good: #3dd97c;
  --star: #ffd94a;
  --cloud: #b9c3e8;
  --purple: #8e6cf0;
  --pink: #e8538f;
  --radius: 26px;
  --shadow: 0 6px 0 rgba(0,0,0,.18);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; user-select: none; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  font-family: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", "Comic Sans MS", sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
  color: var(--ink);
  font-size: 24px;
}
#stars-bg { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bgstar { position: absolute; color: #fff; opacity: .5; animation: twinkle 3s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .15; } }
#screen { position: relative; z-index: 1; height: 100dvh; display: flex; flex-direction: column;
  align-items: center; overflow-y: auto; overflow-x: hidden; padding: 12px; -webkit-overflow-scrolling: touch; }

/* ---------- shared bits ---------- */
.topbar { width: 100%; max-width: 1100px; display: flex; justify-content: space-between; align-items: flex-start; min-height: 76px; }
.corner-btn { width: 76px; height: 76px; border-radius: 22px; border: none; font-size: 38px;
  background: rgba(255,255,255,.16); color: #fff; box-shadow: var(--shadow); cursor: pointer; }
.corner-btn:active { transform: translateY(3px); box-shadow: 0 3px 0 rgba(0,0,0,.18); }
.corner-group { display: flex; gap: 10px; }
.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; width: 100%; max-width: 860px; text-align: center; }
.bigbtn { display: block; width: 100%; max-width: 560px; margin: 14px auto 0; padding: 22px;
  font-size: 34px; font-weight: 800; font-family: inherit; border: none; border-radius: var(--radius);
  background: var(--go); color: var(--go-ink); box-shadow: 0 8px 0 #cf9d00; cursor: pointer; }
.bigbtn:active { transform: translateY(5px); box-shadow: 0 3px 0 #cf9d00; }
.bigbtn.alt { background: #efeaff; color: var(--ink); box-shadow: 0 8px 0 #c9bdf2; }
.bigbtn.alt:active { box-shadow: 0 3px 0 #c9bdf2; }
.bigbtn:disabled { filter: grayscale(.7); opacity: .6; }
.smallnote { color: var(--ink-soft); font-size: 18px; margin-top: 10px; }
h1 { font-size: 40px; margin: 8px 0; color: #fff; text-shadow: 0 3px 0 rgba(0,0,0,.3); text-align: center; }
h2 { font-size: 30px; margin: 6px 0 12px; }
.white { color: #fff; }

/* mascot */
.tara { font-size: 96px; line-height: 1; display: inline-block; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(0 4px 6px rgba(0,0,0,.35)); }
@keyframes bob { 50% { transform: translateY(-10px) rotate(-4deg); } }
.tara.small { font-size: 56px; }
.bubble { position: relative; background: var(--card); border-radius: var(--radius); padding: 18px 22px;
  font-size: 28px; font-weight: 700; max-width: 720px; margin: 10px auto; box-shadow: var(--shadow); }
.bubble:after { content: ""; position: absolute; top: -16px; left: 50%; margin-left: -14px;
  border: 14px solid transparent; border-bottom-color: var(--card); border-top: 0; }

/* ---------- home ---------- */
.home-quest { font-size: 30px; }
.subject-chip { display: inline-block; font-size: 44px; font-weight: 900; padding: 10px 26px;
  border-radius: 20px; color: #fff; margin: 8px 4px; box-shadow: var(--shadow); }
.day-counter { color: #fff; opacity: .9; font-size: 20px; margin-top: 6px; }
.liftoff { margin-top: 14px; background: none; border: none; color: #ffd; font-size: 20px;
  font-family: inherit; text-decoration: underline; cursor: pointer; }

/* ---------- session strip ---------- */
.stepstrip { display: flex; gap: 8px; justify-content: center; margin: 6px 0 12px; }
.stepstrip .st { width: 62px; height: 62px; border-radius: 50%; background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center; font-size: 30px; border: 3px solid transparent; }
.stepstrip .st.done { background: var(--good); }
.stepstrip .st.now { border-color: var(--go); background: rgba(255,255,255,.35); transform: scale(1.15); }

/* ---------- quiz ---------- */
.quiz-wrap { width: 100%; max-width: 980px; display: flex; flex-direction: column; align-items: center; flex: 1; }
.q-visual { font-size: 64px; line-height: 1.2; margin: 6px 0; text-align: center; word-spacing: 8px; }
.q-passage { background: #fff8e1; border-radius: 18px; padding: 14px 18px; font-size: 24px; max-width: 820px; text-align: left; line-height: 1.5; }
.q-prompt { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  font-size: 30px; font-weight: 800; padding: 16px 22px; margin: 8px 0 14px; max-width: 860px; text-align: center; }
.q-prompt.speaking { outline: 5px solid var(--go); }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 760px; }
.opts.two { grid-template-columns: 1fr 1fr; max-width: 560px; }
.opt { min-height: 110px; border-radius: var(--radius); border: 6px solid transparent; background: var(--card);
  box-shadow: var(--shadow); font-family: inherit; font-size: 30px; font-weight: 800; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; padding: 10px; }
.opt .oe { font-size: 54px; line-height: 1; }
.opt.sel { border-color: var(--go); background: #fff7d6; }
.opt.dim { opacity: .38; filter: grayscale(.8); }
.opt.glow { animation: glowpulse 1s ease-in-out infinite; border-color: var(--good); }
@keyframes glowpulse { 50% { transform: scale(1.06); box-shadow: 0 0 30px var(--good); } }
.opt.sparkle-hit { animation: pop .5s ease; border-color: var(--good); background: #e2ffee; }
@keyframes pop { 30% { transform: scale(1.12); } }
.confirm-btn { margin-top: 16px; width: 130px; height: 86px; font-size: 44px; border: none;
  border-radius: var(--radius); background: var(--good); color: #fff; box-shadow: 0 8px 0 #1f9a54; cursor: pointer; }
.confirm-btn:disabled { opacity: .35; }
.confirm-btn:active { transform: translateY(4px); box-shadow: 0 4px 0 #1f9a54; }
.qdots { display: flex; gap: 8px; margin: 10px 0 2px; flex-wrap: wrap; justify-content: center; }
.qdots .d { width: 18px; height: 18px; border-radius: 50%; background: rgba(255,255,255,.3); }
.qdots .d.done { background: var(--star); }
.qdots .d.now { outline: 3px solid #fff; }
.star2-frame { border: 5px dashed var(--star); border-radius: var(--radius); padding: 6px 14px; color: #fff; font-weight: 900; font-size: 22px; margin-bottom: 6px; background: rgba(255,217,74,.15); }
.sparkleburst { position: fixed; pointer-events: none; font-size: 40px; z-index: 60; animation: burst .9s ease-out forwards; }
@keyframes burst { 0% { transform: scale(.4); opacity: 1; } 100% { transform: scale(1.8) translateY(-70px); opacity: 0; } }

/* ---------- wiggle ---------- */
.wiggle-num { font-size: 130px; color: #fff; font-weight: 900; text-shadow: 0 5px 0 rgba(0,0,0,.3); }
.wiggle-tara { font-size: 110px; animation: jump .7s ease-in-out infinite; display: inline-block; }
@keyframes jump { 40% { transform: translateY(-45px); } }

/* ---------- star time / celebrations ---------- */
.bigstar { font-size: 150px; animation: starspin 1.2s ease; display: inline-block; }
@keyframes starspin { 0% { transform: scale(0) rotate(-360deg); } 70% { transform: scale(1.25); } }
.confetti { position: fixed; top: -30px; font-size: 30px; z-index: 55; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }
.sticker-reveal { font-size: 120px; animation: starspin 1s ease; display: inline-block; }

/* ---------- map ---------- */
.map-wrap { width: 100%; max-width: 900px; }
.stage-head { color: #fff; font-size: 22px; font-weight: 900; margin: 18px 0 6px; opacity: .9; }
.week-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.day-node { width: 64px; height: 64px; border-radius: 50%; background: rgba(255,255,255,.12);
  display: flex; align-items: center; justify-content: center; font-size: 30px; position: relative; border: 3px solid transparent; }
.day-node.star { background: rgba(255,217,74,.25); }
.day-node.today { border-color: var(--go); animation: glowpulse 1.4s infinite; }
.day-node .dnum { position: absolute; bottom: -4px; right: -2px; font-size: 12px; color: #fff; opacity: .7; }
.day-node.exam { width: 84px; height: 84px; font-size: 44px; background: rgba(142,108,240,.35); }
.day-node.exam.got { background: var(--purple); }

/* ---------- sticker book ---------- */
.stick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px,1fr)); gap: 14px; width: 100%; max-width: 900px; }
.stick { background: var(--card); border-radius: 20px; padding: 10px; text-align: center; box-shadow: var(--shadow); border: none; font-family: inherit; cursor: pointer; }
.stick .se { font-size: 56px; }
.stick .sl { font-size: 15px; color: var(--ink-soft); }

/* ---------- OMR / mock ---------- */
.omr { display: flex; gap: 10px; align-items: center; background: #fdf6df; border: 3px solid #d8c98e;
  border-radius: 16px; padding: 8px 14px; margin-top: 12px; }
.omr .qno { font-weight: 900; font-size: 22px; }
.omr-bub { width: 52px; height: 52px; border-radius: 50%; border: 4px solid var(--ink); background: #fff;
  font-size: 20px; font-weight: 800; font-family: inherit; color: var(--ink); cursor: pointer; }
.omr-bub.filled { background: var(--ink); color: #fff; }
.omr-bub.hintglow { animation: glowpulse 1s infinite; }
.sun-timer { height: 20px; width: 100%; max-width: 500px; background: rgba(255,255,255,.2); border-radius: 10px; overflow: hidden; margin: 6px auto; }
.sun-timer .fill { height: 100%; background: linear-gradient(90deg,#ffd94a,#ff9a3d); border-radius: 10px; transition: width 10s linear; }

/* ---------- parent ---------- */
.parent-wrap { background: #f4f2ff; border-radius: var(--radius); width: 100%; max-width: 1000px;
  padding: 16px; color: var(--ink); font-size: 18px; user-select: text; }
.ptabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ptab { font-family: inherit; font-size: 17px; font-weight: 700; border: none; border-radius: 12px;
  padding: 10px 16px; background: #ddd8f5; cursor: pointer; }
.ptab.on { background: var(--purple); color: #fff; }
.pcard { background: #fff; border-radius: 16px; padding: 14px; margin-bottom: 12px; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.pcard h3 { margin: 0 0 8px; font-size: 20px; }
table.ptable { border-collapse: collapse; width: 100%; font-size: 16px; }
.ptable th, .ptable td { border: 1px solid #e3def7; padding: 6px 8px; text-align: left; }
.acc-strip { display: flex; gap: 3px; margin: 3px 0; flex-wrap: wrap; }
.acc-cell { width: 26px; height: 20px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #fff; }
.pbtn { font-family: inherit; font-size: 16px; font-weight: 700; border: none; border-radius: 10px;
  padding: 9px 14px; background: var(--purple); color: #fff; cursor: pointer; margin: 3px; }
.pbtn.warn { background: #d9534f; }
.pbtn.soft { background: #ddd8f5; color: var(--ink); }
input.pinput, select.pinput { font-family: inherit; font-size: 16px; padding: 8px; border-radius: 10px; border: 2px solid #ddd8f5; }
.cal-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.cal-cell { border-radius: 10px; padding: 4px; min-height: 62px; font-size: 12px; background: #fff; border: 2px solid #eee9ff; cursor: pointer; }
.cal-cell .cd { font-weight: 900; font-size: 14px; }
.cal-cell.today { border-color: var(--go); }
.cal-cell .tag { display: inline-block; border-radius: 6px; padding: 1px 5px; color: #fff; font-weight: 700; font-size: 11px; margin: 1px 1px 0 0; }
.gate-pad { display: flex; gap: 14px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.gate-num { width: 84px; height: 84px; font-size: 34px; font-weight: 900; border-radius: 20px; border: none;
  background: var(--card); box-shadow: var(--shadow); font-family: inherit; cursor: pointer; }

/* moon mode */
.moonscreen { text-align: center; color: #fff; }
.moonscreen .bubble { color: var(--ink); }
.moonscreen .moon { font-size: 130px; display: inline-block; animation: bob 4s ease-in-out infinite; }

/* ---------- iPad landscape: question left, answers right, nothing below the fold ---------- */
.q-left, .q-right { width: 100%; display: flex; flex-direction: column; align-items: center; }
@media (orientation: landscape) and (min-width: 900px) {
  .quiz-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; align-items: start;
    max-width: 1200px; flex: 1; }
  .quiz-wrap > .qdots { grid-column: 1 / -1; justify-self: center; }
  .q-left { grid-column: 1; position: sticky; top: 0; }
  .q-right { grid-column: 2; }
  .q-visual { font-size: 56px; }
  .q-prompt { font-size: 28px; }
  .opts { max-width: 640px; }
  .opt { min-height: 100px; }
  .q-passage { font-size: 21px; }
}

/* ---------- scratch pad (Apple Pencil rough work) ---------- */
#scratch-panel[hidden] { display: none; }
#scratch-panel { position: fixed; z-index: 70; background: #fffdf4; border: 4px solid var(--go);
  border-radius: 22px 22px 0 0; box-shadow: 0 -6px 30px rgba(0,0,0,.35); display: flex; flex-direction: column;
  bottom: 0; left: 0; right: 0; height: 55dvh; }
#scratch-panel.docked-right { top: 0; bottom: 0; left: auto; right: 0; width: 48vw; height: auto;
  border-radius: 22px 0 0 22px; }
#scratch-panel.fullscreen { inset: 0; width: auto; height: auto; border-radius: 0; }
#scratch-canvas { flex: 1; touch-action: none; border-radius: inherit;
  background-image: repeating-linear-gradient(#f2eddc 0 1px, transparent 1px 34px); }
.scratch-bar { display: flex; gap: 10px; align-items: center; padding: 8px 12px; flex-wrap: wrap;
  background: #fff8dd; border-radius: inherit; border-bottom: 2px solid #eee3b0; }
.scratch-bar .sc-btn { width: 56px; height: 56px; border-radius: 16px; border: 3px solid transparent;
  font-size: 26px; background: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.12); cursor: pointer; font-family: inherit; }
.scratch-bar .sc-btn.on { border-color: var(--ink); transform: scale(1.08); }
.scratch-bar .sc-dot { width: 44px; height: 44px; border-radius: 50%; border: 4px solid transparent; cursor: pointer; }
.scratch-bar .sc-dot.on { border-color: var(--ink); transform: scale(1.15); }
.scratch-bar .sc-title { font-weight: 900; color: #7a6a20; font-size: 18px; margin-right: auto; }

/* ---------- lesson book ---------- */
.lesson-page { background: #fffdf0; border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 26px; max-width: 780px; width: 100%; text-align: center; border: 5px solid #f0e2ad; }
.lp-head { font-size: 34px; font-weight: 900; color: #8a6d1a; }
.lp-scene { font-size: 84px; line-height: 1.15; margin: 10px 0; }
.lp-text { font-size: 29px; line-height: 1.5; color: var(--ink); }
.lp-text.speaking { background: #fff3c4; border-radius: 12px; }
.lp-fact { background: #fff3c4; border: 3px dashed #e3c95d; border-radius: 16px; padding: 10px 14px;
  margin-top: 12px; font-size: 21px; color: #7a6a20; }
.lesson-nav { display: flex; gap: 14px; justify-content: center; align-items: center; margin-top: 14px; width: 100%; }
@media (orientation: landscape) and (min-width: 900px) {
  .lesson-page { display: grid; grid-template-columns: auto 1fr; gap: 6px 26px; text-align: left; align-items: center; max-width: 980px; grid-column: 1 / -1; justify-self: center; }
  .lp-head { grid-column: 1 / -1; text-align: center; }
  .lp-scene { grid-column: 1; font-size: 96px; }
  .lp-text { grid-column: 2; }
  .lp-fact { grid-column: 1 / -1; }
  .lesson-nav { grid-column: 1 / -1; justify-self: center; max-width: 640px; }
}

/* ---------- Tara explains (after a wrong answer) ---------- */
.explain-card { background: #f0fbff; border: 5px solid #7fd4f0; border-radius: var(--radius);
  padding: 18px 22px; max-width: 760px; text-align: center; margin-top: 10px; box-shadow: var(--shadow); }
.explain-card .ex-visual { font-size: 58px; margin: 6px 0; }
.explain-card .ex-answer { font-size: 26px; font-weight: 900; color: #0e7ea8; }
.explain-card .ex-teach { font-size: 24px; margin-top: 8px; color: var(--ink); }

@media (max-width: 640px) {
  body { font-size: 20px; }
  h1 { font-size: 30px; }
  .opts { grid-template-columns: 1fr 1fr; gap: 10px; }
  .opt { min-height: 92px; font-size: 24px; }
  .opt .oe { font-size: 42px; }
  .q-prompt { font-size: 24px; }
  .q-visual { font-size: 44px; }
  .corner-btn { width: 64px; height: 64px; font-size: 30px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- print centre ---------- */
body.print-mode { background: #fff; }
body.print-mode #stars-bg { display: none; }
.pr-controls { background: #f4f2ff; border-radius: 14px; padding: 10px 14px; margin-bottom: 10px; width: 100%; max-width: 800px; }
#print-area { background: #fff; color: #000; width: 100%; max-width: 800px; padding: 24px 30px; border-radius: 8px;
  font-family: Georgia, "Times New Roman", serif; font-size: 16px; user-select: text; }
#print-area h1 { color: #000; text-shadow: none; font-size: 26px; text-align: center; margin: 0 0 4px; }
#print-area h2 { font-size: 18px; }
.pr-sub { text-align: center; font-size: 14px; margin-bottom: 8px; }
.pr-line { margin: 10px 0; font-size: 15px; }
.pr-sec { border-top: 2px solid #000; padding-top: 8px; margin-top: 18px; }
.pr-q { margin: 12px 0; page-break-inside: avoid; }
.pr-qhead { font-size: 16px; }
.pr-star2 { border: 1px dashed #000; border-radius: 6px; padding: 0 6px; font-size: 13px; }
.pr-pass { border: 1px solid #999; border-radius: 6px; padding: 6px 10px; margin: 6px 0; font-size: 15px; }
.pr-visual { font-size: 30px; margin: 4px 0 2px 18px; }
.pr-opts { margin-left: 18px; display: flex; flex-wrap: wrap; gap: 6px 26px; }
.pr-opt { font-size: 15px; }
.pr-omr h2, .pr-key h2 { text-align: center; }
.pr-note { font-size: 13px; text-align: center; margin: 6px 0; }
.pr-omr-grid { column-count: 2; column-gap: 40px; max-width: 560px; margin: 10px auto; }
.pr-omr-row { display: flex; align-items: center; gap: 10px; margin: 5px 0; break-inside: avoid; }
.pr-omr-num { width: 30px; text-align: right; font-weight: bold; }
.pr-bub { width: 26px; height: 26px; border: 2px solid #000; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-size: 12px; }
.pr-key-grid { display: flex; flex-wrap: wrap; gap: 8px 18px; max-width: 640px; margin: 10px auto; }
.pr-key-cell { border: 1px solid #ccc; border-radius: 6px; padding: 2px 8px; font-size: 14px; }
.pr-page-break { page-break-before: always; }

@media print {
  html, body, #screen { height: auto !important; overflow: visible !important; background: #fff !important; }
  #stars-bg, .no-print, #overlay { display: none !important; }
  #screen { display: block; padding: 0; }
  #print-area { max-width: none; padding: 0; border-radius: 0; }
}
