:root {
  --bg: #0b0e17;
  --panel: #121628;
  --text: #e8efff;
  --muted: #9fb0d1;
  --accent: #6ea8ff;
  --btn: #1d2440;

  /* responsive types */
  --fs-body: clamp(0.96rem, 0.9rem + 0.3vw, 1.06rem);
  --fs-h1: clamp(1.25rem, 1.05rem + 1.2vw, 1.7rem);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, Segoe UI, Roboto, Helvetica, Arial;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2242, var(--bg));
  color: var(--text);
  font-size: var(--fs-body);
  line-height: 1.55;
  overflow-x: hidden;
}

.wrap { max-width: 900px; margin: 0 auto; padding: 16px; }
.topbar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
h1 { margin: 8px 0 4px; font-size: var(--fs-h1); letter-spacing: 0.5px; }
.meter { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 0.9rem; }

/* -------------------------
   Scene layout (image + overlay text)
   ------------------------- */
.scene {
  position: relative;
  width: 100%;
  margin-bottom: 24px;
}

.scene img {
  width: 100%;
  height: auto;
  /* keep image from dominating on phones */
  max-height: min(70vh, 560px);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.08);
  display: block;
  object-fit: contain;
}

/* Overlay text now scrolls safely INSIDE the image area when long */
.overlay-text {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  padding: 22px 20px 16px 20px;
  background: linear-gradient(0deg, rgba(18,22,40,0.95) 80%, rgba(18,22,40,0.2) 100%);
  border-radius: 0 0 18px 18px;
  color: #fff;
  text-shadow: 0 0 8px #fff, 0 0 18px #6ea8ff;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.65;
  border: none;
  margin: 0;
  z-index: 2;

  /* key: keep it on-screen */
  max-height: clamp(160px, 40vh, 420px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

/* Remove any previous background/border from non-overlay block */
.text { background: none; border-radius: 0; border: none; margin-top: 0; }

/* Choices */
.choices { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 14px; }
.choice {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.09);
  background: var(--btn);
  color: var(--text);
  cursor: pointer; text-align: left;
}
.choice:hover { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(110,168,255,.2) inset; }

/* Footer / reply box */
.footer { margin-top: 16px; display: flex; flex-direction: column; gap: 12px; }
.primary {
  padding: 12px 16px; border-radius: 12px; background: var(--accent);
  border: none; color: #08101d; font-weight: 600; cursor: pointer;
}
.reply {
  padding: 14px; background: var(--panel);
  border: 1px solid rgba(255,255,255,.06); border-radius: 12px;
  min-height: 64px; line-height: 1.6; color: #eaf1ff;
}
.hidden { display: none; }

/* -------------------------
   Mobile tweaks
   ------------------------- */
@media (max-width: 640px) {
  .wrap { padding: 12px; }
  .meter { font-size: 0.88rem; gap: 10px; }
  .scene img { max-height: min(58vh, 420px); border-radius: 14px; }
  .overlay-text {
    padding: 16px 14px 12px 14px;
    border-radius: 0 0 14px 14px;
    font-size: 1rem;
    line-height: 1.55;
    max-height: clamp(140px, 45vh, 360px);
  }
  .choice { padding: 12px 12px; font-size: 0.98rem; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}
