/* ===== Baqi Games - POKI Style Light Theme ===== */

:root {
  --poki-purple: #6C47FF;
  --poki-purple-dark: #5938CC;
  --poki-purple-light: #8B6BFF;
  --poki-purple-bg: #F0EBFF;
  --poki-pink: #FF4DBC;
  --poki-blue: #4D9DFF;
  --poki-green: #2ECC71;
  --poki-orange: #FF8A3D;
  --poki-red: #FF4D4D;
  --poki-yellow: #FFC83D;
  --poki-gold: #FFB400;

  --bg: #FFFFFF;
  --bg-section: #F7F7FA;
  --bg-card: #FFFFFF;
  --bg-hover: #F0F0F5;
  --bg-elevated: #FFFFFF;

  --text: #1A1A2E;
  --text-secondary: #6B6B80;
  --text-dim: #A0A0B0;
  --text-light: #C0C0CC;

  --border: #ECECF0;
  --border-hover: #D0D0DC;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 24px rgba(108, 71, 255, 0.15);

  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  --sidebar-width: 220px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--poki-purple); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--poki-purple-dark); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D0D0DC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--poki-purple); }

/* ===== Top Bar (fixed) ===== */
.topbar {
  position: fixed;
  top: 0; left: var(--sidebar-width); right: 0;
  height: 64px;
  background: #FFFFFF;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  z-index: 1000;
  transition: box-shadow var(--transition);
}
.topbar.scrolled { box-shadow: var(--shadow-sm); }

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 24px;
  font-weight: 800;
  color: var(--poki-purple);
  letter-spacing: -0.5px;
  flex-shrink: 0;
  text-decoration: none;
}
.topbar-logo:hover { color: var(--poki-purple); }
.topbar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--poki-purple);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  color: #fff;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 44px;
  background: var(--bg-section);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text);
  transition: all var(--transition);
}
.topbar-search input::placeholder { color: var(--text-dim); }
.topbar-search input:focus {
  outline: none;
  background: #fff;
  border-color: var(--poki-purple);
  box-shadow: 0 0 0 4px rgba(108, 71, 255, 0.1);
}
.topbar-search .search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--text-dim);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Mobile search toggle */
.mobile-search-toggle {
  display: none;
  width: 40px; height: 40px;
  border: none;
  background: var(--bg-section);
  border-radius: var(--radius-sm);
  font-size: 18px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--poki-purple);
  color: #fff;
}
.btn-primary:hover {
  background: var(--poki-purple-dark);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(108, 71, 255, 0.3);
}
.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  border-color: var(--poki-purple);
  color: var(--poki-purple);
}
.btn-login {
  background: var(--poki-purple);
  color: #fff;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
}
.btn-login:hover { background: var(--poki-purple-dark); color: #fff; }

/* User avatar */
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--poki-purple);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  cursor: pointer;
}
.btn-logout {
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-logout:hover { border-color: var(--poki-red); color: var(--poki-red); }

/* Mobile search bar */
.mobile-search-bar {
  display: none;
  position: fixed;
  top: 60px; left: 0; right: 0;
  background: #fff;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  z-index: 999;
}
.mobile-search-bar.active { display: block; }
.mobile-search-bar input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  background: var(--bg-section);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 14px;
}
.mobile-search-bar input:focus { outline: none; border-color: var(--poki-purple); }
.mobile-search-bar .search-icon {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
}

/* ===== Sidebar (left, fixed) ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 20px;
  font-size: 22px;
  font-weight: 800;
  color: var(--poki-purple);
  letter-spacing: -0.5px;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo:hover { color: var(--poki-purple); }
.sidebar-logo .logo-icon {
  width: 36px; height: 36px;
  background: var(--poki-purple);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  color: #fff;
  font-weight: 800;
}
.sidebar-nav {
  padding: 12px 10px;
  flex: 1;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition);
  margin-bottom: 2px;
  text-decoration: none;
  white-space: nowrap;
}
.sidebar-item:hover {
  background: var(--poki-purple-bg);
  color: var(--poki-purple);
}
.sidebar-item.active {
  background: var(--poki-purple);
  color: #fff;
}
.sidebar-item .icon {
  width: 24px;
  text-align: center;
  font-size: 18px;
  flex-shrink: 0;
}
.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  padding: 16px 14px 6px;
}
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-footer .btn-login-side {
  display: block;
  text-align: center;
  padding: 10px 16px;
  background: var(--poki-purple);
  color: #fff;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition);
}
.sidebar-footer .btn-login-side:hover { background: var(--poki-purple-dark); color: #fff; }
.sidebar-footer .user-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer .user-box .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--poki-purple);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  flex-shrink: 0;
}
.sidebar-footer .user-box .info { flex: 1; min-width: 0; }
.sidebar-footer .user-box .info .name { font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .user-box .info .logout { font-size: 12px; color: var(--text-dim); cursor: pointer; }
.sidebar-footer .user-box .info .logout:hover { color: var(--poki-red); }

/* Mobile sidebar toggle */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 999;
}
.sidebar-overlay.active { display: block; }
.mobile-menu-btn {
  display: none;
  width: 40px; height: 40px;
  border: none;
  background: var(--bg-section);
  border-radius: var(--radius-sm);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ===== Main Content ===== */
.main-content {
  margin-top: 64px;
  margin-left: var(--sidebar-width);
}

/* ===== Hero Banner ===== */
.hero {
  position: relative;
  width: 100%;
  height: 360px;
  overflow: hidden;
  background: var(--bg-section);
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
  transition: transform 8s ease;
}
.hero:hover .hero-bg { transform: scale(1.06); }
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(255, 77, 188, 0.9);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 12px;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.hero-title {
  font-size: 42px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -1px;
  margin-bottom: 8px;
  line-height: 1.1;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}
.hero-desc {
  font-size: 16px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 20px;
  max-width: 460px;
}
.hero-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.hero-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: rgba(255,255,255,0.8);
}
.hero-meta .stars { color: var(--poki-yellow); }
.hero-play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  background: #fff;
  color: var(--text);
  border: none;
  border-radius: var(--radius-pill);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  width: fit-content;
}
.hero-play-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  color: var(--text);
}
.hero-play-btn .play-triangle {
  width: 0; height: 0;
  border-left: 14px solid var(--poki-purple);
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
}

/* ===== Category Pills ===== */
.category-bar {
  display: flex;
  gap: 8px;
  padding: 16px 0;
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.category-bar::-webkit-scrollbar { display: none; }
.cat-pill {
  padding: 8px 18px;
  border: 2px solid var(--border);
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}
.cat-pill:hover {
  border-color: var(--poki-purple);
  color: var(--poki-purple);
  background: var(--poki-purple-bg);
}
.cat-pill.active {
  background: var(--poki-purple);
  border-color: var(--poki-purple);
  color: #fff;
}

/* ===== Game Sections ===== */
.game-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 24px 28px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-head h2 {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-head .see-all {
  font-size: 14px;
  font-weight: 600;
  color: var(--poki-purple);
  cursor: pointer;
  transition: all var(--transition);
}
.section-head .see-all:hover { color: var(--poki-purple-dark); }

/* Horizontal scroll row */
.game-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.game-row::-webkit-scrollbar { display: none; }
.game-row > .game-tile {
  flex: 0 0 200px;
  scroll-snap-align: start;
}
.game-row.row-large > .game-tile {
  flex: 0 0 260px;
}

/* ===== Game Tile (POKI style - thumbnail only) ===== */
.game-tile {
  position: relative;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.game-tile-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-section);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-slow);
}
.game-tile:hover .game-tile-thumb {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}
.game-tile-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.game-tile:hover .game-tile-thumb img { transform: scale(1.08); }
.game-tile-emoji {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, var(--poki-purple-bg) 0%, #FFE0F0 100%);
}

/* Hover overlay */
.game-tile-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: var(--radius);
}
.game-tile:hover .game-tile-overlay { opacity: 1; }
.play-circle {
  width: 56px; height: 56px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0.7);
  transition: transform var(--transition);
}
.game-tile:hover .play-circle { transform: scale(1); }
.play-circle::after {
  content: '';
  width: 0; height: 0;
  border-left: 16px solid var(--poki-purple);
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  margin-left: 4px;
}

/* Title below tile */
.game-tile-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-top: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color var(--transition);
}
.game-tile:hover .game-tile-title { color: var(--poki-purple); }

/* Badges */
.tile-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
}
.tile-badge.hot { background: var(--poki-red); }
.tile-badge.new { background: var(--poki-green); }
.tile-badge.exclusive { background: var(--poki-blue); }

/* Favorite heart */
.tile-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(4px);
  border: none;
  color: var(--text-dim);
  font-size: 15px;
  cursor: pointer;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  opacity: 0;
}
.game-tile:hover .tile-fav { opacity: 1; }
.tile-fav:hover { background: #fff; transform: scale(1.15); }
.tile-fav.active { color: var(--poki-pink); opacity: 1; }

/* ===== Game Grid (all games) ===== */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 40px;
}
.games-grid .game-tile-thumb { aspect-ratio: 4/3; }

/* Load more */
.load-more-wrap {
  text-align: center;
  padding: 0 24px 48px;
  max-width: 1280px;
  margin: 0 auto;
}
.btn-load-more {
  padding: 12px 40px;
  background: var(--poki-purple-bg);
  color: var(--poki-purple);
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-load-more:hover {
  background: var(--poki-purple);
  color: #fff;
  border-color: var(--poki-purple);
}

/* No results */
.no-results {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-dim);
  font-size: 16px;
}

/* Game count badge */
.game-count {
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 500;
}

/* ===== Play Page ===== */
.play-page {
  margin-top: 64px;
  margin-left: var(--sidebar-width);
  max-width: 1280px;
  margin-right: auto;
  padding: 20px 24px;
}
.play-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
}
.play-main { min-width: 0; }

.play-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.play-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
}
.play-actions { display: flex; gap: 8px; }
.btn-icon {
  padding: 8px 14px;
  background: var(--bg-section);
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-icon:hover {
  background: var(--poki-purple-bg);
  color: var(--poki-purple);
  border-color: var(--poki-purple);
}
.btn-icon.fav-active {
  background: #FFE0F0;
  color: var(--poki-pink);
  border-color: var(--poki-pink);
}

.game-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/10;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.game-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.game-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
  color: #fff;
  z-index: 5;
}
.game-loading .spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,0.15);
  border-top-color: var(--poki-purple);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 14px;
}
.game-loading p { font-size: 14px; color: rgba(255,255,255,0.6); }
@keyframes spin { to { transform: rotate(360deg); } }

/* Play info section */
.play-info {
  margin-top: 20px;
  padding: 20px;
  background: var(--bg-section);
  border-radius: var(--radius);
}
.play-info h2 {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 10px;
  color: var(--text);
}
.play-info-meta {
  display: flex;
  gap: 20px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.play-info-meta span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--text-secondary);
}
.play-info-meta .stars { color: var(--poki-gold); }
.play-info p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.play-info .tags {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.play-info .tag {
  padding: 4px 10px;
  background: #fff;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}
.controls-box {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fff;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--poki-purple);
}
.controls-box .controls-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--poki-purple);
  margin-bottom: 4px;
}
.controls-box .controls-text {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Play sidebar */
.play-sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.sidebar-block {
  background: var(--bg-section);
  border-radius: var(--radius);
  padding: 16px;
}
.sidebar-block h3 {
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 12px;
  color: var(--text);
}
.sidebar-tile {
  display: flex;
  gap: 10px;
  padding: 6px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
  align-items: center;
}
.sidebar-tile:hover { background: #fff; }
.sidebar-tile .thumb {
  width: 56px;
  height: 42px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  flex-shrink: 0;
  background: #fff;
}
.sidebar-tile .thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.sidebar-tile .thumb .emoji {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  background: var(--poki-purple-bg);
}
.sidebar-tile .info { flex: 1; min-width: 0; }
.sidebar-tile .info h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-tile .info p {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ===== Footer ===== */
.footer {
  background: var(--bg-section);
  border-top: 1px solid var(--border);
  margin-top: 40px;
  margin-left: var(--sidebar-width);
}
.footer-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px 20px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
.footer-brand h3 {
  font-size: 20px;
  font-weight: 800;
  color: var(--poki-purple);
  margin-bottom: 8px;
}
.footer-brand p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}
.footer-col h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.footer-col a {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0;
  transition: color var(--transition);
}
.footer-col a:hover { color: var(--poki-purple); }
.footer-bottom {
  text-align: center;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
}

/* ===== 404 ===== */
.not-found {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 24px 24px;
  background: var(--bg-section);
}
.not-found .error-code {
  font-size: 100px;
  font-weight: 800;
  color: var(--poki-purple);
  line-height: 1;
  margin-bottom: 16px;
}
.not-found h1 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}
.not-found p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 15px;
}
.not-found .nf-games {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== Auth Pages ===== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-section);
  padding: 80px 24px 24px;
}
.auth-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.auth-card h2 { text-align: center; margin-bottom: 6px; color: var(--text); font-weight: 800; }
.auth-card .subtitle { text-align: center; color: var(--text-secondary); font-size: 14px; margin-bottom: 24px; }
.auth-card .switch-link { text-align: center; margin-top: 18px; font-size: 14px; color: var(--text-secondary); }
.auth-logo {
  text-align: center;
  margin-bottom: 20px;
}
.auth-logo .logo-icon {
  width: 56px; height: 56px;
  background: var(--poki-purple);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
}

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: #fff;
  color: var(--text);
  transition: all var(--transition);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none;
  border-color: var(--poki-purple);
  box-shadow: 0 0 0 3px rgba(108, 71, 255, 0.1);
}
.btn-block { width: 100%; }
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #FFF0F0; color: var(--poki-red); border: 1px solid rgba(255,77,77,0.2); }
.alert-success { background: #F0FFF4; color: var(--poki-green); border: 1px solid rgba(46,204,113,0.2); }

/* ===== Dashboard (keep minimal) ===== */
.dashboard { display: grid; grid-template-columns: 240px 1fr; gap: 24px; min-height: calc(100vh - 64px); margin-top: 64px; margin-left: var(--sidebar-width); padding: 24px; }
.dashboard .main-content { margin-top: 0; }
.dash-sidebar { background: var(--bg-section); border-radius: var(--radius); padding: 12px; height: fit-content; }
.dash-sidebar .menu-item { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; font-weight: 600; color: var(--text-secondary); transition: all var(--transition); margin-bottom: 2px; text-decoration: none; }
.dash-sidebar .menu-item:hover, .dash-sidebar .menu-item.active { background: var(--poki-purple); color: #fff; }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card-title { font-size: 18px; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card .label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-card .value { font-size: 26px; font-weight: 800; color: var(--text); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 10px 14px; background: var(--bg-section); font-weight: 700; color: var(--text); border-bottom: 1px solid var(--border); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.badge { display: inline-block; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 12px; font-weight: 600; }
.badge-admin { background: var(--poki-purple-bg); color: var(--poki-purple); }
.badge-active { background: #E6FAF0; color: var(--poki-green); }

/* ===== Animations ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeInUp 0.4s ease; }

/* ===== No Sidebar (auth pages, etc.) ===== */
body.no-sidebar .topbar { left: 0; }
body.no-sidebar .main-content,
body.no-sidebar .play-page,
body.no-sidebar .footer,
body.no-sidebar .dashboard { margin-left: 0; }
body.no-sidebar .mobile-menu-btn { display: none; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 0px; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { left: 0; padding: 0 16px; }
  .mobile-menu-btn { display: flex; }
  .main-content { margin-left: 0; }
  .play-layout { grid-template-columns: 1fr; }
  .play-sidebar { display: none; }
  .footer-content { grid-template-columns: 1fr 1fr; }
  .hero-title { font-size: 34px; }
}
@media (max-width: 768px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-search { display: none; }
  .topbar-logo { font-size: 20px; }
  .topbar-logo .logo-icon { width: 32px; height: 32px; font-size: 16px; }
  .mobile-search-toggle { display: flex; }
  .hero { height: 260px; }
  .hero-title { font-size: 26px; }
  .hero-desc { font-size: 14px; }
  .hero-meta { gap: 10px; }
  .hero-meta span { font-size: 12px; }
  .hero-play-btn { padding: 12px 28px; font-size: 14px; }
  .category-bar { padding: 12px 16px; }
  .cat-pill { padding: 6px 14px; font-size: 13px; }
  .game-section { padding: 8px 16px 24px; }
  .section-head h2 { font-size: 18px; }
  .game-row > .game-tile { flex: 0 0 150px; }
  .game-row.row-large > .game-tile { flex: 0 0 200px; }
  .game-tile-emoji { font-size: 36px; }
  .games-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; padding: 0 16px 32px; }
  .play-page { padding: 16px 16px; }
  .play-header h1 { font-size: 18px; }
  .game-frame-wrap { aspect-ratio: 4/3; }
  .footer-content { grid-template-columns: 1fr; gap: 16px; padding: 24px 16px 16px; }
  .tile-fav { opacity: 1; }
  .dashboard { grid-template-columns: 1fr; padding: 16px; }
}

@media (max-width: 480px) {
  .hero { height: 220px; }
  .hero-title { font-size: 22px; }
  .hero-desc { display: none; }
  .hero-meta { display: none; }
  .games-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .game-row > .game-tile { flex: 0 0 130px; }
  .game-tile-title { font-size: 12px; }
  .btn-icon span { display: none; }
}
