:root { --serif: "Palatino Linotype", "Book Antiqua", Georgia, serif; --font: "Segoe UI", "Leelawadee UI", "Noto Sans Thai", Tahoma, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #050506; color: #e8e6e0; font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: none; }
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
button { font-family: var(--font); cursor: pointer; }

.logo { font-family: var(--serif); font-weight: 400; letter-spacing: .32em; font-size: clamp(40px, 7vw, 86px); margin: 0; color: #f2efe6; text-shadow: 0 0 30px rgba(180, 150, 255, .35); }
.logo span { color: #b89cff; margin: 0 .15em; text-shadow: 0 0 18px #9b7bff; }
.logo.small { font-size: 34px; }
.presents { letter-spacing: .6em; font-size: 12px; color: #a9a49a; margin-bottom: 14px; }

#loading { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #050506; z-index: 20; transition: opacity .9s; }
#loading.gone { opacity: 0; pointer-events: none; }
#loading .bar { width: min(340px, 70vw); height: 1px; background: rgba(255, 255, 255, .12); margin: 26px 0 12px; }
#loading .bar i { display: block; height: 100%; width: 0; background: #d8d0ff; box-shadow: 0 0 10px #b89cff; transition: width .3s; }
.ltext { font-size: 12px; color: #8a867e; letter-spacing: .1em; }

#title { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, .55)); z-index: 5; animation: fade 2.5s; }
@keyframes fade { from { opacity: 0; } }
.tbox { text-align: center; }
.sub { font-size: 20px; letter-spacing: .5em; color: #cfcac0; margin-top: 8px; }
.menu { margin-top: 44px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.menu button, .pbox button, .ebox button { min-width: 250px; padding: 11px 28px; background: transparent; color: #eeeae2; border: 1px solid rgba(255, 255, 255, .28); border-radius: 2px; font-size: 16px; letter-spacing: .12em; transition: .25s; }
.menu button:hover, .pbox button:hover, .ebox button:hover, .menu button:focus-visible { background: rgba(255, 255, 255, .08); border-color: #cbbcff; box-shadow: 0 0 22px rgba(170, 140, 255, .35); outline: none; }
.keys { margin-top: 36px; font-size: 12px; color: #8d897f; letter-spacing: .08em; }
body.touch .keys { display: none; }
.mute-note { margin-top: 10px; font-size: 12px; color: #b8b0d8; letter-spacing: .06em; opacity: 0; transition: opacity .4s; }
body.muted .mute-note { opacity: .85; }

#hint { position: fixed; left: 50%; bottom: 11vh; transform: translateX(-50%); font-size: 17px; letter-spacing: .12em; color: #f0ece4; text-shadow: 0 0 12px #000, 0 0 3px #000; opacity: 0; transition: opacity 1s; pointer-events: none; white-space: nowrap; }
#hint.on { opacity: .9; }
kbd { font-family: var(--font); font-size: 13px; padding: 2px 8px; border: 1px solid rgba(255, 255, 255, .5); border-radius: 3px; margin: 0 2px; }
#cp { position: fixed; right: 26px; top: 20px; font-size: 22px; color: #d8ccff; opacity: 0; text-shadow: 0 0 12px #9b7bff; pointer-events: none; }
#cp.on { animation: cp 2.6s; }
@keyframes cp { 20% { opacity: .9; transform: rotate(45deg); } 80% { opacity: .6; } 100% { opacity: 0; transform: rotate(90deg); } }
#motes { position: fixed; right: 26px; top: 56px; font-family: var(--serif); letter-spacing: .15em; color: #ffe2a0; opacity: 0; pointer-events: none; text-shadow: 0 0 10px #c89a40; }
#motes.on { animation: cp 3s; }

#pause, #fatal { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4, 4, 6, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); z-index: 10; }
.pbox { display: flex; flex-direction: column; gap: 10px; align-items: stretch; text-align: center; min-width: 280px; }
.pbox h2 { font-family: var(--serif); font-weight: 400; letter-spacing: .3em; margin: 0 0 6px; }
.stats { display: flex; gap: 20px; justify-content: center; color: #a9a49a; font-size: 14px; margin-bottom: 8px; } .stats b { color: #f0e0b0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 14px; color: #cfcac0; padding: 4px 2px; }
.row input[type=range] { width: 150px; accent-color: #b89cff; } .row input[type=checkbox] { accent-color: #b89cff; width: 18px; height: 18px; }

#ending { position: fixed; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 7vw; background: linear-gradient(90deg, rgba(255, 250, 240, 0) 0%, rgba(20, 16, 30, .55) 55%, rgba(10, 8, 18, .85)); z-index: 8; animation: fade 3s; }
#ending img { position: absolute; left: 4vw; bottom: 0; height: 94vh; max-width: 48vw; object-fit: contain; filter: drop-shadow(0 0 40px rgba(255, 220, 160, .6)); animation: rise 3.5s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } }
.ebox { width: min(520px, 90vw); text-align: center; }
.ebox h2 { font-family: var(--serif); font-weight: 400; font-size: clamp(26px, 3.2vw, 38px); letter-spacing: .12em; color: #fff3da; text-shadow: 0 0 20px rgba(255, 200, 120, .5); }
.ebox p { color: #ddd6ca; line-height: 1.8; }
.estats { display: flex; justify-content: center; gap: 28px; margin: 22px 0; }
.estats div { display: flex; flex-direction: column; } .estats b { font-family: var(--serif); font-size: 28px; color: #ffe2a0; } .estats span { font-size: 12px; color: #a9a49a; letter-spacing: .1em; }
.credit { font-size: 12px; color: #8d897f; margin: 18px 0 22px; }

#touch { display: none; }
body.touch #touch { display: block; }
#touch button { position: fixed; width: 70px; height: 70px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .28); background: rgba(10, 10, 14, .35); color: #eee; font-size: 22px; z-index: 4; }
#touch button.on { background: rgba(184, 156, 255, .35); }
#touch .tl { left: calc(24px + env(safe-area-inset-left, 0px)); bottom: 28px; }
#touch .tr { left: calc(108px + env(safe-area-inset-left, 0px)); bottom: 28px; }
#touch .ta { right: calc(112px + env(safe-area-inset-right, 0px)); bottom: 28px; }
#touch .tj { right: calc(24px + env(safe-area-inset-right, 0px)); bottom: 52px; width: 84px; height: 84px; }
#touch .tp { right: calc(18px + env(safe-area-inset-right, 0px)); top: 16px; width: 44px; height: 44px; font-size: 13px; }
#rotate { display: none; position: fixed; inset: 0; z-index: 30; background: #050506; align-items: center; justify-content: center; text-align: center; font-size: 40px; }
#rotate p { font-size: 18px; margin: 14px 0 4px; } #rotate small { font-size: 13px; color: #8d897f; }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }
body.touch.portrait #rotate { display: flex; }
@media (max-width: 900px) { #ending img { opacity: .35; max-width: 90vw; } #ending { justify-content: center; padding: 0; } }
