#research-stage {
  position: relative;
  width: 100%;
  isolation: isolate;
  background: #171a20;
  color: #562c16;
}
#research-stage[hidden] { display: none; }
#research-stage[data-beat="comic"] { padding-top: 56px; }
.research-comic {
  display: block;
  border: 0;
  width: 100%;
  height: min(840px, calc(100dvh - 62px));
}
.research-canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  image-rendering: pixelated;
  touch-action: none;
}
.research-canvas:focus-visible {
  outline: 2px solid #f1cd8a;
  outline-offset: -3px;
}
.research-desk {
  position: absolute;
  z-index: 1;
  left: 50%;
  text-align: center;
  transform: translateX(-50%);
}
.research-desk[hidden] { display: none; }
.research-desk[data-mode="ready"] {
  top: 30%;
  left: 88%;
  width: max-content;
}
.research-desk[data-mode="ceremony"] {
  top: 18%;
  left: 44%;
  width: min(56%, 440px);
  padding: clamp(4px, 1.15vw, 15px);
  color: #fff2cf;
  background: #482226;
  border: 3px solid #38201b;
  box-shadow: inset 0 0 0 2px #ca9256, 0 0 0 1px #edc07c, 3px 4px #2418207c;
  animation: research-citation-in .45s ease-out both;
  pointer-events: none;
}
.research-desk h2 {
  margin: 3px 0;
  color: #ffe3a0;
  font-size: clamp(18px, 3vw, 41px);
  text-shadow: 2px 2px #2e1618;
}
.research-desk p {
  font-size: clamp(11px, 1.2vw, 16px);
  line-height: 1.3;
  margin: 2px 0;
}
.research-desk button {
  font: inherit;
  font-size: clamp(12px, 1.25vw, 16px);
  min-height: 36px;
  padding: 4px 8px;
  color: #562c16;
  background: #f5d48e;
  border: 2px solid #593224;
  box-shadow: inset 0 0 0 1px #fff1c8, 2px 2px #301913af;
  border-radius: 0;
  cursor: pointer;
}
.research-desk button:hover { background: #ffedba; }
.research-desk button:focus-visible { outline: 2px solid #21605b; outline-offset: 2px; }
.research-desk[data-mode="finish"] {
  top: 18%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 3px 4px 3px 9px;
  width: max-content;
  background: #482226;
  color: #fff2d8;
  border: 2px solid #be8754;
}
@keyframes research-citation-in {
  from { opacity: 0; transform: translate(-50%, 8px); }
}
.chapter-preview-art.birthday-preview {
  background-image: url(world-map-coast.webp);
  background-size: 360%;
  background-position: 15% 74%;
}
@media (max-width: 700px) {
  #research-stage[data-beat="comic"] { padding-top: 72px; }
  .research-comic { height: calc(100dvh - 74px); }
  .research-desk[data-mode="ready"] { left: auto; right: 1%; transform: none; }
}
