/* The book spans the cover. The form remains on its own strip of paper. */
body:has(#home:not([hidden])) main{width:100%;max-width:none}
#home .room-book{width:100%;margin:0;padding:clamp(5px,.75vw,13px) clamp(5px,.85vw,16px) clamp(9px,1vw,18px)}
#home .room-spread{display:flex;flex-direction:column}
#home .room-plate{display:block;padding:clamp(4px,.5vw,9px);padding-bottom:0}
#home .room-illustration{width:100%;height:auto;min-height:0;aspect-ratio:2.26;background-size:100% auto;background-repeat:no-repeat;background-position:100% 100%;overflow:hidden}
#home .room-plate::after{bottom:0}
#home .room-illustration canvas{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
#home .room-letter{padding:15px 24px 12px}
#home .room-letter-inner{max-width:1000px;display:grid;align-items:center;justify-content:center;grid-template-columns:auto auto minmax(175px,245px) auto;gap:0 clamp(14px,2.5vw,38px)}
#home .room-seal{position:static;grid-row:1/3;width:55px;height:60px;margin:0}
#home .room-heading{font-size:clamp(24px,2.7vw,38px);text-align:left}
#home #greet{grid-column:2;grid-row:2;margin:0;text-align:left;font-size:15px}
#home #mainAct,#home #consult{grid-row:1/3;margin:0}#home #mainAct{grid-column:3}#home #consult{grid-column:4}
@media(max-width:700px){
 #home .room-book{padding:5px 5px 10px;border-radius:4px 7px 7px 4px}
 #home .room-plate{padding:4px 3px 0}
 /* Keep the arched door on the right and give the foreground book more space. */
 #home .room-illustration{aspect-ratio:1.39;height:auto;min-height:0;background-size:117% auto;background-position:100% 100%}
 #home .room-letter{padding:10px 14px 5px}
 #home .room-letter-inner{max-width:420px;grid-template-columns:1fr auto;column-gap:7px}
 #home .room-heading{grid-column:1;grid-row:1;font-size:clamp(22px,5.8vw,30px);text-align:left}
 #home #greet{grid-column:1;grid-row:2;font-size:12px;letter-spacing:0;line-height:1.5}
 #home .room-seal{display:none}
 #home #mainAct{grid-column:2;grid-row:1/3;width:auto;max-width:none;padding:11px 13px;font-size:clamp(15px,4.2vw,18px);letter-spacing:0}
 #home #consult{grid-column:1/-1;grid-row:3;justify-self:center;font-size:14px;min-height:42px}
 #home .room-letter:before{inset:4px}
 #home .reading-guides{margin-inline:10px}
}
@media(max-width:700px) and (max-height:600px){
 body:has(#home:not([hidden])) .mast{padding-top:5px}
 #home .room-illustration{aspect-ratio:1.65;background-size:105% auto}
}
@media(max-height:480px) and (min-width:540px) and (max-width:960px){
 #home .room-spread{display:grid;grid-template-columns:1.5fr 1fr}
 #home .room-plate{padding:4px}
 #home .room-illustration{aspect-ratio:1.7;background-size:100% auto}
 #home .room-letter-inner{display:flex;flex-direction:column}
 #home .room-heading,#home #greet{text-align:center}
 #home #mainAct{margin:8px auto 0}#home .room-seal{display:none}
}
body[data-light=night] #home .reading-guides a{color:#f1e5cb;text-decoration-color:#c0b28f}
#home .resident-film{
 position:absolute;display:block;pointer-events:none;opacity:0;transition:opacity .12s linear;
 -webkit-mask-image:linear-gradient(to right,transparent,#000 4%,#000 96%,transparent),linear-gradient(to bottom,transparent,#000 4%);
 -webkit-mask-composite:source-in;
 mask-image:linear-gradient(to right,transparent,#000 4%,#000 96%,transparent),linear-gradient(to bottom,transparent,#000 4%);
 mask-composite:intersect
}
#home .resident-film.visible{opacity:1}

#home .glass-bead{position:absolute;inset:0;pointer-events:none;background-image:url("./glass-bead.png");background-position:inherit;background-size:inherit;background-repeat:no-repeat}
#home .drawing-drop .glass-bead{visibility:hidden}

/* Keep the artwork and the moving objects in the same coordinate plane, even at fractional zoom. */
#home .room-illustration{aspect-ratio:1180/460}
body #home .room-plate .room-illustration{background-image:none}
#home .room-world{position:absolute;right:0;bottom:0;height:110.43478261%;aspect-ratio:764/508;pointer-events:none}
#home .left-window{position:absolute;right:0;bottom:0;width:154.45026178%;height:100%;background-size:100% 100%;background-repeat:no-repeat}
#home .glass-bead{background-position:center;background-size:100% 100%}
#home .film-key{-webkit-clip-path:inset(10% 0 0);clip-path:inset(10% 0 0)}
#home .room-plate{width:min(100%,max(880px,calc((100svh - 246px) * 2.565)),1660px);margin-inline:auto}
@media(min-width:701px) and (max-width:960px){#home .room-plate{width:100%}}
@media(max-width:700px){
 #home .room-plate{width:100%}
 #home .room-illustration{aspect-ratio:1.39}
 #home .left-window{width:100%;background-image:none}
}
@media(max-width:700px) and (max-height:600px){#home .room-illustration{aspect-ratio:1.59}}
@media(max-height:480px) and (min-width:540px) and (max-width:960px){
 #home .room-illustration{aspect-ratio:1.74}
 #home .left-window{width:154.45026178%;background-image:var(--room-wide)}
}

#home .left-window picture,#home .left-window img{display:block;width:100%;height:100%}

@media (max-width: 700px), (max-width: 960px) and (max-height: 480px) {
  body:has(#home:not([hidden])) main > .under {
    margin-left: max(20px, calc(env(safe-area-inset-left, 0px) + 12px));
    margin-right: max(20px, calc(env(safe-area-inset-right, 0px) + 12px));
  }
  main > .under {
    align-items: center;
    flex-wrap: wrap;
    gap: 0 12px;
  }
  main > .under > span { white-space: normal; }
  .under > details {
    min-width: 0;
    max-width: 100%;
    margin-inline-start: auto;
  }
  .under > details[open] { flex-basis: 100%; }
  .under > details > summary {
    box-sizing: border-box;
    width: fit-content;
    max-width: 100%;
    min-height: 44px;
    margin-inline-start: auto;
    padding-inline: 4px;
  }
  .under #savedNickname {
    box-sizing: border-box;
    min-width: 0;
    max-width: 100%;
  }
}
