@charset "UTF-8";

:root {
  --primary-font-family: Arial, sans-serif;
  --grass: #468d34;
  --light-grass:  #63b44f;;
  --water: #6db2f3;

  --tile-size: 80px;
  --fog-bg: #8ca2a6;
  --pasture: #647a54;
  --cold-pasture: #5b704c;
  --basalt: #4a3e35;
  --araucaria: #24361e;
  --hydrangea: #6d88b3;

  --menu-bg: rgba(244, 237, 222, 0.95);
  --menu-bg-2: rgba(241, 241, 224, 0.95);
  --menu-border: #8b7355;
  --button-base: #a3c4b6;
  --button-hover: #7b9c8e;
  --button-text: #2f3e36;
  --accent-color: #d99a73;
  --text-dark: #3a322c;
}

* {
  box-sizing: border-box;

  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  background: var(--fog-bg);
  font-family: var(--primary-font-family);
  user-select: none;
  -webkit-user-select: none;
}

#viewport {
  width: 100vw;
  height: 100vh;
  position: relative;
  background-color: var(--fog-bg);
}

#game-board {
  position: relative;
  display: grid;
  width: 3200px;
  height: 2000px;
  background-image: url(../assets/game4-assets/ceu.png);
  background-repeat: no-repeat;
  background-size: cover;
  
  z-index: 1;
  will-change: transform;
}

.smooth-move {
  transition: transform .15s ease-out;
}

#foreground-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 3200px;
  height: 2000px;
  
  background-image: url('../assets/game4-assets/mold_forest.png');
  background-size: cover;
  background-repeat: no-repeat;
  
  pointer-events: none;
  z-index: 4 !important;
}

.piece {
  width: var(--tile-size);
  height: var(--tile-size);
  position: relative;
  z-index: 1; 
  display: flex;
  align-items: center;
  justify-content: center;
}

.piece::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  z-index: 2;
}

/* Modelos */

.grass {
  background-image: url('../assets/game4-assets/grass3-1.png');
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  opacity: 1 !important;
}
.grass2 {
  background-image: url('../assets/game4-assets/grass3-2.png');
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  opacity: 1 !important;
}
.dirt {
  background-image: url('../assets/game4-assets/dirt-1.png');
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  opacity: 1 !important;
}
.dirt2 {
  background-image: url('../assets/game4-assets/dirt-2.png');
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  opacity: 1 !important;
}
.grass-tree {
  background-image: url('../assets/game4-assets/grass3-1.png');
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  opacity: 1 !important;
}
.grass-tree2 {
  background-image: url('../assets/game4-assets/grass3-2.png');
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  opacity: 1 !important;
}
.dirt-block {
  background-image: url('../assets/game4-assets/dirt-1.png');
  background-size: contain;
  background-repeat: no-repeat;
  image-rendering: pixelated;
  opacity: 1 !important;
}

/* Personagens: */

.sprite-P::after { background-image: url('../assets/cavalo_static.png'); }
.sprite-p::after { background-image: url('../assets/bemtevi_static.png'); }
.sprite-M::after { background-image: url('../assets/jacana_static.png'); }
.sprite-m::after { background-image: url('../assets/capivara_static.png'); }
.sprite-O::after { background-image: url('../assets/maequeroquero_scream.png'); }
.sprite-o::after { background-image: url('../assets/urutu_static.png'); }
.sprite-C::after { background-image: url('../assets/graxaim_static.png'); }
.sprite-c::after { background-image: url('../assets/filhoteperdido_scream.png'); }
.sprite-Q::after { background-image: url('../assets/filhotes_static.png'); }
.sprite-q::after { background-image: url('../assets/carcara_static.png'); }

.sprite-P, .sprite-p, .sprite-M, .sprite-m, .sprite-O, .sprite-o, .sprite-C, .sprite-c, .sprite-Q, .sprite-q {
  z-index: 1; 
}

.piece.collected::after {
  display: none !important;
}

/* Personagem */
#player {
  position: absolute;
  top: 0;
  left: 0;
  width: 60px;
  height: 60px;
  background: url(../assets/player.png);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  pointer-events: none;
  transition: transform .15s ease-out;
  z-index: 2;
  display: none;
}

#player.face-left {
  transform: scaleX(-1);
}

/* Minijogos */
/* Puzzle */

#puzzle-board-target {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border: 3px solid #5b704c;
  background-color: #000;
  z-index: 1;
}

#puzzle-board-target::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: inherit;
  background-size: inherit;
  filter: brightness(0.3);
  z-index: -1;
}

.puzzle-slot {
  position: absolute;
  box-sizing: border-box;
  z-index: 2;
}

.puzzle-piece-drag {
  position: absolute;
  cursor: grab;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
  z-index: 21;
  transition: transform 0.1s ease, filter 0.3s ease;
}

.puzzle-piece-drag, #puzzle-page-ref {
  pointer-events: auto;
  cursor: grab;
}

#puzzle-page-ref {
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.puzzle-piece-drag.dragging {
  cursor: grabbing;
  opacity: 0.8;
  z-index: 25;
  -webkit-clip-path: var(--current-mold) !important;
  clip-path: var(--current-mold) !important;
  pointer-events: none !important;
}

.puzzle-piece-drag.placed {
  position: absolute !important;
  left: -0.5px !important;
  top: -0.5px !important;
  width: 121px !important;
  height: 126px !important;
  transform: rotate(0deg) !important;
  z-index: 20 !important;

  filter: none !important; 
  opacity: 1 !important;
  -webkit-clip-path: none !important;
  clip-path: none !important;
  outline: none !important;

  image-rendering: pixelated;
}

/* Catch */

.mg-target-sprite {
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.5));
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}

.mg-target-sprite.sprite-C { background-image: url('../assets/graxaim_static.png') }
.mg-target-sprite.sprite-c { background-image: url('../assets/filhoteperdido_scream.png') }

.running-tremble {
  animation: animalTremble 0.15s infinite
}

@keyframes animalTremble {
  0% { margin-top: 0px }
  25% { margin-top: -4px }
  50% { margin-top: 0px }
  75% { margin-top: 4px }
  100% { margin-top: 0px }
}

.mg-obstacle {
  position: absolute;
  width: 230px;
  height: 180px;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: bottom center;
  z-index: 20;
  pointer-events: none;
}

/* Utilitários dos minijogos */

#minigame-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: none;
  justify-content: center;
  align-items: center;
}

#minigame-box {
  background: #fdfbf7;
  padding: 25px;
  border-radius: 15px;
  width: auto;
  max-width: 850px;
  text-align: center;
  border: 5px solid var(--basalt);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);

  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

#mg-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  border-bottom: 2px solid #ccc;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

#mg-header > div:not(#mg-title) {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 2px;
  margin-right: 0;
}

#mg-title {
  margin: 0;
  text-align: left;
  flex-grow: 1;
}

.hearts-box {
  display: flex;
  gap: 10px;
  align-items: center;
}

#score-counter {
  display: none;
  background: #a3c4b6;
  color: #2f3e36;
  padding: 7px 15px;
  margin-right: 5px;
  border-radius: 8px;
  font-size: 22px;
  font-weight: bold;
}

#counter {
  display: none;
  background: #ccc;
  color: #000;
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 22px;
  font-weight: bold;
  white-space: nowrap;
}

#mg-content {
  margin: 20px 0;
  min-height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

#mg-close { padding: 12px 25px;
  background: rgb(167, 8, 8);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
}

#mg-close:hover {
  background: rgb(117, 10, 10);
}

.mg-card {
  width: 70px;
  height: 90px;
  background: var(--basalt);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  font-size: 30px;
  border: 2px solid #fff;
}

.mg-target {
  width: 80px;
  height: 80px;
  background: #e67e22;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

.mg-target:active {
  transform: scale(0.8);
}

/* Interação e Diálogos */

.interaction-bubble {
  position: absolute;
  background: wheat;
  border: 3px solid black;
  border-radius: 15px;
  padding: 8px 12px;
  font-weight: bold;
  font-size: 14px;
  z-index: 4;
  pointer-events: none;
  transform: translate(-30%, -60%);
  white-space: nowrap;
  user-select: none;
}

#dialog-system {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  width: 90vw;
  height: 160px;
  z-index: 5;
}

#dialog-box {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(236, 221, 189, 0.95);
  color: black;
  border: 2px solid white;
  border-radius: 20px;
  overflow: visible;
  user-select: none;
}

#dialog-ft {
  position: absolute;
  bottom: 0;
  left: 20px;
  height: 220px;
  max-width: 200px;
  object-fit: contain;
  object-position: bottom left;
  z-index: 6;
  filter: drop-shadow(10px 3px 0px rgba(0,0,0,0.5));
  pointer-events: none;
}

#dialog-text-container {
  margin-left: 200px;
  padding: 25px;
  text-align: left;
}

#dialog-name {
  color: #e69010;
  text-transform: uppercase;
  font-style: italic;
  margin-bottom: 10px;
  font-size: 22px;
  display: inline-block;
  margin-top: 0px;
}

#dialog-next-zone {
  position: absolute;
  right: 0;
  top: 0;
  width: 30%;
  height: 100%;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 20px;
  background: transparent;
  color: #000;
  font-weight: 600;
}

#dialog-next-zone > span {
  font-size: 14px;
  user-select: none;
  pointer-events: none;
}

/* Menus */

#main-menu, #ui, #game-over {
  display: flex;
}

@media screen and (max-width: 1024px) and (orientation: portrait) {
  #orientation-warning {
    display: flex !important;
  }
  #viewport, #main-menu, #ui, #pause-menu, #game-complete, #dialog-system {
    display: none !important;
  }
}

#main-menu {
  background-color: var(--menu-bg);
  color: #000;
  border: 3px solid var(--menu-border);

  height: 500px;
  width: 700px;
  padding: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2px;
  border-radius: 20px;
  
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
}

#main-menu > h1 {
  text-align: center;
}

#main-menu > div > button {
  display: inline;
  width: 350px;
  height: 75px;
  border: none;
  border-radius: 10px;
  background-color: var(--button-base);
  color: var(--button-text);
  font-weight: bolder;
  font-size: medium;
  cursor: pointer;
  user-select: none;
}

#main-menu > div > button:hover {
  background-color: var(--button-hover);
  transition-duration: .2s;
  transform: translateY(-3px);
}

#main-menu > div > button#back-btn {
  width: 70px;
  border-radius: 10px;
  background-color: var(--button-base);
}

#main-menu > div > button#back-btn:hover {
  background-color: var(--button-hover);
  transition-duration: .2s;
  transform: translateY(-3px);
}

#ui {
  justify-content: space-between;
  align-items: flex-start;
  position: fixed;
  top: 20px;
  left: 20px;
  right: 20px;
  z-index: 3;
  pointer-events: none;
  display: none;
}

#friends-counter {
  max-width: 160px;
}

#friends-counter, 
#hint, 
#pause-btn {
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  user-select: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

#hint {
  color: #c0392b;
  background: rgba(255, 223, 223, 0.9) !important;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

#hint > #ui-hint-img {
  height: 75px;
  width: 75px;
}

#pause-btn {
  cursor: pointer;
  background: #2c3e50f3 !important;
  transition: transform 0.1s;
}

#pause-btn:active {
  transform: scale(0.9);
}

#pause-menu {
  background-color: var(--menu-bg);
  color: #000;
  border: 3px solid var(--menu-border);
  border-radius: 20px;

  height: 500px;
  width: 700px;
  padding: 20px;

  display: none; 
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 50;
}

#pause-menu > div > h1 {
  text-align: center;
  margin: 40px 0;
}

.pause-options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  font-size: 50px;
  
  position: absolute;
  bottom: 30px;
  left: 0;
  right: 0;
  margin-top: 0;
}

.pause-options div {
  background-color: var(--button-base);
  transition-duration: .2s;

  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.2s;
  border-radius: 15px;
  user-select: none;
}

.controls-list {
  background-color: var(--menu-bg-2);
  padding: 10px 20px;
  width: 90%;
  border-radius: 15px;
  text-align: left;
}

.controls-list p {
  margin: 10px 0;
}

.controls-list h2 {
  margin: 10px 0 20px 0;
}

.pause-options div:hover {
  background-color: var(--button-hover);
  transition-duration: .2s;
  transform: translateY(-3px);
}

#game-complete {
  background-color: var(--menu-bg);
  color: #000;
  border: 3px solid var(--menu-border);
  border-radius: 20px;

  height: 300px;
  width: 700px;
  padding: 20px;

  display: none; 
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 100;
}

#game-complete h1 {
  margin-top: 40px;
  margin-bottom: 10px;
  text-align: center;
}

#game-complete p {
  margin: 10px 0 30px 0;
  padding: 0 40px;
  text-align: center;
  font-size: 18px;
}

.win-options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.win-options div {
  background-color: var(--button-base);
  color: var(--button-text);
  
  width: 300px; 
  height: 75px;
  
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 10px;
  font-weight: bolder;
  user-select: none;
  transition: 0.2s;
}

.win-options div:first-child {
  width: 80px;
  font-size: 30px;
}

.win-options div:hover {
  background-color: var(--button-hover);
  transform: translateY(-3px);
}

/* Celulares */

#orientation-warning {
  display: none; /* Escondido por padrão */
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--basalt);
  color: white;
  z-index: 999999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Se o celular estiver em pé, mostra o aviso e SOME com o jogo */
@media screen and (max-width: 900px) and (orientation: portrait) {
  #orientation-warning {
    display: flex;
  }
  #viewport, #main-menu, #ui, #pause-menu, #game-complete {
    display: none !important; 
  }
}

/* --- CONTROLES ESTILO MINECRAFT --- */
#mobile-controls {
  position: fixed;
  bottom: 20px;
  left: 20px;
  right: 20px;
  display: none;
  justify-content: space-between;
  align-items: flex-end;
  z-index: 100;
  pointer-events: none;
}

#d-pad {
  display: grid;
  grid-template-areas: 
    ". up ."
    "left center right"
    ". down .";
  gap: 10px;
  pointer-events: auto;
}

#d-pad-center {
  grid-area: center;
}

#btn-up { grid-area: up; }
#btn-left { grid-area: left; }
#btn-right { grid-area: right; }
#btn-down { grid-area: down; }

.touch-btn {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(5px);
  border-radius: 12px;
  border: 3px solid rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #333;
  font-weight: bold;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.touch-btn:active {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(0.9);
}

#mg-content, 
.touch-btn, 
.puzzle-piece-drag, 
#game-board {
  touch-action: none;
}

#action-zone {
  pointer-events: auto;
  margin-bottom: 20px;
  margin-right: 20px;
}

.interact-btn {
  width: 75px;
  height: 75px;
  border-radius: 25px;
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(5px);
  border: 3px solid rgba(255, 255, 255, 0.7);
  color: #333;
  font-size: 30px;
}

.interact-btn:active {
  background: rgba(255, 255, 255, 0.8);
  transform: scale(0.9);
}

/* Media Queries */

@media screen and (max-width: 1024px), screen and (max-height: 700px) {
  #main-menu, #pause-menu, #game-complete {
    transform: translate(-50%, -50%) scale(0.8);
  }
  
  #minigame-box {
    transform: scale(0.8);
  }
  
  #dialog-system {
    bottom: 15px;
    transform: translateX(-50%) scale(0.9);
  }
}

@media screen and (max-width: 850px), screen and (max-height: 500px) {
  #main-menu, #pause-menu, #game-complete {
    transform: translate(-50%, -50%) scale(0.55); 
  }
  
  #minigame-container {
    align-items: flex-start; 
    padding-top: 5px;
  }

  #minigame-box {
    transform: scale(0.55); 
    transform-origin: top center;
    margin: 0;
  }

  #ui {
    top: 5px;
    left: 10px;
    right: 10px;
  }

  #friends-counter, #hint, #pause-btn {
    padding: 8px 12px;
    font-size: 15px;
  }

  #hint > #ui-hint-img {
    height: 50px;
    width: 50px;
  }

  #dialog-system {
    bottom: 5px;
    transform: translateX(-50%) scale(0.7);
    transform-origin: bottom center;
  }

  #mobile-controls {
    bottom: 10px;
    left: 10px;
    right: 10px;
  }
  
  .touch-btn {
    width: 50px;
    height: 50px;
    font-size: 20px;
  }
  
  .interact-btn {
    width: 65px;
    height: 65px;
    font-size: 24px;
  }

  .controls-list {
    display: none !important;
  }
}

@media screen and (max-height: 400px) {
  #main-menu, #pause-menu, #game-complete {
    transform: translate(-50%, -50%) scale(0.45);
  }
  #minigame-box {
    transform: scale(0.45);
  }
}
