/* Gamify Addon (GMX) — scoped and toggleable
   - ON: adds html.gmx-on class and renders HUD
   - OFF: no layout changes; only a small toggle button is present
*/

:root{
  --gmx-bg: rgba(8, 12, 18, 0.82);
  --gmx-line: rgba(120, 255, 200, 0.25);
  --gmx-neon: rgba(120, 255, 200, 0.95);
  --gmx-neon2: rgba(110, 190, 255, 0.95);
  --gmx-gold: rgba(255, 215, 80, 0.95);
  --gmx-text: rgba(240, 255, 248, 0.95);
  --gmx-muted: rgba(190, 220, 205, 0.85);
  --gmx-radius: 16px;
  --gmx-shadow: 0 16px 40px rgba(0,0,0,0.35);
  --gmx-font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
}

#gmxToggleBtn{
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 999999;
  border: 1px solid rgba(110,190,255,.35);
  background: linear-gradient(180deg, rgba(15,22,30,.86), rgba(10,14,20,.86));
  color: var(--gmx-text);
  font-family: var(--gmx-font);
  padding: 10px 12px;
  border-radius: 14px;
  box-shadow: var(--gmx-shadow);
  cursor: pointer;
  user-select: none;
  display:flex;
  align-items:center;
  gap:10px;
}
#gmxToggleBtn:hover{ transform: translateY(-1px); }
#gmxToggleBtn .dot{
  width:10px; height:10px; border-radius:50%;
  background: rgba(255,90,110,.9);
  box-shadow: 0 0 10px rgba(255,90,110,.35);
}
html.gmx-on #gmxToggleBtn .dot{
  background: rgba(120,255,200,.95);
  box-shadow: 0 0 14px rgba(120,255,200,.35);
}

html.gmx-on #gmxHud{
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: min(420px, calc(100vw - 48px));
  z-index: 999998;
  border-radius: var(--gmx-radius);
  border: 1px solid var(--gmx-line);
  background: var(--gmx-bg);
  box-shadow: var(--gmx-shadow);
  font-family: var(--gmx-font);
  color: var(--gmx-text);
  overflow: hidden;
  backdrop-filter: blur(8px);
}

#gmxHud .top{
  padding: 12px 12px 10px 28px;
  border-bottom: 1px solid rgba(110,190,255,.15);
  position: relative;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
#gmxHud .top:before{
  content:"⋮⋮";
  position:absolute;
  left:12px;
  top:12px;
  letter-spacing:2px;
  opacity:.75;
  color: var(--gmx-neon2);
  text-shadow: 0 0 10px rgba(110,190,255,.35);
}
.gmx-on #gmxHud.gmx-dragging .top{ cursor: grabbing; }

#gmxHud .title{
  font-weight: 900;
  letter-spacing: 1px;
  font-size: 12px;
  color: rgba(240,255,248,.92);
  text-shadow: 0 0 14px rgba(120,255,200,.22);
}
#gmxHud .marquee{
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  color: var(--gmx-muted);
  font-size: 12px;
}
#gmxHud .marquee > div{
  display: inline-block;
  padding-left: 100%;
  animation: gmxMarquee 10s linear infinite;
}
@keyframes gmxMarquee{
  0%{ transform: translateX(0); }
  100%{ transform: translateX(-100%); }
}

/* Stats row */
#gmxHud .stats{
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px 12px 12px 12px;
}
#gmxHud .card{
  border-radius: 14px;
  border: 1px solid rgba(120,255,200,.18);
  background: rgba(0,0,0,.25);
  padding: 10px;
}
#gmxHud .label{
  font-size: 11px;
  color: var(--gmx-muted);
}
#gmxHud .value{
  margin-top: 4px;
  font-weight: 900;
  letter-spacing: .3px;
  font-size: 16px;
}

/* XP bar */
#gmxHud .xpWrap{
  padding: 0 12px 12px 12px;
}
#gmxHud .xpBar{
  height: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(110,190,255,.15);
  overflow: hidden;
}
#gmxHud .xpFill{
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, rgba(120,255,200,.95), rgba(110,190,255,.95));
  box-shadow: 0 0 18px rgba(120,255,200,.2);
  transition: width 420ms cubic-bezier(.2,.9,.2,1);
}
#gmxHud .xpMeta{
  margin-top: 6px;
  display:flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--gmx-muted);
}
#gmxHud .hudBtns{
  margin-top:10px;
  display:flex;
  gap:8px;
  justify-content:flex-end;
}
#gmxHud .hudBtns button{
  border:1px solid rgba(110,190,255,.25);
  background:rgba(0,0,0,.25);
  color:rgba(240,255,248,.95);
  border-radius:12px;
  padding:8px 10px;
  cursor:pointer;
}
#gmxHud .hudBtns button.danger{
  border-color: rgba(255,90,110,.25);
}

/* Toast */
#gmxToast{
  position: fixed;
  left: 18px;
  bottom: 160px;
  z-index: 999999;
  width: min(380px, calc(100vw - 48px));
  border-radius: 14px;
  border: 1px solid rgba(255,215,80,.25);
  background: rgba(15,18,22,.88);
  color: var(--gmx-text);
  box-shadow: var(--gmx-shadow);
  font-family: var(--gmx-font);
  padding: 12px 12px;
  transform: translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}
html.gmx-toast-on #gmxToast{
  opacity: 1;
  transform: translateY(0);
}
#gmxToast b{ color: var(--gmx-gold); }

/* Optional highlight effect on answered check blocks */
html.gmx-on .gmx-task-done{
  outline: 2px solid rgba(120,255,200,.35);
  box-shadow: 0 0 0 2px rgba(120,255,200,.12), 0 0 24px rgba(120,255,200,.10);
  border-radius: 10px;
}

@media (prefers-reduced-motion: reduce){
  #gmxHud .marquee > div{ animation: none; padding-left: 0; }
  #gmxHud .xpFill{ transition: none; }
  #gmxToast{ transition: none; }
}
/* HUD buttons (now themeable because we removed inline styles) */
#gmxHud .gmxBtn{
  border: 1px solid rgba(110,190,255,.25);
  background: rgba(0,0,0,.25);
  color: var(--gmx-text);
  border-radius: 12px;
  padding: 8px 10px;
  cursor: pointer;
}
#gmxHud .gmxBtn:hover{ transform: translateY(-1px); }
#gmxHud .gmxBtn:active{ transform: scale(.99); }

#gmxHud .gmxBtnPrimary{
  border-color: rgba(110,190,255,.35);
  box-shadow: 0 0 0 1px rgba(110,190,255,.10);
}
#gmxHud .gmxBtnDanger{
  border-color: rgba(255,90,110,.35);
  box-shadow: 0 0 0 1px rgba(255,90,110,.10);
}

/* --------------------------------------------
   Theme overrides (match your theme classes)
   Works if your app toggles theme-* on <html> or <body>
-------------------------------------------- */

html.theme-sunrise, body.theme-sunrise{
  --gmx-bg: rgba(30, 20, 14, 0.80);
  --gmx-line: rgba(255, 190, 110, 0.25);
  --gmx-neon: rgba(255, 170, 90, 0.95);
  --gmx-neon2: rgba(255, 120, 180, 0.95);
  --gmx-muted: rgba(255, 220, 190, 0.85);
}

html.theme-midnight, body.theme-midnight{
  --gmx-bg: rgba(8, 12, 22, 0.86);
  --gmx-line: rgba(110, 190, 255, 0.22);
  --gmx-neon: rgba(90, 200, 255, 0.95);
  --gmx-neon2: rgba(140, 120, 255, 0.95);
  --gmx-muted: rgba(185, 210, 235, 0.85);
}

html.theme-forest, body.theme-forest{
  --gmx-bg: rgba(10, 18, 12, 0.86);
  --gmx-line: rgba(120, 255, 200, 0.22);
  --gmx-neon: rgba(120, 255, 200, 0.95);
  --gmx-neon2: rgba(110, 190, 255, 0.95);
  --gmx-muted: rgba(190, 230, 210, 0.85);
}

html.theme-terminal, body.theme-terminal{
  --gmx-bg: rgba(0, 0, 0, 0.86);
  --gmx-line: rgba(0, 255, 120, 0.22);
  --gmx-neon: rgba(0, 255, 120, 0.95);
  --gmx-neon2: rgba(0, 220, 255, 0.95);
  --gmx-muted: rgba(170, 255, 210, 0.85);
}

html.theme-solarized, body.theme-solarized{
  --gmx-bg: rgba(0, 43, 54, 0.86);
  --gmx-line: rgba(38, 139, 210, 0.22);
  --gmx-neon: rgba(42, 161, 152, 0.95);
  --gmx-neon2: rgba(38, 139, 210, 0.95);
  --gmx-muted: rgba(200, 220, 220, 0.85);
}

html.theme-cardano, body.theme-cardano{
  --gmx-bg: rgba(12, 10, 22, 0.86);
  --gmx-line: rgba(120, 120, 255, 0.25);
  --gmx-neon: rgba(120, 120, 255, 0.95);
  --gmx-neon2: rgba(110, 190, 255, 0.95);
  --gmx-muted: rgba(210, 210, 255, 0.85);
}

