* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; touch-action: none; color: #fff;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  font-family: system-ui, -apple-system, "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  background: radial-gradient(ellipse at 50% 40%, #24121a 0%, #07040a 70%);
}
#app { position: absolute; left: 50%; top: 0; transform: translateX(-50%); overflow: hidden; background: #000; box-shadow: 0 0 80px rgba(0,0,0,.9); }
#gl, #fx { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }
#fx { touch-action: none; cursor: crosshair; }
#safeProbe { position: absolute; top: 0; left: 0; width: 1px; height: env(safe-area-inset-top, 0px); pointer-events: none; visibility: hidden; }
.hidden { display: none !important; }

.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }

/* buttons */
.btn {
  font: inherit; font-size: 18px; font-weight: 800; letter-spacing: .12em; color: #fff; cursor: pointer;
  min-width: 220px; min-height: 54px; padding: 12px 28px; border-radius: 999px; border: 1px solid rgba(255,255,255,.28);
  background: rgba(255,255,255,.1); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  transition: transform .12s ease, filter .2s;
}
.btn:active { transform: scale(.94); }
.btn.big {
  font-size: 23px; min-height: 66px; min-width: 250px; border: 1px solid rgba(255,190,200,.7);
  background: linear-gradient(180deg, #ff4b63 0%, #c3122d 60%, #8e0a1f 100%);
  box-shadow: 0 8px 30px rgba(255,40,70,.45), inset 0 1px 0 rgba(255,255,255,.45);
  animation: pulse 2.2s ease-in-out infinite;
}
.btn.ghost { background: transparent; border-color: rgba(255,255,255,.18); min-height: 44px; font-size: 15px; opacity: .85; }
@keyframes pulse { 0%,100% { box-shadow: 0 8px 30px rgba(255,40,70,.45), inset 0 1px 0 rgba(255,255,255,.45); } 50% { box-shadow: 0 8px 44px rgba(255,60,90,.8), inset 0 1px 0 rgba(255,255,255,.45); } }

/* loading */
#loading { background: #07040a; gap: 18px; z-index: 30; }
.load-logo { font-size: 13px; letter-spacing: .5em; opacity: .75; font-weight: 700; }
.load-bar { width: 62%; max-width: 280px; height: 6px; border-radius: 6px; background: rgba(255,255,255,.12); overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 0%; border-radius: 6px; background: linear-gradient(90deg, #8e0a1f, #ff4b63); box-shadow: 0 0 12px #ff4b63; transition: width .2s; }
.load-txt { font-size: 13px; opacity: .7; }

/* title */
#title { justify-content: space-between; padding: calc(9vh + env(safe-area-inset-top, 0px)) 18px calc(18px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(180deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,0) 30%, rgba(0,0,0,0) 45%, rgba(0,0,0,.8) 78%, rgba(0,0,0,.92) 100%); }
.logo { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.logo-en { font-size: 12px; letter-spacing: .6em; font-weight: 800; color: #ffb3bf; text-shadow: 0 0 12px rgba(255,60,90,.8); margin-right: -.6em; }
#title h1 { margin: 0; font-size: clamp(30px, 9.4vw, 42px); font-weight: 900; letter-spacing: .04em; line-height: 1.1;
  text-shadow: 0 3px 0 #7a0a1a, 0 6px 24px rgba(0,0,0,.9), 0 0 30px rgba(255,60,90,.55); }
#title h1 span { display: inline-block; }
.logo-tag { font-size: 14px; font-weight: 700; opacity: .9; text-shadow: 0 2px 8px #000; letter-spacing: .1em; }
.title-bottom { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }
.cards { position: relative; display: flex; gap: 12px; width: 100%; margin-bottom: 0; padding: 8px 18px 10px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; scroll-padding: 0 18px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.cards::-webkit-scrollbar { display: none; }
.card { position: relative; flex: 0 0 min(38%, 150px); aspect-ratio: 3 / 3.6; scroll-snap-align: center; padding: 0; border-radius: 18px; overflow: hidden; cursor: pointer;
  border: 2px solid rgba(255,255,255,.18); background: #111; color: #fff; font: inherit; transition: transform .25s, border-color .25s, box-shadow .25s; opacity: .72; }
.card .thumb { position: absolute; inset: 0; background-size: cover; background-position: 50% 32%; transform: scale(1.05); transition: transform .6s; }
.card .card-txt { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 8px 10px; font-size: 15px; font-weight: 800; line-height: 1.35;
  background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.85)); display: flex; flex-direction: column; align-items: center; }
.card small { font-size: 10px; letter-spacing: .3em; color: #ffb3bf; }
.card .best { font-size: 13px; letter-spacing: .15em; color: #ffd257; min-height: 1.2em; text-shadow: 0 0 6px rgba(255,190,40,.6); }
.card.on { border-color: #ff5a72; box-shadow: 0 0 0 3px rgba(255,90,114,.25), 0 10px 30px rgba(255,40,70,.4); transform: translateY(-4px) scale(1.03); opacity: 1; }
.card.on .thumb { transform: scale(1.12); }
.cards-dots { display: flex; gap: 7px; margin: -4px 0 4px; }
.cards-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.3); transition: background .25s, transform .25s; }
.cards-dots i.on { background: #ff5a72; transform: scale(1.25); }
.note { font-size: 11px; opacity: .6; margin-top: 2px; letter-spacing: .08em; }

/* panels */
.panel { width: min(88%, 360px); padding: 26px 20px 20px; border-radius: 26px; display: flex; flex-direction: column; align-items: center; gap: 12px;
  background: linear-gradient(180deg, rgba(40,16,24,.82), rgba(14,8,12,.88)); border: 1px solid rgba(255,255,255,.14);
  box-shadow: 0 20px 60px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.1); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
#howto { background: rgba(0,0,0,.55); z-index: 12; }
#howto h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: .2em; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; text-align: left; width: 100%; }
.steps li { display: flex; gap: 12px; align-items: center; background: rgba(255,255,255,.06); border-radius: 16px; padding: 10px 12px; }
.steps i { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-weight: 900;
  background: linear-gradient(#ff4b63, #b3102a); box-shadow: 0 0 12px rgba(255,60,90,.5); }
.steps b { display: block; font-size: 16px; }
.steps span { display: block; font-size: 12px; opacity: .75; margin-top: 2px; line-height: 1.5; }

#result { background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,.25), rgba(0,0,0,.75)); z-index: 10; }
.res-en { font-size: 12px; letter-spacing: .6em; font-weight: 800; opacity: .7; margin-right: -.6em; }
#resHead { margin: 0; font-size: 46px; font-weight: 900; letter-spacing: .08em; }
#resHead.ok { color: #ff5a72; text-shadow: 0 0 26px rgba(255,60,90,.8), 0 3px 0 #6a0816; }
#resHead.ng { color: #b9c1d0; text-shadow: 0 3px 0 #2a2f3a; }
.stars { display: flex; gap: 10px; margin: 2px 0 4px; }
.star { width: 52px; height: 52px; background: rgba(255,255,255,.14);
  clip-path: polygon(50% 2%, 62% 36%, 98% 37%, 69% 58%, 80% 94%, 50% 73%, 20% 94%, 31% 58%, 2% 37%, 38% 36%); }
.star.on { background: linear-gradient(160deg, #fff4b0, #ffc93c 45%, #f08a00); filter: drop-shadow(0 0 10px rgba(255,200,40,.9)); }
.stars .star:nth-child(2) { width: 62px; height: 62px; margin-top: -8px; }
.res-rows { width: 100%; display: flex; flex-direction: column; gap: 6px; margin-bottom: 6px; }
.row { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 14px; border-radius: 12px; background: rgba(255,255,255,.06); font-size: 14px; }
.row b { font-size: 24px; font-weight: 900; }
.row.sub b { font-size: 16px; color: #ffd257; }
.res .btn { width: 100%; min-width: 0; }

/* in-game overlays */
#hint { position: absolute; left: 50%; bottom: calc(15% + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 5; pointer-events: none;
  padding: 12px 22px; border-radius: 999px; font-size: 18px; font-weight: 900; white-space: nowrap; letter-spacing: .06em;
  background: rgba(255,255,255,.94); color: #2a0a12; box-shadow: 0 8px 30px rgba(0,0,0,.5); }
#hint::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -9px; border: 9px solid transparent; border-top-color: rgba(255,255,255,.94); }
#hand { position: absolute; left: 0; top: 0; width: 64px; height: 64px; z-index: 4; pointer-events: none; filter: drop-shadow(0 4px 8px rgba(0,0,0,.6)); }
#hand svg { width: 100%; height: 100%; transform-origin: 40% 10%; }
#hand.tap svg { animation: tap 1.1s ease-in-out infinite; }
#hand.press svg { animation: press 1.6s ease-in-out infinite; }
@keyframes tap { 0%,100% { transform: translate(0,10px) scale(1); } 45% { transform: translate(0,0) scale(.9); } }
@keyframes press { 0% { transform: translate(0,14px); } 25%,85% { transform: translate(0,0) scale(.88); } 100% { transform: translate(0,14px); } }
#banner { position: absolute; left: 0; right: 0; top: 36%; z-index: 5; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 0; background: linear-gradient(90deg, rgba(0,0,0,0), rgba(0,0,0,.65) 25%, rgba(0,0,0,.65) 75%, rgba(0,0,0,0)); }
#banner small { font-size: 13px; letter-spacing: .5em; color: #ffb3bf; font-weight: 800; margin-right: -.5em; }
#banner b { font-size: 30px; font-weight: 900; letter-spacing: .1em; text-shadow: 0 0 20px rgba(255,60,90,.6); }
#pop { position: absolute; left: 0; right: 0; top: 40%; z-index: 6; pointer-events: none; text-align: center; font-size: 58px; font-weight: 900; letter-spacing: .06em;
  color: #fff; -webkit-text-stroke: 2px #7a0a1a; text-shadow: 0 6px 0 #7a0a1a, 0 0 30px rgba(255,60,90,.8); }
#pop.cool { -webkit-text-stroke: 2px #1c4a2a; text-shadow: 0 6px 0 #1c4a2a, 0 0 30px rgba(120,255,170,.7); }
#wipe { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 40; }
#fatal { background: #000; z-index: 50; font-size: 16px; line-height: 1.8; }
