* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--night); }

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 55% at 50% 62%, rgba(255, 207, 107, 0.10), transparent 70%),
    linear-gradient(180deg, var(--night) 0%, var(--night-light) 100%);
  line-height: 1.5;
}

h1, h2, h3 { margin: 0; font-family: var(--font-title); font-weight: 500; text-wrap: balance; }
p { margin: 0; }
ul { margin: 0; }

.sprite { display: block; image-rendering: pixelated; }

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) max(var(--space), env(safe-area-inset-right, 0px)) 6px max(var(--space), env(safe-area-inset-left, 0px));
}
.topbar h1 { color: var(--candle); font-size: clamp(1.3rem, 3.4vw, 1.8rem); letter-spacing: 0.02em; }
.topbar__progress { font-family: var(--font-title); color: var(--mist); font-size: 0.9rem; }
.topbar__books { display: flex; gap: 8px; }

.book-button {
  position: relative;
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 8px 16px;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-title);
  box-shadow: 0 3px 0 var(--ink-soft);
}
.book-button:hover { background: var(--candle-bright); }
.book-button.has-news::after {
  content: "";
  position: absolute;
  top: -5px;
  right: -5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--cherry);
  border: 2px solid var(--night);
}

.room {
  max-width: 1120px;
  margin: 0 auto;
  padding: 8px max(var(--space), env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 32px) max(var(--space), env(safe-area-inset-left, 0px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-areas:
    "window deduction"
    "stage deduction"
    "cat deduction";
  grid-template-rows: auto auto 1fr;
  align-items: start;
  gap: 20px 28px;
}
.window { grid-area: window; }
.stage { grid-area: stage; position: relative; }
.cat { grid-area: cat; }
.deduction { grid-area: deduction; }

@media (max-width: 900px) {
  .room {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "window" "stage" "cat" "deduction";
    grid-template-rows: none;
  }
}
.room.is-end {
  max-width: 820px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "window" "stage" "cat";
  grid-template-rows: none;
}
.room.is-end .cat { margin-top: 0; }

.window__frame {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  border: 10px solid var(--ink-soft);
  border-bottom-width: 14px;
  border-radius: 120px 120px 6px 6px / 60px 60px 6px 6px;
  background: linear-gradient(180deg, #121530 0%, var(--night) 70%, var(--night-light) 100%);
  box-shadow: inset 0 0 0 3px var(--ink), 0 8px 0 var(--ink);
  overflow: hidden;
}
.village-view {
  position: relative;
  min-height: 150px;
  display: grid;
  place-items: center;
}
.village-view canvas { max-width: 100%; border-radius: 0; box-shadow: none; }

.village-placeholder {
  width: min(680px, calc(100vw - 52px));
  min-height: 150px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: center;
  gap: 10px 8px;
  padding: 28px 16px 14px;
  background:
    radial-gradient(circle at 82% 22%, var(--parchment) 0 13px, transparent 14px),
    linear-gradient(0deg, #151a33 0 14px, transparent 14px);
}
.house {
  display: grid;
  justify-items: center;
  padding: 0;
  border: 0;
  background: none;
}
.house__roof {
  width: 0;
  height: 0;
  border-left: 17px solid transparent;
  border-right: 17px solid transparent;
  border-bottom: 13px solid var(--ink-soft);
}
.house__wall {
  display: grid;
  place-items: center;
  width: 28px;
  height: 24px;
  background: var(--ink);
}
.house__window {
  width: 10px;
  height: 11px;
  border-radius: 5px 5px 1px 1px;
  background: #121530;
  transition: background var(--placeholder-window-warms) ease, box-shadow var(--placeholder-window-warms) ease;
}
.house.is-lit .house__window {
  background: var(--candle);
  box-shadow: 0 0 10px 3px rgba(255, 207, 107, 0.55);
}
.house.is-lighting .house__window { animation: light-up var(--placeholder-window-lights-up) ease-out; }
@keyframes light-up {
  0% { background: #121530; box-shadow: none; }
  40% { background: var(--candle-bright); box-shadow: 0 0 22px 8px rgba(255, 233, 168, 0.8); }
  100% { background: var(--candle); box-shadow: 0 0 10px 3px rgba(255, 207, 107, 0.55); }
}

.table {
  position: relative;
  z-index: 1;
  border-radius: 14px 14px 8px 8px;
  padding: 26px 20px 30px;
  background:
    repeating-linear-gradient(180deg, transparent 0 38px, rgba(42, 29, 20, 0.45) 38px 40px),
    linear-gradient(180deg, #8a5a34 0%, var(--ink-soft) 55%, #574330 100%);
  box-shadow: inset 0 3px 0 rgba(255, 233, 168, 0.25), 0 10px 0 var(--ink), 0 22px 30px var(--shadow);
}
.table__candle {
  position: absolute;
  left: 18px;
  top: -34px;
  width: 40px;
  filter: drop-shadow(0 0 14px rgba(255, 207, 107, 0.7));
}
.table__candle .sprite { width: 100%; animation: flicker var(--candle-flicker-cycle) ease-in-out infinite; }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  45% { opacity: 0.88; }
  60% { opacity: 0.96; }
}
.table__objects {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.object {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 10px 6px 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--parchment);
  transition: transform var(--object-hover-lift) ease, background var(--object-hover-lift) ease;
}
.object:hover { transform: translateY(-3px); background: rgba(255, 233, 168, 0.08); }
.object__sprite { width: clamp(64px, 14vw, 104px); filter: drop-shadow(0 6px 0 rgba(42, 29, 20, 0.6)); }
.object.is-open .object__sprite { filter: drop-shadow(0 6px 0 rgba(42, 29, 20, 0.6)) drop-shadow(0 0 12px rgba(255, 207, 107, 0.55)); }
.object__label {
  max-width: 18ch;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--parchment);
  color: var(--ink);
  font-size: 0.85rem;
  line-height: 1.25;
  text-align: center;
  box-shadow: 0 2px 0 var(--ink);
}
.object__tag {
  font-family: var(--font-title);
  font-size: 0.8rem;
  color: var(--mist);
}
.object.is-open .object__tag { color: var(--candle); }
.object__building {
  padding: 1px 8px;
  border: 1px dashed var(--mist);
  border-radius: 4px;
  font-size: 0.72rem;
  color: var(--mist);
}

.cat {
  align-self: start;
  justify-self: end;
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  flex-direction: row-reverse;
  gap: 6px;
  margin: -62px 4px 0 0;
  max-width: min(100%, 460px);
  pointer-events: none;
}
.cat__body {
  flex: none;
  width: 72px;
  padding: 0;
  border: 0;
  background: none;
  pointer-events: auto;
}
.cat__body .sprite { width: 100%; filter: drop-shadow(0 0 1px var(--mist)); }
.cat__bubble {
  position: relative;
  margin-bottom: 30px;
  padding: 8px 12px;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--parchment);
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.35;
  pointer-events: auto;
  box-shadow: 0 3px 0 var(--ink);
}
.cat__bubble::after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: 10px;
  border: 7px solid transparent;
  border-left-color: var(--ink);
}

@media (max-width: 900px) {
  .cat { justify-self: stretch; max-width: none; align-self: start; margin-top: -40px; }
  .cat__bubble { flex: 1; }
}

.witch { position: relative; display: block; }
.witch .sprite { width: 100%; height: auto; }
.witch__eyelids { position: absolute; inset: 0; opacity: 0; animation: witch-blinks var(--witch-blink-cycle) linear infinite; }
@keyframes witch-blinks {
  0%, 95.9% { opacity: 0; }
  96%, 98.4% { opacity: 1; }
  98.5%, 100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .witch__eyelids { animation: none; }
}

.witch-at-home {
  position: absolute;
  z-index: 0;
  right: 9%;
  top: -88px;
  width: 72px;
  pointer-events: none;
}
.witch-at-home .witch__body { filter: drop-shadow(0 0 1px var(--mist)); }
@media (max-width: 520px) {
  .witch-at-home { right: 6%; top: -54px; width: 44px; }
}

.card {
  background: var(--parchment);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 5px 0 var(--ink), 0 18px 30px var(--shadow);
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
}
.card h2 { font-size: 1.3rem; color: var(--ink); }
.card h3 { font-size: 0.95rem; color: var(--ink-soft); letter-spacing: 0.03em; margin-bottom: 4px; }
.card__header { display: flex; align-items: center; gap: 12px; }
.card__header h2 { flex: 1; }
.card__footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }

.hint-text { color: var(--ink-soft); font-size: 0.9rem; }

.button {
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  padding: 9px 18px;
  background: var(--candle);
  color: var(--ink);
  font-family: var(--font-title);
  box-shadow: 0 3px 0 var(--ink);
}
.button:hover:not(:disabled) { background: var(--candle-bright); }
.button:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.button:disabled { opacity: 0.5; cursor: not-allowed; }
.button--quiet { background: var(--parchment-dark); }

.icon-button {
  flex: none;
  width: 36px;
  height: 36px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--parchment-dark);
  color: var(--ink);
  font-size: 1.3rem;
  line-height: 1;
}

select {
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 2px solid var(--ink-soft);
  border-radius: var(--radius);
  background: #fbf4e3;
  color: var(--ink);
  font: inherit;
}
select:disabled { opacity: 0.6; }

.villager-name { color: var(--name-on-paper); }
.card.puzzle .villager-name { color: var(--name-on-night); }

.is-new {
  background: var(--candle-bright);
  box-shadow: 0 0 0 2px var(--candle-bright);
  border-radius: 3px;
}

.deduction h2 { font-size: 1.15rem; }
.owners { list-style: none; padding: 0; display: grid; gap: 10px; }
.owners__row { display: grid; gap: 4px; }
.owners__row label { display: flex; align-items: center; gap: 8px; font-size: 0.9rem; line-height: 1.25; }
.owners__sprite { width: 28px; flex: none; }
.deduction__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.attempts { font-family: var(--font-title); font-size: 0.85rem; color: var(--ink-soft); }
.verdict { width: 100%; font-weight: 600; color: var(--cherry); min-height: 1.5em; }
.verdict:empty { display: none; }
.whisper {
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(141, 147, 196, 0.22);
  font-size: 0.92rem;
}

.wish {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--parchment-dark);
  font-size: 1.15rem;
  font-style: italic;
  line-height: 1.7;
}
.rune {
  padding: 0 1px;
  border: 0;
  border-bottom: 1px dotted currentColor;
  background: none;
  color: var(--ink-soft);
  font-family: var(--font-runes);
  font-style: normal;
  font-size: 1em;
  line-height: 1;
}
.rune:hover { color: var(--cherry); }
.rune--pencil {
  font-family: var(--font-hand);
  font-size: 1.3em;
  font-weight: 700;
  color: var(--night-light);
}
.pencil { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pencil__pair {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 6px;
  background: #fbf4e3;
}
.pencil__rune { font-family: var(--font-runes); color: var(--ink-soft); font-size: 1.1rem; line-height: 1.2; }
.pencil input {
  width: 2.1em;
  padding: 0 2px;
  border: 1px solid var(--parchment-dark);
  border-radius: 4px;
  background: var(--parchment);
  color: var(--night-light);
  text-align: center;
  text-transform: uppercase;
  font-family: var(--font-hand);
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.2;
}
.pencil__pair--known input:disabled { border-color: transparent; background: transparent; color: var(--ink); opacity: 1; -webkit-text-fill-color: var(--ink); }
.sheet__pencil { margin-top: 10px; }

.alphabet { display: flex; flex-wrap: wrap; gap: 4px; }
.alphabet__pair {
  display: grid;
  justify-items: center;
  min-width: 28px;
  padding: 2px 4px;
  border-radius: 5px;
  background: #fbf4e3;
  font-family: var(--font-title);
  font-size: 0.8rem;
}
.alphabet__rune { font-family: var(--font-runes); font-size: 1.05rem; color: var(--ink-soft); }

.observations { padding-left: 20px; display: grid; gap: 4px; }

.sheet__sprite { width: 56px; flex: none; }
.sheet__reveals { display: grid; justify-items: center; gap: 10px; }
.sheet__reveals h3 { justify-self: stretch; }
.sheet__grows { margin-top: 6px; font-family: var(--font-title); color: var(--ink-soft); }
.sheet__book { width: min(100%, 440px); }
.sheet__book .book__cover { --book-height: auto; }
.sheet__book .book__page { padding-block: 14px 16px; }
.sheet__book .book__folio { display: none; }
.sheet__book .villager__meta + .villager__meta { display: none; }
.sheet__book :is(.villager__keepsake, .villager__gift) { display: none; }
.sheet__reveals[data-ink="waiting"] .book { opacity: 0; }
.sheet__reveals[data-ink="writing"] .book { animation: book-opens var(--sheet-book-opens) ease-out both; }
.owner select { max-width: 340px; }

.card.puzzle { background: var(--night); color: var(--parchment); border-color: var(--ink-soft); }
.card.puzzle h2 { color: var(--candle); }
.card.puzzle .icon-button { background: var(--night-light); color: var(--parchment); border-color: var(--mist); }
.card.puzzle .puzzle__missing { color: var(--parchment); }

.overlay[data-kind="puzzle"] .overlay__body { max-width: 760px; }
.puzzle__root { display: grid; align-content: center; min-height: 160px; min-width: 0; overflow-x: auto; container-type: inline-size; }
.puzzle__root > * { width: 100%; }
@media (max-width: 520px) {
  .overlay { padding-inline: 8px; }
  .card.puzzle { padding-inline: 10px; }
}
.puzzle__status { text-align: center; font-family: var(--font-title); color: var(--candle); min-height: 1.5em; font-size: 1.3rem; }
.puzzle__status.is-solved { animation: pop var(--puzzle-solved-status-pop) ease-out; }
.puzzle__missing { display: grid; gap: 14px; justify-items: center; text-align: center; max-width: 40ch; margin-inline: auto; padding-block: 24px; }
.puzzle__missing p { margin: 0; }
.puzzle__building {
  padding: 6px 14px;
  border: 2px dashed var(--candle);
  border-radius: var(--radius);
  font-family: var(--font-title);
  color: var(--candle);
}
.puzzle__whispers { display: grid; gap: 6px; }
.puzzle__whispers:empty { display: none; }
.puzzle__hint:empty { display: none; }
.card.puzzle .whisper { color: var(--parchment); }
@keyframes pop {
  0% { transform: scale(0.7); opacity: 0; }
  70% { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); }
}

.overlay {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 16px calc(env(safe-area-inset-bottom, 0px) + 16px);
  background: rgba(15, 12, 30, 0.72);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity var(--overlay-fade) ease;
}
.overlay.is-visible { opacity: 1; }
.overlay__body {
  width: 100%;
  max-width: 620px;
  max-height: 100%;
  overflow-y: auto;
  padding-bottom: 8px;
}
.overlay[data-kind="return"] .overlay__body { max-width: 760px; }

.overlay[data-kind="return"] .overlay__body:has(.return[data-step="learned"]) { max-width: 1000px; }
.return h2 { text-align: center; }
.return__village {
  border: 6px solid var(--ink-soft);
  border-radius: 8px;
  background: linear-gradient(180deg, #121530 0%, var(--night) 70%, var(--night-light) 100%);
  overflow: hidden;
}
.return[data-step="learned"] { background: none; border-color: transparent; box-shadow: none; padding-inline: 0; }
.return[data-step="learned"] > h2 { color: var(--candle); }
.return[data-step="learned"] .return__village,
.return[data-step="learned"] .deliveries { display: none; }
.return.is-instant *,
.return.is-instant *::before,
.return.is-instant *::after { transition: none !important; animation: none !important; }

.deliveries { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.delivery {
  display: grid;
  grid-template-columns: 40px 1fr;
  column-gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: opacity var(--return-character-steps-in) ease, border-color var(--return-character-steps-in) ease, background var(--return-character-steps-in) ease;
}
.delivery__sprite { grid-row: span 2; width: 40px; }
.delivery__object { font-size: 0.9rem; line-height: 1.2; }
.delivery__owner { font-family: var(--font-title); font-size: 0.9rem; color: var(--cherry); }
.delivery[data-state="waiting"] { opacity: 0.55; }
.delivery[data-state="current"] { border-color: var(--ink-soft); background: color-mix(in srgb, var(--candle) 30%, transparent); }
.delivery[data-state="given"] .delivery__owner::after { content: " ✓"; }

.scene { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; min-height: 160px; }
.scene__who { margin: 0; display: grid; justify-items: center; gap: 6px; animation: character-steps-in var(--return-character-steps-in) ease-out both; }
.scene__frame {
  position: relative;
  width: 112px;
  padding: 8px 8px 0;
  border: 3px solid var(--ink);
  border-radius: 48px 48px 6px 6px;
  background: linear-gradient(180deg, #121530 0%, var(--night-light) 100%);
  box-shadow: inset 0 0 0 3px var(--ink-soft), 0 4px 0 var(--ink);
}
.scene__portrait { display: block; width: 100%; height: auto; }
.scene__portrait--cat { padding: 14px 6px 0 14px; }
.scene__gift {
  position: absolute;
  right: -22px;
  bottom: -12px;
  width: 46px;
  filter: drop-shadow(0 2px 0 var(--ink));
  opacity: 0;
  transform: translate(36px, -18px) scale(0.6) rotate(-10deg);
  transition: opacity var(--return-object-handed-over) ease, transform var(--return-object-handed-over) cubic-bezier(0.3, 1.5, 0.5, 1);
}
.scene.is-given .scene__gift { opacity: 1; transform: none; }
.scene__meeting { display: flex; align-items: flex-end; gap: 4px; }
.scene__visitor { flex: none; width: 54px; }
.scene__who:has(.scene__visitor) .scene__name { padding-left: 58px; }
.scene__meeting:has(.scene__visitor) .scene__gift { opacity: 1; right: auto; left: 6px; bottom: -10px; transform: translate(-60px, -4px) scale(0.6) rotate(8deg); }
.scene.is-given .scene__meeting:has(.scene__visitor) .scene__gift { transform: none; }
.scene__name { font-family: var(--font-title); font-size: 1.15rem; color: var(--cherry); }
.bubble {
  position: relative;
  margin-top: 10px;
  padding: 12px 16px;
  border: 3px solid var(--ink);
  border-radius: 14px;
  background: #fffaf0;
  box-shadow: 0 4px 0 var(--ink);
  opacity: 0;
  transform: scale(0.85);
  transform-origin: 0 34px;
  transition: opacity var(--return-bubble-opens) ease, transform var(--return-bubble-opens) cubic-bezier(0.3, 1.5, 0.6, 1);
}
.bubble::before,
.bubble::after {
  content: "";
  position: absolute;
  top: 22px;
  width: 16px;
  height: 20px;
  clip-path: polygon(100% 0, 75% 0, 75% 20%, 50% 20%, 50% 40%, 25% 40%, 0 50%, 25% 60%, 50% 60%, 50% 80%, 75% 80%, 75% 100%, 100% 100%);
}
.bubble::before { left: -17px; background: var(--ink); }
.bubble::after { left: -11px; top: 25px; width: 12px; height: 14px; background: #fffaf0; }
.scene.is-speaking .bubble { opacity: 1; transform: none; }
.bubble__text { margin: 0; font-size: 1.04rem; line-height: 1.5; }
.ink-word { opacity: 0; transition: opacity var(--return-speech-word-appears) ease; }
.ink-word.is-inked { opacity: 1; }
@keyframes character-steps-in {
  from { opacity: 0; transform: translateY(14px); }
}
@media (max-width: 520px) {
  .deliveries { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
  .delivery { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 4px; }
  .delivery__sprite { grid-row: auto; width: 34px; }
  .delivery__object { display: none; }
  .delivery__owner { font-size: 0.8rem; }
  .scene { gap: 14px; }
  .scene__frame { width: 74px; padding: 5px 5px 0; border-radius: 32px 32px 5px 5px; }
  .scene__gift { width: 34px; right: -14px; bottom: -8px; }
  .scene__visitor { width: 36px; }
  .scene__who:has(.scene__visitor) .scene__name { padding-left: 40px; }
  .scene__meeting:has(.scene__visitor) .scene__gift { left: 4px; bottom: -8px; transform: translate(-41px, -2px) scale(0.6) rotate(8deg); }
  .scene:has(.scene__visitor) { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .scene:has(.scene__visitor) .scene__who { justify-self: center; }
  .scene:has(.scene__visitor) .bubble { margin-top: 0; transform-origin: 50% 0; }
  .scene:has(.scene__visitor) .bubble::before { top: -18px; left: calc(50% - 8px); rotate: 90deg; }
  .scene:has(.scene__visitor) .bubble::after { top: -11px; left: calc(50% - 6px); rotate: 90deg; }
  .scene__name { font-size: 1rem; }
  .bubble { padding: 10px 12px; }
  .bubble__text { font-size: 0.95rem; line-height: 1.45; }
  .return { gap: 10px; padding-inline: 14px; }
  .return > h2 { font-size: 1.05rem; }
  .return[data-step="learned"] { padding-inline: 0; }
}

.intro { max-width: 560px; margin: 0 auto; }
.intro p { font-size: 1.05rem; }
.intro__household { display: flex; justify-content: center; align-items: flex-end; gap: 4px; }
.intro__frame { width: 96px; }
.intro__cat { width: 54px; margin-left: -10px; }
.end { text-align: center; justify-items: center; padding-block: 28px; }
.end h2 { font-size: 1.6rem; }
.end p { max-width: 46ch; }
.end__actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.ending { gap: 18px; padding-block: 24px; }
.ending h2 { text-align: center; font-size: 1.6rem; }
.ending .scene { min-height: 0; }
.ending__story { margin: 0 auto; max-width: 52ch; font-size: 1.08rem; line-height: 1.65; text-align: center; }
.ending__lit { margin: 0; text-align: center; font-family: var(--font-title); color: var(--ink-soft); transition: opacity var(--return-bubble-opens) ease; }
.ending > .button, .ending > p:has(+ .end__actions), .ending .end__actions { justify-self: center; text-align: center; }
.ending:not(.is-playing) .ink-word { opacity: 1; }
.ending:not(.is-playing) .bubble { opacity: 1; transform: none; transition: none; }
.ending:not(.is-playing) .scene__gift { opacity: 1; transform: none; transition: none; }
.ending.is-playing .ending__lit,
.ending.is-playing > .button { opacity: 0; }

.topbar__actions { display: flex; align-items: center; gap: 8px; }
.share-button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 2px solid var(--mist);
  border-radius: var(--radius);
  background: transparent;
  color: var(--mist);
}
.share-button:hover { color: var(--candle); border-color: var(--candle); }
.share-button__icon { width: 21px; height: 21px; shape-rendering: crispEdges; }

.overlay[data-kind="share"] .overlay__body { max-width: 360px; }
.share { justify-items: center; text-align: center; }
.share .card__header { justify-self: stretch; }
.share__code { display: block; width: min(296px, 100%); height: auto; aspect-ratio: 1; border: 2px solid var(--ink-soft); border-radius: var(--radius); }
.share__address { font-family: var(--font-title); color: var(--ink-soft); overflow-wrap: anywhere; }
