/* ========================================
   Floresta do Matteo — Estilos
   ======================================== */

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

:root {
  --parchment:  #F5EDD6;
  --ink:        #3B2A1A;
  --moss:       #5A7A3A;
  --moss-dark:  #3d5428;
  --moss-light: #7aaa4a;
  --earth:      #C4956A;
  --earth-light:#dbb88a;
  --mushroom:   #C0392B;
  --flower:     #c084e8;
  --sky:        #87CEEB;
}

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

body {
  font-family: 'Nunito', sans-serif;
  background: var(--parchment);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
  background-image:
    radial-gradient(ellipse at 10% 20%, rgba(90,122,58,0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 80%, rgba(90,122,58,0.08) 0%, transparent 50%);
}

/* ---- HEADER ---- */
header {
  text-align: center;
  margin-bottom: 18px;
}

.game-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: clamp(2rem, 6vw, 3.2rem);
  color: var(--moss-dark);
  letter-spacing: 2px;
  text-shadow: 3px 3px 0 rgba(90,122,58,0.2);
  line-height: 1;
}

.game-subtitle {
  font-size: 0.9rem;
  color: var(--earth);
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: 1px;
}

/* ---- WORLD SELECTOR ---- */
.world-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.world-btn {
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 8px 18px;
  border: 3px solid var(--moss-dark);
  border-radius: 999px;
  background: white;
  color: var(--moss-dark);
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.5px;
}

.world-btn:hover {
  background: var(--moss-light);
  color: white;
  border-color: var(--moss-dark);
}

.world-btn.active {
  background: var(--moss-dark);
  color: #fff;
}

/* ---- HUD ---- */
.hud {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 16px;
  background: white;
  border: 3px solid var(--moss-dark);
  border-radius: 16px;
  padding: 10px 24px;
  box-shadow: 4px 4px 0 var(--moss-dark);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 800;
  color: var(--ink);
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hud-value {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--moss-dark);
}

.hud-divider {
  width: 2px;
  height: 36px;
  background: var(--earth-light);
  border-radius: 2px;
}

/* ---- RESET BTN ---- */
.reset-btn {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.1rem;
  letter-spacing: 1px;
  padding: 10px 28px;
  background: var(--moss);
  color: white;
  border: 3px solid var(--moss-dark);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--moss-dark);
  transition: all 0.1s;
  margin-bottom: 16px;
}

.reset-btn:hover {
  background: var(--moss-light);
  transform: translateY(-1px);
}

.reset-btn:active {
  transform: translateY(1px);
  box-shadow: 1px 1px 0 var(--moss-dark);
}

/* ---- BOARD WRAPPER ---- */
.board-wrapper {
  border: 4px solid var(--moss-dark);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 6px 6px 0 var(--moss-dark);
  position: relative;
  overflow: hidden;
}

/* World themes */
.board-wrapper.campinho { background: #d4edaa; }
.board-wrapper.bosque   { background: #b8d490; }
.board-wrapper.floresta { background: #3d5428; }

/* ---- GRID ---- */
#board {
  display: grid;
  gap: 4px;
}

/* ---- CELLS ---- */
.cell {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  user-select: none;
  border: 2px solid transparent;
  font-weight: 800;
  transition: transform 0.08s, box-shadow 0.08s;
  position: relative;
}

/* Hidden cell */
.cell.hidden {
  background: var(--moss);
  border-color: var(--moss-dark);
  box-shadow: 0 3px 0 var(--moss-dark);
}

.floresta .cell.hidden {
  background: #4a6830;
  border-color: #2d3d1a;
  box-shadow: 0 3px 0 #2d3d1a;
}

.cell.hidden:hover {
  background: var(--moss-light);
  transform: translateY(-2px);
  box-shadow: 0 5px 0 var(--moss-dark);
}

/* Flagged cell */
.cell.flagged {
  background: #f0e0ff;
  border-color: #9b50c8;
  box-shadow: 0 3px 0 #9b50c8;
}

/* Revealed cell */
.cell.revealed {
  background: var(--earth-light);
  border-color: var(--earth);
  box-shadow: none;
  cursor: default;
}

.floresta .cell.revealed {
  background: #8b6340;
  border-color: #6b4320;
}

/* Empty revealed */
.cell.revealed.empty {
  background: rgba(196,149,106,0.3);
  border-color: rgba(196,149,106,0.4);
}

.floresta .cell.revealed.empty {
  background: rgba(100,70,40,0.4);
  border-color: rgba(80,50,20,0.4);
}

/* Number colors */
.cell[data-n="1"] { color: #1a6fc4; }
.cell[data-n="2"] { color: #27822a; }
.cell[data-n="3"] { color: #c0392b; }
.cell[data-n="4"] { color: #6c3483; }
.cell[data-n="5"] { color: #922b21; }
.cell[data-n="6"] { color: #148f77; }
.cell[data-n="7"] { color: #212121; }
.cell[data-n="8"] { color: #717d7e; }

/* Mushroom exploded */
.cell.boom {
  background: #ffe0dc !important;
  border-color: var(--mushroom) !important;
  box-shadow: none !important;
  animation: shake 0.3s ease;
}

@keyframes shake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-4px) rotate(-3deg); }
  75% { transform: translateX(4px) rotate(3deg); }
}

/* ---- OVERLAY ---- */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(59,42,26,0.7);
  z-index: 100;
  align-items: center;
  justify-content: center;
}

.overlay.show { display: flex; }

.overlay-box {
  background: var(--parchment);
  border: 4px solid var(--moss-dark);
  border-radius: 24px;
  padding: 40px 48px;
  text-align: center;
  box-shadow: 8px 8px 0 var(--moss-dark);
  max-width: 360px;
  width: 90%;
}

.overlay-emoji {
  font-size: 4rem;
  display: block;
  margin-bottom: 12px;
}

.overlay-title {
  font-family: 'Luckiest Guy', cursive;
  font-size: 2.2rem;
  color: var(--moss-dark);
  margin-bottom: 8px;
}

.overlay-msg {
  font-size: 1rem;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 24px;
  line-height: 1.5;
}

.overlay-btn {
  font-family: 'Luckiest Guy', cursive;
  font-size: 1.2rem;
  letter-spacing: 1px;
  padding: 12px 36px;
  background: var(--moss);
  color: white;
  border: 3px solid var(--moss-dark);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--moss-dark);
  transition: all 0.1s;
}

.overlay-btn:hover { background: var(--moss-light); }

/* ---- LEGEND ---- */
.legend {
  margin-top: 16px;
  display: flex;
  gap: 16px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--moss-dark);
  flex-wrap: wrap;
  justify-content: center;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 520px) {
  .cell { width: 32px; height: 32px; font-size: 1rem; }
  #board { gap: 3px; }
  .board-wrapper { padding: 8px; }
}
