/* screens.css — full-screen DOM screens. Sized in vh (page is ~16:9; 704x396 minimum). */
.scr { position: absolute; inset: 0; overflow: hidden; color: #fff1d6; opacity: 0; transform: scale(1.04); transition: opacity .25s ease, transform .3s cubic-bezier(.2,1.4,.4,1); font-size: max(14px, 3.6vh); }
.scr.in { opacity: 1; transform: none; }
.scr.out { opacity: 0; transform: scale(.96); transition: opacity .22s, transform .22s; }
.scr.quiet, .scr.quiet * { animation-duration: 0s !important; transition-duration: 0s !important; }
.scr .title, .scr b, .scr .lbl { text-shadow: -2px 0 #1a0714, 2px 0 #1a0714, 0 -2px #1a0714, 0 2px #1a0714, 0 3px 4px rgba(0,0,0,.8); }
.dim { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 40%, rgba(40,8,32,.55), rgba(8,3,12,.88)); }

/* buttons */
.btn { font-family: inherit; font-size: max(14px, 4vh); font-weight: 700; color: #fff1d6; cursor: pointer; min-height: max(44px, 9vh); min-width: max(88px, 18vh); padding: 0 max(14px, 3vh);
  background: none; border: 12px solid transparent; border-image: url(../assets/ui-button.webp) 30% fill / 12px stretch; box-sizing: border-box; letter-spacing: .04em;
  transition: transform .15s cubic-bezier(.2,1.6,.4,1), filter .15s; touch-action: manipulation; }
.btn .lbl { display: block; line-height: 1.1; }
.btn.primary { filter: hue-rotate(-20deg) saturate(1.3) brightness(1.05); color: #ffe3a0; }
.btn:hover, .btn.kfocus { transform: scale(1.04); filter: brightness(1.3) drop-shadow(0 0 8px #ffcf7a); }
.btn:active { transform: scale(.94); }
.btn.tab { min-width: 0; font-size: max(14px, 3.6vh); opacity: .7; }
.btn.tab.sel { opacity: 1; filter: brightness(1.25) drop-shadow(0 0 6px #ff2fa8); }
.ibtn { width: 48px; height: 48px; padding: 0; border: 0; cursor: pointer; background: url(../assets/ui-plate.webp) center/100% 100% no-repeat; transition: transform .15s cubic-bezier(.2,1.6,.4,1), filter .15s; touch-action: manipulation; }
.ibtn img { width: 70%; height: 70%; object-fit: contain; pointer-events: none; }
.ibtn:hover, .ibtn.kfocus { transform: scale(1.1); filter: brightness(1.3) drop-shadow(0 0 8px #ffcf7a); }
.ibtn:active { transform: scale(.92); }
.kfocus { outline: 3px solid #2ff3ff; outline-offset: 2px; box-shadow: 0 0 14px #2ff3ff; }
.iconrow { position: absolute; right: 10px; top: 10px; display: flex; gap: 8px; z-index: 5; }

/* panels */
.panel { box-sizing: border-box; border: 18px solid transparent; border-image: url(../assets/ui-panel.webp) 64 fill / 18px stretch; padding: 8px 12px; background-clip: padding-box; }
.title { font-weight: 800; font-size: max(18px, 6vh); color: #ffcf7a; letter-spacing: .08em; text-align: center; }
.title.big { font-size: max(18px, 7vh); color: #ffd9c0; }
.stars { display: flex; gap: 4px; justify-content: center; }
.star { width: 1.2em; height: 1.2em; stroke: #5a3a10; stroke-width: 1.2; }
.star.on { fill: #ffcf7a; filter: drop-shadow(0 0 4px #ffb030); }
.star.off { fill: #3a2a40; }

/* title */
.scr-title .bg, .scr-ending .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kb { animation: kb 20s ease-out forwards; transform-origin: 55% 60%; }
.kb.slow { animation-duration: 40s; }
@keyframes kb { to { transform: scale(1.14); } }
.topgrad { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(8,3,12,.85), rgba(8,3,12,0) 50%), linear-gradient(to top, rgba(8,3,12,.8), rgba(8,3,12,0) 25%); }
.rain { position: absolute; inset: -10%; pointer-events: none; opacity: .35; background: repeating-linear-gradient(105deg, rgba(180,220,255,0) 0 14px, rgba(180,220,255,.5) 14px 15px, rgba(180,220,255,0) 15px 38px); background-size: 120px 200px; animation: rain .55s linear infinite; }
@keyframes rain { to { background-position: -40px 200px; } }
.neon { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; background: radial-gradient(circle at 20% 70%, rgba(255,47,168,.25), transparent 40%), radial-gradient(circle at 80% 60%, rgba(47,243,255,.22), transparent 40%); animation: flick 4s steps(1) infinite; }
@keyframes flick { 0%,100% { opacity: 1; } 8% { opacity: .5; } 10% { opacity: 1; } 46% { opacity: .8; } 48% { opacity: .4; } 50% { opacity: 1; } 82% { opacity: .7; } }
.logo { position: absolute; left: 0; right: 0; top: 5vh; display: flex; justify-content: center; pointer-events: none; animation: drop .6s cubic-bezier(.2,1.5,.4,1) both; }
.logo-in { position: relative; display: inline-block; line-height: 0; animation: float 4s ease-in-out .7s infinite; filter: drop-shadow(0 6px 12px rgba(0,0,0,.8)); }
.logo-in img { max-width: 78vw; max-height: 33vh; width: auto; height: auto; display: block; }
.shine { position: absolute; inset: 0; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center;
  background: linear-gradient(110deg, transparent 40%, rgba(255,255,255,.95) 50%, transparent 60%) no-repeat; background-size: 250% 100%; background-position: 150% 0; animation: shine 3.6s ease-in-out 1s infinite; mix-blend-mode: overlay; }
@keyframes shine { 0% { background-position: 150% 0; } 45%,100% { background-position: -50% 0; } }
@keyframes drop { from { transform: translateY(-60vh); opacity: 0; } 60% { transform: translateY(2vh); opacity: 1; } to { transform: none; } }
@keyframes float { 50% { transform: translateY(-1.2vh); } }
.prompt { position: absolute; left: 0; right: 0; bottom: 9vh; text-align: center; font-size: max(14px, 3.8vh); color: #fff1d6; letter-spacing: .1em; text-shadow: 0 0 8px #ff2fa8, 0 2px 4px #000; animation: pulse 1.6s ease-in-out infinite; pointer-events: none; }
@keyframes pulse { 50% { opacity: .35; } }

/* select */
.scr-select .title { position: absolute; left: 140px; right: 140px; top: 4vh; }
.scr-select .gold { position: absolute; left: 76px; top: 10px; height: 48px; display: flex; align-items: center; gap: 6px; font-size: max(16px, 4.4vh); }
.gold img { height: 36px; width: 36px; object-fit: contain; }
.nights { position: absolute; left: 3%; right: 3%; top: 17vh; bottom: 19vh; display: flex; gap: 1.6%; justify-content: center; align-items: stretch; }
.night { flex: 0 0 16%; font-family: inherit; color: #fff1d6; display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px; padding: 1.2vh 4px 1vh; cursor: pointer; box-sizing: border-box;
  background: linear-gradient(#2a0f28, #12060f); border: 3px solid #b8893a; border-radius: 40% 40% 8px 8px / 14% 14% 8px 8px; box-shadow: inset 0 0 0 2px #3a0a1e, 0 0 12px rgba(0,0,0,.8);
  animation: rise .5s cubic-bezier(.2,1.4,.4,1) both; animation-delay: var(--d); transition: transform .15s cubic-bezier(.2,1.6,.4,1), filter .15s; min-width: 0; }
@keyframes rise { from { transform: translateY(8vh); opacity: 0; } }
.night:hover, .night.kfocus { transform: translateY(-4px) scale(1.04); filter: brightness(1.2); }
.night:active { transform: scale(.94); }
.night.current { border-color: #ffcf7a; animation: rise .5s cubic-bezier(.2,1.4,.4,1) both, glow 1.4s ease-in-out .6s infinite; animation-delay: var(--d), 0s; }
@keyframes glow { 50% { box-shadow: inset 0 0 0 2px #3a0a1e, 0 0 22px 4px #ff2fa8; } }
.night.locked { filter: grayscale(.7) brightness(.6); cursor: default; }
.roman { font-size: max(16px, 5vh); font-weight: 800; color: #ffcf7a; text-shadow: 0 2px 3px #000; line-height: 1; margin-top: 1vh; }
.nname { font-size: max(14px, 3.4vh); text-align: center; line-height: 1.1; font-weight: 700; }
.night .stars .star { width: max(12px, 2.6vh); height: max(12px, 2.6vh); }
.mem { flex: 1; width: 82%; min-height: 0; border: 2px solid #8a6a2a; background: #0b0610; display: flex; align-items: center; justify-content: center; overflow: hidden; border-radius: 4px; }
.mem img { width: 100%; height: 100%; object-fit: cover; }
.lock { width: 45%; fill: #b8893a; }
.nbest { font-size: max(14px, 3.2vh); color: #ffe3a0; font-weight: 700; }
.scr-select .back { position: absolute; left: 12px; bottom: 12px; }

/* results */
.res { position: absolute; left: 50%; top: 50%; width: min(92vw, 150vh); height: 90vh; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; justify-content: space-around; text-align: center; padding: 6px 14px; animation: popin .4s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes popin { from { transform: translate(-50%, -50%) scale(.6); opacity: 0; } }
.cont.popin { animation: popin2 .4s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes popin2 { from { transform: scale(.5); opacity: 0; } }
.banner { opacity: 0; transform: scale(3); }
.banner.slam { opacity: 1; transform: none; transition: transform .35s cubic-bezier(.2,1.6,.4,1), opacity .15s; }
.bn { font-size: max(18px, 6.4vh); font-weight: 800; color: #ffcf7a; line-height: 1.1; text-shadow: -2px 0 #1a0714, 2px 0 #1a0714, 0 -2px #1a0714, 0 2px #1a0714, 0 4px 0 #000; }
.bs { font-size: max(14px, 3.8vh); color: #fff1d6; letter-spacing: .2em; text-shadow: 0 0 8px #ff2fa8, 0 2px 2px #000; }
.stars.big .star { width: max(30px, 8vh); height: max(30px, 8vh); }
.star.pop { animation: starpop .45s cubic-bezier(.2,1.8,.4,1); }
@keyframes starpop { from { transform: scale(0) rotate(-90deg); } }
.score { font-size: max(22px, 8vh); font-weight: 800; color: #fff1d6; font-variant-numeric: tabular-nums; text-shadow: 0 0 10px #ff2fa8, 0 3px 0 #000; line-height: 1; }
.score.done { animation: starpop .3s cubic-bezier(.2,1.8,.4,1); }
.subline { display: flex; gap: 12px; align-items: center; opacity: 0; transition: opacity .3s; font-size: max(14px, 3.4vh); }
.subline.show { opacity: 1; }
.ribbon { background: linear-gradient(#ff2fa8, #a0105f); padding: 2px 14px; border: 2px solid #ffcf7a; font-weight: 800; color: #fff1d6; text-shadow: 0 2px 2px #000; clip-path: polygon(0 0, 100% 0, 94% 50%, 100% 100%, 0 100%, 6% 50%); animation: pulse 1.2s infinite; }
.rewards { display: flex; gap: 2vh; align-items: center; justify-content: center; min-height: 0; flex: 1; width: 100%; margin: 4px 0; }
.rw { opacity: 0; transform: translateY(2vh) scale(.8); transition: opacity .3s, transform .35s cubic-bezier(.2,1.6,.4,1); display: flex; flex-direction: column; align-items: center; height: 100%; max-width: 20vh; }
.rw.show { opacity: 1; transform: none; }
.rw.big { max-width: 30vh; }
.flip { perspective: 800px; position: relative; flex: 1; min-height: 0; aspect-ratio: 2 / 3; }
.rw.big .flip { aspect-ratio: 3 / 2; }
.flipin { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .6s cubic-bezier(.3,1.3,.5,1); }
.flipped .flipin { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 6px; overflow: hidden; border: 2px solid #b8893a; background: #0b0610; }
.face img { width: 100%; height: 100%; object-fit: cover; }
.face.front { transform: rotateY(180deg); }
.flip.burst::before { content: ""; position: absolute; inset: -40%; z-index: -1; opacity: 0; background: radial-gradient(circle, rgba(255,230,150,.95), rgba(255,160,40,.4) 35%, transparent 65%), repeating-conic-gradient(rgba(255,220,120,.7) 0 6deg, transparent 6deg 24deg); -webkit-mask: radial-gradient(circle, #000 30%, transparent 70%); mask: radial-gradient(circle, #000 30%, transparent 70%); animation: burst 1.2s ease-out .3s both; }
@keyframes burst { 0% { opacity: 0; transform: scale(.3) rotate(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6) rotate(40deg); } }
.newtag { position: absolute; top: -6px; right: -8px; z-index: 3; background: #ff2fa8; color: #fff; font-size: max(12px, 2.8vh); font-weight: 800; padding: 0 6px; border: 2px solid #ffcf7a; border-radius: 4px; transform: rotate(8deg); }
.rwn { font-size: max(12px, 2.9vh); margin-top: 2px; line-height: 1.1; white-space: nowrap; }
.goldrw { flex-direction: row; gap: 6px; height: auto; font-size: max(16px, 5vh); }
.goldrw img { width: max(32px, 7vh); height: max(32px, 7vh); object-fit: contain; }
.btns { display: flex; gap: 12px; align-items: center; justify-content: center; opacity: 0; transform: translateY(2vh); transition: opacity .3s, transform .35s cubic-bezier(.2,1.6,.4,1); }
.btns.show { opacity: 1; transform: none; }

/* fail */
.vig { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(20,0,10,.4) 30%, rgba(140,0,30,.85) 100%); animation: pulse 2.4s ease-in-out infinite; }
.vig.blue { background: radial-gradient(ellipse at center, rgba(5,5,25,.6) 30%, rgba(10,10,50,.92) 100%); animation: none; }
.scr-fail .title { position: absolute; left: 0; right: 0; top: 5vh; }
.failp { position: absolute; left: 50%; top: 53%; transform: translate(-50%, -50%); width: min(86vw, 110vh); display: flex; flex-direction: column; gap: 1.6vh; align-items: center; padding: 1.5vh 14px; background-color: rgba(10,4,14,.55); }
.revive { display: flex; flex-direction: column; gap: 1vh; width: 100%; }
.rrow { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.have { display: flex; align-items: center; gap: 6px; min-width: 22%; font-size: max(16px, 4.6vh); }
.have img { width: max(32px, 7vh); height: max(32px, 7vh); object-fit: contain; }
.rrow .btn { flex: 1; }

/* toast */
.toast { position: absolute; left: 50%; top: max(60px, 15vh); transform: translate(-50%, -20px); opacity: 0; z-index: 50; pointer-events: none; padding: 6px 22px; font-size: max(14px, 3.8vh); font-weight: 700; color: #fff1d6; border: 2px solid #e8b85a; border-radius: 30px; background: linear-gradient(#3a0a1e, #12060f); box-shadow: 0 0 14px rgba(255,47,168,.5); text-shadow: 0 2px 2px #000; transition: opacity .25s, transform .35s cubic-bezier(.2,1.6,.4,1); white-space: nowrap; max-width: 90vw; }
.toast.in { opacity: 1; transform: translate(-50%, 0); }

/* collection */
.book { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(94vw, 160vh); height: 92vh; display: flex; flex-direction: column; gap: 4px; }
.bhead { display: flex; justify-content: center; align-items: baseline; gap: 14px; }
.bhead .title { font-size: max(18px, 5.6vh); }
.prog { font-size: max(14px, 3.6vh); color: #ffe3a0; }
.tabs { display: flex; gap: 8px; justify-content: center; }
.grid { flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y; scrollbar-width: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(max(64px, 14vh), 1fr)); gap: 8px; align-content: start; padding: 4px; -webkit-overflow-scrolling: touch; }
.grid::-webkit-scrollbar { display: none; }
.bcard { font-family: inherit; color: #fff1d6; background: rgba(20,8,24,.7); border: 2px solid #8a6a2a; border-radius: 6px; padding: 3px; cursor: pointer; display: flex; flex-direction: column; align-items: center; transition: transform .15s cubic-bezier(.2,1.6,.4,1), filter .15s; touch-action: pan-y; }
.bcard:hover, .bcard.kfocus { transform: scale(1.05); filter: brightness(1.25); }
.bcard .pic { position: relative; width: 100%; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 3px; }
.bcard .pic img { width: 100%; height: 100%; object-fit: cover; }
.lockedc { cursor: default; } .lockedc .pic img { filter: brightness(.35) saturate(.5); }
.q { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: max(24px, 7vh); font-weight: 800; color: #e8b85a; text-shadow: 0 2px 4px #000; }
.cn { font-size: max(12px, 3vh); margin-top: 2px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.book .closeb { align-self: center; }
.overlay { position: absolute; inset: 0; z-index: 10; background: rgba(5,2,8,.82); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.overlay.in { opacity: 1; }
.overlay .detail { transform: scale(.7); transition: transform .3s cubic-bezier(.2,1.6,.4,1); width: min(90vw, 140vh); height: 84vh; display: flex; gap: 16px; background-color: #1a0a1c; }
.overlay.in .detail { transform: none; }
.dpic { flex: 0 0 auto; height: 100%; aspect-ratio: 2 / 3; border: 3px solid #e8b85a; border-radius: 8px; overflow: hidden; box-shadow: 0 0 20px rgba(255,47,168,.5); }
.detail.mem .dpic { aspect-ratio: 3 / 2; height: auto; width: 55%; align-self: center; }
.dpic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dside { flex: 1; display: flex; flex-direction: column; gap: 1.4vh; justify-content: center; min-width: 0; }
.dname { font-size: max(18px, 6vh); font-weight: 800; color: #ffcf7a; text-shadow: -2px 0 #1a0714, 2px 0 #1a0714, 0 -2px #1a0714, 0 2px #1a0714; }
.lore { background: linear-gradient(#e9d6a8, #cdb27a); color: #2a1408; padding: 1.2vh 12px; border-radius: 6px; font-size: max(14px, 3.4vh); line-height: 1.35; border: 2px solid #8a6a2a; }
.gems { display: flex; flex-wrap: wrap; gap: 8px; }
.gem { display: flex; align-items: center; gap: 5px; font-size: max(14px, 3.4vh); font-weight: 700; background: rgba(0,0,0,.5); padding: 2px 10px 2px 6px; border-radius: 20px; border: 1px solid #8a6a2a; text-shadow: 0 1px 2px #000; }
.gi { width: 1em; height: 1em; transform: rotate(45deg) scale(.8); background: var(--c); box-shadow: 0 0 8px var(--c), inset 0 0 0 2px rgba(255,255,255,.5); }
.shield { width: 1.1em; height: 1.1em; fill: #9fb4ff; filter: drop-shadow(0 0 4px #5f7fff); }
.dside .btn { align-self: flex-start; }

/* help */
.helpp { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(94vw, 165vh); height: 92vh; display: flex; flex-direction: column; gap: 1vh; align-items: center; }
.helpp .title { font-size: max(18px, 5.4vh); }
.steps { display: flex; gap: 10px; flex: 1; min-height: 0; width: 100%; }
.step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; background: rgba(0,0,0,.35); border: 1px solid #6a4a20; border-radius: 6px; padding: 6px; min-width: 0; }
.pics { display: flex; align-items: center; justify-content: center; gap: 4px; flex: 1; min-height: 0; width: 100%; }
.sp { height: 100%; max-height: 17vh; width: auto; max-width: 30%; object-fit: contain; border-radius: 4px; flex: 1 1 0; }
.sp.cardpic { border: 1px solid #e8b85a; }
.arrow { width: 0; height: 0; border: 7px solid transparent; border-left: 11px solid #ffcf7a; border-right: 0; flex: none; filter: drop-shadow(0 0 4px #ff2fa8); }
.st { font-size: max(14px, 3.3vh); text-align: center; line-height: 1.25; }
.keys { font-size: max(12px, 3vh); text-align: center; color: #ffe3a0; line-height: 1.3; }

/* ending */
.dawn { position: absolute; inset: 0; background: linear-gradient(to top, rgba(255,190,90,.55), rgba(255,140,80,.1) 45%, rgba(20,6,20,.55)); }
.sub { position: absolute; left: 8%; right: 8%; bottom: 14vh; text-align: center; font-size: max(16px, 4.6vh); font-weight: 700; color: #fff1d6; line-height: 1.35; text-shadow: -2px 0 #1a0714, 2px 0 #1a0714, 0 -2px #1a0714, 0 2px #1a0714, 0 3px 6px #000; opacity: 0; transform: translateY(1.5vh); transition: opacity .6s, transform .6s; pointer-events: none; }
.sub.show { opacity: 1; transform: none; }
.endl { position: absolute; left: 0; right: 0; top: 36%; text-align: center; font-size: max(22px, 8vh); font-weight: 800; color: #ffe3a0; letter-spacing: .3em; text-shadow: 0 0 16px #ffb030, 0 3px 0 #1a0714; opacity: 0; transition: opacity 1s; }
.endl.show { opacity: 1; }
.cont { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: 10vh; }
