:root {
  color-scheme: light;
  --paper: #faf9f6;
  --ink: #272722;
  --muted: #77776f;
  --line: #cfcec6;
  --button: #fffefa;
  --shadow: #b4b2a8;
  --faint: #ecebe5;
  --error: #8b302b;
}
:root.dark {
  color-scheme: dark;
  --paper: #191a18;
  --ink: #dedfd7;
  --muted: #9a9d90;
  --line: #4a4c43;
  --button: #20221e;
  --shadow: #080907;
  --faint: #2c2e28;
  --error: #e5a49e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font:
    15px/1.7 Georgia,
    "Times New Roman",
    serif;
  transition:
    background 0.2s,
    color 0.2s;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: default;
  opacity: 0.4;
}
a {
  color: inherit;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 5px;
}
.frame {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 38px 70px;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 85px;
}
.brand {
  font-size: 19px;
  letter-spacing: -0.5px;
  text-decoration: none;
}
.links {
  display: flex;
  gap: 24px;
}
.link {
  border: 0;
  padding: 0;
  background: none;
  text-decoration: none;
  box-shadow: none;
  font-size: 13px;
}
.link:hover:not(:disabled) {
  text-decoration: underline;
  text-underline-offset: 5px;
}
.muted,
.eyebrow {
  color: var(--muted);
}
.eyebrow {
  font:
    11px/1.6 ui-monospace,
    SFMono-Regular,
    Consolas,
    monospace;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}
.welcome {
  max-width: 440px;
  margin: 16vh auto 0;
  padding: 0 24px;
}
h1 {
  font-weight: normal;
  font-size: 32px;
  line-height: 1.3;
  letter-spacing: -1px;
  margin: 0 0 22px;
}
h2 {
  font-weight: normal;
  font-size: 22px;
  line-height: 1.4;
  margin: 0 0 24px;
}
h3 {
  font-size: 15px;
  font-weight: normal;
  margin: 24px 0 12px;
}
p {
  margin: 0 0 20px;
}
.welcome .intro {
  max-width: 340px;
  margin-bottom: 44px;
  color: var(--muted);
}
.menu {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 16px;
}
.button {
  display: inline-block;
  background: var(--button);
  border: 1px solid var(--ink);
  border-radius: 0;
  box-shadow: 2px 2px 0 var(--shadow);
  padding: 8px 20px;
  line-height: 1.5;
  text-align: left;
  min-height: 42px;
  transition:
    box-shadow 0.12s,
    transform 0.12s;
}
.button:hover:not(:disabled) {
  box-shadow: 3px 3px 0 var(--shadow);
  transform: translate(-1px, -1px);
}
.button:active:not(:disabled) {
  box-shadow: 0 0 0 var(--shadow);
  transform: translate(1px, 1px);
}
.welcome .button {
  min-width: 172px;
}
.footer {
  position: fixed;
  bottom: 20px;
  left: 32px;
  right: 32px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  pointer-events: none;
}
.footer button {
  pointer-events: auto;
}
.single {
  max-width: 570px;
  margin: 0 auto;
}
.small-intro {
  margin: 0 0 30px;
  color: var(--muted);
}
.slot {
  width: 100%;
  padding: 17px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  text-align: left;
  display: flex;
  gap: 18px;
  align-items: baseline;
}
.slot:hover:not(:disabled) .slot-title {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.slot-number {
  color: var(--muted);
  font:
    12px ui-monospace,
    monospace;
  min-width: 20px;
}
.slot-copy {
  flex: 1;
}
.slot-title {
  display: block;
  font-size: 17px;
}
.slot-status {
  font-size: 12px;
  color: var(--muted);
}
.slot-recent {
  font-size: 11px;
  color: var(--muted);
}
.back {
  margin-top: 32px;
}
.fields {
  display: grid;
  gap: 24px;
  margin: 30px 0;
}
.fields label {
  display: block;
}
.fields label span {
  display: block;
  margin-bottom: 7px;
}
.fields small {
  color: var(--muted);
  font-size: 12px;
}
.text-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: 9px 0;
  outline-offset: 3px !important;
}
.text-input:focus {
  border-color: var(--ink);
}
textarea.text-input {
  resize: vertical;
  min-height: 72px;
}
.play-grid {
  display: grid;
  grid-template-columns: 155px minmax(0, 570px) 180px;
  gap: 35px;
  align-items: start;
}
.rail {
  font-size: 12px;
  color: var(--muted);
  padding-top: 4px;
}
.rail h2 {
  font: inherit;
  color: var(--ink);
  margin-bottom: 15px;
}
.rail button {
  display: block;
  margin-bottom: 15px;
}
.rail .past {
  margin-top: 34px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.rail .past p {
  line-height: 1.6;
  margin-bottom: 13px;
}
.story {
  min-width: 0;
}
.story h1 {
  font-size: 26px;
  margin-bottom: 34px;
}
.scene {
  font-size: 18px;
  line-height: 1.9;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-width: 560px;
}
.scene.gentle {
  animation: arrive 0.5s ease;
}
.scene p {
  margin-bottom: 24px;
}
.choices {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin: 34px 0;
}
.choices .button {
  font-size: 14px;
  max-width: 100%;
}
.action-form {
  margin: 35px 0 28px;
}
.input-row {
  display: flex;
  align-items: center;
  gap: 18px;
}
.input-row .text-input {
  font-size: 15px;
}
.input-row button {
  flex-shrink: 0;
}
.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 9px;
}
.world {
  font-size: 12px;
  line-height: 1.7;
}
.world section {
  margin: 0 0 28px;
}
.world h2 {
  font-size: 12px;
  font-weight: normal;
  color: var(--muted);
  margin-bottom: 10px;
}
.world ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.world li {
  margin-bottom: 7px;
  overflow-wrap: anywhere;
}
.stat {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.draft {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.draft .eyebrow {
  margin-bottom: 15px;
}
.draft-prose {
  white-space: pre-wrap;
  font-size: 18px;
  line-height: 1.9;
  overflow-wrap: anywhere;
}
.draft-prose:not(:empty)::after {
  content: "▏";
  color: var(--muted);
  animation: blink 1s steps(2, end) infinite;
}
.status-line {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 18px;
  align-items: baseline;
  margin-top: 15px;
}
.error {
  color: var(--error);
  font-size: 14px;
  margin: 22px 0;
  white-space: pre-wrap;
}
.notice {
  border-left: 1px solid var(--line);
  padding-left: 16px;
  font-size: 13px;
  color: var(--muted);
  margin: 20px 0;
}
.analysis {
  border-top: 1px solid var(--line);
  margin-top: 38px;
  padding-top: 28px;
}
.analysis h2 {
  font-size: 20px;
}
.analysis h3 {
  color: var(--muted);
  font-size: 12px;
}
.analysis p {
  font-size: 15px;
  margin-bottom: 14px;
}
.evidence {
  font:
    11px ui-monospace,
    monospace;
  margin-left: 5px;
}
.questions {
  border-top: 1px solid var(--line);
  margin-top: 30px;
  padding-top: 25px;
}
.qa {
  margin-bottom: 25px;
}
.qa .question {
  font-size: 16px;
  margin-bottom: 10px;
}
.qa .answer {
  white-space: pre-wrap;
  font-size: 15px;
}
.kind {
  font:
    11px ui-monospace,
    monospace;
  color: var(--muted);
  margin-bottom: 7px;
}
.setting-row {
  margin: 24px 0;
}
.setting-row label {
  display: block;
  margin-bottom: 8px;
}
select {
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 7px 12px;
}
.facts {
  font-size: 14px;
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr);
  gap: 12px;
  margin: 28px 0;
}
.facts dt {
  color: var(--muted);
}
.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.empty {
  color: var(--muted);
}
dialog {
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 35px;
  max-width: 560px;
  width: calc(100% - 40px);
  max-height: 80vh;
  box-shadow: 5px 5px 0 #0002;
}
dialog::backdrop {
  background: #0004;
  backdrop-filter: blur(2px);
}
dialog h2 {
  font-size: 22px;
}
.dialog-actions {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-top: 28px;
}
.checkpoints {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}
.checkpoints li {
  margin: 20px 0;
}
.checkpoints .button {
  width: 100%;
}
.journal-entry {
  border-top: 1px solid var(--line);
  padding-top: 18px;
  margin-top: 25px;
}
.journal-entry h3 {
  font-size: 14px;
}
.journal-entry p {
  font-size: 14px;
  white-space: pre-wrap;
}
.journal-entry .eyebrow {
  font-size: 10px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
[hidden] {
  display: none !important;
}
@keyframes arrive {
  from {
    opacity: 0.1;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
@media (max-width: 950px) {
  .play-grid {
    grid-template-columns: minmax(0, 1fr) 160px;
  }
  .rail {
    grid-column: 1/-1;
    display: flex;
    gap: 23px;
    align-items: center;
    padding: 0;
  }
  .rail h2 {
    display: none;
  }
  .rail button {
    margin: 0;
  }
  .rail .past {
    display: none;
  }
  .top {
    margin-bottom: 45px;
  }
  .frame {
    max-width: 850px;
  }
}
@media (max-width: 600px) {
  .frame {
    padding: 24px 23px 70px;
  }
  .top {
    margin-bottom: 40px;
    align-items: center;
  }
  .brand {
    font-size: 17px;
  }
  .links {
    gap: 16px;
  }
  .link {
    font-size: 12px;
  }
  .welcome {
    margin-top: 13vh;
  }
  h1 {
    font-size: 29px;
  }
  .play-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
  }
  .rail {
    display: flex;
    flex-wrap: wrap;
    gap: 23px;
    width: 100%;
    order: 0;
  }
  .story {
    order: 1;
    width: 100%;
  }
  .world {
    order: 2;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 25px;
    border-top: 1px solid var(--line);
    padding-top: 25px;
  }
  .world section {
    margin-bottom: 10px;
  }
  .story h1 {
    font-size: 23px;
    margin-bottom: 27px;
  }
  .scene,
  .draft-prose {
    font-size: 17px;
    line-height: 1.85;
  }
  .choices {
    margin-top: 28px;
  }
  .choices .button {
    font-size: 14px;
    padding: 10px 16px;
  }
  .input-row {
    gap: 12px;
  }
  .input-row .button {
    padding: 7px 13px;
  }
  .footer {
    left: 23px;
    right: 23px;
    bottom: 15px;
  }
  .facts {
    grid-template-columns: 80px minmax(0, 1fr);
  }
  dialog {
    padding: 25px;
  }
  .slot-title {
    font-size: 16px;
  }
  .slot-recent {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Keep the footer in document flow, including on long stories and phone screens. */
#app {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
#app > .frame {
  width: 100%;
  flex: 1;
}
#app > .welcome {
  width: 100%;
  flex: 1;
}
.footer {
  position: static;
  flex-shrink: 0;
  margin: 30px 32px 20px;
  gap: 20px;
}
@media (max-width: 600px) {
  .footer {
    margin: 25px 23px 20px;
  }
}

.backup-actions {
  display: flex;
  gap: 24px;
  margin: 20px 0;
}

/* Daydreamer: the same quiet page, with a little light at its edges. */
:root {
  --paper: #f8f7f4;
  --ink: #34343f;
  --muted: #7e7b89;
  --line: #d7d3db;
  --button: #fcfbf8;
  --dream-glow: #e8e1f066;
  --warm-glow: #f2e7d64d;
}
:root.dark {
  --paper: #1c1c24;
  --ink: #e3dfe9;
  --muted: #a39daf;
  --line: #47424f;
  --button: #25232c;
  --dream-glow: #65507821;
  --warm-glow: #8372590d;
}
body {
  background:
    radial-gradient(ellipse at 24% 12%, var(--dream-glow), transparent 58%),
    radial-gradient(ellipse at 80% 74%, var(--warm-glow), transparent 55%),
    var(--paper);
  background-attachment: fixed;
}
.brand {
  letter-spacing: 1px;
}
.brand::before {
  content: "✧";
  color: var(--muted);
  font-size: 14px;
  margin-right: 11px;
}
.welcome h1 {
  font-size: clamp(42px, 7vw, 62px);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -2px;
  margin-bottom: 20px;
}
.welcome .intro {
  line-height: 2;
}
.reader-shell {
  position: relative;
  margin: 0 0 28px;
  min-width: 0;
}
.reader {
  position: relative;
  height: clamp(290px, 52svh, 520px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  overflow-anchor: none;
  scrollbar-width: none;
  padding: 42px 15px 16px 2px;
  scroll-padding: 42px 0 24px;
  -webkit-mask-image: linear-gradient(
    transparent,
    #000 38px,
    #000 calc(100% - 14px),
    transparent
  );
  mask-image: linear-gradient(
    transparent,
    #000 38px,
    #000 calc(100% - 14px),
    transparent
  );
}
.reader:focus-visible {
  outline: 1px solid var(--line);
  outline-offset: 7px;
}
.reader-caption {
  min-height: 40px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding-top: 13px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.1px;
}
.reader-caption .link {
  font-size: 11px;
}
.reader-history,
.current-passage {
  font-size: 18px;
  line-height: 1.95;
  overflow-wrap: anywhere;
}
.past-passage {
  color: var(--muted);
  opacity: 0.6;
  margin: 0 0 46px;
  transition: opacity 1.8s ease;
}
.past-passage:last-child {
  opacity: 0.8;
}
.past-passage:hover,
.past-passage:focus-within,
.reader[data-following="false"] .past-passage {
  opacity: 1;
}
.passage-action {
  font-size: 12px;
  font-style: italic;
  letter-spacing: 0.1px;
  margin-bottom: 20px;
}
.current-passage {
  opacity: 1;
  transition: opacity 1.8s ease;
}
.current-passage.receding {
  opacity: 0.42;
}
.reader[data-following="false"] .current-passage {
  opacity: 1;
}
.reader .scene {
  white-space: normal;
  line-height: 1.95;
}
.reader p:first-child {
  margin-top: 0;
}
.reader .scene.gentle {
  animation: none;
}
.passage-enter {
  animation: dream-arrive 1.15s ease-out both;
}
.reader .scene.gentle.passage-enter {
  animation: dream-arrive 1.8s ease-out both;
}
.arriving-word {
  animation: word-arrive 850ms ease-out both;
}
.reader .draft {
  border-top: 0;
  margin-top: 34px;
  padding-top: 0;
}
.reader .draft-prose {
  min-height: 0;
}
.reader .draft-prose:empty {
  min-height: 55px;
}
.reader .status-line {
  margin-top: 23px;
  font-size: 11px;
}
.reader-tail {
  height: 16px;
}
@keyframes dream-arrive {
  from {
    opacity: 0;
    transform: translateY(7px);
    filter: blur(2px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}
@keyframes word-arrive {
  from {
    opacity: 0;
    filter: blur(2px);
  }
  to {
    opacity: 1;
    filter: blur(0);
  }
}
@media (max-width: 600px) {
  .reader {
    height: clamp(270px, 48svh, 440px);
    padding-right: 8px;
  }
  .reader-history,
  .current-passage,
  .reader .scene {
    font-size: 17px;
    line-height: 1.9;
  }
  .story h1 {
    margin-bottom: 15px;
  }
  .reader-caption {
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .passage-enter,
  .arriving-word,
  .reader .scene.gentle.passage-enter {
    animation: none;
    filter: none;
  }
  .current-passage,
  .past-passage {
    transition: none;
  }
}
.current-passage.receding {
  animation: dream-recede 1.8s ease both;
}
@keyframes dream-recede {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.42;
  }
}
.reader[data-following="false"] .current-passage.receding {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .current-passage.receding {
    animation: none;
  }
}
.reader.slow-drift .arriving-word {
  animation-duration: 1.4s;
}

/* Keep the reader chrome invisible while preserving native scrolling. */
.reader::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.reader-caption {
  min-height: 0;
  justify-content: flex-end;
}

/* During play the story takes the remaining space; actions stay in view. */
.mobile-details {
  display: none;
}
body.is-playing {
  overflow: hidden;
}
#app.is-playing {
  height: var(--play-height, 100dvh);
  min-height: 0;
}
.is-playing > .frame {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 32px 0;
}
.is-playing .top {
  flex-shrink: 0;
  margin-bottom: 22px;
}
.is-playing .play-grid {
  flex: 1;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
  align-items: stretch;
}
.is-playing .story {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.is-playing .story > .eyebrow,
.is-playing .story > h1 {
  flex-shrink: 0;
}
.is-playing .story h1 {
  margin: 0 0 12px;
  font-size: 24px;
  line-height: 1.3;
}
.is-playing .reader-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  margin: 0;
}
.is-playing .reader {
  flex: 1;
  height: auto;
  min-height: 0;
  padding-top: 32px;
}
.is-playing .reader-caption {
  flex-shrink: 0;
  padding-top: 4px;
}
.action-dock {
  flex-shrink: 0;
  padding: 14px 0 2px;
}
.action-dock .choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 8px;
  margin: 0;
}
.action-dock .choices .button {
  width: 100%;
  min-height: 36px;
  padding: 7px 11px;
  text-align: left;
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.action-dock .action-form {
  margin: 10px 0 0;
}
.action-dock .input-row {
  gap: 12px;
}
.action-dock .input-row .text-input {
  min-width: 0;
}
.is-playing > .footer {
  flex-shrink: 0;
  margin: 9px 32px 12px;
}
.is-playing .play-grid > .world {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.is-playing .play-grid > .world::-webkit-scrollbar {
  display: none;
}
@media (max-width: 950px) {
  .is-playing .play-grid {
    grid-template-rows: auto minmax(0, 1fr);
    row-gap: 12px;
  }
}
@media (max-width: 600px) {
  .is-playing > .frame {
    padding: 14px 20px 0;
  }
  .is-playing .top {
    margin-bottom: 14px;
  }
  .is-playing .play-grid {
    gap: 12px;
  }
  .is-playing .rail {
    flex-shrink: 0;
    gap: 16px;
    line-height: 1.3;
  }
  .is-playing .story {
    flex: 1;
  }
  .is-playing .story > .eyebrow {
    display: none;
  }
  .is-playing .story h1 {
    font-size: 20px;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }
  .is-playing .play-grid > .world {
    display: none;
  }
  .is-playing .mobile-details {
    display: inline;
  }
  .action-dock {
    padding-top: 10px;
  }
  .action-dock .choices .button {
    font-size: 12px;
    padding: 7px 9px;
    min-height: 36px;
  }
  .action-dock .action-form {
    margin-top: 8px;
  }
  .is-playing > .footer {
    margin: 7px 20px max(9px, env(safe-area-inset-bottom));
    font-size: 10px;
  }
}
/* Give the custom action room when a phone keyboard reduces the viewport. */
.is-playing.keyboard-open .action-dock .choices,
.is-playing.keyboard-open .rail {
  display: none;
}
@media (max-height: 450px) {
  .is-playing .top {
    margin-bottom: 6px;
  }
  .is-playing .story h1 {
    font-size: 18px;
  }
  .is-playing .rail {
    display: none;
  }
  .is-playing .play-grid {
    grid-template-rows: minmax(0, 1fr);
  }
  .action-dock .choices .button {
    padding: 4px 8px;
    font-size: 11px;
    min-height: 28px;
  }
  .is-playing > .footer {
    margin-top: 4px;
    margin-bottom: 5px;
  }
}
