/* Pindi Smash — platform layer. Loads after site.css and builds on its tokens
   (--bg, --text, --dim, --line, --accent). Styles the game-page shell, the
   branded loader, the player toolbar, game tiles, and horizontal rails. The
   game canvas + .game-frame sizing are inherited from site.css, untouched. */

:root {
  --radius-tile: 16px;
  --radius-card: 14px;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-2: rgba(255, 255, 255, 0.06);
  --sidebar-w: 212px;
}

/* ---- Skip link ---------------------------------------------------------- */
.skip-link {
  position: fixed; top: 8px; left: 8px; z-index: 200;
  background: var(--accent); color: #1a1408; font-weight: 700;
  padding: 10px 14px; border-radius: 8px; transform: translateY(-150%);
  transition: transform 0.15s ease;
}
.skip-link:focus { transform: none; text-decoration: none; }

/* ---- Persistent sidebar (desktop) --------------------------------------- */
.sidebar {
  position: fixed; top: 0; left: 0; z-index: 50;
  width: var(--sidebar-w); height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  background: #080b12; border-right: 1px solid var(--line);
}
.side-brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); padding: 4px 8px 14px; }
.side-brand:hover { text-decoration: none; }
.side-brand .brand-name { font-family: Anton, sans-serif; font-size: 20px; letter-spacing: 0.5px; }
.logo-mark { flex-shrink: 0; border-radius: 50%; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-head {
  margin: 14px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--faint);
}
.nav-link {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--dim); cursor: pointer;
  padding: 9px 10px; border-radius: 9px; border: 0; background: transparent;
}
.nav-link:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav-link.is-active, .nav-link[aria-current="page"] { color: var(--text); background: var(--surface-2); }
.nav-link svg { flex-shrink: 0; color: var(--dim); }
.nav-cat { font-weight: 500; padding-left: 12px; }

/* ---- Mobile top bar ----------------------------------------------------- */
.topbar { display: none; }

/* ---- Content offset for the fixed sidebar ------------------------------- */
/* Pad the body (not main) so a page's own `.home{margin:0 auto}` can't override
   the offset on specificity. The fixed sidebar sits in the padding gutter. */
@media (min-width: 880px) {
  body { padding-left: var(--sidebar-w); }
}
@media (max-width: 879.98px) {
  .sidebar { display: none; }
  .topbar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 16px calc(10px); padding-top: calc(10px + env(safe-area-inset-top, 0px));
    background: rgba(8, 11, 18, 0.92); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .topbar .side-brand { padding: 0; }
  .topbar-search {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
    color: var(--text); background: var(--surface-2); border: 1px solid var(--line);
  }
}

/* ---- Search overlay ----------------------------------------------------- */
.search-overlay[hidden] { display: none; }
.search-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: rgba(5, 7, 13, 0.82); backdrop-filter: blur(6px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: clamp(16px, 6vh, 80px) 16px 24px; overflow-y: auto;
}
.search-panel {
  width: 100%; max-width: 760px;
  background: #0c1017; border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
.search-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px;
  color: var(--dim);
}
.search-bar input {
  flex: 1; min-width: 0; font: inherit; font-size: 16px; color: var(--text);
  background: transparent; border: 0; outline: none;
}
.search-close {
  font-size: 15px; color: var(--dim); background: transparent; border: 0; cursor: pointer;
  width: 30px; height: 30px; border-radius: 8px;
}
.search-close:hover { color: var(--text); background: var(--surface-2); }
.search-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 2px 4px; }
.search-chips .chip { cursor: pointer; background: transparent; }
.search-heading { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); margin: 16px 2px 10px; }
.search-empty { color: var(--dim); padding: 8px 2px 4px; }

/* ---- Game page layout --------------------------------------------------- */
.game-page { max-width: 1040px; margin: 0 auto; padding: 0 20px 8px; }

.breadcrumb {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 16px 2px 4px; font-size: 13px; color: var(--dim);
}
.breadcrumb a { color: var(--dim); }
.breadcrumb a:hover { color: var(--text); text-decoration: none; }
.breadcrumb span { color: var(--faint); }

.player { display: flex; flex-direction: column; align-items: center; padding: 8px 0 4px; }

/* Player frame — reuses .game-frame from site.css for the 9:16 box; we only add
   the loading overlay and a slightly larger cap on the game page. */
.game-page .game-frame { max-width: min(430px, 72vh); }

.game-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center;
  background: radial-gradient(120% 90% at 50% 30%, #12284a 0%, #0a1426 70%);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}
.game-loading.is-hidden { opacity: 0; visibility: hidden; }
.gl-icon { width: 104px; height: 104px; border-radius: 22px; box-shadow: 0 10px 30px rgba(0,0,0,0.45); }
.gl-title { font-family: Anton, sans-serif; font-size: 22px; letter-spacing: 0.5px; margin-top: 4px; }
.gl-bar { width: 180px; max-width: 70%; height: 6px; border-radius: 99px; background: rgba(255,255,255,0.12); overflow: hidden; }
.gl-fill { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--accent); transition: width 0.15s ease; }
.gl-pct { font-size: 13px; font-weight: 600; color: var(--dim); }
.gl-tip { font-size: 13px; color: var(--faint); min-height: 1.2em; }

/* ---- Player toolbar (meta + actions) ------------------------------------ */
.player-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; max-width: min(430px, 72vh); margin: 10px auto 0;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface);
}
.pt-meta { display: flex; flex-direction: column; min-width: 0; }
.pt-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt-dev { font-size: 12px; color: var(--dim); }
.pt-actions { display: flex; gap: 8px; flex-shrink: 0; }
.pt-btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text);
  padding: 8px 12px; border-radius: 9px; border: 1px solid var(--line-strong);
  background: transparent; transition: border-color 0.16s ease, background-color 0.16s ease;
}
.pt-btn:hover { border-color: var(--text); background: var(--surface-2); }

/* ---- Tiles (cards) ------------------------------------------------------ */
.tile {
  position: relative; display: block; overflow: hidden;
  border-radius: var(--radius-tile); background: var(--surface-2);
  aspect-ratio: 1 / 1; outline: 1px solid var(--line);
  transition: transform 0.16s ease, outline-color 0.16s ease, box-shadow 0.16s ease;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-3px); outline-color: var(--tile-accent, var(--accent));
  box-shadow: 0 12px 28px rgba(0,0,0,0.4); text-decoration: none;
}
.tile-art { width: 100%; height: 100%; object-fit: cover; display: block; }
.tile-label {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px;
  background: linear-gradient(to top, rgba(5,7,15,0.9), rgba(5,7,15,0));
  opacity: 0; transform: translateY(6px); transition: opacity 0.16s ease, transform 0.16s ease;
}
.tile:hover .tile-label, .tile:focus-visible .tile-label { opacity: 1; transform: none; }
.tile-name { font-weight: 700; font-size: 14px; color: #fff; }
.tile--featured { grid-column: span 2; grid-row: span 2; aspect-ratio: 1 / 1; }

/* ---- Horizontal rail ---------------------------------------------------- */
.rail { margin: 22px 0 8px; }
.rail-head { font-size: 18px; margin: 0 0 12px; }
.rail-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 14px;
  overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.rail-track .tile { scroll-snap-align: start; }

/* ---- Game SEO prose ----------------------------------------------------- */
.game-prose { max-width: 760px; margin: 26px auto 0; }
.game-prose h1 { margin-bottom: 4px; }
.game-prose .lede { margin-top: 0; font-size: 15px; }
.game-prose h2 { font-size: 20px; margin-top: 30px; }
.game-prose p { color: var(--dim); }
.howto { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.howto li { display: grid; grid-template-columns: 120px 1fr; gap: 12px; align-items: start; }
.howto .k {
  font-weight: 600; font-size: 13px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 8px; padding: 6px 8px; text-align: center;
}
.howto .t { color: var(--dim); font-size: 14px; }
@media (max-width: 480px) {
  .howto li { grid-template-columns: 1fr; gap: 4px; }
  .howto .k { justify-self: start; }
}
.catchips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.chip {
  font-size: 12px; font-weight: 600; color: var(--dim);
  padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line-strong);
}
.chip:hover { color: var(--text); border-color: var(--text); text-decoration: none; }

/* ---- Homepage ----------------------------------------------------------- */
.home, .category-page { max-width: 1120px; margin: 0 auto; padding: 0 24px 48px; }
.eyebrow {
  color: var(--dim); font-weight: 600; letter-spacing: 2px;
  text-transform: uppercase; font-size: 12px; margin: 0 0 10px;
}

/* Featured game banner — leads the homepage so a game (not a text hero) is
   the first thing seen, and the layout fills the full width. */
.feature {
  display: grid; grid-template-columns: minmax(0, 360px) 1fr; gap: 30px;
  align-items: center; margin: 26px 0 8px; padding: 22px;
  border: 1px solid var(--line); border-radius: 22px;
  background:
    radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--tile-accent, #ffb529) 13%, transparent), transparent 58%),
    var(--surface);
}
.feature-art {
  position: relative; display: block; border-radius: 16px; overflow: hidden;
  aspect-ratio: 1 / 1; outline: 1px solid var(--line);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.feature-art:hover { transform: translateY(-3px); box-shadow: 0 16px 40px rgba(0,0,0,0.45); text-decoration: none; }
.feature-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.feature-tagpill {
  position: absolute; top: 12px; left: 12px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase;
  color: #1a1408; background: var(--accent); padding: 4px 10px; border-radius: 99px;
}
.feature-body { min-width: 0; }
.feature-body h1 { margin: 0 0 8px; }
.feature-tag { font-size: 18px; color: var(--text); margin: 0 0 8px; font-weight: 600; }
.feature-about { color: var(--dim); font-size: 15px; max-width: 48ch; margin: 0 0 18px; }
.feature-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.feature-meta { font-size: 13px; color: var(--faint); }
.feature-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
@media (max-width: 720px) {
  .feature { grid-template-columns: 1fr; gap: 18px; padding: 16px; }
  .feature-art { width: 100%; max-width: 440px; margin: 0 auto; }
}

.cat-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin: 24px 0 6px; }
.browse-label { font-size: 12px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--faint); margin-right: 4px; }
.section-title { font-size: 20px; margin: 28px 0 14px; }
.section-note { color: var(--faint); font-size: 14px; margin: -8px 0 14px; }

/* Free cricket tools — a real, useful highlight band. */
.tools-feature {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin: 30px 0 8px; padding: 20px 22px;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface);
}
.tf-icon {
  flex-shrink: 0; width: 56px; height: 56px; border-radius: 14px;
  display: grid; place-items: center; color: #cdbcff;
  background: radial-gradient(120% 100% at 50% 0%, #2a2350 0%, #141026 100%);
}
.tf-body { flex: 1; min-width: 200px; }
.tf-body h2 { font-size: 18px; margin: 0 0 4px; }
.tf-body p { margin: 0; font-size: 14px; }
.tf-cta { flex-shrink: 0; }

/* Mosaic grid (used by category pages, search results, and coming-soon). */
.mosaic {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.mosaic .tile { aspect-ratio: 1 / 1; }

/* Coming-soon placeholder tile (NOT a link, clearly marked). */
.tile--soon { cursor: default; outline-color: var(--line); opacity: 0.92; }
.tile--soon:hover { transform: none; box-shadow: none; outline-color: var(--line); }
.soon-art {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 16px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--tile-accent) 26%, #0c1119), #0c1119);
}
.soon-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: #0c1119; background: var(--tile-accent); padding: 4px 9px; border-radius: 99px;
}
.soon-name { font-weight: 700; font-size: 15px; color: rgba(255,255,255,0.86); }
.mosaic--soon { opacity: 0.95; }

/* ---- Category page ------------------------------------------------------ */
.category-page { padding-top: 6px; }
.category-page h1 { margin: 10px 0 4px; }
.category-page .breadcrumb { padding-left: 0; }
.category-page .mosaic { margin-top: 18px; }

/* ---- Reduced motion ----------------------------------------------------- */
/* Honour the OS "reduce motion" setting. The game itself renders on canvas via
   JS, so its animation is unaffected; this only calms CSS transitions and the
   tile/loader/button motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
