/* meta.css — メタ画面オーバーレイ（子供向け・スマホ縦持ち・60fps配慮）。
   既存 style.css は変更最小。試合HUD #overlay は z-index:5。メタは z-index:50。 */

:root {
  --m-bg1: #1b2a4a;
  --m-bg2: #0e1830;
  --m-accent: #ffd23f;
  --m-accent2: #ff7a3c;
  --m-coin: #ffd23f;
  --m-gem: #51d0ff;
  --m-card-bg: #233456;
  --m-card-bg2: #2c4068;
  --m-text: #ffffff;
  --m-sub: #b9c6e3;
  --rar-N: #9aa6bd;
  --rar-R: #5bc66a;
  --rar-SR: #f0a93a;
  --rar-UR: #ff5a7a;
}

/* ===== ルート ===== */
#meta-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  font-family: "Hiragino Maru Gothic ProN", "Rounded Mplus 1c", system-ui, sans-serif;
  color: var(--m-text);
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
/* 試合表示中はメタを退避（操作・表示オフ） */
#meta-overlay.match-mode {
  opacity: 0;
  pointer-events: none;
}

/* ===== 通貨バー（共通・常時表示） ===== */
.meta-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 14px;
  background: linear-gradient(180deg, rgba(8, 16, 36, 0.92), rgba(8, 16, 36, 0));
  z-index: 60;
  pointer-events: none;
}
.meta-topbar .m-coin,
.meta-topbar .m-gem {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 16px;
  background: rgba(0, 0, 0, 0.32);
  border-radius: 16px;
  padding: 3px 12px 3px 8px;
}
.meta-topbar .m-coin { color: var(--m-coin); }
.meta-topbar .m-gem { color: var(--m-gem); }
.m-cur-ico { font-size: 15px; }

/* match-mode では通貨バーも隠す */
#meta-overlay.match-mode .meta-topbar { display: none; }

/* ===== 画面共通 ===== */
.meta-screen {
  position: absolute;
  inset: 0;
  padding: 50px 14px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: radial-gradient(120% 80% at 50% 0%, var(--m-bg1), var(--m-bg2));
  box-sizing: border-box;
}
.meta-screen.hidden { display: none; }
.meta-screen.slide-in {
  animation: m-slidein 0.26s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes m-slidein {
  from { transform: translateX(8%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.m-screen-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.m-back-btn {
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  padding: 7px 12px;
  border-radius: 14px;
  cursor: pointer;
}
.m-back-btn:active { transform: scale(0.94); }
.m-screen-title {
  margin: 0;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 1px;
}

/* ===== タイトル ===== */
.m-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: 10px 0;
}
.m-logo {
  font-size: 32px;
  font-weight: 900;
  color: var(--m-accent);
  text-shadow: 0 3px 0 var(--m-accent2), 0 6px 14px rgba(0, 0, 0, 0.4);
  letter-spacing: 1px;
}
.m-logo-sub {
  font-size: 16px;
  color: var(--m-sub);
  margin: 4px 0 26px;
  font-weight: 700;
}
.m-menu {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 360px;
}
.m-menu-btn {
  border: none;
  border-radius: 20px;
  padding: 18px 8px;
  font-size: 17px;
  font-weight: 900;
  color: #1a1130;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
  transition: transform 0.08s;
}
.m-menu-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.25); }
.m-menu-ico { font-size: 30px; }
.m-menu-btn.play { background: linear-gradient(160deg, #ffe16b, #ffab2e); grid-column: 1 / -1; }
.m-menu-btn.gacha { background: linear-gradient(160deg, #ff9ad6, #ff5fa2); }
.m-menu-btn.deck { background: linear-gradient(160deg, #93e0ff, #43b0ff); }
.m-menu-btn.training { background: linear-gradient(160deg, #b6f59a, #5bce5b); }
.m-menu-btn.skillset { background: linear-gradient(160deg, #d6b8ff, #a06bff); }
.m-menu-btn.ranking { background: linear-gradient(160deg, #ffd98a, #ffb13a); }

/* ===== カードタイル（共通） ===== */
.m-card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}
.m-card-grid.small { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.m-card {
  background: linear-gradient(165deg, var(--m-card-bg2), var(--m-card-bg));
  border-radius: 12px;
  padding: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 11px;
  min-height: 78px;
  transition: transform 0.08s;
}
.m-card:active { transform: scale(0.96); }
.m-card.selected { border-color: var(--m-accent); box-shadow: 0 0 0 2px var(--m-accent) inset; }
.m-card.empty { opacity: 0.3; }
.m-card-top { display: flex; justify-content: space-between; font-size: 9px; font-weight: 900; }
.m-rar { padding: 0 4px; border-radius: 5px; background: rgba(0, 0, 0, 0.35); }
.m-pos { color: var(--m-sub); }
.m-card.rar-N .m-rar { color: var(--rar-N); }
.m-card.rar-R .m-rar { color: var(--rar-R); }
.m-card.rar-SR .m-rar { color: var(--rar-SR); }
.m-card.rar-UR .m-rar { color: var(--rar-UR); }
.m-card.rar-SR { box-shadow: 0 0 8px rgba(240, 169, 58, 0.35); }
.m-card.rar-UR { box-shadow: 0 0 10px rgba(255, 90, 122, 0.45); }
.m-card-name { font-weight: 800; font-size: 11px; margin: 3px 0 1px; line-height: 1.1; }
.m-card-lb { color: var(--m-accent); font-size: 10px; letter-spacing: -1px; }
.m-card-lb b { color: #ff8; }
.m-card-stats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; font-size: 9px; }
.m-card-stats .st { color: var(--m-sub); }
.m-card-stats .power { color: #ffb38a; }
.m-card-stats .shoot { color: #ff8a8a; }
.m-card-stats .save { color: #8ad6ff; }
.m-card-skills { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.m-skill-badge {
  font-size: 8px; padding: 0 3px; border-radius: 4px; background: rgba(255, 255, 255, 0.18);
}
.m-skill-badge.red { background: rgba(255, 90, 90, 0.4); }
.m-skill-badge.blue { background: rgba(80, 180, 255, 0.4); }
.m-skill-badge.green { background: rgba(90, 200, 90, 0.4); }

/* ===== 共通ボタン ===== */
.m-big-btn {
  border: none;
  border-radius: 16px;
  padding: 14px;
  font-size: 17px;
  font-weight: 900;
  color: #1a1130;
  background: linear-gradient(160deg, #ffe16b, #ffab2e);
  cursor: pointer;
  width: 100%;
  margin-top: 12px;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.25);
}
.m-big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.m-big-btn:disabled { filter: grayscale(0.7) brightness(0.7); cursor: default; box-shadow: none; }
.m-big-btn small { font-size: 12px; font-weight: 700; }

.m-empty { color: var(--m-sub); text-align: center; padding: 20px 8px; font-size: 13px; }

/* ===== デッキ ===== */
.m-deck-slots { margin-bottom: 6px; }
.m-deck-slots-label { font-size: 13px; font-weight: 800; color: var(--m-sub); margin-bottom: 6px; }
.m-slot-row { display: flex; gap: 6px; }
.m-slot {
  flex: 1;
  min-height: 46px;
  border-radius: 10px;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; text-align: center; padding: 2px;
  background: rgba(0, 0, 0, 0.2);
}
.m-slot.filled { border-style: solid; border-color: var(--m-accent); background: rgba(255, 210, 63, 0.12); cursor: pointer; }
.m-slot.gk.filled { border-color: var(--m-gem); background: rgba(81, 208, 255, 0.12); }
.m-slot-num { color: var(--m-sub); }

/* ===== スキルセット ===== */
.m-skill-panel { margin-top: 12px; background: rgba(0, 0, 0, 0.22); border-radius: 14px; padding: 12px; }
.m-skill-panel-title { font-weight: 800; font-size: 14px; margin-bottom: 8px; }
.m-skill-list { display: flex; flex-direction: column; gap: 8px; }
.m-skill-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas: "rar name btn" "rar desc btn";
  align-items: center;
  gap: 2px 8px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  padding: 8px 10px;
  border-left: 4px solid var(--m-sub);
}
.m-skill-row.rar-R { border-left-color: var(--rar-R); }
.m-skill-row.rar-SR { border-left-color: var(--rar-SR); }
.m-skill-row.rar-UR { border-left-color: var(--rar-UR); }
.m-skill-row.on { background: rgba(255, 210, 63, 0.16); }
.m-skill-rar { grid-area: rar; font-weight: 900; font-size: 12px; }
.m-skill-name { grid-area: name; font-weight: 800; font-size: 13px; }
.m-skill-name.red { color: #ff9a9a; }
.m-skill-name.blue { color: #9ad6ff; }
.m-skill-name.green { color: #9ae09a; }
.m-skill-desc { grid-area: desc; font-size: 10px; color: var(--m-sub); }
.m-skill-eff { display: none; }
.m-skill-toggle { grid-area: btn; border: none; border-radius: 10px; padding: 8px 12px; font-weight: 800; font-size: 12px; cursor: pointer; }
.m-skill-toggle.add { background: var(--m-accent); color: #2a1a00; }
.m-skill-toggle.remove { background: rgba(255, 255, 255, 0.25); color: #fff; }

/* ===== ランキング ===== */
.m-rank-my {
  background: linear-gradient(160deg, #ffe16b, #ffab2e);
  color: #2a1a00; font-weight: 800; font-size: 15px;
  border-radius: 14px; padding: 12px; text-align: center; margin-bottom: 12px;
}
.m-rank-my b { font-size: 20px; }
.m-rank-list { display: flex; flex-direction: column; gap: 5px; }
.m-rank-row {
  display: grid; grid-template-columns: 38px 1fr auto; align-items: center;
  background: rgba(255, 255, 255, 0.07); border-radius: 10px; padding: 9px 12px; font-weight: 700;
}
.m-rank-row.me { background: rgba(255, 210, 63, 0.22); outline: 2px solid var(--m-accent); }
.m-rank-no { font-weight: 900; color: var(--m-accent); }
.m-rank-name { font-size: 14px; }
.m-rank-score { font-weight: 900; color: var(--m-sub); }

/* ===== ガチャ ===== */
.m-gacha-rates {
  background: rgba(0, 0, 0, 0.28); border-radius: 14px; padding: 10px 14px; margin-bottom: 12px;
}
.m-rates-title { font-weight: 800; font-size: 13px; margin-bottom: 4px; }
.m-rates-row { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; padding: 1px 0; }
.m-rates-note { font-size: 11px; color: var(--m-accent); margin-top: 6px; font-weight: 700; }
.m-gacha-stage { min-height: 150px; display: flex; align-items: center; justify-content: center; }
.m-gacha-results { display: grid; grid-template-columns: 1fr; gap: 8px; width: 100%; }
.m-gacha-results.ten { grid-template-columns: repeat(2, 1fr); }
.m-gacha-card {
  background: linear-gradient(165deg, var(--m-card-bg2), var(--m-card-bg));
  border-radius: 12px; padding: 10px; text-align: center; border: 2px solid var(--m-sub);
}
.m-gacha-card.rar-N { border-color: var(--rar-N); }
.m-gacha-card.rar-R { border-color: var(--rar-R); }
.m-gacha-card.rar-SR { border-color: var(--rar-SR); box-shadow: 0 0 10px rgba(240, 169, 58, 0.45); }
.m-gacha-card.rar-UR { border-color: var(--rar-UR); box-shadow: 0 0 14px rgba(255, 90, 122, 0.6); }
.m-gacha-card.flip { animation: m-flip 0.4s ease-out both; }
@keyframes m-flip {
  from { transform: rotateY(90deg) scale(0.8); opacity: 0; }
  to { transform: rotateY(0) scale(1); opacity: 1; }
}
.m-gacha-card-rar { font-weight: 900; font-size: 14px; }
.m-gacha-card-name { font-weight: 800; font-size: 13px; margin: 4px 0; }
.m-tag { font-size: 10px; font-weight: 900; padding: 2px 6px; border-radius: 6px; }
.m-tag.new { background: var(--rar-UR); }
.m-tag.lb { background: var(--m-accent); color: #2a1a00; }
.m-tag.over { background: var(--rar-R); }
.m-gacha-btns { display: flex; gap: 10px; }
.m-gacha-btns .m-big-btn { margin-top: 14px; }
.gacha-10 { background: linear-gradient(160deg, #ff9ad6, #ff5fa2); color: #fff; }

/* ===== 育成 ===== */
.m-train-panel { margin-top: 12px; background: rgba(0, 0, 0, 0.22); border-radius: 14px; padding: 12px; }
.m-train-panel-title { font-weight: 800; font-size: 14px; margin-bottom: 8px; }
.m-train-info { font-size: 13px; line-height: 1.7; }
.m-train-info b { color: var(--m-accent); }
.m-train-progress { margin-top: 4px; }
.m-train-bar { height: 18px; background: rgba(0, 0, 0, 0.4); border-radius: 9px; overflow: hidden; }
.m-train-bar i {
  display: block; height: 100%; width: 100%;
  transform-origin: left center; transform: scaleX(0);
  background: linear-gradient(90deg, #5bce5b, #b6f59a);
  transition: transform 0.2s linear;
}
.m-train-status { font-size: 13px; font-weight: 700; margin-top: 6px; text-align: center; }

.m-clubhouse { margin-top: 14px; background: rgba(0, 0, 0, 0.26); border-radius: 14px; padding: 12px; }
.m-clubhouse-title { font-weight: 800; font-size: 13px; }
.m-clubhouse-reduce { font-size: 12px; color: var(--m-accent); margin: 4px 0 8px; font-weight: 700; }
.m-fac-row {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px;
  padding: 7px 0; border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.m-fac-name { font-weight: 800; font-size: 13px; }
.m-fac-lv { font-size: 12px; color: var(--m-sub); font-weight: 700; }
.m-fac-btn {
  border: none; border-radius: 10px; padding: 7px 10px; font-weight: 800; font-size: 12px;
  background: var(--m-accent); color: #2a1a00; cursor: pointer;
}
.m-fac-btn:disabled { filter: grayscale(0.6) brightness(0.7); }

/* ===== トースト ===== */
.m-toast {
  position: absolute;
  left: 50%;
  bottom: 70px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.86);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 20px;
  opacity: 0;
  pointer-events: none;
  z-index: 70;
  max-width: 90%;
  text-align: center;
}
.m-toast.show { animation: m-toast 1.8s ease-out forwards; }
@keyframes m-toast {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0); }
  80% { opacity: 1; transform: translateX(-50%) translateY(0); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ============================================================================
   演出（FX）レイヤー — transform/opacity 中心・60fps・子供向け。
   ガチャ開封 / 限界突破 / 育成完了 / 設備UP。射幸性を煽らない短い演出。
   ============================================================================ */

/* ---- ガチャ：パック開封 ---- */
.m-fx-gacha {
  position: relative;
  width: 100%;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 16px;
}
.m-fx-pack {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
  cursor: pointer;
  animation: m-fx-pack-idle 1.2s ease-in-out infinite;
}
@keyframes m-fx-pack-idle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-6px) scale(1.03); }
}
.m-fx-pack-glow {
  position: absolute;
  inset: -30px;
  background: radial-gradient(circle, var(--fx-glow, rgba(255,255,255,0.5)), transparent 70%);
  opacity: 0.6;
  animation: m-fx-glow-pulse 1.2s ease-in-out infinite;
}
@keyframes m-fx-glow-pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.95); }
  50% { opacity: 0.8; transform: scale(1.08); }
}
.m-fx-pack-box { font-size: 70px; line-height: 1; filter: drop-shadow(0 6px 10px rgba(0,0,0,0.4)); }
.m-fx-pack-hint { font-size: 12px; font-weight: 800; color: #fff; opacity: 0.85; }
.m-fx-pack.open { animation: m-fx-pack-open 0.4s ease-out forwards; }
@keyframes m-fx-pack-open {
  0% { transform: scale(1) rotate(0); }
  40% { transform: scale(1.25) rotate(-6deg); }
  100% { transform: scale(0) rotate(8deg); opacity: 0; }
}

/* レア度バースト（開封時の光のはじけ） */
.m-fx-burst {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, var(--fx-glow, rgba(255,255,255,0.7)), transparent 60%);
  opacity: 0;
  transform: scale(0.4);
  animation: m-fx-burst 0.7s ease-out forwards;
}
@keyframes m-fx-burst {
  0% { opacity: 0; transform: scale(0.4); }
  35% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.4); }
}

/* SR/UR カットイン（光の帯＋ことば） */
.m-fx-cutin {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}
.m-fx-cutin-band {
  position: absolute;
  left: -20%;
  right: -20%;
  height: 90px;
  background: linear-gradient(90deg, transparent, var(--fx-rar, #fff), transparent);
  opacity: 0.85;
  transform: skewY(-8deg) scaleX(0);
  transform-origin: left center;
  animation: m-fx-band 0.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes m-fx-band {
  0% { transform: skewY(-8deg) scaleX(0); opacity: 0; }
  40% { transform: skewY(-8deg) scaleX(1); opacity: 0.9; }
  100% { transform: skewY(-8deg) scaleX(1); opacity: 0; }
}
.m-fx-cutin-word {
  position: relative;
  font-size: 30px;
  font-weight: 900;
  color: #fff;
  -webkit-text-stroke: 2px var(--fx-rar, #ff5a7a);
  text-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transform: scale(0.4);
  opacity: 0;
  animation: m-fx-word 1.2s cubic-bezier(0.22, 1.4, 0.36, 1) forwards;
  animation-delay: 0.2s;
  white-space: nowrap;
}
@keyframes m-fx-word {
  0% { transform: scale(0.4); opacity: 0; }
  25% { transform: scale(1.15); opacity: 1; }
  70% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.04); opacity: 0; }
}
.m-fx-cutin.rar-UR .m-fx-cutin-word { font-size: 34px; }

/* UR 特別演出：星屑が舞う */
.m-fx-ur-stars { position: absolute; inset: 0; pointer-events: none; }
.m-fx-ur-star {
  position: absolute;
  top: 50%;
  font-size: 18px;
  color: #ffe16b;
  opacity: 0;
  text-shadow: 0 0 8px #ffd23f;
  animation: m-fx-star 1.3s ease-out forwards;
  animation-delay: calc(var(--i) * 60ms);
}
@keyframes m-fx-star {
  0% { transform: translateY(20px) scale(0.2); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(-70px) scale(1); opacity: 0; }
}

/* 結果カードの最高レアにポップ */
.m-gacha-card.m-fx-pop { animation: m-fx-pop 0.6s ease-out; }
@keyframes m-fx-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

/* ---- 限界突破演出（★増加 / パラメータUP） ---- */
.m-fx-lb, .m-fx-train {
  position: absolute;
  inset: 0;
  z-index: 75;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: rgba(8, 14, 30, 0.55);
}
.m-fx-lb.out, .m-fx-train.out { animation: m-fx-fade 0.3s ease-out forwards; }
@keyframes m-fx-fade { to { opacity: 0; } }

.m-fx-lb-card {
  background: linear-gradient(165deg, #2c4068, #1b2a4a);
  border: 2px solid var(--m-accent);
  border-radius: 18px;
  padding: 20px 26px;
  text-align: center;
  box-shadow: 0 0 24px rgba(255, 210, 63, 0.5);
  transform: scale(0.6);
  opacity: 0;
  animation: m-fx-card-in 1.5s cubic-bezier(0.22, 1.3, 0.36, 1) forwards;
}
.m-fx-lb-card.over { border-color: var(--rar-R); box-shadow: 0 0 24px rgba(91, 198, 106, 0.5); }
@keyframes m-fx-card-in {
  0% { transform: scale(0.6); opacity: 0; }
  18% { transform: scale(1.06); opacity: 1; }
  35% { transform: scale(1); opacity: 1; }
  85% { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.02); opacity: 1; }
}
.m-fx-lb-title { font-size: 20px; font-weight: 900; color: var(--m-accent); }
.m-fx-lb-card.over .m-fx-lb-title { color: var(--rar-R); }
.m-fx-lb-name { font-size: 14px; font-weight: 800; margin: 4px 0 10px; }
.m-fx-lb-stars { font-size: 30px; letter-spacing: 2px; }
.m-fx-lb-star { display: inline-block; color: rgba(255,255,255,0.3); }
.m-fx-lb-star.lit { color: var(--m-accent); text-shadow: 0 0 10px rgba(255,210,63,0.8); }
.m-fx-lb-star.pop { animation: m-fx-star-pop 0.8s cubic-bezier(0.22, 1.5, 0.36, 1) 0.25s both; }
@keyframes m-fx-star-pop {
  0% { transform: scale(0) rotate(-60deg); }
  60% { transform: scale(1.5) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}
.m-fx-lb-plus { color: #ff8; font-size: 26px; margin-left: 6px; }
.m-fx-lb-up { font-size: 13px; font-weight: 800; color: #fff; margin-top: 10px; opacity: 0.9; }

/* ---- 育成完了演出（スキル取得 / レベルアップ） ---- */
.m-fx-train-card {
  position: relative;
  background: linear-gradient(165deg, #2c4068, #1b2a4a);
  border: 2px solid var(--fx-rar, var(--m-sub));
  border-radius: 18px;
  padding: 22px 28px;
  text-align: center;
  box-shadow: 0 0 24px var(--fx-glow, rgba(120,140,180,0.4));
  transform: scale(0.6);
  opacity: 0;
  overflow: hidden;
  animation: m-fx-card-in 1.7s cubic-bezier(0.22, 1.3, 0.36, 1) forwards;
}
.m-fx-train-burst {
  position: absolute;
  inset: -40%;
  background: conic-gradient(from 0deg, transparent, var(--fx-glow, rgba(255,255,255,0.3)), transparent, var(--fx-glow, rgba(255,255,255,0.3)), transparent);
  opacity: 0.5;
  animation: m-fx-spin 2.2s linear infinite;
}
@keyframes m-fx-spin { to { transform: rotate(360deg); } }
.m-fx-train-label { position: relative; font-size: 18px; font-weight: 900; color: #fff; }
.m-fx-train-rar { position: relative; font-size: 22px; font-weight: 900; color: var(--fx-rar, #fff); margin-top: 4px; text-shadow: 0 0 10px var(--fx-glow); }
.m-fx-train-skill { position: relative; font-size: 18px; font-weight: 900; margin-top: 4px; }
.m-fx-train-skill.red { color: #ff9a9a; }
.m-fx-train-skill.blue { color: #9ad6ff; }
.m-fx-train-skill.green { color: #9ae09a; }
.m-fx-train-skill.gray { color: #fff; }
.m-fx-train-lv { position: relative; font-size: 13px; font-weight: 800; color: var(--m-sub); margin-top: 8px; }
.m-fx-train-lv.big { font-size: 32px; color: var(--m-accent); margin-top: 6px; }

/* ---- 設備アップグレード フィードバック ---- */
.m-fx-fac { animation: m-fx-fac-flash 0.5s ease-out; }
@keyframes m-fx-fac-flash {
  0% { background: transparent; }
  30% { background: rgba(255, 210, 63, 0.3); }
  100% { background: transparent; }
}
.m-fac-row { position: relative; }
.m-fx-fac-pop {
  position: absolute;
  right: 8px;
  top: 50%;
  font-size: 13px;
  font-weight: 900;
  color: var(--m-accent);
  text-shadow: 0 1px 4px rgba(0,0,0,0.6);
  pointer-events: none;
  transform: translateY(-50%);
  animation: m-fx-fac-pop 1s ease-out forwards;
}
@keyframes m-fx-fac-pop {
  0% { transform: translateY(-50%) scale(0.6); opacity: 0; }
  25% { transform: translateY(-120%) scale(1.1); opacity: 1; }
  100% { transform: translateY(-220%) scale(1); opacity: 0; }
}

/* 動きを減らす設定の尊重（アクセシビリティ） */
@media (prefers-reduced-motion: reduce) {
  .m-fx-pack, .m-fx-pack-glow, .m-fx-train-burst { animation: none; }
  .m-fx-cutin-band, .m-fx-ur-star { animation-duration: 0.3s; }
}

/* ===== 小さい端末（320x568）対応 ===== */
@media (max-width: 360px) {
  .m-logo { font-size: 27px; }
  .m-menu-btn { font-size: 15px; padding: 14px 6px; }
  .m-menu-ico { font-size: 26px; }
  .m-card-grid { gap: 6px; }
  .m-card { font-size: 10px; min-height: 72px; }
  .m-screen-title { font-size: 18px; }
  .m-fx-pack-box { font-size: 56px; }
  .m-fx-cutin-word { font-size: 24px; }
  .m-fx-cutin.rar-UR .m-fx-cutin-word { font-size: 27px; }
}

/* ============================================================================
   Phase3-3: 試合終了2ボタン行／試合履歴／リプレイビューア（子供向け・スマホ縦持ち）
   ============================================================================ */
.m-match-end-row {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  gap: 10px;
  width: min(360px, 92vw);
}
.m-match-end-row.hidden { display: none; }
.m-end-btn {
  flex: 1;
  border: none;
  border-radius: 18px;
  padding: 14px 8px;
  font-size: 16px;
  font-weight: 900;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.3);
}
.m-end-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.3); }
.m-end-btn.replay { background: linear-gradient(160deg, #ff9a3c, #ff5a3c); }
.m-end-btn.back { background: linear-gradient(160deg, #5b7fd0, #3a52a0); }

/* ----- 試合履歴一覧（りれき） ----- */
.m-hist-body { display: flex; flex-direction: column; gap: 12px; }
.m-hist-list { display: flex; flex-direction: column; gap: 10px; }
.m-hist-card {
  background: linear-gradient(165deg, var(--m-card-bg2), var(--m-card-bg));
  border-radius: 16px;
  padding: 12px 12px 10px;
  border: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}
.m-hist-card.result-win { border-color: var(--m-accent); }
.m-hist-card.result-lose { border-color: rgba(255, 255, 255, 0.12); }
.m-hist-card.result-draw { border-color: var(--m-gem); }
.m-hist-top { display: flex; justify-content: space-between; align-items: flex-start; }
.m-hist-meta { display: flex; flex-direction: column; gap: 2px; }
.m-hist-date { font-size: 12px; color: var(--m-sub); font-weight: 700; }
.m-hist-opp { font-size: 15px; font-weight: 900; }
.m-hist-scorewrap { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.m-hist-score { font-size: 22px; font-weight: 900; letter-spacing: 1px; }
.m-hist-badge { font-size: 12px; font-weight: 900; padding: 2px 10px; border-radius: 10px; color: #1a2030; }
.m-hist-badge.win { background: var(--m-accent); }
.m-hist-badge.lose { background: #9aa6bd; }
.m-hist-badge.draw { background: var(--m-gem); }
.m-hist-stats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.m-stat-chip {
  font-size: 11px; font-weight: 800; color: var(--m-sub);
  background: rgba(255, 255, 255, 0.08); padding: 3px 9px; border-radius: 10px;
}
.m-stat-chip.awaken { color: #ffe14a; background: rgba(255, 210, 60, 0.16); }
.m-hist-btnrow { display: flex; justify-content: flex-end; margin-top: 9px; }
.m-hist-replay {
  border: none; border-radius: 13px; padding: 8px 18px;
  font-size: 14px; font-weight: 900; color: #fff; cursor: pointer;
  background: linear-gradient(160deg, #ff9a3c, #ff5a3c);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}
.m-hist-replay:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.28); }
.m-hist-clear {
  align-self: center; margin-top: 4px;
  border: none; background: rgba(255, 90, 90, 0.18); color: #ff9a9a;
  font-size: 13px; font-weight: 800; padding: 8px 18px; border-radius: 12px; cursor: pointer;
}
.m-hist-clear.armed { background: rgba(255, 90, 90, 0.4); color: #fff; }

/* ----- リプレイビューア ----- */
.m-replay-body { display: flex; flex-direction: column; gap: 10px; height: calc(100% - 44px); }
.m-replay-head { text-align: center; }
.m-replay-title { font-size: 15px; font-weight: 900; color: var(--m-sub); }
.m-replay-board {
  display: flex; align-items: center; justify-content: space-between;
  background: linear-gradient(165deg, #2c4068, #1b2a4a);
  border-radius: 16px; padding: 10px 16px;
  border: 2px solid rgba(255, 255, 255, 0.1);
}
.m-replay-board.pulse { animation: m-rb-pulse 0.5s ease-out; }
@keyframes m-rb-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.04); box-shadow: 0 0 24px var(--m-accent); }
  100% { transform: scale(1); }
}
.m-rb-side { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 64px; }
.m-rb-lbl { font-size: 11px; color: var(--m-sub); font-weight: 700; }
.m-rb-score { font-size: 32px; font-weight: 900; line-height: 1; }
.m-rb-side.ally .m-rb-score { color: #ff7a5c; }
.m-rb-side.enemy .m-rb-score { color: #7aa0ff; }
.m-rb-clock { font-size: 13px; font-weight: 800; color: var(--m-accent); text-align: center; }
.m-replay-list {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; flex-direction: column; gap: 5px;
  background: rgba(0, 0, 0, 0.18); border-radius: 14px; padding: 8px;
  min-height: 120px;
}
.m-replay-row {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 13px; font-weight: 700;
  transition: background 0.15s, transform 0.15s;
  cursor: pointer;
}
.m-rr-icon { font-size: 16px; flex-shrink: 0; }
.m-rr-text { line-height: 1.25; }
.m-replay-row.current {
  background: linear-gradient(100deg, rgba(255, 210, 60, 0.28), rgba(255, 122, 60, 0.18));
  transform: translateX(3px);
  box-shadow: 0 0 0 2px var(--m-accent) inset;
}
.m-replay-row.awaken {
  border: 1px solid #ffd23c;
  background: linear-gradient(100deg, rgba(255, 122, 28, 0.2), rgba(255, 60, 174, 0.12));
}
.m-replay-row.awaken .m-rr-text { color: #ffe14a; }
.m-replay-ctrl { display: flex; align-items: center; gap: 8px; padding: 4px 2px 2px; }
.m-rc-btn {
  border: none; border-radius: 12px; padding: 9px 12px;
  font-size: 16px; font-weight: 900; color: #fff; cursor: pointer;
  background: rgba(255, 255, 255, 0.14); min-width: 44px;
}
.m-rc-btn.play { background: linear-gradient(160deg, #ff9a3c, #ff5a3c); }
.m-rc-btn.play.playing { background: linear-gradient(160deg, #5b7fd0, #3a52a0); }
.m-rc-btn.speed { background: rgba(81, 208, 255, 0.22); color: var(--m-gem); }
.m-rc-btn:active { transform: scale(0.94); }
.m-replay-seek { flex: 1; accent-color: var(--m-accent); height: 22px; }

@media (prefers-reduced-motion: reduce) {
  .m-replay-row, .m-replay-board { transition: none; animation: none; }
}
@media (max-width: 360px) {
  .m-hist-score { font-size: 19px; }
  .m-hist-opp { font-size: 13px; }
  .m-stat-chip { font-size: 10px; padding: 2px 7px; }
  .m-rb-score { font-size: 26px; }
  .m-replay-row { font-size: 12px; padding: 6px 8px; }
  .m-rc-btn { padding: 8px 9px; min-width: 38px; font-size: 14px; }
  .m-end-btn { font-size: 14px; padding: 12px 6px; }
}
