/* ============================================================
   CROSS GEAR FIVE ギア合体パズル
   スマホの縦画面が基準。PCでは中央に縦長の画面を出す
   ============================================================ */
@property --g { syntax: '<number>'; inherits: true; initial-value: 0; }

:root {
  --bg: #0b0d1f;
  --panel: #161a38;
  --line: rgba(255, 255, 255, 0.13);
  --text: #f4f6ff;
  --muted: #a9b0d6;
  --gold: #ffd34a;
  --font: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', 'Hiragino Sans', 'Meiryo', sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #05060f;
  color: var(--text);
  font-family: var(--font);
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  overscroll-behavior: none;
}
button { font-family: inherit; }
img { -webkit-user-drag: none; user-select: none; }

#app {
  position: relative;
  width: 100%; max-width: 480px;
  height: var(--vh, 100vh);
  margin: 0 auto;
  overflow: hidden;
  background: radial-gradient(120% 60% at 50% 0%, #1b2150 0%, var(--bg) 60%);
}
@media (min-width: 520px) {
  #app { box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 0 60px rgba(60, 80, 200, 0.25); }
}
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.hidden { display: none !important; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-block;
  min-width: 200px;
  padding: 12px 26px;
  border: none; border-radius: 14px;
  background: linear-gradient(#ff6a4d, #df2a1a);
  box-shadow: 0 4px 0 #86130a, 0 8px 18px rgba(0, 0, 0, 0.4);
  color: #fff;
  font-size: 18px; font-weight: 800;
  text-align: center; text-decoration: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 #86130a; }
.btn-big { min-width: 240px; padding: 16px 40px; font-size: 26px; animation: pulse 1.6s ease-in-out infinite; }
.btn-sub { background: linear-gradient(#3d4686, #272d60); box-shadow: 0 4px 0 #131733, 0 8px 18px rgba(0, 0, 0, 0.35); }
.btn-sub:active { box-shadow: 0 1px 0 #131733; }
.btn-yt { background: linear-gradient(#ff4040, #c4161c); box-shadow: 0 4px 0 #6d0a0e, 0 8px 18px rgba(0, 0, 0, 0.35); }
.btn-small { min-width: 0; padding: 9px 16px; font-size: 15px; }

.btn-icon {
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 11px;
  background: rgba(12, 14, 34, 0.75);
  color: #fff; font-size: 17px; line-height: 1;
  cursor: pointer; position: relative;
}
.btn-icon:active { transform: scale(0.94); }
.btn-icon.off { opacity: 0.5; }
#btn-bgm.off::after {
  content: ''; position: absolute; left: 7px; right: 7px; top: 50%;
  height: 2px; background: #ff6a6a; transform: rotate(-40deg);
}
.sound-btns {
  position: absolute; z-index: 50;
  top: calc(3px + env(safe-area-inset-top)); right: 6px;
  display: flex; gap: 5px;
}

/* ---------- タイトル ---------- */
.title-bg {
  position: absolute; inset: 0;
  background: url(../img/bg/city.webp) center / cover;
  filter: brightness(0.6) saturate(1.1);
}
.title-bg::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, rgba(11, 13, 31, 0.3) 0%, transparent 35%, rgba(11, 13, 31, 0.55) 62%, var(--bg) 92%);
}
.title-heroes { position: absolute; left: 0; right: 0; top: 27%; height: 42%; }
.th {
  position: absolute; bottom: 4%; left: var(--x); translate: -50% 0;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)) brightness(0.92);
  animation: rise 0.7s ease-out backwards;
}
.th-purple { --x: 14%; height: 60%; animation-delay: 0.32s; }
.th-green  { --x: 28%; height: 72%; animation-delay: 0.16s; z-index: 1; }
.th-blue   { --x: 73%; height: 74%; animation-delay: 0.2s; z-index: 1; }
.th-yellow { --x: 87%; height: 64%; animation-delay: 0.28s; }
.th-red    { --x: 50%; bottom: 0; height: 94%; animation-delay: 0.05s; z-index: 2; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.7)); }
.logo { position: absolute; left: 0; right: 0; top: calc(8% + env(safe-area-inset-top)); text-align: center; z-index: 3; }
.logo-main {
  font-size: clamp(30px, 10.5vw, 48px); font-weight: 800; font-style: italic;
  letter-spacing: 1px; line-height: 1.05;
  background: linear-gradient(#ffffff 0%, #dfe5ff 45%, #7b87e6 52%, #ffffff 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #151a45) drop-shadow(0 0 14px rgba(120, 140, 255, 0.7));
}
.logo-sub {
  display: inline-block; margin-top: 10px; padding: 4px 18px;
  background: linear-gradient(90deg, #ff4436, #ffc81e);
  color: #2a0d00; font-size: clamp(18px, 6vw, 26px); font-weight: 800;
  border-radius: 4px; transform: skewX(-12deg);
  box-shadow: 0 4px 14px rgba(255, 100, 40, 0.5);
}
.title-buttons {
  position: absolute; left: 0; right: 0; bottom: calc(9% + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 3;
}
.title-note { position: absolute; left: 0; right: 0; bottom: calc(2.5% + env(safe-area-inset-bottom)); text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- エリア選択 ---------- */
.s-top {
  flex: none; height: 52px; margin-top: env(safe-area-inset-top);
  display: flex; align-items: center; gap: 10px;
  padding: 0 96px 0 8px;
}
.s-head { flex: 1; font-size: 20px; font-weight: 800; }
.s-total { color: var(--gold); font-weight: 800; white-space: nowrap; }
.s-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: 4px 12px calc(28px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
.area-card { flex: none; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; padding-bottom: 14px; }
.area-head {
  position: relative; height: 96px; padding: 10px 14px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background-size: cover; background-position: center 40%;
}
.area-head::before { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(11, 13, 31, 0.92), rgba(11, 13, 31, 0.1)); }
.area-head > * { position: relative; }
.area-ep { color: var(--gold); font-size: 13px; font-weight: 800; }
.area-title { font-size: 23px; font-weight: 800; text-shadow: 0 2px 4px #000; }
.area-story { margin: 10px 14px 12px; color: #d6dbf5; font-size: 14px; line-height: 1.65; }
.area-story b { display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 6px; background: #2c3470; color: #fff; font-size: 12px; }
.stage-list { display: flex; flex-direction: column; gap: 8px; padding: 0 12px; }
.stage {
  display: flex; align-items: center; gap: 10px;
  height: 60px; padding: 6px 12px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.13); border-radius: 12px;
  background: linear-gradient(90deg, #252d60, #1a1f46);
  color: #fff; text-align: left; cursor: pointer;
}
.stage:active { transform: scale(0.98); }
.stage img { width: 48px; height: 48px; object-fit: contain; object-position: center top; border-radius: 10px; background: rgba(0, 0, 0, 0.3); }
.st-text { flex: 1; min-width: 0; }
.st-no { color: var(--muted); font-size: 12px; font-weight: 800; }
.st-name { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st-stars { white-space: nowrap; font-size: 20px; }
.st-stars span { color: #3a416f; }
.st-stars span.on { color: var(--gold); text-shadow: 0 0 6px rgba(255, 211, 74, 0.7); }
.stage.boss { background: linear-gradient(90deg, #561a36, #2c1238); border-color: rgba(255, 90, 110, 0.45); }
.boss-tag { padding: 0 5px; border-radius: 4px; background: #ff3b3b; color: #fff; font-size: 11px; }
.stage.locked { opacity: 0.55; }
.stage.locked img { filter: brightness(0) drop-shadow(0 0 1px #8890c0); }
.area-card > .btn-yt { display: block; margin: 14px 12px 0; }
.area-card.locked { padding: 16px; opacity: 0.8; background: repeating-linear-gradient(-45deg, #15183a 0 14px, #12152f 14px 28px); }
.area-lockrow { display: flex; align-items: center; gap: 14px; }
.area-lockrow .lock { font-size: 28px; }
.area-date { color: var(--gold); font-size: 19px; font-weight: 800; }

/* ---------- バトル ---------- */
#scr-battle { background: var(--bg); }
.b-top {
  flex: none; height: 44px; margin-top: env(safe-area-inset-top);
  display: flex; align-items: center; gap: 8px;
  padding: 0 92px 0 6px;
}
.b-stage { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; }
.b-stage b { margin-right: 6px; color: var(--gold); font-size: 16px; }
.b-turn { text-align: right; font-size: 12px; line-height: 1.1; white-space: nowrap; }
.b-turn b { font-size: 18px; }
.b-turn small { display: block; color: var(--gold); font-size: 10px; }

.b-enemy {
  position: relative; flex: 1; min-height: 110px;
  margin: 0 6px; overflow: hidden;
  border: 1px solid var(--line); border-radius: 14px;
}
.b-bg { position: absolute; inset: 0; background-size: cover; background-position: center 62%; filter: brightness(0.82); }
.b-enemy::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 30%); }
.b-enemy.boss { border-color: rgba(255, 80, 110, 0.6); box-shadow: inset 0 0 30px rgba(255, 40, 90, 0.35); }
.b-enemy-light {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 34% 46% at 50% 68%, rgba(220, 200, 255, 0.32), rgba(160, 120, 255, 0.1) 55%, transparent 75%);
}
.b-enemy-img {
  position: absolute; left: 50%; bottom: 3%;
  height: calc(78% * var(--size, 1)); max-height: 88%;
  translate: -50% 0;
  transform-origin: 50% 100%;
  filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 10px rgba(166, 92, 255, 0.8));
  animation: breathe 2.4s ease-in-out infinite;
}
.b-enemy.raged .b-enemy-img { filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, 0.85)) drop-shadow(0 0 14px rgba(255, 40, 90, 0.95)); }
.b-enemy-img.hit { animation: hitShake 0.3s; filter: brightness(2.4) drop-shadow(0 0 12px #fff); }
.b-enemy-img.lunge { animation: lunge 0.7s ease-out; }
.b-enemy-img.defeated { animation: defeat 1s ease-in forwards; }
.b-enemy-info { position: absolute; left: 8px; right: 86px; top: 7px; z-index: 2; }
.b-enemy-name { margin-bottom: 3px; font-size: 14px; font-weight: 800; text-shadow: 0 2px 3px #000; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-enemy.boss .b-enemy-name { color: #ff9cb0; }

.bar { position: relative; height: 12px; overflow: hidden; border: 1px solid rgba(255, 255, 255, 0.28); border-radius: 8px; background: rgba(0, 0, 0, 0.6); }
.bar-fill, .bar-back { position: absolute; left: 0; top: 0; bottom: 0; width: 100%; }
.bar-back { background: #fff3b0; transition: width 0.6s 0.35s; }
.bar-enemy .bar-fill { background: linear-gradient(#ff86a8, #d41f55); transition: width 0.25s; }

.b-counter {
  position: absolute; right: 8px; top: 7px; z-index: 2;
  width: 70px; height: 70px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(#3b2b6d, #190f35);
  border: 3px solid #a65cff;
  box-shadow: 0 0 12px rgba(166, 92, 255, 0.6);
}
.b-counter span { font-size: 9px; line-height: 1.15; text-align: center; color: #e0d4ff; }
.b-counter b { font-size: 26px; line-height: 1; }
.b-counter.danger { border-color: #ff3b3b; animation: dangerPulse 0.7s ease-in-out infinite; }
.b-counter.frozen { border-color: #2f8cff; box-shadow: 0 0 22px #2f8cff; }

.union {
  position: absolute; right: 8px; bottom: 8px; z-index: 6;
  padding: 8px 16px;
  border: 3px solid #fff; border-radius: 30px;
  background: linear-gradient(90deg, #ff4436, #ffc81e, #2bc46a, #2f8cff, #a65cff);
  color: #fff; font-size: 17px; font-weight: 800; white-space: nowrap;
  transform-origin: 100% 100%;
  text-shadow: 0 2px 2px rgba(0, 0, 0, 0.7);
  cursor: pointer;
  animation: unionPulse 0.8s ease-in-out infinite alternate;
}

.fx { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.pop {
  position: absolute; top: 42%; translate: -50% 0;
  font-weight: 800; white-space: nowrap;
  text-shadow: 0 2px 0 #000, 0 0 6px #000;
  animation: popUp 1.1s ease-out forwards;
}
.pop.dmg { font-size: 26px; color: #fff; }
.pop.dmg.big { font-size: 40px; color: var(--c, var(--gold)); -webkit-text-stroke: 1px #fff; }
.pop.dmg.union { font-size: 54px; color: var(--gold); -webkit-text-stroke: 1px #fff; top: 35%; }
.pop.enemy-move {
  top: 34%; padding: 4px 12px; border-radius: 9px;
  background: rgba(70, 0, 40, 0.88); border: 1px solid #ff5a8a;
  font-size: 15px; animation: fadeInOut 1.3s ease-out forwards;
}
.pop.hurt { top: -14px; color: #ff6060; font-size: 24px; }
.pop.heal { top: -14px; color: #6dffa6; font-size: 24px; }
.pop.info { top: 62%; color: #9fd0ff; font-size: 17px; }

.b-player { position: relative; flex: none; height: 38px; display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.b-player-label { color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.bar-player { flex: 1; height: 17px; }
.bar-player .bar-fill { background: linear-gradient(#7dffb0, #1db45d); transition: width 0.3s; }
.bar-player .bar-fill.low { background: linear-gradient(#ffb57d, #e0501f); }
.bar-text { position: absolute; inset: 0; font-size: 11px; line-height: 15px; font-weight: 800; text-align: center; text-shadow: 0 1px 2px #000; }
.b-boost {
  position: absolute; right: 10px; top: -9px; z-index: 3;
  padding: 1px 9px; border-radius: 9px;
  background: #a65cff; font-size: 11px; font-weight: 800;
  box-shadow: 0 0 10px #a65cff;
}

.b-board { position: relative; flex: none; display: flex; justify-content: center; margin: 0 auto; }
#board {
  display: block; touch-action: none; cursor: pointer;
  border-radius: 12px;
  background: linear-gradient(#151b40, #0e1230);
  box-shadow: inset 0 0 0 2px rgba(150, 170, 255, 0.25), 0 6px 20px rgba(0, 0, 0, 0.5);
}
.b-msg {
  position: absolute; left: 8px; right: 8px; bottom: calc(100% + 2px); z-index: 9;
  padding: 8px; border: 2px solid #ffc81e; border-radius: 12px;
  background: rgba(40, 30, 0, 0.88);
  font-size: 15px; font-weight: 800; text-align: center;
  pointer-events: none;
}
.b-msg small { display: block; color: #ffe9a0; font-size: 11px; font-weight: 500; }
.chain {
  position: absolute; left: 50%; top: 42%; translate: -50% -50%;
  font-size: 46px; font-weight: 800; font-style: italic; white-space: nowrap;
  color: #ffe24a;
  text-shadow: 0 3px 0 #7a3b00, 0 0 14px rgba(255, 200, 40, 0.9);
  animation: chainPop 0.9s ease-out forwards;
}
.chain small { font-size: 24px; }
.chain.c3 { color: #ff9a3a; }
.chain.c4 { color: #ff4d6d; text-shadow: 0 3px 0 #6b0019, 0 0 16px rgba(255, 60, 100, 0.9); }
.chain.c5 {
  background: linear-gradient(90deg, #ff4436, #ffc81e, #2bc46a, #2f8cff, #a65cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: none; filter: drop-shadow(0 3px 0 #000) drop-shadow(0 0 10px #fff);
}

.b-heroes {
  position: relative; flex: none;
  display: flex; align-items: center; justify-content: space-around;
  padding: 4px 4px calc(10px + env(safe-area-inset-bottom));
}
.hero {
  position: relative; flex: 1; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: none; background: none; cursor: pointer;
}
.hero-ring {
  width: min(64px, 16.5vw); aspect-ratio: 1; padding: 4px;
  border-radius: 50%;
  background: conic-gradient(var(--c) calc(var(--g) * 360deg), rgba(255, 255, 255, 0.13) 0);
  transition: --g 0.35s ease-out;
}
.hero-ring img { display: block; width: 100%; height: 100%; object-fit: cover; border: 2px solid var(--bg); border-radius: 50%; background: #000; }
.hero:active .hero-ring { transform: scale(0.94); }
.hero.full .hero-ring { animation: fullGlow 0.9s ease-in-out infinite alternate; }
.hero-go {
  display: none;
  position: absolute; left: 50%; bottom: 3px; translate: -50% 0;
  padding: 0 8px; border-radius: 8px;
  background: #fff; color: var(--d, #000);
  font-size: 12px; font-weight: 800;
}
.hero.full .hero-go { display: block; animation: bounce 0.5s ease-in-out infinite alternate; }
.hero.bump .hero-ring { animation: bump 0.25s; }
.hero.full.bump .hero-ring { animation: bump 0.25s, fullGlow 0.9s 0.25s ease-in-out infinite alternate; }
.hero.picking .hero-ring { box-shadow: 0 0 0 3px #fff, 0 0 24px 8px #ffc81e; }

.b-tip {
  position: absolute; left: 10px; right: 10px; z-index: 25;
  padding: 10px 12px; border: 1px solid rgba(255, 255, 255, 0.25); border-radius: 12px;
  background: rgba(14, 16, 40, 0.95);
  font-size: 14px; line-height: 1.55;
  pointer-events: none;
  animation: panelIn 0.2s;
}
.b-tip small { color: var(--muted); }

/* 技のカットイン */
.cutin { position: absolute; inset: 0; z-index: 20; overflow: hidden; pointer-events: none; }
.cutin-band {
  position: absolute; left: -10%; right: -10%; top: 33%; height: 32%;
  background:
    repeating-linear-gradient(100deg, rgba(255, 255, 255, 0.14) 0 3px, transparent 3px 26px),
    linear-gradient(100deg, var(--d), var(--c) 50%, var(--d));
  box-shadow: 0 0 30px var(--c), 0 0 0 3px rgba(255, 255, 255, 0.6);
  transform: skewY(-8deg) scaleX(0);
}
.cutin.play .cutin-band { animation: bandIn 1.05s ease-out forwards; }
.cutin-img { position: absolute; left: 2%; top: 21%; height: 54%; max-width: 60%; object-fit: contain; filter: drop-shadow(0 0 10px #fff); opacity: 0; }
.cutin.play .cutin-img { animation: heroIn 1.05s ease-out forwards; }
.cutin-text { position: absolute; right: 5%; top: 42%; max-width: 62%; text-align: right; opacity: 0; }
.cutin.play .cutin-text { animation: textIn 1.05s ease-out forwards; }
.cutin-text small { display: block; font-size: 14px; font-weight: 800; text-shadow: 0 2px 2px #000; }
.cutin-text b { display: block; font-size: clamp(18px, 6vw, 28px); font-style: italic; line-height: 1.15; text-shadow: 0 3px 0 #000, 0 0 12px var(--c); }

/* クロスギア合体 */
.union-cut {
  position: absolute; inset: 0; z-index: 21;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(60, 60, 140, 0.9), rgba(4, 5, 16, 0.95) 70%);
  pointer-events: none;
}
.union-row { position: relative; width: 100%; height: 42%; display: flex; align-items: flex-end; justify-content: center; }
.union-row img { width: 25%; height: auto; max-height: 82%; object-fit: contain; object-position: bottom; margin: 0 -3%; opacity: 0; filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.7)); }
.union-cut.play .union-row img { animation: unionHero 0.45s ease-out forwards; animation-delay: calc(var(--i) * 0.13s); }
.union-row img:nth-child(1) { order: 2; width: 30%; max-height: 100%; z-index: 2; }
.union-row img:nth-child(2) { order: 1; }
.union-row img:nth-child(3) { order: 3; }
.union-row img:nth-child(4) { order: 0; width: 28%; }
.union-row img:nth-child(5) { order: 4; width: 29%; }
/* アニメの合体シーンの静止画（img/union.webp）があれば、5人の絵の代わりに使う */
.union-still { display: none; width: 100%; height: 46%; object-fit: cover; opacity: 0; box-shadow: 0 0 40px rgba(255, 255, 255, 0.4); }
.union-cut.has-still .union-row { display: none; }
.union-cut.has-still .union-still { display: block; }
.union-cut.play .union-still { animation: titleIn 0.6s ease-out forwards; }
.union-title {
  margin-top: 14px; opacity: 0;
  font-size: clamp(28px, 9vw, 40px); font-weight: 800; font-style: italic;
  background: linear-gradient(90deg, #ff4436, #ffc81e, #2bc46a, #2f8cff, #a65cff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #000) drop-shadow(0 0 10px #fff);
}
.union-attack { margin-top: 6px; opacity: 0; color: var(--gold); font-size: 22px; font-weight: 800; text-shadow: 0 2px 0 #000; }
.union-cut.play .union-title { animation: titleIn 0.45s 0.75s ease-out forwards; }
.union-cut.play .union-attack { animation: titleIn 0.4s 1.25s ease-out forwards; }

/* 帯の文字（STAGE / WARNING / CLEAR） */
.banner {
  position: absolute; left: 0; right: 0; top: 47%; z-index: 15;
  translate: 0 -50%;
  padding: 14px 0; text-align: center; pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(10, 12, 40, 0.92) 18%, rgba(10, 12, 40, 0.92) 82%, transparent);
}
.banner.play { animation: bannerIn 0.3s ease-out; }
.banner b { display: block; font-size: 34px; font-style: italic; text-shadow: 0 3px 0 #000; }
.banner small { display: block; margin-top: 2px; font-size: 15px; }
.banner.warn { background: repeating-linear-gradient(-45deg, rgba(200, 0, 30, 0.92) 0 18px, rgba(90, 0, 14, 0.92) 18px 36px); }
.banner.warn b { letter-spacing: 6px; animation: blink 0.4s steps(2) infinite; }
.banner.rage { background: linear-gradient(90deg, transparent, rgba(80, 0, 30, 0.95) 15%, rgba(80, 0, 30, 0.95) 85%, transparent); }
.banner.rage b.line { padding: 0 14px; font-size: 18px; font-style: normal; line-height: 1.5; }
.banner.clear b {
  font-size: 42px;
  background: linear-gradient(#fff6c4, #ffd34a 50%, #ff9a1e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 3px 0 #5a2a00);
}
.banner.lose b { color: #ff8080; }
.banner.small b { font-size: 26px; }

.flash { position: absolute; inset: 0; z-index: 30; opacity: 0; pointer-events: none; }
.flash.red { background: rgba(255, 0, 40, 0.45); animation: flash 0.45s; }
.flash.white { background: #fff; animation: flash 0.5s; }
.flash.heal { background: rgba(60, 255, 140, 0.35); animation: flash 0.7s; }
#scr-battle.shake { animation: shake 0.4s; }

.orbs { position: absolute; inset: 0; z-index: 12; pointer-events: none; }
.orb {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, var(--c) 45%, transparent 72%);
  box-shadow: 0 0 14px var(--c);
  transition: transform 0.45s cubic-bezier(0.5, 0, 0.8, 0.5), opacity 0.45s;
}

/* ---------- 重ねて出す画面（結果・ポーズ・あそびかた） ---------- */
.overlay {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(4, 5, 15, 0.8);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.panel {
  width: 100%; max-width: 380px; max-height: 100%; overflow-y: auto;
  padding: 22px 18px;
  border: 2px solid rgba(150, 170, 255, 0.35); border-radius: 20px;
  background: linear-gradient(#1e2554, #12163a);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  text-align: center;
  animation: panelIn 0.3s ease-out;
}
.r-title {
  font-size: 30px; font-weight: 800; font-style: italic;
  background: linear-gradient(#fff6c4, #ffd34a 50%, #ff9a1e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 0 #5a2a00);
}
.r-title.lose { background: none; color: #ff8a8a; filter: none; }
.r-title.small { font-size: 24px; }
.r-stars { margin: 6px 0; }
.r-stars span { display: inline-block; margin: 0 4px; color: #2c3262; font-size: 54px; line-height: 1.1; }
.r-stars span.on { color: var(--gold); text-shadow: 0 0 14px rgba(255, 211, 74, 0.8); animation: starIn 0.4s ease-out; }
.r-info { margin: 6px 0; font-size: 16px; line-height: 1.6; }
.r-info small { color: var(--muted); font-size: 13px; }
.r-info .new { padding: 1px 7px; border-radius: 6px; background: #ff3b3b; font-size: 13px; }
.r-msg { margin: 12px 0 4px; padding: 10px; border: 1px solid rgba(255, 211, 74, 0.45); border-radius: 12px; background: rgba(255, 211, 74, 0.12); font-size: 14px; line-height: 1.65; }
.r-msg b { color: var(--gold); font-size: 16px; }
.r-buttons { display: flex; flex-direction: column; align-items: stretch; gap: 11px; margin-top: 16px; }
.r-buttons .btn { min-width: 0; padding-left: 10px; padding-right: 10px; }
.r-buttons .btn-yt { font-size: 15px; }

.howto-panel { max-width: 400px; }
.h-page { display: none; }
.h-page.on { display: block; animation: panelIn 0.25s ease-out; }
.h-title { margin-bottom: 10px; color: var(--gold); font-size: 21px; font-weight: 800; }
.h-art {
  min-height: 176px; padding: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  border-radius: 14px; background: rgba(0, 0, 0, 0.3);
}
.hg { display: block; width: 46px; height: 46px; }
.h-row { display: flex; gap: 4px; }
.h-swap { position: relative; }
.h-arrow {
  position: absolute; left: 50%; top: -26px; translate: -50% 0;
  color: #fff; font-size: 28px; font-style: normal; text-shadow: 0 0 8px #000, 0 0 4px #000;
  animation: bob 0.7s ease-in-out infinite alternate;
}
.h-flow { display: flex; align-items: center; gap: 3px; }
.h-to { margin: 0 6px; font-size: 26px; }
.hero.demo { flex: none; width: 74px; height: 74px; cursor: default; }
.hero.demo .hero-ring { width: 64px; }
.h-five { display: flex; gap: 2px; }
.h-five .hero.demo { width: 54px; height: 54px; }
.h-five .hero-ring { width: 48px; padding: 3px; }
.h-specials { display: flex; align-items: center; gap: 16px; }
.h-specials > div { display: flex; flex-direction: column; align-items: center; }
.h-specials .hg { width: 54px; height: 54px; }
.h-specials small { margin-top: 4px; font-size: 11px; line-height: 1.3; }
.h-counter {
  width: 66px; height: 66px; border-radius: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(#3b2b6d, #190f35); border: 3px solid #a65cff;
}
.h-counter span { font-size: 9px; line-height: 1.15; }
.h-counter b { font-size: 24px; line-height: 1; }
.h-text { margin: 12px 2px 4px; font-size: 15px; line-height: 1.75; text-align: left; }
.h-text b { color: var(--gold); }
.howto-dots { margin-top: 8px; }
.howto-dots span { display: inline-block; width: 8px; height: 8px; margin: 0 4px; border-radius: 50%; background: #3a416f; }
.howto-dots span.on { background: var(--gold); }
.howto-nav { display: flex; gap: 10px; margin-top: 12px; }
.howto-nav .btn { flex: 1; min-width: 0; }

/* ---------- 動き ---------- */
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } }
@keyframes breathe { 0%, 100% { scale: 1 1; } 50% { scale: 1.01 1.025; } }
@keyframes hitShake { 0% { transform: translateX(0); } 25% { transform: translateX(-6px) rotate(-2deg); } 60% { transform: translateX(5px) rotate(1deg); } 100% { transform: translateX(0); } }
@keyframes lunge { 0% { transform: none; } 30% { transform: translateY(-4%) scale(0.96); } 55% { transform: translateY(6%) scale(1.18); } 100% { transform: none; } }
@keyframes defeat {
  0% { opacity: 1; filter: brightness(3) drop-shadow(0 0 20px #fff); transform: none; }
  60% { opacity: 0.8; filter: brightness(1.5) drop-shadow(0 0 30px #a65cff); transform: scale(1.04, 0.96); }
  100% { opacity: 0; filter: brightness(0.5) drop-shadow(0 0 40px #a65cff) blur(6px); transform: scale(1.2, 0.2); }
}
@keyframes popUp { 0% { opacity: 0; transform: translateY(10px) scale(0.6); } 15% { opacity: 1; transform: translateY(0) scale(1.15); } 30% { transform: scale(1); } 100% { opacity: 0; transform: translateY(-34px); } }
@keyframes fadeInOut { 0% { opacity: 0; transform: translateY(6px); } 15% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes chainPop { 0% { opacity: 0; transform: scale(0.4) rotate(-8deg); } 20% { opacity: 1; transform: scale(1.2) rotate(-4deg); } 35% { transform: scale(1) rotate(-4deg); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-30px) rotate(-4deg); } }
@keyframes dangerPulse { 0%, 100% { box-shadow: 0 0 8px rgba(255, 50, 50, 0.6); transform: scale(1); } 50% { box-shadow: 0 0 22px rgba(255, 50, 50, 1); transform: scale(1.08); } }
@keyframes fullGlow { from { box-shadow: 0 0 0 2px #fff, 0 0 8px 2px var(--c); } to { box-shadow: 0 0 0 3px #fff, 0 0 22px 7px var(--c); } }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-4px); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes unionPulse { from { box-shadow: 0 0 10px #fff, 0 0 0 0 rgba(255, 255, 255, 0.5); transform: scale(1); } to { box-shadow: 0 0 26px #fff, 0 0 0 8px rgba(255, 255, 255, 0); transform: scale(1.06); } }
@keyframes bandIn { 0% { transform: skewY(-8deg) scaleX(0); } 18% { transform: skewY(-8deg) scaleX(1); } 82% { transform: skewY(-8deg) scaleX(1); opacity: 1; } 100% { transform: skewY(-8deg) scaleX(1); opacity: 0; } }
@keyframes heroIn { 0% { opacity: 0; transform: translateX(-60%); } 22% { opacity: 1; transform: translateX(0); } 80% { opacity: 1; transform: translateX(6%); } 100% { opacity: 0; transform: translateX(30%); } }
@keyframes textIn { 0% { opacity: 0; transform: translateX(40%); } 25% { opacity: 1; transform: translateX(0); } 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes unionHero { from { opacity: 0; transform: translateY(30px) scale(0.85); } to { opacity: 1; transform: none; } }
@keyframes titleIn { from { opacity: 0; transform: scale(2); } to { opacity: 1; transform: scale(1); } }
@keyframes bannerIn { from { opacity: 0; transform: scaleY(0.2); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0.35; } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translate(-6px, 3px); } 40% { transform: translate(6px, -3px); } 60% { transform: translate(-4px, 2px); } 80% { transform: translate(3px, -1px); } }
@keyframes panelIn { from { opacity: 0; transform: translateY(14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes starIn { 0% { transform: scale(2.4) rotate(-30deg); opacity: 0; } 70% { transform: scale(0.9); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-5px); } }

/* スマホを横にしたときは、たてにするよう案内する */
#rotate {
  display: none;
  position: absolute; inset: 0; z-index: 100;
  flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: var(--bg); font-size: 20px; font-weight: 800;
}
#rotate div { font-size: 48px; animation: tilt 1.4s ease-in-out infinite; }
@keyframes tilt { 0%, 30% { transform: rotate(90deg); } 60%, 100% { transform: rotate(0deg); } }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #rotate { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .btn-big, .b-enemy-img, .hero.full .hero-go { animation: none; }
}
