/* Gematrixx V36 — final, isolated Gematria result-card guard.
   Scope: result grids only. No calculation/history/match/table logic is touched. */

/* Keep all Gematria result grids as compact, centered fixed-size card grids. */
#pageGematriaAR #resultsGrid,
#pageGematriaEN #geoResultsGrid,
#pageHebrewGematria #hebResultsGrid,
#pageGreekGematria #grkResultsGrid,
#pageSlavicGematria #slvResultsGrid{
  --gmx-gem-card-w:154px;
  display:grid!important;
  width:max-content!important;
  max-width:100%!important;
  margin:1rem auto 0!important;
  padding:0!important;
  gap:.72rem!important;
  align-items:stretch!important;
  justify-content:center!important;
  background:transparent!important;
  border:0!important;
  border-radius:0!important;
  box-sizing:border-box!important;
}

#pageGematriaAR #resultsGrid{
  grid-template-columns:repeat(var(--ar-result-cols,6),var(--gmx-gem-card-w))!important;
}
#pageGematriaEN #geoResultsGrid,
#pageHebrewGematria #hebResultsGrid,
#pageGreekGematria #grkResultsGrid,
#pageSlavicGematria #slvResultsGrid{
  grid-template-columns:repeat(var(--gem-effective-cols,var(--gem-result-cols,6)),var(--gmx-gem-card-w))!important;
}

/* Restore the actual small card surface. */
#pageGematriaAR #resultsGrid > .ar-quran-result-card,
#pageGematriaEN #geoResultsGrid > .gem-quran-result-card,
#pageHebrewGematria #hebResultsGrid > .gem-quran-result-card,
#pageGreekGematria #grkResultsGrid > .gem-quran-result-card,
#pageSlavicGematria #slvResultsGrid > .gem-quran-result-card{
  width:var(--gmx-gem-card-w)!important;
  min-width:var(--gmx-gem-card-w)!important;
  max-width:var(--gmx-gem-card-w)!important;
  min-height:106px!important;
  box-sizing:border-box!important;
  position:relative!important;
  overflow:hidden!important;
  display:flex!important;
  flex-direction:column!important;
  align-items:center!important;
  justify-content:center!important;
  gap:.22rem!important;
  padding:.78rem .55rem .68rem!important;
  background:var(--bg3,#0a0c10)!important;
  border:1px solid var(--bdr,var(--border,#fff))!important;
  border-radius:10px!important;
  text-align:center!important;
  box-shadow:0 4px 14px rgba(0,0,0,.12)!important;
  transform:none;
  transition:border-color .15s ease,transform .12s ease,background .15s ease!important;
}

/* Category/cipher accent line. */
#pageGematriaAR #resultsGrid > .ar-quran-result-card::before,
#pageGematriaEN #geoResultsGrid > .gem-quran-result-card::before,
#pageHebrewGematria #hebResultsGrid > .gem-quran-result-card::before,
#pageGreekGematria #grkResultsGrid > .gem-quran-result-card::before,
#pageSlavicGematria #slvResultsGrid > .gem-quran-result-card::before{
  content:""!important;
  position:absolute!important;
  top:0!important;
  right:0!important;
  left:0!important;
  height:2px!important;
  opacity:.96!important;
  pointer-events:none!important;
}
#pageGematriaAR #resultsGrid > .ar-quran-result-card::before{
  background:var(--ar-card-color,var(--accent,var(--gold2,#e8c96a)))!important;
}
#pageGematriaEN #geoResultsGrid > .gem-quran-result-card::before,
#pageHebrewGematria #hebResultsGrid > .gem-quran-result-card::before,
#pageGreekGematria #grkResultsGrid > .gem-quran-result-card::before,
#pageSlavicGematria #slvResultsGrid > .gem-quran-result-card::before{
  background:var(--gem-card-color,var(--gold2,#e8c96a))!important;
}

#pageGematriaAR #resultsGrid > .ar-quran-result-card:hover,
#pageGematriaEN #geoResultsGrid > .gem-quran-result-card:hover,
#pageHebrewGematria #hebResultsGrid > .gem-quran-result-card:hover,
#pageGreekGematria #grkResultsGrid > .gem-quran-result-card:hover,
#pageSlavicGematria #slvResultsGrid > .gem-quran-result-card:hover{
  transform:translateY(-1px)!important;
  background:var(--bg4,var(--bg3,#0a0c10))!important;
}

/* Name/value/root rhythm, identical across languages. */
#pageGematriaAR #resultsGrid .ar-quran-result-card .rc-name,
#pageGematriaEN #geoResultsGrid .gem-quran-result-card .gl,
#pageHebrewGematria #hebResultsGrid .gem-quran-result-card .gl,
#pageGreekGematria #grkResultsGrid .gem-quran-result-card .gl,
#pageSlavicGematria #slvResultsGrid .gem-quran-result-card .gl{
  order:1!important;
  min-height:2.7em!important;
  margin:0 0 .06rem!important;
  padding:0!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  color:var(--gold2,var(--gold-glow,#e8c96a))!important;
  font-family:var(--font-main)!important;
  font-size:.72rem!important;
  font-weight:700!important;
  line-height:1.38!important;
  letter-spacing:0!important;
  text-transform:none!important;
  white-space:normal!important;
  word-break:normal!important;
  overflow-wrap:anywhere!important;
  text-align:center!important;
}

#pageGematriaAR #resultsGrid .ar-quran-result-card .rc-val,
#pageGematriaEN #geoResultsGrid .gem-quran-result-card .gv,
#pageHebrewGematria #hebResultsGrid .gem-quran-result-card .gv,
#pageGreekGematria #grkResultsGrid .gem-quran-result-card .gv,
#pageSlavicGematria #slvResultsGrid .gem-quran-result-card .gv{
  order:2!important;
  margin:.02rem 0 0!important;
  padding:0!important;
  font-family:"Ubuntu Mono",var(--font-main),monospace!important;
  font-size:1.4rem!important;
  font-weight:800!important;
  line-height:1.1!important;
  direction:ltr!important;
  unicode-bidi:isolate!important;
}

#pageGematriaAR #resultsGrid .ar-quran-result-card .rc-dr,
#pageGematriaEN #geoResultsGrid .gem-quran-result-card .gen-dr,
#pageHebrewGematria #hebResultsGrid .gem-quran-result-card .gen-dr,
#pageGreekGematria #grkResultsGrid .gem-quran-result-card .gen-dr,
#pageSlavicGematria #slvResultsGrid .gem-quran-result-card .gen-dr{
  order:3!important;
  margin:.12rem 0 0!important;
  color:var(--txt3,var(--text-muted,#c9a84c))!important;
  font-family:var(--font-main)!important;
  font-size:.64rem!important;
  line-height:1.25!important;
}

/* Open cipher letter table still spans the whole result row. */
#pageGematriaEN #geoResultsGrid > .geo-inline-table-wrap,
#pageHebrewGematria #hebResultsGrid > .geo-inline-table-wrap,
#pageGreekGematria #grkResultsGrid > .geo-inline-table-wrap,
#pageSlavicGematria #slvResultsGrid > .geo-inline-table-wrap{
  grid-column:1 / -1!important;
  width:100%!important;
}

/* Light mode: keep cards clearly distinct without harsh black borders. */
html[data-theme="light"] #pageGematriaAR #resultsGrid > .ar-quran-result-card,
html[data-theme="light"] #pageGematriaEN #geoResultsGrid > .gem-quran-result-card,
html[data-theme="light"] #pageHebrewGematria #hebResultsGrid > .gem-quran-result-card,
html[data-theme="light"] #pageGreekGematria #grkResultsGrid > .gem-quran-result-card,
html[data-theme="light"] #pageSlavicGematria #slvResultsGrid > .gem-quran-result-card{
  background:#fffdf8!important;
  border-color:rgba(74,58,25,.42)!important;
  box-shadow:0 4px 14px rgba(73,57,22,.08)!important;
}
html[data-theme="light"] #pageGematriaAR #resultsGrid .ar-quran-result-card .rc-val,
html[data-theme="light"] #pageGematriaEN #geoResultsGrid .gem-quran-result-card .gv,
html[data-theme="light"] #pageHebrewGematria #hebResultsGrid .gem-quran-result-card .gv,
html[data-theme="light"] #pageGreekGematria #grkResultsGrid .gem-quran-result-card .gv,
html[data-theme="light"] #pageSlavicGematria #slvResultsGrid .gem-quran-result-card .gv{
  filter:brightness(.72) saturate(1.08);
}

/* Responsive: compact cards, never giant cards on mobile. */
@media(max-width:1050px){
  #pageGematriaAR #resultsGrid,
  #pageGematriaEN #geoResultsGrid,
  #pageHebrewGematria #hebResultsGrid,
  #pageGreekGematria #grkResultsGrid,
  #pageSlavicGematria #slvResultsGrid{
    grid-template-columns:repeat(4,var(--gmx-gem-card-w))!important;
    gap:.6rem!important;
  }
}
@media(max-width:720px){
  #pageGematriaAR #resultsGrid,
  #pageGematriaEN #geoResultsGrid,
  #pageHebrewGematria #hebResultsGrid,
  #pageGreekGematria #grkResultsGrid,
  #pageSlavicGematria #slvResultsGrid{
    grid-template-columns:repeat(3,var(--gmx-gem-card-w))!important;
    gap:.52rem!important;
  }
  #pageGematriaAR #resultsGrid > .ar-quran-result-card,
  #pageGematriaEN #geoResultsGrid > .gem-quran-result-card,
  #pageHebrewGematria #hebResultsGrid > .gem-quran-result-card,
  #pageGreekGematria #grkResultsGrid > .gem-quran-result-card,
  #pageSlavicGematria #slvResultsGrid > .gem-quran-result-card{
    min-height:100px!important;
    padding:.7rem .46rem .62rem!important;
  }
}
@media(max-width:500px){
  #pageGematriaAR #resultsGrid,
  #pageGematriaEN #geoResultsGrid,
  #pageHebrewGematria #hebResultsGrid,
  #pageGreekGematria #grkResultsGrid,
  #pageSlavicGematria #slvResultsGrid{
    --gmx-gem-card-w:min(154px,calc((100vw - 2.3rem)/2));
    grid-template-columns:repeat(2,var(--gmx-gem-card-w))!important;
    gap:.5rem!important;
  }
  #pageGematriaAR #resultsGrid > .ar-quran-result-card,
  #pageGematriaEN #geoResultsGrid > .gem-quran-result-card,
  #pageHebrewGematria #hebResultsGrid > .gem-quran-result-card,
  #pageGreekGematria #grkResultsGrid > .gem-quran-result-card,
  #pageSlavicGematria #slvResultsGrid > .gem-quran-result-card{
    min-height:96px!important;
  }
  #pageGematriaAR #resultsGrid .ar-quran-result-card .rc-name,
  #pageGematriaEN #geoResultsGrid .gem-quran-result-card .gl,
  #pageHebrewGematria #hebResultsGrid .gem-quran-result-card .gl,
  #pageGreekGematria #grkResultsGrid .gem-quran-result-card .gl,
  #pageSlavicGematria #slvResultsGrid .gem-quran-result-card .gl{
    font-size:.68rem!important;
  }
  #pageGematriaAR #resultsGrid .ar-quran-result-card .rc-val,
  #pageGematriaEN #geoResultsGrid .gem-quran-result-card .gv,
  #pageHebrewGematria #hebResultsGrid .gem-quran-result-card .gv,
  #pageGreekGematria #grkResultsGrid .gem-quran-result-card .gv,
  #pageSlavicGematria #slvResultsGrid .gem-quran-result-card .gv{
    font-size:1.28rem!important;
  }
}
