/* Mobile-specific layout; the approved desktop composition stays intact. */
@media(max-width:720px){
.header{height:58px;min-height:58px;padding-block:0;box-sizing:border-box}
.header .logo{font-size:25px}.header .brand-cookie{width:23px;height:23px}.header .write-top{font-size:11px;padding:7px}
.welcome{height:calc(100svh - 248px);min-height:0;display:grid;grid-template-columns:minmax(0,1fr);grid-template-rows:auto minmax(105px,1fr);gap:10px;padding:12px 5% 10px;box-sizing:border-box;margin:0}
.welcome .entrance-copy{padding:0;margin:0;align-self:start}
.welcome .eyebrow{font-size:12px;line-height:1.4;margin:0 0 12px}
.welcome h1{font-size:clamp(20px,5.5vw,26px);line-height:1.3;margin:0 0 10px;letter-spacing:-.8px}
.welcome .headline-row{margin:0 0 5px;line-height:1.3;white-space:nowrap}
.welcome .headline-lead{font-size:inherit}.welcome .headline-action{font-size:1.12em}
.welcome .entrance-description{font-size:11px;line-height:1.5;margin:8px 0 0}
.welcome .entrance-scene{height:100%;min-height:105px;max-height:none;aspect-ratio:auto;width:100%;margin:0;align-self:stretch}
.welcome .room-backdrop{inset:0}
.welcome .compact-invitation{left:8px;right:8px;bottom:8px;max-width:300px;width:auto;padding:0}
.welcome .compact-notification{padding:9px 11px;gap:8px}
.welcome .notification-icon{width:17px;height:19px}.welcome .notification-icon svg{width:17px;height:19px}
.welcome .notification-section-title{font-size:9px;line-height:1.4;margin:0 0 4px}
.welcome .compact-notification-copy strong{font-size:13px;line-height:1.45;margin:0 0 4px}
.welcome .compact-notification-copy>span:last-child{font-size:10px;line-height:1.4}
.welcome .compact-notification-arrow{font-size:20px}
body:not(.is-in-story) .picture-tabs.room-entrances{height:190px;min-height:190px;padding:10px 5% 12px;margin:0;box-sizing:border-box}
body:not(.is-in-story) .room-entrances .picture-tab-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,78px);gap:9px 10px;width:100%;padding:0}
body:not(.is-in-story) .room-entrances .room-sign{display:grid;grid-template-columns:32px minmax(0,1fr);height:78px;min-height:78px;padding:6px;gap:5px;text-align:left}
body:not(.is-in-story) .room-entrances .pencil-room-art{width:32px;height:43px;max-height:43px}
body:not(.is-in-story) .room-entrances .picture-tab-copy{align-items:flex-start;text-align:left;padding:0}
body:not(.is-in-story) .room-entrances .room-sign strong{font-size:12px;letter-spacing:-.7px;line-height:1.4}
body:not(.is-in-story) .room-entrances .period{font-size:9px;line-height:1.3;margin-bottom:4px}
body:not(.is-in-story) .room-entrances .sign-hanger{display:none}
#stories .room-eyebrow{margin-bottom:11px;font-size:10px}
#stories #story-classroom-title{font-size:20px;line-height:1.45;letter-spacing:-.8px}
#stories .weekly-navigation{margin-top:15px}
#stories:not(.viewing-archive) .weekly-wall-area{grid-template-columns:minmax(0,1fr) minmax(0,1.1fr);grid-template-rows:auto minmax(0,1fr) 26px!important;column-gap:9px;row-gap:12px;padding:12px 8px}
#stories:not(.viewing-archive) .weekly-topic-banner{grid-column:1;grid-row:1;padding:0}
#stories:not(.viewing-archive) .topic-dateline{flex-direction:column;align-items:flex-start;gap:2px;margin-bottom:5px}
#stories:not(.viewing-archive) .topic-dateline>span,#stories:not(.viewing-archive) #weekly-date{font-size:8px;line-height:1.4}
#stories:not(.viewing-archive) .weekly-topic-banner h3{font-size:clamp(16px,4.5vw,20px);line-height:1.35;letter-spacing:-.8px;white-space:nowrap;margin:3px 0 5px}
#stories:not(.viewing-archive) .weekly-topic-banner p{font-size:9px;line-height:1.5;word-break:keep-all;letter-spacing:-.4px}
#stories:not(.viewing-archive) .weekly-view-controls{grid-column:2;grid-row:1;border:0;border-left:1px solid #7d79613d;padding:0 0 0 8px;gap:7px;align-self:center}
#stories:not(.viewing-archive) .weekly-view-controls #weekly-future-story,#stories:not(.viewing-archive) .weekly-view-controls #weekly-view-hint{font-size:9px;line-height:1.6;letter-spacing:-.3px;word-break:keep-all}
#stories:not(.viewing-archive) .weekly-frame{grid-column:1/-1;grid-row:2}
#stories:not(.viewing-archive) .story-wall-footer{grid-column:1/-1;grid-row:3}
#stories:not(.viewing-archive) .weekly-frame #room-memo-board,#stories .weekly-frame #room-memo-board.archived-wall{--cols:2;--tile:calc((100cqw - 23px)/2);grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:calc(var(--tile)/1.2);gap:3px 3px;padding:3px 2px 8px}
}
@media(max-width:720px) and (max-height:650px){.header{height:50px;min-height:50px}.welcome{height:calc(100svh - 220px);padding-top:8px;gap:6px}.welcome .eyebrow{margin-bottom:7px;font-size:11px}.welcome h1{font-size:20px;margin-bottom:5px}.welcome .headline-row{margin-bottom:2px}.welcome .entrance-description{font-size:10px;line-height:1.35;margin-top:4px}body:not(.is-in-story) .picture-tabs.room-entrances{height:170px;min-height:170px;padding-block:7px}body:not(.is-in-story) .room-entrances .picture-tab-list{grid-template-rows:repeat(2,72px);gap:8px 10px}body:not(.is-in-story) .room-entrances .room-sign{height:72px;min-height:72px}}
@media(max-width:720px){.welcome .entrance-copy h1 .headline-row .headline-lead{font-size:1em!important}.welcome .entrance-copy h1 .headline-row .headline-action{font-size:1.12em!important}}
/* Crop the mobile illustration instead of stretching it with a tall viewport. */
@media(max-width:720px){
.welcome{height:auto;grid-template-rows:auto auto;gap:9px;padding-bottom:10px}
.welcome .entrance-scene{height:clamp(125px,24svh,180px);min-height:0;max-height:180px;overflow:hidden}
.welcome .room-backdrop{background-position:center 68%;background-size:cover}
.welcome .compact-invitation{bottom:7px}
body:not(.is-in-story) .story-classroom{display:none}
}
@media(max-width:720px){.welcome .entrance-scene .room-backdrop{background-position:64% bottom}}

/* Fit the actual visible browser height, including Safari/in-app browser chrome. */
@media(max-width:720px){.welcome{height:calc(100dvh - 248px);min-height:0;align-content:stretch;grid-template-rows:auto minmax(125px,1fr)}.welcome .entrance-scene{height:100%;max-height:none;min-height:125px;flex-shrink:0}#stories .weekly-frame #room-memo-board{touch-action:auto;-webkit-overflow-scrolling:touch}}
@media(max-width:720px) and (max-height:650px){.welcome{height:calc(100dvh - 220px)}}
@media(min-width:721px) and (max-width:900px){.header nav>a{display:none!important}.header nav{min-width:0;flex-shrink:1}.header{justify-content:space-between}}

/* A room has one native vertical scroller on phones. The menu stays outside it. */
@media(max-width:720px){
body.is-in-story{height:100dvh;overflow:hidden}
body.is-in-story>.header,body.is-in-story main>.welcome{display:none}
body.is-in-story .picture-tabs.room-entrances{position:fixed;inset:0 0 auto;height:92px;z-index:40}
body.is-in-story main>.story-classroom:not([hidden]){position:fixed;inset:92px 0 0;width:100%;height:calc(100dvh - 92px);min-height:0;box-sizing:border-box;overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;touch-action:auto;-webkit-overflow-scrolling:touch;padding:18px 3% 16px;scrollbar-gutter:auto}
#stories .story-sidebar{margin-bottom:15px}
#stories:not(.viewing-archive) .weekly-wall-area{padding:12px 4px;grid-template-rows:auto auto 26px!important}
#stories:not(.viewing-archive) .weekly-frame,#stories .weekly-frame{height:auto;min-height:0;max-height:none;container-type:inline-size}
#stories:not(.viewing-archive) .weekly-frame #room-memo-board,#stories .weekly-frame #room-memo-board.archived-wall{--tile:calc((100cqw - 7px)/2);height:auto;min-height:0;max-height:none;overflow:visible;scrollbar-gutter:auto;grid-template-columns:repeat(2,minmax(0,1fr));grid-auto-rows:calc(var(--tile)/1.2);padding:3px 2px 8px;gap:3px}
body.is-in-story .return-entrance{display:flex}
body.is-in-story #relay .relay-prose,body.is-in-story #relay .relay-prose-wrap{height:auto;max-height:none;overflow:visible}
body.is-in-story #series .library-scroll,body.is-in-story #series .library-page-body,body.is-in-story #series .library-manuscript{height:auto;max-height:none;min-height:0;overflow:visible}
}

@media(max-width:720px){
html:has(body.is-in-story){overflow:hidden;scrollbar-gutter:auto}
#stories .weekly-frame .memo-material{transform:scale(1.16);transform-origin:center}
#stories .weekly-frame .memo-writing-area{left:calc(50% + (var(--ink-left) - 50%)*1.16);top:calc(50% + (var(--ink-top) - 50%)*1.16);width:calc(var(--ink-width)*1.16);height:calc(var(--ink-height)*1.16)}
#stories:not(.viewing-archive) .weekly-frame #room-memo-board{row-gap:7px}
}

@media(max-width:720px){
#stories:not(.viewing-archive) .weekly-wall-area{grid-template-columns:minmax(0,.95fr) minmax(0,1.25fr);column-gap:8px}
#stories:not(.viewing-archive) .weekly-view-controls #weekly-future-story,#stories:not(.viewing-archive) .weekly-view-controls #weekly-view-hint{font-size:clamp(10px,3vw,12px);line-height:1.65;letter-spacing:-.35px;word-break:keep-all}
}

@media(max-width:720px){
#stories:not(.viewing-archive) .weekly-wall-area{padding-top:26px;row-gap:22px}
#stories:not(.viewing-archive) .weekly-topic-banner{transform:translateX(var(--topic-paper-offset,0px))}
#stories:not(.viewing-archive) #story-wall-topic{margin-top:8px;margin-bottom:10px}
#stories:not(.viewing-archive) .weekly-view-controls{align-self:center;gap:10px}
#stories:not(.viewing-archive) .weekly-view-controls #weekly-view-hint{color:#3f5034;font-weight:700}
#stories:not(.viewing-archive) .weekly-view-controls #weekly-future-story{color:#555a43;font-weight:600}
}

@media(max-width:720px){#stories:not(.viewing-archive) .weekly-wall-area{column-gap:12px}}
