/* =========================================================================
   Sorkkal shared styles. Linked from every page (including the home page).
   Page-specific game styles stay inside each page.
   Top bar and footer markup lives in partials/ and is loaded by site.js.
   ========================================================================= */
@import url("https://fonts.googleapis.com/css2?family=Baloo+Thambi+2:wght@500;700;800&family=Mukta+Malar:wght@400;600;700&display=swap");

/* ---- Tokens (prefixed so they never clash with a page's own variables) ---- */
:root{
  --sk-navy:#10233B; --sk-paper:#F6F8FB; --sk-text:#16202E; --sk-muted:#5B6878; --sk-line:#DDE3EC;
  --sk-gold:#F2A900; --sk-teal:#0E7C86; --sk-red:#C93631; --sk-green:#267A42;
  --sk-purple:#6B46C1; --sk-blue:#1F55B5; --sk-magenta:#A3266B;
  --sk-green-soft:#DFF3E5; --sk-red-soft:#FDE5E3; --sk-blue-soft:#DFE9FA;
  --sk-display:'Baloo Thambi 2','Noto Sans Tamil','Latha',system-ui,sans-serif;
  --sk-body:'Mukta Malar','Noto Sans Tamil','Latha',system-ui,sans-serif;
  --sk-wrap:clamp(1180px,76vw,1560px);
  --sk-bar-h:clamp(4rem,10vw,5.4rem);
}
@media (max-height:520px){:root{--sk-bar-h:3.9rem}}

/* ---- Page basics ---- */
html{
  scroll-behavior:smooth;scroll-padding-top:var(--sk-bar-h);-webkit-text-size-adjust:100%;
  font-size:clamp(100%,100% + (100vw - 1500px) * .0056,125%); /* grows gently on very wide screens */
}
body{margin:0;padding-top:var(--sk-bar-h);background:var(--sk-paper);color:var(--sk-text);font-family:var(--sk-body)}
@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}

/* Heading of every lesson page */
.page h1{
  margin:clamp(20px,4vw,36px) 0 clamp(14px,2.4vw,20px);color:var(--sk-navy);text-align:center;
  font:800 clamp(1.6rem,4.4vw,2.4rem)/1.3 var(--sk-display);text-wrap:balance;
}

/* ---- Shared chrome (top bar + footer) ---- */
#site-topbar,#site-topbar *,#site-footer,#site-footer *{box-sizing:border-box}
.sk-wrap{
  width:100%;max-width:var(--sk-wrap);margin-inline:auto;
  padding-left:max(clamp(16px,4vw,32px),env(safe-area-inset-left));
  padding-right:max(clamp(16px,4vw,32px),env(safe-area-inset-right));
}

/* Top bar: fixed so it stays visible whatever layout the page uses */
#site-topbar{position:fixed;top:0;left:0;right:0;z-index:500;height:var(--sk-bar-h)}
.sk-topbar{
  height:100%;background:#fff;border-bottom:1.5px solid var(--sk-line);box-shadow:0 2px 12px rgba(16,35,59,.06);
  font-family:var(--sk-body);font-size:1rem;line-height:1.3;
}
.sk-topbar .sk-wrap{max-width:none;height:100%;display:flex;align-items:center;justify-content:space-between;gap:12px}
.sk-brand{display:flex;flex-direction:column;min-width:0;color:#5B1E91;line-height:1.15;text-decoration:none}
.sk-brand b{font:800 clamp(1.5rem,4.2vw,2.6rem)/1.2 var(--sk-display)}
.sk-brand span{font-weight:700;font-size:clamp(.72rem,1.8vw,1.05rem)}
.sk-actions{display:flex;flex:none;gap:clamp(4px,1vw,10px)}
.sk-btn{
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  width:clamp(3.1rem,9vw,5rem);height:calc(var(--sk-bar-h) - 1.1rem);border-radius:clamp(13px,2vw,16px);
  background:#E6E7EB;color:#111;text-decoration:none;font-weight:600;font-size:clamp(.68rem,1.7vw,.95rem);line-height:1.3;
}
.sk-btn:hover{filter:brightness(.94)}
.sk-btn .i{font-size:clamp(1.3rem,3.4vw,1.9rem);line-height:1.15}
.sk-share{background:#25D366}
.sk-share .i{font:700 clamp(1.4rem,3.6vw,2.1rem)/1.15 Arial,Helvetica,sans-serif;color:#0A2A8A}

/* Footer */
#site-footer{margin-top:clamp(40px,6vw,72px)}
.sk-foot{
  padding-block:40px;border-radius:clamp(28px,6vw,64px) clamp(28px,6vw,64px) 0 0;background:var(--sk-navy);
  color:rgba(255,255,255,.8);font-family:var(--sk-body);font-size:1.0625rem;line-height:1.6;text-align:center;
}
.sk-foot p{margin:0}

/* Score line used by the game pages */
.sk-score{margin:0 0 14px;text-align:center;font:700 1.3rem/1.4 var(--sk-body);color:var(--sk-text)}
.sk-score span{color:var(--sk-navy)}

/* Lessons menu (top bar) */
/* Pages may define their own bare "button{margin;padding}" rule; keep the top bar immune to it */
.sk-topbar button.sk-btn{margin:0;padding:0;border:0;cursor:pointer;font-family:inherit;box-sizing:border-box}
.sk-topbar button.sk-burger{display:none}
.sk-topbar button.sk-x{margin:0 0 0 8px;padding:0}
.sk-topbar button.sk-sc-btn{margin:0 0 0 auto;padding:0 12px;min-height:44px;border:0;border-radius:10px;background:var(--sk-navy);color:#fff;font:700 .92rem var(--sk-body);cursor:pointer;display:inline-flex;align-items:center;gap:6px}
.sk-panel-head .sk-sc-btn span{color:#fff;font-size:.92rem}
.sk-lessons-btn[aria-expanded="true"],.sk-burger[aria-expanded="true"]{background:var(--sk-navy);color:#fff}
.sk-scrim{position:fixed;inset:var(--sk-bar-h) 0 0 0;background:rgba(16,35,59,.35)}
.sk-panel{
  position:fixed;top:calc(var(--sk-bar-h) + 6px);right:max(12px,env(safe-area-inset-right));
  width:min(480px,calc(100vw - 24px));max-height:calc(100vh - var(--sk-bar-h) - 18px);max-height:calc(100dvh - var(--sk-bar-h) - 18px);
  overflow:auto;background:#fff;border:1.5px solid var(--sk-line);border-radius:18px;box-shadow:0 18px 48px rgba(16,35,59,.25);
  padding:10px 12px 14px;color:var(--sk-text);font-family:var(--sk-body);overscroll-behavior:contain;
}
.sk-panel[hidden],.sk-scrim[hidden]{display:none}
.sk-quick{display:none}
.sk-panel-head{display:flex;align-items:baseline;gap:8px;padding:4px 4px 8px;font-size:1.15rem}
.sk-panel-head span{color:var(--sk-muted);font-size:.9rem}
.sk-x{margin-left:auto;border:0;background:#E6E7EB;border-radius:10px;width:44px;height:44px;font-size:1.1rem;cursor:pointer;align-self:center}
.sk-paths details{margin:0 0 8px;border:1.5px solid var(--sk-line);border-radius:14px;overflow:hidden}
.sk-paths summary{
  list-style:none;cursor:pointer;display:flex;align-items:center;gap:10px;min-height:48px;padding:8px 12px;
  background:var(--c);color:var(--ink);font-weight:800;
}
.sk-paths summary::-webkit-details-marker{display:none}
.sk-paths summary::after{content:"▾";margin-left:auto;transition:transform .2s}
.sk-paths details[open] summary::after{transform:rotate(180deg)}
.sk-paths summary small{display:block;font-weight:600;font-size:.82rem;opacity:.9}
.sk-paths ul{list-style:none;margin:0;padding:6px;background:var(--soft)}
.sk-paths li a{
  display:flex;align-items:center;gap:10px;min-height:48px;padding:6px 10px;border-radius:10px;
  color:var(--sk-text);text-decoration:none;line-height:1.3;
}
.sk-paths li a:hover{background:#fff}
.sk-paths li a[aria-current="page"]{background:#fff;box-shadow:inset 4px 0 0 var(--c);font-weight:800}
.sk-paths li a .t{display:block}
.sk-paths li a .e{display:block;font-size:.82rem;color:var(--sk-muted)}
.sk-paths li a .ln{display:flex;flex:none;flex-direction:column;align-items:center;gap:2px;width:2.6rem}
.sk-paths li a .ic{text-align:center;font-size:1.25rem;line-height:1.2}
.sk-paths li a .no{font:800 .72rem/1 var(--sk-display);color:var(--sk-muted);letter-spacing:.02em}
.sk-loading{margin:8px 4px;color:var(--sk-muted)}

/* Previous / next lesson arrows */
.sk-pn{display:flex;gap:12px;justify-content:space-between;max-width:960px;margin:24px auto 0;padding-inline:max(clamp(16px,4vw,32px),env(safe-area-inset-left));font-family:var(--sk-body)}
.sk-pn a{
  flex:1 1 0;min-width:0;display:flex;align-items:center;gap:10px;min-height:56px;padding:8px 14px;border-radius:16px;
  background:#fff;border:1.5px solid var(--sk-line);color:var(--sk-text);text-decoration:none;line-height:1.3;
}
.sk-pn a:hover{border-color:var(--sk-navy)}
.sk-pn .arr{flex:none;font-size:1.6rem;font-weight:800;color:var(--sk-navy)}
.sk-pn .lbl{display:block;font-size:.78rem;color:var(--sk-muted)}
.sk-pn .ttl{display:block;font-weight:700;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.sk-pn .nx{text-align:right;flex-direction:row-reverse}
.sk-pn .gap{flex:1 1 0}

@media (max-width:640px){
  .sk-actions{display:none}
  .sk-topbar button.sk-burger{display:flex}
  .sk-panel{left:0;right:0;top:var(--sk-bar-h);width:auto;max-height:none;bottom:0;border-radius:0 0 18px 18px;border-width:0 0 1.5px}
  .sk-scrim{display:none}
  .sk-quick{display:flex;gap:8px;padding:4px 4px 10px}
  .sk-quick .sk-btn{flex:1;width:auto;height:4rem}
  .sk-pn a .lbl{display:none}
}

/* Lesson badges and the My Scores panel */
.sk-bdg{flex:none;margin-left:auto;padding:3px 9px;border-radius:999px;background:#FFF1CC;color:#2B1B00;font:800 .8rem/1.3 var(--sk-body);white-space:nowrap}
.sk-paths li a .sk-bdg{background:#fff;border:1.5px solid var(--sk-line)}
a.mod .sk-bdg{align-self:flex-start;margin-top:2px}
.sk-sc-overlay{position:fixed;inset:0;z-index:900;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(15,23,42,.55)}
.sk-sc-overlay[hidden]{display:none}
.sk-sc-card{width:100%;max-width:520px;max-height:calc(100dvh - 32px);overflow:auto;background:#fff;color:var(--sk-text);border-radius:18px;padding:16px 18px 20px;box-shadow:0 18px 48px rgba(0,0,0,.3);font-family:var(--sk-body);overscroll-behavior:contain}
.sk-sc-head{display:flex;align-items:center;gap:8px;font-size:1.2rem}
.sk-sc-head span{color:var(--sk-muted);font-size:.95rem}
.sk-x2{margin-left:auto;width:44px;height:44px;border:0;border-radius:10px;background:#E6E7EB;font-size:1.1rem;cursor:pointer}
.sk-sc-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px;margin:12px 0 6px}
.sk-sc-stats div{background:var(--sk-paper);border-radius:12px;padding:10px 6px;text-align:center}
.sk-sc-stats b{display:block;font:800 1.35rem/1.2 var(--sk-display)}
.sk-sc-stats span{font-size:.78rem;color:var(--sk-muted)}
.sk-sc-card h3{margin:16px 0 8px;font:800 .95rem var(--sk-body);color:var(--sk-muted);text-transform:uppercase;letter-spacing:.04em}
.sk-sc-row{display:grid;grid-template-columns:6.2rem 1fr 3.4rem;align-items:center;gap:8px;margin:6px 0;font-size:.92rem}
.sk-sc-lab{font-weight:700}
.sk-sc-bar{height:12px;border-radius:999px;background:#E6E7EB;overflow:hidden}
.sk-sc-bar i{display:block;height:100%;background:var(--c);border-radius:999px}
.sk-sc-n{text-align:right;color:var(--sk-muted)}
.sk-sc-list{list-style:none;margin:0;padding:0}
.sk-sc-list a{display:flex;align-items:center;gap:10px;min-height:48px;padding:6px 4px;border-bottom:1px solid var(--sk-line);color:var(--sk-text);text-decoration:none;line-height:1.3}
.sk-sc-list .no{flex:none;width:2.2rem;font:800 .85rem var(--sk-display);color:var(--sk-muted)}
.sk-sc-list .t{flex:1;min-width:0}
.sk-sc-list .t span{display:block;font-weight:700}
.sk-sc-list small{display:block;color:var(--sk-muted);font-size:.8rem}
.sk-sc-list .meta{flex:none;display:flex;flex-direction:column;align-items:flex-end;gap:2px}
.sk-sc-list .sk-bdg{margin:0}
.sk-sc-note{margin:14px 0 8px;font-size:.85rem;color:var(--sk-muted)}
.sk-sc-reset{border:1.5px solid var(--sk-line);background:#fff;border-radius:10px;padding:10px 14px;min-height:44px;font:700 .9rem var(--sk-body);cursor:pointer;color:var(--sk-red)}
.sk-panel-head{position:sticky;top:-10px;z-index:2;background:#fff;margin:-10px -12px 0;padding:10px 12px 8px}
/* Keep the panel header buttons whole on narrow screens */
.sk-panel-head b{flex:0 1 auto;min-width:0}
.sk-topbar button.sk-sc-btn,.sk-topbar button.sk-x{flex:none;white-space:nowrap}
.sk-topbar button.sk-x{width:44px}
@media (max-width:480px){
  .sk-panel-head>span{display:none}
  .sk-topbar button.sk-sc-btn{padding:0 10px}
}

/* Progress bar on the home page path cards */
.sk-prog{display:flex;align-items:center;gap:10px;margin-top:8px;max-width:420px}
.sk-prog .bar{flex:1;height:10px;border-radius:999px;background:color-mix(in srgb,var(--ink,#fff) 22%,transparent);overflow:hidden}
.sk-prog .bar i{display:block;height:100%;border-radius:999px;background:var(--ink,#fff);min-width:0;transition:width .4s ease}
.sk-prog .txt{flex:none;font:800 .85rem/1 var(--sk-display);color:var(--ink,#fff)}
@media (prefers-reduced-motion:reduce){.sk-prog .bar i{transition:none}}

/* Share my progress picture */
.sk-sc-share{display:flex;flex-direction:column;gap:8px;margin:14px 0 6px}
.sk-sc-prev{width:100%;max-width:320px;align-self:center;border-radius:14px;box-shadow:0 4px 14px rgba(16,35,59,.25)}
.sk-sc-share label{font-size:.85rem;color:var(--sk-muted)}
.sk-sc-share input{border:1.5px solid var(--sk-line);border-radius:10px;padding:10px 12px;min-height:44px;font:600 1rem var(--sk-body);width:100%;box-sizing:border-box}
.sk-sc-sharebtn{background:#1f9d55;color:#fff;border:0;border-radius:12px;min-height:48px;padding:10px 16px;font:800 1rem var(--sk-body);cursor:pointer}
.sk-sc-sharebtn:disabled{opacity:.6;cursor:wait}

/* My Scores button: never clip, even with large system text - the title shrinks instead */
.sk-panel-head{flex-wrap:nowrap}
.sk-panel-head b{flex:1 1 0;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.sk-topbar button.sk-sc-btn{margin-left:auto}

/* Pages have their own bare "button{width/height/font-size...}" rules; make sure none of them can resize the top-bar buttons */
.sk-topbar button.sk-sc-btn{width:auto;height:auto;min-height:44px;max-width:none;line-height:1.2;text-align:center}
.sk-topbar button.sk-x{width:44px;height:44px;min-height:0;max-width:none;padding:0;line-height:1}
.sk-topbar .sk-actions button.sk-btn,.sk-topbar button.sk-burger{max-width:none;line-height:1.15}
.sk-topbar button.sk-sc-btn,.sk-topbar button.sk-x,.sk-topbar button.sk-burger,.sk-topbar .sk-actions button.sk-btn{min-width:0;flex:none}
.sk-topbar button.sk-burger,.sk-topbar .sk-actions button.sk-btn{width:clamp(3.1rem,9vw,5rem);height:calc(var(--sk-bar-h) - 1.1rem)}

/* Pages sometimes style bare "ul" / "li" for their own lists; keep the lessons menu and My Scores lists immune to that */
.sk-topbar .sk-paths ul{width:auto;margin:0;padding:6px;text-align:start;list-style:none}
.sk-topbar .sk-paths li{margin:0;padding:0;font-size:1rem;line-height:1.3;text-align:start;list-style:none}
.sk-sc-list{width:auto;margin:0;padding:0;text-align:start;list-style:none}
.sk-sc-list li{margin:0;padding:0;font-size:1rem;text-align:start}
