/* kg.css — the ABC Fun! page: ManyHand header, guide and footer around the app, the app's
   frame (full screen on a phone, a phone-sized frame on a computer), and the app's own
   reset. tailwind.css is built without Tailwind's global reset (preflight), so the reset
   below applies inside #app only and the rest of the page keeps its own styles. */

:root {
  --hdr: 52px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --cream: #faf5ec; --paper: #fffdf8; --ink: #221a12; --inksoft: #6f6152; --line: #e8ddc9;
  --navy: #0e386d; --teal: #0b7d74; --violet: #6d28d9;
}
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--cream); color: var(--ink);
  font-family: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif; line-height: 1.55;
}
* { -webkit-tap-highlight-color: transparent; }

/* ---------------------------------------------------------------- site header */
header.site {
  height: var(--hdr); box-sizing: border-box; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 0 16px; background: var(--paper); border-bottom: 1.5px solid var(--line);
  position: relative; z-index: 2;
}
header.site .brand {
  display: inline-flex; align-items: center; gap: 8px; font-family: "Fraunces", Georgia, serif; font-weight: 900;
  font-size: 20px; letter-spacing: -.02em; color: var(--navy); text-decoration: none;
}
header.site .brand img { width: 24px; height: 24px; }
header.site .brand span { color: var(--teal); margin-left: -8px; }
header.site .links { display: flex; gap: 16px; }
header.site .links a { font-size: 13px; font-weight: 700; color: var(--navy); text-decoration: none; }
header.site .links a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- the app frame */
.kg-stage { display: flex; justify-content: center; }
#app {
  position: relative; width: 100%; overflow: hidden; background: #fff;
  height: calc(100vh - var(--hdr));
  height: calc(100svh - var(--hdr));
  height: calc(100dvh - var(--hdr));
  min-height: 520px;
}
@media (min-width: 600px) {
  .kg-stage { padding: 22px 16px; background: linear-gradient(135deg, #ede9fe 0%, #fce7f3 55%, #fef3c7 100%); border-bottom: 1.5px solid var(--line); }
  #app {
    max-width: 430px; border-radius: 34px; min-height: 640px;
    height: min(880px, calc(100dvh - var(--hdr) - 44px));
    box-shadow: 0 24px 60px -18px rgba(76, 29, 149, .45), 0 0 0 10px #1e1b4b;
  }
}
/* installed app, or the Full screen button: the app is the whole screen */
body.is-app header.site, body.is-app .kg-guide, body.is-app .mh-related, body.is-app footer,
body.is-full header.site, body.is-full .kg-guide, body.is-full .mh-related, body.is-full footer { display: none; }
body.is-app .kg-stage, body.is-full .kg-stage { padding: 0; background: none; border: 0; }
body.is-app #app, body.is-full #app { max-width: none; border-radius: 0; box-shadow: none; height: 100vh; height: 100dvh; min-height: 0; }
body.is-app .kg-guide-link, body.is-full .kg-guide-link { display: none; }

/* ---------------------------------------------------------------- reset inside the app */
/* :where() keeps these at zero specificity, so every Tailwind class still wins over them */
:where(#app, #app *, #app *::before, #app *::after) { box-sizing: border-box; border-width: 0; border-style: solid; border-color: #e5e7eb; }
:where(#app) { line-height: 1.5; font-family: "Baloo 2", "Nirmala UI", "Noto Sans Devanagari", "Noto Sans Malayalam", system-ui, sans-serif; }
:where(#app) :where(h1, h2, h3, h4, p) { margin: 0; font-size: inherit; font-weight: inherit; }
:where(#app) :where(ul) { margin: 0; padding: 0; list-style: none; }
:where(#app) :where(button) { font: inherit; color: inherit; background-color: transparent; background-image: none; margin: 0; padding: 0; cursor: pointer; -webkit-appearance: button; text-transform: none; }
:where(#app) :where(button:disabled) { cursor: default; opacity: .6; }
:where(#app) :where(a) { color: inherit; text-decoration: inherit; }
:where(#app) :where(canvas, svg) { display: block; }
#app [hidden] { display: none !important; }

/* ---------------------------------------------------------------- screens */
.screen {
  position: absolute; inset: 0; display: none; flex-direction: column;
  padding-top: var(--safe-t); padding-bottom: var(--safe-b);
  touch-action: none;               /* no page scroll or zoom while a child plays */
}
.screen.active { display: flex; }
#screen-language { touch-action: pan-y; }   /* the first screen lets grown-ups scroll on to the guide */
.kg-scroll, #numberDots { touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
#traceCanvas, #dotsCanvas, .kg-colorpic { touch-action: none; }
.kg-nav { padding-bottom: max(calc(0.75rem + var(--safe-b)), 12px); }
.kg-padb { padding-bottom: max(calc(1rem + var(--safe-b)), 16px); }
#app button { touch-action: manipulation; }

.kg-full {
  position: absolute; top: calc(12px + var(--safe-t)); right: 12px; font-size: 13px; font-weight: 800; color: #fff;
  background: rgba(30, 27, 75, .28); border-radius: 999px; padding: 6px 12px;
}
.kg-promo a { text-decoration: none; }
.kg-glyph { font-weight: 800; color: #7c3aed; font-size: 3.6rem !important; line-height: 1; }

/* coloring */
#colorWrap { container-type: size; }
.kg-colorpic { width: min(100cqw, 80cqh); height: auto; max-width: 100%; max-height: 100%; aspect-ratio: 4 / 5; border-radius: 10px; }
.kg-wait { position: absolute; inset: auto 16px 50% 16px; transform: translateY(50%); text-align: center; font-weight: 800; color: #7c3aed; }
.cswatch { transition: transform .12s; }
.cswatch.ring-4 { transform: scale(1.12); }

/* For grown-ups */
.kg-card { background: rgba(255, 255, 255, .92); border-radius: 22px; padding: 14px 14px 12px; margin-bottom: 12px; box-shadow: 0 8px 20px -14px rgba(49, 46, 129, .6); }
#app .kg-card h3 { font-size: 1.05rem; font-weight: 800; color: #3730a3; margin-bottom: 8px; }
.kg-row { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.kg-row b { color: #059669; font-weight: 800; }
.kg-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
#app .kg-tile { height: 40px; border-radius: 12px; background: #eef2ff; color: #4338ca; font-weight: 800; font-size: 1.15rem; line-height: 1; }
#app .kg-tile.ok { background: #10b981; color: #fff; }
.kg-note { font-size: .86rem; color: #475569; margin-top: 8px !important; line-height: 1.35; }
.kg-list li { display: flex; justify-content: space-between; padding: 5px 2px; border-bottom: 1px dashed #c7d2fe; font-weight: 700; color: #334155; }
.kg-list li:last-child { border-bottom: 0; }
.kg-list li.none { color: #64748b; font-weight: 600; }
#app .kg-btn { display: block; width: 100%; margin-top: 10px; border-radius: 999px; padding: 11px 14px; background: #6d28d9; color: #fff; font-weight: 800; font-size: 1rem; box-shadow: 0 6px 14px -8px rgba(109, 40, 217, .9); }
#app .kg-btn.alt { background: #fff; color: #4338ca; box-shadow: inset 0 0 0 2px #c7d2fe; }
#app .kg-btn.warn { background: #fff; color: #b91c1c; box-shadow: inset 0 0 0 2px #fecaca; }
#app .kg-link { display: block; margin-top: 12px; color: #4338ca; font-weight: 800; text-decoration: underline; }

/* ---------------------------------------------------------------- guide for grown-ups */
.kg-guide { max-width: 880px; margin: 0 auto; padding: 30px 18px 10px; box-sizing: border-box; }
.kg-guide .step-label { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--teal); margin: 0 0 8px; }
.kg-guide h2 { font-family: "Fraunces", Georgia, serif; font-size: 28px; line-height: 1.15; margin: 0 0 12px; letter-spacing: -.01em; }
.kg-guide h3 { font-family: "Fraunces", Georgia, serif; font-size: 21px; margin: 26px 0 8px; }
.kg-guide h4 { font-size: 15px; margin: 0 0 6px; }
.kg-guide p, .kg-guide li { font-size: 15px; color: #3b3127; }
.kg-guide p { margin: 0 0 12px; }
.kg-guide ul { margin: 0 0 12px; padding-left: 20px; }
.kg-guide li { margin: 5px 0; }
.kg-guide a { color: var(--navy); font-weight: 700; }
.kg-guide .kg-small { font-size: 13.5px; color: var(--inksoft); }
.kg-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 26px; }
.kg-cols > div { background: var(--paper); border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px 6px; }
.kg-guide details { border-top: 1.5px solid var(--line); padding: 11px 0; }
.kg-guide details:last-of-type { border-bottom: 1.5px solid var(--line); }
.kg-guide summary { cursor: pointer; font-weight: 700; font-size: 15px; }
.kg-guide details p { margin: 6px 0 0; font-size: 14.5px; }
.kg-links { columns: 2 260px; }
footer { text-align: center; color: var(--inksoft); font-size: 13px; padding: 24px 16px 30px; }
footer a { color: var(--navy); }
@media (max-width: 700px) {
  .kg-cols { grid-template-columns: 1fr; }
  .kg-guide h2 { font-size: 24px; }
  header.site .links { gap: 12px; }
}
@media (max-width: 380px) { header.site .links a[href="/tools/"] { display: none; } }
