/* Kids' Story App — navy & gold, Fluent Academy look */
:root {
  --navy: #12394a;
  --navy-deep: #0d2e3d;
  --navy-soft: #1b4d63;
  --gold: #c9a24b;
  --gold-soft: #e8d6a4;
  --cream: #fdf6e6;
  --paper: #ffffff;
  --ink: #17313f;
  --muted: #5d7380;
  --line: #dbe5e5;
  --green: #2f8f6b;
  --red: #b3261e;
  --radius: 18px;
  --shadow: 0 4px 18px rgba(18, 57, 74, 0.1);
  --shadow-soft: 0 2px 8px rgba(18, 57, 74, 0.08);
}

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

html, body { margin: 0; padding: 0; }

body {
  font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--cream);
  background-image: radial-gradient(circle at 12% 8%, #fff9ea 0, transparent 40%),
    radial-gradient(circle at 88% 92%, #f4ecdb 0, transparent 45%);
  min-height: 100vh;
}

h1, h2, h3, .serif { font-family: Georgia, "Times New Roman", serif; color: var(--navy); }

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

/* ---------------- header ---------------- */
header.top {
  background: linear-gradient(135deg, var(--navy-deep), var(--navy) 60%, var(--navy-soft));
  border-bottom: 3px solid var(--gold);
  color: #fff;
  padding: 12px max(3vw, 12px);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
}
header.top img.logo {
  height: 62px;
  width: auto;
  max-width: 44vw;
  object-fit: contain;
  background: #fff;
  border-radius: 14px;
  padding: 4px 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.brand { display: flex; flex-direction: column; line-height: 1.15; }
.brand strong { font-family: Georgia, serif; font-size: 22px; letter-spacing: 0.2px; }
.brand small { color: #cfe0e6; font-size: 13px; }
.top .spacer { flex: 1; }
.top .who { font-size: 14px; color: #e6eef2; text-align: right; }
.top .who b { display: block; font-size: 16px; }
.starchip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff8e2;
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px max(3vw, 12px) 72px;
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 26px 12px 34px;
}

/* ---------------- buttons ---------------- */
.btn {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 14px;
  padding: 14px 22px;
  min-height: 52px;
  background: #e6eeef;
  color: var(--navy);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  transition: transform 0.06s ease, filter 0.15s ease;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--gold); color: #22303a; box-shadow: 0 3px 10px rgba(201, 162, 75, 0.4); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.ghost { background: #fff; border: 2px solid var(--line); }
.btn.small { min-height: 42px; padding: 8px 14px; font-size: 15px; border-radius: 11px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn[aria-pressed="true"] { background: var(--navy); color: #fff; }

/* ---------------- cards & layout ---------------- */
.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin: 0 0 16px;
}
.card.hero {
  background: linear-gradient(140deg, var(--navy), var(--navy-soft));
  color: #fff;
  border: 0;
  padding: 26px 22px;
}
.card.hero h1, .card.hero h2 { color: #fff; margin: 0 0 6px; }
.card.hero p { color: #d7e6ea; margin: 0; }
.grid { display: grid; gap: 14px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.stories { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.muted { color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
h1 { font-size: 30px; margin: 0 0 10px; }
h2 { font-size: 23px; margin: 0 0 10px; }
h3 { font-size: 18px; margin: 0 0 8px; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }

/* ---------------- home ---------------- */
.hero-logo { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-logo img { height: 92px; background: #fff; border-radius: 16px; padding: 6px 10px; }
.pick { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.pick .card { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.pick .card h3 { margin: 0; font-size: 21px; }
.pick .card p { margin: 0; color: var(--muted); }

.ladder { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.band {
  border-radius: 14px;
  padding: 10px 12px;
  background: #f4f8f9;
  border: 1px solid var(--line);
  min-width: 150px;
  flex: 1 1 150px;
}
.band b { display: block; font-size: 14px; color: var(--navy); }
.band span { font-size: 12px; color: var(--muted); }
.band .lv { display: flex; gap: 4px; margin-top: 6px; flex-wrap: wrap; }
.lv i {
  font-style: normal;
  font-weight: 700;
  font-size: 12px;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--navy);
}
.band.here { border-color: var(--gold); background: #fff8e6; box-shadow: var(--shadow-soft); }
.band.here .lv i.on { background: var(--gold); border-color: var(--gold); color: #22303a; }

/* ---------------- forms ---------------- */
label.field { display: block; margin: 0 0 12px; font-weight: 600; font-size: 15px; }
label.field input, label.field select {
  display: block;
  width: 100%;
  margin-top: 6px;
  font: inherit;
  padding: 13px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  min-height: 52px;
}
label.field input:focus, label.field select:focus { outline: 3px solid #cfe3ec; border-color: var(--navy); }
input.code {
  font-size: 26px;
  letter-spacing: 0.18em;
  text-align: center;
  text-transform: uppercase;
  font-weight: 700;
}
.notice { border-radius: 12px; padding: 12px 14px; font-size: 15px; }
.notice.err { background: #fdecea; color: #8c1d18; border: 1px solid #f0c2bd; }
.notice.ok { background: #e6f4ec; color: #1b5c3d; border: 1px solid #bfe0cd; }
.notice.info { background: #eaf3fb; color: #124a72; border: 1px solid #bcd8ee; }

/* ---------------- student home ---------------- */
.bandbar {
  border-radius: var(--radius);
  padding: 16px 18px;
  color: #fff;
  background: linear-gradient(140deg, var(--navy), var(--navy-soft));
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.bandbar .lvs { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.bandbar .lvs span {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; background: #ffffff1f; color: #fff; font-size: 17px;
}
.bandbar .lvs span.on { background: var(--gold); color: #22303a; }
.bandbar .lvs span.done { background: #2f8f6b; }

.storycard { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.storycard .art { border-radius: 14px; overflow: hidden; background: #eaf3fb; aspect-ratio: 4 / 3; }
.storycard .art svg { width: 100%; height: 100%; display: block; }
.storycard h4 { margin: 0; font-size: 17px; font-family: Georgia, serif; color: var(--navy); }
.storycard.empty { opacity: 0.62; }
.storycard.empty .art { display: grid; place-items: center; color: var(--muted); font-size: 14px; background: #f3f6f7; border: 2px dashed var(--line); }
.dots { display: flex; gap: 5px; flex-wrap: wrap; }
.dots i {
  width: 22px; height: 22px; border-radius: 7px; background: #eef3f4; border: 1px solid var(--line);
  display: grid; place-items: center; font-size: 11px; font-style: normal; color: var(--muted); font-weight: 700;
}
.dots i.on { background: var(--gold); border-color: var(--gold); color: #22303a; }

/* ---------------- reader ---------------- */
.reader { max-width: 860px; margin: 0 auto; }
.reader .pagecard {
  background: #fff; border-radius: 22px; box-shadow: var(--shadow); overflow: hidden;
}
.reader .art { background: #eaf3fb; }
.reader .art svg { width: 100%; display: block; }
.reader .text {
  font-family: Georgia, serif;
  font-size: clamp(24px, 5.4vw, 38px);
  line-height: 1.5;
  padding: 22px 24px 30px;
  color: var(--navy);
  text-align: center;
  min-height: 120px;
}
.reader .text span.w { cursor: pointer; border-radius: 8px; padding: 0 2px; }
.reader .text span.w:hover, .reader .text span.w.speaking { background: #fdf0cd; }
.turnbar { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.turnbar .btn { flex: 0 0 auto; font-size: 20px; padding: 12px 20px; }
.turnbar .mid { flex: 1; text-align: center; color: var(--muted); font-size: 14px; }
.pagedots { display: flex; gap: 6px; justify-content: center; margin: 10px 0 0; }
.pagedots i { width: 10px; height: 10px; border-radius: 50%; background: #d5e2e6; }
.pagedots i.on { background: var(--gold); width: 26px; border-radius: 6px; }

/* ---------------- activities ---------------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.tile {
  background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink);
  border: 2px solid transparent; position: relative;
}
.tile.done { border-color: #bfe0cd; background: #f4fbf7; }
.tile b { font-size: 18px; color: var(--navy); font-family: Georgia, serif; }
.tile .st { font-size: 13px; color: var(--muted); }
.tile .pill { align-self: flex-start; }
.tile .tick { position: absolute; top: 12px; right: 14px; color: var(--green); font-size: 20px; }

.qcard { max-width: 780px; margin: 0 auto; }
.qtitle { font-family: Georgia, serif; font-size: clamp(22px, 4.4vw, 30px); color: var(--navy); margin: 0 0 16px; }
.opts { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.opt {
  background: #fff; border: 3px solid var(--line); border-radius: 16px; padding: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-weight: 700; color: var(--navy);
}
.opt svg { width: 100%; border-radius: 10px; display: block; }
.opt.txt { flex-direction: row; justify-content: center; padding: 18px; font-size: 19px; }
.opt.right { border-color: var(--green); background: #effaf3; }
.opt.wrong { border-color: var(--red); background: #fdeeec; }
.progress { height: 10px; background: #e6eeef; border-radius: 99px; overflow: hidden; margin: 0 0 16px; }
.progress i { display: block; height: 100%; background: var(--gold); transition: width 0.3s ease; }

.matchgrid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 780px; margin: 0 auto; }
@media (max-width: 560px) { .matchgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mcard {
  aspect-ratio: 1 / 1; border-radius: 16px; background: #fff; border: 3px solid var(--line);
  display: grid; place-items: center; cursor: pointer; overflow: hidden; padding: 8px;
  font-family: Georgia, serif; font-size: clamp(18px, 4vw, 26px); font-weight: 700; color: var(--navy);
}
.mcard svg { width: 100%; height: 100%; }
.mcard.down { background: #eef4f6; border-color: #cfe0e6; }
.mcard.hidden span { visibility: hidden; }
.mcard.hidden svg { visibility: hidden; }
.mcard.picked { border-color: var(--gold); background: #fff8e6; }
.mcard.paired { border-color: var(--green); background: #effaf3; }

/* ---------------- colouring ---------------- */
.colourwrap { max-width: 760px; margin: 0 auto; }
.colourstage { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 8px; }
.colourstage svg { width: 100%; display: block; touch-action: manipulation; }
.colourstage svg [fill="#ffffff"] { cursor: pointer; transition: fill 0.12s ease; }
.palette { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 14px 0; }
.swatch { width: 48px; height: 48px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 2px 8px #0002; cursor: pointer; }
.swatch.on { outline: 3px solid var(--navy); outline-offset: 2px; }

/* ---------------- certificate ---------------- */
.certwrap { max-width: 820px; margin: 0 auto; }
.cert {
  background: #fff;
  border: 12px double var(--gold);
  border-radius: 6px;
  padding: 34px 26px;
  text-align: center;
  color: var(--navy);
  box-shadow: var(--shadow);
}
.cert .brandline { font-size: 15px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.cert img { height: 78px; border-radius: 12px; margin: 6px 0 4px; }
.cert h2 { font-size: clamp(26px, 5vw, 38px); margin: 12px 0 4px; }
.cert .name {
  font-family: Georgia, serif; font-size: clamp(28px, 6vw, 44px); font-weight: 700;
  border-bottom: 3px solid var(--gold); display: inline-block; padding: 0 18px 4px; margin: 8px 0 10px;
}
.cert .body { font-size: 17px; color: #2c4a59; max-width: 30em; margin: 0 auto; }
.cert .stars { font-size: 19px; font-weight: 700; margin: 14px 0 4px; }
.cert .sig { margin-top: 30px; display: flex; justify-content: space-around; gap: 20px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.cert .sig div { border-top: 1px solid var(--navy); padding-top: 6px; min-width: 180px; font-style: italic; font-family: Georgia, serif; font-size: 17px; color: var(--navy); }

/* ---------------- teacher ---------------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }
.tabs button {
  font: inherit; font-weight: 700; border: 0; border-radius: 999px; padding: 12px 20px;
  background: #fff; color: var(--navy); cursor: pointer; box-shadow: var(--shadow-soft); min-height: 48px;
}
.tabs button.on { background: var(--navy); color: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tablewrap { overflow-x: auto; }
.codebig {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 26px; font-weight: 700;
  letter-spacing: 0.16em; color: var(--navy); background: #fff8e6; border: 2px dashed var(--gold);
  border-radius: 12px; padding: 10px 16px; display: inline-block;
}
.pill { display: inline-block; background: #eef3f4; border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 700; color: var(--navy); }
.pill.gold { background: #fff2d0; }
.pill.green { background: #e3f4ea; color: #1b5c3d; }
audio { width: 100%; max-width: 320px; }
.spin { display: inline-block; width: 18px; height: 18px; border: 3px solid #fff6; border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { padding: 40px 0; text-align: center; color: var(--muted); }

/* ---------------- print ---------------- */
@media print {
  header.top, footer, .noprint { display: none !important; }
  body { background: #fff; }
  main { padding: 0; max-width: none; }
  .cert { box-shadow: none; border-width: 10px; }
}

@media (max-width: 560px) {
  header.top { padding: 10px 12px; }
  header.top img.logo { height: 48px; }
  .brand strong { font-size: 19px; }
  .brand small { font-size: 11px; }
  main { padding: 16px 12px 60px; }
  h1 { font-size: 25px; }
  .card { padding: 16px; }
  .cert { padding: 22px 14px; }
  .cert .brandline { font-size: 11px; letter-spacing: .1em; }
}
