/* 🎮 games + rewards tab — every class prefixed .gm- */
.gm-tab { --gm-ink: var(--text); --gm-ok: #2f7d4f; --gm-no: #8a3a32; --gm-soft: #ffffff14; }
body.light .gm-tab { --gm-ink: #1b2a22; --gm-soft: #00000010; }
.gm-tab [hidden] { display: none !important; }

/* fallback Arabic font when QWords.fontClass is not available */
.gm-arfb { font-family: "Traditional Arabic", "Amiri", "Scheherazade New", "Noto Naskh Arabic", serif; }
.gm-ar { direction: rtl; unicode-bidi: isolate; }

/* header card */
.gm-card { background: var(--card); color: var(--gm-ink); border: 1px solid var(--gold); border-radius: 12px; padding: 10px 12px; margin: 2px 0 8px; }
.gm-ctop { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gm-stars { font-size: 24px; font-weight: 700; color: var(--gold); white-space: nowrap; }
.gm-lvl { font-size: 14px; font-weight: 600; text-align: left; }
.gm-bar { height: 9px; background: var(--gm-soft); border-radius: 6px; overflow: hidden; margin: 6px 0 3px; }
.gm-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--gold), #f0d77a); border-radius: 6px; transition: width .4s; }
.gm-fill.gm-done { background: var(--accent); }
.gm-fill.gm-warn { background: #c0553f; }
.gm-small { font-size: 12.5px; color: var(--muted); line-height: 1.6; }
body.light .gm-card .gm-small, body.light .gm-stage .gm-small { color: #5b6e63; }
.gm-goalrow { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.gm-goalrow .gm-small { white-space: nowrap; }
.gm-goalbar { flex: 1; margin: 0; }
.gm-latest { font-size: 13px; margin-top: 6px; }
.gm-cbtns { display: flex; gap: 6px; margin-top: 8px; }
.gm-cbtns > * { flex: 1; font-size: 13px; padding: 4px 6px; }
.gm-mini { font-size: 13px; padding: 4px 10px; }

/* badges */
.gm-badges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin: 0 0 10px; }
.gm-badge { background: var(--card); color: var(--gm-ink); border: 1px dashed #ffffff26; border-radius: 10px; text-align: center; padding: 6px 2px; cursor: pointer; }
body.light .gm-badge { border-color: #00000026; }
.gm-badge:not(.gm-earned) > * { opacity: .45; filter: grayscale(1); }
.gm-badge.gm-earned { border: 1px solid var(--gold); box-shadow: 0 0 0 1px #d4af3740 inset; }
.gm-bicon { font-size: 22px; }
.gm-bname { font-size: 11px; line-height: 1.3; }

/* game picker */
.gm-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 8px 0; }
.gm-pick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 12px; }
.gm-pick .gm-picon { font-size: 24px; }
.gm-pick b { font-size: 14.5px; }
.gm-pick small { font-size: 11.5px; color: var(--muted); }

/* stage */
.gm-stage { background: var(--card); color: var(--gm-ink); border: 1px solid var(--gold); border-radius: 12px; padding: 8px 10px 10px; margin: 6px 0; }
.gm-ghead { display: flex; align-items: center; gap: 8px; }
.gm-ghead b { color: var(--gold); font-size: 15px; }
.gm-score { flex: 1; text-align: center; font-weight: 600; font-size: 14px; }
.gm-x { padding: 2px 10px; }
.gm-ginfo { font-size: 12.5px; color: var(--muted); line-height: 1.6; margin: 4px 0 6px; }
body.light .gm-ginfo { color: #5b6e63; }
.gm-load, .gm-err { text-align: center; padding: 18px 4px; font-size: 15px; }
.gm-err { color: #e08070; }
body.light .gm-err { color: #9b2e20; }
.gm-row { display: flex; gap: 6px; align-items: center; justify-content: center; margin: 8px 0; }
.gm-row.gm-wrap { flex-wrap: wrap; }
.gm-row > button { flex: 1 1 auto; }

/* Quran text flow */
.gm-flow { font-size: 27px; line-height: 2.25; text-align: justify; text-align-last: center; padding: 4px 2px; word-spacing: 2px; color: var(--gm-ink); }
.gm-flow span { display: inline-block; }
.gm-num { font-family: "Segoe UI", Tahoma, sans-serif; font-size: 13px; line-height: 22px; min-width: 24px; height: 24px; padding: 0 3px;
  border: 1.5px solid var(--gold); border-radius: 50%; text-align: center; color: var(--gold); vertical-align: middle; margin: 0 3px; }
.gm-w { padding: 0 1px; }
.gm-fl { min-width: 30px; padding: 0 6px; margin: 2px 0; line-height: 1.75; vertical-align: middle; border-radius: 10px; cursor: pointer;
  background: var(--gm-soft); color: var(--gold); text-align: center; transition: background .15s, color .15s; }
.gm-fl:hover { background: #d4af3733; }
.gm-fl.gm-open { background: transparent; color: var(--gm-ink); }
.gm-fl.gm-bad, .gm-blank.gm-bad { background: #8a3a3233; color: #e06a55; border-radius: 8px; }
body.light .gm-fl.gm-bad, body.light .gm-blank.gm-bad { color: #9b2e20; }
/* light theme: gold #d4af37 on the cream card is only ~1.9:1 -> dark gold (~6.5:1) */
body.light .gm-fl:not(.gm-open):not(.gm-bad) { color: #6b5208; background: #00000014; }
body.light .gm-fl:not(.gm-open):not(.gm-bad):hover { background: #d4af3740; }
body.light .gm-num { color: #6b5208; border-color: #8a6a0c; }
body.light .gm-stars, body.light .gm-ghead b, body.light .gm-streak, body.light .gm-rh, body.light .gm-rstar { color: #6b5208; }
.gm-blank { border-bottom: 2.5px dashed var(--gold); min-width: 46px; cursor: pointer; border-radius: 6px; padding: 0 4px; line-height: 1.75; vertical-align: middle; }
.gm-blank.gm-act { background: #d4af372e; outline: 2px solid var(--gold); }
.gm-blank.gm-good { border-bottom: 2.5px solid var(--accent); color: var(--accent); }
body.light .gm-blank.gm-good { color: #1f6b3f; }
.gm-nshow { min-height: 64px; }

/* options */
.gm-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 8px 0 4px; }
.gm-opts.gm-long { grid-template-columns: 1fr; }
.gm-opt { position: relative; font-size: 23px; line-height: 1.8; padding: 4px 26px 4px 8px; min-height: 52px; border-radius: 10px; direction: rtl; }
.gm-opts.gm-long .gm-opt { font-size: 20px; text-align: right; }
.gm-k { position: absolute; top: 4px; right: 7px; font-family: "Segoe UI", Tahoma, sans-serif; font-size: 11px; color: var(--muted); }
.gm-opt.gm-ok, .gm-ocard.gm-ok { background: var(--gm-ok) !important; border-color: #8fe0b0; }
.gm-opt.gm-no, .gm-ocard.gm-no { background: var(--gm-no) !important; }
.gm-opt:disabled { cursor: default; }
.gm-opt:disabled:not(.gm-ok):not(.gm-no) { opacity: .6; }
.gm-shake { animation: gm-shake .35s; }
@keyframes gm-shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.gm-streak { text-align: center; color: var(--gold); font-weight: 700; min-height: 20px; }
.gm-timer { height: 7px; }

/* order game */
.gm-olist { margin: 4px 0 8px; }
.gm-orow { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-bottom: 1px solid var(--gm-soft); font-size: 21px; line-height: 1.9; }
.gm-cards { display: flex; flex-direction: column; gap: 7px; }
.gm-ocard { font-size: 21px; line-height: 1.9; text-align: right; padding: 6px 10px; border-radius: 10px; direction: rtl; }

/* continuation */
.gm-qbox { text-align: center; border-bottom: 1px solid var(--gm-soft); padding-bottom: 6px; }
.gm-qtext { font-size: 25px; line-height: 2.1; margin: 4px 0; color: var(--gm-ink); }

/* word by word */
.gm-wbw .gm-ww { cursor: pointer; padding: 0 4px; border-radius: 8px; transition: background .15s; }
.gm-wbw .gm-ww:hover { background: #d4af3726; }
.gm-ww.gm-weak { text-decoration: underline wavy #d0644f 1.5px; text-underline-offset: 9px; }
.gm-ww.gm-play { background: #d4af3755; color: var(--gold); }
body.light .gm-ww.gm-play { color: #6b5208; }
.gm-ww.gm-say { background: #3fa36b55; outline: 2px dashed var(--accent); }
.gm-ww.gm-done { color: var(--accent); }
body.light .gm-ww.gm-done { color: #1f6b3f; }

/* result */
.gm-result { text-align: center; background: var(--gm-soft); border-radius: 10px; padding: 10px; margin: 4px 0 10px; }
.gm-rh { font-size: 20px; font-weight: 700; color: var(--gold); }
.gm-rh2 { font-weight: 700; text-align: center; margin: 6px 0; }
.gm-rs { font-size: 15px; margin: 4px 0; }
.gm-rstar { font-size: 22px; font-weight: 700; color: var(--gold); margin: 4px 0; }
.gm-rbtns { display: flex; gap: 8px; margin-top: 6px; }
.gm-rbtns button { flex: 1; }
.gm-grade { margin-top: 6px; }

/* celebration overlay (appended to <body>, so not inside .gm-tab) */
.gm-cele { position: fixed; inset: 0; z-index: 60; pointer-events: none; display: flex; align-items: center; justify-content: center;
  animation: gm-fadein .25s ease-out; transition: opacity .45s; }
.gm-cele.gm-out { opacity: 0; }
.gm-cele-cv { position: absolute; inset: 0; width: 100%; height: 100%; }
.gm-cele-box { position: relative; direction: rtl; text-align: center; max-width: 86vw; background: #0b1612e6; border: 2px solid var(--gold, #d4af37);
  border-radius: 18px; padding: 16px 34px; box-shadow: 0 10px 40px #0008; animation: gm-pop .45s cubic-bezier(.2, 1.6, .5, 1); }
.gm-cele-h { font-family: "Traditional Arabic", "Amiri", "Segoe UI", serif; font-size: 44px; color: var(--gold, #d4af37); line-height: 1.5; }
.gm-cele-s { font-size: 17px; color: #f1ead2; margin-top: 2px; }
@keyframes gm-pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes gm-fadein { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .gm-cele, .gm-cele-box, .gm-shake { animation: none; } }
