/* story-shell — mobile-first, Capacitor-ready */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0b10;
  --ink: #f4ede2;
  --ink-dim: #b9ad9c;
  --accent: #c9a227;       /* regency gold */
  --accent-ink: #1b1407;
  --panel: rgba(13, 11, 16, 0.82);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
}

.screen { display: none; position: fixed; inset: 0; }
.screen.active { display: flex; align-items: center; justify-content: center; }
.hidden { display: none !important; }

/* ---- title + end screens ---- */
.title-card {
  max-width: 26rem;
  padding: 2rem 1.5rem calc(2rem + env(safe-area-inset-bottom));
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}
.kicker {
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.7rem;
  color: var(--accent);
}
h1, h2 { font-family: var(--serif); font-weight: 500; }
h1 { font-size: 2.6rem; line-height: 1.1; }
h2 { font-size: 2rem; }
.byline, .hint, .end-copy { color: var(--ink-dim); font-size: 0.95rem; }
.hint { font-size: 0.8rem; }
.boot-status { color: var(--accent); font-size: 0.85rem; min-height: 1.2em; }

.btn-primary {
  font-family: var(--sans);
  font-size: 1.05rem;
  padding: 0.9rem 2.4rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary:disabled { opacity: 0.5; }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--ink-dim);
  color: var(--ink);
  padding: 0.7rem 1.6rem;
  border-radius: 999px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}

/* ---- stage ---- */
#stage-screen { background: var(--bg); }
/* width/height must not depend on `position`: the SDK mount guard sets
   inline position:relative when none is set inline, which kills inset-based
   sizing and collapses the container to 0x0. */
#avatar-container { position: absolute; inset: 0; width: 100%; height: 100%; }
#avatar-container canvas { width: 100% !important; height: 100% !important; }

.caption-bar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(1.2rem + env(safe-area-inset-bottom));
  width: min(92vw, 40rem);
  background: var(--panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: 0.9rem;
  padding: 0.8rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.caption-speaker {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
}
.caption-text { font-family: var(--serif); font-size: 1.15rem; line-height: 1.35; }
.caption-bar.narrator .caption-text { font-style: italic; color: var(--ink-dim); }

.choice-overlay {
  position: absolute;
  inset: 0;
  background: rgba(13, 11, 16, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 0 1.2rem calc(2.4rem + env(safe-area-inset-bottom));
}
.choice-prompt {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  text-align: center;
  max-width: 32rem;
  color: var(--ink);
}
.choice-buttons { display: flex; flex-direction: column; gap: 0.7rem; width: min(92vw, 24rem); }
.btn-choice {
  padding: 0.95rem 1.2rem;
  border-radius: 0.8rem;
  border: 1px solid var(--accent);
  background: var(--panel);
  color: var(--ink);
  font-size: 1rem;
  font-family: var(--sans);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-choice:active { background: var(--accent); color: var(--accent-ink); }

.btn-skip {
  position: absolute;
  top: calc(0.8rem + env(safe-area-inset-top));
  right: 0.9rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: var(--panel);
  color: var(--ink-dim);
  font-size: 1.1rem;
  cursor: pointer;
}

/* Pause button (Phase 77.0) — mirrors .btn-skip, offset one button-width left */
.btn-pause {
  position: absolute;
  top: calc(0.8rem + env(safe-area-inset-top));
  right: 3.9rem; /* one btn-skip width (2.6rem) + its 0.9rem inset + 0.4rem gap */
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 1px solid rgba(201, 162, 39, 0.4);
  background: var(--panel);
  color: var(--ink-dim);
  font-size: 1.1rem;
  cursor: pointer;
}

/* Pause menu — modal overlay (mirrors .choice-overlay, centered) */
.pause-menu {
  position: absolute;
  inset: 0;
  background: rgba(13, 11, 16, 0.72);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 0 1.2rem;
}
.pause-menu .btn-primary,
.pause-menu .btn-ghost { width: min(92vw, 20rem); }

/* ---- email door ---- */
.email-form { display: flex; flex-direction: column; gap: 0.7rem; width: 100%; max-width: 20rem; }
.email-form input {
  padding: 0.85rem 1rem;
  border-radius: 0.7rem;
  border: 1px solid var(--ink-dim);
  background: rgba(244, 237, 226, 0.06);
  color: var(--ink);
  font-size: 1rem;
}
.email-form input::placeholder { color: var(--ink-dim); }
