.gift-calendar {
  position:absolute;inset:0;z-index:4;overflow:auto;cursor:default;
  display:grid;place-items:safe center;touch-action:pan-y;color:#fff4d4;
  background:linear-gradient(180deg,#1e153bbd,#2b193dce 65%,#15152ea6),
             url("assets/levels/7.webp") center bottom / auto 100%;
}
.calendar-inner {width:min(100%,890px);padding:80px 24px 34px;text-align:center}
.calendar-heading h2 {
  color:#fff1bd;font:400 clamp(16px,3.2vw,38px)/1.5 var(--pixel);letter-spacing:-.06em;
  text-shadow:2px 3px #945d70,3px 5px #41283f;
}
.calendar-heading>p:last-child {margin:8px 0 20px;font-size:clamp(14px,1.7vw,18px)}
.opening-count {
  display:inline-block;margin-bottom:10px;padding:4px 12px;color:#ffe1a3;
  border-block:1px solid #c3a171;font:700 14px Golos,sans-serif;
}
.doors {
  list-style:none;margin:0 auto;padding:clamp(10px,1.4vw,15px);display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr)) minmax(0,1.14fr);
  gap:clamp(8px,1.4vw,12px);width:min(100%,650px);background:#563b48;border:3px solid #edcd8d;
  border-radius:7px;box-shadow:inset 0 0 0 3px #846253,0 0 0 3px #38273e,4px 6px 0 #26182f;
}
.doors li {min-width:0}
.door {
  --paper:#23695b;--light:#daf7b2;
  position:relative;display:block;width:100%;min-height:52px;aspect-ratio:1.14;padding:0;
  border:3px solid #35243b;border-radius:5px;background:#503744;color:#fff1bd;perspective:360px;
  box-shadow:1px 4px 0 #302135;touch-action:manipulation;transition:box-shadow .13s,transform .13s;
}
.doors li:nth-child(3n+2) .door {--paper:#9e4659;--light:#ffe6bc}
.doors li:nth-child(3n) .door {--paper:#65518d;--light:#ede2ff}
.door-front,.door-room {position:absolute;inset:0;display:grid;place-items:center;border-radius:2px}
.door-room {background:radial-gradient(ellipse,#ab8261,#72505b 65%,#38263d)}
.door-front {
  transform-origin:0 50%;transform-style:preserve-3d;backface-visibility:hidden;
  background-color:var(--paper);
  background-image:repeating-linear-gradient(135deg,transparent 0 11px,#fff4d609 11px 13px);
  box-shadow:inset 2px 3px 0 #fff2ce70,inset -3px -5px 0 #22152e54;
  transition:transform .34s ease-in,filter .13s;
}
.door-front:before {content:"";position:absolute;inset:6px;border:1px dashed #ffebbe7d}
.door-front:after {
  content:"";position:absolute;right:7%;top:54%;width:5px;height:6px;background:#ffda83;
  box-shadow:inset 1px 1px #fff3b6,1px 2px #583546;
}
.door-front svg {position:absolute;top:13%;width:20%;height:20%;color:var(--light)}
.door-front b {
  position:absolute;top:61%;left:50%;transform:translate(-50%,-50%);
  font:400 clamp(17px,2.6vw,30px) var(--pixel);letter-spacing:-.07em;text-shadow:2px 3px #402b3f;
}
.door:focus-visible {outline:3px solid #d4ff8f;outline-offset:3px;z-index:2}
@media(hover:hover) and (pointer:fine) {
  .door:enabled:hover {transform:translateY(-2px);box-shadow:1px 6px 0 #302135}
  .door:enabled:hover .door-front {filter:brightness(1.14);transform:rotateY(-6deg)}
  .door.open:enabled:hover .door-room {filter:brightness(1.14)}
}
.door:enabled:active {transform:translateY(3px);box-shadow:0 1px 0 #302135}
.door:enabled:active .door-front {filter:brightness(1.11)}
.door.unwrapping .door-front,.door.open .door-front {transform:rotateY(-103deg)}
.door.open .door-front {visibility:hidden}
.door.unwrapping .door-room {background:radial-gradient(ellipse,#fff9c7,#edc77c 65%,#965a4e)}
.door-room canvas {width:56%;height:56%;object-fit:contain;image-rendering:pixelated}
.door-room small {position:absolute;bottom:6px;right:6px;font:clamp(8px,.9vw,11px) var(--pixel);color:#fff2da}
.door.open .door-room canvas {animation:toy-settle .36s ease-out}
.door[data-claimed] .door-room::after {content:"✓";position:absolute;left:6px;top:2px;color:#deffb2;font-weight:bold}
.doors li:last-child {grid-area:1 / 4 / span 2 / 5}
.doors li:last-child .door {height:100%;--paper:#99582e;--light:#ffebaf}
.doors li:last-child .door-front {
  background-image:linear-gradient(90deg,transparent 42%,#ffd77544 42% 60%,transparent 60%),
                   repeating-linear-gradient(135deg,transparent 0 12px,#fff3d113 12px 15px);
}
.doors li:last-child .door-front b {top:64%}
.doors li:last-child .door-front svg {top:17%;width:32%;height:23%}
#calendarEnd:not([hidden]) {display:flex;justify-content:center;margin-top:22px}
body[data-state="calendar"] .stage {touch-action:pan-y}
@keyframes toy-settle {0%{transform:scale(.72)}65%{transform:scale(1.12)}100%{transform:scale(1)}}

@media(max-width:510px) and (orientation:portrait) {
  .calendar-inner {padding:76px max(13px,env(safe-area-inset-right)) max(21px,env(safe-area-inset-bottom)) max(13px,env(safe-area-inset-left))}
  .calendar-heading>p:last-child {margin-bottom:16px}
  .doors {grid-template-columns:repeat(3,minmax(0,1fr));width:min(100%,422px);padding:8px;gap:8px}
  .door {aspect-ratio:1.24}
  .door-front b {font-size:clamp(18px,5.4vw,25px)}
  .doors li:last-child {grid-area:auto / 1 / auto / -1}
  .doors li:last-child .door {height:clamp(57px,15vw,70px);aspect-ratio:auto}
  .doors li:last-child .door-front {display:flex;align-items:center;justify-content:center;gap:12px}
  .doors li:last-child .door-front b,.doors li:last-child .door-front svg {position:static;transform:none}
  .doors li:last-child .door-front svg {width:26px;height:26px}
  .doors li:last-child .door-room canvas {width:44px;height:82%}
}
@media(orientation:landscape) and (max-height:500px) {
  .calendar-inner {padding:9px max(14px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
  .doors {width:min(96%,125vh,650px);gap:7px;padding:7px}
  .door {aspect-ratio:1.5}
  .opening-count {font-size:12px;margin:0 0 3px;padding-block:2px}
  .calendar-heading h2 {font-size:clamp(15px,3.65vh,19px)}
  .calendar-heading>p:last-child {margin:3px 0 11px;font-size:13px}
  #calendarEnd:not([hidden]) {margin-top:12px}
}
@media(orientation:landscape) and (max-height:500px) and (max-width:720px) {
  .calendar-heading {margin-right:clamp(0px,calc(590px - 100vw),160px)}
}
@media(prefers-reduced-motion:reduce) {
  .door,.door-front {transition:none}
  .door:enabled:hover,.door:enabled:active,.door:enabled:hover .door-front {transform:none}
  .door.open .door-room canvas {animation:none}
}
