/* atfal.net — rounded type, bright colours, big touch targets. */
:root {
  --bg: #fff8ec;
  --paper: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #f1e4cc;
  --accent: #e8590c;
  --accent-soft: #ffe8d6;
  --fs: 20px;
  --kid: "Baloo Bhaijaan 2", "Noto Kufi Arabic", Tahoma, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171f; --paper: #1d2230; --ink: #eef0f6; --muted: #a2a9ba; --line: #2c3344;
    --accent: #ffa94d; --accent-soft: #3a2a1d; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14171f; --paper: #1d2230; --ink: #eef0f6; --muted: #a2a9ba; --line: #2c3344;
  --accent: #ffa94d; --accent-soft: #3a2a1d; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--kid); font-size: var(--fs); line-height: 1.85;
  background-image: radial-gradient(var(--line) 1.2px, transparent 1.2px); background-size: 22px 22px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }
button { font-family: inherit; }
main { max-width: 1080px; margin: 0 auto; padding: 18px 16px 40px; }

/* Header */
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 8px 16px;
  background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--line); font-size: 16px; line-height: 1.4; }
.logo { font-weight: 800; font-size: 26px; color: var(--accent); white-space: nowrap; text-decoration: none !important; }
.sections { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.sections::-webkit-scrollbar { display: none; }
.sections a { white-space: nowrap; padding: 4px 11px; border-radius: 999px; color: var(--ink); font-weight: 700;
  text-decoration: none; border: 2px solid transparent; }
.sections a:hover { border-color: var(--sec); }
.sections a[aria-current] { background: var(--sec); color: #fff; }
.tools { display: flex; gap: 6px; flex-shrink: 0; }
.tools button, .rnd { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 36px;
  border: 2px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); cursor: pointer;
  font-size: 18px; text-decoration: none !important; padding: 0 6px; }
.tools button:hover, .rnd:hover { border-color: var(--accent); }
.crumbs { font-size: 14px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.crumbs span { opacity: .6; }
.foot { text-align: center; font-size: 14px; color: var(--muted); padding: 20px 16px 40px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; margin-bottom: 8px; }
.foot-links a { color: var(--muted); font-weight: 700; }

/* «About this game» text under games, activities and colouring pages */
.about-game { max-width: 820px; margin: 24px auto 0; background: var(--paper); border: 2px solid var(--line); border-radius: 22px;
  padding: 6px 22px 14px; font-size: .92em; line-height: 1.9; }
.about-game h2 { font-size: 1.15em; color: var(--accent); margin: .6em 0 .2em; }
.about-game h3 { font-size: 1em; color: var(--muted); margin: .8em 0 .2em; }
.about-game p { margin: .3em 0; }
.more-games { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.more-games a { display: inline-block; padding: 2px 14px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line);
  color: var(--ink); font-size: .95em; }

/* Buttons */
.btn { display: inline-block; font: inherit; font-weight: 700; font-size: 17px; padding: 8px 20px; border-radius: 999px;
  border: 0; background: var(--accent); color: #fff !important; cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.15);
  text-decoration: none !important; line-height: 1.5; }
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn.alt { background: #7c3aed; }
.btn.ghost { background: var(--paper); color: var(--ink) !important; border: 2px solid var(--line); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; }

/* Site home */
.home-hero { text-align: center; padding: 26px 0 6px; }
.home-hero h1 { font-size: clamp(44px, 9vw, 76px); line-height: 1.2; margin: 0; color: var(--accent); }
.home-hero p { margin: .2em 0 0; color: var(--muted); font-size: 1.05em; }
.portal { list-style: none; padding: 0; margin: 26px 0; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.portal a { display: flex; flex-direction: column; align-items: center; text-align: center; height: 100%; padding: 24px 16px;
  border-radius: 28px; background: var(--paper); color: var(--ink); text-decoration: none; border: 4px solid var(--sec);
  box-shadow: 0 6px 0 color-mix(in srgb, var(--sec) 40%, transparent); transition: transform .15s; }
.portal a:hover { transform: translateY(-5px) rotate(-1deg); }
.portal .big-emoji { font-size: 66px; }
.portal b { font-size: 1.5em; color: var(--sec); line-height: 1.4; }
.portal small { color: var(--muted); font-size: 15px; line-height: 1.6; }
.today { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); margin-top: 10px; }
.today > section { background: var(--paper); border-radius: 24px; border: 2px solid var(--line); padding: 6px 18px 16px; }
.today h2 { font-size: 1.15em; color: var(--accent); margin: .5em 0; }

/* Section home pages */
.kids-hero { text-align: center; padding: 14px 0 6px; }
.kids-hero h1 { font-size: clamp(34px, 7vw, 56px); margin: 0; color: var(--accent); line-height: 1.3; }
.kids-hero p { color: var(--muted); margin: .2em 0 1em; }
.hero-actions { margin-top: 1em; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.tiles { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.tiles a { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; height: 100%;
  padding: 18px 12px; border-radius: 22px; background: var(--paper); color: var(--ink); text-decoration: none;
  border: 3px solid color-mix(in srgb, var(--cat) 35%, transparent); transition: transform .15s; }
.tiles a:hover { transform: translateY(-4px) rotate(-1deg); border-color: var(--cat); }
.tiles b { font-size: 1.1em; color: var(--cat); }
.tiles small { font-size: 13px; color: var(--muted); line-height: 1.5; }
.big-emoji { font-size: 52px; line-height: 1.2; }

/* Search */
.search { position: relative; max-width: 640px; margin: 0 auto; text-align: right; }
#q { width: 100%; font: inherit; font-size: 18px; padding: 12px 22px; border: 2px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); }
#q:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.results { list-style: none; margin: 8px 0 0; padding: 6px; max-height: 60vh; overflow: auto; background: var(--paper);
  border: 2px solid var(--line); border-radius: 18px; font-size: 18px; position: absolute; inset-inline: 0; z-index: 4; }
.results li a { display: block; padding: 6px 12px; border-radius: 12px; color: var(--ink); line-height: 1.5; }
.results li a:hover, .results li a:focus { background: var(--accent-soft); text-decoration: none; outline: none; }
.results small { display: block; color: var(--muted); font-size: 12px; }
.results .none { padding: 8px 10px; color: var(--muted); font-size: 14px; }
.filter { display: block; width: 100%; max-width: 420px; margin: 1em auto; font: inherit; font-size: 16px; padding: 8px 18px;
  border: 2px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--ink); }

/* On-screen Arabic keyboard */
.kb-field { position: relative; display: block; }
.kb-filter { max-width: 420px; margin: 1em auto; }
.kb-filter .filter { margin: 0; }
.kb-field #q, .kb-field .filter { padding-inline-end: 54px; }
.kb-toggle { position: absolute; inset-inline-end: 6px; top: 50%; transform: translateY(-50%); width: 42px; height: 36px;
  border: 0; border-radius: 999px; background: var(--accent-soft); font-size: 20px; line-height: 1; cursor: pointer; }
.kb-toggle[aria-expanded="true"] { background: var(--accent); }
.kb { margin: 8px auto 0; max-width: 640px; padding: 8px; background: var(--paper); border: 2px solid var(--line);
  border-radius: 18px; user-select: none; -webkit-user-select: none; }
.kb-row { display: grid; grid-template-columns: repeat(12, 1fr); gap: 4px; margin-bottom: 4px; }
.kb button { font: inherit; font-size: 22px; line-height: 1; min-height: 44px; padding: 0; border: 2px solid var(--line);
  border-radius: 10px; background: var(--bg); color: var(--ink); cursor: pointer; touch-action: manipulation; }
.kb button:hover { border-color: var(--accent); }
.kb button:active { background: var(--accent-soft); }
.kb-act { grid-template-columns: 1fr 3fr 2fr 1fr; margin-bottom: 0; }
.kb-act button { font-size: 16px; }
@media (max-width: 480px) { .kb { padding: 5px; } .kb-row { gap: 3px; } .kb button { font-size: 18px; min-height: 40px; border-radius: 8px; } }

/* Did you know */
.dyk h2 { color: var(--accent); }
#dyk { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.dyk-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px; background: var(--paper); border-radius: 18px;
  border: 2px solid var(--line); color: var(--ink); text-decoration: none !important; font-size: .82em; line-height: 1.7; }
.dyk-item:hover { border-color: var(--accent); }
.dyk-item img { width: 84px; height: 84px; object-fit: contain; border-radius: 12px; flex-shrink: 0; background: #fff; }
.dyk-item b { display: block; color: var(--accent); }

/* Encyclopedia: category pages */
.cat-head { text-align: center; padding: 10px 0; }
.cat-head h1 { color: var(--cat); margin: 0; font-size: clamp(30px, 6vw, 46px); line-height: 1.3; }
.cat-head p { color: var(--muted); margin: 0; }
.subcats { list-style: none; padding: 0; margin: 14px 0 12px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.subcats a { display: inline-block; padding: 5px 14px; border-radius: 999px; font-weight: 700; font-size: .9em;
  background: color-mix(in srgb, var(--cat) 14%, var(--paper)); color: var(--cat); text-decoration: none; }
.subcats a:hover { background: var(--cat); color: #fff; }
.subcats small { opacity: .7; font-weight: 500; }
.subcat { scroll-margin-top: 70px; }
.subcat[hidden] { display: none; }
.subcat h2 { color: var(--cat); font-size: 1.35em; margin: 1.2em 0 0; padding-bottom: 4px;
  border-bottom: 3px dotted color-mix(in srgb, var(--cat) 40%, transparent); }
.cards { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.cards li[hidden] { display: none; }
.cards a { display: flex; flex-direction: column; height: 100%; background: var(--paper); border-radius: 18px; overflow: hidden;
  border: 2px solid var(--line); color: var(--ink); text-decoration: none; transition: transform .15s; }
.cards a:hover { transform: translateY(-3px); border-color: var(--cat); }
/* height: auto lets the 4:3 frame win over the width/height attributes, so every card is the same size */
.cards img, .cards .noimg { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; display: flex;
  align-items: center; justify-content: center; font-size: 48px; }
.cards span:last-child { padding: 8px 12px 10px; font-weight: 700; line-height: 1.5; font-size: .9em; }

/* Encyclopedia: article */
article.kid { background: var(--paper); border-radius: 26px; padding: clamp(16px, 4vw, 40px);
  border: 3px solid color-mix(in srgb, var(--cat) 30%, transparent); }
.kid h1 { color: var(--cat); font-size: clamp(28px, 6vw, 42px); text-align: center; line-height: 1.4; margin: 0 0 .3em; }
.kid h2 { font-size: 1.15em; color: var(--cat); margin: 1.2em 0 .4em; }
.cat-badge { text-align: center; margin: 0 0 .2em; }
.cat-badge a { display: inline-block; padding: 2px 14px; border-radius: 999px; font-size: 15px; font-weight: 700;
  background: color-mix(in srgb, var(--cat) 15%, transparent); color: var(--cat); margin: 2px; }
figure { margin: 0; }
figure img { display: block; max-width: 100%; height: auto; border-radius: 12px; background: #fff; }
figure a { display: block; cursor: zoom-in; }
figcaption { font-size: .72em; line-height: 1.6; color: var(--muted); margin-top: 4px; }
.hero-pic { max-width: 560px; margin: 0 auto 1em; text-align: center; }
.hero-pic img { margin: 0 auto; border-radius: 18px; box-shadow: 0 6px 20px rgba(0,0,0,.12); }
.hero-pic.photo { max-width: 820px; }
.hero-pic.photo img { width: auto; max-height: min(560px, 75vh); }  /* whole photo, never cropped */
.brief { background: color-mix(in srgb, var(--cat) 8%, var(--paper)); border-radius: 20px; padding: 6px 22px 14px; }
.brief h2 { margin-top: .6em; }
.brief p { margin: 0; font-size: 1.08em; line-height: 2; }
.say { font: inherit; font-size: .8em; border: 0; background: color-mix(in srgb, var(--cat) 18%, transparent); border-radius: 999px;
  padding: 0 10px; cursor: pointer; vertical-align: middle; }
.say.on { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.15); } }
.sound-notice { position: fixed; inset-inline: 16px; bottom: 16px; margin: auto; max-width: 520px; z-index: 50; padding: 12px 18px;
  border-radius: 16px; background: var(--ink, #222); color: var(--paper, #fff); box-shadow: 0 6px 24px #0004; text-align: center;
  opacity: 0; transform: translateY(20px); transition: .25s; pointer-events: none; }
.sound-notice.on { opacity: 1; transform: none; }
.wow ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.wow li { padding: 14px 16px; border-radius: 20px; line-height: 1.8; font-size: .95em;
  background: color-mix(in srgb, var(--cat) 12%, var(--paper)); border: 2px solid color-mix(in srgb, var(--cat) 35%, transparent); }
.wow li:nth-child(odd) { transform: rotate(-.8deg); }
.wow li:nth-child(even) { transform: rotate(.8deg); }
.num { display: inline-block; color: var(--cat); font-size: 1.35em; line-height: 1; padding: 0 2px; }
.facts-card { margin-top: 1.2em; border: 2px dashed color-mix(in srgb, var(--cat) 45%, transparent); border-radius: 20px; padding: 6px 22px 16px; }
.fc-pics, .gallery > div { display: flex; gap: 14px; flex-wrap: wrap; }
.fc-pics figure, .gallery figure { max-width: 220px; }
.gallery.photos > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.gallery.photos figure { max-width: none; }
.gallery.photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: var(--bg); }
.credits { margin-top: 1.5em; font-size: .8em; color: var(--muted); }
.credits summary { cursor: pointer; }
.credits ul { margin: 6px 0 0; padding-inline-start: 1.2em; line-height: 1.8; }
.credits a { color: inherit; }
.facts-card dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 12px 0 0; }
.facts-card dl div { background: var(--bg); border-radius: 12px; padding: 6px 12px; }
.facts-card dt { font-weight: 700; color: var(--cat); font-size: .85em; }
.facts-card dd { margin: 0; font-size: .9em; line-height: 1.6; }
.learn-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.lc { background: var(--paper); border-radius: 20px; padding: 4px 18px 12px; border: 2px solid var(--line); border-top: 6px solid var(--cat); }
.lc h3 { color: var(--cat); font-size: 1em; margin: .6em 0 .2em; }
.lc p { margin: 0; line-height: 1.9; font-size: .95em; }
.videos > div { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.videos video { width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 18px; display: block; }
.more-cat ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.more-cat a { display: inline-block; padding: 4px 14px; border-radius: 999px; background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); font-size: .9em; }

/* Mini quiz in articles */
.kquiz { margin-top: 1.4em; background: color-mix(in srgb, #7c3aed 7%, var(--paper)); border-radius: 24px; padding: 4px 18px 16px; }
.kquiz h2 { color: #7c3aed; }
.kq { margin: 12px 0; }
.kq-q { margin: 0 0 8px; font-weight: 700; line-height: 1.9; }
.kq-n { display: inline-grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: #7c3aed; color: #fff; font-size: .85em; }
.blank { display: inline-block; min-width: 2.5em; text-align: center; border-bottom: 3px dashed #7c3aed; color: #7c3aed; }
.kq-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.kq-choices button, .choices button { font: inherit; font-weight: 700; padding: 6px 18px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--paper); color: var(--ink); cursor: pointer; transition: transform .1s; }
.kq-choices button:hover, .choices button:hover { border-color: #7c3aed; transform: translateY(-2px); }
.kq-choices.pics button { padding: 4px; width: min(30%, 150px); }
.kq-choices.pics img { width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; border-radius: 10px; display: block; }
.ok { background: #dcfce7 !important; border-color: #16a34a !important; color: #14532d !important; }
.bad { background: #fee2e2 !important; border-color: #dc2626 !important; color: #7f1d1d !important; }
.kq.done button { cursor: default; }
.kq-msg { min-height: 1.4em; margin: 6px 0 0; font-weight: 700; font-size: .9em; }
.kq-msg.ok { background: none !important; color: #16a34a !important; }
.kq-score { text-align: center; font-size: 1.3em; font-weight: 700; color: #7c3aed; margin: 8px 0 0; }
.confetti { position: absolute; z-index: 99; pointer-events: none; font-size: 22px; animation: pop 1.1s ease-out forwards; }
@keyframes pop { to { transform: translate(var(--dx), var(--dy)) rotate(200deg); opacity: 0; } }

/* Play areas shared by games and activities */
.play { background: var(--paper); border-radius: 26px; border: 3px solid color-mix(in srgb, var(--sec) 35%, transparent);
  padding: 14px clamp(12px, 3vw, 28px) 22px; text-align: center; }
.play h1 { color: var(--sec); margin: 0; font-size: clamp(28px, 6vw, 42px); line-height: 1.3; }
.play .help { color: var(--muted); margin: 0 0 10px; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 10px 0; }
.bar select { font: inherit; font-size: 16px; padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line);
  background: var(--paper); color: var(--ink); }
.stat { font-weight: 700; color: var(--sec); }
.msg { min-height: 1.6em; font-weight: 700; color: #16a34a; margin: 8px 0 0; }
.grid-list { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.grid-list a { display: flex; flex-direction: column; align-items: center; text-align: center; height: 100%; padding: 18px 14px;
  border-radius: 24px; background: var(--paper); color: var(--ink); text-decoration: none; border: 3px solid var(--line); transition: transform .15s; }
.grid-list a:hover { transform: translateY(-4px); border-color: var(--sec); }
.grid-list b { color: var(--sec); font-size: 1.2em; }
.grid-list small { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* Picture quiz */
.q-pic { max-width: 460px; margin: 14px auto; }
.q-pic img { border-radius: 18px; max-height: 340px; margin: 0 auto; object-fit: contain; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; max-width: 640px; margin: 0 auto; }

/* Memory */
.memory { display: grid; gap: 10px; max-width: 640px; margin: 10px auto; grid-template-columns: repeat(var(--cols, 4), 1fr); perspective: 800px; }
.mcard { aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer; position: relative; transform-style: preserve-3d;
  transition: transform .4s; }
.mcard.up, .mcard.done { transform: rotateY(180deg); }
.mcard > span { position: absolute; inset: 0; border-radius: 16px; backface-visibility: hidden; display: grid; place-items: center; overflow: hidden; }
.mcard .back { background: linear-gradient(135deg, #7c3aed, #ec4899); color: #fff; font-size: 34px; }
.mcard .face { transform: rotateY(180deg); background: #fff; border: 3px solid var(--line); }
.mcard .face img { width: 100%; height: 100%; object-fit: contain; }
.mcard.done .face { border-color: #16a34a; }

/* Sliding puzzle */
.slide { display: grid; gap: 4px; width: min(420px, 100%); aspect-ratio: 1; margin: 10px auto; grid-template-columns: repeat(var(--n), 1fr);
  background: var(--line); padding: 4px; border-radius: 16px; touch-action: manipulation; }
.slide button { border: 0; padding: 0; border-radius: 8px; cursor: pointer; background-repeat: no-repeat; position: relative; }
.slide button span { position: absolute; top: 2px; inset-inline-start: 6px; font-size: 13px; font-weight: 700; color: #fff;
  text-shadow: 0 0 3px #000; }
.slide .empty { background: transparent !important; cursor: default; }
.slide-ref { width: 120px; border-radius: 10px; margin: 4px auto; }

/* Mini sudoku */
.sudoku { display: grid; grid-template-columns: repeat(4, 1fr); width: min(360px, 100%); margin: 10px auto; border: 4px solid var(--ink); border-radius: 12px; overflow: hidden; }
.sudoku button { aspect-ratio: 1; border: 1px solid var(--line); background: var(--paper); font-size: 38px; cursor: pointer; padding: 0; color: var(--ink); }
.sudoku button.given { background: var(--bg); cursor: default; }
.sudoku button.sel { outline: 4px solid #7c3aed; outline-offset: -4px; }
.sudoku button.wrong { background: #fee2e2; }
.sudoku button:nth-child(4n+2) { border-inline-end: 3px solid var(--ink); }
.sudoku button:nth-child(n+5):nth-child(-n+8) { border-bottom: 3px solid var(--ink); }
.pick { display: flex; gap: 8px; justify-content: center; margin: 8px 0; }
.pick button { font-size: 34px; width: 64px; height: 64px; border-radius: 16px; border: 3px solid var(--line); background: var(--paper); cursor: pointer; }
.pick button:hover { border-color: #7c3aed; }

/* Simon */
.simon { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(340px, 100%); margin: 12px auto; }
.simon button { aspect-ratio: 1; border: 0; border-radius: 28px; font-size: 56px; cursor: pointer; opacity: .55;
  transition: opacity .1s, transform .1s; box-shadow: 0 6px 0 rgba(0,0,0,.18); }
.simon button:nth-child(1) { background: #ef4444; } .simon button:nth-child(2) { background: #22c55e; }
.simon button:nth-child(3) { background: #3b82f6; } .simon button:nth-child(4) { background: #facc15; }
.simon button.lit { opacity: 1; transform: scale(1.06); }

/* Odd one out */
.odd { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; max-width: 700px; margin: 10px auto; }
.odd button { border: 3px solid var(--line); border-radius: 18px; background: var(--paper); padding: 6px; cursor: pointer; color: var(--ink); font: inherit; }
.odd button:hover { border-color: var(--sec); }
.odd img { width: 100%; aspect-ratio: 1; object-fit: contain; border-radius: 12px; display: block; background: #fff; }
.odd span { display: block; font-size: .8em; font-weight: 700; line-height: 1.5; margin-top: 4px; }

/* Quick maths */
.mq { margin: 10px 0 16px; }
.mq .eq { font-size: clamp(40px, 9vw, 64px); font-weight: 800; color: var(--sec); line-height: 1.3; }
.mq .things { font-size: 40px; line-height: 1.4; max-width: 420px; margin: 0 auto; letter-spacing: 4px; }
#mchoices button { font-size: 28px; }

/* Tic-tac-toe */
.ttt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: min(330px, 100%); margin: 10px auto; }
.ttt button { aspect-ratio: 1; font-size: 54px; border-radius: 18px; border: 3px solid var(--line); background: var(--paper); cursor: pointer; padding: 0; }
.ttt button.win { background: #dcfce7; border-color: #16a34a; }

/* Patterns */
.pattern { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 14px 0; direction: rtl; }
.pattern span { font-size: 42px; width: 64px; height: 64px; display: grid; place-items: center; background: var(--bg); border-radius: 16px; }
.pattern .q { border: 3px dashed var(--sec); color: var(--sec); font-weight: 800; }

/* Spot the difference */
.finddiff { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 4px; width: min(480px, 100%); margin: 10px auto; }
.finddiff button { aspect-ratio: 1; border: 0; border-radius: 10px; background: var(--bg); font-size: clamp(18px, calc(260px / var(--n)), 48px);
  cursor: pointer; padding: 0; line-height: 1; }

/* Jigsaw (swap pieces) */
.jigsaw button.sel { outline: 4px solid #7c3aed; outline-offset: -4px; z-index: 1; }
.jigsaw button.placed { box-shadow: inset 0 0 0 3px rgba(22,163,74,.7); }

/* Tower of Hanoi */
.hanoi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 640px; margin: 14px auto; }
.peg { position: relative; height: 230px; border: 3px solid var(--line); border-radius: 18px; background: var(--bg); cursor: pointer;
  display: flex; flex-direction: column-reverse; align-items: center; padding: 10px 6px; gap: 4px; }
.peg.held { border-color: var(--sec); }
.peg .pole { position: absolute; bottom: 10px; width: 10px; height: 180px; border-radius: 6px; background: #92400e; }
.peg .disk { position: relative; height: 26px; border-radius: 13px; box-shadow: inset 0 -5px 0 rgba(0,0,0,.18); transition: transform .15s; }
.peg .disk.up { transform: translateY(-18px); }

/* Lights out */
.lights { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 8px; width: min(400px, 100%); margin: 10px auto; }
.lights button { aspect-ratio: 1; border-radius: 16px; border: 3px solid var(--line); background: #334155; cursor: pointer; font-size: 30px; padding: 0; }
.lights button.on { background: #fde047; border-color: #facc15; box-shadow: 0 0 18px #fde047; }

/* Pipes */
.pipes { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; width: min(440px, 100%); margin: 10px auto;
  background: var(--line); padding: 3px; border-radius: 14px; }
.pipes button { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: var(--paper); border-radius: 8px; cursor: pointer; }
.pipes svg { width: 100%; height: 100%; display: block; }
.pipes line { stroke: #9ca3af; stroke-width: 18; stroke-linecap: round; }
.pipes circle { fill: #9ca3af; }
.pipes .wet line { stroke: #3b82f6; } .pipes .wet circle { fill: #3b82f6; }
.pipes button span { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(16px, 5vw, 30px); pointer-events: none; }

/* Nonogram */
.nonogram table { border-collapse: collapse; margin: 10px auto; }
.nonogram th { font-weight: 800; color: var(--sec); font-size: 18px; line-height: 1.2; padding: 4px 8px; }
.nonogram .cclue { vertical-align: bottom; }
.nonogram .rclue { text-align: right; white-space: nowrap; }
.nonogram td { padding: 2px; }
.nonogram td button { width: clamp(44px, 12vw, 60px); height: clamp(44px, 12vw, 60px); border: 2px solid var(--line); border-radius: 8px;
  background: var(--paper); cursor: pointer; font-size: 24px; color: #9ca3af; padding: 0; }
.nonogram td button.fill { background: var(--sec); border-color: var(--sec); }
.nonogram .reveal { font-size: 80px; margin: 0; line-height: 1.2; }

/* Shadows */
.shadow-q { font-size: 150px; line-height: 1.2; margin: 6px 0; }
.shadow-q .shadow { display: inline-block; filter: brightness(0); transition: filter .4s; }
.shadow-q .shadow.shown { filter: none; }
.shadow-pick button { font-size: 46px; width: 84px; height: 84px; }

/* Catalogue: subject and level badges, level pages */
.badges { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 4px 0 0; }
.badges a { font-size: 14px; font-weight: 700; padding: 1px 12px; border-radius: 999px; color: var(--b);
  background: color-mix(in srgb, var(--b) 14%, var(--paper)); text-decoration: none; }
.nav-label { margin: 10px 0 0; font-size: 15px; color: var(--muted); font-weight: 700; }
.kids-hero .subcats { margin-top: 4px; }
.row-title { color: var(--accent); margin: 1em 0 0; }
.subcat h3 { margin: .8em 0 0; color: var(--muted); font-size: 1em; }
.grid-list .lv { font-style: normal; font-size: 13px; font-weight: 700; color: var(--sec); margin-top: 6px;
  background: color-mix(in srgb, var(--sec) 12%, transparent); border-radius: 999px; padding: 0 10px; }
.levels-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 18px 0 0; list-style: none; padding: 0; }
.levels-row a { display: inline-block; padding: 6px 16px; border-radius: 999px; background: var(--paper); border: 3px solid #0ea5e9;
  color: #0369a1; font-weight: 800; text-decoration: none; }
.levels-row a:hover { background: #0ea5e9; color: #fff; }

/* Magic colouring */
.legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; }
.legend button { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-weight: 800; font-size: 20px; padding: 4px 14px;
  border-radius: 999px; border: 3px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; direction: ltr; }
.legend button i { width: 26px; height: 26px; border-radius: 50%; background: var(--c); border: 2px solid rgba(0,0,0,.2); }
.legend button.on { border-color: var(--ink); transform: scale(1.08); }
.magic { display: grid; grid-template-columns: repeat(10, 1fr); gap: 2px; width: min(560px, 100%); margin: 8px auto; direction: ltr; }
.magic button { aspect-ratio: 1; border: 1px solid #d1d5db; background: #fff; border-radius: 4px; padding: 0; cursor: pointer;
  font: 700 clamp(9px, 2.4vw, 15px) var(--kid); color: #374151; }
.magic button.painted { color: transparent; border-color: transparent; }

/* Compare numbers */
.compare { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 14px 0; font-size: clamp(40px, 9vw, 64px); font-weight: 800; }
.compare .things { font-size: 30px; max-width: 220px; line-height: 1.4; letter-spacing: 2px; }
.compare .cp-q { width: 80px; height: 80px; border-radius: 20px; display: grid; place-items: center; border: 4px dashed var(--sec); color: var(--sec); }
.choices.sym b { font-size: 1.4em; }

/* Sentence order */
.sn-hint { font-size: 64px; margin: 0; line-height: 1.3; }
.sentence { min-height: 70px; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; padding: 10px;
  border: 3px dashed var(--line); border-radius: 18px; margin: 8px auto; max-width: 700px; }
.sentence.right { border-color: #16a34a; background: #dcfce7; }
.sentence .placeholder { color: var(--muted); font-size: 16px; }
.word-bank { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.sentence button, .word-bank button { font: inherit; font-weight: 800; font-size: 22px; padding: 4px 16px; border-radius: 14px;
  border: 3px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; }
.word-bank button { border-color: var(--sec); }

/* Shapes, calendar */
.shape-q { width: min(240px, 60vw); display: block; margin: 6px auto; }
.cal-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; padding: 0; margin: 8px 0; list-style: none; counter-reset: c; }
.cal-list li { counter-increment: c; background: var(--bg); border-radius: 12px; padding: 2px 12px; font-size: 16px; }
.cal-list li::before { content: counter(c) " · "; color: var(--sec); font-weight: 800; }
.cal-list small { color: var(--muted); }
.cal-q { font-size: 1.3em; font-weight: 800; color: var(--sec); }

/* Hangman */
.balloons { font-size: 42px; margin: 4px 0; letter-spacing: 4px; min-height: 1.4em; }
.balloons .popped { opacity: .35; font-size: 28px; }
.hg-hint { font-size: 22px; margin: 0; }
.word-slots .gap:empty::after { content: ' '; }
.keyboard { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 640px; margin: 10px auto; }
.keyboard button { width: 46px; height: 50px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); color: var(--ink);
  font: 800 24px var(--kid); cursor: pointer; padding: 0; }
.keyboard button:disabled { cursor: default; }

/* Robot programming */
.robot-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 3px; width: min(400px, 100%); margin: 10px auto; direction: ltr;
  background: #c7d2fe; padding: 3px; border-radius: 14px; }
.robot-grid span { aspect-ratio: 1; background: #eef2ff; border-radius: 8px; display: grid; place-items: center; font-size: clamp(20px, 6vw, 36px); }
.program { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 52px; padding: 6px; margin: 6px auto; max-width: 560px;
  border: 3px dashed var(--line); border-radius: 14px; direction: ltr; }
.program .step { font-size: 26px; border-radius: 8px; padding: 0 2px; }
.program .step.now { background: #fde68a; }
.program .placeholder { color: var(--muted); font-size: 15px; direction: rtl; }

/* Languages: word cards, quiz and spelling */
.vcards { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.vcards button { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px;
  border-radius: 18px; border: 2px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; font: inherit; transition: transform .1s; }
.vcards button:hover, .vcards button.said { border-color: var(--sec); transform: translateY(-2px); }
.vcards .ve { font-size: 46px; line-height: 1.2; }
.vcards b { font-size: 1.15em; color: var(--sec); font-family: "Segoe UI", Tahoma, sans-serif; }
.vcards small { color: var(--muted); font-size: .85em; }
.vstats { font-weight: 700; color: var(--sec); }
.vq { margin: 8px 0; }
.vq .ve.big { font-size: 110px; line-height: 1.2; }
.vq .var { margin: 0; font-size: 1.3em; font-weight: 800; }
.vlisten { font-size: 64px; width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--sec); background: var(--paper); cursor: pointer; }
.vlisten.small { font-size: 22px; width: 44px; height: 44px; border-width: 2px; vertical-align: middle; }
#vchoices button { font-family: "Segoe UI", Tahoma, sans-serif; font-size: 22px; }
.emoji-choices button { font-size: 52px !important; padding: 8px !important; }
.spell-slots { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: center; margin: 12px 0; }
.spell-slots .prefix { font: 700 30px "Segoe UI", Tahoma, sans-serif; color: var(--muted); margin-inline-end: 4px; }
.spell-slots .slot { width: 48px; height: 58px; border-radius: 12px; border: 3px dashed var(--line); background: var(--bg);
  font: 800 30px "Segoe UI", Tahoma, sans-serif; color: var(--ink); cursor: pointer; padding: 0; }
.spell-slots .slot.fixed { border-style: solid; cursor: default; }
.spell-slots.right .slot { border: 3px solid #16a34a; background: #dcfce7; }
.spell-tiles { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.spell-tiles button { width: 52px; height: 58px; border-radius: 12px; border: 3px solid var(--sec); background: var(--paper);
  font: 800 30px "Segoe UI", Tahoma, sans-serif; color: var(--ink); cursor: pointer; padding: 0; }

/* Maze */
.maze-wrap { display: inline-block; max-width: 100%; touch-action: none; }
#maze { max-width: 100%; height: auto; background: #fff; border-radius: 12px; }
.pad { display: grid; grid-template-columns: repeat(3, 56px); gap: 6px; justify-content: center; margin: 10px auto; direction: ltr; }
.pad button { height: 56px; font-size: 26px; border-radius: 14px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; }
.pad .u { grid-column: 2; } .pad .l { grid-column: 1; grid-row: 2; } .pad .d { grid-column: 2; grid-row: 2; } .pad .r { grid-column: 3; grid-row: 2; }

/* Word search */
.ws { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; align-items: flex-start; }
.ws-grid { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: 2px; width: min(520px, 100%); touch-action: none; user-select: none; }
.ws-grid span { aspect-ratio: 1; display: grid; place-items: center; font-size: clamp(16px, 3.6vw, 26px); font-weight: 700;
  background: var(--bg); border-radius: 8px; cursor: pointer; }
.ws-grid span.sel { background: #fde68a; color: #000; }
.ws-grid span.found { background: color-mix(in srgb, var(--hue) 45%, #fff); color: #000; }
.ws-words { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; max-width: 360px; justify-content: center; }
.ws-words li { padding: 2px 14px; border-radius: 999px; background: var(--bg); border: 2px solid var(--line); }
.ws-words li.found { text-decoration: line-through; opacity: .55; }

/* Connect the dots */
.dots-box { max-width: 520px; margin: 0 auto; flex: none; }
#dots .dot circle { fill: #1f2937; }
#dots .dot.done circle { fill: #10b981; }
#dots .dot.next circle:first-child { fill: #ec4899; animation: pulse 1s infinite; transform-box: fill-box; transform-origin: center; }
#dots text { font: 700 18px var(--kid); fill: #1f2937; text-anchor: middle; }
#dots .reveal { font-size: 90px; }

/* Arabic letters */
.letter-list { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0 14px; }
.letter-list button { width: 46px; height: 46px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper);
  color: var(--ink); font-size: 24px; font-weight: 700; cursor: pointer; padding: 0; }
.letter-list button.on { background: var(--sec); border-color: var(--sec); color: #fff; }
.letter-card { text-align: center; }
.big-letter { font-size: 110px; line-height: 1.1; color: var(--sec); font-weight: 800; }
.lname { margin: 0; font-weight: 700; }
.lforms { display: flex; gap: 8px; justify-content: center; margin: 6px 0; }
.lforms span { font-size: 34px; background: var(--bg); border-radius: 12px; padding: 0 12px; }
.lword { font-size: 30px; font-weight: 700; margin: 4px 0; }
.lword .emoji { font-size: 44px; vertical-align: middle; }
#ltrace { cursor: crosshair; }

/* Picture-word matching */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 640px; margin: 10px auto; }
.match-pics, .match-words { display: grid; gap: 10px; }
.match button { border: 3px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); cursor: pointer;
  font: inherit; font-weight: 700; padding: 4px; min-height: 64px; transition: transform .1s; }
.match-pics img { width: 100%; height: 110px; object-fit: contain; border-radius: 12px; display: block; background: #fff; }
.match button.sel { border-color: var(--sec); transform: scale(1.04); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sec) 30%, transparent); }
.match button.paired { border-color: var(--hue); background: color-mix(in srgb, var(--hue) 22%, var(--paper)); cursor: default; }

/* Missing letter */
.word-slots { display: flex; gap: 6px; justify-content: center; margin: 10px 0; direction: rtl; }
.word-slots span { width: 54px; height: 62px; display: grid; place-items: center; font-size: 34px; font-weight: 800;
  background: var(--bg); border-radius: 12px; border-bottom: 4px solid var(--line); }
.word-slots .gap { border: 3px dashed var(--sec); color: var(--sec); }
.letters-pick button { font-size: 36px; font-weight: 800; color: var(--ink); }

/* Clock */
.clockface { width: min(300px, 80vw); display: block; margin: 10px auto; }
.clockface .rim { fill: #fff; stroke: var(--sec); stroke-width: 6; }
.clockface text { font: 700 17px var(--kid); text-anchor: middle; dominant-baseline: central; fill: #1f2937; }
.clockface line { stroke: #9ca3af; stroke-width: 1.5; }
.clockface .hour { stroke: #1f2937; stroke-width: 8; stroke-linecap: round; }
.clockface .minute { stroke: var(--sec); stroke-width: 5; stroke-linecap: round; }
.clockface .pin { fill: #1f2937; }
#cchoices button { font-size: 26px; }

/* Piano */
.piano { display: flex; gap: 6px; justify-content: center; margin: 16px auto; direction: ltr; max-width: 640px; touch-action: manipulation; }
.piano button { flex: 1; height: 220px; border: 0; border-radius: 0 0 16px 16px; background: var(--k); cursor: pointer;
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 12px; box-shadow: inset 0 -10px 0 rgba(0,0,0,.15);
  transition: transform .08s; }
.piano button span { color: #fff; font-weight: 800; font-size: 20px; text-shadow: 0 1px 2px rgba(0,0,0,.4); }
.piano button.down { transform: translateY(6px); box-shadow: inset 0 -4px 0 rgba(0,0,0,.15); filter: brightness(1.15); }
.piano button.next { outline: 5px solid #1f2937; outline-offset: 3px; animation: pulse 1s infinite; }

/* Drawing board and colouring */
.studio { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; align-items: flex-start; }
.palette { display: grid; grid-template-columns: repeat(6, 38px); gap: 6px; justify-content: center; }
.palette button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line);
  background: var(--c); cursor: pointer; }
.palette button.on { box-shadow: 0 0 0 4px var(--ink); transform: scale(1.1); }
.canvas-box { flex: 1 1 520px; max-width: 760px; background: #fff; border-radius: 18px; border: 3px solid var(--line); overflow: hidden; touch-action: none; }
.canvas-box svg, .canvas-box canvas { display: block; width: 100%; height: auto; }
.canvas-box svg [data-fill] { cursor: pointer; }
.side { display: flex; flex-direction: column; gap: 10px; align-items: center; min-width: 240px; }
.sizes { display: flex; gap: 8px; }
.sizes button { width: 44px; height: 44px; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); cursor: pointer;
  display: grid; place-items: center; }
.sizes button i { display: block; border-radius: 50%; background: var(--ink); }
.sizes button.on { border-color: var(--ink); }
.color-list { list-style: none; padding: 0; margin: 20px 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.color-list a { display: block; background: #fff; border-radius: 20px; border: 3px solid var(--line); padding: 10px; text-align: center;
  color: #1f2937; text-decoration: none; transition: transform .15s; }
.color-list a:hover { transform: translateY(-4px) rotate(1deg); border-color: #ec4899; }
.color-list img { width: 100%; height: auto; aspect-ratio: 1; object-fit: contain; }
.color-list b { display: block; font-size: .95em; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.85); display: flex; flex-direction: column;
  align-items: center; justify-content: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 85vh; border-radius: 10px; background: #fff; }
.lightbox p { color: #eee; font-size: 16px; max-width: 800px; text-align: center; margin: 10px 0 0; line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .confetti { display: none; } .say.on { animation: none; } .wow li { transform: none !important; }
  .mcard { transition: none; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; gap: 6px 10px; }
  .sections { order: 3; flex-basis: 100%; }
  .logo { flex: 1; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tiles a { padding: 12px 8px; }
  .tiles small { display: none; }
  .big-emoji { font-size: 40px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .memory { gap: 6px; }
}
@media print {
  .top, .foot, .crumbs, .bar, .side, .pad, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .play, .canvas-box { border: 0; }
}

/* Computer: parts, mouse and keyboard practice, algorithms, binary cards, pixel pictures, safety */
.pc-parts b { font-family: inherit; }
.pc-parts .pc-kind { display: none; font-style: normal; font-size: 13px; font-weight: 700; line-height: 1.5; margin-top: 4px;
  padding: 2px 8px; border-radius: 10px; background: color-mix(in srgb, var(--sec) 14%, transparent); color: var(--sec); }
.pc-parts button.open .pc-kind { display: block; }
.pc-parts .pc-in { background: #dbeafe; color: #1e40af; }
.pc-parts .pc-out { background: #fce7f3; color: #9d174d; }
.pc-q { margin: 8px 0 12px; }
.pc-q .ve.big { font-size: 96px; line-height: 1.2; }
.pc-q p { margin: 0; font-weight: 700; }
.pc-ask { font-size: 1.25em; color: var(--sec); }
#pcchoices .ve { font-size: 1.4em; vertical-align: middle; }
.pc-situation { max-width: 640px; margin-inline: auto; padding: 18px; border-radius: 18px; background: var(--bg);
  border: 2px dashed var(--line); font-size: 1.15em; font-weight: 700; }
.pc-note { font-size: 14px; color: var(--muted); }

.pc-field { position: relative; height: clamp(300px, 55vh, 440px); max-width: 760px; margin: 8px auto; border-radius: 20px;
  background: color-mix(in srgb, var(--sec) 10%, var(--bg)); border: 3px solid var(--line); overflow: hidden; touch-action: manipulation; }
.pc-target-item { position: absolute; font-size: 46px; line-height: 1; width: 64px; height: 64px; padding: 0; border: 0;
  background: none; cursor: pointer; user-select: none; transition: transform .1s; }
.pc-target-item:hover { transform: scale(1.15); }
.pc-target-item.held { transform: scale(1.25); z-index: 2; cursor: grabbing; }
.pc-target-item.wiggle { animation: pc-wiggle .3s; }
@keyframes pc-wiggle { 25% { transform: rotate(-12deg); } 75% { transform: rotate(12deg); } }
.pc-basket { position: absolute; bottom: 10px; left: 50%; translate: -50% 0; width: 130px; height: 110px; font-size: 90px; line-height: 110px;
  text-align: center; border: 3px dashed var(--sec); border-radius: 20px; background: var(--paper); }

.pc-target { font: 800 clamp(44px, 10vw, 72px) "Segoe UI", Tahoma, sans-serif; min-height: 1.4em; letter-spacing: .05em; }
.pc-target[dir="rtl"] { font-family: var(--kid); letter-spacing: 0; }
.pc-target .done { color: #16a34a; }
.pc-target .now { color: var(--sec); text-decoration: underline 4px; text-underline-offset: 10px; }
.pc-kb { max-width: 680px; margin: 8px auto; padding: 8px; border-radius: 16px; background: var(--bg); border: 2px solid var(--line); }
.pc-kb-row { display: flex; gap: 5px; justify-content: center; margin: 5px 0; }
.pc-kb-row:nth-child(2) { padding-left: 4%; }
.pc-kb-row:nth-child(3) { padding-left: 10%; }
.pc-kb button { flex: 0 1 52px; min-width: 0; height: 52px; font: 700 22px var(--kid); border-radius: 10px; border: 2px solid var(--line);
  border-bottom-width: 4px; background: var(--paper); color: var(--ink); cursor: pointer; padding: 0; touch-action: manipulation; }
.pc-kb button.lit { background: var(--sec); border-color: var(--sec); color: #fff; transform: translateY(-2px); }
.pc-kb button.miss { background: #fee2e2; border-color: #dc2626; }
.pc-space { display: block; width: 50%; height: 34px; border-radius: 10px; border: 2px solid var(--line); background: var(--paper);
  color: var(--muted); font-size: 13px; line-height: 30px; }

.pc-prog { max-width: 560px; margin: 8px auto; padding: 10px 12px; min-height: 60px; border-radius: 18px; border: 3px dashed var(--line);
  list-style-position: inside; text-align: start; }
.pc-prog li { margin: 4px 0; border-radius: 12px; }
.pc-prog li.placeholder { list-style: none; color: var(--muted); font-size: 15px; text-align: center; }
.pc-prog button, .pc-steps button { font: inherit; font-weight: 700; padding: 4px 14px; border-radius: 12px; border: 2px solid var(--line);
  background: var(--paper); color: var(--ink); cursor: pointer; }
.pc-prog li.ok button { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.pc-prog li.bad button { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.pc-steps { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0; }
.pc-steps button:hover { border-color: var(--sec); transform: translateY(-2px); }

.pc-goal { font-size: 1.3em; font-weight: 800; margin: 4px 0; }
.pc-goal b { color: var(--sec); font-size: 1.4em; }
.pc-bin { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.pc-bin button { width: clamp(56px, 16vw, 104px); aspect-ratio: 3 / 4; border-radius: 14px; border: 3px solid var(--sec); cursor: pointer;
  padding: 6px; display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: repeating-linear-gradient(45deg, var(--sec) 0 8px, color-mix(in srgb, var(--sec) 70%, #fff) 8px 16px); }
.pc-bin button.up { background: #fff; color: #1f2937; }
.pc-bin .dots { display: flex; flex-wrap: wrap; gap: 3px; justify-content: center; align-content: center; flex: 1; }
.pc-bin .dots i { width: 9px; height: 9px; border-radius: 50%; background: #1f2937; }
.pc-bin b { font-size: 18px; }
.pc-bits { font: 800 32px "Segoe UI", Tahoma, sans-serif; margin: 4px 0; }
.pc-bits b { color: var(--muted); margin: 0 4px; }
.pc-bits b.one { color: var(--sec); }
.pc-bits > b { color: var(--ink); }

.pc-pixels { display: inline-block; margin: 8px auto; }
.pc-px-row { display: flex; align-items: center; gap: 3px; margin-bottom: 3px; }
.pc-px-row .code { font: 700 clamp(13px, 3.4vw, 18px) ui-monospace, Consolas, monospace; letter-spacing: .12em; min-width: 7.6em;
  text-align: left; color: var(--muted); margin-right: 8px; }
.pc-px-row button { width: clamp(30px, 8.5vw, 44px); aspect-ratio: 1; padding: 0; border-radius: 6px; border: 2px solid var(--line);
  background: #fff; cursor: pointer; }
.pc-px-row button.on { background: var(--sec); border-color: var(--sec); }
.pc-thumb { width: 100%; height: auto; border-radius: 16px; margin-bottom: 8px; }
.pc-figs figure { margin: 10px auto 16px; max-width: 680px; text-align: center; }
.pc-figs img { width: 100%; height: auto; border-radius: 18px; border: 2px solid var(--line); }
.pc-figs figcaption { font-size: .9em; margin-top: 6px; }
.pc-swatches { display: flex; gap: 18px; justify-content: center; margin: 8px 0; }
.pc-swatches figure { margin: 0; }
.pc-swatch { width: clamp(110px, 30vw, 170px); aspect-ratio: 1; border-radius: 24px; border: 4px solid var(--line); }
.pc-rgb { display: grid; gap: 8px; max-width: 420px; margin: 10px auto; }
.pc-rgb-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.pc-rgb-row b { width: 4em; color: var(--c); }
.pc-rgb-row button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--c); background: var(--paper); color: var(--ink);
  font: 800 24px var(--kid); cursor: pointer; padding: 0; }
.pc-level { display: flex; gap: 4px; }
.pc-level i { width: 26px; height: 26px; border-radius: 6px; background: var(--line); }
.pc-level i.on { background: var(--c); }
.pc-key { font: 800 clamp(30px, 8vw, 48px) "Segoe UI", Tahoma, sans-serif; color: var(--sec); }
.pc-beads { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; font-size: clamp(26px, 6vw, 38px); line-height: 1.2;
  min-height: 1.3em; margin: 6px 0; }
.pc-out { padding: 6px; border-radius: 16px; border: 3px dashed var(--line); max-width: 640px; margin-inline: auto; }
.pc-progs button { font-size: 18px; }
.pc-loop { max-width: 520px; margin: 10px auto; padding: 8px 14px; border-radius: 18px; background: var(--bg); border: 2px solid var(--line); }
.pc-loop p { margin: 4px 0; font-weight: 700; }
.pc-loop #pctimes { color: var(--sec); font-size: 1.4em; }
.pc-step { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--sec); background: var(--paper); color: var(--ink); font: 800 20px var(--kid); cursor: pointer; padding: 0; }
.pc-unit em { font-size: 15px; color: var(--muted); font-style: normal; }
.pc-rule { max-width: 560px; margin: 8px auto; padding: 12px 16px; border-radius: 18px; background: color-mix(in srgb, var(--sec) 10%, var(--paper));
  border: 2px solid var(--sec); font-weight: 700; line-height: 1.9; }
.pc-rule b { color: var(--sec); }
.pc-boxes { display: flex; gap: 14px; justify-content: center; }
.pc-boxes button { font-size: 52px; line-height: 1.1; padding: 8px 22px; border-radius: 22px; border: 3px solid var(--line); background: var(--paper);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; color: var(--ink); }
.pc-boxes button span { font: 700 16px var(--kid); }
.pc-boxes button:hover { border-color: var(--sec); transform: translateY(-2px); }
.pc-pass { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 10px 0; }
.pc-pass input { font: 700 22px "Segoe UI", Tahoma, sans-serif; padding: 8px 18px; border-radius: 999px; border: 3px solid var(--line);
  background: var(--paper); color: var(--ink); width: min(420px, 100%); }
.pc-meter { max-width: 420px; height: 16px; margin: 6px auto; border-radius: 999px; background: var(--line); overflow: hidden; }
.pc-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.pc-checks { list-style: none; padding: 0; max-width: 420px; margin: 8px auto; text-align: start; }
.pc-checks li { margin: 4px 0; padding: 2px 10px; border-radius: 10px; color: var(--muted); }
.pc-checks li.ok { color: inherit; }
.pc-mail { display: grid; gap: 8px; max-width: 560px; margin: 10px auto; text-align: start; }
.pc-mail label { display: grid; gap: 2px; font-weight: 700; color: var(--muted); font-size: 15px; }
.pc-mail input, .pc-mail textarea { font: inherit; font-size: 17px; color: var(--ink); padding: 6px 12px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--paper); }
.pc-mail textarea { resize: vertical; }
.pc-journey { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; list-style: none; padding: 0; margin: 10px 0; }
.pc-journey li { padding: 4px 12px; border-radius: 999px; border: 2px solid var(--line); color: var(--muted); font-weight: 700; font-size: 15px;
  transition: transform .2s; }
.pc-journey li.passed { border-color: var(--sec); color: var(--ink); }
.pc-journey li.now { background: var(--sec); color: #fff; transform: scale(1.1); }
.pc-inbox { max-width: 600px; margin: 10px auto; padding: 12px 18px; border-radius: 18px; border: 2px solid var(--line); background: var(--bg); text-align: start; }
.pc-inbox p { margin: 2px 0; }
.pc-from span { color: var(--muted); font-size: 14px; font-family: "Segoe UI", Tahoma, sans-serif; }
.pc-subject { font-weight: 800; color: var(--sec); font-size: 1.15em; }
.pc-net { display: grid; grid-template-columns: 44px repeat(5, 1fr) 44px; gap: 8px; max-width: 520px; margin: 10px auto; align-items: center; }
.pc-net .pc-end { font-size: 40px; text-align: center; }
.pc-net button { aspect-ratio: 1; border-radius: 16px; border: 3px solid var(--line); background: var(--paper); font-size: clamp(20px, 5vw, 30px);
  cursor: pointer; padding: 0; }
.pc-net button.on { background: color-mix(in srgb, var(--sec) 25%, var(--paper)); border-color: var(--sec); }
.pc-net button.broken { background: #fee2e2; border-color: #fca5a5; cursor: not-allowed; }
.pc-net button.miss, .pc-shelf button.miss { animation: pc-wiggle .3s; border-color: #dc2626; }
.pc-arrived { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; direction: rtl; }
.pc-arrived span { display: flex; flex-direction: column; align-items: center; min-width: 48px; padding: 2px 6px 6px; border-radius: 12px;
  border: 2px dashed var(--line); font-size: 28px; font-weight: 800; line-height: 1.2; color: var(--muted); }
.pc-arrived span.got { border-style: solid; border-color: #16a34a; color: var(--ink); }
.pc-arrived small { font-size: 12px; color: var(--muted); }
.pc-queue { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; min-height: 64px; margin: 10px 0; }
.pc-queue div { display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 16px; border: 2px solid var(--line); background: var(--bg); }
.pc-queue div.now { border-color: var(--sec); background: color-mix(in srgb, var(--sec) 15%, var(--paper)); transform: scale(1.08); }
.pc-queue span { font-size: 28px; }
.pc-shelf { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; max-width: 640px; margin: 10px auto; }
.pc-shelf button { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 16px; border: 3px solid var(--line);
  background: var(--paper); color: var(--ink); font: 700 16px var(--kid); cursor: pointer; }
.pc-shelf button:hover { border-color: var(--sec); }
.pc-shelf span { font-size: 32px; line-height: 1.2; }
.pc-shelf small { color: var(--muted); font-size: 13px; }
.pc-shelf .pc-404 { border-color: #fca5a5; }
.pc-words dl { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); margin: 0; }
.pc-words dl div { padding: 10px 14px; border-radius: 16px; background: var(--paper); border: 2px solid var(--line); border-inline-start: 6px solid var(--cat); }
.pc-words dt { font-weight: 800; color: var(--cat); }
.pc-words dd { margin: 0; font-size: .92em; line-height: 1.7; }
.pc-try-home { margin-top: 1em; padding: 4px 20px 12px; border-radius: 20px; background: color-mix(in srgb, #f59e0b 12%, var(--paper));
  border: 2px dashed #f59e0b; }
.pc-try-home h2 { color: #b45309 !important; }
.pc-try-home p { margin: 0; line-height: 2; }

/* Language lessons (lessons.py) and conjugation practice */
.fl { font-family: "Segoe UI", Tahoma, Arial, sans-serif; font-weight: 700; color: var(--cat, var(--sec)); unicode-bidi: isolate; }
.ls-board { width: 100%; height: auto; border-radius: 18px; }
.ls-sec { background: var(--paper); border: 2px solid var(--line); border-top: 6px solid var(--cat); border-radius: 20px; padding: 6px 18px 14px; margin: 14px 0; }
.ls-sec h3 { margin: .5em 0 .3em; color: var(--cat); }
.ls-n { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--cat); color: #fff; font-size: .8em; }
.ls-sec p { margin: .2em 0 .6em; line-height: 2; }
.ls-table-wrap { overflow-x: auto; }
.ls-table { border-collapse: separate; border-spacing: 0; margin: 8px auto; min-width: min(360px, 100%); border-radius: 14px; overflow: hidden; border: 2px solid var(--line); }
.ls-table th { background: color-mix(in srgb, var(--cat) 15%, var(--paper)); color: var(--cat); padding: 6px 14px; font-size: .9em; }
.ls-table td { padding: 6px 16px; border-top: 1px solid var(--line); text-align: center; }
.ls-table td.fl { font-size: 1.15em; color: var(--ink); }
.ls-table tbody tr:nth-child(even) td { background: color-mix(in srgb, var(--cat) 5%, var(--paper)); }
.ls-end { color: #dc2626; }
.ls-examples { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 8px; }
.ls-examples li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 6px 12px; border-radius: 14px; background: var(--bg); }
.ls-examples .fl { font-size: 1.1em; color: var(--ink); }
.ls-examples small { color: var(--muted); font-size: .95em; }
.ls-say { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--cat); background: var(--paper); cursor: pointer; font-size: 16px; padding: 0; flex: none; }
.ls-say:hover { background: color-mix(in srgb, var(--cat) 15%, var(--paper)); }
.ls-tips ul { margin: 0; padding-inline-start: 1.2em; line-height: 2; }
.ls-nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin: 18px 0 0; }
.ls-nav .btn { font-size: 15px; }
.conj-task { font: 800 clamp(30px, 7vw, 46px) "Segoe UI", Tahoma, sans-serif; color: var(--sec); margin: 0; }
.conj-tense { margin: 0; font-weight: 700; color: var(--muted); }
#vchoices.choices button[lang="fr"], #vchoices.choices button[lang="en"] { font-family: "Segoe UI", Tahoma, sans-serif; font-size: 20px; }

/* التربية الإسلامية */
.isl-cards div { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 10px;
  border-radius: 18px; border: 2px solid var(--line); background: var(--paper); text-align: center; }
.isl-cards b { font-family: var(--kid); }
.isl-cards small { line-height: 1.7; }
.isl-hero { font-size: clamp(90px, 22vw, 140px); line-height: 1.2; text-align: center; margin: 0 0 .2em; }
.isl-quote { margin: 1em 0; padding: 14px 22px; border-radius: 20px; background: color-mix(in srgb, var(--cat) 10%, var(--paper));
  border-inline-start: 6px solid var(--cat); }
.isl-quote blockquote { margin: 0; font: 700 1.3em/2 Amiri, serif; }
.isl-quote figcaption { margin-top: 4px; font-size: .85em; color: var(--muted); }
.isl-ayat button, .pc-prog.isl-ayat button { font: 700 1.3em/1.9 Amiri, serif; }
.isl-choices button { line-height: 1.7; }
.isl-surah { max-width: 640px; margin: 14px auto; padding: 10px 22px 16px; border-radius: 20px; border: 3px solid var(--sec);
  background: var(--paper); text-align: center; }
.isl-surah h2 { color: var(--sec); margin: .3em 0; }
.isl-surah p { margin: 0; font: 400 1.5em/2.3 Amiri, serif; }
.isl-basmala { display: block; }
.isl-num { color: var(--sec); font-size: .8em; white-space: nowrap; }
.isl-name, .isl-names button { font: 700 1.5em/1.6 Amiri, serif !important; color: var(--sec); }

/* Mathematics: counting, number line, blocks, fractions, money, ruler, grids, symmetry, angles, solids */
.play [hidden] { display: none !important; }
.m-choices button { font-size: 22px; }
.m-choices small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
.m-big { font-size: clamp(44px, 10vw, 64px); font-weight: 800; color: var(--sec); line-height: 1.2; margin: 0; }
.pc-ask .m-big { font-size: 1.5em; }
.m-eq { font: 800 clamp(30px, 7vw, 46px) var(--kid); margin: 6px 0; }
.m-gap { display: inline-block; min-width: 1.4em; padding: 0 .2em; border-radius: 12px; border: 3px dashed var(--sec); color: var(--sec); }
.m-objs { display: grid; grid-template-columns: repeat(5, auto); justify-content: center; gap: 4px 10px; font-size: clamp(32px, 8vw, 46px); line-height: 1.2; margin: 6px 0; }
.m-svg, .m-linesvg, .m-rulersvg, .m-gridsvg, .m-anglesvg, .m-pie, .m-bar { display: block; margin: 6px auto; max-width: 100%; height: auto; }
.m-linesvg { width: 640px; }
.m-axis, .m-tick { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.m-tick { stroke-width: 2; }
.m-linesvg text, .m-rulersvg text { fill: var(--ink); font: 700 20px var(--kid); text-anchor: middle; }
.m-linesvg text.m-shown { fill: #16a34a; font-size: 24px; }
.m-arrow { fill: var(--sec); }
.m-hit { fill: transparent; cursor: pointer; }
.m-hit:hover { fill: color-mix(in srgb, var(--sec) 15%, transparent); }
.m-hit.ok { fill: rgba(22, 163, 74, .3); }
.m-hit.bad { fill: rgba(220, 38, 38, .3); }

.m-blocks, .m-bgrp, .m-cols { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: flex-end; }
.m-blocks { margin: 10px 0; min-height: 70px; }
.m-bgrp { gap: 4px; }
.m-bgrp i { display: block; border: 1.5px solid #1e3a8a; background-color: #93c5fd; }
.m-bgrp .m-h { width: 80px; height: 80px; background-image: linear-gradient(#1e3a8a55 1px, transparent 1px), linear-gradient(90deg, #1e3a8a55 1px, transparent 1px);
  background-size: 8px 8px; background-color: #fcd34d; border-color: #92400e; }
.m-bgrp .m-t { width: 10px; height: 80px; background-image: linear-gradient(#1e3a8a77 1px, transparent 1px); background-size: 8px 8px; background-color: #86efac; border-color: #166534; }
.m-bgrp .m-o { width: 10px; height: 10px; }
.m-col { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 120px; padding: 10px; border-radius: 18px; border: 2px dashed var(--line); background: var(--bg); }
.m-col .m-bgrp { min-height: 84px; max-width: 260px; }
.m-pm { display: flex; align-items: center; gap: 10px; font: 800 26px var(--kid); }
.m-pm button { width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--sec); background: var(--paper); color: var(--sec); font: 800 26px/1 var(--kid); cursor: pointer; }
.m-total { font-weight: 700; }
.m-total b { color: var(--sec); font-size: 1.3em; }

.m-pairs { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0; }
.m-pairs i { display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: 12px; border: 2px solid var(--line); }
.m-pairs i.alone { border-color: #dc2626; }
.m-pairs b, .m-array b { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--sec); }
.m-array { display: flex; flex-direction: column; gap: 4px; align-items: center; margin: 8px 0; }
.m-array i { display: flex; gap: 4px; }
.m-array b { width: 12px; height: 12px; }
.m-seq { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 8px 0; font: 800 clamp(24px, 6vw, 34px) var(--kid); }
.m-seq > span { min-width: 2em; padding: 2px 10px; border-radius: 14px; background: var(--bg); border: 2px solid var(--line); }
.m-seq .m-gap { border-style: dashed; border-color: var(--sec); }
.m-table { max-width: 560px; margin: 6px auto; text-align: start; }
.m-table summary { cursor: pointer; font-weight: 700; color: var(--sec); }
.m-table ol { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 4px; font-size: 20px; }
.m-table li.all { grid-column: 1 / -1; font-size: 15px; color: var(--muted); }

.m-pile { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; font-size: 28px; min-height: 44px; max-width: 520px; margin: 0 auto;
  padding: 6px; border-radius: 18px; border: 2px dashed var(--line); }
.m-pile small { font-size: 15px; color: var(--muted); align-self: center; }
.m-plates { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 12px 0; }
.m-plate { position: relative; }
.m-give { display: flex; flex-direction: column; align-items: center; width: 116px; min-height: 150px; padding: 8px; border-radius: 20px;
  border: 3px solid var(--line); background: var(--paper); color: var(--ink); cursor: pointer; font: inherit; }
.m-give:hover { border-color: var(--sec); }
.m-kid { font-size: 44px; line-height: 1.2; }
.m-got { font-size: 18px; line-height: 1.3; word-break: break-all; }
.m-give b { color: var(--sec); font-size: 1.3em; margin-top: auto; }
.m-back { position: absolute; top: -8px; inset-inline-start: -8px; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line);
  background: var(--paper); cursor: pointer; padding: 0; font-size: 16px; }

.m-frac { display: inline-flex; flex-direction: column; align-items: center; vertical-align: middle; line-height: 1.1; font-weight: 800; margin: 0 .15em; }
.m-frac span:last-child { border-top: 3px solid currentColor; padding: 0 .2em; }
.m-pie { width: 220px; }
.m-bar { width: 340px; }
.m-part { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.m-part.on { fill: #f97316; }
[data-math="fractions"] .m-part { cursor: pointer; }

.m-coins, .m-tray { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin: 8px auto; }
.m-tray { min-height: 72px; max-width: 560px; padding: 6px; border-radius: 18px; border: 3px dashed var(--line); }
.m-tray small { color: var(--muted); font-size: 15px; }
.m-coin { width: 58px; height: 58px; border-radius: 50%; border: 4px solid #b45309; background: radial-gradient(circle at 35% 30%, #fef3c7, #f59e0b);
  color: #78350f; font: 800 22px/1 var(--kid); cursor: pointer; padding: 0; box-shadow: 0 3px 0 #92400e; }
.m-coin.c1, .m-coin.c2 { width: 50px; height: 50px; border-color: #9a3412; background: radial-gradient(circle at 35% 30%, #fed7aa, #c2410c); color: #fff; }
.m-coin.c20, .m-coin.c50 { border-color: #64748b; background: radial-gradient(circle at 35% 30%, #f8fafc, #94a3b8); color: #1e293b; box-shadow: 0 3px 0 #475569; }
.m-price { color: var(--sec); }

.m-rulersvg { width: 660px; }
.m-rbody { fill: #fde68a; stroke: #b45309; stroke-width: 2; }
.m-rulersvg .m-tick { stroke: #78350f; stroke-width: 1.5; }
.m-rulersvg text { fill: #78350f; font-size: 16px; }
.m-guide { stroke: #dc2626; stroke-width: 1.5; stroke-dasharray: 4 4; }
.m-pencil { fill: #3b82f6; }
.m-eraser { fill: #f9a8d4; }
.m-tip { fill: #fcd9a8; stroke: #92400e; stroke-width: 1; }

.m-gridsvg { width: 360px; }
.m-gl { stroke: var(--line); stroke-width: 1.5; }
.m-cell { fill: color-mix(in srgb, var(--sec) 35%, transparent); }
.m-edge { stroke: var(--sec); stroke-width: 4; stroke-linecap: round; }

.m-sym { display: grid; grid-template-columns: repeat(8, 1fr); gap: 0; width: min(360px, 100%); margin: 10px auto; border: 3px solid var(--ink); }
.m-sym button { aspect-ratio: 1; border: 1px solid var(--line); background: var(--paper); cursor: pointer; padding: 0; }
.m-sym button.given { background: var(--bg); cursor: default; }
.m-sym button.on { background: var(--sec); }
.m-sym button.given.on { background: color-mix(in srgb, var(--sec) 70%, #000); }
.m-sym button.bad { outline: 3px solid #dc2626; outline-offset: -3px; }
.m-sym button.axr { border-right: 4px solid #dc2626; }
.m-sym button.axb { border-bottom: 4px solid #dc2626; }

.m-anglesvg { width: 260px; }
.m-ray { fill: none; stroke: var(--ink); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.m-arc { fill: color-mix(in srgb, var(--sec) 20%, transparent); stroke: var(--sec); stroke-width: 3; }
.m-vertex { fill: var(--sec); }

.m-solid .m-svg { width: 180px; }
.m-svg .f1, .m-svg .f2, .m-svg .f3 { stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.m-svg .f1 { fill: color-mix(in srgb, var(--sec) 45%, var(--paper)); }
.m-svg .f2 { fill: color-mix(in srgb, var(--sec) 20%, var(--paper)); }
.m-svg .f3 { fill: color-mix(in srgb, var(--sec) 70%, var(--paper)); }
.m-svg .d, .m-svg .e { fill: none; stroke: var(--ink); stroke-width: 2; }
.m-svg .d { stroke-dasharray: 5 4; opacity: .7; }
.m-solids div { height: 100%; box-sizing: border-box; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px;
  border-radius: 18px; border: 2px solid var(--line); background: var(--paper); }
.m-solids .m-svg { width: 96px; margin: 0; }
.m-solids b { font-family: var(--kid); }
.m-solids i { font-style: normal; font-size: 13px; color: var(--muted); }
.m-problem p { line-height: 1.9; }

.m-examples ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.m-examples li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 10px 16px; border-radius: 16px;
  background: color-mix(in srgb, var(--cat) 8%, var(--paper)); border-inline-start: 5px solid var(--cat); }
.m-examples li b { font-size: 1.25em; color: var(--cat); unicode-bidi: isolate; }
