:root{
  --hg-good-bg: rgba(0, 255, 140, .18);
  --hg-good-br: rgba(0, 255, 140, .50);

  --hg-mis-bg: rgba(255, 200, 0, .18); /* yellow */
  --hg-mis-br: rgba(255, 200, 0, .52);

  --hg-bad-bg: rgba(255,255,255,.02);
  --hg-bad-br: rgba(255,255,255,.14);

  /* selection outline (red) */
  --hg-sel-outline: rgba(255, 70, 70, .95);

  --hg-tok-bg: rgba(255,255,255,.03);
  --hg-tok-br: rgba(255,255,255,.14);
}

:root[data-theme="light"]{
  --hg-good-bg: rgba(0, 160, 90, .18);
  --hg-good-br: rgba(0, 160, 90, .44);

  --hg-mis-bg: rgba(200, 150, 0, .20);
  --hg-mis-br: rgba(200, 150, 0, .48);

  --hg-bad-bg: rgba(11,15,20,.03);
  --hg-bad-br: rgba(11,15,20,.14);

  --hg-sel-outline: rgba(220, 40, 40, .95);

  --hg-tok-bg: rgba(11,15,20,.03);
  --hg-tok-br: rgba(11,15,20,.14);
}

/* tighter wrapping */
header.wrap { padding-bottom: 6px; }
main.wrap { padding-top: 6px; }

.card.hgCard{ padding: 10px 10px 12px; }

.hgTopRow{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap:10px;
  margin-bottom: 8px;
}

.hgMeta{ display:flex; flex-direction:column; gap:2px; }
.hgDate{ font-size: 13px; opacity: .9; }
.hgRule{ font-size: 12px; opacity: .7; }

.hgSolvedBox{
  text-align:right;
  display:flex;
  flex-direction:column;
  gap:4px;
  align-items:flex-end;
  min-width: 86px;
}
.hgSolvedVal{ font-size: 20px; line-height:1; }

.hgEquations{
  margin-top: 6px;
  margin-bottom: 10px;
  padding: 10px 10px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.02);
}
:root[data-theme="light"] .hgEquations{
  border: 1px solid rgba(11,15,20,.12);
  background: rgba(11,15,20,.02);
}

.hgEqList{
  display:flex;
  flex-direction:column;
  gap: 6px;
}

.hgEq{
  display:flex;
  align-items:center;
  gap: 8px;
  flex-wrap:wrap;
  font-size: 14px;
}

.hgEq .hgSym{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.02);
  font-size: 18px;
  line-height: 1;
}
:root[data-theme="light"] .hgEq .hgSym{
  border: 1px solid rgba(11,15,20,.12);
  background: rgba(11,15,20,.02);
}

.hgEq .hgOp{ opacity:.9; font-weight:700; }
.hgEq .hgNum{ opacity:.95; font-weight:800; }

.hgHint{
  margin-top: 6px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.25;
}

/* board */
.hgBoard{
  margin-top: 6px;
  display:flex;
  flex-direction:column;
  gap:10px;
  align-items:center;
}
.hgRow{
  display:flex;
  justify-content:center;
  width: 100%;
}

.hgStrip{
  display:flex;
  align-items:center;
  justify-content:center;
  flex-wrap:nowrap;
  white-space:nowrap;
  gap: clamp(6px, 1.2vw, 10px);
  width: fit-content;
  max-width: 100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.hgStrip::-webkit-scrollbar{ display:none; }

.hgTok{
  width: clamp(44px, 13vw, 64px);
  height: clamp(52px, 15vw, 76px);
  border-radius: 14px;
  padding: 6px;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 4px;
  border: 1px solid var(--hg-tok-br);
  background: var(--hg-tok-bg);
  user-select:none;
}

.hgTokBtn{
  cursor:pointer;
  padding:0;
}

/* selection = red outline */
.hgTokBtn.hgSel{
  outline: 3px solid var(--hg-sel-outline);
  outline-offset: 2px;
}

/* explicitly kill any old bracket/paren pseudo elements */
.hgTokBtn.hgSel::before,
.hgTokBtn.hgSel::after{
  content: none !important;
}

.hgTok .hgSymBig{
  font-size: clamp(18px, 6vw, 28px);
  line-height: 1;
}
.hgTok .hgVal{
  font-size: 12px;
  line-height: 1;
  font-weight: 900;
}

/* feedback states */
.hgTok.g{ background: var(--hg-good-bg) !important; border-color: var(--hg-good-br) !important; }
.hgTok.y{ background: var(--hg-mis-bg) !important; border-color: var(--hg-mis-br) !important; }
/* "b" is intentionally blank -> no class */

/* keypad */
.hgPad{
  margin-top: 12px;
  display:flex;
  gap:8px;
  justify-content:center;
  flex-wrap:wrap;
}
.hgBtn{
  min-width: 52px;
  height: 40px;
  border-radius: 14px;
  font-size: 16px;
  padding: 0 12px;
}
#enterBtn, #clearBtn{ min-width: 96px; }

@media (max-width:520px){
  .wrap { padding-left: 10px; padding-right: 10px; }
  .card.hgCard { padding: 8px 8px 10px; }
}

@media (max-width:420px){
  .hgPad{ gap:6px; }
  .hgBtn{
    min-width: 48px;
    height: 38px;
    border-radius: 13px;
    padding: 0 10px;
    font-size: 15px;
  }
  #enterBtn, #clearBtn{ min-width: 92px; }
}

.hgMiniRow{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-top:10px;
  font-size: 13px;
}

/* SEO example cards */
.hgExampleGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
@media (max-width:720px){
  .hgExampleGrid{ grid-template-columns: 1fr; }
}
.hgExCard{
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.02);
  border-radius: 14px;
  padding: 10px 12px;
}
:root[data-theme="light"] .hgExCard{
  border: 1px solid rgba(11,15,20,.12);
  background: rgba(11,15,20,.02);
}
.hgExTitle{ font-size: 14px; font-weight: 800; }
.hgExP{ font-size: 13px; line-height: 1.25; }

/* Menu: 2 columns (this page only) */
.menuGrid{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width:520px){
  .menuGrid{ grid-template-columns: 1fr; }
}
.menuCol{ display:flex; flex-direction:column; gap: 8px; }
.menuSectionTitle{
  opacity: .75;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

/* Equations a bit bigger */
@media (min-width: 900px){
  #hgEqList { font-size: 2.00em; }   /* +50% */
}

/* Desktop: make equations ~50% bigger */
@media (min-width: 900px){
  .hgEq{
    font-size: 21px;              /* 14px * 1.5 */
  }

  .hgEq .hgSym{
    min-width: 42px;              /* 28px * 1.5 */
    height: 42px;                 /* 28px * 1.5 */
    border-radius: 14px;
    font-size: 27px;              /* 18px * 1.5 */
  }
}




/* ---------- Help button (top-right) ---------- */
.infoBtn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:36px;
  height:36px;
  border-radius:12px;
  border:1px solid rgba(185,148,47,.65);
  background: rgba(185,148,47,.10);
}
.infoBtn:hover{ background: rgba(185,148,47,.16); }
.iGlyph{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:22px;
  height:22px;
  border-radius:999px;
  border:1px solid rgba(185,148,47,.75);
  color: rgba(255,255,255,.95);
  font-weight:800;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height:1;
}

/* ---------- Help dialog (HieroGlyph) ---------- */
.hgHelpDlg{
  width: min(560px, calc(100% - 24px));
  border: 0;
  padding: 0;
  border-radius: 18px;
  overflow: hidden;
}
.hgHelpDlg::backdrop{
  background: rgba(0,0,0,.55);
}
.hgHelp{
  padding: 14px 14px 12px;
}
.hgHelpScroll{
  max-height: min(62vh, 520px);
  overflow: auto;
  padding-right: 4px;
}
.hgHelpActions{
  display:flex;
  gap:10px;
  justify-content:flex-end;
  flex-wrap:wrap;
  margin-top:12px;
}
.hgHelpBox{
  border:1px solid rgba(255,255,255,.08);
  border-radius:14px;
  padding:12px;
  margin-top:10px;
  background: rgba(255,255,255,.03);
}
.hgHelpKicker{
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
  opacity: .8;
}
.hgHelpList{
  margin: 8px 0 0;
  padding-left: 18px;
}
.hgHelpList li{ margin: 6px 0; }



