/* ===== BaraaKids ===== */

/* ---- fonts (self-hosted) ---- */
@font-face { font-family: 'Baloo Bhaijaan 2'; font-weight: 700; font-display: swap;
  src: url(../fonts/baloo-bhaijaan-2-arabic-700-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F; }
@font-face { font-family: 'Baloo Bhaijaan 2'; font-weight: 700; font-display: swap;
  src: url(../fonts/baloo-bhaijaan-2-latin-700-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Baloo Bhaijaan 2'; font-weight: 800; font-display: swap;
  src: url(../fonts/baloo-bhaijaan-2-arabic-800-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F; }
@font-face { font-family: 'Baloo Bhaijaan 2'; font-weight: 800; font-display: swap;
  src: url(../fonts/baloo-bhaijaan-2-latin-800-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Readex Pro'; font-weight: 400; font-display: swap;
  src: url(../fonts/readex-pro-arabic-400-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F; }
@font-face { font-family: 'Readex Pro'; font-weight: 400; font-display: swap;
  src: url(../fonts/readex-pro-latin-400-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Readex Pro'; font-weight: 600; font-display: swap;
  src: url(../fonts/readex-pro-arabic-600-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F; }
@font-face { font-family: 'Readex Pro'; font-weight: 600; font-display: swap;
  src: url(../fonts/readex-pro-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122; }
@font-face { font-family: 'Amiri Quran'; font-weight: 400; font-display: swap;
  src: url(../fonts/amiri-quran-arabic-400-normal.woff2) format('woff2');
  unicode-range: U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F; }

/* ---- tokens ---- */
:root {
  --cobalt: #3355ff;
  --cobalt-deep: #1f38c9;
  --ink: #16213e;
  --ink-soft: #4a5578;
  --paper: #f4f7ff;
  --white: #ffffff;
  --sun: #ffc83d;
  --sun-deep: #f2b01c;
  --coral: #ff6b5b;
  --mint: #19b994;
  --plum: #7c4dff;
  --line: #dfe5f5;
  --good: #14a36f;
  --bad: #e5484d;

  --font-head: 'Baloo Bhaijaan 2', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-body: 'Readex Pro', 'Segoe UI', Tahoma, system-ui, sans-serif;
  --font-quran: 'Amiri Quran', 'Traditional Arabic', 'Scheherazade New', serif;

  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --shadow: 0 6px 0 rgba(22, 33, 62, .12);
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.05rem;
  line-height: 1.75;
  -webkit-tap-highlight-color: transparent;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 800; line-height: 1.25; margin: 0; }
p { margin: 0; }
:focus-visible { outline: 3px solid var(--sun-deep); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { width: min(100% - 2rem, var(--wrap)); margin-inline: auto; }
[hidden] { display: none !important; }

/* language-only blocks (privacy, terms) */
html[lang="ar"] [data-only="en"], html[lang="en"] [data-only="ar"] { display: none; }

/* ---- buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 52px; padding: .5rem 1.6rem;
  border: 0; border-radius: 999px;
  font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; line-height: 1;
  text-decoration: none; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
  box-shadow: var(--shadow);
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(22, 33, 62, .12); }
.btn-sun { background: var(--sun); color: var(--ink); }
.btn-cobalt { background: var(--cobalt); color: #fff; }
.btn-white { background: #fff; color: var(--cobalt-deep); }
.btn-line { background: transparent; color: #fff; box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .85); }
.btn-line:active { box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, .85); }
.btn-small { min-height: 42px; padding: .35rem 1.1rem; font-size: 1rem; box-shadow: none; }
.btn-small:active { box-shadow: none; }

/* ---- header ---- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid var(--line);
}
.head-row { display: flex; align-items: center; gap: 1rem; min-height: 68px; }
.logo { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; color: var(--ink); }
.logo svg { width: 42px; height: 42px; flex: none; }
.nav { display: flex; align-items: center; gap: .25rem; margin-inline-start: 1rem; }
.nav a { padding: .45rem .9rem; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--ink-soft); }
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.head-tools { margin-inline-start: auto; display: flex; align-items: center; gap: .5rem; }
.chip-stars { display: inline-flex; align-items: center; gap: .35rem; background: #fff6d8; border: 2px solid var(--sun); border-radius: 999px; padding: .15rem .8rem; font-family: var(--font-head); font-weight: 800; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line); background: #fff; display: inline-grid; place-items: center; font-size: 1.2rem; line-height: 1; }
.icon-btn:hover { border-color: var(--cobalt); }
.lang-btn { min-height: 42px; padding: 0 1rem; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 600; }
.lang-btn:hover { border-color: var(--cobalt); }
.menu-btn { display: none; }

@media (max-width: 860px) {
  .menu-btn { display: inline-grid; }
  .nav {
    position: absolute; inset-inline: 0; top: 100%;
    flex-direction: column; align-items: stretch;
    margin: 0; padding: .75rem 1rem 1rem;
    background: #fff; border-bottom: 2px solid var(--line);
    display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: .8rem 1rem; }
  .install-top { display: none; }
}
@media (max-width: 480px) {
  .logo span { font-size: 1.25rem; }
  .chip-stars { padding-inline: .55rem; }
}

/* ---- hero ---- */
.hero { background: var(--cobalt); color: #fff; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 2.5rem; align-items: center; padding-block: 3.5rem 4.5rem; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.7rem); letter-spacing: -.01em; }
.hero .lead { margin-top: 1.1rem; font-size: 1.2rem; max-width: 34rem; color: #e8edff; }
.hero-cta { margin-top: 1.8rem; display: flex; flex-wrap: wrap; gap: .8rem; }
.chips { margin-top: 1.6rem; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; list-style: none; }
.chips li { background: rgba(255, 255, 255, .16); border-radius: 999px; padding: .25rem .9rem; font-size: .95rem; font-weight: 600; }
.chips li::before { content: '✓'; margin-inline-end: .4rem; color: var(--sun); font-weight: 800; }

.board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; max-width: 460px; margin-inline: auto; padding: .5rem; }
.tile {
  position: relative; aspect-ratio: 1; border: 0; padding: 0;
  border-radius: var(--r-md); background: #fff; color: var(--ink);
  box-shadow: 0 8px 0 rgba(10, 20, 90, .35);
  display: grid; place-items: center;
  transform: rotate(var(--tilt, 0deg));
  transition: transform .15s ease;
}
.tile:nth-child(1) { --tilt: -4deg; } .tile:nth-child(2) { --tilt: 3deg; margin-top: 1.2rem; }
.tile:nth-child(3) { --tilt: -2deg; } .tile:nth-child(4) { --tilt: 3deg; }
.tile:nth-child(5) { --tilt: -3deg; margin-top: -1.2rem; } .tile:nth-child(6) { --tilt: 4deg; }
.tile:hover { transform: rotate(0) translateY(-4px); }
.tile .em { font-size: clamp(2.4rem, 7vw, 3.6rem); line-height: 1; }
.tile .wd { position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; border-radius: inherit; font-family: var(--font-head); font-weight: 800; line-height: 1.1; }
.tile .wd b { font-size: clamp(1.2rem, 3.4vw, 1.8rem); }
.tile .wd small { font-size: 1rem; font-weight: 700; opacity: .8; }
.tile.on .em { visibility: hidden; }
.tile.on .wd { display: flex; }
.tile.c1.on { background: var(--sun); } .tile.c2.on { background: #bff0e3; } .tile.c3.on { background: #ffd2cc; }
.tile.c4.on { background: #dcd0ff; } .tile.c5.on { background: #cfe0ff; } .tile.c6.on { background: #fff0b8; }
.board-hint { grid-column: 1 / -1; text-align: center; color: #dbe3ff; font-size: .95rem; margin-top: .6rem; }

@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; padding-block: 2.5rem 3rem; }
  .board { max-width: 380px; }
}

/* ---- sections ---- */
.section { padding-block: 4.5rem; }
.section.alt { background: #fff; }
.section-head { max-width: 40rem; margin-bottom: 2.4rem; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); }
.section-head p { margin-top: .5rem; color: var(--ink-soft); }

/* categories */
.cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); gap: 1.1rem; }
.cat { background: #fff; border-radius: var(--r-lg); overflow: hidden; border: 2px solid var(--line); display: flex; flex-direction: column; }
.cat-top { padding: 1.2rem 1.2rem 1.1rem; display: flex; flex-direction: column; align-items: flex-start; gap: .8rem; min-height: 168px; }
.cat-ico { width: 56px; height: 56px; border-radius: 16px; background: rgba(255, 255, 255, .35); display: grid; place-items: center; font-size: 1.9rem; font-family: var(--font-head); font-weight: 800; line-height: 1; flex: none; }
.cat-top h3 { font-size: 1.35rem; }
.cat-top p { font-size: .93rem; opacity: .92; line-height: 1.45; margin-top: .15rem; }
.cat.cobalt .cat-top { background: var(--cobalt); color: #fff; }
.cat.mint .cat-top { background: var(--mint); color: var(--ink); }
.cat.plum .cat-top { background: var(--plum); color: #fff; }
.cat.coral .cat-top { background: var(--coral); color: var(--ink); }
.cat.sun .cat-top { background: var(--sun); color: var(--ink); }
.cat-links { list-style: none; margin: 0; padding: .6rem .7rem 1rem; display: flex; flex-direction: column; gap: .15rem; }
.cat-links a { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: var(--r-sm); text-decoration: none; font-weight: 600; }
.cat-links a:hover { background: var(--paper); }
.cat-links .gi { width: 34px; text-align: center; font-size: 1.3rem; font-family: var(--font-head); }

/* steps (a real sequence) */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1.6rem; counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding-top: 4rem; }
.steps li::before {
  counter-increment: s; content: counter(s);
  position: absolute; top: 0; inset-inline-start: 0;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--sun); color: var(--ink);
  display: grid; place-items: center;
  font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; line-height: 1;
  box-shadow: var(--shadow);
}
.steps h3 { font-size: 1.25rem; }
.steps p { margin-top: .3rem; color: var(--ink-soft); }

/* stats */
.stats-band { background: var(--ink); color: #fff; padding-block: 3.2rem; }
.stats-band h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); margin-bottom: 1.8rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.4rem; margin: 0; padding: 0; list-style: none; }
.stats b { display: block; font-family: var(--font-head); font-weight: 800; font-size: 3rem; line-height: 1; color: var(--sun); }
.stats span { display: block; margin-top: .3rem; color: #c9d2ee; line-height: 1.4; }

/* why */
.why { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.8rem 2.4rem; }
.why > div { display: flex; gap: 1rem; align-items: flex-start; }
.why .wi { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; }
.why h3 { font-size: 1.2rem; }
.why p { margin-top: .2rem; color: var(--ink-soft); }
.wi.c1 { background: #dfe6ff; } .wi.c2 { background: #fff0bd; } .wi.c3 { background: #ffe0dc; }
.wi.c4 { background: #d4f5ea; } .wi.c5 { background: #e5dcff; } .wi.c6 { background: #d9ecff; }

/* faq */
.faq { max-width: 50rem; display: flex; flex-direction: column; gap: .7rem; }
.faq details { background: #fff; border: 2px solid var(--line); border-radius: var(--r-md); }
.faq summary { list-style: none; cursor: pointer; padding: 1rem 1.2rem; font-family: var(--font-head); font-weight: 800; font-size: 1.15rem; display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--paper); display: grid; place-items: center; font-size: 1.4rem; line-height: 1; }
.faq details[open] summary::after { content: '–'; background: var(--sun); }
.faq details p { padding: 0 1.2rem 1.1rem; color: var(--ink-soft); }

/* install band */
.install { background: var(--sun); }
.install-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1.5rem; padding-block: 3rem; }
.install h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); }
.install p { margin-top: .4rem; max-width: 36rem; }
.install .note { font-size: .95rem; margin-top: .6rem; }

/* footer */
.site-footer { background: var(--ink); color: #c9d2ee; padding-block: 3rem 2rem; }
.foot-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2rem; }
.site-footer .logo { color: #fff; }
.site-footer p { margin-top: .7rem; max-width: 26rem; }
.site-footer h4 { color: #fff; font-size: 1.1rem; margin-bottom: .6rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .3rem; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--sun); }
.copy { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid rgba(255, 255, 255, .15); font-size: .95rem; }
@media (max-width: 640px) { .foot-grid { grid-template-columns: 1fr; } }

/* ---- page title bars (games, teachers, legal) ---- */
.page-top { background: var(--cobalt); color: #fff; padding-block: 2.4rem 3rem; }
.page-top h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.page-top p { margin-top: .4rem; color: #e1e8ff; }
.page-top .row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1rem; }

/* ---- games hub ---- */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-block: 1.6rem 1.4rem; }
.filter { min-height: 44px; padding: 0 1.2rem; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 600; }
.filter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.grid-games { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.2rem; padding-bottom: 4rem; }
.gcard { text-align: start; border: 2px solid var(--line); background: #fff; border-radius: var(--r-lg); padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform .12s ease; }
.gcard:hover { transform: translateY(-3px); border-color: var(--ink); }
.gcard .gtop { height: 110px; display: grid; place-items: center; font-size: 3.4rem; font-family: var(--font-head); font-weight: 800; line-height: 1; }
.gcard.cobalt .gtop { background: var(--cobalt); color: #fff; }
.gcard.mint .gtop { background: var(--mint); color: var(--ink); }
.gcard.plum .gtop { background: var(--plum); color: #fff; }
.gcard.coral .gtop { background: var(--coral); color: var(--ink); }
.gcard .gbody { padding: 1rem 1.2rem 1.2rem; display: flex; flex-direction: column; gap: .3rem; flex: 1; }
.gcard h3 { font-size: 1.25rem; }
.gcard p { color: var(--ink-soft); font-size: .97rem; line-height: 1.5; flex: 1; }
.gcard .play { margin-top: .6rem; align-self: flex-start; background: var(--sun); color: var(--ink); border-radius: 999px; padding: .3rem 1.1rem; font-family: var(--font-head); font-weight: 800; }

/* ---- game stage (overlay) ---- */
.stage { position: fixed; inset: 0; z-index: 100; background: var(--paper); display: flex; flex-direction: column; }
.stage-top { display: flex; align-items: center; gap: .8rem; padding: .7rem 1rem; background: #fff; border-bottom: 2px solid var(--line); }
.stage-top h2 { font-size: 1.25rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-status { font-weight: 600; color: var(--ink-soft); }
.stage-body { flex: 1; overflow: auto; padding: 1.2rem 1rem 2rem; }
.stage-in { width: min(100%, 640px); margin-inline: auto; }
.prompt { text-align: center; font-family: var(--font-head); font-weight: 700; font-size: 1.3rem; margin-bottom: 1rem; }
.hint { text-align: center; color: var(--ink-soft); margin-bottom: 1rem; }
.bigem { text-align: center; font-size: clamp(5rem, 22vw, 9rem); line-height: 1.1; }
.bigword { text-align: center; font-family: var(--font-head); font-weight: 800; font-size: 2.2rem; margin-block: .2rem 1rem; }
.progress { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 1.2rem; }
.progress i { display: block; height: 100%; width: 0; background: var(--mint); border-radius: inherit; transition: width .25s ease; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.opt { min-height: 72px; border-radius: var(--r-md); border: 2px solid var(--line); background: #fff; font-family: var(--font-head); font-weight: 800; font-size: 1.6rem; box-shadow: var(--shadow); transition: transform .1s ease; }
.opt:hover { border-color: var(--cobalt); }
.opt:active { transform: translateY(3px); box-shadow: none; }
.opt.ok { background: #c8f2e1; border-color: var(--good); }
.opt.no { background: #ffd9db; border-color: var(--bad); animation: shake .3s; }
.opt[disabled] { cursor: default; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* memory */
.mem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; max-width: 460px; margin-inline: auto; }
.mem { aspect-ratio: 1; border: 0; border-radius: var(--r-md); background: var(--cobalt); color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 2.2rem; box-shadow: var(--shadow); display: grid; place-items: center; padding: .2rem; line-height: 1.1; text-align: center; }
.mem.open { background: #fff; color: var(--ink); border: 3px solid var(--cobalt); }
.mem.done { background: #c8f2e1; color: var(--ink); border: 3px solid var(--good); box-shadow: none; }
.mem .em { font-size: 2.8rem; }
.mem .wd { font-size: 1.15rem; }
@media (min-width: 520px) { .mem-grid { grid-template-columns: repeat(4, 1fr); } }

/* builder */
.slots, .letters { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-block: 1rem; direction: ltr; }
.slot, .ltr { width: 54px; height: 62px; border-radius: 14px; display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: 2rem; text-transform: lowercase; }
.slot { border: 3px dashed #aab6dd; background: #fff; }
.slot.filled { border: 3px solid var(--cobalt); background: #e5ebff; cursor: pointer; }
.slot.ok { border-color: var(--good); background: #c8f2e1; }
.ltr { border: 0; background: var(--sun); box-shadow: var(--shadow); }
.ltr[disabled] { display: none; }

/* ayat */
.surahs { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; margin-bottom: 1.2rem; }
.ayat { display: flex; flex-direction: column; gap: .7rem; }
.ayah { direction: rtl; text-align: center; border: 2px solid var(--line); background: #fff; border-radius: var(--r-md); padding: .8rem 1rem; font-family: var(--font-quran); font-size: 1.7rem; line-height: 2.1; box-shadow: var(--shadow); position: relative; }
.ayah.done { background: #c8f2e1; border-color: var(--good); box-shadow: none; }
.ayah.no { animation: shake .3s; border-color: var(--bad); }
.ayah .n { position: absolute; inset-inline-start: .6rem; top: .6rem; width: 30px; height: 30px; border-radius: 50%; background: var(--good); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-size: 1rem; line-height: 1; }

/* xo */
.xo { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; width: min(100%, 330px); margin: 1rem auto; direction: ltr; }
.xo button { aspect-ratio: 1; border: 0; border-radius: var(--r-md); background: #fff; box-shadow: var(--shadow); font-family: var(--font-head); font-weight: 800; font-size: 3.2rem; line-height: 1; }
.xo .x { color: var(--cobalt); } .xo .o { color: var(--coral); }
.xo .win { background: #c8f2e1; }
.status-line { text-align: center; font-family: var(--font-head); font-weight: 800; font-size: 1.3rem; min-height: 2rem; }

/* balloons */
.sky { position: relative; height: min(62vh, 520px); border-radius: var(--r-lg); background: linear-gradient(#bfe3ff, #eaf6ff); overflow: hidden; border: 2px solid var(--line); }
.balloon { position: absolute; bottom: -90px; width: 66px; height: 80px; border: 0; border-radius: 50% 50% 48% 48%; font-family: var(--font-head); font-weight: 800; font-size: 1.9rem; color: var(--ink); box-shadow: inset -8px -8px 0 rgba(0, 0, 0, .1); animation: floatup var(--dur, 7s) linear forwards; touch-action: manipulation; }
.balloon::after { content: ''; position: absolute; left: 50%; top: 100%; width: 2px; height: 26px; background: rgba(22, 33, 62, .4); }
.balloon.pop { animation: pop .18s ease-out forwards; }
@keyframes floatup { to { transform: translateY(var(--rise, -620px)); } }
@keyframes pop { to { transform: scale(1.6); opacity: 0; } }
.pick { display: grid; gap: .8rem; margin-top: 1rem; }

/* alphabet board */
.alpha { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: .6rem; }
.alpha button { aspect-ratio: 1; border: 2px solid var(--line); border-radius: var(--r-md); background: #fff; font-family: var(--font-head); font-weight: 800; font-size: 2.1rem; box-shadow: var(--shadow); line-height: 1; }
.alpha button.on { background: var(--sun); border-color: var(--sun-deep); }
.alpha-detail { background: #fff; border: 2px solid var(--line); border-radius: var(--r-lg); padding: 1rem; margin-bottom: 1.2rem; text-align: center; display: flex; align-items: center; justify-content: center; gap: 1.4rem; flex-wrap: wrap; min-height: 150px; }
.alpha-detail .big { font-family: var(--font-head); font-weight: 800; font-size: 5.5rem; line-height: 1; color: var(--cobalt); }
.alpha-detail .em { font-size: 4.5rem; line-height: 1; }
.alpha-detail .w { font-family: var(--font-head); font-weight: 800; font-size: 1.9rem; }

/* result */
.result { position: fixed; inset: 0; z-index: 120; background: rgba(22, 33, 62, .6); display: grid; place-items: center; padding: 1rem; }
.result-card { background: #fff; border-radius: var(--r-lg); padding: 1.8rem 1.6rem; text-align: center; width: min(100%, 380px); animation: rise .25s ease-out; }
@keyframes rise { from { transform: translateY(20px); opacity: 0; } }
.result-card h3 { font-size: 1.8rem; }
.result-stars { font-size: 3rem; letter-spacing: .15em; margin-block: .6rem; min-height: 3.6rem; }
.result-stars .off { filter: grayscale(1); opacity: .3; }
.result-card .btn { margin-top: .6rem; width: 100%; }
.result-card .btn + .btn { margin-top: .7rem; }

/* ---- teachers ---- */
.tabs { display: flex; gap: .5rem; margin-block: 1.6rem 1.2rem; }
.tab { min-height: 46px; padding: 0 1.3rem; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 600; }
.tab[aria-selected="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--line); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.tools label { display: inline-flex; align-items: center; gap: .5rem; font-weight: 600; }
#boardCanvas { width: 100%; height: min(62vh, 560px); background: #fff; border: 2px solid var(--line); border-radius: var(--r-lg); touch-action: none; display: block; cursor: crosshair; }
.cert-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-bottom: 1.4rem; }
.field { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; }
.field input, .field select { min-height: 48px; border-radius: var(--r-sm); border: 2px solid var(--line); padding: 0 .8rem; font: inherit; background: #fff; }
.cert-wrap { overflow-x: auto; padding-bottom: .5rem; }
.cert { width: 900px; max-width: none; aspect-ratio: 1.414; margin-inline: auto; background: #fffdf4; border: 14px solid var(--cobalt); outline: 4px solid var(--sun); outline-offset: -26px; padding: 3.2rem 3.6rem; text-align: center; display: flex; flex-direction: column; justify-content: space-between; color: var(--ink); }
.cert h3 { font-size: 3rem; color: var(--cobalt-deep); }
.cert .given { font-size: 1.25rem; color: var(--ink-soft); }
.cert .who { font-family: var(--font-head); font-weight: 800; font-size: 3.4rem; line-height: 1.2; border-bottom: 3px solid var(--sun); display: inline-block; align-self: center; padding-inline: 2rem; min-width: 60%; }
.cert .for { font-size: 1.4rem; }
.cert .stars { font-size: 2rem; letter-spacing: .3em; }
.cert .foot { display: flex; justify-content: space-between; align-items: end; font-size: 1.1rem; }
.cert .foot div { min-width: 200px; border-top: 2px solid var(--ink-soft); padding-top: .3rem; }
.cert .brandline { font-family: var(--font-head); font-weight: 800; color: var(--cobalt); font-size: 1.3rem; }

/* ---- legal ---- */
.legal { max-width: 46rem; padding-block: 3rem 5rem; }
.legal h2 { font-size: 1.4rem; margin-top: 2rem; }
.legal p, .legal li { color: var(--ink-soft); margin-top: .5rem; }
.legal ul { padding-inline-start: 1.3rem; }

/* ---- 404 ---- */
.lost { min-height: 60vh; display: grid; place-content: center; text-align: center; gap: 1.2rem; padding: 2rem; }
.lost .big { font-size: 6rem; line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .balloon { animation-duration: 12s !important; }
}

@media print {
  body * { visibility: hidden; }
  #certificate, #certificate * { visibility: visible; }
  #certificate { position: absolute; inset: 0; width: 100%; margin: 0; }
  .cert { width: 100%; height: 100vh; aspect-ratio: auto; border-width: 12px; }
  @page { size: A4 landscape; margin: 0; }
}
