/* Shared header styles, used by every page */
:root {
  --bg: #eef4fc;
  --text: #2b2b2b;
  --nav: #3a3a3a;
  --gap: clamp(10px, 1.25vw, 25px);
  --radius: clamp(12px, 1.4vw, 26px);
  /* same side padding as the game grid, so everything lines up */
  --page-pad: clamp(12px, 3.1vw, 62px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  font-family: "Montserrat", system-ui, sans-serif;
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* reserved space for a top banner ad (728×90 leaderboard, 320×50 on phones) */
.ad-top {
  width: min(728px, calc(100% - 2 * var(--page-pad)));
  height: 90px;
  margin: clamp(12px, 1.6vw, 30px) auto 0;
  border: 1px dashed rgba(60, 80, 120, 0.22);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(60, 80, 120, 0.4);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

@media (max-width: 680px) {
  .ad-top { width: min(320px, calc(100% - 2 * var(--page-pad))); height: 50px; }
}

/* hidden until AdSense is approved and the ad code is in place; delete this rule to show the slot again */
.ad-top { display: none; }

header {
  --island-h: clamp(56px, 4.9vw, 97px);
  --island-r: clamp(10px, 0.9vw, 18px);
  --island-shadow: 0 6px 18px rgba(70, 100, 150, 0.12);
  --tab-pad: clamp(18px, 2.4vw, 48px);
  --tab-fs: clamp(14px, 1.6vw, 32px);
  position: relative;
  z-index: 10;
  width: 100%;
  max-width: calc(1831px + 2 * var(--page-pad));
  margin: clamp(10px, 1.3vw, 26px) auto;
  padding: 0 var(--page-pad);
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  align-items: center;
  gap: var(--gap);
}

/* every piece of the header is its own white island */
.island {
  height: var(--island-h);
  background: #fff;
  border-radius: var(--island-r);
  box-shadow: var(--island-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* the nav's links sit directly on the header grid, next to the logo */
nav { display: contents; }

/* the logo and Daily are the same kind of button ("tab"),
   each as wide as a large game tile (two grid columns) */
.logo-island,
nav a {
  grid-column: span 2;
  padding: 0 var(--tab-pad);
  font-size: var(--tab-fs);
  font-weight: 500;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: var(--nav);
  text-decoration: none;
  transition: box-shadow 0.25s ease, color 0.2s ease;
}

/* the header logo is the animated tile row (logo.gif); it fills the island, so the island gets slimmer side padding */
.logo-island { padding: 0 clamp(10px, 1.2vw, 24px); }
.logo-island picture { display: contents; }
.logo-img { display: block; width: 100%; height: auto; }

.logo { font-family: "Montserrat", system-ui, sans-serif; }

a.logo { text-decoration: none; align-self: flex-start; color: #111; font-weight: 500; letter-spacing: -0.03em; }

.logo-island:hover,
nav a:hover {
  box-shadow: 0 8px 20px rgba(70, 100, 150, 0.18);
  color: #111;
}

/* selected page: same size as the others, marked only by a soft outline and shadow */
.logo-island.selected,
nav a.selected {
  color: #111;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 8px 18px rgba(50, 70, 120, 0.14);
}

/* ---------- search: fills the rest of the top row ---------- */
.search-island {
  /* span 6 while the Daily tab is hidden; set back to span 4 when it returns */
  grid-column: span 6;
  position: relative;
  justify-content: flex-start;
  gap: clamp(10px, 0.9vw, 18px);
  padding: 0 clamp(16px, 1.6vw, 32px);
  color: #777;
  cursor: text;
  transition: box-shadow 0.2s ease;
}

.search-island:hover { box-shadow: 0 8px 20px rgba(70, 100, 150, 0.18); }
.search-island:focus-within { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35), 0 8px 18px rgba(50, 70, 120, 0.14); }

.search-island > svg {
  flex: none;
  width: clamp(18px, 1.5vw, 28px);
  height: clamp(18px, 1.5vw, 28px);
}

.search-island input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: clamp(14px, 1.2vw, 24px);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #111;
}

.search-island input::placeholder { color: #9a9a9a; }
.search-island input::-webkit-search-cancel-button { cursor: pointer; }

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  list-style: none;
  padding: 6px;
  background: #fff;
  border-radius: var(--island-r);
  box-shadow: 0 14px 34px rgba(50, 70, 120, 0.18);
  max-height: min(60vh, 420px);
  overflow-y: auto;
}

.search-results[hidden] { display: none; }

.search-results a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  color: #222;
  text-decoration: none;
  font-size: clamp(14px, 1vw, 18px);
  font-weight: 500;
}

.search-results li.active a { background: #eef2f8; }

.result-icon {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: #f1f3f6;
}

.result-icon img { width: 100%; height: 100%; display: block; }

.search-empty { padding: 12px 10px; color: #888; font-size: 14px; }

/* narrower screens: the tile grid has fewer columns, so the header goes back to a simple row */
@media (max-width: 1100px) {
  header { display: flex; }
  nav { display: flex; gap: var(--gap); }
  .logo-island, nav a { flex-shrink: 0; }
  .logo-img { width: clamp(160px, 26vw, 250px); }
  .search-island { flex: 1; min-width: 0; }
}

@media (max-width: 680px) {
  nav { display: none; }
}

/* phones: tighter padding so the tile logo and the "Search games" placeholder both fit */
@media (max-width: 480px) {
  .logo-island { padding: 0 8px; }
  .search-island { padding: 0 12px; gap: 8px; }
}

/* ---------- shared footer ---------- */
footer {
  margin-top: clamp(20px, 2.5vw, 48px);
  padding: clamp(24px, 3vw, 56px) clamp(16px, 4.6vw, 92px);
  background: #fff;
  color: #555;
  border-radius: clamp(12px, 1.4vw, 26px) clamp(12px, 1.4vw, 26px) 0 0;
  box-shadow: 0 -6px 18px rgba(70, 100, 150, 0.10);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 1.5vw, 28px);
}

.footer-logo { display: block; align-self: flex-start; width: clamp(220px, 22vw, 420px); max-width: 100%; text-decoration: none; }
.footer-logo picture { display: contents; }
.footer-logo .logo-img { width: 100%; }

.footer-text { font-size: clamp(13px, 0.9vw, 18px); max-width: 60ch; line-height: 1.6; }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px 24px;
  padding-top: clamp(14px, 1.5vw, 28px);
  border-top: 1px solid #e6ebf3;
  font-size: clamp(12px, 0.8vw, 16px);
}

.footer-left { display: flex; align-items: center; gap: 14px; }

.footer-social {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  color: var(--nav); background: #f1f4f9;
  transition: background .15s, color .15s, transform .15s;
}
.footer-social:hover { color: #fff; background: linear-gradient(45deg, #f9a03f, #e1306c 50%, #833ab4); transform: translateY(-1px); }
.footer-social + .footer-social { margin-left: -6px; }
.footer-social.tiktok:hover { background: #000; box-shadow: -2px -2px 0 #25f4ee inset, 2px 2px 0 #fe2c55 inset; }
.footer-social:focus-visible { outline: 2px solid var(--nav); outline-offset: 2px; }

.footer-links { display: flex; gap: clamp(16px, 2vw, 40px); }

.footer-links a { color: var(--nav); text-decoration: none; }
.footer-links a:hover { color: #000; text-decoration: underline; }

/* used by header.js to set the starting state instantly */
header.no-anim, header.no-anim * { transition: none !important; }
