/* =========================================
   Games hub styling (pairs with style-test.css)
   ========================================= */

.gamesPage{
  --bg: var(--gv-bg, #0b0f14);
  --card: rgba(255,255,255,.05);
  --card2: rgba(255,255,255,.035);
  --text: rgba(235,245,255,.95);
  --muted: rgba(180,200,220,.72);
  --line: rgba(160,190,220,.18);
  --shadow: 0 18px 60px rgba(0,0,0,.35);
}

html[data-theme="light"] .gamesPage{
  --bg: #f6f7fb;
  --card: rgba(0,0,0,.04);
  --card2: rgba(0,0,0,.03);
  --text: rgba(20,26,34,.92);
  --muted: rgba(60,78,96,.70);
  --line: rgba(30,50,70,.14);
  --shadow: 0 18px 55px rgba(0,0,0,.10);
}

.gamesPage{
  background: var(--bg);
  color: var(--text);
}

.wrap{
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}

a{ color: inherit; text-decoration: none; }

.iconbtn{
  border: 1px solid var(--line);
  background: var(--card2);
  color: inherit;
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.iconbtn:hover{
  background: var(--card);
  border-color: rgba(160,190,220,.28);
}

.hambars{ font-size: 18px; line-height: 1; }

/* =========================================
   Top bar
   ========================================= */

.gamesTop{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 10px;
}

.brandlink{
  display:flex;
  align-items:center;
  gap: 10px;
}

.brandMark{
  display:block;
  border-radius: 10px;
}

.brandName{
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .2px;
}

.gamesTopRight{
  display:flex;
  align-items:center;
  gap: 10px;
}

.gamesSearchWrap{
  display:flex;
  align-items:center;
  gap: 10px;
  min-width: 0;
}

.gamesSearch{
  border: 1px solid var(--line);
  background: var(--card2);
  border-radius: 999px;
  padding: 8px 10px;
  min-width: 200px;
  max-width: 360px;
}

.gamesSearch input{
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: inherit;
  font-size: 14px;
}

.countPill{
  border: 1px solid var(--line);
  background: var(--card2);
  padding: 8px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 13px;
  min-width: 42px;
  text-align: center;
}

/* =========================================
   Hero
   ========================================= */

.gamesHero{
  margin-top: 8px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);

  display:grid;
  grid-template-columns: 1.25fr .9fr;
  gap: 14px;
  align-items:center;
  overflow: hidden;
}

.heroKicker{
  display:inline-block;
  font-weight: 800;
  letter-spacing: .3px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.heroTitle{
  margin: 10px 0 8px;
  font-size: 28px;
  line-height: 1.12;
  letter-spacing: .1px;
}

.heroSub{
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.35;
}

.heroCtas{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btnPrimary, .btnGhost{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 800;
  border: 1px solid var(--line);
}

.btnPrimary{
  background: rgba(74,160,255,.18);
  border-color: rgba(74,160,255,.40);
}

.btnPrimary:hover{ background: rgba(74,160,255,.24); }

.btnGhost{
  background: var(--card2);
}

.btnGhost:hover{ background: var(--card); }

.heroArt img{
  width: 100%;
  height: auto;
  display:block;
  opacity: .95;
}

@media (max-width: 860px){
  .gamesHero{ grid-template-columns: 1fr; }
  .heroArt{ order: -1; }
}

/* =========================================
   Mode tiles
   ========================================= */

.modeGrid{
  margin: 14px 0 12px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.modeTile{
  border: 1px solid var(--line);
  background: var(--card2);
  border-radius: 16px;
  padding: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,.12);
}

.modeTile::before{
  content:"";
  position:absolute;
  inset:-2px;
  background: radial-gradient(600px 200px at 20% 0%,
    rgba(var(--acc), .26),
    transparent 55%);
  pointer-events:none;
}

.modeRow{ position: relative; z-index: 1; }

.modeTitle{
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: .1px;
}

.modeSub{
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.modeTile:hover{
  background: var(--card);
  border-color: rgba(160,190,220,.28);
}

@media (max-width: 820px){
  .modeGrid{ grid-template-columns: 1fr; }
}

/* =========================================
   Filters / chips — nicer + mobile wrap
   ========================================= */

.filters{
  margin: 14px 0 10px;
  display: grid;
  gap: 10px;
}

/* wrap, never sideways overflow */
.chipRow{
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.chipBtn{
  --chip: 170,180,190;

  appearance: none;
  border: 1px solid rgba(140,160,180,.35);
  background: rgba(255,255,255,.04);
  color: inherit;

  border-radius: 999px;
  padding: 10px 12px;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  font-weight: 750;
  letter-spacing: .1px;
  line-height: 1;
  white-space: nowrap;

  cursor: pointer;
  user-select: none;

  transition: transform .06s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.chipBtn:hover{
  background: rgba(255,255,255,.07);
  border-color: rgba(160,180,200,.45);
}

.chipBtn:active{ transform: translateY(1px); }

.chipBtn:focus-visible{
  outline: 2px solid rgba(120,170,255,.55);
  outline-offset: 2px;
}

.chipBtn .dot{
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(155,176,196,.55);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}

/* Active */
.chipBtn[data-active]{
  background: rgba(var(--chip), .14);
  border-color: rgba(var(--chip), .55);
  box-shadow: 0 0 0 3px rgba(var(--chip), .10);
}

.chipBtn[data-active] .dot{
  background: rgba(var(--chip), .95);
  box-shadow: 0 0 0 3px rgba(var(--chip), .14);
}

/* Color mapping (mode) */
.chipBtn[data-kind="mode"][data-val="daily"]{  --chip: 74,160,255; }
.chipBtn[data-kind="mode"][data-val="quick"]{  --chip: 46,200,140; }
.chipBtn[data-kind="mode"][data-val="skills"]{ --chip: 255,120,130; }

/* Color mapping (type) */
.chipBtn[data-kind="type"][data-val="number"]{ --chip: 74,160,255; }
.chipBtn[data-kind="type"][data-val="logic"]{  --chip: 90,210,140; }
.chipBtn[data-kind="type"][data-val="word"]{   --chip: 170,120,255; }
.chipBtn[data-kind="type"][data-val="spatial"]{--chip: 110,170,255; }
.chipBtn[data-kind="type"][data-val="memory"]{ --chip: 180,140,255; }
.chipBtn[data-kind="type"][data-val="focus"]{  --chip: 140,210,140; }
.chipBtn[data-kind="type"][data-val="decode"]{ --chip: 216,177,90; }

/* Mobile: slightly tighter pills */
@media (max-width: 520px){
  .gamesSearch{ min-width: 160px; max-width: 240px; }
  .chipBtn{ padding: 9px 11px; font-size: 13px; }
}

/* =========================================
   Game grid / tiles
   ========================================= */

.gameGrid{
  margin-top: 12px;
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 980px){
  .gameGrid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 620px){
  .gameGrid{ grid-template-columns: 1fr; }
}

.gameTile{
  border: 1px solid var(--line);
  background: var(--card2);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 35px rgba(0,0,0,.14);
  transition: transform .10s ease, border-color .18s ease, background .18s ease;
}

.gameTile:hover{
  transform: translateY(-1px);
  background: var(--card);
  border-color: rgba(160,190,220,.28);
}

.shot{
  position: relative;
  aspect-ratio: 16 / 10;
  background: radial-gradient(800px 200px at 10% 0%,
    rgba(var(--acc), .22), transparent 55%), rgba(255,255,255,.03);
  overflow: hidden;
}

.tileTop{
  position:absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display:flex;
  align-items:center;
  gap: 10px;
  z-index: 2;
}

.tileLogo{
  width: 24px;
  height: 24px;
  display:block;
  filter: drop-shadow(0 10px 18px rgba(0,0,0,.25));
}

.tileName{
  margin: 0;
  font-size: 16px;
  font-weight: 900;
  text-shadow: 0 10px 25px rgba(0,0,0,.30);
}

.shotFallback{
  position:absolute;
  inset: 0;
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction: column;
  gap: 10px;
  color: rgba(255,255,255,.80);
  z-index: 0;
}

html[data-theme="light"] .shotFallback{
  color: rgba(20,26,34,.72);
}

.shotFallbackLogo{
  width: 44px;
  height: 44px;
  opacity: .9;
}

.shotImg{
  position:absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display:block;
  z-index: 1;
}

.tileBody{
  padding: 12px 12px 14px;
}

.tileDesc{
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.35;
  font-size: 14px;
}

.tileTags{
  display:flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag{
  border: 1px solid rgba(160,190,220,.18);
  background: rgba(255,255,255,.04);
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

/* =========================================
   Explainer
   ========================================= */

.explainer{
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--card2);
  border-radius: 18px;
  padding: 16px;
}

.explainerH2{
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 900;
}

.explainerGrid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

@media (max-width: 980px){
  .explainerGrid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 620px){
  .explainerGrid{ grid-template-columns: 1fr; }
}

.exItem{
  border: 1px solid rgba(160,190,220,.14);
  background: rgba(255,255,255,.03);
  border-radius: 14px;
  padding: 12px;
}

.exItem h3{
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 900;
}

.exItem p{
  margin: 0;
  color: var(--muted);
  line-height: 1.35;
  font-size: 13px;
}

/* =========================================
   Footer
   ========================================= */

.footer{
  margin-top: 18px;
  padding-top: 8px;
  padding-bottom: 26px;
  color: var(--muted);
}

.footlinks{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items:center;
}

.sep{ opacity: .7; }

.fineprint{
  margin-top: 8px;
  font-size: 12px;
  opacity: .9;
}

/* Mobile: keep mode tiles on ONE row (horizontal scroll) */
@media (max-width: 820px){
  .modeGrid{
    grid-template-columns: none;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  .modeTile{
    flex: 0 0 auto;
    width: 72vw;          /* one-row, swipe for the rest */
    min-width: 220px;
    scroll-snap-align: start;
  }

  /* nicer scroll (optional) */
  .modeGrid::-webkit-scrollbar{ height: 10px; }
  .modeGrid::-webkit-scrollbar-thumb{
    background: rgba(160,190,220,.25);
    border-radius: 999px;
  }
}

@media (max-width: 420px){
  .modeTile{ width: 78vw; min-width: 200px; }
}


/* Reserve a header strip so tile name/logo never sits on the screenshot UI */
.shot{
  --shotHead: 46px;
  padding-top: var(--shotHead);
}

/* Move screenshot down into the remaining area */
.shotImg{
  top: var(--shotHead);
  height: calc(100% - var(--shotHead));
}

/* Keep fallback in the screenshot area only */
.shotFallback{
  inset: var(--shotHead) 0 0 0;
}

/* Subtle header bar behind the title row */
.shot::after{
  content:"";
  position:absolute;
  left:0; right:0; top:0;
  height: var(--shotHead);
  background: linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,0));
  pointer-events:none;
  z-index: 1;
}
html[data-theme="light"] .shot::after{
  background: linear-gradient(180deg, rgba(0,0,0,.07), rgba(0,0,0,0));
}

/* Keep the title row inside that header strip */
.tileTop{
  top: 10px; /* tweak if you want */
  z-index: 2;
}

/* Optional: cleaner text (since it’s no longer on the screenshot) */
.tileName{ text-shadow: none; }



@media (max-width: 820px){
  .modeGrid{
    grid-template-columns: none;
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
  }
  .modeTile{
    flex: 0 0 auto;
    width: 72vw;
    min-width: 220px;
    scroll-snap-align: start;
  }
}

.shot{ --shotHead: 46px; padding-top: var(--shotHead); }
.shotImg{ top: var(--shotHead); height: calc(100% - var(--shotHead)); }
.shotFallback{ inset: var(--shotHead) 0 0 0; }

.shot::after{
  content:"";
  position:absolute;
  left:0; right:0; top:0;
  height: var(--shotHead);
  background: linear-gradient(180deg, rgba(0,0,0,.18), rgba(0,0,0,0));
  pointer-events:none;
  z-index: 1;
}
html[data-theme="light"] .shot::after{
  background: linear-gradient(180deg, rgba(0,0,0,.07), rgba(0,0,0,0));
}
.tileTop{ z-index: 2; }

/* --- Tile header alignment: make every tileTop identical --- */
.gameTile .shot{
  position: relative;
  overflow: hidden;
}

/* fixed header strip */
.gameTile .tileTop{
  position: absolute;
  left: 0; right: 0; top: 0;
  height: var(--shotHead, 46px);
  display: flex;
  align-items: center;          /* KEY: vertical alignment */
  gap: 10px;
  padding: 10px 12px;
  z-index: 2;
}

/* normalize logo box (SVG whitespace stops mattering) */
.gameTile .tileLogo{
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: block;
  object-fit: contain;
}

/* kill default h3 weirdness + lock baseline */
.gameTile .tileName{
  margin: 0;                    /* KEY: remove h3 default margin */
  line-height: 1;               /* KEY: consistent vertical centering */
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* keep screenshot from sitting under the header strip */
.gameTile .shot{ padding-top: var(--shotHead, 46px); }
.gameTile .shotImg{
  position: absolute;
  left: 0; right: 0;
  top: var(--shotHead, 46px);
  height: calc(100% - var(--shotHead, 46px));
}
.gameTile .shotFallback{ inset: var(--shotHead, 46px) 0 0 0; }

/* === FIX: make the tile header (logo + name) sit in the reserved strip === */
.gameTile .shot{
  position: relative;
  overflow: hidden;
  --shotHead: 46px;
  padding-top: var(--shotHead);
}



/* =========================================
   /games hub tweaks: punchier bg + smaller hero art + smaller chip dots
   Paste near end of /style-test.css or games hub CSS
   ========================================= */

body.section-hub.gamesPage{
  background:
    radial-gradient(1100px 600px at 18% -14%, rgba(74,160,255,.272), rgba(0,0,0,0) 60%),
    radial-gradient(980px 560px at 92% 6%,  rgba(46,200,140,.221), rgba(0,0,0,0) 62%),
    radial-gradient(980px 560px at 60% 112%, rgba(255,120,130,.204), rgba(0,0,0,0) 62%),
    radial-gradient(900px 520px at 50% 30%,  rgba(216,177,90,.085), rgba(0,0,0,0) 68%),
    linear-gradient(180deg, rgba(11,15,20,1) 0%, rgba(9,12,18,1) 100%);
  background-attachment: fixed;
}

/* Light theme variant (15% less pop) */
:root[data-theme="light"] body.section-hub.gamesPage{
  background:
    radial-gradient(1100px 600px at 18% -14%, rgba(74,160,255,.221), rgba(255,255,255,0) 60%),
    radial-gradient(980px 560px at 92% 6%,  rgba(46,200,140,.170), rgba(255,255,255,0) 62%),
    radial-gradient(980px 560px at 60% 112%, rgba(255,120,130,.170), rgba(255,255,255,0) 62%),
    radial-gradient(900px 520px at 50% 30%,  rgba(216,177,90,.085), rgba(255,255,255,0) 70%),
    linear-gradient(180deg, rgba(248,250,255,1) 0%, rgba(245,247,252,1) 100%);
  background-attachment: fixed;
}



body.section-hub.gamesPage::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,0) 28%);
  mix-blend-mode: overlay;
  opacity: .7;
}
:root[data-theme="light"] body.section-hub.gamesPage::before{
  background: linear-gradient(180deg, rgba(0,0,0,.04), rgba(0,0,0,0) 28%);
  mix-blend-mode: multiply;
  opacity: .45;
}

/* Make sure your page content is above the sheen layer */
body.section-hub.gamesPage > *{
  position: relative;
  z-index: 1;
}

/* 2) Mobile: hero image smaller again + tighter spacing */
@media (max-width: 520px){
  .gamesHero{
    gap: 10px;
    padding: 12px 12px 8px;
  }

  .gamesHero .heroArt{
    max-width: 260px;   /* smaller than before */
    margin: 0 auto;
  }

  .gamesHero .heroArt img{
    width: 100%;
    height: auto;
    max-height: 140px;  /* smaller than before */
    object-fit: contain;
  }

  /* 3) Mobile: CTA buttons slightly smaller */
  .gamesHero .heroCtas{
    gap: 10px;
  }
  .gamesHero .heroCtas .btnPrimary,
  .gamesHero .heroCtas .btnGhost{
    padding: 8px 9px;
    font-size: 12.5px;
    border-radius: 12px;
    min-height: 38px;
  }
}

/* Even smaller phones */
@media (max-width: 380px){
  .gamesHero .heroArt{ max-width: 230px; }
  .gamesHero .heroArt img{ max-height: 125px; }

  .gamesHero .heroCtas .btnPrimary,
  .gamesHero .heroCtas .btnGhost{
    padding: 7px 9px;
    font-size: 13px;
    min-height: 36px;
  }
}

/* 4) Chip dot inside chip buttons: make it smaller */
.chipBtn .dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
}
@media (max-width: 520px){
  .chipBtn{
    padding: 9px 10px;     /* keeps chips compact */
    font-size: 13.5px;
  }
  .chipBtn .dot{
    width: 5px;
    height: 5px;
  }
}
@media (max-width: 380px){
  .chipBtn{ padding: 8px 9px; font-size: 11px; }
  .chipBtn .dot{ width: 5px; height: 5px; }
}




@media (max-width: 520px){
  .gamesHero .heroKicker,
  .gamesHero .heroTitle,
  .gamesHero .heroSub{
    font-size: 0.75em;
  }
}


/* Games search (top-right) ~20% smaller */
.gamesTopRight .gamesSearchWrap{
  transform: scale(.8);
  transform-origin: top right;
}

/* If scaling makes it affect layout width too much, use this instead (no transform):
.gamesTopRight .gamesSearch input#gameSearch{
  font-size: .8em;
  padding: .6em .75em;
  height: 2.4em;
}
.gamesTopRight .countPill{
  font-size: .8em;
  padding: .45em .6em;
}
*/




/* =========================
   Mobile: top bar narrower + better alignment
   ========================= */
@media (max-width: 520px){
  /* reduce the page side padding just for this header */
  header.wrap.gamesTop{
    padding-left: 10px;
    padding-right: 10px;
  }

  /* keep items on one line, but tighter */
  .gamesTop{
    gap: 8px;
    align-items: center;
  }

  /* right cluster should be allowed to shrink */
  .gamesTopRight{
    display:flex;
    align-items:center;
    gap: 8px;
    min-width: 0;              /* IMPORTANT: allows flex children to shrink */
  }

  /* search row: shrink instead of forcing overflow */
  .gamesSearchWrap{
    display:flex;
    align-items:center;
    gap: 8px;
    min-width: 0;
  }

  .gamesSearch{
    min-width: 0;
    flex: 1 1 auto;
  }

  /* input becomes narrower + not so tall */
  #gameSearch{
    width: 100%;
    font-size: 13.5px;
    padding: 9px 10px;
  }

  /* count pill a bit tighter */
  .countPill{
    padding: 7px 9px;
    font-size: 12.5px;
    white-space: nowrap;
  }

  /* menu button a touch smaller */
  .gamesTopRight #menuOpen.iconbtn{
    width: 40px;
    height: 40px;
  }

  /* optional: shrink brand mark + text slightly */
  .gamesTop .brandMark{ width: 24px; height: 24px; }
  .gamesTop .brandName{ font-size: 16px; }
}

/* Tiny phones */
@media (max-width: 380px){
  header.wrap.gamesTop{
    padding-left: 8px;
    padding-right: 8px;
  }
  #gameSearch{ font-size: 13px; padding: 8px 9px; }
  .countPill{ padding: 6px 8px; font-size: 12px; }
  .gamesTopRight #menuOpen.iconbtn{ width: 38px; height: 38px; }
}


:root[data-theme="light"] .gameTile .tileBody{
  background: rgba(255,255,255,.92);           /* whiter */
  border-top: 1px solid rgba(11,15,20,.08);    /* crisp divider */
}


:root[data-theme="light"] .gameTile .tileDesc,
:root[data-theme="light"] .gameTile .tileTags{
  color: rgba(11,15,20,.78);
}

