:root {
  --ink: #2e2b32;
  --paper: #f7efd9;
  --paper-deep: #ead9b8;
  --night: #10213d;
  --night-deep: #071426;
  --cream: #ffe6b8;
  --gold: #f7c768;
  --wood: #9a7657;
  --wood-soft: #c49a71;
  --green: #6c8062;
  --shadow: rgba(23, 17, 20, 0.24);
  --soft-shadow: rgba(23, 17, 20, 0.12);
  --focus: rgba(255, 224, 157, 0.75);
  font-family: "Songti SC", "STSong", "Noto Serif SC", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 240, 202, 0.24), transparent 36rem),
    linear-gradient(180deg, #071221 0%, #101f35 48%, #1a2232 100%);
  overflow: hidden;
}

button {
  border: 0;
  color: inherit;
  font: inherit;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 4px;
}

.storybook {
  position: relative;
  width: 100vw;
  height: 100vh;
  min-height: 540px;
  overflow: hidden;
}

.sound-toggle {
  position: fixed;
  z-index: 100;
  top: 1.1rem;
  right: 1.2rem;
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  color: rgba(255, 238, 204, 0.72);
  background: rgba(12, 22, 36, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 238, 204, 0.18);
  backdrop-filter: blur(6px);
  opacity: 0.72;
  transition: opacity 300ms ease, background 300ms ease, box-shadow 300ms ease;
}

.sound-toggle:hover,
.sound-toggle.is-on {
  opacity: 1;
  background: rgba(63, 54, 47, 0.5);
  box-shadow: inset 0 0 0 1px rgba(255, 226, 164, 0.35), 0 0 18px rgba(255, 212, 128, 0.18);
}

.sound-entry {
  position: fixed;
  z-index: 110;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 0 1.5rem 11vh;
  color: rgba(255, 239, 207, 0.9);
  background: rgba(23, 22, 25, 0.08);
  cursor: pointer;
}

.sound-entry[hidden] {
  display: none;
}

.sound-entry span {
  padding-bottom: 0.38rem;
  border-bottom: 1px solid rgba(255, 225, 170, 0.42);
  font-size: clamp(1rem, 1.55vw, 1.22rem);
  text-shadow: 0 2px 18px rgba(21, 13, 10, 0.72);
  animation: soundInvitation 2600ms ease-in-out infinite;
}

.scene {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1200ms ease;
}

.scene.is-active {
  opacity: 1;
  pointer-events: auto;
}

.dialogue {
  display: grid;
  gap: 0.52rem;
  min-height: 10.6rem;
}

.dialogue > .line:not(:last-child) {
  display: none;
}

.line {
  max-width: min(70vw, 720px);
  color: rgba(49, 43, 45, 0.92);
  font-size: clamp(1rem, 1.45vw, 1.42rem);
  line-height: 1.74;
  letter-spacing: 0;
  opacity: 0;
  transform: translateY(0.35rem);
  animation: lineIn 900ms ease forwards;
  transition: opacity 260ms ease, transform 260ms ease;
}

.line.is-leaving {
  opacity: 0;
  transform: translateY(-0.2rem);
}

.line .speaker {
  margin-right: 0.55rem;
  color: rgba(68, 57, 54, 0.66);
  font-size: 0.9em;
}

.line.emphasis {
  max-width: min(75vw, 820px);
  color: #2a252a;
  font-size: clamp(1.28rem, 2.5vw, 2.35rem);
  line-height: 1.52;
  text-shadow: 0 0 24px rgba(255, 221, 153, 0.45);
}

.storybook-entry {
  justify-self: center;
  margin-top: 1rem;
  padding: 0.6rem 1.25rem;
  border-bottom: 1px solid rgba(78, 61, 48, 0.42);
  color: #3c322c;
  font-size: clamp(1.05rem, 1.6vw, 1.4rem);
  letter-spacing: 0;
  opacity: 0;
  animation: lineIn 900ms ease forwards;
}

.storybook-entry.small {
  margin-top: 1.5rem;
  font-size: 1rem;
}

[hidden] {
  display: none !important;
}

@media (max-width: 720px) {
  .storybook {
    min-height: 100svh;
  }

  .line {
    max-width: 84vw;
    font-size: 1.03rem;
    line-height: 1.68;
  }

  .line.emphasis {
    max-width: 88vw;
    font-size: 1.42rem;
  }
}
