/* Mobile-only room composition.  This file is deliberately loaded last so it
   consolidates phone layout without changing any desktop rules. */
@media (max-width:700px){
:root{--mobile-scene-height:min(59vw,255px)}

  /* The room is the only home screen. The original feature cards stay in
     the shared DOM, but must not form a second scrollable page on phones. */
  .app.unlocked:not(.room-panel-open) > .container{display:none}

  .room-home{
    min-height:100svh;
    min-height:100dvh;
    overflow:hidden;
    background:linear-gradient(180deg,#e6cfac 0,var(--mobile-scene-height),#d9c39e calc(var(--mobile-scene-height) + 1px),#bda277 100%);
  }
  .room-scene{
    inset:0 0 auto;
    height:var(--mobile-scene-height);
    transform:none!important;
    background-position:center top!important;
    background-size:100% auto!important;
    background-repeat:no-repeat!important;
    filter:none!important;
  }
  .room-home:after{
    background:linear-gradient(180deg,transparent calc(var(--mobile-scene-height) - 42px),rgba(96,72,42,.16) var(--mobile-scene-height),transparent calc(var(--mobile-scene-height) + 34px));
    box-shadow:none;
  }
  .room-header{top:max(4px,env(safe-area-inset-top));width:100%;}
  .room-header h1{padding:4px 10px;font-size:clamp(1rem,5vw,1.35rem);letter-spacing:.1em;text-shadow:0 1px 7px rgba(55,38,20,.62)}

  /* Physical hotspots sit on the un-cropped room image above.  They have a
     generous touch target but do not overlap one another. */
  .room-object{z-index:4;min-width:44px;min-height:44px;touch-action:manipulation}
  .room-object:before{display:none!important}
  .room-object:after{z-index:2;bottom:-16px;padding:3px 7px;color:#4a4031;font-size:.61rem;line-height:1.2;background:rgba(255,252,239,.94);border-radius:999px;box-shadow:0 2px 8px rgba(74,47,26,.16);opacity:1!important;transform:none!important}
  .object-calendar{left:5.2%;top:6.2vw;width:23%;height:17vw;clip-path:polygon(2% 0,98% 0,100% 90%,0 100%)}
  .object-album{right:4.3%;top:6.1vw;width:24%;height:16.5vw}
  .object-bouquet{display:grid!important;left:28.6%!important;top:25.2vw!important;width:15.8%!important;height:17vw!important;clip-path:polygon(17% 0,84% 0,100% 42%,83% 77%,67% 100%,25% 100%,5% 64%,0 28%)!important}
  .object-notebook{left:39.2%;top:35.2vw;width:22.5%;height:14.8vw}
  .object-music{left:62.4%;top:29vw;width:19.5%;height:18vw}
  .object-bouquet:after{bottom:-14px}
  .room-object:focus-visible{outline:3px solid #fff6aa;outline-offset:2px;border-radius:12px}

  /* The lower part remains a calm navigation surface; it is also an
     intentional fallback if an image/hotspot cannot be used. */
  .room-fallback{
    z-index:4;right:50%;bottom:max(16px,calc(env(safe-area-inset-bottom) + 10px));display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;width:min(360px,calc(100% - 28px));max-width:none;transform:translateX(50%);
  }
  .room-fallback:before{content:"小房间入口";grid-column:1/-1;margin:0 0 1px;color:#594a37;font-family:"STKaiti","KaiTi",serif;font-size:1rem;letter-spacing:.1em;text-align:center;text-shadow:0 1px #fff6}
  .room-fallback button{min-height:44px;padding:8px 10px;color:#4d4938;font-size:.8rem;background:rgba(255,252,241,.92);border:1px solid rgba(125,103,70,.34);box-shadow:0 3px 12px rgba(64,47,27,.13)}
  .room-fallback button:last-child{grid-column:1/-1;width:55%;justify-self:center}
  .room-fallback button:focus-visible{outline:3px solid #fff0ad;outline-offset:2px}

  /* Panels use the same live nodes as desktop, but become readable vertical
     paper pages instead of trying to force wide artwork into a narrow screen. */
  .app.room-panel-open .container{padding:62px 10px max(24px,env(safe-area-inset-bottom));background:rgba(37,30,20,.42)}
  .app.room-panel-open .room-panel-close{top:max(10px,env(safe-area-inset-top));min-height:42px;font-size:.9rem}
  .app.room-panel-open .card.selected-object-panel{width:100%;}
  .object-stage{height:auto!important;min-height:0!important;}
  .stage-notebook>.object-panel-art,.stage-album>.object-panel-art,.stage-calendar>.object-panel-art{position:relative!important;display:block;width:100%;height:auto!important;aspect-ratio:1.48;object-fit:contain!important;object-position:top!important;margin:0 0 -29px!important;filter:drop-shadow(0 8px 10px #23190d35)}
  .stage-notebook>.object-panel-content,.stage-album>.object-panel-content,.stage-calendar>.object-panel-content{position:relative!important;inset:auto!important;top:auto!important;display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:14px!important;margin:0 7px!important;padding:21px 14px 25px!important;overflow:visible!important;background:linear-gradient(135deg,#fffaf0,#f0e2c3)!important;border:1px solid #d0ba92!important;border-bottom:4px solid #aa8655!important;border-radius:5px 12px 7px 11px!important;box-shadow:0 10px 20px #33271344!important}
  .stage-calendar>.object-panel-content{display:flex!important}
  .book-leaf,.stage-notebook .book-leaf-left,.stage-notebook .book-leaf-right,.stage-album .book-leaf-right{overflow:visible!important;max-height:none!important;padding:21px 16px!important;background:transparent!important;border:0!important;border-radius:0!important;box-shadow:none!important}
  .stage-notebook .book-leaf-left>.object-page-heading,.stage-album .book-leaf-left>.object-page-heading{padding-left:0!important;min-height:0!important}
  .stage-notebook .form-grid textarea{min-height:138px;height:150px}
  .stage-notebook #sendMessage{width:100%;justify-self:stretch}
  .stage-album #photos{columns:2;column-gap:10px;padding:6px 0;min-height:120px}
  .stage-album .photo-pagination{margin:9px 0 3px;font-size:.66rem}
  .stage-album .photo-actions{display:grid;grid-template-columns:1fr 1fr;gap:5px}
  .stage-album #photos{columns:unset!important;min-height:0!important}
  .stage-album.album-showing-spread .object-panel-content{grid-template-columns:minmax(0,1fr)!important}
  .stage-album .album-photo-spread{grid-template-columns:1fr;gap:14px}
  .stage-album .album-photo-page,.stage-album .album-photo-single .album-photo-page{min-height:0;padding:20px 13px 18px}
  .stage-album .album-page-grid{gap:12px}
  .stage-album .album-page-empty{min-height:130px;font-size:.82rem}
  .stage-album .photo-actions .caption-edit,.stage-album .photo-actions .photo-delete{width:100%;min-height:36px!important;font-size:.68rem!important}
  .stage-calendar{aspect-ratio:auto!important}
  .stage-calendar .calendar-day{min-height:52px;padding:4px 2px}
  .stage-calendar .calendar-day strong{font-size:.56rem}
  .stage-calendar .calendar-weekdays span{font-size:.55rem}
  .stage-calendar .date-form{grid-template-columns:1fr;gap:14px;padding:3px 0}
  .stage-calendar .paper-field:has(#place),.stage-calendar .paper-field:has(#note),.stage-calendar #addDate{grid-column:auto}
  .stage-calendar #addDate{width:100%}
  .stage-calendar .calendar-details{position:static;}
  .stage-music{height:245px!important;width:100%!important;margin:0!important}
  .music-lid-copy{inset:17% 12% auto}.music-lid-copy .object-page-title{font-size:1.4rem}.music-lid-note{display:none}
  .music-object-controls{left:13%;right:13%;top:61%;bottom:11%}.music-object-controls .toolbar{gap:4px;flex-direction:column}.music-object-controls .tip{font-size:.65rem}
  .music-playlist-tray{margin:0 1px 14px;padding:14px 8px 18px}.app.room-panel-open .selected-object-panel .music-frame{height:420px;min-height:420px}
}

@media (max-width:360px){
  :root{--mobile-scene-height:61vw}
  .room-fallback{gap:7px;width:calc(100% - 20px)}
  .room-fallback button{font-size:.73rem}
  .room-object:after{font-size:.56rem;padding:2px 5px}
  .stage-calendar .calendar-day{min-height:48px}
}

@media (max-height:620px) and (max-width:700px){
  .room-fallback{grid-template-columns:repeat(5,minmax(0,1fr));gap:5px;bottom:max(7px,env(safe-area-inset-bottom));width:calc(100% - 16px)}
  .room-fallback:before{display:none}.room-fallback button,.room-fallback button:last-child{grid-column:auto;width:auto;min-height:35px;padding:5px 4px;font-size:.62rem}
}

/* Full-screen phone room: this follows interaction capability as well as width so
   an accidental “desktop site” browser mode cannot reveal the legacy cards. */
@media (hover:none) and (pointer:coarse){
  .app.unlocked:not(.room-panel-open) > .container{display:none!important}
}
@media (max-width:700px){
  :root{--mobile-scene-height:100dvh}
  .app.unlocked:not(.room-panel-open){min-height:100svh;min-height:100dvh;overflow:hidden}
  .app.unlocked:not(.room-panel-open) > .container{display:none!important}
  .room-home{position:fixed!important;inset:0!important;width:100%!important;height:100svh!important;height:100dvh!important;min-height:100svh!important;min-height:100dvh!important;background:#d9c5a4!important}
  .room-scene{inset:0!important;width:100%!important;height:100%!important;background-size:cover!important;background-position:center!important}
  .room-home:after{inset:0!important;background:linear-gradient(180deg,rgba(255,249,230,.08),transparent 39%,rgba(76,56,36,.17))!important}
  .object-calendar{left:5%;top:10%;width:28%;height:18%}
  .object-album{right:4%;top:10%;width:28%;height:17%}
  .object-bouquet{left:27%!important;top:35%!important;width:18%!important;height:18%!important}
  .object-notebook{left:38%;top:57%;width:25%;height:16%}
  .object-music{left:62%;top:49%;width:22%;height:20%}
  .room-fallback{bottom:max(12px,calc(env(safe-area-inset-bottom) + 8px));background:linear-gradient(180deg,transparent,rgba(235,216,184,.12))}
  .stage-album .photo-pagination{position:static;display:flex!important;align-items:center;justify-content:space-between;gap:8px;margin:14px 0 2px!important;pointer-events:auto}
  .stage-album .photo-pagination span{position:static;min-width:0;transform:none;order:2;font-size:.7rem}
  .stage-album .photo-pagination .photo-page-turn{position:static;width:42px;min-width:42px!important;height:42px;min-height:42px!important;transform:none!important;font-size:1.9rem!important;order:1}
  .stage-album .photo-pagination .photo-page-turn-next{order:3}
  .stage-album .album-photo-page{min-height:0;padding:22px 13px 18px}
  .stage-album .album-page-grid{gap:11px}
  .stage-album .album-photo-empty{min-height:135px;padding:10px;font-size:.76rem}
}