:root {
  --pink: #ff3b7a;
  --red: #ff3b5c;
  --yellow: #ffd23f;
  --cyan: #3be3ff;
  --ink: #1b1530;
  --paper: #fffaf0;
  --chalk: #2e4a3a;
  --font: "M PLUS Rounded 1c", system-ui, sans-serif;
  --bold: "Dela Gothic One", "M PLUS Rounded 1c", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #1a1020; color: #fff; font-family: var(--font); user-select: none; -webkit-user-select: none; touch-action: none; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; border: 0; }

/* ふちどり文字 */
.stroke { paint-order: stroke fill; -webkit-text-stroke: 6px var(--ink); }

/* ---------------- ローディング ---------------- */
#loading { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #ff7aa8 0%, #6a2c8a 60%, #1a1020 100%); transition: opacity .6s; }
#loading.fade { opacity: 0; pointer-events: none; }
.ld-inner { text-align: center; width: min(80vw, 420px); }
.ld-logo { font-family: var(--bold); font-size: clamp(28px, 7vw, 54px); color: #fff; paint-order: stroke fill; -webkit-text-stroke: 8px var(--ink); transform: rotate(-4deg); margin-bottom: 28px; }
.ld-bar { height: 16px; border-radius: 99px; background: rgba(0,0,0,.35); border: 3px solid #fff; overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(-45deg, var(--yellow) 0 12px, #ffb800 12px 24px); transition: width .2s; }
.ld-txt { margin-top: 14px; font-weight: 800; letter-spacing: .1em; }
.ld-start { margin-top: 18px; font-family: var(--bold); font-size: 26px; animation: blink 1.1s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------------- 共通スクリーン ---------------- */
#screen { position: fixed; inset: 0; z-index: 20; pointer-events: none; }
#screen > * { pointer-events: auto; }
#overlay { position: fixed; inset: 0; z-index: 60; pointer-events: none; overflow: hidden; }
#overlay > * { pointer-events: auto; }

.btn {
  position: relative; display: block; width: 100%; padding: 14px 22px 12px; margin: 10px 0; text-align: left;
  font-family: var(--bold); font-size: clamp(18px, 2.4vw, 26px); color: var(--ink); letter-spacing: .03em;
  background: linear-gradient(180deg, #fff 0%, #fff6d8 100%); border-radius: 14px 30px 14px 30px;
  border: 4px solid var(--ink); box-shadow: 6px 6px 0 var(--ink); transform: skewX(-8deg);
  transition: transform .12s, box-shadow .12s, background .2s;
}
.btn small { display: block; font-family: var(--font); font-weight: 800; font-size: .55em; color: #7a5a8a; letter-spacing: .15em; }
.btn:hover, .btn:focus-visible { transform: skewX(-8deg) translate(-3px, -3px); box-shadow: 9px 9px 0 var(--ink); background: linear-gradient(180deg, #fff 0%, #ffe066 100%); outline: none; }
.btn:active { transform: skewX(-8deg) translate(3px, 3px); box-shadow: 2px 2px 0 var(--ink); }
.btn.primary { background: linear-gradient(180deg, #ff7aa8 0%, var(--pink) 100%); color: #fff; }
.btn.primary small { color: #ffe3ef; }
.btn.primary:hover { background: linear-gradient(180deg, #ff9ac0 0%, #ff5a90 100%); }
.btn:disabled { filter: grayscale(1) brightness(.8); cursor: not-allowed; }
.btn.center { text-align: center; }

.head {
  font-family: var(--bold); font-size: clamp(22px, 3.6vw, 40px); color: #fff; paint-order: stroke fill; -webkit-text-stroke: 7px var(--ink);
  text-align: center; margin: 0; padding: 18px 10px 8px; transform: rotate(-2deg); letter-spacing: .02em;
}
.back { position: absolute; left: 16px; top: 16px; z-index: 5; font-family: var(--bold); font-size: 16px; padding: 8px 16px; border-radius: 99px; background: #fff; color: var(--ink); border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); }

/* ---------------- タイトル ---------------- */
.title { position: absolute; inset: 0; overflow: hidden; }
.title .kv { position: absolute; inset: -3%; background-size: cover; background-position: center 35%; animation: kenburns 24s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.1) translate(-1.5%, 1%); } }
.title .shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(20,8,30,0) 40%, rgba(20,8,30,.55) 75%, rgba(20,8,30,.75) 100%), linear-gradient(0deg, rgba(20,8,30,.5), transparent 30%); }
.logo { position: absolute; left: 3vw; top: 3vh; width: min(62vw, 760px); transform: rotate(-5deg); transform-origin: left top; filter: drop-shadow(0 8px 0 rgba(0,0,0,.35)); }
.logo .l1 { display: inline-block; font-family: var(--bold); font-size: clamp(22px, 4.2vw, 54px); color: var(--yellow); paint-order: stroke fill; -webkit-text-stroke: 8px var(--ink); background: var(--red); padding: 4px 18px 10px; border: 5px solid var(--ink); border-radius: 12px; transform: skewX(-10deg); }
.logo .l1 span { display: inline-block; animation: hop 1.6s infinite; }
.logo .l2 { display: block; white-space: nowrap; font-family: var(--bold); font-size: clamp(38px, 7.4vw, 100px); line-height: 1.05; margin-top: 6px;
  background: linear-gradient(180deg, #fff 0%, #e3f3ff 45%, #9ad0ff 50%, #fff 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 3px var(--ink); filter: drop-shadow(5px 5px 0 var(--ink)) drop-shadow(-2px -2px 0 var(--ink)) drop-shadow(0 0 18px rgba(255,210,63,.6)); }
.logo .l3 { display: inline-block; font-weight: 900; font-size: clamp(13px, 1.7vw, 20px); color: #fff; background: var(--ink); padding: 6px 14px; border-radius: 6px; margin-top: 8px; letter-spacing: .05em; }
@keyframes hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-8px); } }
.title .menu { position: absolute; right: 4vw; bottom: 6vh; width: min(38vw, 400px); }
.title .catch { position: absolute; left: 4vw; bottom: 5vh; max-width: 48vw; font-weight: 900; font-size: clamp(13px, 1.6vw, 20px); line-height: 1.7; text-shadow: 0 2px 6px #000, 0 0 2px #000; }
.title .ver { position: absolute; right: 10px; bottom: 6px; font-size: 11px; opacity: .6; }
.sparkle { position: absolute; width: 18px; height: 18px; pointer-events: none; background: radial-gradient(circle, #fff 0 20%, transparent 60%); clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%); animation: twinkle 2s infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(0) rotate(0); opacity: 0; } 50% { transform: scale(1) rotate(90deg); opacity: 1; } }

/* ---------------- キャラ選択 ---------------- */
.select { position: absolute; inset: 0; background: radial-gradient(ellipse at 30% 50%, #ffcfe0 0%, #ff8ab5 35%, #6a2c8a 100%); overflow: hidden; }
.select::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(-30deg, rgba(255,255,255,.07) 0 30px, transparent 30px 60px); animation: slide 6s linear infinite; }
@keyframes slide { to { background-position: 120px 0; } }
.select .big { position: absolute; left: 0; bottom: 0; height: 96vh; max-width: 55vw; object-fit: contain; object-position: left bottom; filter: drop-shadow(10px 10px 0 rgba(27,21,48,.35)); animation: pop-in .35s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop-in { from { transform: translateX(-60px) scale(.96); opacity: 0; } }
.select .panel { position: absolute; right: 2.5vw; top: 84px; bottom: 16px; width: min(46vw, 560px); display: flex; flex-direction: column; gap: 10px; }
.select .roster { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { width: 84px; height: 84px; border-radius: 16px; border: 4px solid var(--ink); background-color: #fff; background-repeat: no-repeat; box-shadow: 4px 4px 0 var(--ink); position: relative; transition: transform .12s; }
.chip:hover { transform: translateY(-3px) rotate(-3deg); }
.chip.on { outline: 4px solid var(--yellow); outline-offset: 2px; transform: scale(1.06) rotate(-3deg); }
.chip.locked { background-image: none !important; background: #3a2a4a; }
.chip.locked::after { content: "?"; position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--bold); font-size: 38px; color: #fff; }
.info { background: var(--paper); color: var(--ink); border: 4px solid var(--ink); border-radius: 18px; padding: 14px 18px; box-shadow: 6px 6px 0 var(--ink); position: relative; }
.info .nm { font-family: var(--bold); font-size: clamp(22px, 2.6vw, 32px); }
.info .kana { font-size: 12px; font-weight: 800; color: #8a6a9a; }
.info .grade { display: inline-block; font-size: 12px; font-weight: 900; color: #fff; background: var(--ink); border-radius: 6px; padding: 2px 8px; margin-left: 6px; vertical-align: middle; }
.info .prof { font-weight: 700; font-size: 14px; line-height: 1.55; margin: 6px 0 8px; }
.info .rul { font-family: var(--bold); font-size: 17px; }
.info .rul small { font-family: var(--font); font-weight: 700; font-size: 12px; display: block; color: #5a4a6a; }
.stats { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; margin: 8px 0; font-weight: 900; font-size: 13px; align-items: center; }
.stats .meter { display: flex; gap: 3px; }
.stats .meter i { width: 24px; height: 12px; border-radius: 3px; background: #e6dcef; border: 2px solid var(--ink); transform: skewX(-15deg); }
.stats .meter i.on { background: var(--c, var(--pink)); }
.sp { background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 12px; font-size: 13px; font-weight: 700; }
.sp b { font-family: var(--bold); font-weight: 400; color: var(--yellow); font-size: 16px; display: block; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opt { padding: 8px 14px; border-radius: 99px; border: 3px solid var(--ink); background: #fff; color: var(--ink); font-weight: 900; font-size: 14px; box-shadow: 3px 3px 0 var(--ink); }
.opt.on { background: var(--yellow); }

.stagegrid { position: absolute; inset: 80px 3vw 110px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(280px, 44vw), 1fr)); gap: 16px; overflow: auto; padding: 6px; }
.stagecard { position: relative; height: clamp(130px, 15vw, 240px); border-radius: 16px; border: 4px solid var(--ink); background-size: cover; background-position: center; box-shadow: 6px 6px 0 var(--ink); overflow: hidden; transition: transform .15s; }
.stagecard:hover { transform: translateY(-4px) rotate(-1deg); }
.stagecard.on { outline: 5px solid var(--yellow); outline-offset: 3px; }
.stagecard span { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 12px; background: linear-gradient(0deg, rgba(0,0,0,.8), transparent); font-weight: 900; font-size: 15px; text-align: left; color: #fff; }
.bottombar { position: absolute; left: 0; right: 0; bottom: 14px; display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 0 16px; }
.bottombar .btn { width: auto; min-width: 260px; text-align: center; }

/* ---------------- 会話(ノベル) ---------------- */
.novel { position: absolute; inset: 0; background-size: cover; background-position: center; }
.novel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, rgba(10,5,20,.55), transparent 50%); pointer-events: none; }
.novel .st { position: absolute; bottom: 0; height: 92vh; max-width: 48vw; object-fit: contain; object-position: bottom; transition: filter .25s, transform .25s; z-index: 1; filter: drop-shadow(0 0 12px rgba(0,0,0,.35)); }
.novel .st.l { left: 3vw; }
.novel .st.r { right: 3vw; }
.novel .st.dim { filter: brightness(.55) saturate(.7); transform: translateY(12px) scale(.97); }
.novel .st.talk { animation: talk .25s; }
@keyframes talk { 40% { transform: translateY(-14px); } }
.novel .box { position: absolute; left: 50%; bottom: 3vh; transform: translateX(-50%); width: min(94vw, 1000px); min-height: 150px; z-index: 3;
  background: rgba(255,250,240,.96); color: var(--ink); border: 5px solid var(--ink); border-radius: 22px; padding: 30px 28px 18px; box-shadow: 0 10px 0 rgba(27,21,48,.6); }
.novel .box .nm { position: absolute; left: 22px; top: -24px; font-family: var(--bold); font-size: 22px; color: #fff; padding: 4px 22px 6px; border-radius: 12px; border: 4px solid var(--ink); background: var(--c, var(--pink)); transform: skewX(-8deg); }
.novel .box .tx { font-weight: 800; font-size: clamp(16px, 2vw, 22px); line-height: 1.65; min-height: 3.2em; }
.novel .box .nx { position: absolute; right: 18px; bottom: 10px; animation: hop 1s infinite; font-size: 20px; }
.novel .chap { position: absolute; left: 0; right: 0; top: 34vh; z-index: 4; text-align: center; font-family: var(--bold); font-size: clamp(22px, 4vw, 44px); paint-order: stroke fill; -webkit-text-stroke: 8px var(--ink); animation: chap 2.4s forwards; pointer-events: none; }
.novel .chap::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 120%; transform: translateY(-50%) skewY(-3deg); background: linear-gradient(90deg, transparent, rgba(255,59,122,.9) 15%, rgba(255,59,122,.9) 85%, transparent); z-index: -1; }
@keyframes chap { 0% { opacity: 0; transform: scale(1.4); } 12% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.novel .skip { position: absolute; left: auto; right: 16px; top: 16px; z-index: 5; }
.narr { font-style: normal; color: #4a3a6a; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
#hud button { pointer-events: auto; }
#cards { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; justify-content: space-between; gap: 8px; }
.card { display: flex; align-items: center; gap: 8px; background: rgba(255,250,240,.95); color: var(--ink); border: 4px solid var(--ink); border-radius: 16px; padding: 6px 12px 6px 6px; box-shadow: 4px 4px 0 rgba(27,21,48,.7); min-width: 0; transition: transform .2s; }
.card.active { transform: scale(1.05); box-shadow: 0 0 0 4px var(--yellow), 4px 4px 0 rgba(27,21,48,.7); }
.card.out { filter: grayscale(1) brightness(.7); }
.card .face { width: 58px; height: 58px; border-radius: 12px; border: 3px solid var(--c); background-color: #fff; flex: none; }
.card .mid { min-width: 0; }
.card .nm { font-family: var(--bold); font-size: 17px; white-space: nowrap; }
.card .gauge { position: relative; width: clamp(90px, 16vw, 200px); height: 14px; border-radius: 99px; background: #e6dcef; border: 3px solid var(--ink); overflow: hidden; margin-top: 3px; }
.card .gauge i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--c), var(--yellow)); transition: width .4s; }
.card .gauge.full i { background: repeating-linear-gradient(90deg, #ff3b5c, #ffd23f, #3be3ff, #ff3b5c 60px); background-size: 120px 100%; animation: rainbow 1s linear infinite; }
@keyframes rainbow { to { background-position: 120px 0; } }
.card .glabel { font-size: 10px; font-weight: 900; color: #7a5a8a; letter-spacing: .05em; }
.card .wins { font-family: "Yusei Magic", sans-serif; font-size: 22px; color: #fff; background: var(--chalk); border: 3px solid #6b4a2a; border-radius: 6px; padding: 0 8px; min-width: 40px; text-align: center; margin-left: 4px; }
#cards.many .card .gauge { width: 70px; }
#cards.many .card .face { width: 44px; height: 44px; }
#cards.many .card .nm { font-size: 13px; }
#cards.many .card .wins { display: none; }

#labels .lb { position: absolute; transform: translate(-50%, -100%); display: flex; align-items: center; gap: 4px; padding: 2px 8px 2px 2px; border-radius: 99px; background: var(--c); border: 3px solid var(--ink); color: #fff; font-weight: 900; font-size: 12px; white-space: nowrap; transition: opacity .2s; }
#labels .lb .f { width: 26px; height: 26px; border-radius: 50%; background-color: #fff; border: 2px solid #fff; }
#labels .lb.active { font-size: 14px; animation: bob 1s infinite; }
#labels .lb.active::after { content: "▼"; position: absolute; left: 50%; bottom: -18px; transform: translateX(-50%); color: var(--yellow); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; font-size: 16px; }
@keyframes bob { 50% { margin-top: -6px; } }

#turnbar { position: absolute; left: 50%; bottom: 52px; transform: translateX(-50%); font-family: var(--bold); font-size: clamp(14px, 2vw, 22px); padding: 6px 22px; border-radius: 99px; background: var(--ink); color: #fff; border: 3px solid #fff; white-space: nowrap; opacity: 0; transition: opacity .3s; }
#turnbar.show { opacity: 1; }
#turnbar.cpu { background: #5a1a2a; }

#hint { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); font-weight: 800; font-size: 13px; padding: 6px 16px; background: rgba(0,0,0,.55); border-radius: 99px; white-space: nowrap; opacity: 0; transition: opacity .4s; }
#hint.show { opacity: 1; }

#power { position: absolute; left: 50%; bottom: 60px; transform: translateX(-50%); text-align: center; }
#power .bar { width: min(60vw, 360px); height: 22px; border-radius: 99px; border: 4px solid var(--ink); background: rgba(255,255,255,.85); overflow: hidden; }
#power .bar i { display: block; height: 100%; background: linear-gradient(90deg, #4dff8a, #ffd23f 55%, #ff3b5c); }
#power b { display: block; font-family: var(--bold); font-size: 30px; paint-order: stroke fill; -webkit-text-stroke: 6px var(--ink); margin-top: 2px; }
#power span { display: block; font-weight: 900; font-size: 15px; paint-order: stroke fill; -webkit-text-stroke: 4px var(--ink); }
#power.max b, #power.max span { animation: shake .1s infinite; color: var(--yellow); }
@keyframes shake { 25% { transform: translate(2px, -1px); } 75% { transform: translate(-2px, 1px); } }

#say { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: flex-end; gap: 0; max-width: min(92vw, 640px); animation: sayin .25s cubic-bezier(.2,1.5,.4,1); }
@keyframes sayin { from { transform: translateY(30px) scale(.9); opacity: 0; } }
#say .face { width: 92px; height: 92px; border-radius: 18px; border: 4px solid var(--ink); background-color: #fff; flex: none; box-shadow: 4px 4px 0 var(--ink); z-index: 1; }
#say .bubble { background: #fff; color: var(--ink); border: 4px solid var(--ink); border-radius: 18px; padding: 8px 16px 10px; margin-left: -6px; margin-bottom: 10px; box-shadow: 4px 4px 0 var(--ink); }
#say .nm { font-family: var(--bold); font-size: 13px; color: var(--c); }
#say .tx { font-weight: 800; font-size: clamp(14px, 1.8vw, 18px); line-height: 1.5; }
#say.special .bubble { background: var(--ink); color: var(--yellow); font-size: 1.1em; }

#specialBtn { position: absolute; right: 16px; bottom: 16px; width: 128px; height: 128px; border-radius: 50%; border: 5px solid var(--ink); color: #fff; font-family: var(--bold);
  background: conic-gradient(from 0deg, #ff3b5c, #ffd23f, #3be3ff, #b06bff, #ff3b5c); box-shadow: 0 0 0 4px #fff, 0 0 30px 8px rgba(255,210,63,.8); animation: spin-glow 2s linear infinite; display: grid; place-items: center; align-content: center; line-height: 1.1; }
#specialBtn .l1 { font-size: 34px; paint-order: stroke fill; -webkit-text-stroke: 6px var(--ink); }
#specialBtn .l2 { font-size: 11px; font-family: var(--font); font-weight: 900; paint-order: stroke fill; -webkit-text-stroke: 4px var(--ink); }
#specialBtn.armed { animation: spin-glow .5s linear infinite, shake .1s infinite; box-shadow: 0 0 0 4px var(--red), 0 0 50px 16px rgba(255,59,92,.9); }
@keyframes spin-glow { to { filter: hue-rotate(360deg); } }

#pauseBtn { position: absolute; right: 14px; top: 92px; width: 44px; height: 44px; border-radius: 12px; background: #fff; color: var(--ink); border: 3px solid var(--ink); font-weight: 900; font-size: 18px; box-shadow: 3px 3px 0 var(--ink); }

#wind { position: absolute; left: 14px; top: 96px; display: flex; align-items: center; gap: 6px; font-weight: 900; background: rgba(0,0,0,.5); border-radius: 99px; padding: 4px 12px; }
#wind .arrow { font-size: 22px; color: var(--cyan); transition: transform .3s; }

#combo { position: absolute; right: 6vw; top: 34vh; font-family: var(--bold); font-size: clamp(36px, 6vw, 72px); color: var(--yellow); paint-order: stroke fill; -webkit-text-stroke: 8px var(--ink); transform: rotate(-8deg); }
#combo.bump { animation: bump .25s; }
@keyframes bump { 0% { transform: rotate(-8deg) scale(1.6); } 100% { transform: rotate(-8deg) scale(1); } }

/* 擬音・ポップ文字 */
#fx { position: absolute; inset: 0; overflow: hidden; }
.pop { position: absolute; transform: translate(-50%, -50%); font-family: var(--bold); white-space: nowrap; paint-order: stroke fill; color: var(--c, #fff); pointer-events: none; animation: popfx 1.1s cubic-bezier(.2,1.6,.4,1) forwards; }
.pop.small { font-size: clamp(16px, 2.2vw, 24px); -webkit-text-stroke: 5px var(--ink); }
.pop.mid { font-size: clamp(30px, 4.4vw, 54px); -webkit-text-stroke: 7px var(--ink); }
.pop.big { font-size: clamp(44px, 7vw, 92px); -webkit-text-stroke: 10px var(--ink); animation-duration: 1.5s; }
@keyframes popfx {
  0% { transform: translate(-50%, -50%) scale(.2) rotate(-20deg); opacity: 0; }
  18% { transform: translate(-50%, -60%) scale(1.15) rotate(var(--r, -6deg)); opacity: 1; }
  30% { transform: translate(-50%, -60%) scale(1) rotate(var(--r, -6deg)); }
  80% { opacity: 1; }
  100% { transform: translate(-50%, -95%) scale(1) rotate(var(--r, -6deg)); opacity: 0; }
}

/* バナー */
.banner { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; font-family: var(--bold); font-size: clamp(40px, 8vw, 110px); paint-order: stroke fill; -webkit-text-stroke: 12px var(--ink); color: #fff; pointer-events: none; animation: banner 1.1s forwards; }
.banner.go { color: var(--yellow); }
.banner::before { content: ""; position: absolute; left: -5%; right: -5%; top: 50%; height: 70%; transform: translateY(-50%) skewY(-4deg); background: repeating-linear-gradient(90deg, rgba(255,59,122,.92) 0 40px, rgba(255,90,140,.92) 40px 80px); z-index: -1; border-top: 6px solid var(--ink); border-bottom: 6px solid var(--ink); }
@keyframes banner { 0% { opacity: 0; transform: translateY(-50%) scaleY(0); } 15% { opacity: 1; transform: translateY(-50%) scaleY(1); } 80% { opacity: 1; transform: translateY(-50%) translateX(0); } 100% { opacity: 0; transform: translateY(-50%) translateX(-30%); } }

/* 必殺技カットイン */
.cutin { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cutin .band { position: absolute; left: -10%; right: -10%; top: 50%; height: 52vh; transform: translateY(-50%) skewY(-8deg); background: var(--c); border-top: 10px solid #fff; border-bottom: 10px solid #fff; box-shadow: 0 0 0 8px var(--ink); animation: band 1.9s forwards; overflow: hidden; }
.cutin .band::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, rgba(255,255,255,.25) 0 6px, transparent 6px 60px); animation: lines .25s linear infinite; }
@keyframes lines { to { background-position: -120px 0; } }
@keyframes band { 0% { transform: translateY(-50%) skewY(-8deg) scaleY(0); } 10% { transform: translateY(-50%) skewY(-8deg) scaleY(1); } 85% { transform: translateY(-50%) skewY(-8deg) scaleY(1); opacity: 1; } 100% { transform: translateY(-50%) skewY(-8deg) scaleY(0); opacity: 0; } }
.cutin img { position: absolute; right: 2vw; top: 50%; height: 78vh; transform: translateY(-50%); -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 90%, transparent 100%), linear-gradient(0deg, transparent 0, #000 16%, #000 92%, transparent 100%); -webkit-mask-composite: source-in; mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 90%, transparent 100%), linear-gradient(0deg, transparent 0, #000 16%, #000 92%, transparent 100%); mask-composite: intersect; animation: cutimg 1.9s cubic-bezier(.2,1,.3,1) forwards; filter: drop-shadow(10px 10px 0 rgba(27,21,48,.6)); }
@keyframes cutimg { 0% { transform: translate(60vw, -50%); } 15% { transform: translate(0, -50%); } 80% { transform: translate(-4vw, -50%); opacity: 1; } 100% { transform: translate(-80vw, -50%); opacity: 0; } }
.cutin .spname { position: absolute; left: 4vw; top: 56%; max-width: 60vw; font-family: var(--bold); font-size: clamp(28px, 5vw, 70px); line-height: 1.1; color: #fff; paint-order: stroke fill; -webkit-text-stroke: 10px var(--ink); transform: rotate(-8deg); animation: spname 1.9s forwards; }
.cutin .spname small { display: block; font-size: .42em; color: var(--yellow); }
@keyframes spname { 0%, 12% { opacity: 0; transform: rotate(-8deg) translateX(-40vw); } 25% { opacity: 1; transform: rotate(-8deg) translateX(0); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* 警告 */
.alert { position: absolute; left: 0; right: 0; top: 40%; text-align: center; padding: 18px 10px; background: repeating-linear-gradient(-45deg, #ffd23f 0 30px, var(--ink) 30px 60px); animation: alert 2.4s forwards; }
.alert div { display: inline-block; background: var(--red); color: #fff; font-family: var(--bold); font-size: clamp(18px, 3vw, 34px); padding: 10px 24px; border: 5px solid var(--ink); }
@keyframes alert { 0%, 100% { opacity: 0; } 8%, 92% { opacity: 1; } 20%, 40%, 60% { filter: brightness(1.5); } 30%, 50% { filter: brightness(1); } }

/* VS 演出 */
.vs { position: absolute; inset: 0; background: rgba(10,5,20,.75); animation: fadeout 2.8s forwards; overflow: hidden; }
.vs img { position: absolute; bottom: -4vh; height: 100vh; max-width: 55vw; object-fit: contain; }
.vs img.l { left: 0; animation: vsl 2.8s cubic-bezier(.2,1,.3,1) forwards; object-position: left bottom; }
.vs img.r { right: 0; animation: vsr 2.8s cubic-bezier(.2,1,.3,1) forwards; object-position: right bottom; }
.vs .mark { position: absolute; white-space: nowrap; left: 50%; top: 45%; transform: translate(-50%, -50%) rotate(-8deg); font-family: var(--bold); font-size: clamp(80px, 16vw, 220px); color: var(--yellow); paint-order: stroke fill; -webkit-text-stroke: 14px var(--ink); animation: vsmark 2.8s forwards; }
.vs .nm { position: absolute; bottom: 8vh; font-family: var(--bold); font-size: clamp(22px, 3.5vw, 44px); paint-order: stroke fill; -webkit-text-stroke: 8px var(--ink); }
.vs .nm.l { left: 4vw; } .vs .nm.r { right: 4vw; text-align: right; }
.vs .nm small { display: block; font-size: .45em; color: var(--yellow); }
.vs .royale { position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-end; }
.vs .royale img { position: relative; height: 80vh; margin: 0 -4vw; animation: vsl 2.8s cubic-bezier(.2,1,.3,1) forwards; }
@keyframes vsl { 0% { transform: translateX(-60vw); } 20% { transform: translateX(0); } 85% { transform: translateX(2vw); opacity: 1; } 100% { transform: translateX(2vw); opacity: 0; } }
@keyframes vsr { 0% { transform: translateX(60vw); } 20% { transform: translateX(0); } 85% { transform: translateX(-2vw); opacity: 1; } 100% { transform: translateX(-2vw); opacity: 0; } }
@keyframes vsmark { 0%, 15% { transform: translate(-50%, -50%) rotate(-8deg) scale(4); opacity: 0; } 25% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; } }
@keyframes fadeout { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }

/* リザルト */
.result { position: absolute; inset: 0; background: radial-gradient(circle at 30% 60%, rgba(255,210,63,.35), rgba(10,5,20,.85) 70%); animation: fadein .4s; overflow: hidden; }
.result.lose { background: radial-gradient(circle at 30% 60%, rgba(80,120,255,.3), rgba(10,5,20,.9) 70%); }
@keyframes fadein { from { opacity: 0; } }
.result .ch { position: absolute; left: 2vw; bottom: 0; height: 94vh; max-width: 50vw; object-fit: contain; object-position: left bottom; animation: pop-in .5s cubic-bezier(.2,1.6,.4,1); }
.result .rt { position: absolute; right: 3vw; top: 8vh; width: min(52vw, 640px); text-align: center; }
.result .main { font-family: var(--bold); font-size: clamp(30px, 5vw, 66px); color: var(--yellow); paint-order: stroke fill; -webkit-text-stroke: 10px var(--ink); transform: rotate(-4deg); animation: pop-in .5s .2s both cubic-bezier(.2,1.6,.4,1); }
.result.lose .main { color: #9ab8ff; }
.result .sub { font-weight: 900; font-size: clamp(14px, 1.8vw, 19px); margin: 14px 0; text-shadow: 0 2px 4px #000; }
.result .quote { background: #fff; color: var(--ink); border: 4px solid var(--ink); border-radius: 18px; padding: 12px 16px; font-weight: 800; font-size: clamp(14px, 1.8vw, 18px); box-shadow: 5px 5px 0 var(--ink); text-align: left; margin-bottom: 14px; }
.result .quote b { font-family: var(--bold); font-weight: 400; color: var(--c); display: block; font-size: 13px; }
.result .board { display: inline-flex; gap: 18px; background: var(--chalk); border: 8px solid #7a5230; border-radius: 6px; padding: 8px 22px; font-family: "Yusei Magic", sans-serif; font-size: 22px; margin-bottom: 10px; box-shadow: inset 0 0 30px rgba(0,0,0,.4); }
.result .btn { text-align: center; }

/* ポーズ・設定 */
.modal { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10,5,20,.7); animation: fadein .2s; }
.modal .win { width: min(92vw, 460px); background: var(--paper); color: var(--ink); border: 5px solid var(--ink); border-radius: 22px; padding: 22px; box-shadow: 8px 8px 0 var(--ink); }
.modal h2 { font-family: var(--bold); font-weight: 400; margin: 0 0 12px; text-align: center; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0; font-weight: 900; }
.row input[type=range] { width: 55%; accent-color: var(--pink); }

/* 章選択 */
.chapters { position: absolute; inset: 84px 4vw 20px; display: grid; gap: 12px; overflow: auto; align-content: start; max-width: 860px; margin: 0 auto; }
.chapter { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 10px; border-radius: 18px; border: 4px solid var(--ink); background: var(--paper); color: var(--ink); box-shadow: 5px 5px 0 var(--ink); text-align: left; transition: transform .12s; }
.chapter:hover:not(:disabled) { transform: translate(-2px, -2px); }
.chapter:disabled { filter: grayscale(1) brightness(.7); }
.chapter .th { width: 120px; height: 72px; border-radius: 10px; background-size: cover; background-position: center; border: 3px solid var(--ink); flex: none; }
.chapter .tt { font-family: var(--bold); font-size: clamp(14px, 2vw, 20px); }
.chapter .ds { font-weight: 800; font-size: 13px; color: #6a5a7a; }
.chapter .clr { margin-left: auto; font-family: var(--bold); color: var(--red); font-size: 18px; transform: rotate(-12deg); border: 3px solid var(--red); border-radius: 8px; padding: 2px 8px; }

/* ---------------- スマホ ---------------- */
@media (max-width: 760px), (max-aspect-ratio: 1/1) {
  .title .menu { left: 16px; right: 16px; width: auto; bottom: 3vh; }
  .title .catch, .title .ver { display: none; }
  .select .head { padding-top: 62px; font-size: 22px; }
  .select .panel { top: 110px; }
  .stagegrid { top: 110px; grid-template-columns: 1fr; }
  .stagecard { height: 120px; }
  .card .glabel { display: none; }
  #hint { font-size: 11px; }
  .logo { width: 92vw; }
  .btn { padding: 10px 16px 9px; margin: 7px 0; }
  .select .big { height: 52vh; max-width: 70vw; opacity: .55; }
  .select .panel { left: 16px; right: 16px; width: auto; top: 70px; }
  .chip { width: 60px; height: 60px; }
  .novel .st { height: 62vh; max-width: 60vw; bottom: 22vh; }
  .card .gauge { width: 70px; }
  .card .face { width: 42px; height: 42px; }
  .card .nm { font-size: 13px; }
  #say .face { width: 60px; height: 60px; }
  #specialBtn { width: 96px; height: 96px; bottom: 120px; }
  #specialBtn .l1 { font-size: 26px; }
  .result .ch { opacity: .45; max-width: 90vw; }
  .result .rt { left: 16px; right: 16px; width: auto; }
  .cutin img { height: 50vh; }
  #pauseBtn { top: 78px; }
}

/* ---------------- ぼうけん(RPG) ---------------- */
.rpg { position: absolute; inset: 0; background: #14121c; --dot: "DotGothic16", "M PLUS Rounded 1c", monospace; font-family: var(--dot); }
.rpg-cv { position: absolute; inset: 0; image-rendering: pixelated; }
.rpg-top { position: absolute; left: 10px; top: 10px; right: 90px; display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; pointer-events: none; }
.rpg-place, .rpg-stat { background: rgba(16, 20, 48, .82); border: 3px solid #fff; box-shadow: 0 0 0 3px #2a3470; border-radius: 8px; padding: 4px 12px; font-size: clamp(13px, 1.8vw, 18px); }
.rpg-place { opacity: 0; }
.rpg-place.show { animation: placein 3.2s forwards; }
@keyframes placein { 0% { opacity: 0; transform: translateY(-10px); } 10%, 75% { opacity: 1; transform: none; } 100% { opacity: .0; } }
.rpg-stat b { color: var(--yellow); margin-right: 6px; }
.rpg-stat .bell { margin-left: 12px; color: #ffe9a0; }
.rpg-menubtn { position: absolute; right: 10px; top: 10px; font-family: var(--dot); font-size: 16px; padding: 8px 14px; color: #fff; background: #2a3470; border: 3px solid #fff; border-radius: 8px; box-shadow: 0 3px 0 #10153a; cursor: pointer; }
.rpg-msg { position: absolute; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(920px, calc(100% - 24px)); min-height: 108px; box-sizing: border-box;
  display: flex; gap: 14px; align-items: flex-start; padding: 14px 18px 18px; background: linear-gradient(#f8fbff, #e4ecff); color: #1a1f40; border: 4px solid #1a1f40; border-radius: 12px;
  box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--c, #3a4a8a), 0 10px 24px rgba(0,0,0,.4); font-size: clamp(16px, 2.3vw, 22px); line-height: 1.6; z-index: 5; }
.rpg-msg .face { flex: 0 0 auto; width: 76px; height: 76px; border-radius: 10px; background-size: cover; background-position: center; border: 3px solid var(--c, #3a4a8a); }
.rpg-msg .body { flex: 1; min-width: 0; }
.rpg-msg .nm { display: inline-block; font-size: .8em; color: #fff; background: var(--c, #3a4a8a); padding: 0 10px; border-radius: 6px; margin-bottom: 4px; }
.rpg-msg .tx { white-space: pre-wrap; }
.rpg-msg .nx { position: absolute; right: 16px; bottom: 6px; color: var(--c, #3a4a8a); animation: blink .8s infinite; }
.rpg-msg.typing .nx { visibility: hidden; }
.rpg-choice { position: absolute; right: max(16px, 4vw); bottom: 150px; min-width: 200px; max-width: calc(100% - 32px); max-height: 52vh; overflow: auto; background: #f8fbff; color: #1a1f40; border: 4px solid #1a1f40; border-radius: 10px; box-shadow: 0 0 0 4px #fff, 0 0 0 7px #3a4a8a; padding: 8px 6px; z-index: 6; font-size: clamp(15px, 2vw, 20px); }
.rpg-choice .copt { padding: 6px 14px 6px 28px; position: relative; cursor: pointer; border-radius: 6px; }
.rpg-choice .copt.on { background: #dfe8ff; }
.rpg-choice .copt.on::before { content: '▶'; position: absolute; left: 8px; color: var(--red); }
.rpg-panel { position: absolute; left: max(16px, 3vw); top: 64px; width: min(560px, calc(100% - 32px)); max-height: calc(100% - 250px); overflow: auto; box-sizing: border-box; padding: 14px 18px; background: rgba(16, 20, 48, .94); color: #fff; border: 4px solid #fff; border-radius: 12px; box-shadow: 0 0 0 4px #2a3470, 0 12px 30px rgba(0,0,0,.5); z-index: 4; font-size: clamp(14px, 1.9vw, 18px); }
.rpg-panel .menu-head { font-size: 1.3em; color: var(--yellow); margin-bottom: 8px; display: flex; justify-content: space-between; }
.rpg-panel .bell { color: #ffe9a0; font-size: .8em; }
.st-head { display: flex; gap: 12px; align-items: center; }
.st-head .face { width: 64px; height: 64px; border-radius: 10px; background-size: cover; border: 3px solid var(--red); }
.st-head .nm { font-size: 1.2em; } .st-head .nm small { color: var(--yellow); margin-left: 6px; }
.st-head .ttl { color: #9fd8ff; } .st-head .ex { font-size: .85em; opacity: .85; }
.st-grid { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 4px 14px; margin: 12px 0; }
.st-grid b { color: var(--yellow); }
.st-ruler { margin: 8px 0; line-height: 1.5; }
.st-sub { font-size: .8em; opacity: .8; margin-top: 4px; }
.rpg-panel .hint { margin-top: 10px; font-size: .8em; opacity: .7; text-align: right; }
.rcard { height: 46px; margin: 8px 0; border-radius: 4px; background: var(--bg); box-shadow: inset 0 0 0 2px rgba(255,255,255,.5), 0 3px 0 rgba(0,0,0,.35); overflow: hidden; }
.rcard img { width: 100%; height: 100%; object-fit: fill; display: block; }
.rname { font-size: 1.15em; } .rname small { opacity: .75; font-size: .75em; }
.rstats { display: grid; grid-template-columns: auto 1fr auto 1fr; gap: 2px 10px; margin: 6px 0; font-size: .9em; }
.rstats i { font-style: normal; color: var(--yellow); letter-spacing: 1px; }
.slots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.slot { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border: 2px dashed rgba(255,255,255,.5); border-radius: 8px; font-size: .9em; }
.slot img, .rpg-panel .li img { width: 30px; height: 30px; object-fit: contain; vertical-align: middle; }
.rpg-panel .list .li { padding: 6px 4px; border-bottom: 1px solid rgba(255,255,255,.15); }
.rpg-panel .list .li small { display: block; opacity: .75; font-size: .8em; }
.rpg-panel .price { color: #ffe9a0; float: right; }
.rpg-panel .desc { margin-top: 8px; opacity: .9; }
.rpg-pad { position: absolute; inset: auto 0 0 0; height: 0; pointer-events: none; z-index: 3; }
.rpg-pad button { pointer-events: auto; font-family: var(--dot); color: #fff; background: rgba(20, 24, 60, .55); border: 2px solid rgba(255,255,255,.6); touch-action: none; }
.rpg-pad button.on { background: rgba(255, 59, 92, .7); }
.rpg-pad .dpad { position: absolute; left: 18px; bottom: 140px; width: 150px; height: 150px; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.rpg-pad .dpad button { border-radius: 10px; font-size: 18px; }
.rpg-pad .dpad [data-k=up] { grid-area: 1 / 2; } .rpg-pad .dpad [data-k=left] { grid-area: 2 / 1; } .rpg-pad .dpad [data-k=right] { grid-area: 2 / 3; } .rpg-pad .dpad [data-k=down] { grid-area: 3 / 2; }
.rpg-pad .ab { position: absolute; right: 18px; bottom: 150px; width: 150px; height: 110px; }
.rpg-pad .ab button { position: absolute; width: 64px; height: 64px; border-radius: 50%; font-size: 22px; }
.rpg-pad .ab .a { right: 0; top: 0; background: rgba(255, 59, 122, .6); } .rpg-pad .ab .b { left: 0; bottom: 0; }
@media (hover: hover) and (pointer: fine) { .rpg-pad { display: none; } }
.rpg-fade { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 8; }
.rpg-fade.on { opacity: 1; }
.rpg-trans { position: absolute; inset: 0; z-index: 9; pointer-events: none; display: grid; grid-template-rows: repeat(6, 1fr); animation: transflash .9s steps(1); }
.rpg-trans i { background: #10101a; transform: scaleX(0); animation: transbar .55s cubic-bezier(.7,0,.3,1) forwards; }
.rpg-trans i:nth-child(odd) { transform-origin: left; } .rpg-trans i:nth-child(even) { transform-origin: right; }
.rpg-trans i:nth-child(2) { animation-delay: .05s; } .rpg-trans i:nth-child(3) { animation-delay: .1s; } .rpg-trans i:nth-child(4) { animation-delay: .15s; } .rpg-trans i:nth-child(5) { animation-delay: .2s; } .rpg-trans i:nth-child(6) { animation-delay: .25s; }
.rpg-trans.boss i { background: #3a0010; }
@keyframes transbar { to { transform: scaleX(1); } }
@keyframes transflash { 0% { background: rgba(255,255,255,.9); } 8% { background: transparent; } 16% { background: rgba(255,255,255,.8); } 24% { background: transparent; } }
@media (max-width: 700px) {
  .rpg-msg { min-height: 92px; padding: 10px 12px 14px; }
  .rpg-msg .face { width: 56px; height: 56px; }
  .rpg-panel { top: 56px; max-height: calc(100% - 330px); }
  .rpg-choice { bottom: 300px; }
  .rpg-pad .dpad { bottom: 120px; width: 132px; height: 132px; } .rpg-pad .ab { bottom: 128px; }
}
.rcard.shaped { height: 130px; background: none; box-shadow: none; display: flex; justify-content: center; }
.rcard.shaped img { width: auto; max-width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 3px 0 rgba(0,0,0,.35)); }
.rpg-panel .desc.note { color: #9fd8ff; font-size: .85em; }
