/* =============================================================
   Fuga — Escape Room "Cartoon Adventure"
   Theme: Playful cartoon with warm beige, green & orange
   ============================================================= */

/* ===== THEME TOKENS ===== */
:root {
  --bg: #4CAF50;
  --surface: #F5E6D0;
  --surface-container: #F5E6D0;
  --surface-high: #EDD9BE;
  --primary: #FF5722;
  --primary-dark: #E64A19;
  --primary-shadow: #BF360C;
  --secondary: #4CAF50;
  --secondary-dark: #388E3C;
  --tertiary: #FFC107;
  --on-surface: #3E2723;
  --on-surface-light: #5D4037;
  --outline: #8D6E63;
  --border-dark: #5D4037;

  --font-display: 'Nunito', sans-serif;
  --font-body: 'Nunito', sans-serif;

  --shadow-card: 0 4px 0 #5D4037;
  --shadow-card-hover: 0 6px 0 #5D4037;
  --shadow-btn: 0 4px 0 #BF360C;
  --shadow-btn-active: 0 2px 0 #BF360C;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== BODY ===== */
body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.12) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(0,0,0,0.08) 0%, transparent 50%);
  min-height: 100dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  color: var(--on-surface);
  user-select: none;
  touch-action: none;
  position: relative;
}

/* ===== TOP BAR ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--surface);
  border-bottom: 3px solid var(--outline);
  gap: 8px;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 4px 0 #5D4037;
}

.btn-back {
  color: var(--on-surface);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  background: var(--surface-high);
  border: 3px solid var(--outline);
  padding: 6px 14px;
  border-radius: 16px;
  transition: all 150ms ease;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--border-dark);
}
.btn-back:hover {
  background: #e8cfa8;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 var(--border-dark);
}
.btn-back:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--border-dark);
}

.game-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  white-space: nowrap;
  color: var(--primary);
  text-shadow: 2px 2px 0 #BF360C44;
  text-transform: uppercase;
}

.stats {
  display: flex;
  gap: 12px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--on-surface);
  white-space: nowrap;
  background: var(--surface-high);
  padding: 6px 12px;
  border-radius: 16px;
  border: 3px solid var(--outline);
  box-shadow: 0 3px 0 var(--border-dark);
}

/* ===== GAME CONTAINER ===== */
.game-container {
  flex: 0 0 auto;
  height: calc(100dvh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 8px;
  min-height: 300px;
}

#game-canvas {
  border-radius: 20px;
  border: 3px solid var(--outline);
  background: #1a1a2e;
  box-shadow:
    0 6px 0 var(--border-dark),
    0 10px 20px rgba(0, 0, 0, 0.25);
  max-width: 100%;
  max-height: 100%;
  image-rendering: auto;
}

/* ===== OVERLAY / MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(62, 39, 35, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(4px);
  opacity: 1;
  visibility: visible;
}
.modal-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal {
  text-align: center;
  background: var(--surface);
  border: 3px solid var(--outline);
  border-radius: 20px;
  padding: 32px;
  max-width: 90vw;
  width: 400px;
  transform: scale(1);
  transition: transform 250ms ease;
  box-shadow:
    0 6px 0 var(--border-dark),
    0 12px 24px rgba(0, 0, 0, 0.2);
  position: relative;
}

.modal-overlay.hidden .modal {
  transform: scale(0.9);
}

.modal-icon {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: bounceIn 0.6s ease-out;
  filter: drop-shadow(2px 2px 0 rgba(0,0,0,0.15));
}

.modal h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  text-shadow: 2px 2px 0 #BF360C33;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.modal p {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--on-surface-light);
  margin-bottom: 8px;
  line-height: 1.5;
}

.overlay-score {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--tertiary);
  text-shadow: 1px 1px 0 rgba(0,0,0,0.15);
}

/* ===== BUTTONS ===== */
.btn {
  margin-top: 12px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  border-radius: 16px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 150ms ease;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 3px solid var(--primary-dark);
  box-shadow: var(--shadow-btn);
  padding: 12px 32px;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #BF360C;
}
.btn-primary:active {
  background: var(--primary-dark);
  transform: translateY(2px);
  box-shadow: var(--shadow-btn-active);
}

.btn-whatsapp {
  background: var(--secondary);
  color: #fff;
  border: 3px solid var(--secondary-dark);
  border-radius: 16px;
  padding: 10px 24px;
  box-shadow: 0 4px 0 #2E7D32;
}
.btn-whatsapp:hover {
  background: var(--secondary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #2E7D32;
}
.btn-whatsapp:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #2E7D32;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .game-title { font-size: 0.85rem; }
  .stats { font-size: 0.65rem; gap: 8px; padding: 4px 10px; }
}

@media (max-height: 500px) and (orientation: landscape) {
  .topbar { padding: 4px 8px; }
  .game-title { display: none; }
}

@media (max-width: 380px) {
  .stats { gap: 6px; font-size: 0.55rem; }
}

/* ===== SEO GAME INFO SECTION ===== */
.game-info {
  max-width: 780px;
  margin: 16px auto;
  padding: 20px;
  background: var(--surface);
  border: 3px solid var(--outline);
  border-radius: 20px;
  color: var(--on-surface-light);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.7;
  box-shadow: var(--shadow-card);
}
.game-info h2 {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--primary);
  text-shadow: 1px 1px 0 #BF360C22;
}
.game-info h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  margin: 14px 0 6px;
  color: var(--primary);
}
.game-info ul { padding-left: 1.2rem; }
.game-info li { margin-bottom: 4px; }

/* ===== ANIMATIONS ===== */
@keyframes bounceIn {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.05); opacity: 1; }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-icon { animation: none; }
}
