:root {
    /* 白〜ベージュの明るい配色。濃い面はすべてクリーム色の紙のように見せる */
    --bg: #f2e9db;          /* 地のベージュ */
    --panel: #fffdf8;       /* パネル（ほぼ白のクリーム） */
    --panel-2: #f8f1e5;
    --line: rgba(92, 70, 52, 0.22);
    --cyan: #097484;        /* 明るい地でも読める濃さに落とした差し色（本文比 4.5:1 以上） */
    --pink: #d92a63;
    --gold: #946a04;
    --green: #12804e;
    --text: #332b3d;
    --muted: #7a7185;
    /* 以前 rgba(0,0,0,…) で暗く沈めていた面の置き換え（うっすら影を落とすだけにする） */
    --sink: rgba(92, 70, 52, 0.07);
    --sink-2: rgba(92, 70, 52, 0.13);
    --shadow: rgba(120, 95, 70, 0.20);
    /* 背景（images/haikei.webp）。画面いっぱいに1枚を伸ばして表示する。
       濃さは --haikei-opacity（1で元の明るさ）。
       タイル状に並べ直したいときは、body::before の background を
       repeat ＋ background-size: 64px 64px に戻す。 */
    --haikei-opacity: 0.72;
}

* { box-sizing: border-box; }

/* ---------- 選択・タップ時の青い色を出さない ---------- */
* {
    /* スマホでタップしたときに出る青い四角を消す */
    -webkit-tap-highlight-color: transparent;
}
/* 文字を選んだときの色（既定の青のかわり） */
::selection { background: rgba(217, 42, 99, 0.22); color: inherit; }
::-moz-selection { background: rgba(217, 42, 99, 0.22); color: inherit; }
/* ボタンやリンク、ゲームの操作部分は、そもそも文字選択させない */
button, a, label, .stage-cell, .stage-item, .tp-zone, .type-cards label,
.game-header, #controls, #burstWrap, #superWrap, #tour, canvas {
    user-select: none;
    -webkit-user-select: none;
}
/* マウスやタップで押したあとに枠が残らないようにする（キーボード操作のときだけ出す） */
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
    -webkit-text-size-adjust: 100%;
    min-height: 100dvh;
}

/* 全画面共通の背景：haikei を1枚だけ画面いっぱいに広げる */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background-image: url('/images/haikei.webp');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    opacity: var(--haikei-opacity);
    pointer-events: none;
}

/* 背景のうっすら光るグリッド */
.stars {
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 20% 10%, rgba(255, 61, 129, 0.10), transparent 45%),
        radial-gradient(circle at 80% 80%, rgba(0, 200, 229, 0.10), transparent 45%),
        repeating-linear-gradient(0deg, rgba(92,70,52,0.045) 0 1px, transparent 1px 40px),
        repeating-linear-gradient(90deg, rgba(92,70,52,0.045) 0 1px, transparent 1px 40px);
    pointer-events: none;
}

a { color: var(--cyan); }

.wrap {
    max-width: 520px;
    margin: 0 auto;
    padding: 20px 16px 48px;
}

/* ---------- タイトル ---------- */
.logo {
    text-align: center;
    margin: 18px 0 22px;
}
.logo h1 {
    margin: 0;
    font-size: 2.3rem;
    font-weight: 900;
    letter-spacing: 2px;
    line-height: 1.1;
    background: linear-gradient(90deg, var(--cyan), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.35));
}
/* タイトルは画像（images/titleshooting.webp）。文字はaltに残してある */
.logo h1.logo-img {
    background: none;
    filter: none;
    line-height: 0;
    font-size: 0;
}
.logo h1.logo-img img {
    width: min(100%, 400px);
    height: auto;
    filter: drop-shadow(0 4px 14px rgba(120, 95, 70, 0.35));
}
.logo p {
    margin: 8px 0 0;
    font-size: 0.8rem;
    color: var(--muted);
    letter-spacing: 1px;
}

/* ---------- パネル ---------- */
.panel {
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px 16px;
    margin-bottom: 16px;
    box-shadow: 0 6px 20px var(--shadow);
}
.panel h2 {
    margin: 0 0 12px;
    font-size: 1rem;
    letter-spacing: 1px;
    color: var(--cyan);
    display: flex;
    align-items: center;
    gap: 8px;
}
.panel h2::before {
    content: "";
    width: 4px; height: 16px;
    border-radius: 2px;
    background: var(--pink);
}
.panel .hint {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.6;
    margin: 6px 0 0;
}

/* ---------- ボタン ---------- */
.btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: transform 0.12s, filter 0.12s;
    font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(90deg, var(--pink), #ff7b3d);
    color: #fff;
}
.btn-cyan {
    background: linear-gradient(90deg, #097484, #0d93a8);
    color: #fff;
}
.btn-gold {
    background: linear-gradient(90deg, #946a04, #b8850a);
    color: #fff;
}
.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1.5px solid var(--line);
}
.btn[disabled] { opacity: 0.4; pointer-events: none; }
.btn-sm { padding: 9px 14px; font-size: 0.85rem; width: auto; display: inline-block; }

/* ---------- フォーム ---------- */
label.field {
    display: block;
    font-size: 0.8rem;
    color: var(--muted);
    margin: 12px 0 6px;
    letter-spacing: 1px;
}
input[type="text"], input[type="tel"] {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1.5px solid var(--line);
    background: #fff;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}
input:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12);
}
.code-input {
    text-align: center;
    letter-spacing: 12px;
    font-size: 1.7rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    padding-left: 12px;
}
.hp-field { position: absolute; left: -9999px; }

.msg {
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 14px;
    line-height: 1.6;
}
.msg-error { background: rgba(217, 42, 99, 0.10); border: 1px solid rgba(217, 42, 99, 0.45); color: #a81c4c; }
.msg-ok { background: rgba(22, 145, 90, 0.10); border: 1px solid rgba(22, 145, 90, 0.40); color: #0e6d43; }

/* ---------- タイプ選択（キャラクター） ---------- */
.type-cards { display: flex; gap: 8px; }
.type-cards input { position: absolute; opacity: 0; pointer-events: none; }
.type-cards label {
    flex: 1;
    border: 2px solid var(--line);
    border-radius: 12px;
    padding: 10px 6px;
    text-align: center;
    cursor: pointer;
    background: var(--sink);
}
.type-cards .t-img {
    width: 44px; height: 44px;
    border-radius: 10px;
    margin: 0 auto 6px;
    display: block;
    background: var(--sink);
}
.type-cards .c-red .t-img { box-shadow: 0 0 0 2px rgba(255, 68, 68, 0.35) inset; }
.type-cards .c-blue .t-img { box-shadow: 0 0 0 2px rgba(68, 136, 255, 0.35) inset; }
.type-cards .c-green .t-img { box-shadow: 0 0 0 2px rgba(68, 204, 102, 0.35) inset; }
.type-cards .t-name { font-size: 0.8rem; font-weight: 800; display: block; }
.type-cards .t-desc { font-size: 0.65rem; color: var(--muted); line-height: 1.4; display: block; margin-top: 4px; }
.type-cards input:checked + label { border-color: var(--gold); background: rgba(255, 212, 0, 0.08); }

/* ---------- パスコード表示 ---------- */
.passcode-box {
    text-align: center;
    background: var(--sink-2);
    border: 1.5px dashed var(--gold);
    border-radius: 14px;
    padding: 14px;
}
.passcode-box .code {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: 10px;
    color: var(--gold);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 16px rgba(255, 212, 0, 0.5);
}
.passcode-box .label { font-size: 0.7rem; color: var(--muted); letter-spacing: 2px; }

/* ---------- プレイヤー情報 ---------- */
.player-bar {
    display: flex;
    align-items: center;
    gap: 12px;
}
.player-bar img {
    width: 54px; height: 54px;
    border-radius: 12px;
    border: 2px solid var(--line);
}
.player-bar .pname { font-size: 1.05rem; font-weight: 800; }
.player-bar .pstat { font-size: 0.75rem; color: var(--muted); margin-top: 3px; }
.coin {
    margin-left: auto;
    text-align: right;
    font-weight: 900;
    color: var(--gold);
    font-size: 1.15rem;
    font-variant-numeric: tabular-nums;
}
/* コインの数字の前に置くアイコン（images/point.webp／元は32x32のドット絵）。
   小さく縮めると潰れるので、原寸に近い大きさで出す */
.pt {
    width: 1.9em;
    height: 1.9em;
    vertical-align: -0.62em;
    margin-right: 4px;
    image-rendering: pixelated;   /* ドット絵なのでにじませない */
}
.coin { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.coin .pt { vertical-align: baseline; margin-right: 0; }

/* ---------- ステージ選択 ---------- */
.stage-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}
/* マスと、その下の敵の名前をひとまとめにする */
.stage-item { display: flex; flex-direction: column; gap: 3px; }
.stage-name {
    font-size: 0.52rem;
    line-height: 1.25;
    text-align: center;
    color: var(--muted);
    word-break: auto-phrase;
    overflow-wrap: anywhere;
}
.stage-cell {
    aspect-ratio: 1;
    border-radius: 12px;
    border: 1.5px solid var(--line);
    background: var(--sink);
    color: var(--text);
    font-weight: 900;
    font-size: 1.05rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    cursor: pointer;
}
.stage-cell small { font-size: 0.55rem; font-weight: 700; letter-spacing: 1px; color: var(--muted); }

/* スプライトシート（横一列・各コマ正方形）をCSSアニメーションで再生する。
   img を1コマぶんずつ左にずらすので、コマ数ぶんの steps() でぴたりと止まる */
.bsprite { display: block; overflow: hidden; }
.bsprite > img {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: auto;
    max-width: none;
    animation: bspritePlay var(--dur, 1s) steps(var(--frames, 1)) infinite;
}
@keyframes bspritePlay {
    from { transform: translateX(0); }
    to   { transform: translateX(-100%); }
}
@media (prefers-reduced-motion: reduce) {
    .bsprite > img { animation: none; }
}

/* ボス画像つきのセル（images/boss1〜boss10 が置かれたステージ） */
.stage-cell { position: relative; overflow: hidden; }
.stage-cell .sc-no { position: relative; z-index: 1; }
.stage-cell small { position: relative; z-index: 1; }
.stage-cell .sc-boss {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0.9;
}
.stage-cell .sc-boss.bsprite { overflow: hidden; }
/* ボスの絵があるマスでは、ステージ番号のバッジは出さない（絵だけ見せる） */
.stage-cell.has-boss .sc-no { display: none; }
.stage-cell.has-boss { justify-content: flex-end; padding-bottom: 5px; gap: 3px; }
.stage-cell.has-boss small {
    padding: 0 5px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.72);
}
.stage-cell.cleared { border-color: rgba(18, 128, 78, 0.55); color: var(--green); }
.stage-cell.cleared small { color: #12804e; }
.stage-cell.current {
    border-color: var(--pink);
    background: rgba(217, 42, 99, 0.12);
    box-shadow: 0 0 14px rgba(217, 42, 99, 0.30);
    animation: pulse 1.4s ease-in-out infinite alternate;
}
.stage-cell.locked { opacity: 0.28; pointer-events: none; }
@keyframes pulse {
    from { box-shadow: 0 0 10px rgba(255, 61, 129, 0.25); }
    to   { box-shadow: 0 0 20px rgba(255, 61, 129, 0.55); }
}

/* ---------- ショップ ---------- */
.shop-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.shop-item:last-child { border-bottom: none; }
.shop-item .info { flex: 1; min-width: 0; }
.shop-item .u-name { font-weight: 800; font-size: 0.9rem; }
.shop-item .u-desc { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.lv-bar { display: flex; gap: 3px; margin-top: 6px; }
.lv-bar i {
    width: 16px; height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.12);
}
.lv-bar i.on { background: var(--cyan); box-shadow: 0 0 6px rgba(0, 229, 255, 0.6); }
.shop-item .buy {
    border: none;
    border-radius: 10px;
    padding: 9px 12px;
    font-weight: 800;
    font-size: 0.8rem;
    background: linear-gradient(90deg, #946a04, #b8850a);
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}
.shop-item .buy[disabled] { background: var(--sink-2); color: var(--muted); cursor: default; }
.shop-item .maxed { font-size: 0.75rem; font-weight: 800; color: var(--green); }

/* ---------- ランキング ---------- */
/* 自分の行に色が付くので、左右に少し余白を取って数字が枠に当たらないようにする。
   リスト全体を少し外へ出して、見た目の位置はほぼ変えない */
.rank-list { list-style: none; margin: 0 -6px; padding: 0; }
.rank-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--line);
    font-size: 0.85rem;
}
.rank-list li:last-child { border-bottom: none; }
.rank-list .no {
    width: 24px; height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 900;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted);
    flex: none;
}
.rank-list li:nth-child(1) .no { background: #e5b31c; color: #3d2c00; }
.rank-list li:nth-child(2) .no { background: #b9c0d0; color: #1a1d25; }
.rank-list li:nth-child(3) .no { background: #cd8b52; color: #2e1a08; }
.rank-list img { width: 28px; height: 28px; border-radius: 6px; flex: none; }
.rank-list .rname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .rstage { font-size: 0.65rem; color: var(--muted); margin-left: 4px; }
.rank-list .rscore { margin-left: auto; font-weight: 900; color: var(--pink); font-variant-numeric: tabular-nums; }
.rank-list li.me { background: rgba(9, 116, 132, 0.10); border-radius: 10px; }

.center { text-align: center; }
.mt { margin-top: 14px; }
.small-link { font-size: 0.78rem; color: var(--muted); text-decoration: none; }
.divider { text-align: center; color: var(--muted); font-size: 0.75rem; margin: 18px 0 12px; letter-spacing: 2px; }

/* ---------- タイプ（チュートリアルステージの色分け・BURST説明） ---------- */
.stage-cell.c-red   { box-shadow: inset 0 3px 0 rgba(255, 68, 68, 0.75); }
.stage-cell.c-blue  { box-shadow: inset 0 3px 0 rgba(68, 136, 255, 0.75); }
.stage-cell.c-green { box-shadow: inset 0 3px 0 rgba(68, 204, 102, 0.75); }

.type-detail {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
    font-size: 0.75rem;
    line-height: 1.7;
    color: var(--muted);
}
.type-detail li {
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--sink);
    margin-bottom: 6px;
}
.type-detail b { margin-right: 6px; }
.type-detail b.c-red   { color: #cc3333; }
.type-detail b.c-blue  { color: #2a6fd6; }
.type-detail b.c-green { color: #1e8f4e; }

/* ---------- 全ページ共通ヘッダー ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(255, 253, 248, 0.92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(4px);
}
.sh-brand {
    font-weight: 900;
    font-size: 0.9rem;
    letter-spacing: 2px;
    color: var(--cyan);
    text-decoration: none;
}
.sh-coin {
    display: flex;
    align-items: center;
    gap: 2px;
    font-weight: 900;
    font-size: 1.05rem;
    color: var(--gold);
    text-decoration: none;
    font-variant-numeric: tabular-nums;
}
.sh-coin .pt { margin-right: 0; }

/* ヘッダーのロゴ（押すとオープニングが流れる） */
.sh-brand {
    display: flex;
    align-items: center;
    line-height: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.sh-brand:active { transform: scale(0.96); }
.sh-brand img { height: 30px; width: auto; display: block; }

/* ---------- オープニング（起動時に一度だけ出る画面） ---------- */
.opening {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background-color: var(--bg);
    opacity: 1;
    transition: opacity 0.55s ease;
    cursor: pointer;
}
.opening::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url('/images/haikei.webp');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    opacity: var(--haikei-opacity);
    pointer-events: none;
}
.opening.hide { opacity: 0; pointer-events: none; }
.opening[hidden] { display: none; }
.op-inner {
    position: relative;
    text-align: center;
    animation: opIn 0.7s ease-out both;
}
@keyframes opIn {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
.op-title {
    width: min(88vw, 440px);
    height: auto;
    display: block;
    margin: 0 auto 26px;
    filter: drop-shadow(0 4px 18px rgba(120, 95, 70, 0.4));
}
/* オープニングの文字は読ませたいので大きめに（画面幅に合わせて伸縮） */
.op-maker {
    margin: 0 0 18px;
    font-size: clamp(1.1rem, 5.6vw, 1.6rem);
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}
.op-maker img { height: clamp(38px, 12vw, 58px); width: auto; }
.op-line {
    margin: 8px 0;
    font-size: clamp(1rem, 5.2vw, 1.5rem);
    line-height: 1.7;
    color: var(--muted);
}
.opening a { color: var(--cyan); font-weight: 800; text-decoration: none; }
.opening a:hover { text-decoration: underline; }

/* ヘッダーの「セーブデータ」ボタン */
.sh-save {
    padding: 5px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: rgba(255, 255, 255, 0.6);
    color: var(--text);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    white-space: nowrap;
}
.sh-save:active { transform: scale(0.96); }

/* ---------- 共通モーダル ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 150;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12px;
    overflow-y: auto;
    background: rgba(60, 45, 35, 0.45);
    backdrop-filter: blur(2px);
}
.modal[hidden] { display: none; }
.modal-box {
    margin: auto;
    width: 100%;
    max-width: 380px;
    background: linear-gradient(180deg, var(--panel), var(--panel-2));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px 16px;
    box-shadow: 0 10px 32px var(--shadow);
}
.modal-box h2 {
    margin: 0 0 12px;
    font-size: 1rem;
    letter-spacing: 1px;
    color: var(--cyan);
}

/* プレイヤー欄のアイコン（押すとタイプ変更モーダルが開く） */
.pb-icon {
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    line-height: 0;
    border-radius: 12px;
    flex: none;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.pb-icon:active { transform: scale(0.95); }
.pb-icon::after {
    content: '✎';
    position: absolute;
    right: -4px;
    bottom: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--cyan);
    color: #fff;
    font-size: 10px;
    line-height: 18px;
    text-align: center;
}

/* ---------- キャラクター選択（ステージ開始画面とタイプ変更で共通） ---------- */
.tp-stage {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 12px;
}
.tp-stage img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* 絵の中の3人ぶんの当たり判定。ど真ん中からY字に切り分けてあり、
   clip-path はタップ判定にも効くので、区切った形のまま反応する */
.tp-zone {
    position: absolute;
    inset: 0;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.tp-zone:active { background: rgba(255, 255, 255, 0.3); }
.tp-zone.on.c-red   { background: rgba(226, 59, 59, 0.22); }
.tp-zone.on.c-blue  { background: rgba(47, 127, 224, 0.22); }
.tp-zone.on.c-green { background: rgba(35, 163, 92, 0.22); }
.tp-zone.on.c-yellow { background: rgba(240, 190, 20, 0.26); }

/* 4人目（つきの）。3人の絵のど真ん中に、丸く重ねて置く */
.tp-center {
    inset: auto;
    left: 50%;
    top: 50%;
    width: 42%;
    height: 42%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 253, 248, 0.82);
    box-shadow: 0 3px 12px var(--shadow), 0 0 0 3px rgba(240, 190, 20, 0.85);
    display: grid;
    place-items: center;
    animation: tpPop 0.35s ease-out;
}
.tp-center img {
    width: 108%;
    height: 108%;
    object-fit: contain;
}
.tp-center.on {
    box-shadow: 0 3px 14px var(--shadow), 0 0 0 4px #f0be14, 0 0 20px rgba(240, 190, 20, 0.7);
}
@keyframes tpPop {
    from { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    to   { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}
/* 選んでいるキャラの名前 */
.tp-picked {
    margin: 10px 0 0;
    text-align: center;
    font-size: 1rem;
    font-weight: 900;
    letter-spacing: 1px;
    color: var(--text);
}

/* プレイヤー名の【Player○】部分 */
.player-bar .pid { font-size: 0.78rem; font-weight: 700; color: var(--muted); margin-left: 2px; }

/* 名前のふりがな */
ruby { ruby-position: over; }
ruby rt {
    font-size: 0.5em;
    font-weight: 700;
    color: var(--muted);
    letter-spacing: 0;
}
.player-bar .pname { line-height: 1.35; }

/* SHOPの見出しと、その右端に置く小さな「ホームに戻る」 */
.shop-head {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.shop-head .head-back {
    position: absolute;
    right: 0;
    padding: 6px 12px;
    font-size: 0.75rem;
}

/* BGMの切り替えボタン */
.bgm-btn {
    padding: 5px 10px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: rgba(255, 255, 255, 0.6);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    white-space: nowrap;
}
.bgm-btn.on { color: var(--cyan); border-color: var(--cyan); }
.bgm-btn:active { transform: scale(0.96); }

/* ---------- 画面の切り替え中に出すロード画面 ---------- */
.page-loading {
    position: fixed;
    inset: 0;
    z-index: 500;                       /* ヘッダー・モーダルよりも前 */
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.14s ease, visibility 0.14s;
    pointer-events: none;
}
.page-loading.on {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;               /* 出ている間は二重に押せないようにする */
}
.pl-inner { text-align: center; }
.page-loading img {
    width: 148px;
    max-width: 46vw;
    height: auto;
    display: block;
    margin: 0 auto;
    animation: pl-bob 1.1s ease-in-out infinite;
}
.page-loading p {
    margin: 6px 0 0;
    font-size: 0.95rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--muted);
}
.page-loading p span { animation: pl-dot 1.05s infinite; }
.page-loading p span:nth-child(2) { animation-delay: 0.18s; }
.page-loading p span:nth-child(3) { animation-delay: 0.36s; }

@keyframes pl-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-9px); }
}
@keyframes pl-dot {
    0%, 60%, 100% { opacity: 0.25; }
    30%           { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
    .page-loading img, .page-loading p span { animation: none; }
}

/* ---------- ステージ選択のモード切り替え（NORMAL ⇔ HARD） ---------- */
.mode-tabs {
    display: flex;
    gap: 6px;
    margin: 0 0 10px;
}
.mt-btn {
    flex: 1;
    padding: 7px 0;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: var(--panel);
    color: var(--muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 900;
    letter-spacing: 2px;
    cursor: pointer;
}
.mt-btn.on { color: var(--panel); background: var(--cyan); border-color: var(--cyan); }
.mt-btn[data-mode="1"].on { background: #6b28c9; border-color: #6b28c9; }

.mode-slider {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    /* スライド中に縦スクロールへ持っていかれないようにする */
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin: 0 -2px;
}
.mode-slider::-webkit-scrollbar { display: none; }
.mode-page {
    flex: 0 0 100%;
    min-width: 100%;
    scroll-snap-align: start;
    padding: 0 2px;
}
.hard-lead {
    margin: 0 0 10px;
    padding: 7px 10px;
    border-radius: 10px;
    background: rgba(107, 40, 201, 0.10);
    border: 1px solid rgba(107, 40, 201, 0.35);
    color: #5a1fae;
    font-size: 0.72rem;
    line-height: 1.6;
}
.slide-hint { margin-top: 10px; font-size: 0.68rem; }

/* ハード側のステージ枠は紫の縁にして、ひと目で区別できるようにする */
.stage-grid.hard .stage-cell { border-color: rgba(107, 40, 201, 0.45); }
.stage-grid.hard .stage-cell.cleared { border-color: #6b28c9; }
.stage-grid.hard .stage-cell.current {
    border-color: #8b3bff;
    box-shadow: 0 0 0 2px rgba(139, 59, 255, 0.28);
}

.btn-hard {
    background: linear-gradient(180deg, #7c34d8, #5a1fae);
    color: #fff;
    border-color: #5a1fae;
}

/* 強化バーのうち、ハードモードで開放される枠（黄色にして区別する） */
.lv-bar i.hd { background: rgba(148, 106, 4, 0.18); }
.lv-bar i.hd.on { background: var(--gold); box-shadow: 0 0 6px rgba(255, 200, 0, 0.65); }

/* ---------- 自分の総合ポイント（ランキングの上） ---------- */
.my-point {
    text-align: center;
    padding: 12px 10px 10px;
    border-radius: 14px;
    background: var(--sink);
    border: 1px solid var(--line);
    margin-bottom: 12px;
}
.my-point .mp-label {
    font-size: 0.7rem;
    letter-spacing: 2px;
    color: var(--muted);
}
.my-point .mp-value {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--gold);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}
.my-point .mp-value span { font-size: 0.9rem; margin-left: 3px; }
.my-point .mp-rank {
    font-size: 0.78rem;
    color: var(--cyan);
    font-weight: 800;
}
.my-point .mp-rank strong { font-size: 1.1rem; }
/* 内訳。狭い画面でも折り返して収まるように並べる */
.mp-parts {
    list-style: none;
    margin: 10px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
    gap: 5px;
}
.mp-parts li {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 5px 6px;
    font-size: 0.66rem;
    line-height: 1.45;
}
.mp-parts .mp-k { display: block; color: var(--muted); }
.mp-parts .mp-v { font-weight: 800; color: var(--text); }
.mp-parts .mp-p { float: right; color: var(--gold); font-weight: 800; }
.my-point .hint { margin: 9px 0 0; font-size: 0.68rem; }
.rank-list .rscore small { font-size: 0.62rem; margin-left: 2px; color: var(--muted); font-weight: 700; }
.stage-cell.c-yellow { box-shadow: inset 0 3px 0 rgba(240, 190, 20, 0.85); }
