/* Shockwave-era chunky + gothic moonlight. Annabel Lee glows arsenic green. */
:root {
  --night: #0b1026;
  --ink: #e8e2d0;
  --moon: #f3ecd2;
  --accent: #8fb3d9;   /* hydrangea blue */
  --ghost: #9fd8a8;    /* pale arsenic glow */
  --ghost-deep: #3f7d4f;
  --marigold: #f2a33a; /* cempasúchil, to light the way home */
  --bevel-hi: #4a5a8a;
  --bevel-lo: #05081a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
.stanza span { transition: opacity .6s ease; }
body {
  margin: 0; min-height: 100vh; background: var(--night); color: var(--ink);
  font-family: Georgia, "Times New Roman", serif; display: grid; justify-items: center; align-content: start;
  padding: 1rem;
}
#loader { margin-top: 30vh; text-align: center; font-family: Verdana, Tahoma, sans-serif; }
.loader-title { font-family: Georgia, serif; font-style: italic; font-size: 1.6rem; }
.bar { width: min(320px, 80vw); height: 18px; border: 2px solid; border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo); background: #000; }
.fill { height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--ghost) 0 10px, var(--ghost-deep) 10px 12px); }
.loader-pct { font-size: .8rem; letter-spacing: .05em; }

#stage { width: min(1200px, 100%); }
canvas { width: 100%; height: auto; display: block; 
  border: 3px solid; border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi); }

.meter-wrap { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; font-family: Verdana, Tahoma, sans-serif; font-size: .8rem; }
.meter { flex: 1; height: 14px; background: #000; border: 2px solid; border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo); }
.meter-fill { height: 100%; width: 60%; background: var(--ghost); box-shadow: 0 0 8px var(--ghost); transition: width .15s linear; }
.meter-fill.low { background: #c9b26b; box-shadow: 0 0 8px #c9b26b; }

#dialogue { margin-top: .75rem; padding: .9rem 1rem; min-height: 10rem; background: rgba(5,8,26,.85);
  border: 2px solid; border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi); }
.stanza { white-space: pre-line; font-style: italic; color: var(--moon); margin: 0 0 .7rem; line-height: 1.5; }
.stanza .missing { color: var(--ghost); }
/* Her words appear on the scene, in the sky between the tomb and the moon */
.ghost { position: absolute; left: 50%; top: 5%; transform: translateX(-50%); width: min(78%, 46rem); margin: 0;
  text-align: center; font-style: italic; font-size: clamp(.95rem, 2.1vw, 1.45rem); line-height: 1.4;
  color: var(--ghost); text-shadow: 0 0 10px rgba(159,216,168,.55), 0 1px 3px #000, 0 0 2px #000;
  pointer-events: none; opacity: 0; }
.ghost.show { animation: herWords 1.6s ease forwards; }
@keyframes herWords { from { opacity: 0; filter: blur(3px); } to { opacity: 1; filter: none; } }
@media (prefers-reduced-motion: reduce) { .ghost.show { animation: none; opacity: 1; } }
.ghost.offline::after { content: " ✦"; opacity: .6; }

.choices { display: grid; gap: .45rem; margin: .2rem 0 .6rem; }
button { font: inherit; color: var(--ink); background: #18203f; cursor: pointer; padding: .45rem .8rem;
  border: 2px solid; border-color: var(--bevel-hi) var(--bevel-lo) var(--bevel-lo) var(--bevel-hi); }
button:hover, button:focus-visible { background: #22305c; outline: 2px dashed var(--ghost); outline-offset: 2px; }
button:active { border-color: var(--bevel-lo) var(--bevel-hi) var(--bevel-hi) var(--bevel-lo); }
button:disabled { opacity: .4; cursor: default; }
.choices button { text-align: left; font-style: italic; }
button.big { margin-top: .6rem; }

#candle { margin-top: .8rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
#candle label { flex-basis: 100%; }
#candle input { flex: 1 1 10rem; padding: .4rem; font: inherit; }
#candle small { flex-basis: 100%; opacity: .7; }

.toggles { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .6rem; font-size: .85rem; opacity: .85; }

@media (prefers-reduced-motion: reduce) { .meter-fill { transition: none; } }

/* ---------- Credits ---------- */
.scene-wrap { position: relative; }
#credits { position: absolute; inset: 3px; overflow: hidden; background: rgba(5,8,26,.72);
  font-family: Georgia, serif; text-align: center; color: var(--ink); animation: creditsIn 1.5s ease both; }
#credits .roll { position: absolute; left: 0; right: 0; top: 100%; padding: 0 1rem; animation: roll var(--roll, 24s) linear forwards; }
#credits h3 { margin: 1.1rem 0 .15rem; font: italic .8rem Verdana, Tahoma, sans-serif; letter-spacing: .08em; color: var(--ghost); text-transform: uppercase; }
#credits p { margin: 0; font-size: clamp(.8rem, 2.2vw, 1rem); line-height: 1.4; }
#credits .c-title { font-style: italic; font-size: clamp(1.3rem, 4vw, 2rem); color: var(--ghost); text-shadow: 0 0 10px rgba(159,216,168,.5); }
#credits .c-sub { opacity: .8; }
#c-candles { margin-top: 1rem; color: var(--marigold); }
#credits .c-end { margin: 2rem 0 0; font-style: italic; color: var(--ghost); }
@keyframes roll { to { transform: translateY(calc(-100% - var(--h, 450px))); } }
@keyframes creditsIn { from { opacity: 0; } }
#credits.still .roll { position: static; animation: none; padding: 1rem; }
#credits.still { overflow-y: auto; }

/* Wide screens: the poem and her words sit beside the scene, so nothing needs scrolling */
@media (min-width: 1000px) {
  #stage { width: min(1560px, 100%); display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(320px, 1fr);
    grid-template-areas: "scene dialogue" "meter dialogue" "toggles toggles"; column-gap: 1rem; align-items: start; }
  .scene-wrap { grid-area: scene; }
  .meter-wrap { grid-area: meter; }
  .toggles { grid-area: toggles; }
  #dialogue { grid-area: dialogue; margin-top: 0; align-self: stretch; contain: size; overflow-y: auto; min-height: 0; }
}
