/* Keep the painted borders and both characters inside the two moving doors. */
#home{
 --cover-viewport:calc(100vh - var(--calendar-site-bar-height,0px));
 --cover-height:max(275px,var(--cover-viewport));
 --cover-art-ratio:1.5;
 --cover-art-height:min(var(--cover-height),calc(100vw / var(--cover-art-ratio)));
 --cover-art-width:calc(var(--cover-art-height) * var(--cover-art-ratio));
 --cover-title-position:.31;
 --cover-art:url(img/skin-doors.webp);
 --cover-art-square:url(img/skin-doors-square.webp);
 --cover-art-panorama:url(img/skin-doors-panorama.webp);
 --drawer-grid-min:290px;
 position:relative;isolation:isolate;display:grid;grid-template: minmax(0,1fr) / minmax(0,1fr);
 align-content:stretch;height:var(--cover-height);min-height:0;max-width:none;margin:0;
 padding:0;overflow:hidden;background:#154d4a;color:#fff5d8;
}
@supports (height:100dvh){
 #home{--cover-viewport:calc(100dvh - var(--calendar-site-bar-height,0px))}
}
#home .cabinet,#home .cabinet.is-open{
 grid-area:1/1;width:100%;height:100%;min-height:0;max-width:none;aspect-ratio:auto;margin:0;
 background:#73523c;border:0;border-radius:0;box-shadow:none;container-type:size
}
#home .cabinet::after{display:none}
#home #lid{perspective:1600px}
#home #lid .shutter{
 top:0;bottom:0;width:50%;height:100%;aspect-ratio:auto;
 background:linear-gradient(170deg,#427f78,#76aaa0 52%,#38736d);box-shadow:none
}
#home #lid .shutter::before{
 inset-block:auto;top:50%;height:min(100cqh,calc(100cqw / var(--cover-art-ratio)));
 width:min(50cqw,calc(50cqh * var(--cover-art-ratio)));transform:translateY(-50%);
 background-image:var(--cover-art);background-size:200% 100%
}
#home #lid .shutter.left::before{left:auto;right:0;background-position:left center}
#home #lid .shutter.right::before{left:0;right:auto;background-position:right center}
#home .mast{
 position:absolute;top:calc((100% - var(--cover-art-height)) / 2 + var(--cover-art-height) * var(--cover-title-position));inset-inline:0;z-index:6;display:flex;
 align-items:center;justify-content:center;min-height:0;text-align:center;
 pointer-events:none;background:none;box-shadow:none;border:0;padding:0 6vw;margin:0;color:#214f45
}
#home:not(:has(.cabinet.is-open)) .mast{
 transform:translateY(-50%);flex-flow:column nowrap;gap:clamp(4px,1.1dvh,11px)
}
#home .cover-snowflakes{
 display:flex;align-items:center;justify-content:center;gap:clamp(7px,.85vw,13px);
 pointer-events:none;user-select:none
}
#home .cover-snowflakes img{width:clamp(15px,2.25vmin,23px);height:auto;display:block}
#home .cover-snowflakes img:first-child{transform:rotate(-18deg)}
#home .cover-snowflakes img:nth-child(2){width:clamp(21px,3.25vmin,32px)}
#home .cover-snowflakes img:last-child{transform:rotate(18deg)}
#home:has(.cabinet.is-open) :is(.cover-snowflakes,#unbox,.mast-purchase){display:none}
#home .mast-title{display:block}
#home .mast h1{font:normal clamp(33px,calc(var(--cover-art-width) * .054),84px)/1 var(--text);letter-spacing:-.028em;white-space:normal;color:#174c45;text-shadow:0 1px 2px #fff8cf,0 2px 5px #feefd195;margin:0}
#home .mast #intro{font:normal clamp(17px,calc(var(--cover-art-width) * .021),31px)/1.12 var(--text);letter-spacing:0;color:#315b50;white-space:normal;text-shadow:0 1px #e7f3d5;margin:5px 0 0}
#home .mast #profileHome,#home .cabinetfoot{display:none}
#home:not(:has(.cabinet.is-open)) .cabinetfoot{
 display:flex;align-items:center;justify-content:center;position:absolute;z-index:7;
 bottom:max(12px,env(safe-area-inset-bottom),calc((100% - var(--cover-art-height)) / 2 + 12px));left:50%;transform:translateX(-50%);
 width:max-content;max-width:96%;min-height:0;margin:0;padding:0;border:0;background:none
}
#home #homeFull{
 display:inline-flex;align-items:center;justify-content:center;gap:8px;white-space:nowrap;cursor:pointer;
 padding:8px 17px;min-height:42px;border:1px solid #dfc58e;border-radius:24px;
 color:#fff3d5;background:#1e5147;box-shadow:inset 0 0 0 2px #1e5147,inset 0 0 0 3px #b69d67,0 2px 5px #132f3430;
 font:normal clamp(16px,1.35vw,20px)/1.15 var(--text)
}
#home #homeFull:hover{background-color:#2e6457}
#home #homeFull:focus-visible{outline:3px solid #f7dc92;outline-offset:2px}
#home:has(.is-open) #homeFull{min-height:32px;padding:4px 9px;color:#285043;background:transparent;border-color:transparent;box-shadow:none}
#home #homeScreenNote:not(:empty){
 position:absolute;z-index:8;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);width:max-content;max-width:min(90vw,320px);
 padding:7px 12px;text-align:center;border-radius:9px;background:#fff6df;color:#29483d;font:17px/1.2 var(--text)
}
#home #homeScreenNote:empty{display:none}
#home:has(.cabinet.is-open) .cabinetfoot{position:relative}
@media(max-width:440px){
 #home:has(.cabinet.is-open) .cabinetfoot{gap:4px;padding-inline:3px}
 #home:has(.cabinet.is-open) .cabinetfoot :is(#closebox,#homeFull){padding-inline:4px;font-size:15px}
 #home:has(.cabinet.is-open) .cabinetfoot #count{font-size:14px}
}
#home :is(#unbox,.mast-purchase){
 position:static;transform:none;pointer-events:auto;display:inline-flex;align-items:center;justify-content:center;
 height:auto;width:clamp(222px,25vw,320px);max-width:100%;min-height:50px;aspect-ratio:auto;padding:10px 20px;white-space:nowrap;
 border:1px solid #dcb875;border-radius:40px;background:linear-gradient(150deg,#a9484e,#882637 55%,#701c2e);
 color:#fff6da;font:normal clamp(24px,2.8vw,37px)/1.1 var(--text);box-shadow:inset 0 0 0 3px #8f3b43,inset 0 0 0 4px #e0b06a,0 5px 10px #4d272640;
 border-image:none;transition:opacity .18s,filter .18s
}
#home :is(#unbox,.mast-purchase):focus-visible,#home .session-link:focus-visible,#home #closebox:focus-visible{
 outline:3px solid #ffe5a3;outline-offset:3px
}
/* Once open, the drawer grid itself is the main surface. */
#home:has(.cabinet.is-open){height:auto;min-height:var(--cover-viewport);grid-template-rows:auto minmax(var(--drawer-grid-min),1fr) auto;background:#16463f}
#home:has(.cabinet.is-open) .mast{
 position:relative;grid-row:1;top:auto;inset-inline:auto;pointer-events:auto;
 min-height:44px;justify-content:space-between;padding:4px clamp(9px,2.3vw,40px);text-align:left;
 color:#fff3d8;border-bottom:1px solid #b69563;background:linear-gradient(120deg,#124740,#1b5a4f 55%,#123e39)
}
#home:has(.is-open) .mast-title{display:flex;align-items:baseline;gap:clamp(8px,1.8vw,22px)}
#home:has(.is-open) .mast h1{color:#fff3d8;text-shadow:none;font-size:clamp(22px,3.2vh,36px);letter-spacing:-.01em}
#home:has(.is-open) .mast #intro{color:#e8e2bd;text-shadow:none;font-size:clamp(15px,2.1vh,21px);margin:0}
#home:has(.is-open) .mast #profileHome,#home .cabinetfoot #closebox{
 display:block;position:static;transform:none;max-width:46%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
 color:#fff4d6;font:normal clamp(16px,2vh,20px)/1.1 var(--text);letter-spacing:.01em;
 background:#225c50;border:1px solid #c3a366;border-radius:28px;box-shadow:inset 0 0 0 2px #ffe5b010;
 border-image:none;padding:6px clamp(12px,1.9vw,25px);min-height:36px
}
#home:has(.is-open) .cabinet{grid-area:2/1}
#home:has(.is-open) .cabinetfoot{
 grid-area:3/1;display:flex;flex-wrap:wrap;justify-content:center;align-items:center;
 gap:clamp(10px,2vw,29px);padding:3px 10px max(3px,env(safe-area-inset-bottom));margin:0;min-height:0;border-top:1px solid #b69563;
 background:linear-gradient(120deg,#103d37,#174b43 55%,#103d37)
}
#home .cabinetfoot #count{color:#f8e9c8;font:normal clamp(15px,2vh,19px)/1.05 var(--text)}
#home #grid{
 gap:clamp(3px,.42vmin,7px);padding:clamp(4px,.8vmin,11px);border:0;border-radius:0;
 background:linear-gradient(120deg,#422f2c,#654c35 48%,#48332b);
 box-shadow:inset 0 0 0 2px #9b7953,inset 0 0 16px #261d15
}
#home .drawer.tint0{--wrap:url(img/skin-gift-wrap0.webp);--base:#145354;--rshade:#a77a3f;--rglow:#dfbb77;--redge:#f1dca4;--bow:url(img/skin-gift-bow2.webp)}
#home .drawer.tint1{--wrap:url(img/skin-gift-wrap1.webp);--base:#83303a;--rshade:#b9a478;--rglow:#ead9b2;--redge:#fdf1c9;--bow:url(img/skin-gift-bow3.webp)}
#home .drawer.tint2{--wrap:url(img/skin-gift-wrap2.webp);--base:#305448;--rshade:#883a45;--rglow:#b85c57;--redge:#e8bf84;--bow:url(img/skin-gift-bow0.webp)}
#home .drawer.tint3{--wrap:url(img/skin-gift-wrap3.webp);--base:#b9803b;--rshade:#235247;--rglow:#578a6c;--redge:#dac294;--bow:url(img/skin-gift-bow1.webp)}
#home .drawer.tint4{--wrap:url(img/skin-gift-wrap4.webp);--base:#5d9c9f;--rshade:#924454;--rglow:#b56065;--redge:#e4b58a;--bow:url(img/skin-gift-bow0.webp)}
#home .drawer.tint5{--wrap:url(img/skin-gift-wrap5.webp);--base:#183946;--rshade:#af813e;--rglow:#e6bd71;--redge:#fff0b3;--bow:url(img/skin-gift-bow2.webp)}
#home #grid .drawer{
 --tie-x:77%;--tie-y:23%;--r-width:clamp(5px,.68vw,14px);
 --band:linear-gradient(90deg,var(--redge),var(--rshade) 10%,var(--rglow) 43%,var(--rshade) 90%,var(--redge));
 --cross:linear-gradient(var(--redge),var(--rshade) 10%,var(--rglow) 46%,var(--rshade) 90%,var(--redge));
 --motif-scale:clamp(125px,19vmin,240px);--paper-x:50%;--paper-y:45%;
 isolation:isolate;overflow:hidden;position:relative;border:1px solid #c4a976;border-radius:clamp(3px,.5vw,8px);
 background-color:var(--base);background-image:var(--band),var(--cross),var(--wrap);
 background-position:var(--tie-x) center,center var(--tie-y),var(--paper-x) var(--paper-y);
 background-repeat:no-repeat,no-repeat,repeat;background-size:var(--r-width) 100%,100% var(--r-width),var(--motif-scale) auto;
 box-shadow:inset 0 2px 2px #ffebcd80,inset 0 -5px 3px #361b203c,0 1px 4px #1e1b1cbc;
}
#home #grid .drawer:nth-child(3n){--paper-x:0%;--paper-y:12%;--tie-x:74%;--tie-y:21%}
#home #grid .drawer:nth-child(3n+1){--paper-x:95%;--paper-y:85%;--tie-x:73%;--tie-y:31%}
#home #grid .drawer:nth-child(4n){--paper-x:65%;--paper-y:82%;--tie-x:80%;--tie-y:17%}
#home #grid .drawer::after{
 content:"";position:absolute;z-index:0;inset:clamp(2px,.36vmin,6px);pointer-events:none;border:1px solid #ffe3a963;
 box-shadow:0 0 0 1px #563e3a4d;border-radius:2px;border-image:none
}
#home #grid .drawer::before{
 content:"";z-index:3;position:absolute;inset:auto;left:var(--tie-x);top:var(--tie-y);
 width:min(53cqw,61cqh,100px);height:auto;aspect-ratio:2/1;pointer-events:none;transform:translate(-50%,-50%) rotate(-6deg);
 background:transparent var(--bow) center/contain no-repeat;border:0;border-radius:0;box-shadow:none;filter:drop-shadow(0 2px 1px #382b2566)
}
#home #grid .drawer:nth-child(2n)::before{transform:translate(-50%,-50%) rotate(5deg)}
#home #grid .number{
 z-index:4;display:grid;place-items:center;top:50%;left:8%;right:auto;bottom:auto;
 transform:translateY(-50%) rotate(-3deg);width:clamp(23px,min(39cqw,65cqh),76px);aspect-ratio:1;
 padding:0 0 .03em;color:#253f36;background:radial-gradient(ellipse at 40% 22%,#fff9e8,#efdaad 84%,#ccab74);
 border:1px solid #86623b;border-radius:50%;box-shadow:inset 0 0 0 2px #f8eac7,inset 0 0 0 3px #bb9a61,0 2px 3px #301a204d;
 font:normal clamp(18px,min(27cqw,46cqh),51px)/1 var(--text);text-shadow:0 1px #fff4d8;font-variant-numeric:tabular-nums
}
#home #grid .drawer:nth-child(3n) .number{transform:translateY(-50%) rotate(3deg)}
#home #grid .drawer img{
 z-index:2;right:7%;bottom:5%;width:clamp(24px,46cqw,140px);height:58%;object-fit:contain;object-position:center;
 filter:drop-shadow(0 1px 1px #ffedb9bb) drop-shadow(1px 2px 2px #321a1d9c)
}
#home #grid .done-mark{z-index:5;left:4%;bottom:4%;width:clamp(14px,2.3vmin,24px);height:auto;aspect-ratio:1;font-size:clamp(12px,1.65vmin,18px);background:#ecf6dd;color:#174d40;box-shadow:0 0 0 1px #886b36}
#home #grid .drawer:focus-visible{outline:3px solid #fff9d4;outline-offset:-3px}

/* Independent from the form's validation, focus, room switching and cloud status. */
#gate{
 --modal-ink:#20483f;--modal-berry:#83344a;
 width:min(92vw,510px);max-width:calc(100vw - 12px);max-height:92vh;max-height:92dvh;margin:auto;padding:0;
 border:1px solid #b69764;border-radius:22px;overflow:auto;overscroll-behavior:contain;
 background:#fbf6e9;color:#263d34;box-shadow:0 23px 75px #162b2487;
 font:normal clamp(17px,2.4vh,21px)/1.24 var(--text);scrollbar-width:thin
}
#gate::backdrop{background:#193a35a8;backdrop-filter:blur(4px)}
#gate #entry{box-sizing:border-box;margin:0;padding:0 clamp(17px,5.7vw,34px) clamp(16px,3vh,28px)}
#gate header{
 position:relative;isolation:isolate;display:flex;align-items:flex-end;justify-content:flex-start;
 min-height:clamp(84px,13vh,137px);margin:0 calc(-1 * clamp(17px,5.7vw,34px)) 13px;
 padding:18px clamp(18px,5.7vw,34px);overflow:hidden;background:#21544a url(img/skin-gift-wrap0.webp) 36% 48%/230px auto;
 border:0;border-bottom:3px solid #bfa06e
}
#gate header::before{position:absolute;content:"";inset:0;z-index:-1;background:linear-gradient(80deg,#123f38f8,#16463bc9 48%,#17473a52 74%);pointer-events:none}
#gate header::after{
 position:absolute;content:"";z-index:-1;right:clamp(34px,8%,50px);bottom:4px;
 height:84%;aspect-ratio:1;background:transparent url(img/g-gift.webp) center/contain no-repeat;filter:drop-shadow(0 4px 4px #0a302b66);pointer-events:none
}
#gate #gateTitle{max-width:73%;color:#fff4dc;text-shadow:0 1px 2px #183f32;font:normal clamp(32px,5vw,48px)/1 var(--text);letter-spacing:-.018em}
#gate #dismissGate{
 position:absolute;right:9px;top:9px;display:grid;place-items:center;width:38px;height:38px;min-height:38px;padding:0;
 color:#fff8e1;background:#16483ee8;border:1px solid #e1c78e;border-radius:50%;font:normal 27px/1 Arial,sans-serif
}
#gate #roomSummary:not(:empty){padding:7px 12px;background:#e0efde;color:#235342;border-inline-start:3px solid #66836a;border-radius:6px}
#gate #gateInfo{line-height:1.28;color:#536156}
#gate label{font:normal 1.06em/1.1 var(--text);color:var(--modal-ink);margin:13px 0 5px}
#gate input{
 box-sizing:border-box;width:100%;height:44px;min-width:0;padding:7px 12px;letter-spacing:.025em;color:#183d37;background:#fffdf6;
 border:1.5px solid #aeb7a5;border-radius:9px;font:normal max(18px,1em)/1.1 var(--text);box-shadow:inset 0 1px 2px #9b805214
}
#gate .code-row{position:relative;display:flex;align-items:center;gap:0}
#gate .code-row input{flex:1;padding-right:92px}
#gate button{border:1px solid transparent;background:transparent;color:#20483b;cursor:pointer;min-height:40px;padding:6px 13px;font:normal 1em/1.06 var(--text);border-radius:9px}
#gate #toggleCode{position:absolute;right:4px;padding:4px 9px;min-height:35px;background:#e8eddf;color:#214d41;border:0}
#gate #makeTeacher,#gate #logout{color:#305e50;border:0;text-decoration:underline;text-underline-offset:3px;min-height:34px;width:max-content;max-width:100%;text-align:left;margin:2px 0 0;padding:3px 0}
#gate #resolve{display:flex;gap:6px;flex-wrap:wrap}#gate #resolve button{min-height:40px;background:#e7ecdd;border-color:#adbaa3}
#gate #gateStatus:not(:empty){margin:8px 0 0;padding:8px 11px;border-radius:7px;border-inline-start:3px solid #b78372;color:#6c3044;background:#f4e8d7;overflow-wrap:anywhere}
#gate footer{
 display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,1fr);gap:9px;margin:16px 0 0;padding:0;border:0
}
#gate #enterRoom,#gate #guest{
 min-height:45px;padding:8px 11px;border-radius:11px;box-shadow:none;white-space:normal
}
#gate #enterRoom{color:#fff9e4;background:linear-gradient(135deg,#255d4e,#174739);border:1px solid #174638}
#gate #guest{color:#255443;background:#eff0e2;border:1px solid #aac0ac}
#gate button:disabled{opacity:.55;cursor:wait}
#gate button:focus-visible,#gate input:focus-visible{outline:3px solid #a36238;outline-offset:2px}
@media (orientation:portrait){
 #home{--cover-art-ratio:.66666667;--cover-art:url(img/skin-gift-portrait.webp);--cover-title-position:.36;--drawer-grid-min:427px}
 #home .mast{padding-inline:5vw}
 #home .mast h1{font-size:clamp(31px,calc(var(--cover-art-width) * .088),67px)}
 #home:has(.is-open) .mast{top:auto;padding:6px 9px}
 #home:has(.is-open) .mast-title{display:block}
 #home:has(.is-open) .mast #intro{font-size:15px;line-height:1.1;margin:1px 0 0}
 #home #grid{grid-template-columns:repeat(5,minmax(0,1fr));grid-template-rows:repeat(9,minmax(0,1fr))}
 #home #grid .drawer{grid-column:var(--mx)/span var(--mw);grid-row:var(--my)/span var(--mh)}
}
@media (max-height:540px) and (orientation:landscape){
 #home .mast h1{font-size:clamp(26px,calc(var(--cover-art-width) * .057),38px)}
 #home :is(#unbox,.mast-purchase){min-height:39px;font-size:22px;padding-block:5px}
 #home:has(.is-open) .mast{top:auto;min-height:30px;padding-block:1px}
 #home:has(.is-open) .mast h1{font-size:19px}
 #home .cabinetfoot #closebox,#home:has(.is-open) .mast #profileHome{min-height:28px;padding:3px 10px;font-size:15px}
 #home:has(.is-open) .cabinetfoot{padding-block:2px}
 #gate header{min-height:64px;padding-block:10px}#gate label{margin-top:7px}#gate footer{margin-top:9px}
}
@media(max-width:350px){#gate .code-row input{padding-right:78px}#gate footer{grid-template-columns:1fr}#gate header::after{right:27px;height:69%}}
@media(prefers-reduced-motion:reduce){#home *{transition-duration:0s!important}}
