body.is-chaipo-game { min-height: 100dvh; }
.is-chaipo-game > .site-footer { display: none; }
.is-chaipo-game > .container { width: min(100%, 560px); padding: 0; }
.is-chaipo-game > .container, #view-room { display: flex; flex: 1; flex-direction: column; }
.chai-game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  min-height: 60px;
  padding: .42rem .75rem;
  border-bottom: 1px solid var(--line);
  background: var(--cream);
}
.chai-game-top h1 { margin: 0; font-size: clamp(1.22rem, 5.2vw, 1.54rem); }
#chai-guestbook-open { flex: none; min-height: 44px; padding: .2rem .68rem; white-space: nowrap; font-size: .82rem; }
#chai-guestbook-unread { min-width: 1.15rem; padding-inline: .15rem; border-radius: 999px; background: #386049; color: white; font-size: .7rem; text-align: center; }
#chai-game-frame { display: block; flex: 1; width: 100%; min-height: 580px; border: 0; }

.room-showcase { margin: 0; }
.room-showcase-scene {
  --room-surround: #eae0cd;
  --room-left: #f4e4cb;
  --room-right: #edcfb0;
  --room-floor: #efd8b5;
  position: relative;
  isolation: isolate;
  aspect-ratio: 640 / 420;
  background: #eae0cd;
  border-radius: 12px;
  overflow: hidden;
}
.room-showcase-scene .chai-decorations { display: block; }
.room-showcase-scene .chai-stage-art [data-stage-prop="home"] { display: inline; }
.room-showcase-mascot { position: absolute; left: 36%; bottom: 11%; z-index: 2; width: 31%; height: auto; aspect-ratio: 1; object-fit: contain; }
.room-showcase-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .14rem .7rem; padding: .36rem .08rem; font-size: .82rem; color: var(--muted); }
.room-showcase-nickname { color: var(--green); overflow-wrap: anywhere; }

/* Every story location uses the same illustrated small-room perspective. */
#scene.chai-staged { background: #eae0cd; }
.chai-staged > :is(#scene-art, .scene-shade) { display: none; }
.chai-stage {
  --room-surround: #eae0cd;
  --room-left: #f4e4cb;
  --room-right: #edcfb0;
  --room-floor: #efd8b5;
  position: absolute;
  inset: 0;
  width: min(100%, 152.38cqh);
  height: min(100%, 65.625cqw);
  margin: auto;
}
#scene-art.bg-1 ~ .chai-stage { --room-left: #f2dec5; --room-right: #e5c6a6; }
#scene-art.bg-2 ~ .chai-stage { --room-left: #e8e8cf; --room-right: #d8dfc2; --room-floor: #e9d5b3; }
#scene-art.bg-3 ~ .chai-stage { --room-left: #dfd8ce; --room-right: #c8bfb9; --room-floor: #dfc8ab; }
.chai-stage-art { display: block; width: 100%; height: 100%; }
.chai-stage-art [data-stage-prop] { display: none; }
#scene-art.bg-0 ~ .chai-stage [data-stage-prop="home"],
#scene-art.bg-1 ~ .chai-stage [data-stage-prop="music"],
#scene-art.bg-2 ~ .chai-stage [data-stage-prop="friend"],
#scene-art.bg-3 ~ .chai-stage [data-stage-prop="rest"] { display: inline; }
#scene .chai-stage .actor { width: 31%; height: auto; bottom: 11%; transform: none; animation: none; }
#scene .chai-stage .chaipo { left: 36%; }
#scene.with-bori .chai-stage .chaipo { left: 30%; }
#scene .chai-stage .bori { left: 52%; bottom: 11%; }
.chai-stage #chaipo-sprite.sprite-0 { background: url('./assets/room-chaippo.png') center / contain no-repeat; }

.chai-decorations { display: none; position: absolute; inset: 0; z-index: 1; pointer-events: none; }
#scene-art:is(.bg-0, .bg-3) ~ .chai-stage .chai-decorations { display: block; }
#scene-art.bg-3 ~ .chai-stage .chai-decorations { filter: brightness(.88) saturate(.84); }
.chai-decorations svg { display: none; position: absolute; height: auto; transform: translateX(-50%); }
.chai-decorations svg[data-visible] { display: block; }
.chai-decorations [data-furniture-art="bookshelf"] { left: 18%; bottom: 27%; width: 16%; }
.chai-decorations [data-furniture-art="cushion"] { left: 38%; bottom: 4%; width: 13%; }
.chai-decorations [data-furniture-art="lamp"] { left: 73%; bottom: 17%; width: 17%; }
.chai-decorations [data-furniture-art="plant"] { left: 85%; bottom: 17%; width: 12%; }
.chai-decorations [data-furniture-art="window"] { left: 72%; top: 25%; width: 17%; }
.chai-decorations [data-furniture-art="flower-vase"] { left: 17%; bottom: 17%; width: 11%; }
.chai-decorations [data-furniture-art="concert-poster"] { left: 22%; top: 31%; width: 12%; }
.chai-decorations [data-furniture-art="small-rug"] { left: 74%; bottom: 8%; width: 18%; z-index: -1; }
.chai-decorations [data-furniture-art="display-cabinet"] { left: 86%; top: 39%; width: 11%; }
.chai-decorations [data-furniture-art="record-shelf"] { left: 38%; top: 43%; width: 14%; }
.chai-decorations [data-growth-stage="1"] { left: 38%; top: 25%; width: 11%; }
.chai-decorations [data-growth-stage="2"] { left: 70%; top: 22%; width: 30%; }
.chai-decorations [data-growth-stage="3"] { left: 51%; bottom: 10%; width: 42%; }
.chai-concert-display { position: absolute; left: 63%; bottom: 13%; width: 10%; transform: translateX(-50%); }
.chai-concert-display svg { display: block; position: static; width: 100%; transform: none; }
.chai-room-photo-poster {
  position: absolute;
  left: 80%;
  top: 31%;
  width: 9%;
  aspect-ratio: 3 / 4;
  margin: 0;
  padding: .45%;
  border: 1px solid #b58c5e;
  border-radius: 3px;
  background: #fff2d9;
  box-shadow: 2px 3px 0 #926c5140;
  transform: skewY(17deg);
}
.chai-room-photo-poster[hidden] { display: none; }
.chai-room-photo-poster::before {
  content: '';
  position: absolute;
  top: -4%;
  left: 34%;
  width: 32%;
  height: 9%;
  border-radius: 1px;
  background: #dfb984;
}
.chai-room-photo-poster img { display: block; width: 100%; height: 100%; border-radius: 1px; object-fit: cover; }
.chai-decorations > [data-positioned] {
  left: var(--room-item-x);
  top: var(--room-item-y);
  bottom: auto;
  transform: translate(-50%, -50%);
}
[data-decorating] .chai-stage { touch-action: none; user-select: none; }
[data-decorating] .chai-stage:focus-visible { outline: 2px solid var(--green); outline-offset: -3px; }
[data-decorating] .chai-stage .actor { pointer-events: none; }
[data-decorating] .chai-decorations > :is([data-furniture-art][data-visible], [data-concert-display]) {
  pointer-events: auto;
  cursor: grab;
}
[data-decorating] .chai-decorations > [data-room-selected] {
  outline: 2px dashed #385d48;
  outline-offset: 2px;
  border-radius: 5px;
}

.chai-decoration-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: .24rem;
  min-height: 0;
  padding: .36rem .48rem;
  border: 1px solid #c9bba3;
  border-radius: 6px;
  background: #fff9ec;
  color: var(--green);
}
.chai-decoration-panel[hidden] { display: none; }
.chai-decoration-header { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .45rem; }
.chai-decoration-header h2 { margin: 0; font-size: 1rem; }
.chai-decoration-header button { margin-inline-start: auto; padding: .35rem .52rem; font-size: .78rem; }
.chai-decoration-wallet, .chai-decoration-progress, .chai-decoration-status { margin: 0; font-size: .76rem; }
.chai-decoration-wallet { color: #644716; }
.chai-decoration-scroll { min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-color: #c0b395 transparent; }
.chai-decoration-progress { margin: 0 0 .25rem; color: #565f48; }
.chai-decoration-instructions { margin: .12rem 0 .25rem; color: #565f48; font-size: .78rem; }
.chai-room-photo-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .28rem .5rem;
  margin: .45rem 0;
  padding: .35rem .5rem;
  border: 1px solid #dfd2b8;
  border-radius: 8px;
  background: #f8eedc;
}
.chai-room-photo-controls strong { font-size: .82rem; }
.chai-room-photo-controls p { margin: 0; color: #565f48; font-size: .73rem; }
.chai-room-photo-actions { display: flex; flex-wrap: wrap; gap: .25rem; }
.chai-room-photo-actions button { min-height: 44px; padding: .25rem .45rem; font-size: .75rem; }
.chai-room-photo-actions [hidden] { display: none; }
.chai-decoration-picker { display: flex; align-items: center; gap: .4rem; margin-bottom: .35rem; font-size: .78rem; }
.chai-decoration-picker select { min-width: 0; min-height: 38px; padding: .18rem .28rem; border: 1px solid #c9bba3; border-radius: 5px; background: #fffdf7; color: var(--green); font: inherit; }
.chai-decoration-status:empty { display: none; }
.chai-decoration-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .28rem; margin: 0; padding: 0; list-style: none; }
.chai-decoration-item { display: grid; grid-template-columns: 1.45rem minmax(0, 1fr) auto; align-items: center; gap: .2rem; min-height: 44px; padding: .16rem .26rem; border: 1px solid #dfd2b8; border-radius: 5px; background: #f9f1e2; }
.chai-decoration-item svg { display: block; width: 100%; height: auto; }
.chai-decoration-item strong, .chai-decoration-item span { display: block; font-size: .7rem; line-height: 1.35; }
.chai-decoration-item span { color: #64624e; }
.chai-decoration-item button { min-height: 30px; padding: .18rem .24rem; font-size: .68rem; white-space: nowrap; }
.chai-decoration-item button:disabled { cursor: default; opacity: .6; }
.play-column[data-decorating] > :is(.story-card, #actions, #daily-review, #next-day, #ending, #start-guide) { display: none !important; }

.daybar { gap: .32rem; }
.concert-launcher.secondary { display: inline-flex; align-items: center; gap: .23rem; min-height: 36px; padding: .15rem .34rem; background: #f4e6ca; color: #634e32; font-size: .76rem; white-space: nowrap; }
.concert-launcher .concert-icon { width: 1.2rem; }
.concert-launcher small { font-size: .66rem; }
.concert-screen { min-width: 0; }
.concert-heading { display: flex; align-items: center; gap: .55rem; margin-bottom: .55rem; }
.concert-heading > div:first-child { display: grid; flex: 0 0 2.75rem; width: 2.75rem; height: 2.75rem; padding: .23rem; place-items: center; border: 1px solid #d7b87d; border-radius: 9px; background: #f5e6c9; }
.concert-heading .concert-icon { width: 100%; }
.concert-heading h2 { margin: 0; overflow-wrap: anywhere; }
.concert-heading .modal-kicker { margin: 0 0 .14rem; overflow-wrap: anywhere; }
.concert-artist-form { display: grid; gap: .25rem; padding: .65rem; border: 1px solid #d7c7a7; border-radius: 9px; background: #fbf2de; }
.concert-artist-form label { font-size: .83rem; color: var(--green); font-weight: 750; }
.concert-artist-form > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; gap: .4rem; }
.concert-artist-form input { width: 100%; min-width: 0; min-height: 43px; padding: .38rem .54rem; border: 1px solid #b9ae95; border-radius: 6px; color: var(--ink); background: #fffaf0; font: inherit; font-size: 1rem; }
.concert-artist-form button, .concert-collection button { padding: .32rem .52rem; font-size: .8rem; white-space: nowrap; }
.concert-status { margin: .38rem 0; color: var(--green); font-size: .84rem; }
.concert-status:empty { display: none; }
.concert-start { width: 100%; margin-block: .54rem; text-align: start; }
.concert-screen h3 { margin-block: .7rem .32rem; }
.concert-screen h3 span { margin-inline-start: .25rem; font-size: .84rem; color: var(--muted); }
.concert-collection { display: grid; gap: .32rem; margin: 0; padding: 0; list-style: none; }
.concert-collection li { display: grid; grid-template-columns: 2.3rem minmax(0, 1fr) auto; gap: .42rem; align-items: center; min-height: 44px; padding: .28rem .48rem; border: 1px solid #d8cdb5; border-radius: 8px; background: #f7f2e7; }
.concert-collection li[data-collected] { border-color: #b9c8ab; background: #eef0e1; }
.concert-collection li:not([data-collected]) svg { filter: saturate(.25); opacity: .74; }
.concert-collection .concert-icon { display: block; width: 100%; }
.concert-collection strong, .concert-collection small { display: block; line-height: 1.35; overflow-wrap: anywhere; }
.concert-collection small { margin-top: .12rem; color: var(--muted); }
.concert-replay { margin-top: .62rem; font-size: .87rem; }
.concert-replay summary { cursor: pointer; color: var(--green); font-weight: 750; }
.concert-replay div { display: flex; flex-wrap: wrap; gap: .34rem; margin-top: .35rem; }
.concert-replay button { padding: .3rem .5rem; font-size: .77rem; }
.concert-success, .concert-model, .concert-prize { padding: .54rem .65rem; border: 1px solid #bfcdb1; border-radius: 8px; background: #eef0e1; }
.concert-model { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .38rem; }
.concert-model strong, .concert-model span { display: block; }
.concert-model span { font-size: .82rem; }
.concert-choices { margin-bottom: .44rem; }
.concert-prize { display: flex; align-items: center; gap: .65rem; }
.concert-prize .concert-icon { flex: 0 0 3.6rem; width: 3.6rem; }
.concert-prize p { margin: 0; }
.concert-album [data-open-concert] { margin-top: .5rem; }

@media (max-width: 900px) and (orientation: portrait) {
  .game-shell .header-tools { grid-template-columns: auto auto minmax(0, auto); }
  #compact-room { grid-area: 1 / 3 / 3 / 4; align-self: stretch; padding-inline: .38rem; color: #324936; background: #e6ebd9; }
  #compact-room[aria-expanded="true"] { background: #d5dfc2; }
  .chai-decoration-panel { grid-row: 3 / 5; }
}
@media (max-width: 375px) {
  .game-shell .masthead { padding-inline: 8px; gap: 5px; }
  .game-shell .header-tools { gap: 3px; }
  .game-shell .header-tools .compact-menu-button { padding-inline: 4px; }
  .chai-decoration-list { grid-template-columns: 1fr; }
  .chai-decoration-item button { min-height: 38px; padding-inline: .55rem; }
  .game-shell .day-track { gap: 2px; }
  .game-shell .day-track span { width: 20px; height: 20px; }
  .game-shell .day-track i { width: 5px; }
  .concert-launcher .concert-icon { display: none; }
}

.chai-decoration-item .chai-furniture-listen {
  min-height: 44px;
  padding: .15rem .3rem;
  border: 0;
  background: transparent;
  color: #264a37;
  font-size: .82rem;
  font-weight: 700;
  text-align: left;
  white-space: normal;
}
.chai-decoration-phrases { margin-top: .7rem; border-top: 1px solid #dfd2b8; }
.chai-decoration-phrases summary { min-height: 44px; align-content: center; cursor: pointer; font-weight: 700; }
.chai-decoration-phrase { display: flex; align-items: center; justify-content: space-between; gap: .55rem; padding: .35rem 0; }
.chai-decoration-phrase strong, .chai-decoration-phrase span { display: block; }
.chai-decoration-phrase span { font-size: .82rem; }
.chai-decoration-phrase button { flex: none; min-height: 44px; }
