/* The Legacy of the Dragon Queen: reader styles.
   Layout: one book centred on a night-purple stage, controls in a bar beneath it.
   A single deliberate dark look (a reading room at night). */
:root {
  --night: #140c22;
  --night-hi: #2a1a45;
  --ink: #2a1300;
  --gold: #ffd23f;
  --cream: #fff4d6;
  --muted: #8d8396;
  --display: "Lilita One", "Arial Black", system-ui, sans-serif;
  --letter: "Comic Neue", "Comic Sans MS", "Trebuchet MS", sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(ellipse at 50% 30%, var(--night-hi), var(--night) 70%) fixed, var(--night);
  color: var(--cream);
  font-family: var(--display);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-block: 12px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  box-sizing: border-box;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.library { position: absolute; width: 0; height: 0; overflow: hidden; }
.masthead { margin: 0; font-size: 15px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); text-align: center; }
.stage { width: 100%; display: flex; justify-content: center; }
.book {
  position: relative;
  width: min(100%, clamp(240px, calc((100dvh - 150px) * 2 / 3), 560px));
  aspect-ratio: 2 / 3;
  max-width: 100%;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  cursor: pointer;
  filter: drop-shadow(5px 6px 0 var(--ink)) drop-shadow(0 18px 24px rgba(0, 0, 0, 0.45));
}
.book:focus-visible { outline: 3px solid var(--gold); outline-offset: 6px; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; background: #fbf3df; color: var(--ink); font-size: 18px; }
.page { position: absolute; inset: 0; background: #fbf3df; border-radius: 2px 6px 6px 2px; overflow: hidden; }
.page > svg { display: block; width: 100%; height: 100%; }
.page.on-top { z-index: 2; }
.page.under { z-index: 1; }
.turn-fx { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 3; overflow: visible; pointer-events: none; }

/* Lettering drawn into the page SVGs by the reader. */
.bubble-text { font-family: var(--letter); font-weight: 700; fill: var(--ink); }
.voice-text { font-family: var(--letter); font-weight: 700; font-style: italic; fill: var(--ink); }
.caption-text { font-family: var(--display); fill: var(--ink); }
.title-text { font-family: var(--display); fill: var(--gold); stroke: var(--ink); stroke-width: 7px; paint-order: stroke; stroke-linejoin: round; }
.title-text.cream { fill: var(--cream); stroke-width: 6px; }

/* Crowd colours: clothes = color, hair = fill (inherited into the symbol). */
.c1 { color: #3f6fb5; fill: #3a2412; }
.c2 { color: #8a5a2b; fill: #e0b04a; }
.c3 { color: #5b8f3a; fill: #1d1d1d; }
.c4 { color: #b0413e; fill: #7a3a10; }
.c5 { color: #6d5a9e; fill: #c9c2b0; }
.c6 { color: #c2873a; fill: #4a2a12; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 10px; width: min(100%, 580px); }
.controls button {
  font: 400 15px/1 var(--display);
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 8px 14px;
  min-height: 40px;
  cursor: pointer;
}
.controls button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.controls button:disabled { opacity: 0.45; cursor: default; }
.controls button:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; }
.controls .toggle { background: var(--cream); font-size: 13px; }
.controls .toggle[aria-pressed="false"] { background: var(--muted); }
.where { min-width: 7.5em; text-align: center; font-size: 15px; letter-spacing: 0.04em; }
.break { flex-basis: 100%; height: 0; }
@media (min-width: 640px) { .break { display: none; } }
@media (prefers-reduced-motion: reduce) { .controls button:active { transform: none; } }
