:root{
  --bg:#f3e6f2;
  --box:#ffffff;
  --box2:#f6f6f6;
  --ink:#000;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  height:100vh;
  display:grid;
  place-items:center;
  background:#111;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

.gb-wrap{ width:min(620px,95vw); }

.gb{
  background:#2a2a2a;
  padding:16px;
  border-radius:18px;
  box-shadow:0 18px 40px rgba(0,0,0,.55);
}

.screen{
  width:480px;
  height:432px;
  background:var(--bg);
  border:8px solid #000;
  position:relative;
  overflow:hidden;
}

.scene{
  position:absolute;
  inset:0 0 118px 0; /* room for textbox */
  display:flex;
  justify-content:center;
  align-items:center;
}

.sprite{
  width:150px;
  height:auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius:8px;
}

/* Starter Pokeballs */
.starters{
  display:flex;
  gap:30px;
  align-items:center;
  justify-content:center;
}

.pokeball{
  width:90px;
  height:90px;
  border-radius:50%;
  border:6px solid #000;
  background:linear-gradient(#c21c1c 50%, #f1f1f1 50%);
  position:relative;
  cursor:pointer;
  box-shadow:0 8px 0 rgba(0,0,0,.25);
}
.pokeball::before{
  content:"";
  position:absolute;
  top:50%;
  left:0;
  right:0;
  height:6px;
  transform:translateY(-50%);
  background:#000;
}
.pokeball::after{
  content:"";
  position:absolute;
  top:50%;
  left:50%;
  width:24px;
  height:24px;
  transform:translate(-50%,-50%);
  border-radius:50%;
  border:5px solid #000;
  background:#fff;
}
.pokeball:hover{ transform:translateY(-2px); }

/* Pokéball shake animation (authentic touch) */
.pokeball.shake {
  animation: ballShake 0.55s ease-in-out;
}
@keyframes ballShake{
  0%{ transform: translateX(0); }
  20%{ transform: translateX(-6px); }
  40%{ transform: translateX(6px); }
  60%{ transform: translateX(-4px); }
  80%{ transform: translateX(4px); }
  100%{ transform: translateX(0); }
}

/* Textbox */
.textbox{
  position:absolute;
  bottom:0;
  left:0;
  right:0;
  height:118px;
  background:var(--box);
  border-top:8px solid #000;
  padding:12px;
  font-size:22px;
  line-height:1.05;
  color:var(--ink);
}

.textbox::before{
  content:"";
  position:absolute;
  inset:10px;
  border:4px solid #000;
  pointer-events:none;
}

.text-lines{ padding:12px 18px; }
.line{ height:28px; white-space:pre; }

.next{
  position:absolute;
  right:24px;
  bottom:18px;
  animation:blink 1s infinite;
}
@keyframes blink{ 50%{ opacity:0; } }

/* YES/NO prompt */
.prompt{
  position:absolute;
  right:24px;
  top:12px;
  width:150px;
  height:84px;
}
.menu{
  border:4px solid #000;
  background:var(--box2);
  padding:12px;
  font-size:22px;
  position:relative;
}
.menu-item{
  padding-left:26px;
  height:28px;
  display:flex;
  align-items:center;
}
.cursor{
  position:absolute;
  left:10px;
  top:12px;
}

/* Controls */
.controls{
  margin-top:12px;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}
.btn{
  padding:8px 16px;
  border:3px solid #000;
  background:#eaeaea;
  cursor:pointer;
  font-weight:700;
  border-radius:10px;
}
.btn.secondary{ background:#cfcfcf; }
.help{ color:#ccc; font-size:12px; opacity:.9; }

.hidden{ display:none !important; }

/* Modal */
.modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.6);
  display:flex;
  justify-content:center;
  align-items:center;
  padding:20px;
}
.modal-card{
  background:#fff;
  border:8px solid #000;
  padding:16px;
  width:min(380px, 92vw);
  text-align:center;
  border-radius:14px;
}
.modal-title{
  font-weight:900;
  margin-bottom:10px;
  font-size:18px;
}
.modal-img{
  width:100%;
  height:250px;
  object-fit:cover;
  border:5px solid #000;
  border-radius:12px;
  background:#fff;
}
.modal-actions{
  margin-top:12px;
  display:flex;
  gap:10px;
  justify-content:center;
  flex-wrap:wrap;
}

/* Ending fade + final screen */
.fade{
  position:absolute;
  inset:0;
  background:#ffb6d9;
  opacity:0;
  transition: opacity 1.4s ease;
  display:flex;
  justify-content:center;
  align-items:center;
}
.fade.show{ opacity:1; }

.final{
  z-index:2;
  text-align:center;
  padding:20px;
  transform: translateY(10px);
  opacity:0;
  transition: opacity 1.2s ease, transform 1.2s ease;
}
.fade.show .final{
  opacity:1;
  transform: translateY(0px);
}

.final-text{
  font-size:28px;
  line-height:1.15;
  color:#2a0030;
  text-shadow: 0 2px 0 rgba(255,255,255,.35);
}
.final-line2{
  margin-top:14px;
  font-size:26px;
}
.replay{
  margin-top:22px;
  font-size:16px;
  padding:10px 18px;
  background:#fff;
}

/* floating hearts */
.hearts{
  position:absolute;
  inset:0;
  overflow:hidden;
  z-index:1;
  pointer-events:none;
}
.heart{
  position:absolute;
  bottom:-30px;
  font-size:22px;
  opacity:0.85;
  animation: floatUp 4.5s linear forwards;
  filter: drop-shadow(0 2px 0 rgba(255,255,255,.35));
}
@keyframes floatUp{
  0%{ transform: translateY(0) translateX(0) scale(1); opacity:0; }
  10%{ opacity:0.9; }
  100%{ transform: translateY(-520px) translateX(var(--drift)) scale(1.2); opacity:0; }
}

@media (max-width:520px){
  .screen{ width:360px; height:324px; }
  .textbox{ font-size:18px; height:92px; }
  .line{ height:24px; }
  .sprite{ width:120px; }
  .final-text{ font-size:22px; }
  .final-line2{ font-size:20px; }
}