




.scene {
  position: relative;
  aspect-ratio: 1 / 1;          
  min-width: 0;
  overflow: hidden;
  background: var(--scene-tint);
  box-shadow: inset 0 calc(var(--px) * -1) 0 var(--line-strong);
}




.scene-9x16 {
  aspect-ratio: 9 / 16;
  width: 100%;
  height: auto;
  max-height: 100%;
  min-height: 0;
  margin-inline: auto;
  box-shadow: none;
}


.scene-media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  
  image-rendering: auto;
}


.scene-top,
.scene-bottom {
  position: absolute;
  inset-inline: 0;
  z-index: 2;
  display: grid;
  align-items: center;
}

.scene-top    { top: 0;    min-height: 14%; align-items: start; }
.scene-bottom { bottom: 0; min-height: 14%; align-items: end; }

.scene[data-contract="show"] .scene-top,
.scene[data-contract="show"] .scene-bottom {
  box-shadow: inset 0 0 0 var(--px) var(--berry-300);
}


.scene::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-conic-gradient(from 0deg at 50% 50%,
      rgba(79,61,48,.06) 0deg 90deg,
      transparent 90deg 180deg) 0 0 / calc(var(--px) * 2) calc(var(--px) * 2),
    var(--scene-wash);
  pointer-events: none;
  z-index: 1;
}


.scene-ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: var(--scene-tint);
  background-image: var(--dither-15);
}

.scene-ph::before {
  content: "";
  position: absolute;
  inset: var(--sp-3);
  border: var(--px) dashed var(--oak-500);
  opacity: .5;
}

.scene-ph::after {
  content: attr(data-ratio);
  position: absolute;
  bottom: var(--sp-4);
  font-family: var(--f-pixel);
  font-size: var(--fs-micro);
  -webkit-font-smoothing: none;
  letter-spacing: .08em;
  color: var(--oak-500);
  
  opacity: .45;
}

.scene-ph .spr { opacity: .45; }




.say {
  position: relative;
  z-index: 2;
  margin: calc(var(--sp-4) * -1) var(--sp-4) 0;
  border: 8px solid transparent;
  border-image: url('./sprites/frame-panel.svg') 8 fill stretch;
  padding: var(--sp-3) var(--sp-4);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--sp-3);
  align-items: center;
  filter: var(--shadow-1);
}

.say-text {
  font-family: var(--f-dialogue);
  font-size: var(--fs-dialogue);
  line-height: var(--lh-dialogue);
  
  min-height: calc(var(--fs-dialogue) * var(--lh-dialogue) * 2);
}

.say .spr { --spr-box: 32px; }





.subtitle {
  margin: var(--sp-3) var(--sp-4);
  border: 8px solid transparent;
  border-image: url('./sprites/frame-panel.svg') 8 fill stretch;
  padding: var(--sp-2) var(--sp-4);
  font-family: var(--f-dialogue);
  font-size: var(--fs-dialogue);
  line-height: var(--lh-dialogue);
  min-height: calc(var(--fs-dialogue) * var(--lh-dialogue) * 2);
  max-height: 30dvh;
  overflow-y: auto;
  text-align: center;
  filter: var(--shadow-2);
}


.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--sp-2);
  align-items: center;
  
  min-width: 0;
  padding: var(--sp-3) var(--sp-4);
  padding-bottom: calc(var(--sp-3) + env(safe-area-inset-bottom, 0px));
  background: var(--cream-200);
  box-shadow: inset 0 var(--px) 0 var(--line);
}


.composer .btn-icon { width: var(--touch); }


.suggest {
  padding: var(--sp-2) var(--sp-4) 0;
  min-width: 0;
  
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.suggest-label {
  font-size: var(--fs-micro);
  color: var(--fg-dim);
  margin-bottom: var(--sp-1);
}



.voice {
  display: grid;
  justify-items: center;
  gap: var(--sp-2);
  
  min-height: 72px;
  align-content: center;
  padding: var(--sp-3) var(--sp-4);
  text-align: center;
}

.voice-hint {
  font-size: var(--fs-small);
  color: var(--fg-soft);
}


.wave {
  display: flex;
  align-items: flex-end;
  gap: var(--px);
  height: 24px;
}

.wave i {
  width: calc(var(--px) * 2);
  height: 25%;
  background: var(--action-lo);
  animation: wave-step 640ms steps(4, end) infinite;
}

.wave i:nth-child(2) { animation-delay: 80ms; }
.wave i:nth-child(3) { animation-delay: 160ms; }
.wave i:nth-child(4) { animation-delay: 240ms; }
.wave i:nth-child(5) { animation-delay: 160ms; }
.wave i:nth-child(6) { animation-delay: 80ms; }
.wave i:nth-child(7) { animation-delay: 0ms; }

@keyframes wave-step {
  0%, 100% { height: 25%; }
  50%      { height: 100%; }
}


.thinking {
  display: flex;
  gap: var(--sp-1);
}

.thinking i {
  width: calc(var(--px) * 3);
  height: calc(var(--px) * 3);
  background: var(--fg-dim);
  animation: dot-step 900ms steps(3, end) infinite;
}

.thinking i:nth-child(2) { animation-delay: 150ms; }
.thinking i:nth-child(3) { animation-delay: 300ms; }

@keyframes dot-step {
  0%, 100% { background: var(--fg-dim); }
  50%      { background: var(--action-lo); }
}


.voice [data-when]            { display: none; }
.voice[data-voice="idle"]       [data-when~="idle"],
.voice[data-voice="listening"]  [data-when~="listening"],
.voice[data-voice="processing"] [data-when~="processing"],
.voice[data-voice="playing"]    [data-when~="playing"],
.voice[data-voice="retry"]      [data-when~="retry"] { display: grid; justify-items: center; gap: var(--sp-2); }

.voice[data-voice="listening"] .wave,
.voice[data-voice="processing"] .thinking { display: flex; }


.mic-live {
  animation: mic-step 900ms steps(2, end) infinite;
}

@keyframes mic-step {
  0%, 100% { scale: 1; }
  50%      { scale: 1.08; }
}

@media (prefers-reduced-motion: reduce) {
  .wave i, .thinking i, .mic-live { animation: none; }
  .wave i { height: 60%; }
}


.log { display: grid; gap: var(--sp-3); }
.log-row { display: grid; gap: var(--sp-1); }
.log-row[data-who="me"] { justify-items: end; }
.log-who { font-size: var(--fs-micro); color: var(--fg-dim); }

.log-text {
  max-width: 85%;
  padding: var(--sp-2) var(--sp-3);
  background: var(--cream-050);
  box-shadow: inset 0 0 0 var(--px) var(--line);
  font-size: var(--fs-small);
  line-height: var(--lh-body);
}

.log-row[data-who="mame"] .log-text {
  background: var(--cream-200);
  font-family: var(--f-dialogue);
}




.thing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: var(--sp-3);
}

.thing {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--sp-1);
  min-height: 104px;
  padding: var(--sp-3) var(--sp-2);
  border: 8px solid transparent;
  border-image: url('./sprites/frame-panel.svg') 8 fill stretch;
  color: var(--fg);
  text-align: center;
}

.thing[aria-checked="true"] {
  border-image-source: url('./sprites/frame-action.svg');
  
  translate: 0 calc(var(--px) * -1);
  filter: var(--shadow-1);
}

.thing-name { font-size: var(--fs-micro); line-height: var(--lh-tight); }


.thing-count {
  position: absolute;
  top: calc(var(--px) * -1);
  right: calc(var(--px) * -1);
  min-width: 22px;
  padding: 0 var(--px);
  background: var(--cream-300);
  box-shadow: inset 0 0 0 var(--px) var(--oak-900);
  font-family: var(--f-pixel);
  font-size: var(--fs-micro);
  font-feature-settings: "palt" 0;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: none;
  line-height: 20px;
  text-align: center;
}


.thing-fav {
  position: absolute;
  top: calc(var(--px) * -1);
  left: calc(var(--px) * -1);
  padding: 0 var(--px);
  background: var(--berry-300);
  color: var(--cream-050);
  font-size: var(--fs-micro);
  line-height: 18px;
  box-shadow: inset 0 0 0 var(--px) var(--berry-700);
}


.thing[aria-disabled="true"] {
  filter: saturate(.2) opacity(.55);
  pointer-events: none;
}


.thing[data-placed="true"] {
  border-image-source: url('./sprites/frame-done.svg');
  pointer-events: none;
}

.thing[data-placed="true"] .thing-placed {
  position: absolute;
  right: calc(var(--px) * -1);
  bottom: calc(var(--px) * -1);
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  background: var(--sage-500);
  color: var(--cream-050);
  box-shadow: inset 0 0 0 var(--px) var(--sage-700);
}


.slot-empty {
  min-height: 104px;
  border: 8px solid transparent;
  border-image: url('./sprites/frame-sunken.svg') 8 fill stretch;
}


.shop-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--sp-3);
  align-items: center;
  border: 8px solid transparent;
  border-image: url('./sprites/frame-panel.svg') 8 fill stretch;
  padding: var(--sp-3);
}

.shop-name { font-size: var(--fs-body); }


.shop-cost {
  font-size: var(--fs-small);
  color: var(--fg-soft);
}


.gift-stage {
  display: grid;
  justify-items: center;
  gap: var(--sp-4);
  padding: var(--sp-5) var(--sp-4);
}

.gift-stage .spr-gift { --spr-box: 96px; }




.together {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 0;
}

.together-note {
  padding: var(--sp-5) var(--sp-4) var(--sp-7);
  text-align: center;
  font-family: var(--f-dialogue);
  font-size: var(--fs-dialogue);
  line-height: var(--lh-dialogue);
  color: var(--fg-soft);
}




.enter {
  min-height: 100dvh;
  display: grid;
  grid-template-rows: 1fr auto;
  gap: var(--sp-6);
  padding: var(--sp-7) var(--sp-5) var(--sp-6);
  background: var(--cream-100);
  background-image: var(--tex-wall);
  text-align: center;
}

.enter-top {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: var(--sp-4);
}


.wordmark {
  font-family: var(--f-pixel);
  font-size: var(--fs-hero);
  -webkit-font-smoothing: none;
  letter-spacing: .14em;
  line-height: 1;
  color: var(--ink-900);
}

.wordmark-sub {
  font-family: var(--f-title);
  font-size: var(--fs-small);
  letter-spacing: .22em;
  color: var(--fg-soft);
}


.auth { display: grid; gap: var(--sp-3); }


.auth .btn { justify-content: center; }

.legal {
  font-size: var(--fs-micro);
  color: var(--fg-soft);
  line-height: 1.8;
}
.legal a { text-decoration: underline; }


.onboard { display: grid; gap: var(--sp-5); text-align: left; }
.onboard-label { font-size: var(--fs-small); color: var(--fg-soft); margin-bottom: var(--sp-2); }


.onboard-say {
  display: grid;
  justify-items: center;
  gap: var(--sp-3);
}

.onboard-say .spr { --spr-box: 96px; }

.onboard-say p {
  font-family: var(--f-dialogue);
  font-size: var(--fs-dialogue);
  line-height: var(--lh-dialogue);
}




.room {
  position: absolute;
  inset: 0;
  background: var(--tex-wall);
  overflow: hidden;
}


.room::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset-inline: 0;
  bottom: 0;
  height: 34%;
  background: var(--tex-floor);
  box-shadow: inset 0 var(--px) 0 var(--oak-900);
}


.room-rug {
  position: absolute;
  z-index: 0;
  bottom: 4%;
  left: 12%;
  right: 12%;
  height: 20%;
  background: var(--tex-rug);
  box-shadow: inset 0 0 0 var(--px) var(--cream-400);
}

.room-item { position: absolute; z-index: 1; }


.room-window  { top: 10%; left: 7%; }
.room-picture { top: 12%; right: 10%; }
.room-flower  { top: 30%; right: 8%; }
.room-basket  { bottom: 30%; left: 6%; }
.room-cushion { bottom: 8%; left: 16%; }
.room-bowl    { bottom: 6%; right: 14%; }
.room-toy     { bottom: 5%; right: 36%; }   
.room-blanket { bottom: 26%; right: 6%; }
.room-stove   { top: 16%; right: 6%; }      
.room-lantern { top: 4%; left: 50%; translate: -50% 0; }

.room-mame {
  bottom: 10%;
  left: 46%;
  translate: -50% 0;
  z-index: 1;
}

.room-mame .spr { --spr-box: 72px; }


.room-mame .spr { animation: breathe 2200ms steps(1, end) infinite; }

@keyframes breathe {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 calc(var(--px) * -1); }
}


.room-mame::after {
  content: "";
  position: absolute;
  z-index: -1;
  bottom: calc(var(--px) * -1);
  left: 50%;
  translate: -50% 0;
  width: 56px;
  height: calc(var(--px) * 2);
  background: var(--oak-500);
  opacity: .45;
}

@media (prefers-reduced-motion: reduce) {
  .room-mame .spr { animation: none; }
}


@media (max-width: 359px) {
  .room-mame .spr { --spr-box: 64px; }
  .room-picture, .room-blanket { display: none; }
}
