html, body { margin: 0; height: 100%; background: #000; overflow: hidden; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body { display: flex; align-items: center; justify-content: center;
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "Noto Serif JP", serif; color: #f2ead8; }
/* 1280x720 の論理画面を JS で拡大縮小（レターボックス） */
#stage { position: relative; width: 1280px; height: 720px; transform-origin: 50% 50%; overflow: hidden; background: #000; flex: none; }
#view, #fx { position: absolute; inset: 0; width: 1280px; height: 720px; display: block; }
#fx { pointer-events: none; }
#loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; letter-spacing: .4em; font-size: 22px; color: #ccc; }

#hud { position: absolute; inset: 0; pointer-events: none; text-shadow: 0 0 6px #000, 0 0 2px #000; }
#hud > * { position: absolute; }

/* ゲージ */
.bars { left: 26px; top: 22px; width: 280px; z-index: 3; }
.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; letter-spacing: .1em; }
.bar label { width: 40px; opacity: .85; }
.bar > div { flex: 1; height: 12px; background: rgba(0,0,0,.55); border: 1px solid rgba(255,255,255,.45); }
.bar i { display: block; height: 100%; width: 100%; }
.bar.hp i { background: linear-gradient(90deg, #b8283a, #ff6a6a); }
.bar.st { opacity: .8; } .bar.st > div, .bar.pl > div { height: 6px; } .bar.st i { background: #7ac8a0; }
.bar.pl { opacity: .85; } .bar.pl i { background: #6aa8ff; }
.bar span { width: 32px; text-align: right; font-size: 13px; }
.top-c { left: 0; right: 0; top: 16px; text-align: center; z-index: 3; }
#room { font-size: 20px; letter-spacing: .25em; } #remain { font-size: 14px; letter-spacing: .2em; opacity: .85; margin-top: 4px; }
.top-r { right: 132px; top: 14px; text-align: right; z-index: 3; } #score { font-size: 32px; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
#rscore { font-size: 14px; opacity: .8; letter-spacing: .1em; }

/* コンボ */
#combo { right: 36px; top: 150px; text-align: right; display: none; z-index: 3; }
#combo b { font-size: 90px; color: #ffd24a; text-shadow: 0 0 18px rgba(255,150,0,.8), 0 0 4px #000; font-style: italic; }
#combo span { font-size: 28px; margin-left: 8px; color: #ffd24a; letter-spacing: .1em; }
#combo small { display: block; font-size: 22px; color: #fff; }
#combo.pulse b { animation: pulse .25s ease-out; }
@keyframes pulse { 0% { transform: scale(1.6); } 100% { transform: scale(1); } }
#c-bar { margin-top: 4px; height: 5px; width: 200px; margin-left: auto; background: rgba(0,0,0,.5); } #c-bar i { display: block; height: 100%; background: #ffd24a; }

/* バナー */
#banner { left: 0; right: 0; top: 26%; text-align: center; opacity: 0; pointer-events: none; z-index: 4; }
#banner b { display: block; font-size: 54px; letter-spacing: .3em; text-indent: .3em; text-shadow: 0 0 24px rgba(0,0,0,.95), 0 0 6px #000; }
#banner small { display: block; margin-top: 10px; font-size: 20px; letter-spacing: .25em; opacity: .95; }
#banner.show { animation-name: ban; animation-timing-function: ease-out; animation-fill-mode: forwards; }
@keyframes ban { 0% { opacity: 0; transform: scale(1.3); } 10% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* 罠バー */
#traps { left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 5px; pointer-events: auto; z-index: 3; }
.slot { position: relative; width: 78px; height: 64px; background: rgba(10,8,14,.75); border: 2px solid rgba(255,255,255,.25); border-radius: 6px; border-bottom-width: 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; overflow: hidden; }
.slot.m-floor { border-bottom-color: #58d070; } .slot.m-wall { border-bottom-color: #f0a040; } .slot.m-ceil { border-bottom-color: #b070ff; }
.slot b { font-size: 24px; line-height: 1; position: relative; z-index: 1; } .slot span { font-size: 11px; letter-spacing: .04em; margin-top: 3px; position: relative; z-index: 1; }
.slot u { position: absolute; left: 5px; top: 2px; text-decoration: none; font-size: 11px; opacity: .7; z-index: 1; }
.slot em { position: absolute; right: 5px; top: 1px; font-style: normal; font-size: 15px; color: #ff9a9a; z-index: 1; }
.slot s { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(0,0,0,.65); }
.slot.sel { border-color: #ffd24a; background: rgba(60,40,10,.8); box-shadow: 0 0 14px rgba(255,200,60,.6); transform: translateY(-6px); }
.slot.cool b, .slot.cool span { opacity: .45; }
#tdesc { left: 0; right: 0; bottom: 92px; text-align: center; font-size: 15px; letter-spacing: .08em; z-index: 3; }
.mt { padding: 1px 8px; border-radius: 3px; font-size: 12px; color: #111; text-shadow: none; } .mt.m-floor { background: #58d070; } .mt.m-wall { background: #f0a040; } .mt.m-ceil { background: #b070ff; }
#hint { left: 0; right: 0; bottom: 122px; text-align: center; font-size: 17px; letter-spacing: .1em; opacity: 0; transition: opacity .3s; z-index: 3; }
#hint.show { opacity: 1; background: rgba(0,0,0,.45); width: fit-content; margin: 0 auto; padding: 4px 18px; border-radius: 14px; }
#seq { left: 26px; bottom: 100px; font-size: 15px; z-index: 3; } #seq .sh { font-size: 12px; opacity: .8; margin-bottom: 4px; letter-spacing: .1em; }
.si { padding: 3px 12px; margin-bottom: 3px; background: rgba(0,0,0,.55); border-left: 4px solid #888; letter-spacing: .06em; }
.si.m-floor { border-color: #58d070; } .si.m-wall { border-color: #f0a040; } .si.m-ceil { border-color: #b070ff; }
.si.next { background: rgba(80,60,10,.8); box-shadow: 0 0 10px rgba(255,210,70,.6); } .si.used { opacity: .4; }

/* 演出: シネマバー・計画モード */
.cbar { left: 0; right: 0; height: 0; background: #000; transition: height .25s; z-index: 2; } #bar-t { top: 0; } #bar-b { bottom: 0; }
#planfx { inset: 0; opacity: 0; transition: opacity .2s; box-shadow: inset 0 0 160px 40px rgba(60,120,255,.55); background: rgba(40,80,200,.08); z-index: 1; }

/* ボタン類 */
.hubbtn, .quitbtn { z-index: 6; pointer-events: auto; font: inherit; font-size: 14px; letter-spacing: .1em; color: #f2ead8; text-decoration: none;
  background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.45); padding: 7px 16px; cursor: pointer; }
.hubbtn { left: 26px; bottom: 24px; display: none; } .quitbtn { right: 22px; top: 16px; display: none; }
.m-title .hubbtn { display: block; } .m-play .quitbtn { display: block; }

/* タイトル */
#title { left: 56px; top: 70px; width: 560px; display: none; z-index: 5; }
.m-title #title { display: block; }
.logo { font-size: 150px; letter-spacing: .12em; line-height: 1; color: #f6ecd0; text-shadow: 0 0 30px rgba(180,40,60,.9), 0 4px 0 #3a0a14, 0 0 4px #000; }
.en { font-size: 28px; letter-spacing: .5em; margin: 6px 0 22px 6px; color: #d9b45a; }
.lead { font-size: 18px; line-height: 1.9; letter-spacing: .05em; background: rgba(0,0,0,.55); padding: 10px 14px; border-left: 3px solid #b0283a; }
.lead b { color: #ffd24a; }
.start { margin-top: 22px; font-size: 24px; letter-spacing: .2em; animation: blink 1.6s infinite; }
.keys { margin-top: 12px; font-size: 13px; opacity: .85; line-height: 1.8; background: rgba(0,0,0,.5); padding: 6px 10px; }
@keyframes blink { 50% { opacity: .3; } }
#demo { right: 26px; bottom: 26px; display: none; font-size: 14px; letter-spacing: .25em; padding: 6px 14px; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.35); z-index: 5; }
.m-title #demo { display: block; }
.m-title .top-r, .m-title #tdesc, .m-title #traps, .m-title #hint, .m-title #banner, .m-title #seq, .m-title .bars, .m-title #combo { display: none; }
.m-title .top-c { top: auto; bottom: 28px; opacity: .9; }

/* 結果 */
#result { inset: 0; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,.6); pointer-events: auto; z-index: 7; }
.m-result #result { display: flex; }
.m-result #traps, .m-result #tdesc, .m-result .quitbtn, .m-result #seq { display: none; }
.panel { background: rgba(14,10,16,.94); border: 2px solid #c9a24a; padding: 24px 52px 28px; text-align: center; min-width: 460px; }
.panel h2 { margin: 0 0 4px; font-size: 32px; letter-spacing: .3em; }
.rank { font-size: 100px; line-height: 1.1; font-weight: bold; color: #ffd24a; text-shadow: 0 0 20px rgba(255,160,0,.7); }
.rank.r-X { color: #888; text-shadow: none; }
.panel table { margin: 4px auto 18px; font-size: 19px; letter-spacing: .1em; border-spacing: 18px 5px; } .panel td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.rb { display: flex; gap: 18px; justify-content: center; }
.rb span { cursor: pointer; padding: 8px 20px; border: 1px solid rgba(255,255,255,.5); background: rgba(255,255,255,.08); letter-spacing: .1em; }
#flash { inset: 0; opacity: 0; background: #fff; transition: opacity .15s; mix-blend-mode: screen; z-index: 6; }

/* 仮想キー */
#touch { position: absolute; inset: 0; display: none; pointer-events: none; z-index: 5; }
#touch.on { display: block; } #touch > * { pointer-events: auto; }
.tc-cam { position: absolute; left: 340px; right: 0; top: 80px; bottom: 90px; touch-action: none; }
.tc-stick { position: absolute; left: 50px; bottom: 90px; width: 180px; height: 180px; border-radius: 50%; background: rgba(255,255,255,.08); border: 2px solid rgba(255,255,255,.3); touch-action: none; }
.tc-knob { position: absolute; left: 50px; top: 50px; width: 76px; height: 76px; border-radius: 50%; background: rgba(255,255,255,.3); border: 2px solid rgba(255,255,255,.6); pointer-events: none; }
.tc-btn { position: absolute; width: 104px; height: 104px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 19px; letter-spacing: .06em;
  background: rgba(0,0,0,.4); border: 2px solid rgba(255,255,255,.55); color: #fff; touch-action: none; }
.tc-btn.mid { width: 90px; height: 90px; } .tc-btn.small { width: 72px; height: 72px; font-size: 13px; }
.tc-btn.active { background: rgba(255,255,255,.35); }
/* タッチ時は罠バーを左右のボタンに被らないよう縮めて寄せる */
#stage.touch #traps { left: 262px; transform: none; gap: 3px; } #stage.touch .slot { width: 66px; height: 58px; } #stage.touch .slot span { font-size: 10px; }
#stage.touch #tdesc, #stage.touch #hint { padding: 0 330px 0 260px; }
#stage.touch #seq { bottom: 280px; }

/* 縦持ちのスマホには横向きを促す */
#rotate { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.85); color: #eee; align-items: center; justify-content: center;
  text-align: center; font-size: 18px; letter-spacing: .2em; z-index: 10; pointer-events: none; }
@media (orientation: portrait) and (pointer: coarse) { #rotate { display: flex; } }

#title, #demo { transition: opacity .3s; } .m-title.cine #title, .m-title.cine #demo, .m-title.cine .top-c { opacity: .08; }

#fade { inset: 0; background: #000; opacity: 0; z-index: 8; pointer-events: none; }
.slot.card { width: 188px; height: 70px; flex-direction: column; }
.slot.card .mn { position: absolute; left: 30px; top: 4px; font-style: normal; font-size: 11px; opacity: .85; }
.slot.card b { font-size: 26px; } .slot.card span { font-size: 13px; }
#tdesc small { opacity: .7; }
#stage.touch .slot.card { width: 150px; height: 60px; }

#fade { inset: 0; background: #000; opacity: 0; z-index: 8; pointer-events: none; }
.slot.card { width: 188px; height: 70px; flex-direction: column; }
.slot.card .mn { position: absolute; left: 30px; top: 4px; font-style: normal; font-size: 11px; opacity: .85; }
.slot.card b { font-size: 26px; } .slot.card span { font-size: 13px; }
#tdesc small { opacity: .7; }
#stage.touch .slot.card { width: 150px; height: 60px; }
