* { box-sizing: border-box; }
body { margin: 0; font-family: "Comic Sans MS", "Chalkboard SE", "Trebuchet MS", system-ui, sans-serif; background: #fff8e7; color: #2b2b2b; font-size: 19px; line-height: 1.5; }
.banner { background: #ffe08a; border-bottom: 3px dashed #e0a800; padding: 10px 20px; text-align: center; font-size: 16px; }
header { text-align: center; padding: 18px 16px 6px; }
h1 { margin: 0; font-size: 40px; color: #3a5a99; }
.tag { margin: 4px 0 8px; }
#who { font-size: 18px; }
main { display: grid; grid-template-columns: 1fr 320px; gap: 24px; max-width: 1180px; margin: 0 auto; padding: 12px 20px 30px; }
@media (max-width: 860px) { main { grid-template-columns: 1fr; } }
aside, .card, .panel { background: #fff; border-radius: 18px; box-shadow: 0 4px 0 #e8dcc0; padding: 16px 18px; }
aside h2 { margin-top: 0; }
table { width: 100%; border-collapse: collapse; font-size: 17px; }
th, td { text-align: start; padding: 5px 4px; border-bottom: 1px solid #f0e6cc; }
tr.me td { background: #e6f4ff; font-weight: bold; }
.rules { margin-top: 14px; font-size: 17px; }
.rules ul { padding-inline-start: 18px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { border: 4px solid transparent; position: relative; }
.card.locked { opacity: .65; background: #f4f1ea; }
.card.completed { border-color: #6cc070; }
.card.tested-out { border-color: #8fb3e8; }
.card.in-progress { border-color: #ffb84d; }
.card .emoji { font-size: 40px; }
.card h3 { margin: 4px 0; font-size: 22px; }
.card .code { font-size: 16px; color: #777; }
.card .desc { font-size: 16px; color: #555; }
.card .pts { font-size: 18px; font-weight: bold; margin: 6px 0; }
.card .need { font-size: 16px; color: #a0522d; }
.badge { display: inline-block; font-size: 16px; border-radius: 999px; padding: 1px 10px; background: #eee; }
button { font-family: inherit; font-size: 19px; border: none; border-radius: 14px; padding: 10px 18px; margin: 6px 6px 0 0; cursor: pointer; background: #3a7bd5; color: #fff; box-shadow: 0 4px 0 #2a5aa0; }
button:active { transform: translateY(3px); box-shadow: 0 1px 0 #2a5aa0; }
button.alt { background: #8a8a8a; box-shadow: 0 4px 0 #666; }
button.go { background: #43a047; box-shadow: 0 4px 0 #2e7d32; }
button:disabled { background: #ccc; box-shadow: none; cursor: not-allowed; }
.panel h2 { margin-top: 0; color: #3a5a99; }
.show { font-size: 44px; text-align: center; margin: 10px 0; word-break: break-word; }
.choices button { display: block; width: 100%; text-align: start; background: #fff; color: #2b2b2b; border: 3px solid #cfd8e6; box-shadow: 0 3px 0 #cfd8e6; margin: 8px 0; }
.choices button.right { border-color: #43a047; background: #e8f5e9; }
.choices button.wrong { border-color: #e53935; background: #ffebee; }
.why { background: #f1f8ff; border-inline-start: 6px solid #3a7bd5; padding: 8px 12px; border-radius: 8px; margin: 10px 0; }
.bar { height: 16px; background: #eee; border-radius: 99px; overflow: hidden; margin: 8px 0 14px; }
.bar > div { height: 100%; background: linear-gradient(90deg, #ffb84d, #43a047); }
.score-break td:last-child { text-align: right; font-weight: bold; }
input[type=text] { font-family: inherit; font-size: 20px; padding: 8px 12px; border-radius: 12px; border: 3px solid #cfd8e6; width: 260px; }
.small { font-size: 16px; color: #666; }
footer { text-align: center; font-size: 16px; color: #888; padding: 10px 0 20px; }
/* One small footer link; padded to a 44px tap target without looking like a button. */
footer .support { display: inline-block; color: #6b6b6b; }
footer .support a { display: inline-block; min-height: 44px; line-height: 44px; padding: 0 10px; color: #6b6b6b; text-decoration: underline; }
footer .support a:focus-visible { outline: 3px solid #4a7; border-radius: 6px; }
.free { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: #2f7a4a; }
.banner.live { background: #d9f7dd; border-bottom-color: #43a047; }
.loading { font-size: 26px; text-align: center; padding: 40px 0; }

/* ---- Responsive: desktop, tablet, phone. Nothing depends on hover; all targets >= 44px. ---- */
html { -webkit-text-size-adjust: 100%; }
button { min-height: 48px; min-width: 48px; touch-action: manipulation; }
.choices button { min-height: 56px; }
.rules summary { min-height: 44px; padding: 10px 0; cursor: pointer; }
input[type=text] { min-height: 48px; max-width: 100%; }
.grid { grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); }
img, table { max-width: 100%; }
@media (max-width: 860px) {             /* tablet: high scores move under the courses */
  main { gap: 18px; padding: 10px 16px 24px; }
  h1 { font-size: 34px; }
}
@media (max-width: 600px) {             /* phone: one column, roomy controls */
  body { font-size: 18px; }
  main { padding: 8px 12px 20px; }
  h1 { font-size: 28px; }
  .banner { font-size: 16px; padding: 8px 12px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  aside, .card, .panel { padding: 14px; border-radius: 14px; }
  .card h3 { font-size: 21px; }
  .card .desc, .card .need, .small, table, .rules { font-size: 16px; }
  .card button { width: 100%; margin-inline-end: 0; }
  .show { font-size: 36px; }
  input[type=text] { width: 100%; }
  #add { width: 100%; }
  #who button { display: block; margin: 6px auto 0; }
}
.grade-h { margin: 22px 0 6px; color: #3a5a99; }
.bonusbar { background: #fff; border-radius: 14px; padding: 10px 14px; margin-bottom: 12px; box-shadow: 0 3px 0 #e8dcc0; }
.bonusbar.earned { background: #fff4c2; }
.bonusbar .bar { margin: 6px 0 0; }
.medal { font-size: 18px; }
.breakdown { white-space: normal; }

/* ---- Read-aloud & spoken answers ---- */
.speechbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.toggle[aria-pressed="true"] { background: #2f7a4a; color: #fff; }
.spk { min-width: 48px; min-height: 48px; padding: 0 10px; font-size: 22px; background: #fff; color: #2b2b2b; border: 2px solid #cfd8e6; box-shadow: none; vertical-align: middle; }
.qline { display: flex; align-items: center; gap: 8px; }
.choice { display: flex; align-items: stretch; gap: 8px; }
.choice > button[data-i] { flex: 1; }
.choice > .spk { margin: 8px 0; }
.w { border-radius: 4px; transition: background .1s; }
.w.on { background: #ffe066; box-shadow: 0 0 0 2px #ffe066; }
.reading { outline: 3px dashed #e0a020; outline-offset: 3px; }
#fb .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.voice { margin: 10px 0; }
.mic.listening { background: #c0392b; }
/* K and grade 1: big picture tiles */
.choices.pics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.choices.pics .choice { flex-direction: column; }
.choices.pics button[data-i] { min-height: 120px; text-align: center; font-size: 22px; margin: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.choices.pics .pic { font-size: 44px; line-height: 1.1; }
.choices.pics .choice > .spk { margin: 0; width: 100%; }
.young .ltext, .young .qline { font-size: 22px; line-height: 1.6; }
@media (max-width: 600px) {
  .choices.pics { grid-template-columns: repeat(2, 1fr); }
  .choices.pics button[data-i] { min-height: 110px; font-size: 20px; }
}

footer { padding-bottom: 80px; }  /* keep the footer clear of the floating Feedback button */

/* ---- Right-to-left (Arabic, Hebrew…): the browser mirrors flex/grid with dir=rtl; fix the few physical bits ---- */

[dir="rtl"] .choices.pics button[data-i] { text-align: center; }
[dir="rtl"] .bar > div { margin-inline-start: 0; }
.langpick { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0; font-size: 16px; }
.langpick select { min-height: 44px; font-size: 16px; padding: 0 8px; border-radius: 8px; }
.notice { background: #eef4ff; border-inline-start: 4px solid #2a4a7a; padding: 8px 12px; border-radius: 6px; margin: 8px 0; }

/* ---- Sign-in screen: Log in · Sign up · Guest ---- */
.auth .tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 14px; }
.auth .tab { min-height: 48px; background: #f4f6fa; color: #2b2b2b; border: 2px solid #cfd8e6; box-shadow: none; }
.auth .tab[aria-selected="true"] { background: #2a4a7a; color: #fff; border-color: #2a4a7a; }
.authbox { max-width: 460px; }
.authbox .row { display: flex; align-items: center; gap: 8px; }
.authbox h3 { margin: 4px 0; }
.authbox label { display: block; font-weight: 700; margin: 12px 0 4px; }
.authbox input[type=text], .authbox input[type=password], .authbox select { width: 100%; box-sizing: border-box; min-height: 48px; font-size: 18px; padding: 6px 10px; border-radius: 10px; border: 2px solid #cfd8e6; }
.authbox .check { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.authbox .check input { width: 24px; height: 24px; }
.authbox .check label { display: inline; font-weight: 400; margin: 0; }
.authbox .msg { color: #b23; min-height: 1.2em; font-weight: 700; }
.authbox button[type=submit], .authbox #add { margin-top: 6px; }
.authbox #name { max-width: 320px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) { .auth .tab { flex: 1 1 100%; } .authbox #name { max-width: none; } }

/* Accreditation note + About link (every page footer) */
footer .accred { display: inline-block; color: #6b6b6b; padding: 6px 10px 0; }
footer #about-link { display: inline-block; min-height: 44px; line-height: 44px; padding: 0 10px; color: #6b6b6b; text-decoration: underline; }
footer #about-link:focus-visible { outline: 3px solid #4a7; border-radius: 6px; }

/* About page */
.about-page main.about { display: block; max-width: 760px; }
.about-page h1 a.home { color: inherit; text-decoration: none; }
.about-page .langpick { display: inline-block; margin-top: 8px; }
.about .about-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.about h2 { margin: 0 0 6px; color: #3a5a99; }
.about h3 { margin: 22px 0 6px; color: #3a5a99; }
.about .motto { margin: 0 0 18px; padding: 14px 18px; background: #fff8e7; border-inline-start: 6px solid #e0a020; border-radius: 12px; }
.about .motto blockquote { margin: 0; font-size: 22px; font-style: italic; }
.about .motto figcaption { margin-top: 6px; font-size: 17px; color: #555; }
.about .btn-play { display: inline-block; min-height: 48px; line-height: 48px; padding: 0 22px; border-radius: 14px; background: #43a047;
  box-shadow: 0 4px 0 #2e7d32; color: #fff; font-weight: 700; text-decoration: none; }
.about .btn-play:focus-visible { outline: 3px solid #e0a020; outline-offset: 2px; }
@media (max-width: 520px) { .about .motto blockquote { font-size: 19px; } .about-page h1 { font-size: 30px; } }

/* Country / region picker (localized courses) */
.country-ask .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.country-ask select, header #country { max-width: min(320px, 70vw); }
.card .local { margin: 4px 0; color: #2a5a3a; }
/* phonics sound marks (/s/ in the content): shown as the letter in a chip; read-aloud plays the sound */
.snd { display: inline-block; padding: 0 .3em; margin: 0 .05em; border-radius: .4em; background: #fff3c4; border: 1px dashed #c9a227; font-weight: 700; line-height: 1.3; }
/* pictures are bundled images (Twemoji / flag-icons), the same on every device */
img.emo { width: 1.15em; height: 1.15em; vertical-align: -0.2em; display: inline-block; }
img.emo.flag { width: 1.6em; height: 1.2em; vertical-align: -0.2em; border-radius: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.15); object-fit: cover; }
.show img.emo { width: 1.3em; height: 1.3em; }
.show img.emo.flag { width: 2.2em; height: 1.65em; }
.choices.pics .pic img.emo { width: 64px; height: 64px; }
.choices.pics .pic img.emo.flag { width: 88px; height: 66px; }
.spk img { width: 28px; height: 28px; display: block; margin: auto; pointer-events: none; }
/* Speaker + mic check dialog: big buttons, works on phones (full width) and in right-to-left languages */
.sc-open { min-height: 44px; }
header .sc-open { margin: 6px 0; font-size: 16px; }
.sc-back { position: fixed; inset: 0; z-index: 60; background: rgba(20, 30, 50, .45); display: flex; align-items: center; justify-content: center; padding: 12px; }
.sc-dialog { background: #fff; border-radius: 18px; box-shadow: 0 8px 30px rgba(0,0,0,.3); padding: 18px; width: min(560px, 100%); max-height: calc(100vh - 24px); overflow: auto; box-sizing: border-box; font-size: 18px; }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-head h2 { margin: 0; font-size: 24px; color: #3a5a99; }
.sc-step { border-top: 2px dashed #e8dcc0; margin-top: 14px; padding-top: 10px; }
.sc-step h3 { margin: 4px 0 10px; font-size: 21px; }
.sc-dialog button.big { min-height: 56px; min-width: 56px; font-size: 19px; padding: 0 18px; border-radius: 14px; }
.sc-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.sc-q { font-size: 21px; }
.sc-pass { color: #2f7a4a; font-weight: 700; font-size: 20px; }
.sc-fail { color: #b23; font-weight: 700; font-size: 19px; }
.sc-tips { margin: 6px 0 10px; padding-inline-start: 22px; line-height: 1.45; }
.sc-meter { height: 26px; border-radius: 13px; background: #eef2f7; border: 2px solid #cfd8e6; overflow: hidden; margin: 10px 0; }
.sc-meter > div { height: 100%; width: 0; background: linear-gradient(90deg, #43a047, #e0a020); transition: width .08s linear; }
.sc-heard { min-height: 1.4em; font-style: italic; }
.boss { font-size: 22px; margin: 6px 0; }
.boss.won { color: #2f7a4a; } .boss.try { color: #a0601a; }
@media (max-width: 600px) {
  .sc-back { padding: 0; align-items: stretch; }
  .sc-dialog { border-radius: 0; max-height: 100vh; width: 100%; }
  .sc-row button.big { flex: 1 1 100%; }
}

/* Teaching stages: Learn -> Try it -> Practice round */
.steps { display: flex; gap: .4rem; list-style: none; padding: 0; margin: .6rem 0; flex-wrap: wrap; }
.steps li { padding: .3rem .75rem; border-radius: 999px; background: #eef1f6; color: #556; font-size: .95rem; }
.steps li.on { background: #2b6cb0; color: #fff; font-weight: 700; }
.stitle { margin: .4rem 0; }
.lesson.learn { text-align: center; padding: 1rem; border-radius: 16px; background: #fffbea; }
.lesson.learn .ltext { font-size: 1.35rem; line-height: 1.5; margin: .6rem 0; }
.young .lesson.learn .ltext { font-size: 1.7rem; }
.show.big img.emo { width: 3.4em; height: 3.4em; }
.young .show.big img.emo { width: 4.2em; height: 4.2em; }
.example { background: #e9f7ef; border-radius: 12px; padding: .6rem .9rem; margin: .6rem auto; max-width: 34rem; font-size: 1.15rem; }
.lesson.learn .row { display: flex; gap: 8px; align-items: center; justify-content: center; flex-wrap: wrap; }
.lesson.learn #next { font-size: 1.25rem; padding: .7rem 1.6rem; }
.hint { background: #fff4e5; border-radius: 12px; padding: .4rem .8rem; }
.step-label .muted { color: #667; }
@media (max-width: 480px) { .show.big img.emo { width: 2.6em; height: 2.6em; } .young .show.big img.emo { width: 3em; height: 3em; } }
