*{
  margin:0;
  padding:0;
  box-sizing:border-box;
}

body{
  font-family:'Trebuchet MS', sans-serif;
  background:linear-gradient(135deg,#fff4a3,#ffd000,#fff9d6);
  color:#3b3000;
  min-height:100vh;
  overflow:hidden;
}

#game{
  width:100%;
  height:100vh;
  display:flex;
  justify-content:center;
  align-items:center;
  padding:60px 20px 45px;
}

.screen{
  display:none;
  width:85%;
  max-width:850px;
  max-height:82vh;
  background:rgba(255,255,255,0.92);
  border:4px solid #ffd000;
  border-radius:35px;
  box-shadow:0 20px 50px rgba(0,0,0,0.18);
  padding:50px;
  text-align:center;
  animation:fadeIn 0.6s ease;
  overflow:auto;
}

.screen.active{
  display:block;
}

h1{
  font-size:3.7rem;
  margin-bottom:25px;
}

h2{
  font-size:2.7rem;
  margin-bottom:25px;
}

p{
  font-size:1.2rem;
  line-height:1.8;
  margin-bottom:22px;
}

button{
  margin-top:22px;
  padding:16px 35px;
  border:none;
  border-radius:50px;
  background:#ffd000;
  color:#3b3000;
  font-size:18px;
  font-weight:bold;
  cursor:pointer;
  box-shadow:0 8px 0 #c9a200;
  transition:0.2s;
}

button:hover{
  transform:translateY(-3px);
}

button:active{
  transform:translateY(5px);
  box-shadow:0 3px 0 #c9a200;
}

.items{
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:18px;
  margin:28px 0;
}

.items span{
  background:#fff3a0;
  border:2px solid #ffd000;
  border-radius:20px;
  padding:16px 24px;
  font-size:1.1rem;
  font-weight:bold;
}

.counter-box,
.timeline-card{
  max-width:620px;
  margin:25px auto;
  padding:24px;
  background:#fff8cc;
  border:3px solid #ffd000;
  border-radius:25px;
  box-shadow:0 10px 25px rgba(0,0,0,0.10);
}

.counter-box{
  max-width:420px;
}

.counter-box h3{
  font-size:1.15rem;
  margin-bottom:8px;
}

.counter-box p{
  font-size:2rem;
  font-weight:bold;
  margin:10px 0;
}

.counter-box small{
  font-size:0.9rem;
  opacity:0.8;
}

.timeline-card h3{
  font-size:1.6rem;
  margin-bottom:15px;
}

.timeline-card p{
  font-size:1.05rem;
  margin-bottom:12px;
}

.small-text{
  opacity:0.75;
  font-style:italic;
}

.envelope{
  margin:20px auto;
  width:100%;
  max-width:700px;
}

.envelope-front{
  background:#ffd000;
  padding:30px;
  border-radius:25px;
}

.letter{
  display:none;
  margin-top:18px;
  padding:28px;
  background:white;
  border-radius:25px;
  text-align:left;
  max-height:45vh;
  overflow-y:auto;
}

.letter.show{
  display:block;
}

.letter p{
  font-size:1.05rem;
  line-height:1.9;
}

.version-list{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(170px,1fr));
  gap:15px;
  margin:25px 0;
}

.version-card{
  background:#fff8cc;
  border:2px solid #ffd000;
  border-radius:18px;
  padding:18px;
  box-shadow:0 8px 18px rgba(0,0,0,0.08);
}

.version-card h3{
  margin-bottom:10px;
  font-size:1.25rem;
}

.version-card p{
  font-size:0.95rem;
  line-height:1.5;
  margin-bottom:0;
}

.active-version{
  background:#ffd000;
}

.final{
  background:linear-gradient(160deg,#fff,#fff4a3);
}

.restart-btn{
  margin-left:15px;
}

.footer-version{
  position:fixed;
  bottom:10px;
  left:50%;
  transform:translateX(-50%);
  text-align:center;
  font-size:0.8rem;
  font-weight:bold;
  color:#6b5700;
  opacity:0.75;
  z-index:850;
}

#loader{
  position:fixed;
  inset:0;
  background:linear-gradient(135deg,#fff4a3,#ffd000);
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  z-index:9999;
  transition:opacity 0.8s ease, visibility 0.8s ease;
}

#loader h1{
  font-size:5rem;
  animation:girar 2s linear infinite;
}

#loader p{
  font-size:1.3rem;
  font-weight:bold;
}

#loader.hidden{
  opacity:0;
  visibility:hidden;
}

#progress-container{
  position:fixed;
  top:0;
  left:0;
  width:100%;
  height:8px;
  background:#ffeeb0;
  z-index:999;
}

#progress-bar{
  width:0%;
  height:100%;
  background:#f4b400;
  transition:0.5s;
}

#header-bar{
  position:fixed;
  top:8px;
  left:0;
  width:100%;
  display:flex;
  justify-content:space-between;
  padding:10px 25px;
  font-weight:bold;
  color:#6b5700;
  z-index:900;
  pointer-events:none;
}

#flowers{
  position:fixed;
  inset:0;
  pointer-events:none;
  overflow:hidden;
}

.flower{
  position:absolute;
  top:-100px;
  animation:caer linear infinite;
}

#achievement{
  position:fixed;
  right:20px;
  bottom:20px;
  background:white;
  border:3px solid #ffd000;
  border-radius:18px;
  padding:15px 22px;
  font-weight:bold;
  box-shadow:0 10px 25px rgba(0,0,0,0.18);
  transform:translateY(120px);
  opacity:0;
  transition:0.5s;
  z-index:1000;
}

#achievement.show{
  transform:translateY(0);
  opacity:1;
}

#assistant{
  position:fixed;
  bottom:25px;
  left:25px;
  display:flex;
  align-items:center;
  gap:12px;
  z-index:950;
  font-size:2rem;
}

#assistant-text{
  background:white;
  padding:12px 18px;
  border-radius:20px;
  border:2px solid #ffd000;
  box-shadow:0 10px 20px rgba(0,0,0,0.1);
  font-size:0.9rem;
  max-width:230px;
}

.confetti{
  position:fixed;
  top:-50px;
  z-index:9999;
  pointer-events:none;
  animation:confettiFall linear forwards;
}

.screen::-webkit-scrollbar,
.letter::-webkit-scrollbar{
  width:10px;
}

.screen::-webkit-scrollbar-track,
.letter::-webkit-scrollbar-track{
  background:#fff7cc;
  border-radius:20px;
}

.screen::-webkit-scrollbar-thumb,
.letter::-webkit-scrollbar-thumb{
  background:#ffd000;
  border-radius:20px;
}

@keyframes fadeIn{
  from{
    opacity:0;
    transform:scale(0.95);
  }
  to{
    opacity:1;
    transform:scale(1);
  }
}

@keyframes girar{
  from{
    transform:rotate(0deg);
  }
  to{
    transform:rotate(360deg);
  }
}

@keyframes caer{
  from{
    transform:translateY(-100px) rotate(0deg);
  }
  to{
    transform:translateY(120vh) rotate(360deg);
  }
}

@keyframes confettiFall{
  from{
    transform:translateY(-50px) rotate(0deg);
    opacity:1;
  }
  to{
    transform:translateY(110vh) rotate(720deg);
    opacity:0;
  }
}

@media(max-width:768px){

  body{
    overflow:auto;
  }

  #game{
    height:auto;
    min-height:100vh;
    padding:55px 12px 95px;
  }

  .screen{
    width:94%;
    max-height:none;
    padding:30px 22px;
    border-radius:25px;
  }

  h1{
    font-size:2.25rem;
  }

  h2{
    font-size:1.9rem;
  }

  p{
    font-size:1rem;
  }

  .items span{
    width:100%;
    padding:14px 18px;
  }

  .counter-box p{
    font-size:1.7rem;
  }

  button{
    width:100%;
    max-width:310px;
  }

  .restart-btn{
    margin-left:0;
  }

  #header-bar{
    font-size:0.8rem;
    padding:8px 14px;
  }

  #assistant{
    left:10px;
    bottom:12px;
    transform:scale(0.82);
    transform-origin:left bottom;
  }

  #assistant-text{
    max-width:175px;
    font-size:0.78rem;
    padding:10px 12px;
  }

  #achievement{
    left:12px;
    right:12px;
    bottom:80px;
    text-align:center;
  }

  .version-list{
    grid-template-columns:1fr;
  }

  .letter{
    max-height:55vh;
    padding:22px;
  }

  .footer-version{
    font-size:0.68rem;
    width:90%;
  }
}

@media(max-width:768px){

  body{
    overflow:auto;
  }

  .screen{

    width:95%;

    min-height:auto;

    max-height:88vh;

    padding:25px 18px;

    overflow-y:auto;

  }

  h1{
    font-size:2rem;
  }

  h2{
    font-size:1.8rem;
  }

  p{
    font-size:0.95rem;
  }

  .items{
    gap:12px;
  }

  .items span{

    width:100%;

    padding:14px;

    font-size:1rem;

  }

  button{

    width:100%;

    max-width:320px;

  }

  .counter-box p{
    font-size:1.7rem;
  }

  .footer-version{
    font-size:0.7rem;
  }

}

@media(max-width:768px){

  #assistant{
    bottom:68px;
    left:12px;
    transform:scale(0.78);
    transform-origin:left bottom;
  }

  #assistant-text{
    max-width:210px;
  }

  .footer-version{
    bottom:18px;
    padding:0 45px;
    line-height:1.3;
  }

  #achievement{
    bottom:130px;
  }
}