:root { --ol: #2a1206; --font: serif; --red: #d8432c; --gold: #ffcf5a; --cream: #fff4dc; --indigo: #23305c; }
html { font-size: max(9px, min(calc(100vh / 36), calc(100vw / 62))); }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#app { position: fixed; inset: 0; overflow: hidden; font-family: var(--font); color: #fff; }
#gl, #fx { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#fx { pointer-events: none; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .25s; }
#ui { position: absolute; inset: 0; pointer-events: none; }
#ui * { box-sizing: border-box; }
.hidden { display: none !important; }
.o { color: #fff; font-weight: 900; text-shadow: 0.06em 0 var(--ol), -0.06em 0 var(--ol), 0 0.06em var(--ol), 0 -0.06em var(--ol), 0.05em 0.05em var(--ol), -0.05em 0.05em var(--ol), 0.05em -0.05em var(--ol), -0.05em -0.05em var(--ol), 0.09em 0.13em 0 var(--ol); }
.screen { position: absolute; inset: 0; pointer-events: auto; }
.panel { border-style: solid; border-color: transparent; border-width: 2.2rem; border-image: url(assets/ui-panel.webp) 22% fill / 2.2rem stretch; color: #3a1d0c; }
.panel .dark { color: #3a1d0c; font-weight: 900; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 4.4rem; min-width: 4.4rem; padding: .5rem 2.4rem; box-sizing: border-box; border: .25rem solid #e8b44a; border-radius: 999px; background: linear-gradient(#ff5a44, #d81a12 52%, #a40a08); box-shadow: 0 0 0 .22rem #2a1206, inset 0 .3rem 0 rgba(255,255,255,.35), inset 0 -.3rem 0 rgba(60,0,0,.35), 0 .35rem 0 .1rem #2a1206; margin: .3rem; font-size: 1.6rem; cursor: pointer; transition: transform .12s, filter .12s; pointer-events: auto; white-space: nowrap; }
.btn:active, .btn.press { transform: scale(.92); }
.btn.focus { transform: scale(1.06); filter: brightness(1.2) drop-shadow(0 0 .5rem #ffe28a); }
.btn.dim { filter: grayscale(.8) brightness(.75); }
.btn img { height: 2.2rem; }
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 70% { transform: scale(1.06); opacity: 1; } 100% { transform: scale(1); } }
@keyframes slideL { 0% { transform: translateX(-120%); } 75% { transform: translateX(4%); } 100% { transform: translateX(0); } }
@keyframes drop { 0% { transform: translateY(-60%) scale(1.15); opacity: 0; } 70% { transform: translateY(3%) scale(.98); opacity: 1; } 100% { transform: none; } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.06); opacity: 1; } }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-1.5%); } }
@keyframes shine { 0% { left: -40%; } 60%, 100% { left: 140%; } }
.pop { animation: pop .32s cubic-bezier(.2,1.4,.4,1) both; }

/* title */
#title { background: #1a2340 center / cover no-repeat; }
#title .logoWrap { position: absolute; left: 50%; top: 4%; width: 66%; height: 36%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center; }
#title .logo { max-width: 100%; max-height: 100%; object-fit: contain; animation: drop .6s cubic-bezier(.2,1.3,.4,1) both, floatY 4s 0.7s ease-in-out infinite; filter: drop-shadow(0 .4rem .6rem rgba(0,0,0,.45)); }
#title .start { position: absolute; left: 12%; right: 12%; bottom: 7%; text-align: center; font-size: 2rem; animation: pulse 1.6s ease-in-out infinite; }
.cornerBtn { position: absolute; top: max(1rem, env(safe-area-inset-top)); width: 4.6rem; height: 4.6rem; border-radius: 50%; background: rgba(35, 48, 92, .55); border: .2rem solid rgba(255, 220, 140, .8); display: flex; align-items: center; justify-content: center; cursor: pointer; pointer-events: auto; }
.cornerBtn img, .cornerBtn svg { width: 62%; height: 62%; }
.cornerBtn.r { right: max(1rem, env(safe-area-inset-right)); }
.cornerBtn.l { left: max(1rem, env(safe-area-inset-left)); }

/* intro */
#intro { background: #000 center / cover no-repeat; }
#intro video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
#intro .skip { position: absolute; top: 1rem; right: 1rem; }
.subtitle { position: absolute; left: 10%; right: 10%; bottom: 6%; text-align: center; font-size: 1.7rem; line-height: 1.5; }

/* hud */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud .rankBox { position: absolute; left: max(1rem, env(safe-area-inset-left)); top: .8rem; display: flex; align-items: flex-end; gap: .6rem; }
#hud .rank { font-size: 4.2rem; line-height: 1; color: var(--gold); }
#hud .rank.first { color: #ffe86a; }
#hud .rankSub { font-size: 1.6rem; line-height: 1.6; }
#hud .timeBox { position: absolute; left: max(1rem, env(safe-area-inset-left)); top: 5.6rem; font-size: 1.6rem; }
#hud .goldBox { position: absolute; left: max(1rem, env(safe-area-inset-left)); top: 8rem; font-size: 1.5rem; display: flex; align-items: center; gap: .4rem; }
#hud .goldBox img { height: 2rem; }
#hud .track { position: absolute; left: 24%; right: 24%; top: 1.6rem; height: 4.4rem; }
#hud .track .bar { position: absolute; left: 0; right: 0; top: 2.6rem; height: .7rem; background: rgba(35,25,15,.6); border-radius: .4rem; border: .15rem solid #2a1206; }
#hud .track .fill { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, #ffcf5a, #ff8c3a); border-radius: .3rem; }
#hud .track .goalFlag { position: absolute; right: -1rem; top: 1.7rem; font-size: 1.4rem; }
#hud .dot { position: absolute; top: 0; width: 2.6rem; height: 2.6rem; margin-left: -1.3rem; border-radius: 50%; border: .18rem solid #fff; background: #333 center / cover; transition: left .1s linear; }
#hud .dot.me { width: 3.2rem; height: 3.2rem; margin-left: -1.6rem; top: -.3rem; border-color: var(--gold); z-index: 2; }
#hud .remain { position: absolute; left: 0; right: 0; top: 3.6rem; text-align: center; font-size: 1.6rem; }
#hud .gauges { position: absolute; left: 50%; bottom: 1.6rem; width: 28rem; transform: translateX(-50%); }
#hud .gRow { display: flex; align-items: center; gap: .6rem; margin-top: .5rem; }
#hud .gLabel { min-width: 7.4rem; white-space: nowrap; font-size: 1.4rem; text-align: right; }
#hud .gBar { flex: 1; height: 1.5rem; background: rgba(20,12,6,.65); border: .2rem solid #2a1206; border-radius: .9rem; overflow: hidden; position: relative; }
#hud .gFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: .7rem; }
#hud .ki .gFill { background: linear-gradient(90deg, #6cd4ff, #ffe27a); }
#hud .ki.full .gFill { background: linear-gradient(90deg, #ffb13a, #ff4a2a); animation: pulse .3s infinite; }
#hud .st .gFill { background: linear-gradient(90deg, #7ad66a, #c8f06a); }
#hud .st.low .gFill { background: linear-gradient(90deg, #ff5a3a, #ff9a5a); }
#hud .tut { position: absolute; left: 50%; top: 9rem; transform: translateX(-50%); font-size: 1.7rem; text-align: center; white-space: nowrap; transition: opacity .4s; }
#hud .count { position: absolute; left: 0; right: 0; top: 30%; text-align: center; font-size: 8rem; color: var(--gold); }
#steer { position: absolute; left: max(1.6rem, env(safe-area-inset-left)); bottom: 1.6rem; display: flex; gap: 1.2rem; pointer-events: none; }
.sbtn { width: 7.4rem; height: 7.4rem; border-radius: 50%; background: rgba(40, 20, 10, .55); border: .25rem solid rgba(255, 210, 122, .85); display: flex; align-items: center; justify-content: center; transition: transform .08s, background .08s; }
.sbtn img { width: 60%; height: 60%; object-fit: contain; }
.sbtn.flip img { transform: scaleX(-1); }
.sbtn.on { transform: scale(.9); background: rgba(216, 67, 44, .7); }
.floatTxt { position: absolute; transform: translate(-50%, -50%); font-size: 2.2rem; white-space: nowrap; pointer-events: none; animation: floatUp 1s ease-out forwards; }
@keyframes floatUp { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); } 30% { transform: translate(-50%, -60%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -160%); } }

/* stage card */
#card { display: flex; align-items: center; justify-content: center; pointer-events: none; }
#card .band { width: 100%; padding: 1.6rem 0 1.8rem; background: linear-gradient(90deg, rgba(20,26,50,0) 0%, rgba(20,26,50,.82) 18%, rgba(20,26,50,.82) 82%, rgba(20,26,50,0) 100%); text-align: center; animation: slideL .45s cubic-bezier(.2,1.2,.4,1) both; border-top: .25rem solid var(--gold); border-bottom: .25rem solid var(--gold); }
#card .day { font-size: 2.2rem; color: var(--gold); }
#card .name { font-size: 4.4rem; margin: .2rem 0; }
#card .sub { font-size: 2rem; }
#card .tip { font-size: 1.5rem; margin-top: .6rem; color: #ffe9c0; }

/* dialogue */
#dlg { pointer-events: auto; }
#dlg .box { position: absolute; left: 0; right: 0; margin: 0 auto; bottom: 3%; width: min(70rem, 86%); min-height: 11rem; display: flex; gap: 1.2rem; align-items: center; animation: pop .25s cubic-bezier(.2,1.4,.4,1) both; }
#dlg .face { width: 8.4rem; height: 8.4rem; flex: none; border-radius: 1rem; background: #f3e2c0 center / cover; border: .25rem solid #3a1d0c; }
#dlg .who { font-size: 1.6rem; color: var(--red); font-weight: 900; }
#dlg .line { font-size: 1.75rem; line-height: 1.5; color: #2a1408; font-weight: 700; }
#dlg .nextHint { position: absolute; right: .2rem; bottom: -.6rem; font-size: 1.3rem; color: #6a3a1a; animation: pulse 1s infinite; }

/* results / inn / final share */
.center { display: flex; align-items: center; justify-content: center; }
.dimBg { background: rgba(10, 8, 20, .55); }
.resPanel { width: min(60rem, 88%); max-height: 92%; animation: pop .3s cubic-bezier(.2,1.4,.4,1) both; display: flex; flex-direction: column; gap: .5rem; }
.resPanel h2 { margin: 0 0 .4rem; text-align: center; font-size: 2.6rem; }
.row { display: flex; align-items: center; gap: 1rem; padding: .3rem .8rem; border-radius: .8rem; font-size: 1.7rem; font-weight: 800; color: #3a1d0c; }
.row.me { background: rgba(255, 207, 90, .45); }
.row .pl { width: 3.4rem; font-size: 2.2rem; font-weight: 900; color: var(--red); text-align: center; }
.row .fc { width: 3.6rem; height: 3.6rem; border-radius: 50%; background: #ddd center / cover; border: .18rem solid #3a1d0c; flex: none; }
.row .nm { flex: 1; }
.row .tm { width: 9rem; text-align: right; font-variant-numeric: tabular-nums; }
.row .pt { width: 6.4rem; text-align: right; color: #a3311d; }
.btnRow { display: flex; flex-wrap: wrap; gap: .8rem; justify-content: center; margin-top: .6rem; }
.goldLine { display: flex; justify-content: center; align-items: center; gap: .5rem; font-size: 1.8rem; font-weight: 900; color: #6a3a10; }
.goldLine img { height: 2.4rem; }
#goalBanner { position: absolute; left: 0; right: 0; top: 34%; text-align: center; font-size: 7rem; color: var(--gold); animation: drop .5s cubic-bezier(.2,1.3,.4,1) both; pointer-events: none; }

/* inn */
#inn { background: #120c18 center / cover no-repeat; }
#inn .innWrap { position: absolute; inset: 2% 3%; display: flex; gap: 1.2rem; }
#inn .colL { flex: 1.35; display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
#inn .colR { flex: 1; display: flex; flex-direction: column; gap: .8rem; min-width: 0; }
#inn h2 { margin: 0; font-size: 2.6rem; }
#inn .pick { font-size: 1.6rem; }
#inn .cards { display: flex; gap: .8rem; }
.tcard { flex: 1; min-width: 0; border-style: solid; border-color: transparent; border-width: 1.6rem; border-image: url(assets/ui-panel.webp) 22% fill / 1.6rem stretch; text-align: center; color: #3a1d0c; cursor: pointer; transition: transform .12s, filter .12s; animation: pop .3s cubic-bezier(.2,1.4,.4,1) both; pointer-events: auto; }
.tcard img { width: 5.4rem; height: 5.4rem; object-fit: contain; }
.tcard .tn { font-size: 1.8rem; font-weight: 900; color: var(--red); }
.tcard .td { font-size: 1.3rem; font-weight: 700; line-height: 1.35; min-height: 3.6rem; }
.tcard .tl { font-size: 1.5rem; font-weight: 900; }
.tcard.focus { transform: scale(1.05); filter: brightness(1.12) drop-shadow(0 0 .6rem #ffe28a); }
.tcard.chosen { filter: drop-shadow(0 0 .8rem #ffcf5a) brightness(1.15); transform: scale(1.04); }
.tcard.done { filter: grayscale(.6) brightness(.8); pointer-events: none; }
#inn .smallPanel { padding: 0; font-size: 1.5rem; }
#inn .smallPanel h3 { margin: 0 0 .3rem; font-size: 1.7rem; color: var(--red); }
#inn .bagRow { display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; font-weight: 900; }
#inn .bagRow span { display: inline-flex; align-items: center; gap: .3rem; }
#inn .bagRow img { height: 2.6rem; }
#inn .outfits { display: flex; gap: .6rem; }
.ofit { width: 5rem; height: 5rem; border-radius: .8rem; border: .2rem solid #6a3a1a; background: #f6e7c8 center / 80% no-repeat; position: relative; cursor: pointer; pointer-events: auto; flex: none; }
.ofit.sel { border-color: var(--red); box-shadow: 0 0 0 .2rem var(--gold); }
.ofit.lock { filter: grayscale(.9) brightness(.7); }
.ofit.focus { transform: scale(1.08); box-shadow: 0 0 .6rem #ffe28a; }
.ofit .lk { position: absolute; right: -.3rem; bottom: -.3rem; font-size: 1.2rem; }
#inn .stRow { display: flex; align-items: center; gap: .6rem; font-size: 1.5rem; font-weight: 800; }
#inn .stRow .fc { width: 2.8rem; height: 2.8rem; border-radius: 50%; background: #ddd center / cover; border: .15rem solid #3a1d0c; }
#inn .stRow .nm { flex: 1; }

/* ending */
#ending { background: #000 center / cover no-repeat; }
#ending .endTitle { position: absolute; left: 0; right: 0; top: 7%; text-align: center; font-size: 5.6rem; color: var(--gold); animation: drop .7s cubic-bezier(.2,1.3,.4,1) both; }
#ending .endText { position: absolute; left: 8%; right: 8%; bottom: 6%; padding: 1.4rem 2rem; background: rgba(10,10,25,.62); border-radius: 1rem; font-size: 1.7rem; line-height: 1.6; text-align: center; }
#ending .endText .v { color: #ffe9a8; margin-top: .4rem; }

/* help */
.helpText { font-size: 1.55rem; line-height: 1.6; font-weight: 700; white-space: pre-line; color: #3a1d0c; }
