body {
  margin: 0;
  background-color: #000;
  color: #fff;
  font-family: 'Courier New', monospace;
  text-align: center;
  overflow-x: hidden;
}

.scene {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 1em;
  box-sizing: border-box;
  max-width: 640px;
  margin: 0 auto;
  height: 100vh;
}

.scene-text {
  font-size: 1.1em;
  margin-bottom: 10px;
  padding: 0.5em;
  background-color: #111;
  width: 100%;
  max-width: 540px;
  min-height: 60px;
  overflow-y: auto;
  line-height: 1.6;
  user-select: none;
}

.image-frame {
  width: 100%;
  max-width: 640px;
  height: 420px;
  overflow: hidden;
  background-color: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.image-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: opacity 0.3s ease-in-out;
  border: none;
}

button {
  padding: 1em 2em;
  font-size: 1.2em;
  background: #ff0066;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 0 10px #ff0066;
  transition: background 0.3s ease;
}

button:hover {
  background: #cc0055;
}

/* Credits layout override */
.credits-mode.scene {
  max-width: none;
  width: 100vw;
  padding: 0;
}

.credits-mode .image-frame {
  height: 200px;
}

.credits-mode .scene-text {
  background-color: #000000;
  width: 90vw;
  max-width: 90vw;
  padding: 1em;
  box-sizing: border-box;
  margin: 0 auto;
  text-align: left;
  line-height: 1.8;
  max-height: none;
  overflow-y: visible;
  overflow-x: hidden;
  white-space: normal;
  word-break: break-word;
  hyphens: auto;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  .scene {
    height: auto;       /* Let content expand naturally */
    min-height: 100vh;  /* Still fill the screen if short */
    padding: 0.5em;
  }

  .scene-text {
    font-size: 1rem;
    line-height: 1.4;
    max-width: 95%;
    overflow-y: visible; /* Avoid small inner scrollbars */
  }

  .image-frame {
    height: auto;        /* Scale with screen */
    max-height: 50vh;    /* Don’t exceed half the screen */
  }

  .image-frame img {
    max-height: 50vh;
    width: auto;
    height: auto;
  }

  button {
    font-size: 1rem;
    padding: 0.8em 1.2em;
    width: 90%;          /* Bigger tap target */
    max-width: 320px;
  }
}

/* Extra-small phones */
@media (max-width: 480px) {
  .scene-text {
    font-size: 0.9rem;
  }
}
