/* ==============================
   KOLI GAMES - Poki-Style Design
   ============================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;500;600;700;800;900&display=swap');

/* === CSS Variables === */
:root {
  /* Poki teal/cyan color palette */
  --bg-page: #20c2d4;
  --bg-gradient-top: #0fb8cc;
  --bg-gradient-mid: #24cce0;
  --bg-gradient-bottom: #1abcd0;

  --white: #ffffff;
  --white-soft: #f5fbfc;
  --black: #000000;

  /* Nav island */
  --nav-island-bg: #ffffff;
  --nav-island-radius: 22px;

  /* Sidebar/left nav */
  --sidebar-bg: rgba(255,255,255,0.18);
  --sidebar-active: #ffffff;
  --sidebar-width: 196px;

  /* Game cards */
  --card-radius: 10px;
  --card-shadow: 0 2px 6px rgba(0,0,0,0.22);
  --card-shadow-hover: 0 6px 20px rgba(0,0,0,0.35);

  /* Text */
  --text-dark: #1a1a2e;
  --text-medium: #3a3a5c;
  --text-light: #ffffff;
  --text-muted: rgba(255,255,255,0.7);

  /* Accent */
  --accent: #0fb0c4;
  --accent-dark: #0897aa;

  /* Sizing */
  --nav-height: 60px;
  --left-col-width: 196px;
  --card-gap: 10px;

  --font-main: 'Nunito', 'Segoe UI', sans-serif;

  --transition-fast: 0.15s ease;
  --transition-med: 0.22s ease;
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-main);
  background: var(--bg-page);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
  color: var(--text-dark);
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; border: none; outline: none; background: none; }
input { font-family: inherit; outline: none; border: none; background: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* === Scrollbar === */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.4); border-radius: 99px; }

/* Sidebar scrollbar - slight visibility */
.left-col::-webkit-scrollbar { display: block; width: 3px; }
.left-col { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.3) transparent; }

/* ==============================
   GEOMETRIC BACKGROUND PATTERN
   ============================== */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.08) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(0,0,0,0.06) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* SVG pattern overlay */
.bg-pattern {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.12;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpolygon points='0,0 20,0 0,20' fill='white'/%3E%3Crect x='40' y='10' width='8' height='8' fill='white' opacity='0.6'/%3E%3Ccircle cx='60' cy='60' r='4' fill='white' opacity='0.5'/%3E%3Cpolygon points='70,30 80,30 80,40 70,40' fill='white' opacity='0.4'/%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* ==============================
   PAGE LAYOUT
   ============================== */
.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--left-col-width) 1fr;
  min-height: 100vh;
}

/* ── Left Sidebar Column ── */
.left-col {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 10px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.3) transparent;
  flex-shrink: 0;
}

.left-col::-webkit-scrollbar { width: 3px; }
.left-col::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 99px; }

/* Poki logo island */
.poki-logo-island {
  background: var(--white);
  border-radius: var(--nav-island-radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
  margin-bottom: 4px;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--text-dark);
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0fb8cc, #0897aa);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
  font-family: var(--font-main);
  letter-spacing: -0.02em;
  user-select: none;
}

.logo-text { color: var(--text-dark); }

.logo-island-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* island-icon-btn removed - was causing overlap with logo text */

/* Search island */
.search-island {
  background: #ffffff;
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 3px 12px rgba(0,0,0,0.18);
  border: 1.5px solid rgba(255,255,255,0.9);
  transition: var(--transition-fast);
}

.search-island:focus-within,
.search-island:hover { box-shadow: 0 5px 16px rgba(0,0,0,0.22); }

.search-island input {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  color: #1a1a2e;
  min-width: 0;
  background: transparent;
}

.search-island input::placeholder { color: #999; font-weight: 500; }
.search-island-icon { color: #999; font-size: 0.95rem; flex-shrink: 0; }

/* Nav category items */
.left-nav-section {
  margin-top: 4px;
}

.left-nav-label {
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.6);
  padding: 6px 10px 4px;
}

.left-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 0.875rem;
  font-weight: 700;
  color: rgba(255,255,255,0.9);
  transition: var(--transition-fast);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.left-nav-item:hover,
.left-nav-item.active {
  background: rgba(255,255,255,0.22);
  color: #fff;
}

.left-nav-item .nav-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── Main Content Area ── */
.main-content {
  padding: 12px 12px 40px 0;
  min-width: 0;
}

/* ==============================
   CRAZYGAMES-STYLE HORIZONTAL CAROUSELS
   ============================== */

/* Outer wrapper - position relative for arrow buttons */
.carousel-wrap {
  position: relative;
  margin: 0;
}

/* The scrollable track */
.carousel-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 6px 0 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

/* Arrow navigation buttons */
.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 20;
  transition: background 0.15s ease, transform 0.15s ease;
  backdrop-filter: blur(4px);
  line-height: 1;
  margin-top: -4px; /* compensate for track padding */
}
.carousel-btn:hover {
  background: rgba(0,0,0,0.8);
  transform: translateY(-50%) scale(1.1);
}
.carousel-btn--prev { left: 0; }
.carousel-btn--next { right: 0; }
.carousel-btn.hidden { display: none; }

/* Cat-strip wrapper (for arrows) */
.cat-strip-wrap {
  position: relative;
  margin-bottom: 18px;
}

/* ── Game Card (landscape, CrazyGames default) ── */
.game-card {
  flex: 0 0 auto;
  width: 405px;
  height: 270px; /* 3:2 ratio, 50% bigger */
  border-radius: var(--card-radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-med), box-shadow var(--transition-med);
  position: relative;
  background: #b0d8dc;
  box-shadow: var(--card-shadow);
  display: block;
  text-decoration: none;
}

/* Portrait variant */
.game-card--portrait {
  width: 203px;
  height: 270px;
}

.game-card:hover {
  transform: scale(1.05) translateZ(0);
  box-shadow: var(--card-shadow-hover);
  z-index: 10;
}

.game-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity var(--transition-med);
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* Video preview on hover */
.game-card-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: 2;
}

.game-card:hover .game-card-video {
  opacity: 1;
}

.game-card:hover .game-card-img {
  opacity: 0;
}

/* CrazyGames-style badge (top-left pill) */
.card-new-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
  z-index: 5;
}

.card-hot-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  backdrop-filter: blur(4px);
  z-index: 5;
}

/* Card title - hidden by default, gradient reveal on hover (CrazyGames style) */
.game-card-title-bar {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 22px 8px 7px;
  background: linear-gradient(transparent, rgba(0,0,0,0.80));
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0;
  transition: opacity var(--transition-med);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  z-index: 4;
  letter-spacing: 0.01em;
}

.game-card:hover .game-card-title-bar { opacity: 1; }

/* ==============================
   SECTION HEADERS
   ============================== */
.section-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.25);
  backdrop-filter: blur(6px);
  border-radius: 99px;
  padding: 7px 16px 7px 10px;
  font-size: 0.875rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 10px;
  border: 1.5px solid rgba(255,255,255,0.35);
}

.section-pill .section-icon { font-size: 1rem; }

/* ==============================
   CATEGORY CARDS (Poki style)
   ============================== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}

.category-card {
  background: var(--white);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform var(--transition-med), box-shadow var(--transition-med);
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.category-card:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 20px rgba(0,0,0,0.16);
}

.category-card-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}

.category-card-label {
  font-size: 0.875rem;
  font-weight: 800;
  color: var(--text-dark);
  line-height: 1.2;
  word-break: break-word;  /* let long names wrap */
}

/* ==============================
   SECTION SPACER
   ============================== */
.grid-section {
  margin-bottom: 24px;
}

/* ==============================
   LOAD MORE / SHOW MORE
   ============================== */
.show-more-row {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.btn-show-more {
  background: rgba(255,255,255,0.25);
  border: 2px solid rgba(255,255,255,0.5);
  border-radius: 99px;
  padding: 10px 32px;
  font-size: 0.875rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  transition: var(--transition-med);
  backdrop-filter: blur(6px);
}

.btn-show-more:hover {
  background: rgba(255,255,255,0.38);
  transform: translateY(-2px);
}

/* ==============================
   MOBILE TOP BAR (replaces left col)
   ============================== */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  padding: 10px 16px;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.12);
}

.mobile-topbar .logo-link { font-size: 1.1rem; }

.mobile-search-btn {
  width: 36px;
  height: 36px;
  background: #f0f0f5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  font-size: 1rem;
  cursor: pointer;
}

.mobile-hamburger {
  width: 36px;
  height: 36px;
  background: #f0f0f5;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.mobile-hamburger span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text-dark);
  border-radius: 2px;
}

/* ==============================
   CATEGORY STRIP (horizontal scroll bar)
   ============================== */
.cat-strip {
  display: flex;
  flex-direction: row;
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 4px 2px 10px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.cat-strip::-webkit-scrollbar { display: none; }

.cat-strip-card {
  flex: 0 0 auto;
  min-width: 140px;
  height: 80px;
  border-radius: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 10px 12px;
  cursor: pointer;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-med), box-shadow var(--transition-med);
  box-shadow: 0 3px 10px rgba(0,0,0,0.25);
}

.cat-strip-card:hover {
  transform: translateY(-3px) scale(1.04);
  box-shadow: 0 6px 20px rgba(0,0,0,0.35);
}

.cat-strip-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, rgba(0,0,0,0.2) 100%);
  pointer-events: none;
}

.cat-strip-card-label {
  font-size: 0.82rem;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
  line-height: 1.2;
  z-index: 1;
  max-width: 70%;
  letter-spacing: 0.01em;
}

.cat-strip-card-icon {
  font-size: 1.6rem;
  z-index: 1;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.3));
  flex-shrink: 0;
}

/* Mobile Drawer */
.mobile-drawer {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 240px;
  height: 100vh;
  background: var(--bg-page);
  z-index: 200;
  padding: 20px 12px;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  box-shadow: 4px 0 20px rgba(0,0,0,0.2);
  transform: translateX(-100%);
  transition: transform var(--transition-med);
}

/* Fix: must set display:flex AND slide in when open */
.mobile-drawer.open {
  display: flex;
  transform: translateX(0);
}

.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
}

.drawer-overlay.show { display: block; }

/* ==============================
   SKELETON
   ============================== */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.2) 25%, rgba(255,255,255,0.35) 50%, rgba(255,255,255,0.2) 75%);
  background-size: 800px 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--card-radius);
}

/* ==============================
   UTILITIES
   ============================== */
.hidden { display: none !important; }

/* ==============================
   SEARCH HERO (used on search.html)
   ============================== */
.search-hero-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 99px;
  padding: 10px 10px 10px 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-width: 560px;
  transition: box-shadow 0.2s ease;
}

.search-hero-form:focus-within {
  box-shadow: 0 6px 28px rgba(0,0,0,0.18);
}

.search-hero-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #1a1a2e;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font-main);
  min-width: 0;
}

.search-hero-input::placeholder { color: #aaa; }

.search-hero-btn {
  padding: 9px 22px;
  background: var(--accent);
  border-radius: 99px;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 800;
  flex-shrink: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  font-family: var(--font-main);
  border: none;
  cursor: pointer;
}

.search-hero-btn:hover { opacity: 0.9; transform: scale(1.03); }

/* ==============================
   FOOTER
   ============================== */
.site-footer {
  background: rgba(0,0,0,0.15);
  border-radius: 20px;
  padding: 24px;
  margin: 16px 0 0;
  backdrop-filter: blur(8px);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin-bottom: 12px;
}

.footer-links a {
  font-size: 0.8rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  transition: var(--transition-fast);
}

.footer-links a:hover { color: #fff; }

.footer-copy {
  font-size: 0.75rem;
  color: rgba(255,255,255,0.5);
}

/* ==============================
   MORE GAMES GRID
   ============================== */
.more-games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

/* Cards inside the more grid fill their cell with 3:2 ratio */
.more-games-grid .game-card,
.more-games-grid .mgrid-card {
  flex: none;
  width: 100%;
  height: 0;
  padding-bottom: 66.66%;
  position: relative;
}

.more-games-grid .game-card .game-card-img,
.more-games-grid .game-card .game-card-video,
.more-games-grid .mgrid-card .game-card-img,
.more-games-grid .mgrid-card .game-card-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==============================
   MOBILE SEARCH OVERLAY
   ============================== */
.mobile-search-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,0.5);
  padding: 70px 16px 20px;
  backdrop-filter: blur(4px);
}
.mobile-search-overlay.open { display: block; }
.mobile-search-overlay-inner {
  background: #fff;
  border-radius: 16px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mobile-search-overlay input {
  flex: 1;
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  font-family: var(--font-main);
  outline: none;
  border: none;
}
.mobile-search-overlay-close {
  font-size: 1.3rem;
  cursor: pointer;
  color: #999;
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (max-width: 1100px) {
  .game-card { width: 330px; height: 220px; }
}

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .left-col { display: none; }
  .mobile-topbar { display: flex; }
  .main-content { padding: 12px 12px 40px; }
  .game-card { width: 240px; height: 160px; }
  .game-card--portrait { width: 129px; height: 173px; }
  .carousel-btn { width: 28px; height: 28px; font-size: 0.85rem; }
  .cat-strip { gap: 8px; }
  .cat-strip-card { min-width: 130px; height: 72px; }
  .more-games-grid {
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 10px;
  }
  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
  .footer-links { gap: 5px 14px; }
}

@media (max-width: 480px) {
  .game-card { width: 195px; height: 130px; }
  .game-card--portrait { width: 105px; height: 140px; }
  .cat-strip-card { min-width: 110px; height: 62px; }
  .more-games-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
  }
  .category-grid {
    /* 2 columns on small phones so labels are never clipped */
    grid-template-columns: repeat(2, 1fr);
  }
  .category-card {
    padding: 10px 12px;
    gap: 10px;
  }
  .category-card-icon { font-size: 1.3rem; }
  .section-pill { font-size: 0.78rem; }
  .btn-show-more { padding: 10px 20px; font-size: 0.8rem; }
  .poki-logo-island { padding: 10px 12px; }
}


