/* ============================================================
   Adventure Kids — Vanilla PWA Styles
   Chunky cartoon design: thick outlines, hard shadows, bright colors
   ============================================================ */

:root {
  --ink: #2d1b3d;
  --bg: #fff8e7;
  --pink: #ff6b9d;
  --green: #7ed957;
  --sky: #4dabf7;
  --yellow: #ffe066;
  --purple: #b197fc;
  --orange: #ffa94d;
  --red: #ff5252;
  --shadow: 4px 4px 0 0 var(--ink);
  --shadow-sm: 3px 3px 0 0 var(--ink);
  --shadow-lg: 6px 6px 0 0 var(--ink);
  --shadow-xl: 8px 8px 0 0 var(--ink);
  --radius: 0.75rem;
}

/* ============ RESET ============ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  user-drag: none;
  touch-action: pan-x pan-y;
}

html, body {
  height: 100%;
  height: 100dvh;
  overscroll-behavior: none;
  overflow: hidden;
  font-family: 'Fredoka', ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
  touch-action: none;
}

img { -webkit-user-drag: none; user-drag: none; }

button, input, textarea, select, [contenteditable], [data-interactive] {
  -webkit-user-select: auto;
  user-select: auto;
  touch-action: manipulation;
}

/* ============ APP LAYOUT ============ */
.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ============ ADSENSE SIDE BLOCKS (left/right vertical, main page only) ============ */
.ad-side {
  display: none;
  width: 160px;
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 5;
  overflow: hidden;
}
.ad-left { left: 0; }
.ad-right { right: 0; }
/* AdSense ins fills the container */
.ad-side .adsbygoogle { display: block !important; width: 160px; min-width: 160px; }
@media (min-width: 1200px) {
  .ad-side { display: flex; align-items: center; justify-content: center; padding: 60px 4px; }
  .app { padding-left: 168px; padding-right: 168px; }
}
body.ads-removed .ad-side { display: none !important; }
body.game-playing .ad-side { display: none !important; }
body.game-playing .app { padding-left: 0 !important; padding-right: 0 !important; }
body.ads-removed .app { padding-left: 0 !important; padding-right: 0 !important; }

/* ============ GAME ============ */
.screen {
  position: absolute;
  inset: 0;
  display: none;
}
.screen.active { display: block; }

.game-container {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.game-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* ============ HUD ============ */
.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  padding: 8px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-btn {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-sm);
  font-size: 20px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
}
.hud-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.hud-stat {
  background: rgba(255,255,255,0.92);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-sm);
  border-radius: 16px;
  padding: 4px 16px;
  text-align: center;
  font-weight: 700;
  font-size: 24px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 6px;
}
.hud-label {
  display: block;
  font-size: 9px;
  font-weight: 700;
  opacity: 0.6;
}

/* ============ OVERLAYS ============ */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.overlay.hidden { display: none; }

/* ============ MODAL CARD ============ */
.modal-card {
  background: #fff;
  border-radius: 24px;
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  position: relative;
}
.modal-lg { max-width: 460px; }
.modal-emoji { font-size: 56px; line-height: 1; margin-bottom: 8px; }
.modal-title { font-size: 28px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.modal-desc { font-size: 14px; color: var(--ink); opacity: 0.7; margin-bottom: 16px; line-height: 1.4; }
.modal-info { text-align: left; margin-bottom: 16px; }
.modal-info > div { font-size: 13px; padding: 2px 0; }
.modal-note { font-size: 11px; opacity: 0.5; margin-top: 8px; }
.modal-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #e5e7eb;
  border: 2px solid var(--ink);
  font-size: 14px;
  cursor: pointer;
}

.controls-hint {
  background: #fff8e7;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 16px;
  font-size: 12px;
  text-align: left;
}
.controls-hint > div { padding: 2px 0; }

.best-score { font-weight: 700; margin-bottom: 12px; opacity: 0.6; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 16px 0;
}
.stat-box {
  background: #fff8e7;
  border: 2px solid var(--ink);
  border-radius: 12px;
  padding: 8px;
  text-align: center;
}
.stat-emoji { font-size: 24px; display: block; }
.stat-val { font-size: 20px; font-weight: 700; display: block; }
.stat-label { font-size: 9px; font-weight: 700; opacity: 0.6; }
.new-best {
  background: #d1fae5;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 6px;
  font-weight: 700;
  margin-bottom: 12px;
}
.prev-best { font-size: 12px; opacity: 0.5; margin-bottom: 12px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 16px;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  padding: 12px 20px;
  cursor: pointer;
  transition: transform 0.08s, box-shadow 0.08s;
  margin-top: 8px;
  width: 100%;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn-lg { font-size: 20px; padding: 16px 24px; }
.btn-sm { font-size: 12px; padding: 8px 12px; width: auto; }
.btn-primary { background: var(--green); color: #fff; }
.btn-secondary { background: #e5e7eb; }
.btn-danger { background: var(--pink); color: #fff; }

/* ============ TOP BAR ============ */
.top-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 25;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.player-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-sm);
  border-radius: 999px;
  padding: 2px 12px 2px 2px;
  cursor: pointer;
  transition: transform 0.08s;
}
.player-badge:active { transform: translate(1px, 1px); }
.player-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: #ffd9b3;
  border: 2px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.player-name { font-weight: 700; font-size: 13px; color: var(--ink); max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-sm);
  background: #fff;
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.08s;
}
.top-btn:active { transform: translate(1px, 1px); }
.btn-remove-ads {
  margin-left: auto;
  background: var(--yellow);
  border: 3px solid var(--ink);
  box-shadow: var(--shadow-sm);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.08s;
}
.btn-remove-ads:active { transform: translate(1px, 1px); }
.btn-remove-ads.hidden { display: none; }
.btn-remove-ads.paid { background: #d1fae5; font-size: 11px; }

/* ============ MODAL OVERLAY ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
}
.modal-card { position: relative; z-index: 1; }

.google-btn-container { display: flex; justify-content: center; margin-bottom: 16px; min-height: 44px; }

/* ============ COOKIE BANNER ============ */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 55;
  padding: 8px;
  background: rgba(0,0,0,0.3);
}
.cookie-banner.hidden { display: none; }
.cookie-content {
  max-width: 420px;
  margin: 0 auto;
  background: #fff;
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.cookie-icon { font-size: 24px; flex-shrink: 0; }
.cookie-text { font-size: 11px; line-height: 1.4; color: var(--ink); flex: 1; }
.cookie-text a { color: var(--pink); font-weight: 700; }
.cookie-btns { display: flex; gap: 6px; flex-shrink: 0; }

/* ============ FOOTER (narrow padding, standardized) ============ */
.footer {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  background: rgba(255,255,255,0.95);
  border-top: 3px solid var(--ink);
  padding: 4px 6px;
  text-align: center;
}
.footer a { font-size: 9px; color: var(--ink); opacity: 0.6; text-decoration: underline; }
.footer a:hover { color: var(--pink); }
.footer-brand { font-size: 11px; font-weight: 700; margin: 1px 0; }
.footer-copyright { font-size: 8px; opacity: 0.5; margin-bottom: 2px; }
.footer-links { margin: 1px 0; }

/* ============ PROMOTIONAL POPUP ADS (closable, all pages) ============ */
.promo-popup {
  position: fixed;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
}
.promo-popup.hidden { display: none !important; }
.promo-card {
  background: #fff;
  border: 4px solid var(--ink);
  box-shadow: var(--shadow-lg);
  border-radius: 16px;
  padding: 12px 16px;
  position: relative;
  max-width: 280px;
  text-align: center;
  cursor: pointer;
  transition: transform 0.08s;
}
.promo-card:active { transform: translate(1px, 1px); }
.promo-card a { text-decoration: none; color: var(--ink); display: block; }
.promo-close {
  position: absolute;
  top: -10px; right: -10px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--red);
  border: 3px solid var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.08s;
}
.promo-close:active { transform: scale(0.9); }
.promo-emoji { font-size: 32px; margin-bottom: 4px; }
.promo-text { font-size: 13px; font-weight: 700; }
.promo-sub { font-size: 10px; opacity: 0.6; margin-top: 2px; }
/* Position promotional popups — bottom corners above footer */
#promo-exabyte { bottom: 50px; left: 8px; }
#promo-wasza { bottom: 50px; right: 8px; }
@media (max-width: 600px) {
  #promo-exabyte, #promo-wasza { bottom: 45px; }
  .promo-card { max-width: 160px; padding: 8px 10px; }
  .promo-emoji { font-size: 24px; }
  .promo-text { font-size: 10px; }
  .promo-sub { font-size: 8px; }
}
/* Hide promos when ads removed (paid) */
body.ads-removed .promo-popup { display: none !important; }
/* Hide AdSense side blocks during gameplay (main page only) */
body.game-playing .ad-side { display: none !important; }
body.game-playing .app { padding-left: 0 !important; padding-right: 0 !important; }

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

/* ============ ANIMATIONS ============ */
@keyframes idle-bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes pop-in { 0% { transform: scale(0.7); opacity: 0; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
@keyframes confetti-fall { 0% { transform: translateY(-100vh) rotate(0); } 100% { transform: translateY(100vh) rotate(720deg); } }
.anim-pop-in { animation: pop-in 0.35s cubic-bezier(0.34,1.56,0.64,1) both; }

.confetti-piece {
  position: absolute;
  top: 0;
  width: 10px; height: 14px;
  animation: confetti-fall 2s linear infinite;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 480px) {
  .player-name { display: none; }
  .btn-remove-ads { font-size: 10px; padding: 4px 10px; }
  .hud-stat { font-size: 18px; padding: 4px 10px; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
