@media (max-width: 800px) {
  .app { padding: 0; }
  .room {
    border-radius: 0;
    min-height: 100vh;
    aspect-ratio: auto;
  }
  .brand { left: 24px; top: 24px; }
  .window {
    width: 170px;
    height: 170px;
    left: 7%;
    top: 18%;
  }
  .clock {
    width: 93px;
    height: 93px;
    right: calc(6% - 16px);
    top: calc(18% + 100px);
    border-width: 8px;
  }
  .clock-pin {
    width: 8px;
    height: 8px;
  }
  .clock-hour { width: 3px; }
  .clock-minute { width: 2.5px; }
  .clock-second { width: 1px; }
  .shelf,
  .youtube-playing-object.is-playing {
    transform: translateY(0) scale(.86);
  }
  .desk {
    left: 12%;
    right: 7%;
    top: 63%;
    transform: scale(.88);
    transform-origin: center top;
  }
  .rug {
    width: 70%;
    left: 15%;
    bottom: 9%;
  }
  .cat {
    --cat-scale: .8;
    left: 4%;
    bottom: 7%;
  }
  .sheep-1 { left: 32%; bottom: 5%; --sheep-scale: .78; }
  .sheep-2 { left: 46%; bottom: 3%; --sheep-scale: .7; }
  .sheep-3 { left: 60%; bottom: 6%; --sheep-scale: .74; }
  .os-grid {
    grid-template-columns: repeat(3, 84px);
    justify-content: start;
  }
  .scripture-banner {
    left: 50%;
    top: 65%;
    bottom: auto;
    width: min(76%, 620px);
    padding: 13px 16px;
    border-radius: 16px;
    line-height: 1.58;
  }
  .scripture-text {
    font-size: 13px;
  }
  .scripture-ref {
    font-size: 12px;
  }
  .scripture-en .scripture-text {
    font-size: 11px;
  }
  .scripture-en .scripture-ref {
    font-size: 10.5px;
  }
  .room.night.lamp-on .ambient-overlay {
    -webkit-mask-image: radial-gradient(circle 170px at 78% 68%, transparent 0 62%, rgba(0, 0, 0, .18) 69%, rgba(0, 0, 0, .68) 78%, #000 88%);
    mask-image: radial-gradient(circle 170px at 78% 68%, transparent 0 62%, rgba(0, 0, 0, .18) 69%, rgba(0, 0, 0, .68) 78%, #000 88%);
  }
}

@media (max-width: 520px) {
  .window {
    width: 145px;
    height: 145px;
    top: 18%;
  }
  .desk {
    left: -6%;
    right: -8%;
    top: 64%;
    transform: scale(.75);
  }
  .youtube-playing-object {
    left: calc(29% - 54px);
    top: 43px;
  }
  .rug {
    bottom: 10%;
  }
  .controls {
    right: 14px;
    bottom: 14px;
  }
  .os-content {
    padding: 16px 16px 18px;
    max-height: min(86vh, 720px);
  }
  .os-content.playlist-open {
    padding-bottom: 16px;
  }
  .os-header-row {
    gap: 10px;
    margin-bottom: 8px;
  }
  .hello {
    font-size: 22px;
    margin-bottom: 0;
  }
  .os-grid {
    grid-template-columns: repeat(3, 64px);
    gap: 5px;
    justify-content: end;
  }
  .os-app {
    width: 64px;
    height: 44px;
    font-size: 17px;
  }
  .os-message {
    margin-top: 9px;
  }

  .chat-panel {
    min-height: 245px;
    margin-top: 8px;
    padding: 8px;
  }
  .chat-messages {
    min-height: 178px;
    max-height: 270px;
  }
  .chat-empty {
    min-height: 158px;
  }
  .chat-bubble {
    max-width: 88%;
    font-size: 10px;
  }
  .chat-input {
    min-height: 44px;
    font-size: 16px;
  }
  .chat-remaining {
    font-size: 8px;
  }
  .chat-send {
    min-width: 94px;
    padding: 0 8px;
  }
  .os-embed {
    margin-top: 16px;
    padding: 9px;
  }
  .playlist-actions {
    gap: 6px;
    margin-left: auto;
  }
  .os-embed-head {
    gap: 8px;
    flex-wrap: wrap;
  }
  .playlist-title-status {
    gap: 5px;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .playlist-selected-title {
    width: 0;
    max-width: 100%;
    flex: 1 1 0;
  }
  .playlist-progress-value {
    min-width: 30px;
    margin-left: -3px;
    font-size: 9px;
  }
  .playlist-progress-wrap {
    margin-bottom: 7px;
  }
  .playlist-volume {
    gap: 4px;
  }
  .playlist-volume-step {
    width: 25px;
    height: 25px;
    font-size: 15px;
  }
  .playlist-volume-value {
    min-width: 36px;
    font-size: 9px;
  }
  .playlist-volume-label {
    display: none;
  }
  .playlist-picker {
    grid-template-columns: repeat(10, minmax(0, 1fr));
    gap: 3px;
  }
  .playlist-item-btn {
    width: 100%;
    height: 25px;
    padding: 0;
    border-radius: 8px;
    font-size: 9px;
  }
  .scripture-banner {
    left: 50%;
    top: 64%;
    bottom: auto;
    width: min(88%, 460px);
    padding: 11px 12px;
    line-height: 1.5;
  }
  .scripture-line + .scripture-line {
    margin-top: 6px;
  }
  .scripture-text {
    font-size: 11.5px;
  }
  .scripture-ref {
    display: block;
    margin-left: 0;
    margin-top: 2px;
    white-space: normal;
    font-size: 10.5px;
  }
  .scripture-en .scripture-text {
    font-size: 10px;
  }
  .scripture-en .scripture-ref {
    font-size: 9.5px;
  }
  .sheep-1 { left: 25%; bottom: 7%; --sheep-scale: .64; }
  .sheep-2 { left: 44%; bottom: 4%; --sheep-scale: .58; }
  .sheep-3 { left: 63%; bottom: 8%; --sheep-scale: .61; }
  .room.night.lamp-on .ambient-overlay {
    -webkit-mask-image: radial-gradient(circle 145px at 77% 70%, transparent 0 62%, rgba(0, 0, 0, .18) 69%, rgba(0, 0, 0, .68) 78%, #000 88%);
    mask-image: radial-gradient(circle 145px at 77% 70%, transparent 0 62%, rgba(0, 0, 0, .18) 69%, rgba(0, 0, 0, .68) 78%, #000 88%);
  }
}

/* Keep the passed-heart frame between the window and the cross at every width. */
@media (min-width: 801px) and (max-width: 900px) {
  .passed-heart-frame {
    left: calc(56% - 132px);
    right: auto;
    top: 18%;
    bottom: auto;
    width: 105px;
    min-height: 132px;
    padding: 6px;
    transform: rotate(.4deg);
  }
  .passed-heart-frame:hover {
    transform: translateY(-2px) rotate(-.25deg);
  }
  .passed-heart-paper {
    min-height: 118px;
    padding: 8px 7px 7px;
  }
  .passed-heart-title {
    font-size: 7px;
    white-space: normal;
    line-height: 1.25;
    margin-bottom: 6px;
  }
  .passed-heart-text {
    font-size: 10px;
    line-height: 1.42;
    -webkit-line-clamp: 5;
  }
}

@media (max-width: 800px) {
  .passed-heart-frame {
    left: calc(7% + 178px);
    right: auto;
    top: 20%;
    bottom: auto;
    width: 125px;
    min-height: 135px;
    padding: 7px;
    transform: rotate(.35deg);
    transform-origin: left top;
  }
  .passed-heart-frame:hover {
    transform: translateY(-2px) rotate(-.2deg);
  }
  .passed-heart-paper {
    min-height: 119px;
    padding: 9px 8px 8px;
  }
  .passed-heart-title {
    font-size: 7.5px;
    margin-bottom: 6px;
    white-space: normal;
    line-height: 1.25;
  }
  .passed-heart-text {
    font-size: 10.5px;
    line-height: 1.43;
    -webkit-line-clamp: 5;
  }
}

/* On phones, preserve the frame first; the shelf yields its wall space. */
@media (max-width: 650px) {
  .window {
    width: 118px;
    height: 118px;
    left: 5%;
    top: 18%;
  }
  .clock {
    width: 78px;
    height: 78px;
    right: calc(5% - 8px);
    top: calc(18% + 100px);
    border-width: 7px;
  }
  .shelf {
    display: none;
  }
  .passed-heart-frame {
    left: calc(5% + 126px);
    top: 18%;
    width: clamp(86px, 24vw, 120px);
    min-height: 120px;
    padding: 6px;
    transform: rotate(.25deg);
  }
  .passed-heart-frame:hover {
    transform: translateY(-2px) rotate(-.15deg);
  }
  .passed-heart-paper {
    min-height: 106px;
    padding: 7px 6px 6px;
  }
  .passed-heart-title {
    font-size: 6.8px;
    line-height: 1.22;
    margin-bottom: 5px;
    white-space: normal;
  }
  .passed-heart-text {
    font-size: 9.5px;
    line-height: 1.38;
    -webkit-line-clamp: 5;
  }
}

@media (max-width: 340px) {
  .window {
    width: 100px;
    height: 100px;
    left: 4%;
  }
  .clock {
    width: 70px;
    height: 70px;
    right: calc(3% - 4px);
    top: calc(18% + 98px);
  }
  .passed-heart-frame {
    left: calc(4% + 108px);
    width: 78px;
    min-height: 112px;
    padding: 5px;
  }
  .passed-heart-paper {
    min-height: 100px;
    padding: 6px 5px 5px;
  }
  .passed-heart-title {
    font-size: 6.2px;
    margin-bottom: 4px;
  }
  .passed-heart-text {
    font-size: 8.8px;
    line-height: 1.34;
    -webkit-line-clamp: 5;
  }
}
