/* The welcome page: the tavern fills the frame, and the interface sits over it the Final Fantasy
   way (ART-BIBLE.md §8): the location title top left, key-glyph commands, and a dialogue box at the
   bottom, all in a coder's terminal font (§14, decision 38). */
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
:root {
  --text: #f2f2f2;
  --candle: #ffb35a;
  --candle-core: #ffe2a0;
  --terminal: #9be39b;
  --box: rgb(8 14 30 / 88%);
  --line: rgb(170 195 255 / 45%);
  --shadow: 0 1px 3px rgb(0 0 0 / 90%), 0 0 8px rgb(0 0 0 / 60%);
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000000; }
body { color: var(--text); font: 400 16px/1.6 var(--mono); text-shadow: var(--shadow); }

/* The tavern: the renderer's canvas over a painted poster shown until it starts. */
.scene { position: relative; width: 100%; height: 100svh; min-height: 520px; overflow: hidden; }
.scene canvas, .scene .view, .scene .poster { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene .poster { object-fit: contain; }
.pixels { image-rendering: pixelated; }
.glow { mix-blend-mode: screen; opacity: 0.85; }
.scene.live .poster { display: none; }

/* The location title, with its thin underline flourish, and the subtitle line. */
.location { position: absolute; top: 20px; left: 24px; z-index: 2; }
.location h1 {
  margin: 0;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0 80px 4px 0;
  display: inline-block;
  background: linear-gradient(90deg, rgb(242 242 242 / 85%) 60%, transparent) bottom left / 100% 1px no-repeat;
}
.location p { margin: 4px 0 0 22px; font-size: 0.95rem; opacity: 0.9; }

/* Commands as small rounded-square key glyphs with labels. */
.commands {
  position: absolute;
  left: 24px;
  top: 42%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.commands a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
  min-height: 44px;
}
.commands a:hover span, .commands a:focus-visible span { color: var(--candle-core); }
kbd {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1.5px solid var(--text);
  border-radius: 6px;
  font: 700 0.8rem var(--mono);
  box-shadow: 0 1px 3px rgb(0 0 0 / 80%);
}

/* The dialogue box: a dark band fading at its ends, the speaker's name over a fine line. */
.dialogue {
  position: absolute;
  left: 50%;
  bottom: 3.5%;
  z-index: 2;
  transform: translateX(-50%);
  width: min(900px, 92%);
  padding: 14px 64px 22px;
  background: linear-gradient(90deg, transparent, var(--box) 9%, var(--box) 91%, transparent);
  cursor: pointer;
}
.speaker {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 1.05rem;
  padding-bottom: 6px;
  background: linear-gradient(90deg, var(--line), rgb(170 195 255 / 25%) 70%, transparent) bottom left / 100% 1px no-repeat;
}
.pages p { margin: 0 0 8px; min-height: 3.2em; font-size: 1.02rem; }
.dialogue:not(.paged) .pages p { min-height: 0; }
.command {
  display: block;
  margin: 6px 0;
  color: var(--terminal);
  text-decoration: none;
  font-weight: 700;
}
.command:hover, .command:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible { outline: 2px solid var(--candle); outline-offset: 3px; border-radius: 4px; }
.next {
  position: absolute;
  right: 40px;
  bottom: 12px;
  font-size: 0.8rem;
  opacity: 0;
}
.dialogue.paged.ready:not(.last) .next { opacity: 0.9; }
/* The last page waits like a terminal prompt, with a blinking block cursor. */
.dialogue.paged.ready.last .pages p:not([hidden])::after {
  content: "█";
  margin-left: 4px;
  color: var(--terminal);
}
@media (prefers-reduced-motion: no-preference) {
  .dialogue.paged.ready:not(.last) .next { animation: bob 1.2s ease-in-out infinite; }
  .dialogue.paged.ready.last .pages p:not([hidden])::after { animation: blink 1.1s steps(1) infinite; }
  @keyframes bob { 50% { transform: translateY(3px); } }
  @keyframes blink { 50% { opacity: 0; } }
}

/* Phones: the box spans the width along the bottom. */
@media (max-width: 700px) {
  .location { top: 14px; left: 16px; }
  .location h1 { font-size: 1.6rem; padding-right: 48px; }
  .commands { top: auto; bottom: 230px; left: 16px; flex-direction: row; gap: 16px; }
  .dialogue { width: 100%; padding: 12px 22px 20px; bottom: 0; background: var(--box); }
  .pages p { font-size: 0.92rem; min-height: 4.8em; }
  .next { right: 18px; }
}

/* Cait's "…" while the dialogue types (ART-BIBLE.md §8), placed over the cat by the renderer. */
.cait-bubble {
  position: absolute;
  left: var(--x, 55%);
  top: var(--y, 70%);
  z-index: 2;
  transform: translate(-50%, calc(-100% - 6px));
  padding: 0 10px 4px;
  background: #f2f2f2;
  color: #1c1612;
  border-radius: 12px;
  font: 700 1.1rem/1.2 var(--mono);
  text-shadow: none;
  box-shadow: 0 2px 8px rgb(0 0 0 / 55%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
body[data-talking] .scene.live .cait-bubble { opacity: 1; }

/* The Sound toggle sits with the commands, as a key glyph like the others. */
.commands .sound {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: 400 1.05rem var(--mono);
  text-shadow: var(--shadow);
  min-height: 44px;
  cursor: pointer;
}
.commands .sound[aria-pressed="true"] kbd { background: rgb(242 242 242 / 18%); }
.commands .sound:hover span, .commands .sound:focus-visible span { color: var(--candle-core); }

/* Phones: a one-time hint that the room can be dragged around. */
.hint {
  position: absolute;
  left: 50%;
  top: 38%;
  z-index: 2;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgb(8 14 30 / 70%);
  font-size: 0.85rem;
  opacity: 0;
  transition: opacity 0.6s;
  pointer-events: none;
}
.hint.shown { opacity: 0.9; }

/* The staff's speech bubble (ART-BIBLE.md §8), over whoever was clicked; short and bubble-first. */
.say {
  position: absolute;
  left: var(--x, 50%);
  top: var(--y, 50%);
  z-index: 2;
  transform: translate(-50%, calc(-100% - 10px));
  width: max-content;
  max-width: min(300px, 80vw);
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f2f2f2;
  color: #1c1612;
  font-size: 0.85rem;
  line-height: 1.45;
  text-shadow: none;
  box-shadow: 0 2px 10px rgb(0 0 0 / 55%);
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
}
.say.shown { opacity: 1; }
.say:empty { padding: 0; }
