html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  min-height: 100vh;
  background-image: url("images/background.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  font-family: Arial, sans-serif;
  text-align: center;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

p {
   color: #1e293b;
}

h1 {
   color: #1e3a8a;
}

button {
  margin-top: 20px;
  padding: 12px 24px;
  border: none;
  border-radius: 20px;
  background: #93c5fd;
  color: #1e3a8a;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  transition: 0.2s;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 15px rgba(147, 197, 253, 0.8);
}

.device {
  background: rgba(255, 255, 255, 0.85);
  width: 300px;
  padding: 30px;
  border-radius: 40px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.screen {
  margin: 20px auto;
  width: 200px;
  height: 140px;
  background: #bfdbfe;
  border-radius: 25px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1e3a8a;
  font-weight: bold;
    position: relative;
  overflow: hidden;
}

.era-img {
  width: 100%;
  border-radius: 15px;
  margin: 10px 0;
}

.era-card {
  background: rgba(191, 219, 254, 0.8);
  padding: 15px;
  border-radius: 20px;
  margin-top: 15px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
  transition: 0.2s;
}

.era-card:hover {
  transform: translateY(-5px);
}

.quiz-box {
  height: auto;
  flex-direction: column;
  padding: 20px;
  gap: 10px;
}

.quiz-btn {
  width: 100%;
  margin-top: 8px;
}

#answers {
  width: 100%;
}

#result {
  margin-top: 15px;
  color: #7c3aed;
  font-weight: bold;
}

.result-img {
  width: 100%;
  border-radius: 15px;
  margin-top: 10px;
}

.character {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 110px;
  max-width: 100%;
  object-fit: contain;
  pointer-events: none;
}

#screen-text {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 16px);
  margin: 0;
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  word-break: break-word;
  z-index: 2;
}

.character {
  z-index: 1;
}

.container {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: flex-start;
  max-width: 700px;
  margin: 0 auto;
}

.pet-box {
  background: rgba(255, 255, 255, 0.85);
  padding: 20px;
  border-radius: 30px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  margin-top: 40px;
  transform: translateY(10px);
}

.stats {
  margin-top: 10px;
  width: 100%;
}

.stat {
  background: #e0f2fe;
  border-radius: 10px;
  height: 10px;
  margin: 6px 0;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: #60a5fa;
  width: 70%;
  transition: width 0.3s;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 60px);
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.card {
  width: 60px;
  height: 60px;
  background: #bfdbfe;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  cursor: pointer;
}

.menu-buttons,
.pet-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@media (max-width: 700px) {
  body {
    padding: max(28px, env(safe-area-inset-top)) 12px 20px;
    align-items: flex-start;
  }

  .container {
    flex-direction: column;
    gap: 18px;
    width: 100%;
    max-width: 100%;
    align-items: center;
  }

  .device,
  .pet-box {
    width: 100%;
    max-width: 340px;
    box-sizing: border-box;
  }

  .device {
    padding: 24px 18px;
  }

  .pet-box {
    margin-top: 0;
    transform: none;
  }

  button {
    width: 100%;
    font-size: 16px;
  }

  .screen {
    width: 100%;
    max-width: 220px;
  }
}