/* =====================================================================
   PIYU — MODERN LOOK (loaded LAST, so it only re-skins; no behaviour changes)
   Calm glass surfaces · one clear accent gradient · hairline borders · soft depth
   · compact header · floating glass dock · clean buttons · readable type · less clutter.
   The golden "Piyu" title and the thin running lines stay (the signature), just subtler.
   ===================================================================== */
:root {
  --m-surface: rgba(255, 255, 255, .055);
  --m-surface2: rgba(255, 255, 255, .09);
  --m-hair: rgba(255, 255, 255, .12);
  --m-r: 20px;
  --m-r-sm: 14px;
  --m-shadow: 0 14px 34px -16px rgba(0, 0, 0, .65);
  --m-accent: #7c5cff;
  --m-accent2: #38bdf8;
  --m-grad: linear-gradient(135deg, #7c5cff 0%, #5b8cff 55%, #2dd4ff 100%);
  --m-glow: 0 12px 28px -12px rgba(91, 140, 255, .75);
  --m-font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans Devanagari", "Noto Sans Bengali", sans-serif;
  --r: 20px;
}
html { color-scheme: dark; }
body { font-family: var(--m-font); letter-spacing: -.005em; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:root[lang="bn"] body { font-family: "Noto Sans Bengali", "Hind Siliguri", var(--m-font); }
:root[lang="mr"] body { font-family: "Noto Sans Devanagari", var(--m-font); }
:root[lang="ur"] body { font-family: "Noto Nastaliq Urdu", "Noto Naskh Arabic", "Jameel Noori Nastaleeq", system-ui, sans-serif; }
h1, h2, h3 { letter-spacing: -.02em; }
::selection { background: rgba(124, 92, 255, .45); }
* { scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .22) transparent; }
:focus-visible { outline: 2px solid rgba(124, 92, 255, .85); outline-offset: 2px; }

/* ---------- header: compact, translucent ---------- */
header { padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: rgba(12, 10, 30, .6); backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%); border-bottom: 1px solid var(--m-hair); }
header::before { display: none; }                       /* the blue line; the gold hairline below stays */
header::after { height: 1px; opacity: .5; }
.clock b, .clock span { font-variant-numeric: tabular-nums; }
.gearBtn, header button { border-radius: 14px; }

/* ---------- bottom dock: floating glass pill ---------- */
nav { left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); padding: 6px; border-radius: 26px; background: rgba(18, 16, 42, .72); border: 1px solid var(--m-hair); backdrop-filter: blur(26px) saturate(160%); -webkit-backdrop-filter: blur(26px) saturate(160%); box-shadow: 0 22px 44px -16px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .06); }
nav::before, nav::after { height: 1px; opacity: .45; left: 22px; right: 22px; }
nav .goldbar { display: none; }
nav button { min-height: 54px; gap: 2px; font-size: 11px; font-weight: 600; letter-spacing: .01em; color: var(--mut); border-radius: 20px; transition: background .25s, color .25s, transform .15s; }
nav button i { font-size: 22px; transition: transform .25s; }
nav button.on { background: var(--m-surface2); color: #fff; box-shadow: inset 0 0 0 1px var(--m-hair); }
nav button.on i { transform: none; filter: none; }
nav button:active { transform: scale(.95); }
main { padding-bottom: 116px; }

/* ---------- surfaces ---------- */
.card, .task, .doc { background: var(--m-surface); border: 1px solid var(--m-hair); border-radius: var(--m-r); box-shadow: var(--m-shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.empty { border: 1px solid var(--m-hair); border-style: solid; background: var(--m-surface); border-radius: var(--m-r); color: var(--mut); }
.drop { border: 1.5px dashed rgba(255, 255, 255, .2); border-radius: 24px; background: var(--m-surface); }
.bub.pi { background: var(--m-surface2); border: 1px solid var(--m-hair); border-radius: 18px 18px 18px 6px; }
.bub.me { background: var(--m-grad); border-radius: 18px 18px 6px 18px; box-shadow: var(--m-glow); }
.tag, .chip, .pill, .s-pill { border-radius: 999px; }

/* ---------- buttons ---------- */
.btn { background: var(--m-surface2); border: 1px solid var(--m-hair); border-radius: var(--m-r-sm); font-weight: 600; letter-spacing: .005em; transition: transform .12s, background .2s, border-color .2s, box-shadow .2s; }
.btn:hover { background: rgba(255, 255, 255, .14); border-color: rgba(255, 255, 255, .22); }
.btn.primary { background: var(--m-grad); border: 0; color: #fff; box-shadow: var(--m-glow); }
.btn.primary:hover { filter: brightness(1.08); box-shadow: 0 14px 30px -10px rgba(91, 140, 255, .9); }
.btn.ghost { background: transparent; }
.btn.xl { border-radius: 18px; padding: 15px 28px; }
/* the start button: same clean gradient, a soft pulse instead of the gold bevel */
#startBtn.btn.primary { color: #fff; text-shadow: none; font-weight: 700; letter-spacing: .01em; background: var(--m-grad); background-size: 100% 100%; box-shadow: 0 16px 38px -14px rgba(91, 140, 255, .95), inset 0 1px 0 rgba(255, 255, 255, .25); animation: mPulse 3.2s ease-in-out infinite; }
#startBtn.btn.primary::before, #startBtn.btn.primary::after { display: none; }
@keyframes mPulse { 50% { box-shadow: 0 18px 46px -10px rgba(45, 212, 255, .85), inset 0 1px 0 rgba(255, 255, 255, .25); } }

/* ---------- inputs ---------- */
input[type=text], input[type=number], input[type=time], input[type=password], input[type=email], input[type=tel], input:not([type]), select, textarea { background: rgba(255, 255, 255, .06); border: 1px solid var(--m-hair); border-radius: var(--m-r-sm); color: var(--tx); transition: border-color .2s, box-shadow .2s, background .2s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: rgba(124, 92, 255, .9); box-shadow: 0 0 0 4px rgba(124, 92, 255, .22); background: rgba(255, 255, 255, .09); }
input::placeholder, textarea::placeholder { color: rgba(255, 255, 255, .38); }
.card select, .card input[type=text], .card input[type=number] { border-radius: 12px; padding: 9px 10px; }

/* ---------- start screen: mode cards ---------- */
.modeQ { font-weight: 700; letter-spacing: -.01em; }
.modeCards { gap: 12px; }
.modeCard { border-radius: 22px; padding: 18px 12px; border: 1px solid var(--m-hair); background: var(--m-surface); box-shadow: var(--m-shadow); backdrop-filter: blur(12px); transition: transform .25s, border-color .25s, background .25s, box-shadow .25s; }
.modeCard .mi { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 2px; font-size: 30px; border-radius: 18px; background: var(--m-surface2); box-shadow: inset 0 0 0 1px var(--m-hair); }
.modeCard b { font-size: 16px; font-weight: 700; }
.modeCard small { font-size: 11.5px; line-height: 1.35; color: var(--mut); }
.modeCard.stu .mi { background: linear-gradient(145deg, rgba(56, 189, 248, .32), rgba(29, 78, 216, .28)); }
.modeCard.biz .mi { background: linear-gradient(145deg, rgba(124, 92, 255, .38), rgba(255, 122, 182, .22)); }
.modeCard.parent .mi { background: linear-gradient(145deg, rgba(52, 211, 153, .3), rgba(56, 189, 248, .25)); }
.modeCard.kid .mi { background: linear-gradient(145deg, rgba(255, 122, 182, .35), rgba(255, 209, 102, .25)); }
.modeCard.stu, .modeCard.biz, .modeCard.parent, .modeCard.kid { background: var(--m-surface); }
.modeCard:hover, .modeCard:focus-visible { transform: translateY(-3px); border-color: rgba(255, 255, 255, .24); }
.modeCard.on { border-color: rgba(124, 92, 255, .95); background: rgba(124, 92, 255, .12); box-shadow: 0 0 0 1px rgba(124, 92, 255, .9), 0 18px 40px -16px rgba(124, 92, 255, .7); }
.modeCard.on .mi { transform: none; }
.modeCard.on::after { height: 2px; opacity: .6; }
.langRow .lc, .langChips .lc { border-radius: 999px; border: 1px solid var(--m-hair); background: var(--m-surface); font-weight: 600; transition: background .2s, border-color .2s; }
.langChips .lc.on { background: var(--m-grad); border-color: transparent; color: #fff; box-shadow: var(--m-glow); }

/* ---------- Student bits ---------- */
.s-btn { border-radius: var(--m-r-sm); font-weight: 600; }
.s-card, .s-box { border-radius: var(--m-r); }

/* =====================================================================
   CHILD (kids) — friendly but calmer: softer tiles, flat buttons, quieter background decoration
   ===================================================================== */
body[data-mode=kids] .k-scene { opacity: .3; }                                     /* the floating shapes sit quietly behind, never fighting the content */
body[data-mode=kids] .k-card { background: var(--m-surface); border: 1px solid var(--m-hair); border-radius: 24px; box-shadow: var(--m-shadow); backdrop-filter: blur(14px); }
body[data-mode=kids] .k-btn { min-height: 50px; padding: 11px 22px; font-size: 16px; font-weight: 700; border-radius: 18px; background: var(--m-grad); box-shadow: var(--m-glow); letter-spacing: .005em; }
body[data-mode=kids] .k-btn::after { display: none; }                                /* no moving shine */
body[data-mode=kids] .k-btn:active { transform: scale(.97); box-shadow: var(--m-glow); }
body[data-mode=kids] .k-btn.gold { background: linear-gradient(135deg, #ffb84d, #ffd86b); color: #4a2c00; box-shadow: 0 12px 26px -12px rgba(255, 184, 77, .85); }
body[data-mode=kids] .k-btn.ghost { background: var(--m-surface2); box-shadow: none; border: 1px solid var(--m-hair); color: #fff; }
body[data-mode=kids] .k-btn.red { background: linear-gradient(135deg, #ff5c7a, #ff8a5b); box-shadow: 0 12px 26px -12px rgba(255, 92, 122, .85); }
body[data-mode=kids] .k-btn.green { background: linear-gradient(135deg, #22c55e, #2dd4bf); box-shadow: 0 12px 26px -12px rgba(34, 197, 94, .8); }
/* lesson / game / story tiles: a tinted glass tile with the subject colour as an accent, not a solid slab */
body[data-mode=kids] .k-topic, body[data-mode=kids] .k-game, body[data-mode=kids] .k-story {
  border-radius: 26px; padding: 18px 8px; border: 1px solid var(--m-hair); color: #fff;
  background: linear-gradient(160deg, color-mix(in srgb, var(--c, #8b5cf6) 62%, #170f3a), color-mix(in srgb, var(--c, #8b5cf6) 26%, #120c30));
  box-shadow: 0 16px 30px -18px color-mix(in srgb, var(--c, #8b5cf6) 85%, #000), inset 0 1px 0 rgba(255, 255, 255, .14);
}
body[data-mode=kids] .k-story { --c: #f59e0b; }
body[data-mode=kids] .k-story.night { --c: #6d5bff; }
body[data-mode=kids] .k-topic:active, body[data-mode=kids] .k-game:active, body[data-mode=kids] .k-story:active { transform: scale(.97); box-shadow: 0 8px 20px -14px #000; }
body[data-mode=kids] .k-topic b, body[data-mode=kids] .k-game b, body[data-mode=kids] .k-story b { font-size: 16px; line-height: 1.2; }
body[data-mode=kids] .k-topic-ic, body[data-mode=kids] .k-game-ic, body[data-mode=kids] .k-story-ic { font-size: 46px; }
body[data-mode=kids] .k-fav { background: rgba(255, 214, 102, .95); }
body[data-mode=kids] .k-subs button { background: var(--m-surface); border: 1px solid var(--m-hair); font-weight: 600; }
body[data-mode=kids] .k-subs button.on { background: var(--m-grad); border-color: transparent; color: #fff; box-shadow: var(--m-glow); }
body[data-mode=kids] .k-hero { border-radius: 28px; box-shadow: var(--m-shadow); }
body[data-mode=kids] .k-chip { background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .22); }
body[data-mode=kids] .k-rt { border-radius: 20px; }
body[data-mode=kids] .k-tabs button, body[data-mode=kids] .k-chipbtn { border-radius: 999px; }
body[data-mode=kids] .k-ov, body[data-mode=kids] .k-ovin { backdrop-filter: blur(6px); }
.k-status { border-radius: 20px; }
.k-status.warn { border-color: rgba(255, 190, 80, .45); background: rgba(255, 190, 80, .09); }
.k-status.info { border-color: rgba(56, 189, 248, .4); background: rgba(56, 189, 248, .09); }
.k-status ul.k-tips { margin: 8px 0 10px; padding-left: 20px; font-size: 13px; line-height: 1.55; color: var(--mut); }
.k-status b { font-size: 15px; }

/* =====================================================================
   PARENT — calm teal guardian look on the same system
   ===================================================================== */
body[data-mode=parent] .card, body[data-mode=parent] .k-card { background: var(--m-surface); border: 1px solid var(--m-hair); }
body[data-mode=parent] .btn.primary, body[data-mode=parent] .k-btn { background: linear-gradient(135deg, #14b8a6 0%, #38bdf8 100%); box-shadow: 0 12px 26px -12px rgba(20, 184, 166, .8); }
body[data-mode=parent] nav button.on { background: rgba(56, 189, 248, .16); box-shadow: inset 0 0 0 1px rgba(56, 189, 248, .35); }

/* ---------- desktop: keep the app a comfortable, centred column ---------- */
@media (min-width: 760px) {
  main { max-width: 720px; margin-left: auto; margin-right: auto; }
  nav { left: 50%; right: auto; width: min(560px, calc(100% - 24px)); transform: translateX(-50%); }
  header { padding-left: max(16px, calc((100% - 720px) / 2)); padding-right: max(16px, calc((100% - 720px) / 2)); }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; } }

/* the mode themes (kids / parent) set their own header + dock colours with higher specificity: bring them onto the same system */
body[data-mode] header { background: rgba(12, 10, 30, .6); }
body[data-mode=kids] header { background: rgba(38, 18, 84, .6); }
body[data-mode=parent] header { background: rgba(8, 44, 60, .62); }
body[data-mode] nav { background: rgba(18, 16, 42, .72); border: 1px solid var(--m-hair); box-shadow: 0 22px 44px -16px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .06); }
body[data-mode=kids] nav { background: rgba(44, 22, 98, .72); }
body[data-mode=parent] nav { background: rgba(10, 52, 70, .74); }
body[data-mode=kids] nav button, body[data-mode=parent] nav button { font-size: 11px; font-weight: 600; }
body[data-mode=kids] nav button.on { color: #fff; background: rgba(255, 255, 255, .15); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .2); }
body[data-mode=kids] nav button.on i, body[data-mode=parent] nav button.on i { transform: none; filter: none; }
body[data-mode=parent] nav button.on { color: #fff; }

/* ---------- finishing touches ---------- */
body[data-mode=kids] .k-topic, body[data-mode=kids] .k-game, body[data-mode=kids] .k-story {
  background: linear-gradient(160deg, color-mix(in srgb, var(--c, #8b5cf6) 72%, #170f3a), color-mix(in srgb, var(--c, #8b5cf6) 30%, #120c30));
}
/* stories had one colour for all: give them a calm rotating palette */
body[data-mode=kids] .k-story:nth-child(6n+1) { --c: #f97316; }
body[data-mode=kids] .k-story:nth-child(6n+2) { --c: #ec4899; }
body[data-mode=kids] .k-story:nth-child(6n+3) { --c: #8b5cf6; }
body[data-mode=kids] .k-story:nth-child(6n+4) { --c: #06b6d4; }
body[data-mode=kids] .k-story:nth-child(6n+5) { --c: #22c55e; }
body[data-mode=kids] .k-story:nth-child(6n+6) { --c: #f43f5e; }
body[data-mode=kids] .k-story.night { --c: #6d5bff; }
/* the greeting card: deeper colours so the white text is always readable, clouds quieter */
.k-hero.morn { background: linear-gradient(160deg, #f97316, #ec4899 70%, #8b5cf6); }
.k-hero.day { background: linear-gradient(160deg, #3b82f6, #6366f1 62%, #8b5cf6); }
.k-hero.eve { background: linear-gradient(160deg, #7c3aed, #db2777 62%, #f97316); }
.k-hero .k-cloud { opacity: .35; }
.k-hello small { font-size: 14px; font-weight: 700; opacity: .9; }
.k-hello h1 { font-size: 30px; font-weight: 800; text-shadow: 0 2px 12px rgba(0, 0, 0, .25); }
.k-say { background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .25); }
/* the child card keeps its rainbow edge, just thinner and calmer */
.modeCard.kid::before { padding: 1.5px; opacity: .75; }
.modeCard.kid .mi { animation: none; }
/* empty states */
.k-empty, .k-empty.big { font-size: 18px; font-weight: 600; line-height: 1.5; color: var(--tx); padding: 26px 16px; text-align: center; background: var(--m-surface); border: 1px solid var(--m-hair); border-radius: var(--m-r); }
.k-empty.big { font-size: 20px; }

/* =====================================================================
   MOBILE POLISH — header, page titles, safety buttons (phone widths 320-430px)
   ===================================================================== */
header { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
header .who { flex: 1 1 auto; min-width: 0; gap: 9px; flex-wrap: nowrap; }
header .who > div:nth-child(2) { min-width: 0; line-height: 1.15; }
header .who b { font-size: 17px; font-weight: 800; line-height: 1.1; white-space: nowrap; letter-spacing: .2px; }
header .who b::first-line { background: none; }
header #status { display: block; max-width: 110px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header .orb { flex: none; width: 38px; height: 38px; }
.modeBadge { flex: none; margin: 0 0 0 2px; padding: 2px 9px; font-size: 10.5px; line-height: 1.5; white-space: nowrap; }
header .gearBtn, header #langBtn { flex: none; width: 38px; height: 38px; margin: 0; font-size: 17px; display: grid; place-items: center; padding: 0; }
header .clock { flex: none; text-align: right; line-height: 1.1; }
header .clock b { display: block; font-size: 19px; font-weight: 800; white-space: nowrap; letter-spacing: -.01em; }
header .clock span { display: block; font-size: 10.5px; white-space: nowrap; }

/* the "location ON" badge is a promise to the child: always visible, but UNDER the header, small, never on top of the clock or the name */
.k-locbadge { top: calc(env(safe-area-inset-top) + 62px); font-size: 11px; padding: 3px 11px; gap: 5px; letter-spacing: .01em; box-shadow: 0 6px 16px -6px rgba(0, 0, 0, .55); }
body[data-mode=kids]:has(.k-locbadge:not([hidden])) main { padding-top: 30px; }

/* child page titles ("What shall we learn today?" + language switch): title on its own line, switch under it, nothing squeezed */
body[data-mode=kids] .k-sec.big { flex-wrap: wrap; row-gap: 10px; align-items: center; }
body[data-mode=kids] .k-sec.big h2 { flex: 1 1 200px; min-width: 0; margin: 0; font-size: clamp(21px, 6.4vw, 27px); line-height: 1.18; font-weight: 800; letter-spacing: -.015em; text-wrap: balance; text-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
body[data-mode=kids] .k-langsw { flex: none; padding: 3px; }
body[data-mode=kids] .k-langsw button { padding: 7px 14px; font-size: 14px; }
body[data-mode=kids] .k-lvtxt { margin: 0 2px 4px; font-size: 12px; line-height: 1.35; opacity: .85; }
body[data-mode=kids] .k-subs { margin-inline: -16px; padding-inline: 16px; scroll-padding-inline: 16px; }
body[data-mode=kids] .k-subs button { padding: 7px 13px; font-size: 13px; }
body[data-mode=kids] .k-wrap { gap: 12px; }

/* SOS: smaller, tucked above the dock at the left edge */
.k-sos { width: 48px; height: 48px; font-size: 19px; left: 10px; bottom: calc(92px + env(safe-area-inset-bottom)); border-width: 2px; box-shadow: 0 6px 16px -4px rgba(220, 38, 38, .7); opacity: .96; }
.k-sos small { font-size: 8.5px; letter-spacing: .04em; }

@media (max-width: 400px) {
  header { padding-left: 12px; padding-right: 12px; gap: 6px; }
  header .who { gap: 7px; }
  header .orb { width: 34px; height: 34px; }
  header .who b { font-size: 16px; }
  header #status { max-width: 64px; }
  header .gearBtn, header #langBtn { width: 34px; height: 34px; font-size: 16px; }
  header .clock b { font-size: 17px; }
  .modeBadge { padding: 2px 7px; font-size: 10px; }
  body[data-mode=kids] .k-sec.big { flex-direction: column; align-items: flex-start; row-gap: 8px; }
  body[data-mode=kids] .k-sec.big h2 { flex: none; width: 100%; font-size: clamp(21px, 6.8vw, 26px); }
  body[data-mode=kids] .k-topics, body[data-mode=kids] .k-games, body[data-mode=kids] .k-stories { gap: 10px; }
  body[data-mode=kids] .k-topic, body[data-mode=kids] .k-game, body[data-mode=kids] .k-story { padding: 15px 6px; border-radius: 22px; }
  body[data-mode=kids] .k-topic-ic, body[data-mode=kids] .k-game-ic, body[data-mode=kids] .k-story-ic { font-size: 40px; }
  body[data-mode=kids] .k-topic b, body[data-mode=kids] .k-game b, body[data-mode=kids] .k-story b { font-size: 14.5px; }
  nav { left: 8px; right: 8px; }
  nav button { font-size: 10.5px; min-height: 52px; }
}
@media (max-width: 340px) {
  header .who #status { display: none; }
  header .clock span { display: none; }
  .modeBadge { display: none; }
}
@media (max-width: 400px) {
  body[data-mode=kids] .k-chips { gap: 6px; flex-wrap: nowrap; }
  body[data-mode=kids] .k-chip { padding: 6px 10px; font-size: 14px; white-space: nowrap; }
  body[data-mode=kids] .k-chip i { font-size: 18px; }
  body[data-mode=kids] .k-hello h1 { font-size: 26px; }
  body[data-mode=kids] .k-hero { padding: 14px 12px 12px; }
  body[data-mode=kids] .k-av-wrap, body[data-mode=kids] .k-av.big { transform: scale(.88); transform-origin: left top; }
}
