/* Gaming Mode v1 — standalone app styles.
   Adapted from the approved unlock-games-mock stylesheet (Krunal's
   graphics pass, 2026-11-21). Demo-only rules (grade switcher,
   simulate bar, mock tag) removed; launch/resume state added. */
:root{
  --bg:#eaf3f8; --bg2:#dcecf5;
  --card:#ffffff; --card-soft:#f4f9fc;
  --ink:#16324a; --ink-soft:#4a6a82; --ink-faint:#7d99ad;
  --line:#c9dde9;
  --teal:#0e7c86; --teal-dark:#0a5f67; --teal-soft:#d9f0f1;
  --amber:#f2a81d; --amber-dark:#c77f06; --amber-soft:#fdf0d3;
  --coral:#e4572e; --coral-soft:#fde3da;
  --green:#2e9e5b; --green-soft:#dcf2e4;
  --lock:#8aa5b5;
  --shadow:0 6px 0 rgba(22,50,74,.10), 0 14px 28px rgba(22,50,74,.10);
  --shadow-sm:0 3px 0 rgba(22,50,74,.10), 0 8px 16px rgba(22,50,74,.08);
  --radius:20px;
}
@media (prefers-color-scheme: dark){
  :root{
    --bg:#0d1d29; --bg2:#0a1721;
    --card:#16303f; --card-soft:#122836;
    --ink:#e8f2f8; --ink-soft:#a9c4d4; --ink-faint:#7d99ad;
    --line:#2a4a5e;
    --teal:#2fb3bf; --teal-dark:#7fd6dd; --teal-soft:#123c44;
    --amber:#f5b93e; --amber-dark:#f5b93e; --amber-soft:#3d2f10;
    --coral:#ff8a66; --coral-soft:#42231a;
    --green:#4cc97e; --green-soft:#173d28;
    --lock:#5d7d90;
    --shadow:0 6px 0 rgba(0,0,0,.35), 0 14px 28px rgba(0,0,0,.35);
    --shadow-sm:0 3px 0 rgba(0,0,0,.35), 0 8px 16px rgba(0,0,0,.3);
  }
}
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; font-family:"Nunito",system-ui,sans-serif; color:var(--ink);
  background:linear-gradient(180deg,var(--bg) 0%,var(--bg2) 100%);
  min-height:100vh; line-height:1.45;
}
button{ font-family:inherit; cursor:pointer; min-height:44px; }
h1,h2,h3,.display{ font-family:"Baloo 2","Nunito",sans-serif; line-height:1.15; margin:0; }
p{ margin:0; }
.wrap{ max-width:1060px; margin:0 auto; padding:18px 16px 64px; }

/* ---------- top status bar ---------- */
.statusbar{
  display:flex; flex-wrap:wrap; gap:10px; align-items:center; justify-content:space-between;
  background:var(--card); border:2px solid var(--line); border-radius:16px;
  padding:10px 14px; box-shadow:var(--shadow-sm); margin-bottom:18px;
}
.brand{ display:flex; align-items:center; gap:10px; font-family:"Baloo 2",sans-serif; font-weight:800; font-size:1.05rem; }
.brand .dot{ width:34px; height:34px; border-radius:10px; background:var(--teal); color:#fff; display:grid; place-items:center; font-size:1.05rem; }
.chips{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.chip{
  display:inline-flex; align-items:center; gap:6px; font-weight:800; font-size:.9rem;
  border-radius:999px; padding:7px 13px; border:2px solid var(--line); background:var(--card-soft); color:var(--ink);
}
.chip.sparks{ background:var(--amber-soft); border-color:var(--amber); color:var(--ink); }
.chip.clock{ font-variant-numeric:tabular-nums; }
.backmath{
  border:2px solid var(--teal); background:var(--teal); color:#fff; border-radius:999px;
  font-weight:800; padding:7px 14px; min-height:38px; box-shadow:var(--shadow-sm);
}
.backmath:active{ transform:translateY(2px); box-shadow:none; }

/* ---------- views ---------- */
.view{ display:none; }
.view.active{ display:block; animation:pop .25s ease; }
@keyframes pop{ from{ opacity:0; transform:translateY(6px);} to{ opacity:1; transform:none;} }
@media (prefers-reduced-motion: reduce){ .view.active{ animation:none; } }

.crumbs{ display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:14px; font-weight:800; font-size:.9rem; color:var(--ink-soft); }
.crumbs .sep{ color:var(--ink-faint); }
.crumbs .here{ color:var(--ink); }
.backbtn{
  border:2px solid var(--line); background:var(--card); color:var(--ink); border-radius:12px;
  font-weight:800; padding:8px 14px; box-shadow:var(--shadow-sm);
}
.backbtn:active{ transform:translateY(2px); box-shadow:none; }

.hero{ margin:6px 0 20px; }
.hero h1{ font-size:clamp(1.7rem,4.5vw,2.5rem); font-weight:800; }
.hero p{ color:var(--ink-soft); font-size:1.02rem; max-width:60ch; margin-top:6px; font-weight:600; }

/* ---------- launch / resume state ---------- */
.launchcard{
  border:3px solid var(--teal); border-radius:var(--radius); background:var(--card);
  padding:34px 26px; text-align:center; box-shadow:var(--shadow); max-width:640px; margin:26px auto 0;
}
.launchcard .art{ font-size:3.4rem; line-height:1; }
.launchcard h1{ font-size:1.8rem; font-weight:800; margin-top:12px; }
.launchcard p{ color:var(--ink-soft); font-weight:600; margin-top:10px; }
.launchcard .btnrow{ justify-content:center; }

/* ---------- big choice tiles ---------- */
.duo{ display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width:640px){ .duo{ grid-template-columns:1fr; } }
.bigcard{
  text-align:left; border:3px solid var(--line); background:var(--card); border-radius:var(--radius);
  padding:24px 22px; box-shadow:var(--shadow); color:var(--ink); width:100%;
}
.bigcard:active{ transform:translateY(3px); box-shadow:var(--shadow-sm); }
.bigcard .art{ font-size:2.6rem; line-height:1; margin-bottom:12px; }
.bigcard h2{ font-size:1.55rem; font-weight:800; }
.bigcard p{ color:var(--ink-soft); font-weight:600; margin-top:6px; }
.bigcard .go{ display:inline-block; margin-top:14px; font-weight:800; color:var(--teal-dark); }
.bigcard.feature{ border-color:var(--teal); background:linear-gradient(180deg,var(--teal-soft),var(--card) 70%); }
.bigcard .pillrow{ display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
.minipill{ font-size:.8rem; font-weight:800; background:var(--card-soft); border:2px solid var(--line); border-radius:999px; padding:4px 10px; }

/* ---------- game grids ---------- */
.grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:16px; }
.gamecard{
  position:relative; text-align:left; width:100%; border:3px solid var(--line); background:var(--card);
  border-radius:var(--radius); padding:18px; box-shadow:var(--shadow-sm); color:var(--ink);
}
button.gamecard:active{ transform:translateY(2px); }
.gamecard .art{ font-size:2.3rem; line-height:1.1; }
.gamecard h3{ font-size:1.18rem; font-weight:800; margin-top:8px; }
.gamecard p{ color:var(--ink-soft); font-weight:600; font-size:.92rem; margin-top:4px; }
.gamecard .meta{ display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; align-items:center; }
.tag{ font-size:.78rem; font-weight:800; border-radius:999px; padding:4px 10px; }
.tag.open{ background:var(--green-soft); color:var(--green); border:2px solid var(--green); }
.tag.played{ background:var(--teal-soft); color:var(--teal-dark); border:2px solid var(--teal); }
.tag.need{ background:var(--amber-soft); color:var(--amber-dark); border:2px solid var(--amber); }
.gamecard.locked{ background:var(--card-soft); }
.gamecard.locked .art, .gamecard.locked h3, .gamecard.locked p{ opacity:.55; }
.lockbadge{
  position:absolute; top:12px; right:12px; width:42px; height:42px; border-radius:50%;
  background:var(--card); border:2px solid var(--line); display:grid; place-items:center; font-size:1.15rem;
}
.locknote{ margin-top:12px; font-size:.86rem; font-weight:700; color:var(--ink-soft); display:flex; gap:6px; align-items:flex-start; }

/* ---------- story cover art ---------- */
.coverwrap{ position:relative; margin:-18px -18px 14px; border-radius:17px 17px 0 0; overflow:hidden; border-bottom:3px solid var(--line); }
.coverwrap img{ display:block; width:100%; aspect-ratio:4/3; object-fit:cover; }
.gamecard.locked .coverwrap img{ filter:saturate(.45) brightness(.93); }
.coverwrap .lockbadge{ top:10px; right:10px; box-shadow:var(--shadow-sm); }
.gamecard.featured h3{ font-size:1.45rem; }
.gamecard.featured p{ font-size:1rem; }
@media (min-width:760px){
  .gamecard.featured{ grid-column:1 / -1; display:grid; grid-template-columns:1.1fr 1fr; column-gap:22px; align-items:stretch; }
  .gamecard.featured .coverwrap{ margin:-18px 0 -18px -18px; border-radius:17px 0 0 17px; border-bottom:none; border-right:3px solid var(--line); }
  .gamecard.featured .coverwrap img{ height:100%; aspect-ratio:auto; min-height:260px; }
  .gamecard.featured .cardbody{ align-self:center; padding:10px 0; }
  .gamecard.featured h3{ font-size:1.8rem; }
}
.tileart{ display:block; width:100%; height:112px; object-fit:cover; object-position:center 28%; border-radius:12px; margin-bottom:14px; border:2px solid var(--line); }
.labart{
  display:flex; gap:4px; justify-content:space-around; align-items:center; height:112px; border-radius:12px;
  margin-bottom:14px; background:linear-gradient(135deg,var(--amber-soft),var(--teal-soft)); border:2px solid var(--line); font-size:2.1rem;
}
.bannerart{ display:block; width:100%; height:230px; object-fit:cover; object-position:center 32%; border-radius:14px; border:3px solid var(--line); margin-bottom:16px; box-shadow:var(--shadow-sm); }
@media (max-width:640px){ .bannerart{ height:168px; } }
.sceneart{ margin:-24px -22px 20px; border-radius:17px 17px 0 0; overflow:hidden; border-bottom:3px solid var(--line); }
.sceneart img{ display:block; width:100%; aspect-ratio:16/8; object-fit:cover; object-position:center 32%; }
@media (max-width:640px){ .sceneart img{ aspect-ratio:16/10; } }

/* tooltip bubble for locked cards */
.tip{
  display:none; margin-top:10px; background:var(--ink); color:var(--bg); border-radius:12px;
  padding:10px 12px; font-size:.88rem; font-weight:700; line-height:1.4;
}
.gamecard.showtip .tip, .chaprow.showtip .tip{ display:block; }
@media (prefers-color-scheme: dark){ .tip{ background:#e8f2f8; color:#16324a; } }

/* ---------- chapters ---------- */
.storybanner{
  border:3px solid var(--teal); border-radius:var(--radius); background:linear-gradient(180deg,var(--teal-soft),var(--card) 75%);
  padding:22px; box-shadow:var(--shadow-sm); margin-bottom:18px;
}
.storybanner h2{ font-size:1.7rem; font-weight:800; }
.storybanner p{ color:var(--ink-soft); font-weight:600; margin-top:5px; max-width:62ch; }
.chaplist{ display:grid; gap:12px; }
.chaprow{
  display:flex; gap:14px; align-items:flex-start; width:100%; text-align:left; flex-wrap:wrap;
  border:3px solid var(--line); background:var(--card); border-radius:16px; padding:16px; color:var(--ink); box-shadow:var(--shadow-sm);
}
button.chaprow:active{ transform:translateY(2px); }
.chapnum{
  flex:0 0 auto; width:48px; height:48px; border-radius:14px; display:grid; place-items:center;
  font-family:"Baloo 2",sans-serif; font-weight:800; font-size:1.2rem; background:var(--teal-soft); color:var(--teal-dark); border:2px solid var(--teal);
}
.chaprow.locked .chapnum{ background:var(--card-soft); color:var(--lock); border-color:var(--line); }
.chaprow .body{ flex:1 1 auto; min-width:0; }
.chaprow h3{ font-size:1.08rem; font-weight:800; }
.chaprow p{ color:var(--ink-soft); font-weight:600; font-size:.92rem; margin-top:2px; }
.chaprow .tip{ flex-basis:100%; }
.progressline{ height:10px; border-radius:999px; background:var(--card-soft); border:2px solid var(--line); overflow:hidden; margin-top:10px; }
.progressline i{ display:block; height:100%; background:var(--amber); width:0%; }

/* ---------- story play ---------- */
.scene{
  border:3px solid var(--line); background:var(--card); border-radius:var(--radius);
  padding:24px 22px; box-shadow:var(--shadow-sm);
}
.scene .where{ font-weight:800; color:var(--teal-dark); font-size:.9rem; letter-spacing:.03em; text-transform:uppercase; }
.scene h2{ font-size:1.5rem; font-weight:800; margin:6px 0 10px; }
.scene .story{ font-size:1.06rem; font-weight:600; color:var(--ink); max-width:62ch; }
.scene .story + .story{ margin-top:10px; }
.choices{ display:grid; gap:10px; margin-top:20px; }
@media (min-width:640px){ .choices{ grid-template-columns:1fr 1fr; } }
.choice{
  border:3px solid var(--line); background:var(--card-soft); border-radius:14px; padding:14px 16px;
  font-weight:800; font-size:1rem; color:var(--ink); text-align:left;
}
.choice:hover{ border-color:var(--teal); }
.choice.right{ border-color:var(--green); background:var(--green-soft); }
.choice.wrong{ border-color:var(--coral); background:var(--coral-soft); }
.feedback{ margin-top:16px; font-weight:800; font-size:1rem; display:none; }
.feedback.show{ display:block; }
.feedback.good{ color:var(--green); }
.feedback.bad{ color:var(--coral); }
.primarybtn{
  border:none; background:var(--teal); color:#fff; border-radius:14px; font-weight:800; font-size:1rem;
  padding:12px 22px; box-shadow:0 4px 0 var(--teal-dark);
}
.primarybtn:active{ transform:translateY(3px); box-shadow:none; }
.ghostbtn{
  border:2px solid var(--line); background:var(--card); color:var(--ink); border-radius:14px; font-weight:800; padding:10px 18px;
}
.btnrow{ display:flex; flex-wrap:wrap; gap:10px; margin-top:18px; }
.awardline{ font-weight:800; color:var(--amber-dark); margin-top:10px; }

/* ---------- modal (20-minute popup) ---------- */
.overlay{
  position:fixed; inset:0; background:rgba(10,25,38,.62); display:none; place-items:center;
  padding:18px; z-index:50;
}
.overlay.show{ display:grid; }
.modal{
  background:var(--card); color:var(--ink); border-radius:24px; max-width:440px; width:100%;
  padding:30px 26px; text-align:center; box-shadow:0 24px 60px rgba(0,0,0,.35); border:3px solid var(--amber);
}
.modal .art{ font-size:3rem; }
.modal h2{ font-size:1.6rem; font-weight:800; margin-top:8px; }
.modal p{ color:var(--ink-soft); font-weight:600; margin-top:8px; }
.modal .btnrow{ justify-content:center; }
.breakscreen{ display:none; text-align:center; padding:48px 20px; }
.breakscreen.show{ display:block; }
.breakscreen .art{ font-size:4rem; }
.breakscreen h2{ font-size:1.8rem; font-weight:800; margin-top:10px; }
.breakscreen p{ color:var(--ink-soft); font-weight:600; margin-top:8px; }

.toast{
  position:fixed; left:50%; bottom:22px; transform:translateX(-50%) translateY(20px); opacity:0;
  background:var(--ink); color:var(--bg); font-weight:800; border-radius:999px; padding:12px 20px;
  z-index:60; transition:.25s ease; pointer-events:none; max-width:92vw; text-align:center; font-size:.95rem;
}
@media (prefers-color-scheme: dark){ .toast{ background:#e8f2f8; color:#16324a; } }
.toast.show{ opacity:1; transform:translateX(-50%); }
.sr-only{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
