/* Math Hero Kids rewards system */
#mhr-pill {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  inset-inline-start: 12px;
  z-index: 99998;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 2px solid #e8c25a;
  border-radius: 999px;
  background: #fffdf9;
  box-shadow: 0 4px 12px rgba(61, 40, 0, 0.18);
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  color: #1f2a4a;
  cursor: pointer;
  white-space: nowrap;
}
#mhr-pill .mhr-p { display: inline-flex; align-items: center; gap: 3px; }
#mhr-pill.mhr-hidden { display: none; }
#mhr-overlay {
  position: fixed; inset: 0; z-index: 100002;
  display: none;
  align-items: flex-end; justify-content: center;
  background: rgba(31, 42, 74, 0.45);
}
#mhr-overlay.mhr-show { display: flex; }
#mhr-panel {
  background: #f4efec;
  width: 100%; max-width: 520px;
  border-radius: 22px 22px 0 0;
  max-height: 88vh; overflow-y: auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  font-family: inherit; color: #1f2a4a;
}
#mhr-panel .mhr-grab { width: 44px; height: 5px; border-radius: 99px; background: #cfc4bb; margin: 0 auto 10px; }
.mhr-head { display: flex; align-items: center; gap: 12px; }
.mhr-hero { flex: 0 0 auto; width: 84px; height: 96px; position: relative; }
.mhr-headtxt { flex: 1; min-width: 0; }
.mhr-bal { display: flex; gap: 12px; font-size: 19px; font-weight: 800; flex-wrap: wrap; }
.mhr-bal .mhr-p { display: inline-flex; align-items: center; gap: 4px; }
.mhr-level { margin-top: 6px; font-size: 13px; font-weight: 700; color: #5a6486; }
.mhr-levelbar { height: 8px; border-radius: 99px; background: #e3d9d2; margin-top: 4px; overflow: hidden; }
.mhr-levelbar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #ffb300, #ff8f00); transition: width .5s; }
.mhr-close {
  border: 2px solid #c8cee3; background: #fff; border-radius: 999px;
  width: 38px; height: 38px; font-size: 16px; cursor: pointer; color: #1f2a4a; flex: 0 0 auto;
}
.mhr-sec { margin-top: 16px; background: #fffdf9; border: 2px solid #e8ded6; border-radius: 18px; padding: 12px 14px; }
.mhr-sec h3 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 6px; }
.mhr-sec h3 small { font-weight: 700; color: #5a6486; font-size: 12px; margin-inline-start: auto; }
.mhr-streak-big { font-size: 26px; font-weight: 900; }
.mhr-muted { color: #5a6486; font-size: 13px; }
.mhr-bar { height: 10px; border-radius: 99px; background: #e3d9d2; overflow: hidden; margin-top: 6px; }
.mhr-bar > div { height: 100%; border-radius: 99px; transition: width .5s; }
.mhr-grow { display: grid; gap: 10px; }
.mhr-gline { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 800; }
.mhr-gline .mhr-bar { flex: 1; margin-top: 0; }
.mhr-gline .mhr-frac { font-size: 12px; color: #5a6486; min-width: 42px; text-align: end; }
.mhr-badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mhr-badge { background: #fff; border: 2px solid #e8ded6; border-radius: 14px; padding: 8px 6px; text-align: center; }
.mhr-badge .mhr-bi { font-size: 26px; display: block; }
.mhr-badge .mhr-bn { font-size: 11.5px; font-weight: 800; display: block; margin-top: 3px; line-height: 1.25; }
.mhr-badge.mhr-locked { opacity: 0.42; filter: grayscale(1); }
.mhr-shop { display: grid; gap: 8px; }
.mhr-item { display: flex; align-items: center; gap: 10px; background: #fff; border: 2px solid #e8ded6; border-radius: 14px; padding: 10px 12px; }
.mhr-item .mhr-ii { font-size: 28px; flex: 0 0 auto; }
.mhr-item .mhr-it { flex: 1; min-width: 0; }
.mhr-item .mhr-it b { display: block; font-size: 15px; }
.mhr-item .mhr-it small { display: block; color: #5a6486; font-size: 12px; }
.mhr-buy {
  border: none; border-radius: 999px; padding: 9px 14px; font: inherit; font-size: 14px; font-weight: 800;
  background: linear-gradient(135deg, #ffb300, #ff8f00); color: #3d2800; cursor: pointer; white-space: nowrap;
}
.mhr-buy[disabled] { background: #e3d9d2; color: #8a8272; cursor: default; }
.mhr-buy.mhr-ghost { background: #fff; border: 2px solid #c8cee3; color: #1f2a4a; }
.mhr-note { margin-top: 14px; text-align: center; font-size: 12px; color: #8a8272; }
/* celebration toast */
#mhr-toast {
  position: fixed; left: 50%; bottom: 110px; transform: translateX(-50%) scale(.7);
  z-index: 100003; background: #fffdf9; border: 3px solid #ffb300; border-radius: 18px;
  padding: 12px 20px; font-family: inherit; font-size: 17px; font-weight: 900; color: #1f2a4a;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); opacity: 0; pointer-events: none;
  transition: opacity .25s, transform .25s; text-align: center; max-width: 86vw;
}
#mhr-toast.mhr-show { opacity: 1; transform: translateX(-50%) scale(1); }
#mhr-toast .mhr-tbig { font-size: 30px; display: block; }
#mhr-confetti { position: fixed; inset: 0; z-index: 100001; pointer-events: none; overflow: hidden; }
#mhr-confetti span {
  position: absolute; top: -16px; width: 10px; height: 16px; border-radius: 2px;
  animation: mhr-fall linear forwards;
}
@keyframes mhr-fall { to { transform: translateY(108vh) rotate(720deg); } }
/* mini game */
#mhr-game {
  position: fixed; inset: 0; z-index: 100004; display: none;
  background: linear-gradient(180deg, #2b3a6b, #38508e);
  font-family: inherit; color: #fff; overflow: hidden;
}
#mhr-game.mhr-show { display: block; }
#mhr-game .mhr-gtop { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; padding: 14px 16px; font-size: 18px; font-weight: 900; z-index: 3; }
#mhr-game .mhr-gstar { position: absolute; font-size: 34px; cursor: pointer; user-select: none; animation: mhr-gfall linear forwards; touch-action: none; }
@keyframes mhr-gfall { to { transform: translateY(112vh) rotate(200deg); } }
#mhr-game .mhr-gcenter { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; text-align: center; padding: 20px; z-index: 2; }
#mhr-game .mhr-gcenter h2 { margin: 0; font-size: 26px; }
#mhr-game .mhr-gbtn { border: none; border-radius: 999px; padding: 13px 26px; font: inherit; font-size: 17px; font-weight: 900; background: linear-gradient(135deg, #ffb300, #ff8f00); color: #3d2800; cursor: pointer; }
#mhr-game .mhr-gbtn.ghost { background: #fff; color: #1f2a4a; }
/* certificate */
#mhr-cert { position: fixed; inset: 0; z-index: 100004; display: none; align-items: center; justify-content: center; background: rgba(31,42,74,.5); font-family: inherit; }
#mhr-cert.mhr-show { display: flex; }
#mhr-cert .mhr-cwrap { background: #f4efec; border-radius: 20px; padding: 14px; width: min(94vw, 460px); max-height: 92vh; overflow-y: auto; }
.mhr-cpaper {
  background: #fffdf6; border: 5px double #d98a1f; border-radius: 14px; padding: 22px 16px; text-align: center; color: #1f2a4a;
}
.mhr-cpaper .mhr-cstars { font-size: 22px; letter-spacing: 6px; color: #ffb300; }
.mhr-cpaper h2 { margin: 6px 0 2px; font-size: 23px; color: #d98a1f; }
.mhr-cpaper .mhr-csub { font-size: 13px; color: #5a6486; }
.mhr-cpaper .mhr-cname { font-size: 27px; font-weight: 900; margin: 14px 0 6px; color: #38508e; border-bottom: 2px dashed #c8cee3; display: inline-block; padding: 0 18px 4px; min-width: 160px; }
.mhr-cpaper .mhr-ctext { font-size: 14px; line-height: 1.6; }
.mhr-cpaper .mhr-cseal { font-size: 40px; margin-top: 10px; }
.mhr-cpaper .mhr-cdate { font-size: 12px; color: #8a8272; margin-top: 8px; }
#mhr-cert input {
  width: 100%; box-sizing: border-box; margin-top: 10px; padding: 12px; font: inherit; font-size: 17px;
  border: 2px solid #c8cee3; border-radius: 12px; text-align: center;
}
#mhr-cert .mhr-cbtns { display: flex; gap: 8px; margin-top: 10px; }
#mhr-cert .mhr-cbtns button { flex: 1; border: none; border-radius: 12px; padding: 12px; font: inherit; font-size: 15px; font-weight: 800; cursor: pointer; background: linear-gradient(135deg, #ffb300, #ff8f00); color: #3d2800; }
#mhr-cert .mhr-cbtns button.ghost { background: #fff; border: 2px solid #c8cee3; color: #1f2a4a; }
@media print {
  body > * { display: none !important; }
  body.mhr-printing #mhr-cert-print { display: block !important; position: absolute; inset: 0; }
  #mhr-cert-print { display: none; }
  body.mhr-printing #mhr-cert-print .mhr-cpaper { border-radius: 0; height: 100%; }
}
#mhr-cert-print { display: none; }
.mhr-bump { animation: mhr-bump .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes mhr-bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
.mhr-bal small { font-size: 12px; font-weight: 700; color: #5a6486; }
