/* ========================================================
   MyLittleGames - Global Retro-Cartoon Stylesheet
   Chunky, bouncy, hand-crafted playful arcade feel
   ======================================================== */

:root {
  --bg-color: #fcf6ea;
  --bg-pattern: #f3e8cf;
  --panel-bg: #ffffff;
  --ink-color: #2b2438;
  --primary-yellow: #ffdf40;
  --primary-coral: #ff5f6d;
  --primary-mint: #32d6a4;
  --primary-sky: #4fc3f7;
  --primary-purple: #a855f7;
  --primary-orange: #ff9f1c;

  --border-thick: 3.5px solid var(--ink-color);
  --border-medium: 2.5px solid var(--ink-color);
  --border-thin: 2px solid var(--ink-color);

  --shadow-chunky: 4px 5px 0px var(--ink-color);
  --shadow-chunky-hover: 6px 7px 0px var(--ink-color);
  --shadow-chunky-active: 1px 2px 0px var(--ink-color);
  --shadow-chunky-big: 6px 8px 0px var(--ink-color);

  --radius-chunky: 18px;
  --radius-pill: 999px;
  --radius-card: 22px;

  --font-display: 'Fredoka', 'Lilita One', 'Comic Sans MS', cursive, system-ui, sans-serif;
  --font-body: 'Fredoka', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Base Reset & Polka Background */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  font-weight: 500;
  color: var(--ink-color);
  background-color: var(--bg-color);
  background-image: radial-gradient(var(--bg-pattern) 15%, transparent 16%);
  background-size: 24px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.4;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* Top Navigation Bar */
.site-header {
  background: #ffffff;
  border-bottom: var(--border-thick);
  padding: 12px 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 10px rgba(43, 36, 56, 0.05);
}

.header-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.6rem;
  letter-spacing: -0.5px;
  color: var(--ink-color);
  transition: transform 0.15s ease;
  user-select: none;
}

.logo:hover {
  transform: rotate(-2deg) scale(1.03);
}

.logo-badge {
  background: var(--primary-yellow);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: var(--border-thick);
  box-shadow: var(--shadow-chunky);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  animation: wiggle 4s ease-in-out infinite;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Sound Mute Toggle */
.sound-btn {
  background: #fff;
  border: var(--border-medium);
  box-shadow: var(--shadow-chunky);
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.sound-btn:hover {
  transform: translate(-1px, -2px);
  box-shadow: var(--shadow-chunky-hover);
  background: #fffbe6;
}

.sound-btn:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-chunky-active);
}

.nav-pill {
  background: var(--primary-sky);
  color: var(--ink-color);
  border: var(--border-medium);
  box-shadow: var(--shadow-chunky);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-weight: 700;
  font-size: 0.95rem;
  transition: all 0.1s ease;
}

.nav-pill:hover {
  transform: translate(-1px, -2px);
  box-shadow: var(--shadow-chunky-hover);
  background: #7bd5ff;
}

.nav-pill:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-chunky-active);
}

/* Ad Placement Slots (Stylized & Compliant for Google AdSense) */
.ad-banner-slot {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  margin: 16px auto;
  padding: 8px;
  background: #fff9e6;
  border: 2px dashed #d1c5a9;
  border-radius: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8c826b;
  font-size: 0.8rem;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}

.ad-banner-slot::before {
  content: 'SPONSORED / ADVERTISEMENT';
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #b5a88c;
  margin-bottom: 4px;
  display: block;
}

.ad-rectangle-slot {
  width: 300px;
  min-height: 250px;
  margin: 12px auto;
  padding: 10px;
  background: #fff9e6;
  border: 2px dashed #d1c5a9;
  border-radius: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #8c826b;
  font-size: 0.8rem;
  font-weight: 600;
}

.ad-rectangle-slot::before {
  content: 'ADVERTISEMENT';
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: #b5a88c;
  margin-bottom: 6px;
  display: block;
}

/* Main Layout */
.main-wrapper {
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* Hero Section */
.hero-banner {
  background: linear-gradient(135deg, #fff7cd 0%, #ffe3ec 100%);
  border: var(--border-thick);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-chunky-big);
  padding: 36px 30px;
  text-align: center;
  margin-bottom: 36px;
  position: relative;
  overflow: hidden;
}

.hero-banner::after {
  content: '★ ✦ ★';
  position: absolute;
  right: 20px;
  top: 15px;
  font-size: 1.4rem;
  color: var(--primary-orange);
  opacity: 0.7;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 900;
  letter-spacing: -1px;
  line-height: 1.15;
  margin-bottom: 12px;
  text-shadow: 2px 2px 0 #ffffff;
}

.hero-subtitle {
  font-size: 1.15rem;
  font-weight: 600;
  color: #4b3e5c;
  max-width: 620px;
  margin: 0 auto 20px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: var(--border-thin);
  background: #fff;
  font-weight: 700;
  font-size: 0.85rem;
}

/* Games Grid */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.8rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 10px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 28px;
  margin-bottom: 40px;
}

/* Cartoon Game Card */
.game-card {
  background: var(--panel-bg);
  border: var(--border-thick);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-chunky);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.18s ease;
  position: relative;
  text-decoration: none;
}

.game-card:hover {
  transform: translateY(-6px) scale(1.01);
  box-shadow: var(--shadow-chunky-hover);
}

.game-card:active {
  transform: translateY(2px);
  box-shadow: var(--shadow-chunky-active);
}

.game-card-thumb {
  height: 170px;
  width: 100%;
  border-bottom: var(--border-thick);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  user-select: none;
}

/* Card Artwork Themes */
.card-theme-snack {
  background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
}
.card-theme-cloud {
  background: linear-gradient(135deg, #bae6fd 0%, #7dd3fc 100%);
}
.card-theme-dino {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
}
.card-theme-wordle {
  background: linear-gradient(135deg, #fbcfe8 0%, #f472b6 100%);
}

.game-card-art {
  font-size: 4.8rem;
  filter: drop-shadow(0 4px 0 rgba(0,0,0,0.15));
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-card:hover .game-card-art {
  transform: scale(1.15) rotate(-5deg);
}

.game-card-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 4px 10px;
  background: #ffffff;
  border: var(--border-thin);
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 800;
  box-shadow: 2px 2px 0 var(--ink-color);
}

.game-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-card-title {
  font-size: 1.35rem;
  font-weight: 900;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.game-card-desc {
  font-size: 0.92rem;
  color: #5d536b;
  margin-bottom: 16px;
  line-height: 1.4;
  flex: 1;
}

.game-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 12px;
  border-top: 2px dashed #ece5d6;
}

.card-play-btn {
  background: var(--primary-yellow);
  border: var(--border-thin);
  box-shadow: 2px 2px 0 var(--ink-color);
  padding: 6px 16px;
  border-radius: var(--radius-pill);
  font-weight: 800;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.game-card:hover .card-play-btn {
  background: #ffe66d;
}

.card-high-score {
  font-size: 0.8rem;
  font-weight: 700;
  color: #857861;
}

/* Standalone Game Play Page Styles */
.game-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.back-home-btn {
  background: #ffffff;
  border: var(--border-medium);
  box-shadow: var(--shadow-chunky);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
  font-weight: 800;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.1s ease;
}

.back-home-btn:hover {
  transform: translate(-1px, -2px);
  box-shadow: var(--shadow-chunky-hover);
  background: #fff6da;
}

.back-home-btn:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-chunky-active);
}

.game-stats-board {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stat-chip {
  background: #ffffff;
  border: var(--border-medium);
  box-shadow: 3px 3px 0 var(--ink-color);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-chip .val {
  color: var(--primary-coral);
  font-size: 1.15rem;
}

/* Game Canvas Container */
.game-viewport {
  background: #ffffff;
  border: var(--border-thick);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-chunky-big);
  padding: 16px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  overflow: hidden;
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: var(--border-medium);
  background: #fff;
  touch-action: none;
}

/* Onscreen Game Overlay for Start / Pause / Game Over */
.game-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(43, 36, 56, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 20;
  padding: 20px;
  text-align: center;
  color: #ffffff;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s ease;
}

.game-overlay.hidden {
  display: none !important;
}

.overlay-card {
  background: #ffffff;
  color: var(--ink-color);
  border: var(--border-thick);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-chunky-big);
  padding: 28px 24px;
  max-width: 420px;
  width: 90%;
  animation: popIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.overlay-title {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

.overlay-desc {
  font-size: 1rem;
  color: #574d68;
  margin-bottom: 20px;
}

.overlay-score-box {
  background: #fffbe6;
  border: 2px dashed #e2c974;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-around;
}

.score-cell {
  text-align: center;
}
.score-cell-lbl {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #8c826b;
}
.score-cell-num {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary-coral);
}

.btn-primary {
  background: var(--primary-yellow);
  color: var(--ink-color);
  border: var(--border-thick);
  box-shadow: var(--shadow-chunky);
  border-radius: var(--radius-pill);
  padding: 12px 28px;
  font-size: 1.15rem;
  font-weight: 900;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.1s ease;
}

.btn-primary:hover {
  transform: translate(-1px, -2px);
  box-shadow: var(--shadow-chunky-hover);
  background: #ffe75e;
}

.btn-primary:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-chunky-active);
}

.btn-secondary {
  background: #f1f3f9;
  color: var(--ink-color);
  border: var(--border-medium);
  box-shadow: 2px 2px 0 var(--ink-color);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  margin-top: 10px;
}

.btn-secondary:hover {
  background: #e4e7f2;
}

/* Mobile Friendly Controls */
.mobile-controls {
  display: none;
  width: 100%;
  max-width: 480px;
  margin: 14px auto 0;
  padding: 8px;
  justify-content: space-around;
  gap: 8px;
  user-select: none;
}

.mobile-dpad-btn {
  background: #ffffff;
  border: var(--border-thick);
  box-shadow: var(--shadow-chunky);
  border-radius: 16px;
  width: 68px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  cursor: pointer;
  touch-action: manipulation;
}

.mobile-dpad-btn:active {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-chunky-active);
  background: #fff3c4;
}

@media (max-width: 768px) {
  .mobile-controls.active {
    display: flex;
  }
}

/* Instructions & Info Box */
.game-instructions-box {
  background: #ffffff;
  border: var(--border-medium);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-chunky);
  padding: 24px;
  margin-bottom: 24px;
}

.game-instructions-box h3 {
  font-size: 1.25rem;
  font-weight: 900;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.game-instructions-box p, .game-instructions-box li {
  color: #524765;
  font-size: 0.95rem;
  line-height: 1.6;
}

.game-instructions-box ul {
  padding-left: 20px;
  margin-top: 8px;
}

/* Site Footer */
.site-footer {
  background: #ffffff;
  border-top: var(--border-thick);
  padding: 30px 20px;
  margin-top: auto;
  text-align: center;
}

.footer-content {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.9rem;
  font-weight: 700;
}

.footer-links a:hover {
  color: var(--primary-coral);
  text-decoration: underline;
}

.footer-copyright {
  font-size: 0.85rem;
  color: #7b718d;
}

/* Animations */
@keyframes wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

@keyframes popIn {
  0% { transform: scale(0.85); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
