:root {
  font-family: ui-rounded, "Avenir Next", system-ui, sans-serif;
  color: #fff6ed;
  background: #1d1725;
  font-synthesis: none;
  --ink: #342539;
  --paper: #fff3df;
  --accent: #f2a395;
  --line: #50344e;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; overflow: hidden; }
button, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, select:focus-visible, canvas:focus-visible { outline: 3px solid #55cdd6; outline-offset: 3px; }
button:disabled { opacity: .65; }
[hidden] { display: none !important; }
p { margin: 0; }
#page {
  --top: max(env(safe-area-inset-top, 0px), var(--tg-top, 0px));
  --bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-bottom, 0px));
  width: min(100%, 480px);
  height: var(--viewport, 100dvh);
  position: relative;
  overflow: hidden;
  isolation: isolate;
  margin: 0 auto;
  background: #37253f;
  box-shadow: 0 0 65px #100e18a0;
}
.primary, .secondary, .choice, .chapter-link, .icon-button {
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid #644761;
  padding: .55rem .85rem;
  color: var(--ink);
  background: #fff3e4;
  font-weight: 710;
}
.primary { background: #f7beaa; border: 2px solid #6d4258; box-shadow: 0 3px 0 #6d4258; }
.primary:active { transform: translateY(2px); box-shadow: 0 1px 0 #6d4258; }
.secondary { background: #f9eadd; }
.icon-button { padding: 0; min-width: 44px; font-size: 1.65rem; }
.loading { position: absolute; inset: 0; display: grid; place-items: center; }
.cover {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  padding: calc(var(--top) + 14px) 24px calc(var(--bottom) + 24px);
  background: radial-gradient(ellipse at 50% 43%, #ffd8b4 1%, #e99f9a 44%, #69375e 88%);
  text-align: center;
}
.cover-art { position: relative; min-height: 0; }
.cover-art::before {
  content: "";
  position: absolute;
  inset: 10% 4% 6%;
  border: 1px solid #ffe8ca86;
  border-radius: 50% 50% 45% 46%;
  background: radial-gradient(ellipse, #fbe7c24a, #fbe7c210 65%, transparent 66%);
}
.cover-tanya { position: absolute; width: 100%; height: 96%; bottom: 0; left: 0; object-fit: contain; filter: drop-shadow(0 12px 8px #40203b70); }
.cover-heart { position: absolute; right: 12%; top: 20%; color: #a93861; font-size: 3rem; transform: rotate(15deg); }
.cover-copy { display: grid; justify-items: center; gap: 9px; }
.cover h1 { max-width: 330px; margin: 2px auto 11px; font-family: Georgia, serif; font-size: clamp(2.65rem, 10.7vw, 4.1rem); letter-spacing: -.072em; line-height: .92; color: #fff7e8; text-shadow: 0 3px #5b354e; }
.cover .primary, .cover .secondary { min-width: min(100%, 250px); }
.public-cover { place-content: center; grid-template-rows: auto auto; gap: 12px; }
.public-cover p { max-width: 26ch; margin: auto; text-shadow: 0 2px #55324e; }
.stage { position: absolute; inset: 0; overflow: hidden; background: linear-gradient(160deg, #513757, #292239); display: grid; }
.background, .full-photo, .sprite { position: absolute; display: block; pointer-events: none; }
.background, .full-photo { inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center; }
.full-photo { object-fit: contain; background: #201925; }
.sprite { height: 42%; width: 53%; object-fit: contain; object-position: center bottom; bottom: 23%; z-index: 1; }
.sprite-tanya, .sprite-tanya-happy, .sprite-tanya-romance { left: 6%; }
.sprite-ruslan { right: 4%; height: 47%; }
.sprite-tanya-pregnant { left: -4%; height: 34%; }
.sprite-scooter-tanya { left: 24%; bottom: 23%; height: 37%; }
.sprite-grandpa-bike,.sprite-grandma-bike { bottom: 48%; height: 24%; width: 38%; }
.sprite-grandpa-bike { left: 6%; }
.sprite-grandma-bike { right: 5%; }
.candlelight, .heart-burst, .rpg-artifact, .test-prop {
  position: absolute; align-self: center; justify-self: center; z-index: 2;
  color: #ffe5c5; text-shadow: 0 3px #9d4c6f; pointer-events: none;
}
.candlelight { bottom: 32%; right: 12%; font-size: 2.6rem; text-shadow: 0 0 30px #ff9c64; }
.heart-burst { top: 22%; font-size: 2.65rem; color: #f78ca0; transform: rotate(-8deg); animation: rise .9s both; }
.test-prop { left: 47%; bottom: 43%; color: #9b4775; text-shadow: none; border: 2px solid #67445f; border-radius: 5px; padding: 0 12px; background: #fff3e9; font-size: 1.25rem; transform: rotate(-16deg); }
.rpg-artifact { top: 27%; color: #7b4d80; background: #fff1d6; width: 94px; height: 118px; display: grid; place-items: center; font-size: 3rem; border-radius: 10px; border: 3px solid #a36e91; box-shadow: 0 0 45px #f8a16dab; }
@keyframes rise { from { opacity: 0; transform: translateY(28px) rotate(0deg); } to { opacity: 1; transform: translateY(0) rotate(-8deg); } }
.hud {
  position: absolute; inset: 0 0 auto; z-index: 5;
  display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 6px 13px;
  align-items: center; padding: calc(var(--top) + 8px) 14px 9px;
  background: #271b34e8; border-bottom: 1px solid #d8a59152;
}
.hud-title { display: grid; gap: 1px; min-width: 0; }
.eyebrow { color: #f2b4a8; font-size: .7rem; letter-spacing: .11em; text-transform: uppercase; font-weight: 780; }
.hud-title strong { line-height: 1.12; font-size: clamp(.93rem,4.3vw,1.12rem); }
.menu-button { border: 1px solid #f5cbb280; min-height: 44px; border-radius: 12px; background: #a5698050; color: #fff2e5; font-size: 1.15rem; }
.chapter-meter, .meter { width: 100%; appearance: none; border: 0; background: #6a4c69; border-radius: 12px; overflow: hidden; }
.chapter-meter { grid-column: span 2; height: 4px; }
progress::-webkit-progress-bar { background: #6a4c69; border-radius: inherit; }
progress::-webkit-progress-value { background: #f8baa0; border-radius: inherit; }
progress::-moz-progress-bar { background: #f8baa0; border-radius: inherit; }
.dialog {
  align-self: end;
  z-index: 3;
  margin: 12px 12px calc(var(--bottom) + 12px);
  background: var(--paper);
  color: var(--ink);
  border: 2px solid #674a65;
  border-radius: 19px;
  box-shadow: 0 6px 0 #35213b84;
}
.dialog.thought { background: #eadcf0; border-style: dashed; }
.dialog.speech { background: #fff9ec; }
.dialog.title { text-align: center; }
.dialog-content {
  min-height: 127px; width: 100%;
  display: grid; grid-template-rows: auto minmax(2.7em, auto) auto; gap: 6px;
  color: inherit; border: 0; background: transparent; text-align: inherit;
  padding: .66rem .84rem .52rem; border-radius: inherit;
}
.speaker { color: #8a4663; font-size: .75rem; font-weight: 800; }
.line { font-size: clamp(.97rem, 4.15vw, 1.13rem); line-height: 1.35; white-space: pre-line; }
.thought .line { font-style: italic; }
.dialog-next { justify-self: end; color: #714765; font-size: .72rem; font-weight: 800; }
.playing .background { filter: brightness(.75); }
.game-box {
  position: absolute; inset: calc(var(--top) + 76px) 12px calc(var(--bottom) + 12px);
  display: flex; flex-direction: column; justify-content: center; align-items: stretch;
  min-height: 0; gap: 6px; z-index: 2; text-align: center;
}
.game-instruction { margin: 0 0 2px; font-size: 1rem; color: #fff6e9; text-shadow: 0 2px 3px #372239; }
.game-score { font-weight: 800; font-variant-numeric: tabular-nums; text-shadow: 0 2px 3px #372239; }
.meter { height: 9px; flex: 0 0 9px; }
.playfield {
  display: block; min-height: 0; width: 100%; flex: 1 1 0;
  touch-action: none; outline-offset: -2px; border-radius: 12px;
  border: 1px solid #fff0c86b; background: #44243b48;
}
.race .playfield { background: radial-gradient(ellipse at 50% 9%, #b56e9b, #754a84 48%, #403352); }
.ride .playfield { background: #3c59432b; }
.ultrasound .playfield { background: #302d4e52; }
.game-status {
  min-height: 30px; display: grid; align-content: center; margin: 0; padding: 4px 7px; border-radius: 10px;
  color: #fff5e8; background: #3b2749e8; font-size: .82rem; line-height: 1.2;
}
.timing, .rpg { top: auto; background: #3e294be8; border: 1px solid #e1b9af81; padding: 12px; border-radius: 18px; }
.timing-track { height: 36px; margin: .4rem 0; position: relative; border-radius: 12px; background: #c98197; }
.timing-target { position: absolute; top: 0; height: 100%; border-radius: 8px; background: #b1e0a0; }
.timing-needle { width: 4px; height: 46px; top: -5px; left: 0; position: absolute; transform: translateX(-50%); background: #fff8e4; box-shadow: 0 0 1px 2px #352732; border-radius: 2px; }
.rpg-bars, .rpg-buttons { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 5px; align-items: center; }
.rpg-label { text-align: left; font-size: .75rem; }
.rpg-buttons .secondary { padding: .28rem; line-height: 1.12; font-size: .8rem; }
.rpg-buttons .suggested { background: #ffe098; border-color: #a45e79; outline: 2px solid #b7838c; }
.chat { position: absolute; inset: calc(var(--top) + 68px) 8px calc(var(--bottom) + 8px); display: grid; grid-template-rows: auto minmax(0,1fr) auto; gap: 4px; padding: 7px; border-radius: 15px; background: #e8e5f1; color: #30273f; }
.chat-head { display: flex; gap: 9px; align-items: center; padding: 2px 8px; }
.chat-head small { display: block; color: #705e7b; }
.avatar { display: grid; place-items: center; min-width: 36px; min-height: 36px; border-radius: 50%; color: #fff4ed; background: #6f4b90; }
.chat-messages { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; overflow: auto; padding: 6px; background: radial-gradient(ellipse at 15% 20%, #dbcee7, #d1d4e8); border-radius: 12px; }
.bubble { padding: .44rem .65rem; max-width: 91%; background: #fff9f8; border-radius: 11px 11px 11px 2px; font-size: .89rem; }
.bubble.own { align-self: flex-end; background: #e3d9fb; border-radius: 11px 11px 2px 11px; }
.chat-photo { min-height: 45px; flex: 1 1 0; width: min(65%, 182px); object-fit: contain; object-position: left top; border-radius: 10px; }
.secrecy, .chat-thought { min-height: 1em; font-size: .73rem; color: #654a78; text-align: center; }
.secrecy.warning { color: #962c50; font-weight: 800; }
.chat-thought { font-style: italic; margin: 2px; }
.choices { display: grid; gap: 4px; }
.choice { min-height: 44px; background: #fcf8fa; color: #432e59; border-color: #b29bc5; font-size: .83rem; padding: .35rem; }
.video-view { position: absolute; inset: calc(var(--top) + 66px) 0 0; background: #231a29; }
.fit { width: 100%; height: 100%; position: absolute; display:block; object-fit: contain; inset: 0; transition: opacity .4s ease; }
.hidden-media { opacity: 0 !important; }
.video-tools { position: absolute; inset: auto 0 calc(var(--bottom) + 10px); z-index: 3; text-align: center; }
.video-status { font-size: .83rem; color: white; text-shadow: 0 2px #372239; margin: 4px 8px; }
.montage { place-items: center; padding: calc(var(--top) + 12px) 12px calc(var(--bottom) + 12px); background: radial-gradient(ellipse at 50% 44%, #4e3854, #201a2c); animation: fade .5s ease both; }
.montage.day { background: radial-gradient(ellipse at 50% 44%, #fbd7a4, #9e6e82); }
.montage-photo { width: 100%; height: 74%; max-height: 100%; object-fit: contain; margin-bottom: 12%; }
.montage-caption { position: absolute; align-self: center; margin: 0 20px; white-space: pre-line; text-align: center; font-family: Georgia, serif; font-size: clamp(1.3rem, 6.2vw, 1.72rem); line-height: 1.26; }
.montage-photo ~ .montage-caption, .clock ~ .montage-caption {
  inset: auto 11px calc(var(--bottom) + 15px); margin: 0; padding: 9px 10px; border-radius: 13px;
  font: 600 clamp(1rem,4.8vw,1.23rem)/1.29 system-ui, sans-serif; background: #272033de;
}
.clock { width: min(75%, 315px); height: auto; }
@keyframes fade { from { opacity: .2; } to { opacity: 1; } }
.eyes { place-items: center; background: radial-gradient(ellipse at center, #181021, #0c0911 68%); }
.eyes-button, .focus-button {
  appearance: none; min-height: 54px; padding: .6rem 1rem; border: 1px solid #f8dcd4a0;
  color: #fff5ec; background: #3121359f; border-radius: 30px; font-weight: 650;
}
.final { background: radial-gradient(ellipse at center, #735961, #251b2a); place-items: center; }
.final-image { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; transition: opacity .65s ease; }
.focus-scene .final-image { position: absolute; inset: 0; filter: blur(var(--blur,17px)); }
.final-image.vignette { mask-image: radial-gradient(ellipse at 50% 50%, #000 50%, #000b 70%, #0000 98%); animation: eyes-open .9s ease-out both; }
@keyframes eyes-open { from { clip-path: ellipse(100% 1% at 50% 50%); } to { clip-path: ellipse(108% 70% at 50% 50%); } }
.focus-button { position: absolute; inset: auto 14px calc(var(--bottom) + 22px); touch-action: none; user-select: none; background: linear-gradient(90deg, #925f7ac9 var(--focus-progress,0%), #321f36d6 var(--focus-progress,0%)); }
.greeting { grid-template-rows: minmax(0,1fr) auto; gap: 4px; padding: calc(var(--top) + 7px) 12px calc(var(--bottom) + 9px); }
.final-stack { position: relative; width: 100%; height: 100%; min-height: 0; }
.final-stack .final-image { position: absolute; inset: 0; }
.final-copy { max-height: min(55dvh, 340px); overflow: auto; color: #fff4e9; line-height: 1.36; padding: 1px 4px; }
.final-hello { font: 600 clamp(1.05rem, 5vw, 1.32rem)/1.23 Georgia, serif; margin-bottom: 6px; }
.final-letter { font-size: clamp(.93rem, 4vw, 1.1rem); }
.final-actions { margin: 9px 0 0; display: flex; gap: 6px; }
.media-error, .notice { position: absolute; z-index: 20; left: 9px; right: 9px; bottom: calc(var(--bottom) + 9px); padding: 9px; border: 1px solid #ce9fb0; border-radius: 12px; background: #422946; color: #fff3e7; font-size: .9rem; }
.media-error button, .notice button { margin-left: 6px; }
.overlay { position: absolute; z-index: 12; inset: 0; display: grid; align-items: end; padding: calc(var(--top) + 9px) 10px calc(var(--bottom) + 9px); background: #1c1424ae; }
.panel { border-radius: 18px; border: 1px solid #d6a8b2; background: #fff0e4; color: var(--ink); padding: 11px; max-height: 100%; overflow: auto; display: grid; gap: 5px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.panel h2 { font: 700 1.48rem Georgia, serif; margin: 0; }
.panel h3 { margin: 9px 0 3px; font-size: .92rem; }
.chapter-link { text-align: left; }
.empty { padding: 9px 3px; color: #604565; }
.album-item { margin: 7px 1px; background: #e8d0d1; padding: 7px; border-radius: 9px; text-align: center; }
.album-media { display: block; width: 100%; max-height: 48dvh; object-fit: contain; border-radius: 6px; }
.album-item figcaption { margin: 5px 0 2px; font-size: .88rem; }
@media (max-height: 540px) {
  .hud { padding-bottom: 4px; }
  .dialog { margin-bottom: calc(var(--bottom) + 6px); }
  .dialog-content { min-height: 100px; }
  .line { font-size: .89rem; }
  .final-letter { font-size: .86rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .1s !important; }
}
/* Both parents-over-stroller images share the same geometry in focus and in the letter. */
.focus-scene, .greeting {
  grid-template-rows: minmax(0, 57%) minmax(0, 1fr);
  justify-items: stretch;
  align-items: start;
  padding: calc(var(--top) + 7px) 12px calc(var(--bottom) + 9px);
}
.focus-scene .final-stack { align-self: stretch; }
.greeting .final-copy { height: 100%; max-height: none; align-content: center; }
@media (max-height: 690px) {
  .focus-scene, .greeting { grid-template-rows: minmax(0, 52%) minmax(0, 1fr); }
}
/* Preserve the drawing proportions on tall phones and when the viewport shrinks. */
.game-box .playfield {
  flex: 0 1 auto;
  align-self: center;
  width: min(100%, max(150px, calc((var(--viewport, 100dvh) - var(--top) - var(--bottom) - 182px) * .837209)));
  height: auto;
  aspect-ratio: 360 / 430;
}
