/* theme.css — デザイントークンと共通部品（SPEC-112 §1。DESIGN_CHARTER §2 のパレット）
   - トークン: 色（背景 3 段・パネル 3 段・アクセント金・ランド色・状態色）/ 角丸 / 影 / 時間 / イージング
   - 共通部品: ボタン（押下・波紋・光が横切る）/ .panel（エッジ光・ノイズ・押すと沈む）/ ポップアップ / トースト / 帯 / カットイン
   - fx.js の部品の見た目（.fx-*）
   9 ランドの色はデータから style（--land）で渡す。
   z-index: 0 常時の背景 / 1-4 マップ / 10-90 通常 UI / 95 画面の切り替え / 100 トースト / 120 ポップアップ
            / 150 帯 / 160 カットイン / 170 スプライト / 200 ランド選択 / 900 波紋 / 1000 起動
   動きを減らす: prefers-reduced-motion か、設定の「動きを減らす」（<html data-motion="reduce">）で
   時間のトークンを 1ms にし、常時のアニメーションを止める。 */

:root {
  /* ---------- 色: 背景 3 段（奥 → 手前） ---------- */
  --bg-0:      #0b0911;
  --bg-1:      #121018;
  --bg-2:      #19151f;
  /* ---------- 色: パネル 3 段（低 → 高） ---------- */
  --panel-1:   #1e1a28;
  --panel-2:   #2a2438;
  --panel-3:   #362e48;
  --border:    #3d3550;
  --border-hi: #57497a;
  /* 文字 */
  --text:      #ece6f6;
  --text-hi:   #ffffff;
  --muted:     #a197c2;   /* 本文の muted。#8c7fb0 は背景 #121018 上で 4.5:1 に届かないので少し明るく */
  --muted-2:   #8c7fb0;
  /* アクセント（金） */
  --accent:    #c4a35a;
  --accent-hi: #ecd08a;
  --accent-lo: #8a6f35;
  --accent-ink:#1a1420;
  /* ランド色（4 系統。各ランドの色は --land で上書き） */
  --garuda:    #5ecf8a;
  --ifrit:     #e76060;
  --leviathan: #5ab4c4;
  --tiamat:    #f0c14b;
  /* 状態色 */
  --ok:        #5ecf8a;
  --warn:      #f0c14b;
  --bad:       #ff6a6a;
  --info:      #6cc6ff;
  --danger:    #e76060;

  --r-common:    #8c7fb0;
  --r-uncommon:  #5ecf8a;
  --r-rare:      #5ab4c4;
  --r-epic:      #bb86fc;
  --r-legendary: #c4a35a;

  /* 旧名（各班の CSS が使っている。中身は新しいトークンに寄せる） */
  --bg:     var(--bg-1);
  --panel:  var(--panel-1);

  /* ---------- 角丸 ---------- */
  --r-xs: 4px;
  --r-s:  8px;
  --r-m:  12px;
  --r-l:  18px;
  --r-xl: 28px;
  --radius:   var(--r-m);
  --radius-s: var(--r-s);

  /* ---------- 影とエッジ（物の質感） ---------- */
  --edge-hi:  rgba(255, 255, 255, .14);   /* 上辺のエッジ光 */
  --edge-lo:  rgba(0, 0, 0, .55);         /* 下辺の暗線 */
  --sh-1: 0 1px 2px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .25);
  --sh-2: 0 4px 14px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .4);
  --sh-3: 0 14px 40px rgba(0, 0, 0, .6), 0 3px 10px rgba(0, 0, 0, .45);
  --sh-edge: inset 0 1px 0 var(--edge-hi), inset 0 -1px 0 var(--edge-lo);
  --glow-accent: 0 0 0 1px rgba(236, 208, 138, .35), 0 0 18px rgba(196, 163, 90, .35);
  /* パネルの薄いノイズ（画像ファイルは使わず、SVG のフィルタを data URI で） */
  --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");

  /* ---------- 時間 ---------- */
  --t-tap:  120ms;   /* 押した反応 */
  --t-ui:   240ms;   /* 部品の出入り */
  --t-flip: 380ms;   /* アプリを開く・閉じる */
  --t-page: 600ms;   /* めくり・カメラ */
  /* ---------- イージング ---------- */
  --ease-out:    cubic-bezier(.16, 1, .3, 1);
  --ease-in:     cubic-bezier(.55, 0, .75, .2);
  --ease-inout:  cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.2, .7, .2, 1);

  --gap: clamp(8px, 2.4vw, 14px);
  --font: "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  color-scheme: dark;
}

/* 動きを減らす（設定）: 時間を縮める。prefers-reduced-motion は下の @media */
:root[data-motion="reduce"] { --t-tap: 1ms; --t-ui: 1ms; --t-flip: 1ms; --t-page: 1ms; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
img { max-width: 100%; }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 1rem 0; font-size: .85rem; }
.section-title { font-size: .8rem; font-weight: 800; color: var(--muted); letter-spacing: .04em; margin: 0 0 .4rem; }
.hidden { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

[data-rarity="1"] { --rarity: var(--r-common); }
[data-rarity="2"] { --rarity: var(--r-uncommon); }
[data-rarity="3"] { --rarity: var(--r-rare); }
[data-rarity="4"] { --rarity: var(--r-epic); }
[data-rarity="5"] { --rarity: var(--r-legendary); }

/* ヒーローの絵（ドット絵） */
.hero-img, img.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }
.img-fallback {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--panel-2); color: var(--muted); font-weight: 800;
  border-radius: var(--radius-s); min-width: 1.6em; min-height: 1.6em;
}

/* ---------- パネル（B: 物の質感。上辺のエッジ光・下辺の暗線・薄いノイズ） ---------- */
.panel {
  position: relative;
  background:
    var(--noise) 0 0 / 120px 120px,
    linear-gradient(180deg, color-mix(in srgb, var(--panel-2) 70%, var(--panel-1)) 0%, var(--panel-1) 100%);
  background-blend-mode: soft-light, normal;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--sh-edge), var(--sh-1);
}
.panel--raised { box-shadow: var(--sh-edge), var(--sh-2); }
.panel--glass {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, 0) 40%),
    rgba(26, 22, 36, .72);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  backdrop-filter: blur(12px) saturate(1.2);
}
/* 押せるパネル: 押すと 2px 沈む（影が縮む） */
.panel--press, button.panel, a.panel { cursor: pointer; transition: transform var(--t-tap) var(--ease-out), box-shadow var(--t-tap) var(--ease-out), border-color var(--t-ui); }
.panel--press:hover, button.panel:hover { border-color: var(--border-hi); }
.panel--press:active, button.panel:active { transform: translateY(2px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), inset 0 2px 6px rgba(0, 0, 0, .35); }

/* 既存の面にもエッジ光だけ足す（形・色は各班のまま） */
.res, .home__notices, .result__score, .result__rank, .cal-grid-wrap, .cal-list, .hero-card, .chat-row, .map-plan, .tabs {
  box-shadow: var(--sh-edge), var(--sh-1);
}

/* ---------- ボタン（DESIGN_CHARTER §5。押下で縮む・波紋・主要ボタンは光が横切る） ---------- */
.btn-primary, .btn-secondary, .btn-ghost, .btn-danger {
  position: relative; isolation: isolate; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .35em;
  min-height: 44px; padding: .5rem 1rem;
  border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: .95rem; cursor: pointer;
  transition: transform var(--t-tap) var(--ease-out), background var(--t-ui) var(--ease), box-shadow var(--t-ui) var(--ease), opacity var(--t-ui);
}
.btn-primary {
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 48%, #a8873f 100%);
  color: var(--accent-ink);
  border-color: rgba(255, 236, 190, .55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(90, 64, 20, .45), 0 3px 10px rgba(196, 163, 90, .28), var(--sh-1);
  text-shadow: 0 1px 0 rgba(255, 240, 200, .5);
}
.btn-primary:hover { filter: brightness(1.06); }
/* 光が横切る（数秒に 1 回）。transform で動かすと合成の層が増えるので、背景の位置で動かす */
.btn-primary::after {
  content: ""; position: absolute; z-index: -1; inset: 0; border-radius: inherit;
  background: linear-gradient(105deg, transparent 42%, rgba(255, 255, 255, .55) 50%, transparent 58%) no-repeat;
  background-size: 300% 100%;
  background-position: 120% 0;
  animation: btn-shine 4.8s var(--ease-inout) infinite;
  pointer-events: none;
}
.btn-secondary {
  background: linear-gradient(180deg, rgba(196, 163, 90, .12), rgba(196, 163, 90, .02));
  border-color: var(--accent); color: var(--accent-hi);
  box-shadow: inset 0 1px 0 rgba(255, 236, 190, .18), var(--sh-1);
}
.btn-secondary:hover { background: rgba(196, 163, 90, .18); }
/* 主役のボタンと並ぶ副ボタン（キャンセルなど）は一段引く: 枠 1px・muted。金は主役だけが持つ */
.btn-secondary--quiet, .popup .btn-row .btn-secondary:has(~ .btn-primary, ~ .btn-danger) {
  background: rgba(255, 255, 255, .03); border: 1px solid var(--muted-2); color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
}
.btn-secondary--quiet:hover, .popup .btn-row .btn-secondary:has(~ .btn-primary, ~ .btn-danger):hover { background: rgba(255, 255, 255, .07); color: var(--text); }
.btn-secondary--quiet:focus-visible, .popup .btn-row .btn-secondary:has(~ .btn-primary, ~ .btn-danger):focus-visible { outline: 1px solid var(--muted); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--accent); min-height: 36px; padding: .3rem .6rem; }
.btn-ghost:hover { background: rgba(196, 163, 90, .1); }
.btn-danger {
  background: linear-gradient(180deg, rgba(231, 96, 96, .14), rgba(231, 96, 96, .03));
  border: 1.5px solid var(--danger); color: #ff8b8b;
  box-shadow: inset 0 1px 0 rgba(255, 200, 200, .14), var(--sh-1);
}
.btn-danger:hover { background: rgba(231, 96, 96, .2); }
.btn-primary:active, .btn-secondary:active, .btn-danger:active, .btn-ghost:active { transform: scale(.96); }
.btn-primary:active { box-shadow: inset 0 2px 4px rgba(90, 64, 20, .45), 0 1px 3px rgba(0, 0, 0, .4); }
button:disabled, button[disabled] { opacity: .45; cursor: not-allowed; }
button:disabled::after { animation: none; }
:focus-visible { outline: 2px solid var(--tiamat); outline-offset: 2px; }
.btn-row { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }

@keyframes btn-shine {
  0%, 70% { background-position: 120% 0; }
  100% { background-position: -20% 0; }
}

/* 押したところから広がる波紋（fx.ripple。押したものの形に切り抜いた fixed の箱） */
.fx-ripple {
  position: fixed; z-index: 900; pointer-events: none; overflow: hidden;
}
.fx-ripple__dot {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .38) 0%, rgba(255, 255, 255, .16) 55%, rgba(255, 255, 255, 0) 70%);
  transform: translate(-50%, -50%) scale(0);
  animation: fx-ripple 520ms var(--ease-out) forwards;
}
.fx-ripple--accent .fx-ripple__dot { background: radial-gradient(circle, rgba(255, 246, 214, .6) 0%, rgba(236, 208, 138, .22) 55%, rgba(236, 208, 138, 0) 70%); }
@keyframes fx-ripple {
  0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
  70% { opacity: .9; }
  100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}

/* ---------- ポップアップ（1 つずつ。DESIGN_CHARTER §6。ばねで出る） ---------- */
.popup, .popup-ghost {
  position: fixed; inset: 0; z-index: 120;
  background: radial-gradient(120% 80% at 50% 40%, rgba(30, 24, 44, .78), rgba(8, 6, 12, .9));
  -webkit-backdrop-filter: blur(6px) saturate(.9);
  backdrop-filter: blur(6px) saturate(.9);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fade-in var(--t-ui) var(--ease-out);
}
.popup__card {
  position: relative;
  width: 100%; max-width: 440px; max-height: 90dvh; overflow-y: auto;
  background:
    var(--noise) 0 0 / 120px 120px,
    linear-gradient(180deg, #30284a 0%, var(--panel-1) 60%);
  background-blend-mode: soft-light, normal;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: var(--r-l);
  padding: .8rem 1rem 1rem;
  box-shadow: inset 0 1px 0 rgba(255, 236, 190, .25), inset 0 -1px 0 var(--edge-lo), var(--sh-3), 0 0 0 1px rgba(0, 0, 0, .5);
  display: flex; flex-direction: column; gap: .6rem;
  animation: popup-in calc(var(--t-ui) * 1.5) var(--ease-spring);
}
/* 上辺の金の光 */
.popup__card::before {
  content: ""; position: absolute; left: 12%; right: 12%; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-hi), transparent);
  pointer-events: none;
}
.popup-ghost { pointer-events: none; animation: fade-out 180ms var(--ease-in) forwards; }
.popup-ghost .popup__card { animation: popup-out 180ms var(--ease-in) forwards; }
.popup__card:focus { outline: none; }
.popup__head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.popup__title { font-size: 1.05rem; font-weight: 800; margin: 0; letter-spacing: .02em; }
.popup__x { font-size: 1.4rem; line-height: 1; min-width: 44px; min-height: 44px; }
.popup__body { display: flex; flex-direction: column; gap: .7rem; }
.confirm p { margin: 0; }

@keyframes popup-in { from { opacity: 0; transform: translateY(14px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes popup-out { from { opacity: 1; transform: none; } to { opacity: 0; transform: translateY(8px) scale(.96); } }

/* スイッチ（設定） */
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .3rem 0; }
.setting-row__text { display: flex; flex-direction: column; }
.setting-row__sub { font-size: .72rem; color: var(--muted); }
.switch {
  position: relative; display: inline-flex; align-items: center; gap: .5rem;
  min-width: 92px; min-height: 40px; padding: 4px 12px 4px 4px;
  border-radius: 999px; border: 1px solid var(--border); background: var(--panel-2); cursor: pointer;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .35);
  transition: border-color var(--t-ui), background var(--t-ui);
}
.switch__knob {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(180deg, #b2a7d2, var(--muted-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .45), 0 2px 4px rgba(0, 0, 0, .45);
  transition: transform var(--t-ui) var(--ease-spring), background var(--t-ui);
}
.switch.is-on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, var(--panel-2)); }
.switch.is-on .switch__knob { background: linear-gradient(180deg, var(--accent-hi), var(--accent)); transform: translateX(2px); }
.switch__text { font-weight: 700; font-size: .85rem; }

/* ---------- トースト（右上。fx.toast / h.toast） ---------- */
.toast-stack {
  position: fixed; z-index: 100; top: 36px; right: max(8px, calc(50vw - 232px));
  display: flex; flex-direction: column; align-items: flex-end; gap: 6px;
  pointer-events: none; max-width: min(320px, calc(100vw - 16px));
}
/* .phone の中に置いたとき（端末の中に収める） */
.phone > .toast-stack { position: absolute; top: 34px; right: 8px; max-width: min(320px, calc(100% - 16px)); transition: top var(--t-ui) var(--ease-out); }
/* 実行フェーズ: 右上は「スキップ」の場所。トーストはその下（execbar 44px + 余白 6px）へずらし、2 枚まで（fx.toast） */
.phone.is-executing > .toast-stack { top: 84px; }
.toast {
  --toast: var(--accent);
  position: relative; display: flex; align-items: center; gap: .45rem;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--toast) 18%, transparent), transparent 60%),
    rgba(26, 22, 36, .94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid color-mix(in srgb, var(--toast) 40%, var(--border));
  border-left: 3px solid var(--toast);
  border-radius: var(--radius-s); padding: .4rem .7rem; font-size: .8rem;
  box-shadow: inset 0 1px 0 var(--edge-hi), 0 6px 18px rgba(0, 0, 0, .5);
  animation: toast-in var(--t-ui) var(--ease-spring);
  overflow: hidden;
}
.toast--good { --toast: var(--ok); }
.toast--bad { --toast: var(--bad); }
.toast--warn { --toast: var(--warn); }
.toast--info { --toast: var(--info); }
.toast__icon { width: 20px; height: 20px; object-fit: contain; flex: none; }
.toast.is-bump { animation: toast-bump var(--t-ui) var(--ease-spring); }
.toast.is-leaving { animation: toast-out 220ms var(--ease-in) forwards; }
/* 残り時間の細い線 */
.toast__timer {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--toast); opacity: .55; transform-origin: left;
  animation: toast-timer linear forwards; animation-duration: var(--toast-ms, 2200ms);
}

@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(20px); } }
@keyframes toast-bump { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: none; } }
@keyframes toast-timer { from { transform: scaleX(1); } to { transform: scaleX(0); } }

/* ---------- 帯（砦の陥落など。画面中央。fx.band / h.band） ---------- */
.band {
  --band: var(--accent);
  position: fixed; z-index: 150; left: 0; right: 0; top: 42%;
  display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none;
  padding: .7rem 1rem;
  overflow: hidden;
  animation: band-in var(--band-ms, 1400ms) var(--ease-out) forwards;
}
.phone > .band { position: absolute; }
.band::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .35), transparent 30%, transparent 70%, rgba(0, 0, 0, .35)),
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--band) 94%, transparent) 14%, color-mix(in srgb, var(--band) 94%, transparent) 86%, transparent);
  transform-origin: center;
  animation: band-bg var(--band-ms, 1400ms) var(--ease-out) forwards;
}
/* 光が横切る */
.band::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -30%; width: 22%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .7), transparent);
  transform: skewX(-20deg);
  animation: band-shine var(--band-ms, 1400ms) var(--ease-out) forwards;
}
.band { border-top: 1px solid transparent; border-bottom: 1px solid transparent; border-image: linear-gradient(90deg, transparent, rgba(255, 246, 214, .9) 20%, rgba(255, 246, 214, .9) 80%, transparent) 1; }
.band--bad { --band: var(--ifrit); }
/* 細い帯（高さ 44px。敵どうしの陥落など、プレイヤーに直接関わらない知らせ。fx.band(text, {slim:true})） */
.band--slim { top: 38%; height: 44px; padding: 0 1rem; }
.band--slim .band__text { font-size: .9rem; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.band--slim .band__sub { display: none; }
/* 全画面のカットインが出ている間は、帯をその下へ逃がす（斜めの帯と重ねない） */
.phone:has(> .fx-cutin) > .band { top: 74%; }
.band--good { --band: var(--garuda); }
.band--info { --band: var(--leviathan); }
.band__text {
  font-weight: 900; font-size: 1.2rem; text-align: center; letter-spacing: .06em; color: var(--accent-ink);
  text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
  animation: band-text var(--band-ms, 1400ms) var(--ease-out) forwards;
}
.band__sub { font-size: .78rem; font-weight: 700; color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes fade-out { from { opacity: 1; } to { opacity: 0; } }
@keyframes band-in { 0% { opacity: 0; } 8% { opacity: 1; } 82% { opacity: 1; } 100% { opacity: 0; } }
@keyframes band-bg { 0% { transform: scaleY(.05) scaleX(1.2); } 14% { transform: scaleY(1.15); } 22% { transform: none; } 100% { transform: none; } }
@keyframes band-text { 0% { opacity: 0; letter-spacing: .6em; } 18% { opacity: 1; letter-spacing: .1em; } 30% { letter-spacing: .06em; } 100% { letter-spacing: .06em; } }
@keyframes band-shine { 0%, 12% { left: -30%; } 45% { left: 110%; } 100% { left: 110%; } }

/* ---------- カットイン（fx.cutin。左右から絵が滑り込み、文字の手前にも絵の一部が重なる） ---------- */
.fx-cutin {
  --cut: #609da8;
  position: fixed; z-index: 160; inset: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  container-type: size;
  background: rgba(6, 4, 10, .35);
  animation: fade-in 120ms linear;
}
.phone > .fx-cutin { position: absolute; }
.fx-cutin--opponent { --cut: #be6c65; }
.fx-cutin--accent { --cut: #c4a35a; }
.fx-cutin__band {
  position: absolute; left: -10%; right: -10%; top: 50%; height: 168px;
  transform: translateY(-50%) skewY(-10deg);
  background: linear-gradient(to right bottom, var(--cut) 0, var(--cut) 50%, #282b33 0, #282b33);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 0 0 2px rgba(255, 255, 255, .12);
  animation: cutin-band 1600ms var(--ease-out) forwards;
  animation-duration: var(--cut-ms, 1600ms);
  /* タップで早送りする受け口は帯だけ（全面を覆わない。後ろの「スキップ」や地図は押せる） */
  pointer-events: auto; cursor: pointer;
}
.fx-cutin--opponent .fx-cutin__band { background: linear-gradient(to left top, var(--cut) 0, var(--cut) 50%, #282b33 0, #282b33); animation-name: cutin-band-r; }
.fx-cutin__shine {
  position: absolute; inset: 0; mix-blend-mode: color-dodge;
  background: linear-gradient(180deg, #024, #059 20%, #059 80%, #024);
  animation: cutin-shine .6s linear infinite alternate;
}
.fx-cutin--opponent .fx-cutin__shine { background: linear-gradient(180deg, #402, #903 20%, #903 80%, #402); }
.fx-cutin--accent .fx-cutin__shine { background: linear-gradient(180deg, #420, #960 20%, #960 80%, #420); }
.fx-cutin__lines {
  position: absolute; inset: 0; opacity: .35;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .5) 0 2px, transparent 2px 38px);
  animation: cutin-lines 400ms linear infinite;
}
/* 絵（奥: 文字の後ろ / 手前: 下半分だけ文字の前に重ねる） */
.fx-cutin__art {
  position: absolute; top: 50%; height: 220px; width: 220px; left: 6%;
  transform: translateY(-58%);
  animation: cutin-art 1600ms var(--ease-out) forwards; animation-duration: var(--cut-ms, 1600ms);
  pointer-events: none;
}
.fx-cutin--opponent .fx-cutin__art { left: auto; right: 6%; animation-name: cutin-art-r; }
.fx-cutin__art img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(2px 0 0 rgba(255, 255, 255, .5)) drop-shadow(-2px 0 0 rgba(255, 255, 255, .5)); }
.fx-cutin__art--front { z-index: 3; clip-path: inset(78% 0 0 0); }
.fx-cutin__art--back { z-index: 1; }
.fx-cutin__text {
  position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-end;
  width: 100%; padding: 0 5% 0 52%; transform: skewY(-10deg);
  pointer-events: none;
  animation: cutin-text 1600ms var(--ease-out) forwards; animation-duration: var(--cut-ms, 1600ms);
}
.fx-cutin--opponent .fx-cutin__text { align-items: flex-start; padding: 0 52% 0 5%; animation-name: cutin-text-r; }
.fx-cutin__title {
  margin: 0; max-width: 100%; font-size: clamp(1rem, calc(40cqw / var(--fit, 4)), 2.1rem); font-weight: 900; line-height: 1.1; color: #fff;
  word-break: keep-all; overflow-wrap: anywhere; text-align: right;
  text-shadow: 2px 2px 0 #333, -2px 2px 0 #333, -2px -2px 0 #333, 2px -2px 0 #333, 0 0 18px var(--cut);
}
.fx-cutin--opponent .fx-cutin__title { text-align: left; }
/* 字幕: 暗い座布団を敷いて、絵や斜線の上でも読める。1 行に収まらなければ 2 行で折り返す */
.fx-cutin__sub {
  margin: .35rem 0 0; max-width: 100%; padding: 3px 7px; border-radius: 4px;
  background: rgba(0, 0, 0, .55); box-shadow: 0 0 0 1px rgba(255, 255, 255, .08);
  font-size: .8rem; line-height: 1.35; font-weight: 800; color: #fff; text-align: left;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
  text-shadow: 0 1px 0 #000;
}

@keyframes cutin-shine { from { opacity: 0; } to { opacity: .8; } }
@keyframes cutin-lines { from { background-position: 0 0; } to { background-position: -40px 0; } }
@keyframes cutin-band {
  0% { transform: translate(100%, -50%) skewY(-10deg); opacity: 0; }
  14% { transform: translate(0, -50%) skewY(-10deg); opacity: 1; }
  84% { transform: translate(0, -50%) skewY(-10deg); opacity: 1; }
  100% { transform: translate(-100%, -50%) skewY(-10deg); opacity: 0; }
}
@keyframes cutin-band-r {
  0% { transform: translate(-100%, -50%) skewY(-10deg); opacity: 0; }
  14% { transform: translate(0, -50%) skewY(-10deg); opacity: 1; }
  84% { transform: translate(0, -50%) skewY(-10deg); opacity: 1; }
  100% { transform: translate(100%, -50%) skewY(-10deg); opacity: 0; }
}
@keyframes cutin-art {
  0% { transform: translate(-140%, -58%) scale(1.3); opacity: 0; }
  18% { transform: translate(6%, -58%) scale(1.02); opacity: 1; }
  80% { transform: translate(0, -58%) scale(1); opacity: 1; }
  100% { transform: translate(-60%, -58%) scale(1); opacity: 0; }
}
@keyframes cutin-art-r {
  0% { transform: translate(140%, -58%) scale(1.3); opacity: 0; }
  18% { transform: translate(-6%, -58%) scale(1.02); opacity: 1; }
  80% { transform: translate(0, -58%) scale(1); opacity: 1; }
  100% { transform: translate(60%, -58%) scale(1); opacity: 0; }
}
@keyframes cutin-text {
  0%, 10% { transform: translateX(60%) skewY(-10deg); opacity: 0; }
  24% { transform: translateX(-2%) skewY(-10deg); opacity: 1; }
  82% { transform: translateX(0) skewY(-10deg); opacity: 1; }
  100% { transform: translateX(-30%) skewY(-10deg); opacity: 0; }
}
@keyframes cutin-text-r {
  0%, 10% { transform: translateX(-60%) skewY(-10deg); opacity: 0; }
  24% { transform: translateX(2%) skewY(-10deg); opacity: 1; }
  82% { transform: translateX(0) skewY(-10deg); opacity: 1; }
  100% { transform: translateX(30%) skewY(-10deg); opacity: 0; }
}

/* ---------- 数値が転がる（fx.rollNumber） ---------- */
.fx-roll { display: inline-block; transition: color var(--t-ui); font-variant-numeric: tabular-nums; }
.fx-roll.is-up { animation: roll-up 900ms var(--ease-out); }
.fx-roll.is-down { animation: roll-down 900ms var(--ease-out); }
@keyframes roll-up { 0% { color: var(--ok); text-shadow: 0 0 10px rgba(94, 207, 138, .8); transform: translateY(-2px); } 100% { text-shadow: none; transform: none; } }
@keyframes roll-down { 0% { color: var(--bad); text-shadow: 0 0 10px rgba(255, 106, 106, .8); transform: translateY(2px); } 100% { text-shadow: none; transform: none; } }

/* ---------- 1 文字ずつ（fx.typeText） ---------- */
.fx-type__caret {
  display: inline-block; width: .5em; height: 2px; margin-left: 2px; vertical-align: baseline;
  background: currentColor; opacity: .7; animation: caret 700ms steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

/* ---------- 順に出す（fx.stagger） ---------- */
.fx-stagger-pre { opacity: 0; }

/* ---------- スプライト（fx.spriteOnce） ---------- */
.fx-sprite {
  position: fixed; z-index: 170; pointer-events: none;
  background-repeat: no-repeat; image-rendering: pixelated;
  mix-blend-mode: screen;
}

/* ---------- 起動 ---------- */
.boot {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: .6rem;
  background: radial-gradient(80% 50% at 50% 45%, #241d33, var(--bg-0) 70%); color: var(--muted); font-size: .9rem;
}
.boot__title { color: var(--accent); font-weight: 800; font-size: 1.2rem; letter-spacing: .06em; text-shadow: 0 0 18px rgba(196, 163, 90, .5); }
.boot__bar { width: 120px; height: 3px; border-radius: 999px; overflow: hidden; background: rgba(255, 255, 255, .08); position: relative; }
.boot__bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 40%; border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent-hi), transparent);
  animation: boot-bar 1.1s var(--ease-inout) infinite;
}
@keyframes boot-bar { to { left: 100%; } }
.boot--error { color: var(--danger); padding: 1rem; text-align: center; }

/* ---------- 動きを減らす ---------- */
@media (prefers-reduced-motion: reduce) {
  :root { --t-tap: 1ms; --t-ui: 1ms; --t-flip: 1ms; --t-page: 1ms; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .band, .band::before, .band::after, .band__text, .btn-primary::after { animation: none !important; }
}
:root[data-motion="reduce"] *, :root[data-motion="reduce"] *::before, :root[data-motion="reduce"] *::after {
  animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important;
}
:root[data-motion="reduce"] .band, :root[data-motion="reduce"] .band::before, :root[data-motion="reduce"] .band::after,
:root[data-motion="reduce"] .band__text, :root[data-motion="reduce"] .btn-primary::after { animation: none !important; }

/* 画像が読めたらふわっと出す（h.js の imgEl） */
.fx-img-in { animation: img-in var(--t-ui) var(--ease-out); }
@keyframes img-in { from { opacity: 0; filter: brightness(1.8) blur(2px); } to { opacity: 1; filter: none; } }

/* カットインの「動きを減らす」版（動かさずに出して消す） */
.fx-cutin.is-static .fx-cutin__band { animation: none !important; transform: translateY(-50%) skewY(-10deg); }
.fx-cutin.is-static .fx-cutin__art { animation: none !important; transform: translateY(-58%); }
.fx-cutin.is-static .fx-cutin__text { animation: none !important; transform: skewY(-10deg); }
.fx-cutin.is-static .fx-cutin__shine, .fx-cutin.is-static .fx-cutin__lines { animation: none !important; }

/* アプリを開くときの光の枠（fx.flipOpen） */
.fx-zoomframe {
  position: fixed; z-index: 96; pointer-events: none; transform-origin: 0 0;
  border-radius: 18px;
  border: 1.5px solid rgba(255, 246, 214, .55);
  background: radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, .12), rgba(255, 255, 255, 0) 70%);
  box-shadow: 0 0 24px rgba(196, 163, 90, .35), inset 0 0 18px rgba(255, 255, 255, .08);
}
