:root{
  --bg:#000000;
  --panel:#121a2f;
  --panel-2:#0f162a;
  --text:#eaf0ff;
  --muted:#a9b6da;
  --line:rgba(255,255,255,.12);
  --brand:#6ae4ff;
  --brand-2:#8b5cff;
  --ok:#2ee59d;
  --warn:#ffcc66;
  --shadow:0 14px 40px rgba(0,0,0,.35);
  --r:14px;
  --ring: rgba(106,228,255,.22);
  --header-h: 68px;
}

*{box-sizing:border-box}
html,body{height:100%}
html{color-scheme:dark}
body{
  margin:0;
  font-family:ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  line-height:1.45;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
  color:var(--text);
  background:var(--bg);
}
body.nav-open{overflow:hidden}

::selection{background:rgba(106,228,255,.22);color:var(--text)}

img{max-width:100%;display:block}
a{color:inherit;text-decoration:none}
button,input{font:inherit}

.container{
  max-width:1200px;
  margin:0 auto;
  padding-left:max(16px, env(safe-area-inset-left));
  padding-right:max(16px, env(safe-area-inset-right));
}
.section{padding:20px 0}
.muted{color:var(--muted)}
.sr-only{
  position:absolute!important;
  width:1px;height:1px;
  padding:0;margin:-1px;
  overflow:hidden;clip:rect(0,0,0,0);
  white-space:nowrap;border:0;
}
.skip-link{
  position:absolute;left:10px;top:-40px;
  background:var(--panel);
  border:1px solid var(--line);
  padding:10px 12px;border-radius:12px;
  z-index:50;
}
.skip-link:focus{top:10px}

/* Header */
.site-header{
  position:sticky;top:0;z-index:40;
  background:#000;
  border-bottom:1px solid var(--line);
}
.header-inner{
  display:grid;
  grid-template-columns: auto 1fr minmax(220px, 25%);
  align-items:center;
  gap:14px;
  padding:12px 0;
  min-height:var(--header-h);
}
.brand{display:flex;align-items:center;gap:10px;min-width:max-content}
.brand-mark{
  width:28px;height:28px;border-radius:10px;
  background:linear-gradient(135deg,var(--brand),var(--brand-2));
  box-shadow:0 10px 30px rgba(106,228,255,.25);
}
.brand-text{font-weight:800;letter-spacing:.2px}
.header-nav{
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-width:0;
  position:relative;
}
.header-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:10px;
}
.header-searchbar{
  display:flex;
  align-items:center;
  height:42px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  width:100%;
}
.header-searchbar input{
  width:100%;
  height:100%;
  border:0;
  outline:none;
  background:transparent;
  color:var(--text);
  padding:0;
  min-width:0;
}
.header-searchbar input::placeholder{color:rgba(169,182,218,.85)}
.header-searchbar input:focus,
.header-searchbar input:focus-visible{
  box-shadow:none !important; /* override global input focus-visible glow */
  outline:none !important;
}
.header-searchbar:focus-within{
  border-color:rgba(106,228,255,.45);
  /* box-shadow:0 0 0 4px rgba(106,228,255,.08); */
}

.nav-toggle{
  padding:0;
  display:none; /* hidden on desktop */
  align-items:center;
  justify-content:center;
  line-height:1;
}
.nav-toggle:hover{background:rgba(255,255,255,.06)}
.nav-toggle:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring)}
.nav-inline{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}
.nav-links--inline{
  flex-wrap:nowrap;
  overflow:hidden;
  white-space:nowrap;
}
.more{position:relative}
.more.is-hidden{display:none}
.more-toggle{
  height:36px;
  padding:0 12px;
  border-radius:999px;
  background:rgba(255,255,255,.04);
  border-color:rgba(255,255,255,.12);
}
.nav-inline .more-toggle:hover{background:rgba(255,255,255,.06);border-color:rgba(255,255,255,.18)}
.nav-inline .more-toggle span[aria-hidden="true"]{color:var(--ok)}
.more-menu{
  position:absolute;
  right:0;
  top:46px;
  min-width:220px;
  max-width:320px;
  max-height:min(60vh, 520px);
  overflow:auto;
  padding:8px;
  border-radius:14px;
  border:1px solid var(--line);
  background:rgba(18,26,47,.98);
  box-shadow:var(--shadow);
  display:none;
}
.more-menu.is-open{display:block}
.more-menu a{
  display:block;
  padding:10px 10px;
  border-radius:12px;
  color:var(--muted);
}
.more-menu a:hover{background:rgba(255,255,255,.05);color:var(--text)}
.more-menu a.is-active{
  background:rgba(106,228,255,.10);
  border:1px solid rgba(106,228,255,.22);
  color:var(--text);
}
.nav-links{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.nav-links a{
  padding:8px 10px;
  border:1px solid transparent;
  border-radius:999px;
  color:var(--muted);
}
.nav-links a:hover{border-color:var(--line);color:var(--text)}
.nav-links a.is-active{
  border-color:rgba(106,228,255,.35);
  color:var(--text);
  background:rgba(106,228,255,.08);
}

/* Header nav pills (inline) */
.nav-inline .nav-links{gap:6px;flex-wrap:nowrap}
.nav-inline .nav-links a{
  height:36px;
  display:inline-flex;
  align-items:center;
  padding:0 14px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.04);
  color:var(--text);
  font-weight:800;
  letter-spacing:.1px;
}
.nav-inline .nav-links a:hover{
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.18);
}
.nav-inline .nav-links a.is-active{
  background:rgba(106,228,255,.12);
  border-color:rgba(106,228,255,.22);
}

/* Desktop dropdown "drawer" (opened via hamburger) */
.nav-drawer{
  position:absolute;
  left:0;
  top:54px;
  width:min(560px, calc(100vw - 32px));
  background:rgba(18,26,47,.98);
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:var(--shadow);
  padding:12px;
  display:none;
  flex-direction:column;
  align-items:stretch;
  gap:12px;
}
.nav-drawer.is-open{display:flex}
.nav-drawer-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.nav-title{font-weight:900}

/* Header search popover (icon -> input) */
.header-search-wrap{position:relative}
.search-popover{
  position:absolute;
  right:0;
  top:54px;
  width:min(460px, calc(100vw - 32px));
  padding:10px;
  border-radius:18px;
  border:1px solid var(--line);
  background:rgba(18,26,47,.98);
  box-shadow:var(--shadow);
  display:none;
}
.search-popover.is-open{display:block}
.search-popover-form{
  display:flex;
  align-items:center;
  gap:10px;
}
.search-popover-form input{
  width:100%;
  height:42px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--text);
  outline:none;
}
.search-popover-form input:focus{
  border-color:rgba(106,228,255,.45);
  box-shadow:0 0 0 4px rgba(106,228,255,.08);
}

.search{margin-left:auto;display:flex;align-items:center;gap:10px;min-width:280px;max-width:460px;flex:1}
.search--drawer{margin-left:0;max-width:none;min-width:0}
.search input{
  width:100%;
  height:42px;
  padding:0 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.05);
  color:var(--text);
  outline:none;
}
.search input:focus{border-color:rgba(106,228,255,.45);box-shadow:0 0 0 4px rgba(106,228,255,.08)}

/* Buttons / Links */
.btn{
  height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:0 14px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  cursor:pointer;
  transition:transform .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover{border-color:rgba(255,255,255,.22);background:rgba(255,255,255,.06);transform:translateY(-1px)}
.btn:active{transform:translateY(0)}
.btn:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring)}
.btn-primary{
  border-color:rgba(106,228,255,.45);
  background:linear-gradient(135deg, rgba(106,228,255,.18), rgba(139,92,255,.14));
}
.link{color:var(--brand);font-weight:600}
.link:hover{text-decoration:underline}
.link:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring);border-radius:10px}
.icon-btn:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring)}
input:focus-visible{outline:0;box-shadow:0 0 0 4px rgba(106,228,255,.10)}
a:focus-visible{outline:0;box-shadow:0 0 0 4px rgba(106,228,255,.10);border-radius:10px}
.link-btn{
  margin-top:10px;
  background:transparent;
  border:0;
  padding:0;
  color:var(--brand);
  font-weight:700;
  cursor:pointer;
}

/* Hero */
.hero{padding:22px 0 10px}
.hero-inner{
  display:grid;
  grid-template-columns: 1.5fr .9fr;
  gap:16px;
  align-items:stretch;
}
.hero-inner--single{grid-template-columns:1fr}
.hero-copy{
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:var(--r);
  padding:18px 18px;
  box-shadow:var(--shadow);
}
.hero-copy h1{margin:0 0 8px;font-size:32px;letter-spacing:-.3px}
.hero-copy p{margin:0 0 14px;color:var(--muted);line-height:1.55}

/* Hot games icon strip (after header, all pages) */
.hot-strip{padding:12px 0 4px}
.hot-inner{
  display:flex;
  align-items:center;
  gap:12px;
}
.hot-arrow{
  width:100px;
  height:44px;
  font-size:30px;
  line-height:1;
  display:inline-flex;
  /* align-items:center; */
  justify-content:center;
  padding:0;
}
.hot-arrow[disabled]{opacity:.45;cursor:not-allowed}
.hot-viewport{
  flex:1 1 auto;
  min-width:0;
  overflow:auto;
  border-radius:20px;
  padding:5px 12px;
  background:rgba(0,0,0,.14);
  scrollbar-width:none;
  cursor:grab;
  scroll-snap-type: none;
  -webkit-overflow-scrolling: touch;
}
.hot-viewport::-webkit-scrollbar{width:0;height:0}
.hot-viewport.is-dragging{cursor:grabbing}
.hot-viewport, .hot-track, .hot-item{user-select:none}
.hot-viewport.is-dragging{user-select:none}
.hot-track{
  display:flex;
  align-items:center;
  gap:14px;
}
.hot-item{
  flex:0 0 auto;
  display:block;
  width:82px;
  height:82px;
  border-radius:28px;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 12px 26px rgba(0,0,0,.28);
  overflow:hidden;
  scroll-snap-align:start;
  cursor:grab;
  transition:border-color .12s ease, box-shadow .12s ease;
}
.hot-item img{
  width:100%;
  height:100%;
  object-fit:cover;
  background:rgba(255,255,255,.05);
  -webkit-user-drag:none;
  user-select:none;
}
.hot-item:hover{border-color:rgba(106,228,255,.25)}
.hot-item:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring), 0 12px 26px rgba(0,0,0,.28)}
.hot-item.is-pressed{
  border-color:rgba(106,228,255,.55);
  box-shadow:0 14px 32px rgba(0,0,0,.35), 0 0 0 4px rgba(106,228,255,.16);
}
.hot-viewport.is-dragging .hot-item{cursor:grabbing}

.chips{display:flex;gap:10px;flex-wrap:wrap}
.chip{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 12px;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
}
.chip small{color:var(--muted);font-weight:600}

/* Layout */
.layout-2col{
  display:grid;
  grid-template-columns: 1.55fr .75fr;
  gap:16px;
  align-items:start;
}
.content-col{min-width:0}
.sidebar-col{position:sticky;top:calc(var(--header-h) + 14px);display:grid;gap:14px}

/* Game details: Similar Games box can be sticky within the top layout */
.page-game .sidebar-box--sticky{
  position:sticky;
  top:calc(var(--header-h) + 14px);
}

/* Home top area (Hot games + Ad + Browse by type) */
.home-top{padding-top:18px;padding-bottom:8px}
.home-top-grid{
  display:grid;
  grid-template-columns: 1fr minmax(220px, 300px);
  gap:16px;
  align-items:start;
}
.home-top-main{min-width:0}
.home-top-side{position:sticky;top:calc(var(--header-h) + 14px)}

.home-hot-grid{
  display:grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap:16px;
}
.hot-tile{
  position:relative;
  display:block;
  border-radius:26px;
  overflow:hidden;
  aspect-ratio: 1 / 1;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 14px 32px rgba(0,0,0,.30);
  transition:transform .12s ease, border-color .12s ease, box-shadow .12s ease;
}
.hot-tile:hover{transform:translateY(-2px);border-color:rgba(106,228,255,.28);box-shadow:0 18px 40px rgba(0,0,0,.34)}
.hot-tile:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring), 0 18px 40px rgba(0,0,0,.34)}
.hot-tile img{
  width:100%;
  height:100%;
  object-fit:cover;
  background:rgba(255,255,255,.05);
  -webkit-user-drag:none;
  user-select:none;
}
.hot-tile-name{
  position:absolute;
  left:10px;
  right:10px;
  bottom:10px;
  padding:8px 10px;
  border-radius:14px;
  background:rgba(0,0,0,.55);
  border:1px solid rgba(255,255,255,.16);
  text-align:center;
  font-weight:900;
  font-size:14px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.sidebar-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:10px}
.sidebar-title{margin:0;font-size:14px;letter-spacing:.1px}
.type-list{display:grid;gap:10px}
.type-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.28);
  color:var(--text);
  font-weight:800;
  font-size:13px;
  transition:transform .12s ease, border-color .12s ease, background .12s ease;
}
.type-item:hover{transform:translateY(-1px);border-color:rgba(255,255,255,.18);background:rgba(0,0,0,.34)}
.type-item:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring)}
.type-icon{
  width:22px;
  height:22px;
  border-radius:10px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-weight:1000;
  color:#0b1020;
  background:linear-gradient(135deg, rgba(106,228,255,.95), rgba(139,92,255,.85));
  box-shadow:0 10px 20px rgba(0,0,0,.18);
  flex:0 0 auto;
}

/* Cards / Grid */
.section-head{
  display:flex;align-items:baseline;justify-content:space-between;gap:10px;
  margin-bottom:10px;
}
.section-head.tight{margin-bottom:8px}
.section-head h2{margin:0;font-size:20px}
.sections{display:grid;gap:18px}

/* Home: 3 type sections + single right-side advertisement */
.home-sections-layout{
  display:grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap:24px; /* more breathing room between last game tile and the right ad */
  align-items:start;
}
.home-sections-layout > *{min-width:0}
.home-sections-ad{
  position:static; /* scroll with page (not sticky) */
  margin-left:10px; /* extra separation from the game sections */
  align-self:stretch; /* match height of the left (Casual→Arcade) sections on wide screens */
  display:flex;
}
.home-sections-ad > .ad-card{
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
}
.home-sections-ad > .ad-card .ad-body{
  flex:1;
}

/* Collapse the right-side ad earlier so the game strips don't get squeezed */
@media (max-width: 980px){
  .home-sections-layout{grid-template-columns:1fr}
  .home-sections-ad{position:static;margin-top:14px;margin-left:0}
}

.type-strip .section-head h2{font-size:18px}
.strip-row{
  display:flex;
  align-items:flex-start;
  gap:14px;
  overflow:auto;
  padding:10px 4px 4px;
  scrollbar-width:none;
  -webkit-overflow-scrolling: touch;
}
.strip-row::-webkit-scrollbar{width:0;height:0}
.strip-row--wrap{
  flex-wrap:wrap;
  overflow:visible;
  padding-bottom:0;
}
.strip-row--wrap::-webkit-scrollbar{width:0;height:0}
.strip-game{
  flex:0 0 auto;
  width:clamp(84px, 8.2vw, 110px);
  color:var(--text);
}
.strip-game img{
  width:100%;
  aspect-ratio:1 / 1;
  border-radius:28px;
  object-fit:cover;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 12px 26px rgba(0,0,0,.28);
}
.strip-game:hover img{border-color:rgba(106,228,255,.25)}
.strip-game:focus-visible{outline:0}
.strip-game:focus-visible img{box-shadow:0 0 0 4px var(--ring), 0 12px 26px rgba(0,0,0,.28)}
.strip-game-name{
  margin-top:10px;
  font-weight:900;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.strip-game-stars{
  margin-top:6px;
  display:flex;
  align-items:center;
  gap:6px;
  font-weight:900;
  font-size:12px;
  color:var(--warn);
}
.strip-game-count{color:var(--text)}

.page-type .page-head{margin-bottom:12px}

/* Type page: icon grid (match reference screenshot) */
.type-grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap:16px;
  margin-top:10px;
}
.type-grid--main{
  /* Desktop: always 9 games per row */
  grid-template-columns: repeat(9, minmax(0, 1fr));
}
.type-grid--hot{
  /* Desktop: always 6 games per row */
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

/* Medium screens: avoid overly-small tiles */
@media (max-width: 1120px){
  .type-grid--main{grid-template-columns: repeat(6, minmax(0, 1fr))}

  /* Tablet/Small desktop: avoid squeezing the 3-column game header (hero + ad + similar). */
  .page-game .game-top-layout{
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  }
  .page-game .game-hero{grid-column:1;grid-row:1 / span 2}
  .page-game .ad-card.ad-top{grid-column:2;grid-row:1}
  .page-game .game-similar{grid-column:2;grid-row:2}
}

/* ============================================================
  1024px tuning (small desktop / tablet landscape)
  NOTE: this block must come AFTER the 1120px block (last rule wins).
============================================================ */

@media (max-width: 1024px){
  /* Header: give nav more breathing room by moving search to its own row */
  .header-inner{
    grid-template-columns:auto minmax(0, 1fr);
    gap:12px;
  }
  .header-nav{justify-content:flex-start}
  .header-actions{
    grid-column:1 / -1;
    justify-content:stretch;
  }
  .header-searchbar{width:100%}

  /* Header pills: slightly smaller so the row stays balanced */
  .nav-inline .nav-links a{padding:0 12px}
  .more-toggle{padding:0 10px}

  /* Home: hot grid shouldn't be 5-up at 1024 (tiles get too small) */
  .home-hot-grid{grid-template-columns: repeat(4, minmax(0, 1fr))}

  /* Home: collapse the right-side ad earlier so the left sections keep clean spacing */
  .home-sections-layout{grid-template-columns:1fr;gap:18px}
  .home-sections-ad{position:static;margin-top:14px;margin-left:0}

  /* Type page: make icon grids less dense for 1024px */
  .type-grid--main{grid-template-columns: repeat(5, minmax(0, 1fr))}
  .type-grid--hot{grid-template-columns: repeat(4, minmax(0, 1fr))}

  /* Game page: keep the 2-column layout from the 1120px breakpoint, but reduce squeeze */
  .page-game .game-top-layout{
    grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  }
}
.type-game{
  display:block;
  color:var(--text);
  min-width:0;
}
.type-game img{
  width:100%;
  aspect-ratio: 1 / 1;
  border-radius:28px;
  object-fit:cover;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.12);
  box-shadow:0 12px 26px rgba(0,0,0,.28);
}
.type-game:hover img{border-color:rgba(106,228,255,.25)}
.type-game:focus-visible{outline:0}
.type-game:focus-visible img{box-shadow:0 0 0 4px var(--ring), 0 12px 26px rgba(0,0,0,.28)}
.type-game-name{
  margin-top:10px;
  font-weight:900;
  font-size:13px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.type-game-stars{
  margin-top:6px;
  display:flex;
  align-items:center;
  gap:6px;
  font-weight:900;
  font-size:12px;
  color:var(--warn);
}
.type-game-stars .type-game-count{color:var(--text)}

.grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap:12px;
}
.grid--stable{
  /* Keeps card size stable when filtering reduces the item count */
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.card{
  border:1px solid var(--line);
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border-radius:16px;
  overflow:hidden;
  box-shadow:0 10px 26px rgba(0,0,0,.25);
  transition:transform .12s ease, border-color .12s ease;
}
.card:hover{transform:translateY(-2px);border-color:rgba(106,228,255,.25)}
.card-media{aspect-ratio: 4 / 3;background:rgba(255,255,255,.03);display:flex;align-items:center;justify-content:center}
.card-media img{width:100%;height:100%;object-fit:cover}
.card-body{padding:10px 10px 12px}
.card-title{
  font-weight:800;
  font-size:13px;
  line-height:1.25;
  margin:0 0 8px;
  display:-webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow:hidden;
  min-height: 2.5em;
}
.card-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;color:var(--muted);font-size:12px}
.pill{
  display:inline-flex;align-items:center;gap:6px;
  padding:5px 8px;border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  font-size:12px;
}
.stars{color:var(--warn);letter-spacing:.6px}

.stack{display:grid;gap:10px}
.mini{
  display:flex;gap:10px;align-items:center;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  border-radius:14px;
  padding:10px;
}
.mini img{width:44px;height:44px;border-radius:12px;object-fit:cover;background:rgba(255,255,255,.05)}
.mini-title{font-weight:800;font-size:13px;margin:0}
.mini-sub{font-size:12px;color:var(--muted);display:flex;gap:8px;align-items:center}

/* Ads */
.ad-card, .ad-inline{
  border:1px dashed rgba(255,255,255,.25);
  background:rgba(255,255,255,.03);
  border-radius:var(--r);
  overflow:hidden;
  position:relative;
  /* Allow ad iframes/embeds to shrink inside grids without forcing overflow */
  min-width:0;
  max-width:100%;
}
.ad-badge{
  position:absolute;top:10px;left:10px;
  font-size:12px;font-weight:800;
  padding:6px 10px;border-radius:999px;
  background:rgba(0,0,0,.35);
  border:1px solid rgba(255,255,255,.18);
}
.ad-body{padding:48px 16px 18px;min-height:140px;display:flex;flex-direction:column;justify-content:center;gap:6px}
.ad-title{font-weight:900;letter-spacing:.2px}
.ad-subtitle{color:var(--muted);font-size:13px}
.ad-inline{margin:14px 0}
.ad-strip{padding:26px 14px 14px;min-height:92px;display:flex;flex-direction:column;justify-content:center;gap:6px}

/* ------------------------------------------------------------
  Responsive ad embed rules (CSS-only)
  Goal: third-party ad markup should never overflow the viewport,
  and should remain centered when smaller than its container.
  Notes:
  - We do NOT change ad provider scripts or JS logic.
  - We only constrain *maximum* width; we don't force a fixed width.
------------------------------------------------------------- */

/* Existing ad wrappers used across pages */
.home-ad-card,
.ad-card,
.ad-inline{
  max-width:100%;
  overflow:hidden; /* defensive: some ad scripts insert large children */
  min-width:0;
}

/* Common ad elements (AdSense uses <ins> + injected <iframe>) */
.home-ad-card iframe,
.ad-card iframe,
.ad-inline iframe,
.home-ad-card ins,
.ad-card ins,
.ad-inline ins,
.home-ad-card img,
.ad-card img,
.ad-inline img,
.home-ad-card object,
.ad-card object,
.ad-inline object,
.home-ad-card embed,
.ad-card embed,
.ad-inline embed{
  max-width:100% !important; /* overrides inline widths without forcing a fixed size */
  margin-left:auto;          /* center on mobile when the ad is narrower than container */
  margin-right:auto;
}

.home-ad-card iframe,
.ad-card iframe,
.ad-inline iframe{
  display:block;
  border:0;
}

/* Ads inserted as <ins> should behave like a block that can shrink */
.home-ad-card ins,
.ad-card ins,
.ad-inline ins{
  display:block !important;
  overflow:hidden;
}

/* Home advertisement placeholder (index.html only) */
.home-ad{padding:10px 0 8px}
.home-ad--inline{padding:0;margin-top:14px}
.home-ad-card{
  position:relative;
  min-height:140px;
  border-radius:22px;
  border:1px dashed rgba(255,255,255,.35);
  background:rgba(255,255,255,.04);
  box-shadow:0 14px 34px rgba(0,0,0,.25);
  max-width:100%;
  overflow:hidden;
  min-width:0;
}
.home-ad--inline .home-ad-card{min-height:190px}
.home-ad-placeholder{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:16px;
  text-align:center;
  font-weight:900;
  letter-spacing:.6px;
  color:rgba(234,240,255,.72);
  text-transform:uppercase;
  pointer-events:none;
  user-select:none;
}

/* Page head / Breadcrumbs */
.page-head{margin-bottom:10px}
.page-title h1{margin:6px 0 4px;font-size:28px;letter-spacing:-.3px}
.breadcrumbs{display:flex;gap:8px;align-items:center;color:var(--muted);font-size:13px;flex-wrap:wrap}
.breadcrumbs a{color:var(--muted)}
.breadcrumbs a:hover{color:var(--text)}
.breadcrumbs .sep{opacity:.5}

/* Filters */
.filters{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:12px;
  flex-wrap:wrap;
}
.search-inline input{
  width:260px;max-width:100%;
  height:40px;
  padding:0 12px;border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  outline:none;
}

.load-more-wrap{display:flex;justify-content:center;margin:16px 0 10px}

/* Game details */
.game-top-layout{
  display:grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 340px) minmax(260px, 340px);
  gap:16px;
  align-items:start;
  padding-top:6px;
}
.game-top-layout > *{min-width:0}
.game-similar{align-self:start}
.ad-card.ad-top{
  display:flex;
  flex-direction:column;
}
.ad-card.ad-top .ad-body{
  min-height:210px;
}
.ad-top-label{
  padding:10px 10px 6px;
  text-align:center;
  font-weight:900;
  color:rgba(234,240,255,.86);
  border-bottom:1px solid rgba(255,255,255,.08);
  background:rgba(0,0,0,.16);
}
.ad-top .ad-body{padding-top:18px}

.game-hero{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap:14px;
  padding:14px;
  border:1px solid var(--line);
  border-radius:var(--r);
  background:linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  box-shadow:var(--shadow);
}
.game-logo{
  width:120px;height:120px;border-radius:24px;
  object-fit:cover;
  background:rgba(255,255,255,.06);
  border:1px solid rgba(255,255,255,.1);
}
.game-title{margin:0;font-size:28px;letter-spacing:-.3px}

.game-meta{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-top:8px;
}
.rating-inline{
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-weight:1000;
  color:var(--warn);
}
.rating-inline .n{
  color:var(--text);
  font-weight:1000;
}
.meta-type{
  color:rgba(234,240,255,.90);
  font-weight:900;
  font-size:14px;
}
.meta-type:hover{text-decoration:underline}
.meta-safe{
  display:inline-flex;
  align-items:center;
  gap:8px;
  color:var(--ok);
  font-weight:900;
  font-size:14px;
  order:2;            /* place after rating/meta-type */
  flex:0 0 100%;      /* force a new line below the rating row */
  margin-top:4px;
}
.meta-safe .safe-ic{width:16px;height:16px;display:block}

.spec-card{
  margin-top:14px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.20);
  border-radius:18px;
  padding:14px;
  grid-column:1 / -1; /* sit below the game image + header (spans full hero width) */
}
.spec-row{
  display:grid;
  grid-template-columns: 140px 1fr;
  gap:10px;
  padding:8px 0;
}
.spec-row + .spec-row{border-top:1px solid rgba(255,255,255,.06)}
.spec-k{color:rgba(234,240,255,.88);font-weight:900}
.spec-v{color:rgba(234,240,255,.92);font-weight:800}
.game-hero-top{display:flex;align-items:flex-start;justify-content:space-between;gap:10px;flex-wrap:wrap}
.rating-pill{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 10px;border-radius:999px;
  border:1px solid rgba(255,255,255,.16);
  background:rgba(255,255,255,.04);
  color:var(--text);
  white-space:nowrap;
}
.tag-row{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:10px 0 8px}
.tag{
  display:inline-flex;align-items:center;
  padding:7px 10px;border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  color:var(--text);
  font-weight:700;font-size:13px;
}
.info-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap:10px;
  margin:12px 0;
}
.info-item{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
  background:rgba(255,255,255,.03);
}
.info-k{color:var(--muted);font-size:12px;font-weight:700}
.info-v{font-weight:900;margin-top:4px}
.actions{display:flex;gap:10px;flex-wrap:wrap;margin-top:10px}
.safety-box{
  margin-top:12px;
  border:1px solid rgba(46,229,157,.25);
  background:rgba(46,229,157,.05);
  border-radius:14px;
  padding:10px;
}
.safety-title{font-weight:900;margin-bottom:4px;color:#bfffe8}
.prose{color:var(--muted);line-height:1.7}
.prose ul,
.prose ol{
  margin:0 0 12px;
  padding-left:1.2em; /* consistent indent across browsers */
}
.prose li{margin:6px 0}
.prose.is-collapsed{
  display:-webkit-box;
  line-clamp: 7;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow:hidden;
}

/* Game details: About section (match reference screenshot) */
.about-section{padding-top:24px}
.about-head{
  padding-bottom:14px;
  margin-bottom:14px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.about-head h2{
  margin:0;
  font-size:26px;
  letter-spacing:-.2px;
}
.about-prose{
  color:rgba(234,240,255,.92);
  font-size:14px;
}
.about-prose p{margin:0 0 12px}
.about-prose p:last-child{margin-bottom:0}
.about-actions{
  display:flex;
  justify-content:center;
  margin-top:16px;
}
.about-toggle{
  min-width:160px;
  height:44px;
  border-radius:999px;
  background:rgba(255,255,255,.06);
  border-color:rgba(255,255,255,.14);
}
.gallery{
  display:flex;
  gap:14px;
  overflow:auto;
  padding:6px 2px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width:none;
  cursor:grab;
}
.gallery.is-dragging{cursor:grabbing}
.gallery::-webkit-scrollbar{width:0;height:0}
.gallery img{
  flex:0 0 auto;
  width:clamp(360px, 52vw, 620px);
  aspect-ratio: 16 / 9;
  object-fit:cover;
  border-radius:18px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(255,255,255,.03);
  user-select:none;
  -webkit-user-drag:none;
}

.get-game{
  display:grid;
  gap:12px;
}

/* Get the Game (match reference screenshot) */
.get-section{padding-top:22px}
.get-head{
  padding-bottom:14px;
  margin-bottom:14px;
  border-bottom:1px solid rgba(255,255,255,.10);
}
.get-head h2{
  margin:0;
  font-size:26px;
  letter-spacing:-.2px;
}
.get-safety{
  display:flex;
  align-items:center;
  gap:14px;
  padding:12px 14px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(255,255,255,.03);
}
.get-safety-ic{
  width:42px;height:42px;
  border-radius:999px;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(46,229,157,.14);
  color:var(--ok);
  flex:0 0 auto;
}
.get-safety-ic img{
  width:22px;
  height:22px;
  display:block;
}
.get-safety-text{min-width:0}
.get-safety-title{font-weight:1000;color:rgba(234,240,255,.95);line-height:1.15}
.get-safety-sub{color:rgba(234,240,255,.85);font-weight:700;font-size:13px;line-height:1.35}

.get-actions{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap:16px;
}
.get-actions.is-single{grid-template-columns:1fr}
.btn-store{
  width:100%;
  height:54px;
  border-radius:999px;
  justify-content:center;
  gap:10px;
  font-weight:1000;
  background:rgba(255,255,255,.05);
  border-color:rgba(255,255,255,.12);
}
.btn-store .store-ic{
  width:18px;
  height:18px;
  display:block;
}

/* Ads: banner variant used on game details */
.ad-inline--banner{
  margin:16px 0;
}
.ad-inline--banner .ad-strip{
  min-height:120px;
  align-items:center;
  text-align:center;
}
.ad-inline--banner-bottom .ad-strip{
  min-height:110px;
}

/* Sidebar: similar games rows (screenshot-like) */
.side-stack{gap:10px}
.side-row{
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.03);
  border-radius:14px;
  padding:10px;
  transition:transform .12s ease, border-color .12s ease;
}
.side-row:hover{transform:translateY(-1px);border-color:rgba(106,228,255,.25)}
.side-row:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring)}
.side-row img{
  width:44px;
  height:44px;
  border-radius:12px;
  object-fit:cover;
  background:rgba(255,255,255,.05);
  flex:0 0 auto;
}
.side-row-title{
  font-weight:900;
  font-size:13px;
  line-height:1.2;
}
.side-row-rate{
  margin-left:auto;
  display:inline-flex;
  align-items:center;
  gap:6px;
  font-weight:1000;
  color:var(--warn);
  white-space:nowrap;
}
.side-row-rate .n{color:var(--text);font-weight:900}

/* Sidebar */
.sidebar-box{
  border:1px solid var(--line);
  background:rgba(255,255,255,.02);
  border-radius:var(--r);
  padding:12px;
}
.sidebar-box--sticky{
  position:sticky;
  top:calc(var(--header-h) + 14px);
}
.sidebar-col .sidebar-box .section-head.tight{
  padding-bottom:10px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.sidebar-col .sidebar-box .section-head.tight h2{
  font-size:22px;
  letter-spacing:-.2px;
}

/* Footer */
.site-footer{
  border-top:1px solid var(--line);
  margin-top:24px;
  background:linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,0)), #0c101a;
}

/* New footer layout (matches reference screenshot) */
.footer-top{padding:10px 0 8px}
.footer-top-inner{
  display:grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap:14px;
  align-items:center;
  min-height:112px;
  padding:4px 0 10px;
  border-bottom:1px solid rgba(255,255,255,.08);
}
.footer-brandblock{min-width:0}
.footer-brandlink{
  display:inline-flex;
  align-items:center;
  gap:12px;
  min-width:max-content;
}
.footer-brandtext{
  font-weight:1000;
  letter-spacing:.8px;
  text-transform:uppercase;
}
.footer-lead{
  margin:8px 0 0;
  max-width:74ch;
  color:rgba(234,240,255,.92);
  font-size:12px;
  line-height:1.5;
}
.footer-illustration{
  justify-self:end;
  width:min(400px, 100%);
}
.footer-illustration img,
.footer-illustration svg{
  width:100%;
  height:auto;
  display:block;
  object-fit:contain;
}
.footer-bottom{
  padding:8px 0 10px;
  border-top:0;
}
.footer-bottom-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  flex-wrap:wrap;
}
.footer-nav{
  display:flex;
  gap:22px;
  flex-wrap:wrap;
  color:rgba(234,240,255,.75);
}
.footer-nav a{color:rgba(234,240,255,.75)}
.footer-nav a:hover{color:var(--text)}
.footer-copy{
  color:rgba(234,240,255,.78);
  font-size:13px;
  text-align:right;
}

/* Mobile nav drawer */
.icon-btn{
  width:42px;height:42px;
  display:inline-flex;
  /* align-items:center; */
  justify-content:center;
  line-height:1;
  border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.04);
  color:var(--text);
  cursor:pointer;
}
.icon-btn.nav-toggle{
  display:none; /* hidden on desktop; shown via media queries */
  border:0;
  border-radius:12px;
  background:transparent;
}
.icon-btn.nav-toggle:hover{background:rgba(255,255,255,.06)}
.icon-btn.nav-toggle:focus-visible{outline:0;box-shadow:0 0 0 4px var(--ring)}
/* Note: base desktop drawer styles are defined in the header section above. */

/* Responsiveness */
@media (max-width: 860px){
  :root{ --header-h: 68px; }
  .hero-inner{grid-template-columns:1fr}
  .layout-2col{grid-template-columns:1fr}
  .sidebar-col{position:static}
  .game-top-layout{grid-template-columns:1fr}
  .search{min-width:0;max-width:none}
  .nav-toggle{display:inline-flex} /* show on tablet + mobile */
  .icon-btn.nav-toggle{display:inline-flex} /* override .icon-btn base */
  .header-nav{justify-content:flex-start}
  .nav-inline{display:none} /* prevent overflow on tablet */
  .search-popover{display:none !important} /* legacy (unused) */
  .header-searchbar{
    width:100%;
  }

  /* Drawer becomes fixed panel on tablet/mobile */
  .nav-drawer{
    position:fixed;
    left:12px;right:12px;top:calc(var(--header-h) + 10px);
    width:auto;
    background:rgba(18,26,47,.95);
    border:1px solid var(--line);
    border-radius:18px;
    box-shadow:var(--shadow);
    padding:12px;
    display:none;
    flex-direction:column;
    align-items:stretch;
    max-height: calc(100dvh - var(--header-h) - 24px);
    overflow:auto;
    z-index:60;
  }
  .nav-drawer.is-open{display:flex}
  .nav-drawer-head{display:flex}

  .home-top-grid{grid-template-columns:1fr}
  .home-top-side{position:static}
  /* Hot games: 2-up on mobile/tablet */
  .home-hot-grid{grid-template-columns: repeat(2, minmax(0, 1fr));gap:12px}
  .home-ad-card{min-height:124px}
  .home-ad--inline .home-ad-card{min-height:165px}

  .home-sections-layout{grid-template-columns:1fr}
  .home-sections-ad{position:static;margin-top:14px;margin-left:0}

  /* Home sections (Casual/Puzzle/Arcade): 3-up grid on mobile/tablet */
  .home-sections-layout .type-strip .strip-row{
    display:grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap:12px;
    overflow:visible;
    padding:10px 4px 4px;
  }
  .home-sections-layout .type-strip .strip-game{width:100%}

  .footer-top-inner{grid-template-columns:1fr}
  .footer-illustration{justify-self:start;max-width:520px}
  .footer-copy{text-align:left}

  /* Type grids: larger tiles on tablet/mobile */
  .type-grid{gap:12px}
  .type-grid--main{grid-template-columns: repeat(3, minmax(0, 1fr))}
  .type-grid--hot{grid-template-columns: repeat(2, minmax(0, 1fr))}
}
@media (max-width: 640px){
  :root{ --header-h: 112px; }
  .header-inner{gap:10px}
  .header-inner{grid-template-columns: auto 1fr}
  .header-actions{
    grid-column:1 / -1;
    justify-content:stretch;
  }
  .header-searchbar{
    width:100%;
    max-width:none;
    min-width:0;
  }
  .search:not(.search--drawer){display:none}
  .search.search--drawer{display:flex}
  .search-popover{display:none !important}
  .nav-drawer-head{align-items:center;justify-content:space-between;gap:10px}
  .nav-links{flex-direction:column;align-items:stretch}
  .nav-links a{padding:10px 12px}
  .hero-copy h1{font-size:26px}
  .hot-strip{padding:10px 0 2px}
  .hot-item{width:70px;height:70px;border-radius:24px}
  .hot-viewport{padding:10px 10px;border-radius:18px}
  .hot-track{gap:12px}
  .home-hot-grid{grid-template-columns: repeat(2, minmax(0, 1fr))}
  .home-ad-card{min-height:112px}
  .home-ad--inline .home-ad-card{min-height:150px}
  .game-hero{grid-template-columns: 92px 1fr}
  .game-logo{width:92px;height:92px;border-radius:20px}
  .game-title{font-size:22px}
  .spec-row{grid-template-columns: 110px 1fr}
  .sidebar-box--sticky{position:static}
  .actions .btn{flex:1 1 100%}
  .gallery img{width:clamp(260px, 82vw, 420px)}
  .ad-inline--banner .ad-strip{min-height:100px}
  .about-head h2{font-size:22px}
  .about-toggle{width:100%}
  .get-head h2{font-size:22px}
  .get-safety{border-radius:22px;align-items:flex-start}
  .get-actions{grid-template-columns:1fr}
  .search-inline input{width:100%}
  .footer-nav{gap:16px}

  .type-grid{
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap:10px;
  }
  .type-grid--hot{grid-template-columns: repeat(2, minmax(0, 1fr))}
  .type-grid--main{grid-template-columns: repeat(3, minmax(0, 1fr))}
  /* Larger icons on mobile */
  .type-game img{
    border-radius:34px;
    width:100%;
    height:auto;
    aspect-ratio: 1 / 1;
  }
}

@media (max-width: 520px){
  /* prevent header crowding on very small phones */
  .brand-text{display:none}
}

@media (prefers-reduced-motion: reduce){
  .btn,.card{transition:none}
  .btn:hover,.card:hover{transform:none}
}

/* ---- Target breakpoint safety overrides (appended) ---- */
@media (max-width: 768px){
  /* Nav drawer search: keep input + button on one line */
  .nav-drawer .search.search--drawer{
    flex-direction:row;
    flex-wrap:nowrap;
    align-items:center;
    gap:10px;
  }
  .nav-drawer .search.search--drawer input{
    flex:1;
    min-width:0;
    width:auto;
  }
  .nav-drawer .search.search--drawer .btn{
    width:auto;
    white-space:nowrap;
  }
}
@media (max-width: 425px){
  /* Footer links: true 44px tap target */
  .footer-nav a{display:inline-flex;align-items:center;min-height:44px;padding:8px 0}
}

/* ============================================================
  PIXEL-TUNED TARGETS (320 / 375 / 425 / 768)
  Purpose: address exact device resolutions with predictable tile/button sizing.
  NOTE: CSS-only. JS untouched. Ads/iframes/scripts untouched.
============================================================ */

/* --- Tablet portrait (<= 768px) --- */
@media (max-width: 768px){
  /* Type listing: stable 2-col grid with readable text */
  .type-grid{gap:12px}
  .type-game-name{font-size:14px;line-height:1.25}

  /* Cards: slightly larger tap area */
  .card-body{padding:12px 12px 14px}

  /* Game details: reduce squeeze in hero top */
  .page-game .game-hero{padding:12px}
}

/* --- Large mobile (<= 425px) --- */
@media (max-width: 425px){
  /* Make primary “list” buttons (e.g., More/Load more) full-width */
  .load-more-wrap{justify-content:stretch;margin:14px 0 10px}
  .load-more-wrap .btn{width:100%}

  /* Type tiles: comfortable icon size for 425px */
  .type-game{grid-template-columns: 1fr}
  .type-game img{
    width:100%;
    height:auto;
    aspect-ratio: 1 / 1;
    border-radius:34px;
  }
  .type-game-name{font-size:14px}

  /* Hot strip arrows already constrained; ensure they don't crowd */
  .hot-inner{gap:8px}

  /* Game details: keep hero readable and prevent spec overflow */
  .page-game .game-hero{grid-template-columns: 88px minmax(0, 1fr);gap:12px}
  .page-game .game-logo{width:88px;height:88px;border-radius:18px}
  .page-game .game-title{font-size:22px;line-height:1.15}
  .page-game .spec-row{grid-template-columns: 104px minmax(0, 1fr)}

  /* Ensure long values wrap instead of forcing horizontal scroll */
  .spec-v, .prose, .footer-lead{overflow-wrap:anywhere;word-break:break-word}
}

/* --- Standard mobile (<= 375px) --- */
@media (max-width: 375px){
  /* Type tiles: slightly smaller than 425 */
  .type-game{grid-template-columns: 1fr}
  .type-game img{
    width:100%;
    height:auto;
    aspect-ratio: 1 / 1;
    border-radius:32px;
  }
  .type-game-name{font-size:13.5px}

  /* Game details: reduce key column width so values have room */
  .page-game .spec-row{grid-template-columns: 96px minmax(0, 1fr)}
}

/* --- Small mobile (<= 320px) --- */
@media (max-width: 320px){
  /* Type tiles: smallest safe icon */
  .type-game{grid-template-columns: 1fr}
  .type-game img{
    width:100%;
    height:auto;
    aspect-ratio: 1 / 1;
    border-radius:28px;
  }
  .type-game-name{font-size:13px}

  /* Game details: stack hero to avoid cramped 2-col layout */
  .page-game .game-hero{grid-template-columns: 1fr}
  .page-game .game-hero-media{display:flex;justify-content:center}
  .page-game .game-logo{width:92px;height:92px}
  .page-game .spec-row{grid-template-columns: 88px minmax(0, 1fr)}
}

/* --- Mobile button/layout consistency (<= 425px) --- */
@media (max-width: 425px){
  /* Make common action groups stack cleanly */
  .actions{gap:10px}
  .actions .btn{width:100%}

  /* Drawer search already stacked; ensure header search remains stable */
  .header-searchbar{height:44px}

  /* Store buttons: full width and no text clipping */
  .btn-store{height:56px}
  .btn-store span{min-width:0;white-space:normal;line-height:1.2}
}

/* --- Ultra-small button/layout consistency (<= 320px) --- */
@media (max-width: 320px){
  /* Reduce excessive spacing that can push content off-screen */
  .section{padding:16px 0}
  .footer-top{padding:8px 0 6px}

  /* Ensure long headings wrap naturally */
  .game-title, .page-title h1{overflow-wrap:anywhere}
}

/* --- Mobile overflow guard (<= 768px) --- */
@media (max-width: 768px){
  html, body{
    max-width:100%;
    overflow-x:hidden;
  }
  .container{
    padding-left:max(14px, env(safe-area-inset-left));
    padding-right:max(14px, env(safe-area-inset-right));
  }
  .hot-viewport,
  .gallery{
    overscroll-behavior-x:contain; /* prevent horizontal drag from moving the page */
  }
  .game-top-layout,
  .game-after{
    min-width:0;
    overflow:hidden;
  }
  .page-game main.container{
    width:100%;
    max-width:100%;
  }
}

/* --- Game details top layout tuning (<= 768px) --- */
@media (max-width: 768px){
  /* Ensure top layout never forces side-by-side squeeze */
  .page-game .game-top-layout{grid-template-columns: 1fr;gap:14px}
  .page-game .game-hero{
    width:100%;
    max-width:100%;
    grid-column:auto;
    grid-row:auto;
  }
  .page-game .ad-card.ad-top{
    order:2;
    width:100%;
    max-width:100%;
    grid-column:auto;
    grid-row:auto;
  }
  .page-game .game-similar{
    order:3;
    width:100%;
    max-width:100%;
    position:static;
    align-self:start;
    grid-column:auto;
    grid-row:auto;
  }
  .page-game .spec-row{
    grid-template-columns:minmax(104px, 45%) 1fr;
    align-items:center;
  }
  .page-game .spec-v{
    min-width:0;
    overflow-wrap:anywhere;
    word-break:break-word;
  }
  /* Game page: Most Popular Games — 3 per row on mobile */
  .page-game .strip-row--wrap{
    display:grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap:14px;
    overflow:visible;
    padding:10px 4px 4px;
  }
  .page-game .strip-game{
    width:100%;
  }
  .page-game .strip-game img{border-radius:32px}
  .page-game main.container{
    width:100%;
    max-width:100%;
    padding-left:max(14px, env(safe-area-inset-left));
    padding-right:max(14px, env(safe-area-inset-right));
  }

  /* Similar list: keep rows from overflowing */
  .side-row-title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}

/* --- Game details top layout tuning (<= 425px) --- */
@media (max-width: 425px){
  .page-game main.container.section{padding-top:14px}

  /* Spec card: reduce padding and allow wrap */
  .spec-card{padding:12px}
  .spec-k{white-space:nowrap}
  .spec-v{min-width:0}

  /* Rating/meta chips: keep them from overflowing */
  .rating-pill{white-space:normal}
  .game-meta{gap:8px}
}

/* --- Game details top layout tuning (<= 320px) --- */
@media (max-width: 320px){
  .page-game .game-hero{padding:12px}
  .page-game .game-meta{flex-direction:column;align-items:flex-start}
  .page-game .rating-inline{align-self:flex-start}
}

/* --- Horizontal overflow hard-stop (all breakpoints) --- */
html, body{max-width:100%}
body{overflow-x:hidden}

/* Defensive: any embedded content should never exceed container */
iframe, video, canvas{max-width:100%}

/* Long words/URLs in legal pages and specs should wrap instead of overflowing */
.prose, .spec-v, .footer-lead{overflow-wrap:anywhere}

/* ============================================================
  HOME GRID + HEADER: enforce same 1-col/2-col rules as requested
  (home-hot-grid was previously using 640px rules and could be 2-col at 425)
============================================================ */

@media (max-width: 768px){
  /* Header: stack actions earlier to avoid any overflow at 768px portrait */
  .header-inner{grid-template-columns:auto minmax(0,1fr);gap:10px}
  .header-actions{grid-column:1 / -1;justify-content:stretch}

  /* Nav drawer list should be a vertical list on tablet too */
  .nav-drawer .nav-links{flex-direction:column;align-items:stretch}
  .nav-drawer .nav-links a{min-height:44px}

  /* Home hot grid must be 2 columns for 426–768 */
  .home-hot-grid{grid-template-columns: repeat(2, minmax(0, 1fr));gap:12px}
  .hot-tile-name{font-size:13px}
}

@media (max-width: 425px){
  /* Home hot grid: keep 2 columns even on small phones */
  .home-hot-grid{grid-template-columns: repeat(2, minmax(0, 1fr));gap:10px}

  /* Reduce tile chrome slightly so it fits nicely */
  .hot-tile{border-radius:22px}
  .hot-tile-name{font-size:13px}
}

@media (max-width: 320px){
  .hot-tile-name{font-size:12.5px}
}

/* ============================================================
  EXACT TARGET: 1024 × 866
  Purpose: user-requested one-off layout tuning for this resolution only.
============================================================ */

@media (width: 1024px) and (height: 866px){
  /* Add comfortable outer spacing around the whole page */
  .container{
    padding-left:max(24px, env(safe-area-inset-left));
    padding-right:max(24px, env(safe-area-inset-right));
  }

  /* Game page: title truncation config (used by JS) */
  .page-game{--game-title-max: 15;}
  .page-game{--tw-bg-opacity: 1;}

  /* Game page: keep the game name on a single line */
  .page-game .game-title{
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
    max-width:100%;
  }

  /* Header: keep search on the same line (logo + nav + search) */
  .header-inner{
    grid-template-columns: auto minmax(0, 1fr) minmax(260px, 340px);
    gap:14px;
  }
  .header-actions{
    grid-column:auto;
    justify-content:flex-end;
  }
  .header-searchbar{
    width:100%;
    max-width:340px;
  }

  /* Type page: force desktop-like grids at this exact resolution */
  .page-type .type-grid--main{grid-template-columns: repeat(9, minmax(0, 1fr))}
  .page-type .type-grid--hot{grid-template-columns: repeat(6, minmax(0, 1fr))}

  /* Game page: keep top area in ONE row (Details + Ad + Similar) */
  .page-game .game-top-layout{
    /* Make the left "details" card narrower; let the right column absorb remaining width */
    grid-template-columns: minmax(0, 360px) minmax(280px, 300px) minmax(240px, 1fr);
    gap:16px;
    align-items:start;
  }
  /* Cancel the 1120px "2-col with stacked right rail" placements */
  .page-game .game-hero{grid-column:auto;grid-row:auto}
  .page-game .ad-card.ad-top{grid-column:auto;grid-row:auto}
  .page-game .game-similar{grid-column:auto;grid-row:auto}

  /* Game page: place Safety below the rating (stars) */
  .page-game .game-meta{align-items:flex-start}
  .page-game .rating-inline{order:1}
  .page-game .meta-type{order:2}
  .page-game .meta-safe{
    order:3;
    flex:0 0 100%;
    margin-top:6px;
  }

  /* Game page: remove "card" borders everywhere */
  .page-game .game-hero,
  .page-game .spec-card,
  .page-game .sidebar-box,
  .page-game .side-row,
  .page-game .ad-card,
  .page-game .ad-inline,
  .page-game .info-item,
  .page-game .tag,
  .page-game .rating-pill,
  .page-game .get-safety,
  .page-game .gallery img{
    border:0 !important;
  }

  /* Game page: Similar games — not sticky; make list scrollable */
  .page-game .game-similar{
    position:static; /* disable sticky for 1024×866 as requested */
    padding:10px;
  }
  .page-game .game-similar .section-head.tight{
    margin-bottom:6px;
    padding-bottom:6px;
  }
  .page-game .side-stack{
    gap:4px;
    max-height:420px;
    overflow:auto;
    padding-right:4px; /* room for scrollbar */
    overscroll-behavior:contain;
  }
  .page-game .side-row{
    background-color: rgb(40 41 50 / var(--tw-bg-opacity));
    border-radius:12px;
    padding:6px 8px;
    gap:8px;
    /* Force single-line layout: logo | name (ellipsis) | rating */
    display:grid;
    grid-template-columns: 36px minmax(0, 1fr) max-content;
    align-items:center;
  }
  .page-game .side-row img{
    width:36px;
    height:36px;
    border-radius:10px;
  }
  .page-game .side-row-title{
    padding:0;
    border-radius:0;
    background:transparent;
    margin:0;
    line-height:1.2;
    min-width:0;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .page-game .side-row-rate{
    padding:0;
    border-radius:0;
    background:transparent;
    margin:0;
    margin-left:0;
    justify-self:end;
  }

  /* Game page: Most Popular Games — force 9 items per row */
  .page-game .strip-row--wrap{
    display:grid;
    grid-template-columns: repeat(9, minmax(0, 1fr));
    gap:14px;
    overflow:visible;
    padding:10px 4px 4px;
  }
  .page-game .strip-game{width:auto}

  /* Home page: Hot Games grid should be 5 items in one row */
  .home-hot-grid{grid-template-columns: repeat(5, minmax(0, 1fr))}

  /* Home page: Advertisement should be on the right side of the 3 sections */
  .home-sections-layout{
    grid-template-columns: minmax(0, 1fr) minmax(260px, 340px);
  }
  .home-sections-layout .sections{
    padding-right:8px; /* keep header link comfortably away from the ad */
  }
  .home-sections-ad{
    margin-top:0;
    margin-left:0;      /* rely on grid gap, prevents squeezing/overlap */
    align-self:stretch; /* keep full height like before */
    display:flex;
    width:100%;
    max-width:none;     /* don't clamp height/box visually; fill the grid column */
  }
  .home-sections-ad > .ad-card{
    height:100%;
  }

  /* Home page: keep "View more" on the same row (top-right) for the 3 type sections */
  .home-sections-layout .section-head{
    flex-wrap:nowrap;
    align-items:flex-start;
  }
  /* Keep "View more" away from the ad column (it's space-between, so pad the header) */
  .home-sections-layout .type-strip .section-head{
    padding-right:28px;
  }
  .home-sections-layout .section-head h2{
    min-width:0;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .home-sections-layout .section-head .link{
    flex:0 0 auto;
    white-space:nowrap;
    align-self:flex-start;
  }

  /* Home page: 3 type sections (Casual/Puzzle/Arcade)
     Make the game row a 7-column grid so "View more" aligns above the last tile,
     not at the far edge near the ad column. */
  .home-sections-layout .type-strip .strip-row{
    display:grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap:14px;
    overflow:visible;
    padding:10px 4px 4px;
  }
  .home-sections-layout .type-strip .strip-game{width:auto}
}

/* ============================================================
  NEAR TARGET: ~1024 × ~866 (tolerant)
  Reason: browser UI / scrollbars can shift the *viewport* by a few px on refresh,
  which can break exact (width/height) media queries.
  Scope: ONLY affects `type.html` (body.page-type).
============================================================ */

@media (min-width: 1000px) and (max-width: 1040px) and (min-height: 820px) and (max-height: 920px){
  .page-type{
    --type-page-size: 27;
  }
  .page-type .type-grid--main{grid-template-columns: repeat(9, minmax(0, 1fr))}
  .page-type .type-grid--hot{grid-template-columns: repeat(6, minmax(0, 1fr))}
}

@media (min-width: 1000px) and (max-width: 1040px) and (min-height: 820px) and (max-height: 920px){
  /* Game page: keep title truncation stable even if viewport is off by a few px */
  .page-game{--game-title-max: 15;}
  .page-game{--tw-bg-opacity: 1;}
}
