/* ============================================================
    0. フォント（アプリ同梱・サブセット済み）
    ------------------------------------------------------------
    以前は Google Fonts から読んでいたため、オフライン起動や
    通信の遅い環境では M PLUS Rounded 1c が当たらず、端末標準の
    ゴシックで表示されていた（＝意図した見た目になっていなかった）。
    ゲーム内に出る文字だけに絞ったサブセットを同梱して常に効くようにする。
    3ウェイト合計で約520KB。ライセンスは fonts/ 内の LICENSE を参照。
============================================================ */
@font-face {
    font-family: 'M PLUS Rounded 1c';
    font-style: normal; font-weight: 400; font-display: block;
    src: url('fonts/koicoin-400.woff2') format('woff2');
}
@font-face {
    font-family: 'M PLUS Rounded 1c';
    font-style: normal; font-weight: 700; font-display: block;
    src: url('fonts/koicoin-700.woff2') format('woff2');
}
@font-face {
    font-family: 'M PLUS Rounded 1c';
    font-style: normal; font-weight: 900; font-display: block;
    src: url('fonts/koicoin-900.woff2') format('woff2');
}
/* 🏁 決着の文字（チャレンジ終了など）用のポップな書体 Mochiy Pop One（OFL）。
   かな・英数字と決着表示で使う漢字だけに絞った約38KBのサブセット。
   入っていない字は M PLUS Rounded 1c で表示される。ライセンスは fonts/LICENSE-Mochiy-Pop-One.txt */
@font-face {
    font-family: 'Koicoin Pop';
    font-style: normal; font-weight: 400; font-display: swap;
    src: url('fonts/koicoin-pop.woff2') format('woff2');
}

/* ============================================================
    1. ルート設定 ＆ ベースリセット
============================================================ */
:root {
    --safe-area-top: env(safe-area-inset-top, 0px);
    /* ⚠️ 2026-08: 実機（Android・3ボタンナビゲーション）で、画面下端が
       ナビゲーションバーに隠れる不具合の報告を受けて調査。
       viewport-fit=cover は index.html に設定済みだが、Android の
       WebView は env(safe-area-inset-bottom) が3ボタンナビゲーションの
       高さを正しく返さず 0 になることが多い（iOSでは概ね機能するが、
       Androidでは信頼できない既知の差）。
       env() の値と「実機のナビゲーションバーの標準的な高さ(48dp相当)」を
       比較し、大きい方を採用する。env()が正しく効く端末（ジェスチャー
       ナビ等でinsetが大きい場合）ではそちらが優先されるので、
       過剰な余白にはならない。 */
    --safe-area-bottom: max(env(safe-area-inset-bottom, 0px), 26px);

    /* --------------------------------------------------------
       🎨 カラートークン
       現状 201種類の色がコード中に直書きされていて、同じ役割の
       赤・青が微妙に違う値になっている箇所が多い。まずは
       「実際によく使われている色」を役割名で定義し、今後は
       生の16進数ではなくこの変数を使う。
       -------------------------------------------------------- */
    --c-p1:        #ff4d6d;   /* プレイヤー1（自分）の赤 */
    --c-p1-soft:   #ffb3c6;
    --c-p1-deep:   #c9184a;
    --c-p2:        #0077b6;   /* プレイヤー2（あいて）の青 */
    --c-p2-soft:   #90e0ef;
    --c-p2-light:  #4cc9f0;

    --c-gold:      #ffd166;   /* お金・お買い上げ・ごほうび */
    --c-gold-hi:   #ffd700;
    --c-warn:      #ff9f1c;   /* 注意・セール・降参 */
    --c-go:        #52b788;   /* 進む・ほぞん・成功 */
    --c-go-deep:   #2d6a4f;
    --c-magic:     #a855f7;   /* 逆両替・特殊コイン */

    --c-ink:       #33415c;   /* 本文 */
    --c-ink-mute:  #7a869c;   /* 補助テキスト */
    --c-paper:     #ffffff;
    --c-line:      #dbe6ff;

    /* 角丸・影：値がバラバラだと「作りかけ」に見えるので3段階に統一する */
    --r-sm: 10px;
    --r-md: 16px;
    --r-lg: 24px;
    --r-pill: 999px;
    --shadow-card: 0 8px 16px rgba(0,0,0,0.10);
    --shadow-pop:  0 4px 0 rgba(0,0,0,0.18);
}

body {
    margin: 0;
    width: 100vw;
    height: 100dvh;
    padding-top: var(--safe-area-top);
    padding-bottom: var(--safe-area-bottom);
    box-sizing: border-box;
    overflow: hidden;
    background-color: #fff;
    /* 2026-11-07（ユーザー「フォントも統一させてほしい」）：同梱の M PLUS Rounded 1c を全体に。
       前は body に指定が無く、文字は端末のふつうのフォント・ボタンは Arial になっていた */
    font-family: 'M PLUS Rounded 1c', sans-serif;
}
button, input, select, textarea { font-family: inherit; }

#main-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 4px;
    gap: 4px;
    box-sizing: border-box;
}

*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
    2. プレイヤーセクション（上下2分割）
============================================================ */
.player-section { 
    flex: 1 1 0;
    min-width: 0;        
    min-height: 0;
    display: flex; 
    flex-direction: row; 
    background: #fff;
    border: 5px solid #ffb3c6;
    border-radius: 20px;
    position: relative; 
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    overflow: hidden;
    box-sizing: border-box;
    transition: transform 0.1s; 
}
#p2-section { 
    order: -1;
    border-color: #90e0ef;
    position: relative;
}

.player-section .canvas-container {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ============================================================
    3. UI ヘッダー（スコア + 目標表示 + プログレスバー）
    ★ さらに極限まで横幅を細くスリム化！
============================================================ */
.ui-container {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;               /* 隙間をさらに詰めました */
    width: min(85px, 20%);  /* 👈 最大幅を 120px → 85px (25% → 20%) に極限縮小 */
    min-width: 80px;        /* 👈 最小幅を 100px → 80px に限界カット */
    background: #ffe5ec;
    border-right: 3px solid #ffb3c6; /* 線も少し細く */
    padding: 4px 2px;        /* 上下左右の余白を極限まで削減 */
    z-index: 100;
}
#p2-section .ui-container {
    background: #e0f7fa;
    border-right-color: #90e0ef;
}

.battle-timer {
    flex: 0 0 auto;
    min-height: 36px;        /* 縦をさらにコンパクトに */
    display: flex;
    flex-direction: column;  /* 2行縦並びを維持 */
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 2px solid #ffb3c6; 
    border-radius: 6px;      
    padding: 2px;            
    font-size: clamp(11px, 2.8vw, 14px); /* 文字数を減らした分すっきり収まるサイズ */
    font-weight: 900;
    color: #d6336c;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    line-height: 1.1;
}
.battle-timer span {
    display: block;          
    font-size: clamp(8px, 1.8vw, 10px);
    font-weight: 700;
    opacity: 0.8;
}
#p2-section .battle-timer {
    border-color: #90e0ef;
    color: #0077b6;
}

/* スコア＋目標の横並び行 */
.ui-row { 
    display: flex; 
    width: 100%; 
    align-items: center;
    flex-wrap: wrap;
    gap: 3px;                
    min-width: 0;
}
.ui-top-row { justify-content: flex-start; }
.ui-bottom-row { justify-content: stretch; }
.ui-bottom-row .vending-display { flex: 1 1 100%; }

/* スコアボックス */
.score-box { 
    flex: 1 1 0;             
    min-height: 36px;        
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center; 
    background: #fff; 
    padding: 2px; 
    border-radius: 6px; 
    border: 2px solid #ffb3c6; 
    font-weight: bold;
    color: #ff4d6d;
    box-shadow: 0 1.5px 0 #ffb3c6; 
    font-size: clamp(7px, 1.5vw, 9px);
    white-space: nowrap;
    line-height: 1.1;
}
#p2-section .score-box {
    border-color: #90e0ef;
    color: #0077b6;
    box-shadow: 0 1.5px 0 #90e0ef;
}
.score-box .score-num {
    display: block;
    font-size: clamp(11px, 3.2vw, 16px); 
    font-weight: 900;
    color: #ff4d6d;
    line-height: 1.0;
}
#p2-section .score-box .score-num { color: #0077b6; }

/* 目標ディスプレイ */
.vending-display { 
    flex: 1 1 100%;          
    min-width: 0;
    min-height: 36px;        
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center; 
    background: #fffdf0; 
    padding: 2px; 
    border-radius: 6px; 
    border: 2px solid #ff9f1c; 
    box-shadow: 0 1.5px 0 #e76f51; 
    font-weight: bold;
    color: #e76f51;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#p2-section .vending-display {
    border-color: #90e0ef;
    color: #0077b6;
    box-shadow: 0 1.5px 0 #90e0ef;
}
.vending-display::before {
    display: none;
}
.vending-display .price-label {
    display: block;
    width: 100%;
    font-size: clamp(12px, 3vw, 15px);
    font-weight: 900;
    line-height: 1.1;
}
#p2-section .vending-display .price-label { color: #0077b6; }

/* プログレスバー */
.progress-bar-bg { 
    width: 100%;
    height: 6px;             
    background: #eee; 
    border-radius: 4px; 
    overflow: hidden; 
    border: 1px solid #ffb3c6; 
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.1);
    flex-shrink: 0;
}
#p2-section .progress-bar-bg { border-color: #90e0ef; }

.progress-bar-fill { 
    width: 0%; 
    height: 100%; 
    background: linear-gradient(90deg, #ff758c 0%, #ff7eb3 100%); 
    transition: width 0.2s; 
    border-radius: 4px;
}
.progress-bar-fill.ready { 
    background: linear-gradient(90deg, #4edb8a 0%, #2ecc71 100%); 
    box-shadow: 0 0 6px #2ecc71; 
    animation: rainbow-pulse 1.5s infinite alternate;
}
@keyframes rainbow-pulse {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(30deg) saturate(1.2); }
}

/* ============================================================
   🛍️ 精算ゲージ（旧・バーストゲージのDOMを再利用）
   ------------------------------------------------------------
   両替済み合計(p.current)が目標額(p.target)にどれだけ近いかを示す。
   「いつ自動精算されるか」「あと¥いくらか」を先読みできるようにする、
   見た目だけのゲージ（判定は従来どおり game.js 側のロジックが握る）。
   旧COMBOゲージは役目を失って表示なしになっていた同じ要素を、
   別の意味を持つゲージとして再利用している。
============================================================ */
.burst-bar-bg {
    display: none;
}
.burst-bar-bg.checkout-gauge {
    display: block;
    position: relative;
    width: 100%;
    height: 13px;
    border-radius: 7px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.14);
    border: 1px solid rgba(0, 0, 0, 0.08);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
    margin-top: 2px;
}
.checkout-gauge-fill {
    border-radius: 7px;
    transition: width 0.25s ease-out;
}
.checkout-gauge-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(9px, 2.6vw, 11px);
    font-weight: 900;
    color: #5c3a00;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
    letter-spacing: 0.2px;
    white-space: nowrap;
    pointer-events: none;
}
#p2-section .checkout-gauge-label { color: #023e6b; }

/* 画面が低い端末（3ボタンナビ機種等）では、サイドバーの縦幅がさらに
   厳しくなるため、ゲージも一段薄くする（ラベルはclamp()で自然に小さくなる）。 */
@media (max-height: 640px) {
    .burst-bar-bg.checkout-gauge { height: 9px; margin-top: 1px; }
}

/* あと少しで自動精算が発動するライン（0.85以上）：見逃さないよう軽く明滅させる。
   速さを煽らないよう、点滅はゆっくりめにしてある。 */
.checkout-gauge.is-near .checkout-gauge-fill {
    animation: checkout-near-pulse 0.7s ease-in-out infinite alternate;
}
@keyframes checkout-near-pulse {
    from { filter: brightness(1); }
    to   { filter: brightness(1.4) saturate(1.3); }
}

/* ============================================================
   🚪 乱入コード
   ------------------------------------------------------------
   ソロプレイ中、誰かがこの番号で乱入してこられることを常時示すバー。
   精算ゲージのすぐ下・盤面のすぐ上に置く（raid.jsがdisplayを切り替える）。
============================================================ */
.raid-code-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 5px 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%);
    box-shadow: 0 4px 0 #0f766e;
    flex-shrink: 0;
    margin-top: 2px;
}
.raid-code-bar .raid-code-label {
    font-size: clamp(9px, 2.6vw, 11px);
    font-weight: 900;
    color: #fff;
    white-space: nowrap;
}
.raid-code-bar .raid-code-numbers {
    font-size: clamp(14px, 4vw, 18px);
    font-weight: 900;
    color: #fff;
    letter-spacing: 3px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}

/* ============================================================
    4. キャンバスエリア（UIが極限まで縮んだ分、さらにワイドに拡張！）
============================================================ */
.canvas-container{
    flex:1;
    position:relative;
    width:100%;
    min-height:0;

    background:
        radial-gradient(circle at 20% 20%,rgba(255,255,255,.35),transparent 30%),
        radial-gradient(circle at 80% 80%,rgba(255,255,255,.2),transparent 35%),
        repeating-linear-gradient(
            90deg,
            #d9bb8c 0px,
            #d9bb8c 8px,
            #d2b17d 10px,
            #c89f6a 18px,
            #d9bb8c 26px
        );

    overflow:hidden;
    display:flex;
    justify-content:center;
    align-items:center;
    box-shadow:
    0 12px 25px rgba(0,0,0,.28),
    inset 0 0 15px rgba(255,255,255,.25);
}

#p2-section .canvas-container{
    background:
        radial-gradient(circle at 20% 20%,rgba(255,255,255,.35),transparent 30%),
        radial-gradient(circle at 80% 80%,rgba(255,255,255,.2),transparent 35%),
        repeating-linear-gradient(
            90deg,
            #cfd5bf 0px,
            #cfd5bf 8px,
            #c4caaf 10px,
            #b6bda2 18px,
            #cfd5bf 26px
        );
}

canvas {
    display:block;
    width:auto;
    height:auto;
    max-width:100%;
    max-height:100%;

    aspect-ratio:440 / 600;

    background:#fffdf0;

    border-left:6px solid #ffb3c6;
    border-right:6px solid #ffb3c6;

border-top:3px solid #ffb3c6;
border-bottom:3px solid #ffb3c6;

    box-sizing:border-box;
}

#p2-section canvas {
    transform:rotate(180deg);
    transform-origin:center center;

    border-left-color:#90e0ef;
    border-right-color:#90e0ef;

    border-top-color:#90e0ef;
    border-bottom-color:#90e0ef;
}

.info-label { 
    position: absolute; 
    bottom: 6px;
    left: 6px;
    background: rgba(255,255,255,0.95); 
    padding: 4px 8px; 
    /* 文字を減らしてアイコン＋数字だけにしたので、その分大きく読みやすく */
    font-size: clamp(12px, 3.4vw, 16px);
    letter-spacing: 0.5px;
    z-index: 50; 
    border-radius: 10px; 
    pointer-events: none; 
    border: 2px solid #ff4d6d; 
    color: #ff4d6d;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    white-space: nowrap;
    max-width: calc(100% - 52px);
    overflow: hidden;
    text-overflow: ellipsis;
}
#p2-section .info-label {
    border-color: #0077b6;
    color: #0077b6;
}

.flash { 
    position: absolute; 
    inset: 0; 
    background: white; 
    opacity: 0; 
    pointer-events: none; 
    z-index: 150; 
}

/* ============================================================
   オーバーレイ共通（メニュー・リザルト等）
============================================================ */
.overlay {
    position: fixed;
    inset: 0;
    /* タイトルと同じ世界観のグラデーション背景 */
    background:
        radial-gradient(circle at 20% 20%, rgba(200,238,255,0.9) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,228,240,0.9) 0%, transparent 50%),
        linear-gradient(160deg, #c8eeff 0%, #daf3ff 35%, #fff0fa 70%, #ffe4f0 100%);
    background-image:
        radial-gradient(circle, #b8d8ea 1.5px, transparent 1.5px),
        radial-gradient(circle, #f4c5cc 1.5px, transparent 1.5px),
        radial-gradient(circle at 20% 20%, rgba(200,238,255,0.6) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,228,240,0.6) 0%, transparent 50%),
        linear-gradient(160deg, #c8eeff 0%, #daf3ff 35%, #fff0fa 70%, #ffe4f0 100%);
    background-size: 36px 36px, 36px 36px, 100% 100%, 100% 100%, 100% 100%;
    background-position: 0 0, 18px 18px, 0 0, 0 0, 0 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 16px;
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    overflow-y: auto;
}

#result-screen{
    background:
        radial-gradient(circle, #b8d8ea 1.5px, transparent 1.5px),
        radial-gradient(circle, #f4c5cc 1.5px, transparent 1.5px),
        linear-gradient(160deg, #c8eeff 0%, #daf3ff 35%, #fff0fa 70%, #ffe4f0 100%) !important;
    background-size: 36px 36px, 36px 36px, 100% !important;
    background-position: 0 0, 18px 18px, 0 0 !important;
    backdrop-filter: none !important;
    display:flex;
    /* ⚠️ 2026-08: リプレイボタンが増えて縦に長くなった分、justify-content:center のままだと
       小さい画面で中身の上側が画面外に出た状態でスタートしてしまい（centerのまま
       overflowすると上下が均等にはみ出す）、下のボタン（もう一度／タイトルへ）まで
       たどり着けないという報告があった。そこで一旦 flex-start（上寄せ）にしていたが、
       今度は逆に、画面に収まる普通の高さでも常に上寄せになり、画面下半分が
       ぽっかり空く見た目になっていた。
       "safe center" は、収まる時は中央寄せ・収まりきらない時だけ start 相当に
       フォールバックしてくれるので、両方のケースをこれ1つで満たせる。
       .overlay 側の overflow-y:auto は、フォールバック時に続きへスクロールする
       ためそのまま残す。 */
    justify-content:safe center;
    align-items:center;
    padding-top: max(28px, calc(env(safe-area-inset-top, 0px) + 16px));
    /* ⚠️ 2026-08: 買った商品が多いと.result-items-titleの画像グリッドが伸びて
       カードが縦に長くなり、フォールバックのstart寄せ＋overflow-y:autoで
       下端までスクロールしても、最後の「タイトルへ」ボタンが3ボタン
       ナビゲーション機種のナビバーの真下に来て押せなくなっていた。
       .overlayにはこの余白が無く、bodyのpadding-bottomは position:fixed の
       .overlayには効かない。--safe-area-bottom（env()がAndroidで信用できない
       場合の26px保険込み）をここにも足し、スクロールの下限に余白を確保する。 */
    padding-bottom: var(--safe-area-bottom);
}

.result-window{
    background:#fffdf8;
    border-radius:24px;
    padding:24px 32px;
    box-shadow:0 10px 30px rgba(0,0,0,.35);

    max-width:380px;
    width:90%;
    box-sizing:border-box;
    text-align:center;
    display:flex;
    flex-direction:column;
    align-items:center;
}

.result-window .menu-btn {
    width: 100%;
    max-width: 280px;
}

/* ============================================================
   📼 やられたリプレイ：結果画面から開く振り返りオーバーレイ
   ⚠️ 2026-08: 「盤面だけ」から「対戦画面まるごと」の再現に変更。
   小さな専用カードを自作するのではなく、実プレイの#main-layoutと同じ
   .player-section / .canvas-container / グローバルcanvasルールを
   そのまま再利用する（id違いの複製要素なので.player-sectionのCSSが
   そのまま効く。中身の数値はJS側でrender.jsが毎フレーム書き込む）。
============================================================ */
.death-replay-title {
    font-size: clamp(16px, 5vw, 20px);
    font-weight: 900;
    color: #5c3a00;
    margin-bottom: 6px;
    flex-shrink: 0;
}
#death-replay-layout {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 380px;
    height: min(66vh, 560px);
    gap: 6px;
    flex-shrink: 1;
    min-height: 0;
}
/* 🥊 相手側の盤面canvasだけは実プレイの#p2-section canvasと同じく
   180度回転＋水色枠にする（テーブルを挟んで向かい合っている見た目）。 */
#dr-p2-section canvas {
    transform: rotate(180deg);
    border-left-color: #90e0ef;
    border-right-color: #90e0ef;
    border-top-color: #90e0ef;
    border-bottom-color: #90e0ef;
}
.death-replay-progress {
    font-size: clamp(12px, 3.5vw, 14px);
    font-weight: 900;
    color: #5c3a00;
    margin: 8px 0;
    flex-shrink: 0;
}

.menu-btn { 
    width: min(280px, 90vw);
    padding: 13px 18px; 
    border-radius: 22px; 
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%); 
    color: white; 
    border: none; 
    font-size: clamp(15px, 4vw, 18px);
    font-weight: 900; 
    cursor: pointer; 
    margin-bottom: 12px; 
    box-shadow: 0 7px 0 #c93b54, 0 9px 18px rgba(255, 117, 140, 0.3); 
    text-shadow: 1px 2px 2px rgba(0,0,0,0.2); 
    transition: transform 0.1s, box-shadow 0.1s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.menu-btn:active { 
    transform: translateY(6px); 
    box-shadow: 0 1px 0 #c93b54, 0 3px 8px rgba(255, 117, 140, 0.3); 
}
.menu-btn:disabled {
    background: #ccc !important;
    box-shadow: 0 7px 0 #999 !important;
    color: #666 !important;
    cursor: not-allowed;
    transform: none !important;
}

/* ⚠️ 2026-09: 文字入力欄向けの見た目。スライダー(range)にまで枠・内側余白・影が
      付いて「100%なのに右に余白がある」ように見えていたので、rangeは除外する。 */
input:not([type="range"]) {
    width: min(250px, calc(90vw - 40px));
    padding: 12px; 
    border-radius: 18px; 
    border: 4px solid #4cc9f0; 
    font-size: clamp(14px, 4vw, 18px);
    font-weight: bold;
    text-align: center; 
    margin-bottom: 12px; 
    background: #fff; 
    color: #333; 
    box-shadow: 0 4px 0 #4895ef;
    outline: none;
}

/* ============================================================
   チュートリアルパネル
============================================================ */
#tutorial-text{
    font-size:clamp(16px,2.5vw,20px);
    line-height:1.6;
    font-weight:700;
}

#tutorial-panel-container {
    position: absolute;
    inset: 0;
    z-index: 600;
    padding: 8px;
    display: none;
    pointer-events: auto;
}
#tutorial-panel {
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(2px); 
    border: 4px solid #ff9f1c;
    border-radius: 16px;
    padding: 14px;
    box-shadow: 0 8px 16px rgba(255, 159, 28, 0.2);
    color: #333;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    overflow-y: auto;
}
#tutorial-text {
    font-size: clamp(16px, 2.5vw, 20px);
    line-height: 1.65;
    font-weight: bold;
    word-break: break-all;   /* 日本語＋英数字両方の折り返しを保証 */
    overflow-wrap: break-word;
    text-align: center;
    max-width: 100%;
}

/* 🔰 チュートリアル ステップ1：「押して離す」を文章ではなく動きで見せる指アイコン */
.tap-hint {
    display: inline-block;
    font-size: clamp(28px, 8vw, 40px);
    animation: tapHintBounce 1s ease-in-out infinite;
}
@keyframes tapHintBounce {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(10px); }
}

#tutorial-success-overlay {
    background: rgba(255, 255, 255, 0.6) !important;
    background-image: none !important;
    backdrop-filter: blur(3px) !important;     
}
#tutorial-success-screen {
    background: linear-gradient(135deg, #52b788 0%, #74c69d 100%); 
    border: 5px solid #fff;
    border-radius: 24px;
    width: min(320px, 92vw);
    padding: 14px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1); 
    color: white;
    max-height: 88vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ============================================================
   🏠 ホームボタン（修正版）
============================================================ */

#home-btn{
    flex: 1;
    height: 48px;          /* 32→48 */
    background: #fff;
    border: 2px solid #4cc9f0;
    border-radius: 10px;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 28px;       /* 16→28 */
    cursor: pointer;

    box-shadow: 0 3px 0 #4cc9f0;
    flex-shrink: 0;
}



.ui-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

/* ゲームエリア（スコアやキャンバスなど） */
#game-content {
    flex: 1; /* 残りのスペースを全て占有 */
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

 /* ============================================================
   🎮 ゲーム説明パネル（SOLOモード用）
============================================================ */
#solo-explanation-panel{

    display:none;

    position:fixed !important;

    top:50%;
    left:50%;

    transform:translate(-50%,-50%);

    width:min(90vw,420px);

    max-height:80vh;

    overflow-y:auto;

    background:#fff;

    border:4px solid #ff9f1c;

    border-radius:16px;

    box-shadow:0 8px 30px rgba(0,0,0,.35);

    z-index:99999 !important;

    padding:16px;
}

.explanation-title {
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 900;
    color: #ff4d6d;
    margin-bottom: 12px;
    text-shadow: 2px 2px 0px #ffe5ec;
}

.explanation-item {
    background: rgba(255, 255, 255, 0.7);
    border: 3px solid #4cc9f0;
    border-radius: 14px;
    padding: 10px; /* 余白を少し詰める */
    margin-bottom: 8px;
    font-size: clamp(10px, 2.5vw, 12px); /* 👈ここを調整：最小10pxまで小さくする */
    color: #333;
    font-weight: bold;
    line-height: 1.4; /* 行間を少し詰める */
    display: flex;
    align-items: center;
    gap: 8px;
}

.explanation-emoji {
    font-size: clamp(10px, 5vw, 12px); /* 絵文字も少し小さくしてバランスをとる */
    flex-shrink: 0;
}

.explanation-text {
    text-align: left;
    flex: 1;
}

/* ============================================================
   📱 スマホ向け調整（480px 以下）
============================================================ */
@media (max-width: 480px) {
    #main-layout {
        padding: 4px;
        /* ⚠️ 2026-08: 以前はここで padding-top: max(50px, var(--safe-area-top))
           を指定していたが、body側で既に padding-top: var(--safe-area-top)
           を適用済みだったため、状態バー分の余白が二重に加算されていた
           （実測：状態バー高さ+50px＝最大80px近い無駄な余白）。
           実機で画面上部に不自然な空きがあり、下端がナビゲーションバーに
           隠れる原因の一端になっていた。safe-areaの適用はbody側の1箇所に
           統一し、ここでは追加しない。 */
        gap: 4px;
    }
    .player-section {
        border-width: 3px;
        border-radius: 14px;
    }
    .ui-container {
        gap: 4px;
        padding: 4px;
    }
    .vending-display::before {
        font-size: 14px;
        top: -10px;
        left: -6px;
    }
}

/* 超小型画面（360px 以下）*/
@media (max-width: 360px) {
    .vending-display::before { display: none; }
    .ui-row { gap: 3px; }
}

/* =========================
   ソロモード
========================= */

body.solo-mode #p1-section{
    display:flex;
    flex-direction:column;
    height:100%;
}

body.solo-mode #p1-section .ui-container{

    width:100%;

    display:grid !important;

    grid-template-columns:1fr;

    grid-template-rows:
        auto
        auto;

    gap:4px;

    padding:4px 6px;

    border-right:none;

    border-bottom:2px solid #ffb3c6;
}

/* ホームボタン＋ポイント＋支払い待ちコイン（1行目・全幅） */
body.solo-mode #p1-section .pm-home-row{
    grid-column:1;
    grid-row:1;
}

body.solo-mode .score-box{
    min-width:60px;
}

/* タイマー＋商品画像（2行目・全幅） */
body.solo-mode #p1-section .pm-timer-image-row{
    grid-column:1;
    grid-row:2;
}

body.solo-mode #p1-battle-timer{
    font-size:18px;
    font-weight:bold;
}

/* 商品画像 */
body.solo-mode #p1-image-box{
    /* ⚠️ 2026-08: 商品枠が大きく、上部UIが縦に張り出してプレイエリアが
       狭く見えるとの指摘。候補サムネイルと合わせて薄くする。 */
    width:56px;
    height:56px;
    flex:0 0 auto;
    transform-origin: center center;
    will-change: transform;
}

body.solo-mode #p1-item-image{

    width:70px;
    height:70px;

    object-fit:contain;
}

/* ゲージ */
body.solo-mode .progress-bar-bg{
    grid-column:1;
}

body.solo-mode #p1-burst-box{
    grid-column:1;
}

/* 盤面最大化 */
body.solo-mode #p1-section .canvas-container{
    flex:1;
    min-height:0;
}

#help-close-btn{

        width:52px;
    height:52px;
    font-size:32px;
    position:absolute;
    top:10px;
    right:10px;


    display:flex;
    align-items:center;
    justify-content:center;

    border-radius:50%;

    background:#ff9f1c;
    color:#fff;

    font-size:22px;
    font-weight:bold;

    cursor:pointer;
}
/* ============================================================
    13. JS生成コンテンツ用クラス（チュートリアル成功演出 / リザルト / ランキング）
    ※ コード品質改善：従来 JS 側に直書きされていたインラインstyleを集約
============================================================ */

/* --- チュートリアル成功カード --- */
.tutorial-success-card {
    padding: 12px;
    border-radius: 16px;
    margin-bottom: 8px;
    border: 3px solid #fff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    color: #fff;
}
.tutorial-success-card.center {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
}
.tutorial-success-card.simple {
    padding: 20px;
    border-radius: 10px;
    border: none;
    box-shadow: none;
    margin-bottom: 0;
}
.tutorial-success-card.accent-blue   { background: #4cc9f0; }
.tutorial-success-card.accent-red    { background: #e71d36; }
.tutorial-success-card.accent-orange { background: #ff9f1c; }

.tutorial-success-card .ts-title {
    font-size: clamp(18px, 4vw, 28px);
    font-weight: 900;
    text-align: center;
    margin-bottom: 6px;
}
.tutorial-success-card .ts-title.large {
    font-size: clamp(18px, 4vw, 28px);
}
.tutorial-success-card .ts-body {
    margin-top: 6px;
    font-size: clamp(14px, 3.5vw, 20px);
    line-height: 1.6;
    font-weight: 700;
}

/* --- リザルト画面：スコア・統計バッジ --- */
.result-score-line {
    font-size: clamp(14px, 4vw, 20px);
    font-weight: 900;
    color: #ff9f1c;
}
.result-stats-row {
    display: flex;
    gap: 8px;
    justify-content: center;
    align-items: center;
    margin-top: 8px;
    flex-wrap: wrap;
    width: 100%;
    max-width: 100%;
}
.result-stats-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    width: 100%;
    max-width: 100%;
}
.result-stats-col .result-stat-badge {
    width: fit-content;
    max-width: 90%;
}
.result-stat-badge {
    border-radius: 12px;
    padding: 4px 8px;
    font-size: clamp(10px, 2.6vw, 13px);
    font-weight: bold;
    white-space: nowrap;
    border: 2px solid;
}
.result-stat-badge.merge    { background: #fff0f5; border-color: #ffb3c6; color: #ff4d6d; }
.result-stat-badge.purchase { background: #fff9e6; border-color: #ffd166; color: #e6a800; }
.result-stat-badge.chain    { background: #f3e8ff; border-color: #c77dff; color: #7b2cbf; }
.result-stat-badge.combo    { background: #e8f4fd; border-color: #4cc9f0; color: #0077b6; }

/* --- リザルト画面：「もう一回」を後押しする一言（自己ベストの近さ・次の称号） --- */
.result-nudge {
    margin-top: 6px;
    font-size: clamp(11px, 2.8vw, 14px);
    font-weight: 800;
    color: #666;
    background: #f4f4f4;
    border-radius: 10px;
    padding: 5px 10px;
}
.result-nudge--best {
    color: #b8860b;
    background: #fff8e6;
    border: 2px solid #ffd166;
}

/* --- ランキング一覧 --- */
.ranking-item {
    display: flex;
    align-items: center;
    border-radius: 12px;
    padding: 8px 12px;
    margin-bottom: 6px;
    gap: 10px;
    background: #fff;
    border: 2px solid #eee;
}
.ranking-item.rank-1 { background: #fff9e6; border-color: #ffd166; }
.ranking-item.rank-2 { background: #f5f5f5; border-color: #ccc; }
.ranking-item.rank-3 { background: #fff0f0; border-color: #ffb3c6; }
.ranking-rank  { font-size: 22px; width: 32px; text-align: center; }
.ranking-info  { flex: 1; }
.ranking-score { font-size: 16px; font-weight: 900; color: #ff9f1c; }
.ranking-meta  { font-size: 11px; color: #888; margin-top: 4px; line-height: 1.6; }
.ranking-empty { text-align: center; color: #aaa; padding: 20px; font-size: 14px; }

/* ============================================================
    14. 演出ブラッシュアップ（パネル登場演出 / タイトル演出 / 紙吹雪 など）
============================================================ */

/* --- 汎用：パネルのポップイン登場 --- */
@keyframes panel-pop-in {
    0%   { opacity: 0; transform: scale(0.86) translateY(12px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}
.result-window,
#tutorial-success-screen,
.ranking-panel,
.slide-panel,
#solo-mode-select > button.menu-btn,
#shopping-mode-select > button.menu-btn,
#shopping-mode-select > #resume-btn,
#hoard-mode-select > button.menu-btn,
#hoard-mode-select > #hoard-resume-btn,
#cpu-mode-select > button.menu-btn,
#cpu-mode-select > #cpu-level-panel {
    animation: panel-pop-in 0.38s cubic-bezier(.34,1.56,.64,1) both;
}

/* --- タイトル画面：背景に漂うコイン・キラキラ --- */
#menu-screen.title-screen { overflow: hidden; }
.bg-floaters {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
#menu-screen.title-screen > :not(.bg-floaters):not(.ts-mascot) {
    position: relative;
    z-index: 1;
}
.bg-floaters span {
    position: absolute;
    bottom: -10%;
    font-size: clamp(18px, 5vw, 28px);
    opacity: 0;
    animation-name: floater-rise;
    animation-timing-function: ease-in;
    animation-iteration-count: infinite;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.08));
}
@keyframes floater-rise {
    0%   { transform: translateY(0) rotate(0deg);    opacity: 0; }
    8%   { opacity: 0.6; }
    85%  { opacity: 0.4; }
    100% { transform: translateY(-115vh) rotate(25deg); opacity: 0; }
}

/* --- タイトルロゴ：浮遊 + 光の帯が流れるシャイン演出 --- */
.title-pop {
    animation: panel-pop-in 0.55s cubic-bezier(.34,1.56,.64,1) both;
}
.title-logo {
    color: #ff4d6d;
    background: linear-gradient(100deg, #ff4d6d 30%, #ffd1dc 48%, #ff4d6d 62%);
    background-size: 250% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: title-shine 3.4s ease-in-out infinite, title-float 3s ease-in-out infinite;
    display: inline-block;
}
@keyframes title-shine {
    0%   { background-position: 220% 0; }
    100% { background-position: -60% 0; }
}
@keyframes title-float {
    0%, 100% { transform: rotate(-3deg) translateY(0); }
    50%      { transform: rotate(-3deg) translateY(-6px); }
}

/* --- タイトルのメニューボタン：順番に弾んで登場 --- */
#menu-screen.title-screen > button.menu-btn {
    animation: title-pop-in 0.5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes title-pop-in {
    0%   { opacity: 0; transform: translateY(18px) scale(0.92); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}
#menu-screen.title-screen > button.menu-btn:nth-of-type(1) { animation-delay: .08s; }
#menu-screen.title-screen > button.menu-btn:nth-of-type(2) { animation-delay: .14s; }
#menu-screen.title-screen > button.menu-btn:nth-of-type(3) { animation-delay: .20s; }
#menu-screen.title-screen > button.menu-btn:nth-of-type(4) { animation-delay: .26s; }
#menu-screen.title-screen > button.menu-btn:nth-of-type(5) { animation-delay: .32s; }
#menu-screen.title-screen > button.menu-btn:nth-of-type(6) { animation-delay: .38s; }
#menu-screen.title-screen > button.menu-btn:nth-of-type(7) { animation-delay: .44s; }

/* --- 一番おすすめのボタンにやさしい光のパルス --- */
.cta-glow {
    animation: title-pop-in 0.5s cubic-bezier(.34,1.56,.64,1) both, cta-pulse 1.8s ease-in-out infinite;
}
@keyframes cta-pulse {
    0%, 100% { box-shadow: 0 8px 0 #2a3eb1, 0 0 0px rgba(76,201,240,0.6); }
    50%      { box-shadow: 0 8px 0 #2a3eb1, 0 0 18px rgba(76,201,240,0.9); }
}

/* --- ボタン：PC等ポインタ環境でのホバー演出 --- */
@media (hover: hover) {
    .menu-btn:hover {
        transform: translateY(-2px);
        filter: brightness(1.06);
    }
}

/* --- ゲージ「いまだ！」状態：斜めシマーが流れる --- */
.progress-bar-fill.ready {
    background-image:
        linear-gradient(90deg, #4edb8a 0%, #2ecc71 100%),
        repeating-linear-gradient(45deg, rgba(255,255,255,0.3) 0 8px, transparent 8px 16px);
    background-size: 100% 100%, 28px 28px;
    background-position: 0 0, 0 0;
    animation: rainbow-pulse 1.5s infinite alternate, shimmer-stripe 0.8s linear infinite;
}
@keyframes shimmer-stripe {
    from { background-position: 0 0, 0 0; }
    to   { background-position: 0 0, 28px 0; }
}

/* --- リザルト画面：星評価 --- */
.result-stars {
    display: flex;
    justify-content: center;
    gap: 4px;
    font-size: clamp(26px, 7vw, 36px);
    margin-bottom: 6px;
    line-height: 1;
}
.result-star {
    display: inline-block;
    opacity: 0;
    filter: grayscale(1) opacity(0.5);
    animation: star-pop-in 0.5s cubic-bezier(.34,1.56,.64,1) both;
}
.result-star.filled {
    filter: none;
    text-shadow: 0 0 10px rgba(255, 209, 102, 0.8);
}
@keyframes star-pop-in {
    0%   { opacity: 0; transform: scale(0.2) rotate(-25deg); }
    70%  { opacity: 1; transform: scale(1.25) rotate(8deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* --- リザルト画面：紙吹雪 --- */
.confetti-layer {
    position: absolute;
    inset: -10% -10% auto -10%;
    height: 0;
    overflow: visible;
    pointer-events: none;
    z-index: 5;
}
.confetti-piece {
    position: absolute;
    top: 0;
    width: 8px;
    height: 14px;
    border-radius: 2px;
    opacity: 0.95;
    animation-name: confetti-fall;
    animation-timing-function: cubic-bezier(.25,.46,.45,.94);
    animation-fill-mode: forwards;
}
@keyframes confetti-fall {
    0%   { transform: translate(0, 0) rotate(0deg);    opacity: 1; }
    100% { transform: translate(var(--drift, 0px), 320px) rotate(var(--spin, 360deg)); opacity: 0; }
}

/* --- オンライン対戦：同時スタートカウントダウン --- */
@keyframes match-countdown-pop {
    0%   { opacity: 0; transform: scale(0.3) rotate(-12deg); }
    55%  { opacity: 1; transform: scale(1.25) rotate(4deg); }
    100% { opacity: 1; transform: scale(1) rotate(0deg); }
}
#match-countdown-text.pop {
    animation: match-countdown-pop 0.35s cubic-bezier(.34,1.56,.64,1) both;
}

/* --- 動きを好まない人向け配慮 --- */
@media (prefers-reduced-motion: reduce) {
    .bg-floaters, .title-logo, .menu-btn, .cta-glow, .result-star,
    .confetti-piece, .progress-bar-fill.ready, .result-window,
    #tutorial-success-screen, .ranking-panel, .slide-panel, .title-pop,
    #match-countdown-text.pop {
        animation: none !important;
    }
}

/* ============================================================
   🎚️ 音の大きさパネルのスライダー
   ブラウザ標準のスライダー（色も標準の青のまま）。
   値の分だけ色が付くので、100%ならつまみが右端まで行く。
============================================================ */
#audio-setting-overlay input[type="range"] {
    width: 100%;
    margin: 6px 0 2px;
    cursor: pointer;
}

/* ============================================================
   🖼️ プレイエリア背景設定パネル（タイトル画面）スライダー
============================================================ */
#title-bg-alpha-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 4px;
    background: linear-gradient(90deg, #b7e4c7 0%, #2d6a4f 100%);
    outline: none;
    cursor: pointer;
}
#title-bg-alpha-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #52b788;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    cursor: pointer;
}
#title-bg-alpha-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid #52b788;
    cursor: pointer;
}

/* ============================================================
   🛒 purchase_manager.css — 支払い待ちエリア & 購入演出
   ============================================================ */

/* ── ホームボタン＋ポイント＋支払い待ちエリアの横並び行 ── */
.pm-home-row {
    display: flex;
    align-items: stretch;
    gap: 4px;
    width: 100%;
}

/* 🏠＋ポイントをまとめる列（既定＝対戦中）
   ⚠️ 2026-08: 以前は width:100% だった潜在バグ（flex-basis:autoがwidthの
   値を使うため、隣の#p1-payment-areaがほぼ0幅まで押しつぶされていた）を
   64px固定に直した。案内役キャラは #p1-payment-area 側にはみ出す形で
   重ねるため、この列自体のサイズは元のままでよい。 */
.pm-home-score-col {
    display: flex;
    flex-direction: column;
    flex: 0 0 auto;
    width: 64px;
    position: relative; /* 🏠バッジ(.home-btn-badge)の基準位置 */
}
.pm-home-score-col #home-btn {
    flex: 0 0 auto;
    width: 100%;
    height: 48px;
}

/* 🏠ボタンに「押すと何か見られる」を伝える案内バッジ。
   ⚠️ 2026-08: 🏠は見た目が「終了ボタン」に見えるため、実際は
   遊び方が見られるポーズパネルが開くにもかかわらず、初見プレイヤーが
   押すのをためらう（＝終了すると誤解する）ことが判明した。
   文言を増やす代わりに、「ここに何かある」を示す小さな？バッジを
   ゆっくり脈打たせて視線を誘導する。一度でも🏠を押して中身を見た
   プレイヤーには（toggleHelp側でlocalStorageへ記録し）二度と出さない。 */
.home-btn-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #ff4d6d;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 2px 0 #c9184a;
    pointer-events: none;
    animation: home-btn-badge-pulse 1.6s ease-in-out infinite;
    z-index: 5;
}
@keyframes home-btn-badge-pulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.22); }
}
.pm-home-score-col .score-box {
    flex: 0 0 auto;
    width: 100%;
    min-height: 36px;
}

/* 画面が低い端末（3ボタンナビ機種等）：対戦(非ソロ)のホームボタンは
   ソロモード（後述、32px）より大きい48pxのままだったので、ここでも
   同じ考え方で縮める。ソロ側の body.solo-mode 指定はクラスが1つ多く
   詳細度で常に勝つため、このルールとは干渉しない。 */
@media (max-height: 640px) {
    .pm-home-score-col #home-btn { height: 36px; }
    .pm-home-score-col .score-box { min-height: 30px; }
}

/* ソロモードのみ：🏠＋ポイントを縦2段に積んだ列にする（高さが支払い待ちエリアの基準になる） */
body.solo-mode .pm-home-score-col {
    flex: 0 0 auto;
    gap: 3px;
    width: 60px;
}
body.solo-mode .pm-home-score-col #home-btn {
    width: 100%;
    height: 32px;
}
body.solo-mode .pm-home-score-col .score-box {
    width: 100%;
    min-height: 32px;
}

/* ── 支払い待ちエリア本体 ──
   ソロモードでは左の「🏠＋ポイント」列（2段ぶんの高さ）に揃えてストレッチ。
   コインが増えて2行になっても、この高さの中で折り返す／必要ならスクロールするだけで、
   プレイエリア（canvas-container）の高さには影響しない。 */
#p1-payment-area {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    padding: 4px 3px;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    align-self: stretch;
    background: rgba(255,255,255,0.55);
    border: 2px solid rgba(200,180,120,0.45);
    border-radius: 10px;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.08);
    align-content: flex-start;
    position: relative;
    overflow: visible;
    transition: border-color 0.3s;
    box-sizing: border-box;
}
body.solo-mode #p1-payment-area {
    max-height: 67px;
    overflow: visible;  /* コイン移動アニメがクリップされないよう */
}

/* 購入演出（コインが商品画像へ飛んでいく間）は高さ固定によるクリップを一時解除 */
#p1-payment-area.pm-area-flying {
    overflow: visible;
}

/* ── タイマー＋商品画像のエリア（既定＝対戦中は元どおり縦並び：画像→タイマー） ── */
.pm-timer-image-row {
    display: flex;
    flex-direction: column;
    width: 100%;
}
.pm-timer-image-row .battle-timer {
    order: 2;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.pm-timer-image-row .vending-display {
    order: 1;
    width: 100%;
}

/* ソロモードのみ：タイマー＋商品画像を横並びにする */
body.solo-mode .pm-timer-image-row {
    flex-direction: row;
    align-items: stretch;
    gap: 4px;
}
body.solo-mode .pm-timer-image-row .battle-timer {
    order: initial;
    flex: 0 0 auto;
    width: 44px;
}
body.solo-mode .pm-timer-image-row .vending-display {
    order: initial;
    flex: 1 1 0;
    min-width: 0;
    width: auto;
}

/* ── コイン1枚アイコン ── */
/* ── コイン1枚 (canvas要素) ── */
.pm-coin {
    display: block;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border-radius: 50%;
    cursor: default;
    user-select: none;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,0.22));
}

/* コイン登場アニメ */
@keyframes pm-coin-enter {
    0%   { transform: scale(0.3) translateY(-8px); opacity: 0; }
    65%  { transform: scale(1.18) translateY(2px);  opacity: 1; }
    100% { transform: scale(1)    translateY(0px);  opacity: 1; }
}
.pm-coin--enter {
    animation: pm-coin-enter 0.28s cubic-bezier(.34,1.56,.64,1) both;
}

/* コイン吸収(飛翔)アニメ */
@keyframes pm-coin-fly {
    0%   { transform: translate(0,0) scale(1);    opacity: 1; }
    50%  { transform: translate(calc(var(--dest-x)*0.55), calc(var(--dest-y)*0.45)) scale(1.15); opacity: 0.9; }
    100% { transform: translate(var(--dest-x), var(--dest-y)) scale(0.2); opacity: 0; }
}
.pm-coin-fly {
    animation: pm-coin-fly 0.42s cubic-bezier(.55,.06,.68,.19) both;
    pointer-events: none;
}

/* 旧 pm-glow-* → TAM(tam-glow-*)に統合済み */

/* ── 購入成立: 商品フラッシュ ── */
/* ⚠️ 以前は 0.55秒で2回ピーク（毎秒3.6回相当）だった。
   光過敏性発作の指針は毎秒3回まで。商品画像は画面のごく一部なので
   指針上の危険域ではないが、余裕を持たせて単峰にする。見た目の派手さは
   ズームとヒットストップ側で補う。 */
@keyframes pm-item-flash {
    0%   { filter: brightness(1); transform: scale(1); }
    22%  { filter: brightness(1.9) saturate(1.8); transform: scale(1.08); }
    100% { filter: brightness(1); transform: scale(1); }
}
.pm-item-flash {
    animation: pm-item-flash 0.55s ease-in-out both;
}

/* スパークルオーバーレイ（疑似要素でキラキラ表現） */
@keyframes pm-sparkle-rotate {
    0%   { opacity: 0; transform: scale(0.6) rotate(0deg); }
    30%  { opacity: 1; }
    100% { opacity: 0; transform: scale(1.5) rotate(180deg); }
}
#p1-image-box.pm-item-sparkle::after {
    content: '✨✨✨';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    letter-spacing: 2px;
    pointer-events: none;
    animation: pm-sparkle-rotate 1.1s ease-out both;
}

/* ── 購入済み: 画像を緑縁に ── */
.pm-item-bought #p1-item-image,
.pm-item-bought .vending-display {
    border: 3px solid #52b788 !important;
    box-shadow: 0 0 16px 6px rgba(82,183,136,0.55) !important;
    transition: border 0.2s, box-shadow 0.2s;
}

/* ── 「買えたよ！」バッジ ── */
.pm-bought-badge {
    display: none;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.82);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 900;
    color: #2d6a4f;
    letter-spacing: 0.5px;
    backdrop-filter: blur(2px);
    z-index: 10;
}
@keyframes pm-badge-in {
    0%   { transform: scale(0.5) translateY(6px); opacity: 0; }
    70%  { transform: scale(1.1) translateY(-2px); opacity: 1; }
    100% { transform: scale(1)   translateY(0);    opacity: 1; }
}
@keyframes pm-badge-out {
    0%   { transform: scale(1);   opacity: 1; }
    100% { transform: scale(0.8); opacity: 0; }
}
.pm-bought-badge--show { animation: pm-badge-in  0.32s cubic-bezier(.34,1.56,.64,1) both; }
.pm-bought-badge--hide { animation: pm-badge-out 0.4s  ease-in both; }

/* ── スコアへ飛ぶコインアニメ ── */
.pm-score-fly-coin {
    position: fixed;
    width: 36px;
    height: 36px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    will-change: transform, opacity;
    border-radius: 50%;
}
@keyframes pm-score-fly {
    0%   { transform: translate(-50%,-50%) scale(1);   opacity: 1; }
    60%  { opacity: 1; }
    100% { transform: translate(calc(-50% + var(--fly-dx)), calc(-50% + var(--fly-dy))) scale(0.4);
           opacity: 0; }
}
.pm-score-fly-coin--go {
    animation: pm-score-fly 0.55s cubic-bezier(.55,.06,.68,.19) both;
}

/* ── スコア数値のパラパラ変化 ── */
@keyframes pm-score-pop {
    0%   { transform: scale(1);    color: inherit; }
    30%  { transform: scale(1.35); color: #ffd166; }
    70%  { transform: scale(1.15); color: #ff9f1c; }
    100% { transform: scale(1);    color: inherit; }
}
.pm-score-pop {
    display: inline-block;
    animation: pm-score-pop 0.65s ease-out both;
}

/* 旧 pm-glow-near等→TAM統合済み */

/* ── おかいものだい / てんすう ラベル ── */
#p1-score-label {
    font-size: inherit;
    font-weight: inherit;
}

/* ── 商品画像：枠内に収まるよう統一 ── */
#p1-item-image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    margin: 0 auto;
}

/* ── スコアラベル購入フィードバック ── */
@keyframes pm-score-label-pop {
    0%   { color: inherit; transform: scale(1); }
    35%  { color: #ff9f1c; transform: scale(1.25); }
    70%  { color: #ffd166; transform: scale(1.1); }
    100% { color: inherit; transform: scale(1); }
}
#p1-score-label.pm-score-label-pop {
    display: inline-block;
    animation: pm-score-label-pop 0.65s ease-out both;
}

/* ============================================================
   🛍️ 購入成立オーバーレイ（プレイエリア全体）
   ============================================================ */

.purchase-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 9000;
    opacity: 0;
}

/* ── バッグアイコン（商品画像の下に添える控えめな彩り。主役は商品画像に譲る） ── */
.purchase-overlay__bag {
    position: absolute;
    top: 50%; left: 50%;
    margin-top: calc(clamp(120px, 42vw, 220px) / 2 - 6px);
    font-size: clamp(40px, 10vw, 58px);
    line-height: 1;
    filter: drop-shadow(0 0 14px rgba(255,200,0,0.9)) drop-shadow(0 6px 10px rgba(0,0,0,0.35));
    transform: translate(-50%, 0) scale(0.1) rotate(-40deg);
    opacity: 0;
}

/* ── 買った商品の写真そのものを主役として大きく見せる ── */
.purchase-overlay__item-image {
    position: absolute;
    top: 50%; left: 50%;
    width: clamp(120px, 42vw, 220px);
    height: clamp(120px, 42vw, 220px);
    object-fit: contain;
    border-radius: 24px;
    background: radial-gradient(circle, #fffef0 0%, #fff6d9 100%);
    box-shadow: 0 0 0 6px #ffd700, 0 0 40px 14px rgba(255,210,0,0.75), 0 10px 24px rgba(0,0,0,0.35);
    transform: translate(-50%, -50%) scale(0.1) rotate(-18deg);
    opacity: 0;
}

/* ── 「GET!」バッジ：商品画像の右肩に弾けて出る ── */
.purchase-overlay__get-badge {
    position: absolute;
    top: 50%; left: 50%;
    margin-top: calc(-1 * clamp(120px, 42vw, 220px) / 2 - 6px);
    margin-left: calc(clamp(120px, 42vw, 220px) / 2 - 30px);
    background: linear-gradient(145deg, #ff6b9d, #ff3d7f);
    color: #fff;
    font-weight: 900;
    font-size: 20px;
    padding: 6px 14px;
    border-radius: 999px;
    border: 3px solid #fff;
    box-shadow: 0 4px 0 #c2185b, 0 6px 14px rgba(0,0,0,0.3);
    transform: scale(0) rotate(20deg);
    opacity: 0;
    white-space: nowrap;
}

/* ── テキストは非表示（Canvas側でspawnPurchasePopupが担当） ── */
.purchase-overlay__text {
    display: none;
}

/* ── 星パーティクル ── */
.purchase-overlay__stars {
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.purchase-overlay__stars::before,
.purchase-overlay__stars::after {
    content: '🌟⭐💫✨🌟⭐💫✨🌟⭐';
    position: absolute;
    inset: 0;
    display: flex;
    flex-wrap: wrap;
    align-content: space-around;
    justify-content: space-around;
    font-size: clamp(22px, 6vw, 36px);
    opacity: 0;
    letter-spacing: 6px;
}

/* ── 背景フラッシュ：まず白く飛ぶ ── */
@keyframes pov-bg-flash {
    0%   { opacity: 0; background: rgba(255,255,255,0); }
    8%   { opacity: 1; background: rgba(255,235,140,0.35); }
    20%  { opacity: 1; background: rgba(255,220,90,0.22); }
    50%  { opacity: 1; background: rgba(255,200,30,0.14); }
    88%  { opacity: 1; background: rgba(255,180,0,0.05); }
    100% { opacity: 0; background: rgba(255,180,0,0); }
}

/* ── バッグ：弾けて登場（商品画像の下に添える控えめな彩り） ── */
@keyframes pov-bag {
    0%   { transform: translate(-50%, 0) scale(0.1) rotate(-40deg); opacity: 0; }
    15%  { transform: translate(-50%, 0) scale(1.3)  rotate(12deg);  opacity: 1; }
    30%  { transform: translate(-50%, 0) scale(0.85) rotate(-6deg);  opacity: 1; }
    45%  { transform: translate(-50%, 0) scale(1.1)  rotate(5deg);   opacity: 1; }
    58%  { transform: translate(-50%, 0) scale(1.0)  rotate(0deg);   opacity: 1; }
    80%  { transform: translate(-50%, 0) scale(1.0)  rotate(0deg);   opacity: 1; }
    100% { transform: translate(-50%, 0) scale(0.4)  rotate(15deg);  opacity: 0; }
}

/* ── 商品画像：本命の主役演出。ドーンと弾んで登場し、じっくり見せてからスッと引く ── */
@keyframes pov-item-image {
    0%   { transform: translate(-50%, -50%) scale(0.1)  rotate(-18deg); opacity: 0; }
    16%  { transform: translate(-50%, -50%) scale(1.25) rotate(8deg);   opacity: 1; }
    30%  { transform: translate(-50%, -50%) scale(0.92) rotate(-4deg); opacity: 1; }
    44%  { transform: translate(-50%, -50%) scale(1.08) rotate(2deg);  opacity: 1; }
    56%  { transform: translate(-50%, -50%) scale(1.0)  rotate(0deg);  opacity: 1; }
    82%  { transform: translate(-50%, -50%) scale(1.0)  rotate(0deg);  opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(0.55) rotate(10deg); opacity: 0; }
}

/* ── GET!バッジ：商品画像に少し遅れてポンッと弾ける ── */
@keyframes pov-badge {
    0%   { transform: scale(0) rotate(20deg); opacity: 0; }
    50%  { transform: scale(0) rotate(20deg); opacity: 0; }
    62%  { transform: scale(1.4) rotate(-8deg); opacity: 1; }
    75%  { transform: scale(0.95) rotate(4deg); opacity: 1; }
    85%  { transform: scale(1.05) rotate(0deg); opacity: 1; }
    100% { transform: scale(1.0) rotate(0deg); opacity: 1; }
}

/* ── テキスト：ドーン！と出る ── */
@keyframes pov-text {
    0%   { transform: scale(0.1)  translateY(40px); opacity: 0; }
    18%  { transform: scale(1.3)  translateY(-8px); opacity: 1; }
    32%  { transform: scale(0.92) translateY(2px);  opacity: 1; }
    48%  { transform: scale(1.06) translateY(-2px); opacity: 1; }
    62%  { transform: scale(1.0)  translateY(0);    opacity: 1; }
    80%  { transform: scale(1.0)  translateY(0);    opacity: 1; }
    100% { transform: scale(0.5)  translateY(-12px);opacity: 0; }
}

/* ── 星：派手に降り注ぐ ── */
@keyframes pov-stars {
    0%     { opacity: 0;   transform: scale(0.5) rotate(-10deg); }
    20%    { opacity: 1;   transform: scale(1.1) rotate(5deg); }
    70%    { opacity: 0.9; }
    100%   { opacity: 0;   transform: scale(1.3) rotate(10deg); }
}

/* ── 発火クラス ── */
.purchase-overlay--fire {
    animation: pov-bg-flash 2.0s ease-out both;
}
.purchase-overlay--fire .purchase-overlay__item-image {
    animation: pov-item-image 2.0s cubic-bezier(.34,1.56,.64,1) both;
}
.purchase-overlay--fire .purchase-overlay__get-badge {
    animation: pov-badge 2.0s cubic-bezier(.34,1.56,.64,1) both;
}
.purchase-overlay--fire .purchase-overlay__bag {
    animation: pov-bag 2.0s cubic-bezier(.34,1.56,.64,1) 0.05s both;
}
.purchase-overlay--fire .purchase-overlay__text {
    animation: pov-text 2.0s cubic-bezier(.34,1.56,.64,1) 0.06s both;
}
.purchase-overlay--fire .purchase-overlay__stars::before {
    animation: pov-stars 2.0s ease-out 0.1s both;
}
.purchase-overlay--fire .purchase-overlay__stars::after {
    animation: pov-stars 2.0s ease-out 0.18s both;
    transform: scale(-1,1);
}

/* ============================================================
   🎉 パーティモード：お買い上げ時の画面フラッシュ演出
   （全モード共通の「過剰なくらいド派手」方針のパーティモード版）
   ============================================================ */
@keyframes party-purchase-flash-kf {
    0%   { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); filter: brightness(1); }
    12%  { box-shadow: inset 0 0 90px 30px rgba(255,220,140,0.45); filter: brightness(1.08); }
    30%  { box-shadow: inset 0 0 80px 24px rgba(255,210,60,0.3); filter: brightness(1.03); }
    100% { box-shadow: inset 0 0 0 0 rgba(255,255,255,0); filter: brightness(1); }
}
@keyframes party-purchase-shake-kf {
    0%, 100% { transform: translate(0, 0); }
    20%      { transform: translate(3px, -2px); }
    40%      { transform: translate(-3px, 1.5px); }
    60%      { transform: translate(2px, 2px); }
    80%      { transform: translate(-2px, -1.5px); }
}
/* ⚠️ 画面の揺れは廃止した。酔いの原因になるうえ、爽快感には寄与していなかった
   （手応えはヒットストップ、派手さは文字の大きさで作る）。
   キーフレーム定義は残してあるので、戻したくなったら animation に足すだけでよい。 */
.party-purchase-flash {
    animation: party-purchase-flash-kf 0.5s ease-out both;
}

/* ============================================================
   🎉 SOLO/CPU/ONLINE共通：お買い上げ時のキャンバス揺れ（パーティ版と統一感を持たせる）
   ============================================================ */
@keyframes purchase-shake-kf {
    0%, 100% { transform: translate(0, 0); }
    20%      { transform: translate(var(--shake-px, 6px), calc(var(--shake-px, 6px) * -0.6)); }
    40%      { transform: translate(calc(var(--shake-px, 6px) * -1), calc(var(--shake-px, 6px) * 0.5)); }
    60%      { transform: translate(calc(var(--shake-px, 6px) * 0.6), calc(var(--shake-px, 6px) * 0.6)); }
    80%      { transform: translate(calc(var(--shake-px, 6px) * -0.6), calc(var(--shake-px, 6px) * -0.5)); }
}
/* ⚠️ 揺れ廃止（酔い対策）。SOLO/CPU/ONLINE 側も同じ方針で揃える。 */
.purchase-shake {
    animation: none;
}

/* ============================================================
   🎆 JACKPOT到達フラッシュ（SOLO/CPU/ONLINE共通）
   ------------------------------------------------------------
   揺れは酔い対策で廃止済みのため、頻度が低く「ここぞ」の瞬間である
   JACKPOT／SUPER JACKPOT到達だけは、光の明滅で決め感を出す。
   通常合体では一切発火しない（render.jsのjustReachedJackpot参照）。
   ============================================================ */
@keyframes jackpot-flash-kf {
    0%   { box-shadow: inset 0 0 0 0 rgba(255,215,0,0); filter: brightness(1); }
    15%  { box-shadow: inset 0 0 60px 22px rgba(255,215,0,0.55); filter: brightness(1.12); }
    40%  { box-shadow: inset 0 0 50px 16px rgba(255,215,0,0.3); filter: brightness(1.04); }
    100% { box-shadow: inset 0 0 0 0 rgba(255,215,0,0); filter: brightness(1); }
}
.jackpot-flash {
    animation: jackpot-flash-kf 0.45s ease-out both;
}
@keyframes jackpot-flash-super-kf {
    0%   { box-shadow: inset 0 0 0 0 rgba(255,215,0,0); filter: brightness(1); }
    12%  { box-shadow: inset 0 0 90px 34px rgba(255,215,0,0.75); filter: brightness(1.22); }
    35%  { box-shadow: inset 0 0 70px 24px rgba(255,180,0,0.4); filter: brightness(1.08); }
    100% { box-shadow: inset 0 0 0 0 rgba(255,215,0,0); filter: brightness(1); }
}
.jackpot-flash-super {
    animation: jackpot-flash-super-kf 0.6s ease-out both;
}

/* p2オーバーレイ */
#p2-purchase-overlay .purchase-overlay__text {
    color: #a0f0ff;
    text-shadow:
        0 0 30px rgba(0,220,255,1),
        0 0 60px rgba(0,160,255,0.8),
        4px 4px 0 #004488,
        -2px -2px 0 #004488;
}



/* ============================================================
   🎨 タイトル画面リデザイン v2
   ============================================================ */

/* ── ベース ── */
#menu-screen.title-screen{
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    box-sizing: border-box;
    position:relative;
    overflow:hidden;
    min-height:100vh;

    display:flex;
    flex-direction:column;
    align-items:center;
    justify-content:center;

    background:
        linear-gradient(
            180deg,
            #fff8d2 0%,
            #ffe889 35%,
            #ffd45c 55%,
            #cfa06b 55%,
            #d9b07b 100%
        ) !important;
}

#menu-screen.title-screen::before{

    content:"";

    position:absolute;

    left:0;
    right:0;
    bottom:0;

    height:45%;

    background:
        repeating-linear-gradient(
            90deg,
            #d8b07a 0px,
            #d8b07a 8px,
            #c9955d 10px,
            #e0bd88 18px,
            #d8b07a 28px
        );

    z-index:0;
}

#menu-screen.title-screen > *:not(.ts-mascot){
    position:relative;
    z-index:2;
}
html,
body{
    min-height:100%;
    background:#d8b07a;
}

#menu-screen.title-screen > button.menu-btn { display: none !important; }

/* ── 背景：浮遊コイン ── */
.ts-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.ts-coin {
    position: absolute;
    font-size: 28px;
    opacity: 0;
    animation: ts-float linear infinite;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.12));
}
.ts-c1 { left:5%;  font-size:22px; animation-duration:10s; animation-delay:0s;   bottom:-10%; }
.ts-c2 { left:18%; font-size:32px; animation-duration:13s; animation-delay:2.5s; bottom:-10%; }
.ts-c3 { left:33%; font-size:20px; animation-duration:11s; animation-delay:5s;   bottom:-10%; }
.ts-c4 { left:50%; font-size:26px; animation-duration:14s; animation-delay:1.2s; bottom:-10%; }
.ts-c5 { left:65%; font-size:30px; animation-duration:12s; animation-delay:3.8s; bottom:-10%; }
.ts-c6 { left:78%; font-size:18px; animation-duration:9s;  animation-delay:6s;   bottom:-10%; }
.ts-c7 { left:88%; font-size:24px; animation-duration:11s; animation-delay:0.8s; bottom:-10%; }
.ts-c8 { left:42%; font-size:20px; animation-duration:15s; animation-delay:7s;   bottom:-10%; }
@keyframes ts-float {
    0%   { transform: translateY(0) rotate(0deg);    opacity: 0; }
    6%   { opacity: 0.65; }
    88%  { opacity: 0.4; }
    100% { transform: translateY(-115vh) rotate(30deg); opacity: 0; }
}

/* ── 左上：認証エリア ── */
.ts-auth {
    position: absolute;
    top: 14px;
    left: 12px;
    z-index: 20;
    background: rgba(255,255,255,0.78);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255,255,255,0.95);
    border-radius: 24px;
    padding: 6px 12px 6px 8px;
    max-width: 190px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}
.ts-auth-hint { font-size: 10px; color: #888; }
.ts-avatar-fallback {
    width: 30px; height: 30px; border-radius: 50%;
    background: #4285F4;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; color: #fff; font-weight: 700; flex-shrink: 0;
}
.ts-auth-name { font-size: 12px; font-weight: 800; color: #333; line-height: 1.2; }
.ts-auth-sub  { font-size: 9px; color: #888; }
.ts-signout-btn {
    border: none; background: rgba(0,0,0,0.06); border-radius: 50%;
    width: 20px; height: 20px; font-size: 11px; color: #999;
    cursor: pointer; flex-shrink: 0; display: flex; align-items: center; justify-content: center;
}

/* ── 右上：横アイコン行 ── */
.ts-icon-row {
    display: none; /* 上部には表示しない */
}

/* 下部アイコン行 */
.ts-icon-row--bottom {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;              /* 5個になっても窮屈にならないよう、入りきらない時は2段に折り返す */
    gap: 6px 8px;
    justify-content: center;
    position: relative;
    z-index: 1;
    margin-top: 10px;
    padding: 0 16px;
}
.ts-icon-btn {
    display: flex; flex-direction: column; align-items: center;
    gap: 3px;
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(8px);
    border: 1.5px solid rgba(255,255,255,0.95);
    border-radius: 14px;
    padding: 8px 10px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(0,0,0,0.09);
    transition: transform 0.12s;
    min-width: 48px;
    flex: 0 0 auto;                /* 5個で詰まっても潰れず、必要な幅を保ったまま折り返す */
}
.ts-icon-btn:active { transform: scale(0.92); }
.ts-icon-btn span { font-size: 20px; line-height: 1; }
.ts-icon-btn small { font-size: 9px; font-weight: 700; color: #555; white-space: nowrap; }

/* ── ロゴエリア ── */
.ts-logo-wrap {
    position: relative;
    z-index: 1;
    margin-top: clamp(18px, 5vw, 30px);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.ts-logo {
    font-size: clamp(30px, 9.5vw, 46px);
    font-weight: 900;
    margin: 0;
    letter-spacing: 2px;
    line-height: 1;
    /* 手書き風・立体テキスト */
    color: #3a8fc9;
    text-shadow:
        0 1px 0 #a8d8f0,
        0 2px 0 #90c8e8,
        0 3px 0 #78b8e0,
        0 4px 0 #60a8d8,
        0 5px 0 #4898d0,
        0 6px 8px rgba(0,80,160,0.22);
    animation: ts-logo-float 3.2s ease-in-out infinite;
    display: inline-block;
}
@keyframes ts-logo-float {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-7px); }
}
/* ロゴ横コイン */
.ts-logo-coin-l, .ts-logo-coin-r {
    position: absolute;
    font-size: 26px;
    top: 6px;
    animation: ts-logo-float 3.2s ease-in-out infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.ts-logo-coin-l { left: -38px; animation-delay: 0.3s; }
.ts-logo-coin-r { right: -38px; animation-delay: 0.6s; }
.ts-logo-sub {
    margin: 3px 0 0;
    font-size: 20px;
    font-weight: 700;
    color: #7ab0cc;
    letter-spacing: 2px;
    text-transform: none;
}

/* ── メインボタン3つ ── */
.ts-main-btns {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;      /* 7px → 14px */
    margin-top:18px;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
}
.ts-btn {
    width: 100%;
    max-width: 330px;
    display: flex;
    align-items: center;
    gap: 12px;
    border: none;
    border-radius: 20px;
    padding: 9px 14px;
    cursor: pointer;
    text-align: left;
    transition: transform 0.1s;
    position: relative;
    overflow: hidden;
}
.ts-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0) 55%);
    border-radius: inherit;
    pointer-events: none;
}
.ts-btn:active { transform: translateY(3px); }
.ts-btn-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 3px rgba(0,0,0,0.15));
}
.ts-btn-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.ts-btn-title {
    font-size: clamp(12px, 3.6vw, 16px);
    font-weight: 900;
    color: #fff;
    letter-spacing: 0px;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
    display: block;
    white-space: normal;
    line-height: 1.25;
}
.ts-btn-desc {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.82);
    display: block;
    letter-spacing: 0.3px;
}
.ts-btn-arrow {
    font-size: 18px;
    font-weight: 900;
    color: rgba(255,255,255,0.7);
    flex-shrink: 0;
    line-height: 1;
}

/* ひとりであそぶ（緑） */
.ts-btn-solo {
    background: linear-gradient(135deg, #6bcf9e 0%, #42b883 45%, #2d9e6b 100%);
    box-shadow: 0 6px 0 #1a6e45, 0 8px 18px rgba(42,120,80,0.30);
}
.ts-btn-solo:active { box-shadow: 0 2px 0 #1a6e45; }

/* CPUとたいせん（青） */
.ts-btn-cpu {
    background: linear-gradient(135deg, #6bbdf0 0%, #4aa8e8 45%, #2880cc 100%);
    box-shadow: 0 6px 0 #1860a0, 0 8px 18px rgba(30,100,190,0.28);
}
.ts-btn-cpu:active { box-shadow: 0 2px 0 #1860a0; }

/* おともだちとたいせん（ピンク赤） */
.ts-btn-online {
    background: linear-gradient(135deg, #ff8fa8 0%, #ff5577 45%, #e02255 100%);
    box-shadow: 0 6px 0 #a01040, 0 8px 18px rgba(200,30,70,0.28);
}
.ts-btn-online:active { box-shadow: 0 2px 0 #a01040; }

/* パーティモード（むらさき×きん） */
.ts-btn-party {
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 45%, #7e22ce 100%);
    box-shadow: 0 6px 0 #55158c, 0 8px 18px rgba(120,30,200,0.28);
}
.ts-btn-party:active { box-shadow: 0 2px 0 #55158c; }

/* 両替モード（オレンジ） */
.ts-btn-hoard {
    background: linear-gradient(135deg, #f6b673 0%, #f4a261 45%, #e07a1f 100%);
    box-shadow: 0 6px 0 #a85d0f, 0 8px 18px rgba(200,110,20,0.28);
}
.ts-btn-hoard:active { box-shadow: 0 2px 0 #a85d0f; }

/* ============================================================
   🎉 パーティモード専用スタイル
============================================================ */
#party-canvas {
    display: block;
    /* 縦長スマホで縦をできるだけ使い切る。100dvh はアドレスバーの出入りで
       高さが変わらないので 100vh より安定する。 */
    /* 確保する高さ = 上部HUD(約104px) + 下のモード切替(48px) + gap/余白(26px)。
       切替ボタンを足したときにここを更新し忘れると、盤面が上にせり上がって
       HUDと重なり、切替ボタンがタップを吸われる（実際に起きた）。
       さらにナビゲーションバー回避で下余白を12px→48pxに広げたぶん(+36px)を加算。 */
    height: min(calc(100dvh - 214px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 780px);
    width: auto;
    aspect-ratio: 480 / 780;
    max-width: 96vw;
    border-radius: 20px;
    background: #fffdf0;
    border: 6px solid #a855f7;
    box-shadow: 0 8px 24px rgba(120,30,200,0.35);
    touch-action: none;
    box-sizing: border-box;
}
#party-game-screen {
    position: fixed;
    inset: 0;
    z-index: 1800;
    background:
        radial-gradient(circle at 20% 20%, rgba(220,180,255,0.55) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255,228,240,0.55) 0%, transparent 50%),
        linear-gradient(160deg, #2a1a40 0%, #3b1f5c 45%, #1f1233 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    overflow: hidden;
    touch-action: none;
    /* ⚠️ targetSdk 35(Android 15)以降はエッジツーエッジが強制され、WebViewが
       ナビゲーションバーの裏まで広がる。3ボタンナビは約48dpあるので、
       画面最下部に置いたモード切替ボタンがバーの下に潜り、
       タッチをOS側に取られて押せなくなっていた（ジェスチャーナビはバーが薄く出にくい）。
       最下部にボタンを置いているのはパーティモードだけなので、ここだけで対処する。

       env() はWebViewが0を返すことがあるため当てにできない。max() を使うことで
       ・env()が効く端末 → 実測値（48前後）
       ・env()が0の端末 → 48px
       のどちらでも48px以上が確保され、二重に空くこともない。 */
    padding-bottom: max(48px, env(safe-area-inset-bottom));
}
.party-player-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.35);
    border-radius: 16px;
    padding: 4px 10px 4px 6px;
    font-size: 12px;
    font-weight: 900;
    color: #fff;
}
.party-player-chip .dot {
    width: 10px; height: 10px; border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px currentColor;
}
@keyframes partyJackpotPulse {
    0%   { transform: scale(0.6); opacity: 0; }
    30%  { transform: scale(1.15); opacity: 1; }
    50%  { transform: scale(1.0); opacity: 1; }
    100% { transform: scale(1.0); opacity: 1; }
}
.party-jackpot-banner {
    animation: partyJackpotPulse 0.5s cubic-bezier(.2,1.4,.4,1) forwards;
}

/* ⚡ タイムセール中の商品バッジ */
@keyframes partySaleFlash {
    0%, 100% { box-shadow: 0 0 6px rgba(255,80,80,0.5); }
    50%      { box-shadow: 0 0 16px rgba(255,200,60,0.95); }
}
#party-item-box.party-sale-active {
    background: linear-gradient(135deg, #ff5e62, #ff9966) !important;
    border-color: #fff !important;
    animation: partySaleFlash 0.6s ease-in-out infinite;
}

/* 🧑‍🤝‍🧑 パーティモード：ロビーの人数選択ステッパー */
.party-count-step-btn {
    width: 40px; height: 40px;
    border-radius: 50%;
    border: 3px solid #d8b4fe;
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    color: #fff;
    font-weight: 900;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 0 #7e22ce;
    transition: transform 0.1s;
}
.party-count-step-btn:active { transform: scale(0.9) translateY(2px); box-shadow: 0 2px 0 #7e22ce; }

/* 💰 パーティモード：ロビーの資産システムON/OFFトグル */
.party-asset-toggle-btn {
    width: 100%;
    padding: 8px 4px;
    border-radius: 14px;
    border: 3px solid #d8b4fe;
    font-weight: 900;
    font-size: 12px;
    cursor: pointer;
    margin-bottom: 10px;
    background: #fff;
    color: #a855f7;
    box-shadow: 0 3px 0 #d8b4fe;
    transition: background 0.15s, color 0.15s;
}
.party-asset-toggle-btn.active {
    background: linear-gradient(135deg, #c084fc 0%, #a855f7 100%);
    border-color: #7e22ce;
    color: #fff;
    box-shadow: 0 3px 0 #7e22ce;
}
.party-asset-toggle-btn:active { transform: scale(0.97); }

/* 🧾 管理費で脱落したプレイヤーのチップ表示 */
.party-player-chip.party-chip-eliminated {
    opacity: 0.5;
    filter: grayscale(0.6);
    text-decoration: line-through;
}

/* 💴 所持金が尽きて自分が脱落した時の所持金表示（控えめに警告色） */
/* 📝 パーティモード：文字のきりのいい改行＋縦長スマホ向けサイズ調整の共通クラス。
   単語の途中で切らず、幅に収まらなければ自然に複数行へ回す。あちこちに同じスタイルを
   書かずに済むよう、長い文言が出る場所はすべてこれを使う。 */
.party-text-wrap {
    max-width: 90vw;
    margin: 0 auto;
    word-break: keep-all;
    overflow-wrap: anywhere;
    line-height: 1.5;
    text-align: center;
}

#party-money-box.party-money-danger {
    border-color: rgba(255,77,109,0.8);
    color: #ff9a9a;
}

/* ⚡ 「まもなくタイムセール」予告中：本番より控えめに、しかし気づけるように点滅させる */
@keyframes partySaleWarningPulse {
    0%, 100% { box-shadow: 0 0 4px rgba(255,209,102,0.4); transform: scale(1); }
    50%      { box-shadow: 0 0 14px rgba(255,209,102,0.9); transform: scale(1.03); }
}
#party-item-box.party-sale-warning {
    background: linear-gradient(135deg, #ffd166, #ff9966) !important;
    border-color: #fff !important;
    animation: partySaleWarningPulse 0.5s ease-in-out infinite;
}


/* ── サブ行 ── */
.ts-sub-row {
    position: relative;
    z-index: 1;
    display: flex;
    gap: 8px;
    margin-top: 10px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0 20px;
}
.ts-sub-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 10px 14px;
    border-radius: 16px;
    border: 2px solid rgba(255,255,255,0.95);
    background: rgba(255,255,255,0.72);
    backdrop-filter: blur(8px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    font-size: 18px;
    cursor: pointer;
    transition: transform 0.1s;
    min-width: 76px;
}
.ts-sub-btn:active { transform: scale(0.93); }
.ts-sub-btn small {
    font-size: 9px;
    font-weight: 700;
    color: #555;
    text-align: center;
    line-height: 1.3;
}

/* ── 下部テキスト ── */

.ts-footer {
    position: relative;
    z-index: 1;
    margin-top: auto;
    padding: 14px 24px calc(env(safe-area-inset-bottom, 0px) + 24px);
    font-size: 10px;
    color: #020c11;
    text-align: center;
    line-height: 1.7;
    font-weight: 600;
}
/* ============================================================
   🎨 各オーバーレイ デザイン統一（商業リリース品質）
   ============================================================ */

/* ── モード選択パネル共通カード ── */
#solo-mode-select .title-pop,
#shopping-mode-select .title-pop,
#hoard-mode-select .title-pop,
#cpu-mode-select .title-pop {
    background: rgba(255,255,255,0.88);
    border-radius: 20px;
    padding: 14px 24px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    backdrop-filter: blur(6px);
    margin-bottom: 20px !important;
}

/* モード選択ボタンを大きく・丸く・立体的に */
#solo-mode-select > button.menu-btn,
#shopping-mode-select > button.menu-btn,
#hoard-mode-select > button.menu-btn,
#cpu-mode-select > button.menu-btn {
    width: min(300px, 88vw);
    padding: 16px 20px;
    font-size: clamp(16px, 4.5vw, 20px);
    border-radius: 28px;
    box-shadow: 0 7px 0 rgba(0,0,0,0.2), 0 10px 20px rgba(0,0,0,0.12);
    letter-spacing: 1px;
    margin-bottom: 14px;
}

/* ── 結果画面ウィンドウ ── */
.result-window {
    background: linear-gradient(160deg, #fff9f0 0%, #fff0fa 100%) !important;
    border: 3px solid rgba(255,200,100,0.5);
    box-shadow: 0 12px 40px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.8) inset !important;
}

/* ── 設定・ランキング・ずかんオーバーレイの内部ウィンドウ ──
   ※ランキング/ずかんは✖ボタン用のラッパーdivを間に挟んでいるため、
   直接の子要素ではなく子孫セレクタで指定する（じゃないとぼかしが効かない） */
#settings-overlay > div,
#ranking-overlay .ranking-panel,
#zukan-overlay .ranking-panel,
#online-menu > div,
#bg-setting-overlay > div {
    backdrop-filter: blur(8px);
}

/* ── オンラインメニューパネル ── */
#online-menu {
    gap: 12px;
}

/* ── スライドオーバーレイ（あそびかた） ── */
#slide-overlay {
    background:
        radial-gradient(circle, #b8d8ea 1.5px, transparent 1.5px),
        radial-gradient(circle, #f4c5cc 1.5px, transparent 1.5px),
        linear-gradient(160deg, #c8eeff 0%, #daf3ff 40%, #fff0fa 100%) !important;
    background-size: 36px 36px, 36px 36px, 100% !important;
    background-position: 0 0, 18px 18px, 0 0 !important;
}

/* ── チュートリアル成功オーバーレイ ── */
#tutorial-success-overlay {
    background: linear-gradient(160deg, rgba(200,255,220,0.97) 0%, rgba(255,255,200,0.97) 100%) !important;
}

/* ── マッチスタートオーバーレイ ── */
#match-start-overlay {
    background: linear-gradient(160deg, rgba(200,238,255,0.98) 0%, rgba(255,228,240,0.98) 100%) !important;
}

/* ── menu-btn タイトル/モード選択用 共通アップグレード ── */
.menu-btn {
    position: relative;
    overflow: hidden;
}
/* ボタン上部の光沢 */
.menu-btn::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 45%;
    background: linear-gradient(180deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0) 100%);
    border-radius: inherit;
    pointer-events: none;
}

/* ── 浮遊コイン背景をオーバーレイにも追加（JS生成） ── */
.overlay-float-coin {
    position: fixed;
    pointer-events: none;
    z-index: 1999;
    font-size: 22px;
    opacity: 0;
    animation: ts-rise linear infinite;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.12));
}

/* ============================================================
   🎮 ソロタイマー→ポイント大表示 & 対戦コインエリア
   ============================================================ */

/* ── ソロ：タイマー非表示 ── */
.pm-battle-timer-p1 { display: block; }  /* 対戦時は表示 */
body.solo-mode .pm-battle-timer-p1 { display: none !important; }

/* ソロ時ホームボタンを大きく */
body.solo-mode .pm-home-score-col #home-btn {
    height: 44px !important;
    font-size: 26px;
}

/* ── 対戦：p2コインエリア ── */
.pm-payment-area-p2 {
    max-height: 36px;
    overflow: hidden;
    border-color: rgba(76,201,240,0.5) !important;
    margin-top: 2px;
}
/* プレイエリアを圧迫しないよう固定高さ */
#p2-payment-area {
    flex-shrink: 0;
    height: 34px;
}

/* ============================================================
   🎬 TransactionAnimationManager CSS
   ============================================================ */

/* ── 1. 予兆：輝きレベル ── */
#p1-image-box.tam-glow-low  { box-shadow: 0 0  8px 2px rgba(255,180,50,0.35) !important; border-color: rgba(255,180,50,0.5) !important; transition: box-shadow 0.4s, border-color 0.4s; }
#p1-image-box.tam-glow-mid  { box-shadow: 0 0 14px 5px rgba(255,140,0,0.55) !important;  border-color: rgba(255,140,0,0.7) !important;  transition: box-shadow 0.3s, border-color 0.3s; }
#p1-image-box.tam-glow-high { box-shadow: 0 0 20px 8px rgba(255,210,30,0.75) !important; border-color: #ffd700 !important; border-width: 3px !important; transition: box-shadow 0.2s; }

/* 90%以上：鼓動アニメ */
@keyframes tam-heartbeat {
    0%,100% { transform: scale(1);    box-shadow: 0 0 18px 6px rgba(255,215,0,0.6); }
    30%      { transform: scale(1.06); box-shadow: 0 0 28px 10px rgba(255,215,0,0.9); }
    60%      { transform: scale(0.98); box-shadow: 0 0 14px 4px rgba(255,215,0,0.5); }
}
#p1-image-box.tam-heartbeat,
body.solo-mode #p1-image-box.tam-heartbeat {
    animation: tam-heartbeat 0.55s ease-in-out infinite !important;
    border-color: #ffd700 !important;
    border-width: 3px !important;
    overflow: visible !important;
}

/* ── 2. コイン移動アニメ ── */
@keyframes tam-coin-move {
    0%   { transform: translate(0,0) scale(1) rotate(0deg);   opacity: 1; }
    20%  { transform: translate(calc(var(--tam-dx)*0.2), calc(var(--tam-dy)*0.1)) scale(1.3) rotate(-15deg); opacity: 1; }
    60%  { transform: translate(calc(var(--tam-dx)*0.7), calc(var(--tam-dy)*0.6)) scale(0.8) rotate(20deg);  opacity: 0.9; }
    100% { transform: translate(var(--tam-dx),var(--tam-dy))  scale(0.15) rotate(45deg); opacity: 0; }
}
.tam-coin-move {
    animation: tam-coin-move 0.5s cubic-bezier(.25,.46,.45,.94) both;
    pointer-events: none;
    position: relative;
    z-index: 100;
    filter: brightness(1.4) drop-shadow(0 0 6px rgba(255,215,0,0.8));
}

/* ── 商品画像フラッシュ（決済確定時） ── */
@keyframes tam-flash {
    0%   { filter: brightness(1); }
    25%  { filter: brightness(2.2) saturate(2); }
    55%  { filter: brightness(1.5) saturate(1.5); }
    100% { filter: brightness(1); }
}
#p1-image-box.tam-flash { animation: tam-flash 0.4s ease-out both; }

/* ── コイン到達時の「カチッ」バウンス ── */
@keyframes tam-coin-hit {
    0%   { transform: scale(1); }
    35%  { transform: scale(1.12); }
    65%  { transform: scale(0.96); }
    100% { transform: scale(1); }
}
#p1-image-box.tam-coin-hit { animation: tam-coin-hit 0.18s ease-out; }

/* ── 3. スコアへの光の粒子 ── */
@keyframes tam-particle {
    0%   { transform: translate(0,0) scale(1); opacity: 1; }
    70%  { opacity: 0.8; }
    100% { transform: translate(var(--tam-pdx),var(--tam-pdy)) scale(0.3); opacity: 0; }
}
.tam-particle {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff, #ffe566, #ffd700);
    box-shadow: 0 0 10px 4px rgba(255,215,0,0.9), 0 0 20px 8px rgba(255,160,0,0.5);
    pointer-events: none;
    z-index: 9999;
    animation: tam-particle 0.7s cubic-bezier(.2,.8,.4,1) both;
}

/* ============================================================
   📘 ずかん（コレクション）
============================================================ */
.zukan-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* 帯見出し（必要コンボ数ごとの区切り）。グリッドの3列すべてを使って幅いっぱいに表示する */
.zukan-band-label {
    grid-column: 1 / -1;
    font-size: 12px;
    font-weight: 900;
    color: #8a6d1f;
    margin: 10px 0 -2px;
    padding-bottom: 4px;
    border-bottom: 2px solid #ffe8a3;
}
.zukan-band-label:first-child { margin-top: 0; }

.zukan-cell {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.zukan-cell--unlocked {
    background: #fff8e6;
    border: 2px solid #ffd166;
    cursor: pointer;
    padding: 4px;
    transition: transform 0.15s ease;
}
.zukan-cell--unlocked:active { transform: scale(0.94); }

.zukan-cell--unlocked img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.zukan-cell-label {
    font-size: 10px;
    font-weight: 900;
    color: #b8860b;
    margin-top: 2px;
}

.zukan-cell--locked {
    background: #eef1f5;
    border: 2px dashed #bbc2cc;
}

.zukan-cell-q {
    font-size: 28px;
    font-weight: 900;
    color: #b0b8c2;
}

.zukan-cell--locked .zukan-cell-label {
    color: #9aa2ac;
}

.zukan-cell-bar {
    width: 70%;
    height: 6px;
    background: #d6dbe2;
    border-radius: 3px;
    overflow: hidden;
    margin-top: 6px;
}

.zukan-cell-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #4cc9f0, #4361ee);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ── 新規登録トースト ── */
.zukan-unlock-toast {
    position: fixed;
    left: 50%;
    top: 18%;
    transform: translate(-50%, -20px) scale(0.85);
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #ffffff, #fff8e6);
    border: 3px solid #ffd166;
    border-radius: 16px;
    padding: 10px 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
    opacity: 0;
    pointer-events: none;
    z-index: 9998;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.zukan-unlock-toast img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
}

.zukan-unlock-toast-text {
    font-size: 13px;
    font-weight: 900;
    color: #ff9f1c;
    line-height: 1.3;
}

.zukan-unlock-toast--show {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
}

/* ==========================================================
   🏠 ポーズパネル（モード別・アイコン主体）
   文字を減らし、絵で伝えるための最小スタイル。
   HTMLは js/ui.js の buildHelpBody() が生成する。
   ========================================================== */
.hp-head {
    display: flex; align-items: center; justify-content: center;
    gap: 8px; margin: 2px 0 12px; font-size: 15px; font-weight: 900; color: #33415c;
}
.hp-badge {
    font-size: 13px; font-weight: 900; color: #fff;
    border-radius: 999px; padding: 4px 11px; white-space: nowrap;
}
.hp-grid {
    display: grid; grid-template-columns: repeat(3, 1fr);
    gap: 8px; margin-bottom: 12px;
}
.hp-card {
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    gap: 4px; padding: 10px 3px 8px;
    background: #f4f8ff; border: 2px solid #dbe6ff; border-radius: 14px;
}
.hp-card .hp-ico { font-size: 30px; line-height: 1; }
.hp-card .hp-lbl { font-size: 13px; font-weight: 900; color: #4a5b7a; text-align: center; line-height: 1.3; }
.hp-card.is-atk  { background: #fff2f5; border-color: #ffc2ce; }
.hp-card.is-atk .hp-lbl { color: #c9184a; }

.hp-more {
    width: 100%; height: 48px; min-height: 48px; margin-bottom: 4px;
    background: #fff; border: 2px dashed #b9c6e0; border-radius: 10px;
    font-family: inherit; font-size: 13px; font-weight: 900; color: #5a6b8c; cursor: pointer;
}

.hp-row { display: flex; gap: 10px; }
.hp-row .hp-btn { margin-top: 0; }

.hp-btn {
    width: 100%; height: 52px; margin-top: 10px; flex: 1;
    display: flex; align-items: center; justify-content: center; gap: 7px;
    border: none; border-radius: 12px; color: #fff; cursor: pointer;
    font-family: inherit; font-size: 17px; font-weight: 900;
}
.hp-btn .hp-bico    { font-size: 22px; line-height: 1; }
.hp-btn.is-save     { background: linear-gradient(135deg, #52b788 0%, #2d6a4f 100%); box-shadow: 0 3px 0 #1b4332; }
.hp-btn.is-exit     { background: #ff4d6d; box-shadow: 0 3px 0 #d63b5b; }
.hp-btn.is-surrender{ background: #ff9f1c; box-shadow: 0 3px 0 #b35c00; }
.hp-btn.is-cancel   { background: #ccc; color: #444; box-shadow: 0 3px 0 #a8a8a8; }

/* 確認画面（タイトルへ戻る／降参） */
.hp-confirm { text-align: center; padding: 6px 0 18px; }
.hp-confirm-ico { font-size: 52px; line-height: 1; margin-bottom: 6px; }
.hp-confirm-ttl { font-size: 19px; font-weight: 900; color: #33415c; margin-bottom: 6px; }
.hp-confirm-sub { font-size: 13px; font-weight: 900; color: #7a869c; }

/* 極端に横の狭い端末（iPhone SE など）では、ポーズパネルのカードを2列に落とす。
   3列のままだとラベルが1文字ずつ折り返って読めなくなるため。 */
@media (max-width: 340px) {
    .hp-grid { grid-template-columns: repeat(2, 1fr); }
    .hp-card .hp-lbl { font-size: 13px; }
}

/* ==========================================================
   🔄 商品チェンジボタン
   商品画像の右下に重ねる。使用済みはグレーにして、
   「買えばまた使える」ことは purchase 演出のあと色が戻ることで伝える。
   ========================================================== */
.change-btn {
    position: absolute;
    right: 3px;
    bottom: 3px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    border: 2px solid #fff;
    border-radius: var(--r-pill, 999px);
    background: linear-gradient(135deg, #4cc9f0 0%, #0077b6 100%);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
    transition: filter 0.15s, transform 0.1s;
}
.change-btn:active { transform: translateY(2px); box-shadow: none; }

/* 使用済み：買うまで戻らない */
.change-btn.is-spent {
    background: #b9c2d0;
    filter: grayscale(1);
    opacity: 0.75;
}

/* 使用済みで押されたときの「だめだよ」の揺れ */
.change-btn.is-denied { animation: changeDeny 0.28s ease; }
@keyframes changeDeny {
    0%, 100% { transform: translateX(0); }
    25%      { transform: translateX(-3px); }
    75%      { transform: translateX(3px); }
}

/* 商品が切り替わった瞬間のフラッシュ */
#p1-image-box.is-changing { animation: changeFlash 0.34s ease; }
@keyframes changeFlash {
    0%   { filter: brightness(2.2); transform: scale(0.94); }
    60%  { filter: brightness(1.1); transform: scale(1.03); }
    100% { filter: brightness(1);   transform: scale(1); }
}

/* チェンジできない理由が「支払い中のコインがあるから」のとき、
   支払いエリアを光らせて視線を誘導する（文字で説明しない） */
.pm-payment-area.is-blocking { animation: pmBlocking 0.5s ease; }
@keyframes pmBlocking {
    0%, 100% { box-shadow: none; }
    40%      { box-shadow: 0 0 0 3px #ffd166, 0 0 14px rgba(255,209,102,0.9); }
}

/* 💴 おまけ商品（5円ズレの目標）：
   図鑑の絵は無いが、hue-rotateで色違いにするので暗くする必要はない
   （色そのものが「これは別の品」の合図になる）。値段は左下に小さな
   値札チップで添えるだけにして、絵の見栄えを邪魔しない。 */
#p1-image-box.is-offmenu {
    /* 角に切れ込みの入った「限定カラー」ラベルの雰囲気を出す */
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.6);
}
.price-tag {
    position: absolute;
    left: 3px;
    bottom: 3px;
    padding: 1px 6px;
    border-radius: var(--r-pill, 999px);
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(9px, 2.6vw, 11px);
    font-weight: 900;
    color: #e76f51;
    box-shadow: 0 1px 0 rgba(0,0,0,0.15);
    pointer-events: none;
}

/* ==========================================================
   🌈 パーティ：まっすぐ / なげる の切り替え
   ========================================================== */
#party-mode-switch {
    display: flex;
    gap: 10px;
    flex: 0 0 auto;        /* 盤面に押し潰されないよう縮小を禁止する */
    position: relative;
    z-index: 30;           /* 上部HUD(z-index:10)より必ず手前に置く */
}
.pm-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 48px;      /* 指で押せる最低サイズ。以前は約30pxで小さすぎた */
    min-width: 116px;
    padding: 8px 18px;
    border: 2px solid rgba(255,255,255,0.5);
    border-radius: var(--r-pill, 999px);
    background: rgba(255,255,255,0.16);
    color: rgba(255,255,255,0.75);
    font-family: inherit;
    font-size: 13px;
    font-weight: 900;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}
.pm-mode .pm-ico { font-size: 16px; line-height: 1; }
.pm-mode.is-on {
    background: #fff;
    color: #7e22ce;
    border-color: #fff;
    transform: scale(1.06);
    box-shadow: 0 3px 10px rgba(0,0,0,0.3);
}
.pm-mode:active { transform: scale(0.97); }

/* 💥 パーティ：着地・大合体の一瞬の衝撃。
   お買い上げの大フラッシュとは別枠で、短く鋭く効かせる。 */
@keyframes partyImpact {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-2px, 3px); }
    55%  { transform: translate(2px, -2px); }
    80%  { transform: translate(-1px, 1px); }
    100% { transform: translate(0, 0); }
}
@keyframes partyImpactHard {
    0%   { transform: translate(0, 0) scale(1); }
    18%  { transform: translate(-5px, 6px) scale(1.012); }
    42%  { transform: translate(5px, -4px) scale(0.996); }
    68%  { transform: translate(-3px, 2px) scale(1.004); }
    100% { transform: translate(0, 0) scale(1); }
}
#party-canvas.party-impact      { animation: partyImpact 0.16s ease-out; }
#party-canvas.party-impact-hard { animation: partyImpactHard 0.22s ease-out; }

/* ==========================================================
   ⚠️ 光の演出をまとめて弱めるための設定
   ------------------------------------------------------------
   OS側で「視差効果を減らす／動きを減らす」を有効にしている人は、
   光や動きに弱い場合がある。その意思表示を尊重して、
   画面全体のフラッシュと揺れを止める（ゲーム自体は普通に遊べる）。
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
    .party-purchase-flash,
    .purchase-shake,
    .pm-item-flash,
    .jackpot-flash,
    .jackpot-flash-super,
    #p1-image-box.tam-flash {
        animation: none !important;
    }
}

/* ==========================================================
   🏠 パーティ：ホームボタンと確認パネル
   他モードのポーズパネルと見た目・言い回しを揃える。
   ========================================================== */
#party-home-btn {
    position: absolute;
    top: calc(10px + env(safe-area-inset-top));
    left: 12px;                  /* 🏠 他モード（画面左上）と位置を合わせる */
    z-index: 20;
    width: 44px;                 /* 指で押せる大きさ。以前は文字ボタンで小さかった */
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #fff;
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: var(--r-pill, 999px);
}
#party-home-btn:active { transform: scale(0.94); }

#party-pause-panel {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2600;              /* パーティ画面(1800)より手前 */
    background: rgba(20, 10, 40, 0.72);
    align-items: center;
    justify-content: center;
    padding: 20px;
}
#party-pause-panel.is-open { display: flex; }

#party-pause-panel .pp-card {
    position: relative;    /* ✕ボタン(.panel-close)の位置の基準 */
    width: min(340px, 92vw);
    max-height: 86vh;
    overflow-y: auto;      /* カードが増えても小型端末で見切れないように */
    padding: 20px 18px 16px;
    border-radius: var(--r-lg, 24px);
    background: #fff;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
    text-align: center;
}
#party-pause-panel .pp-ico { font-size: 52px; line-height: 1; margin-bottom: 6px; }
#party-pause-panel .pp-ttl {
    font-size: 21px; font-weight: 900; color: var(--c-ink, #33415c); margin-bottom: 8px;
}
#party-pause-panel .pp-sub {
    font-size: 13px; font-weight: 900; color: var(--c-ink-mute, #7a869c); margin-bottom: 16px;
}
#party-pause-panel .pp-row { display: flex; gap: 10px; }
#party-pause-panel .pp-row .hp-btn { margin-top: 0; }

/* ==========================================================
   ✕ パネルを閉じるボタン（全モード共通）
   以前は index.html にインラインstyleで20行書かれていた。
   パーティにも同じものを置くにあたり、クラスに切り出して共通化する。
   ========================================================== */
.panel-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--c-p1, #ff4d6d);
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    z-index: 10;
}
.panel-close:active { transform: scale(0.92); }

/* ============================================================
   🎀 案内役キャラクター（こいこいんの女の子／男の子）
   ------------------------------------------------------------
   タイトルの立ち絵と、ゲーム中に出るリアクションSD。
   どちらも見た目だけの演出で、タップは受け付けない
   （pointer-events:none）。キャラの選択は設定画面の
   「案内役キャラ」から行う。
   ⚠️ 2026-08: 以前はタップで切替できるようにしていたが、
      画像の矩形全体がボタンの上に重なり、下の「ひとりであそぶ」等の
      ボタンが押せなくなる不具合があった。透過PNGでも<img>の当たり判定は
      矩形全体なので、タップ操作は立ち絵に持たせないことにした。
   ============================================================ */

/* タイトル画面の立ち絵：右下に控えめに立たせる。
   ボタン列と重ならないよう、狭い画面では小さくする。 */
.ts-mascot {
    position: absolute;
    right: 2px;
    bottom: 4px;
    /* ⚠️ 2026-08: 表記を漢字にしてボタン幅が変わった結果、右端の「設定」が
       立ち絵の後ろに隠れるようになった。z-indexでの解決を試みたが、
       行(.ts-icon-row--bottom)側のz-index:1が別の指定元で固定されており
       上書きできなかったため、立ち絵を小さくして重なり自体を無くす。 */
    height: min(24vh, 190px);
    width: auto;
    z-index: 2;
    pointer-events: none;   /* 下のボタンを絶対に邪魔しない */
    filter: drop-shadow(0 6px 10px rgba(0,0,0,0.28));
    animation: ts-mascot-breathe 3.4s ease-in-out infinite;
}

/* ふわっと呼吸するだけの控えめな動き（酔い対策として上下移動は2pxまで） */
@keyframes ts-mascot-breathe {
    0%, 100% { transform: translateY(0)     rotate(0deg);   }
    50%      { transform: translateY(-2px)  rotate(-0.6deg); }
}

/* 画面が狭い／低い端末ではボタンを優先して小さく退避させる */
@media (max-height: 700px) {
    .ts-mascot { height: 17vh; opacity: 0.92; }
}
@media (max-width: 360px) {
    .ts-mascot { height: 14vh; opacity: 0.9; }
}

/* 設定パネルの「女の子／男の子」選択ボタン */
.char-pick-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 6px 8px;
    border-radius: 18px;
    border: 3px solid #eee;
    background: #fafafa;
    cursor: pointer;
    font-size: 13px;
    font-weight: 900;
    color: #666;
}
.char-pick-btn img { width: 64px; height: auto; aspect-ratio: 3 / 4; object-fit: contain; object-position: bottom center; pointer-events: none; }
.char-pick-btn.is-selected {
    border-color: #ffb703;
    background: #fff7e6;
    color: #a35700;
    box-shadow: 0 3px 0 #e0a000;
}
.char-pick-btn:active { transform: scale(0.96); }

/* ゲーム中は右上のデッドスペースに常駐する案内役キャラ（パーティモード用）。
   ⚠️ 2026-08: 以前は購入等のイベントでひょこっと出て消える一時表示だったが、
   「せっかくデッドスペースなら常時出して、状況で表情を使い分けてほしい」
   との要望を受け、常時表示＋表情差し替え方式に変更した。
   画像の切り替え自体はふわっとクロスフェードする程度に留め、
   位置が動く演出は無くした（酔い対策・常時視界に入るものなので特に控えめに）。 */
.char-react {
    position: fixed;
    right: 6px;
    left: auto;
    top: calc(8px + env(safe-area-inset-top));
    bottom: auto;
    height: 118px;
    width: auto;
    /* 2026-09-27: 表情シート由来の画像はキャラごとに縦横比が違う（ノアは横長）。
       枠は従来画像と同じ3:4に固定し、中身を収める＝占有範囲を変えない。 */
    aspect-ratio: 3 / 4;
    object-fit: contain;
    object-position: bottom right;
    z-index: 60;
    pointer-events: none;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.35));
    opacity: 0;
    transition: opacity 0.35s ease-out;
}
.char-react.is-in {
    opacity: 1;
}

/* 狭い画面ではプレイエリアを優先し、キャラは少し控えめにする */
@media (max-height: 700px) {
    .char-react { height: 92px; }
}
@media (max-width: 360px) {
    .char-react { height: 80px; }
}

/* ============================================================
   🎀 ソロ：案内役キャラを .pm-timer-image-row の空きスペースに置く
   ------------------------------------------------------------
   ピクセル解析とelementFromPointで再確認した結果、赤枠が指していたのは
   #p1-payment-area（それは別の場所、アイコン列の右横）ではなく、
   商品画像ボックス(#p1-image-box)の右側にある空きスペースだった。
   ソロモードでは #p1-battle-timer が非表示になるため、その分の
   空きが .pm-timer-image-row の右側に残る。そこに flex子要素として
   追加すれば、絶対配置無しに自然な位置へ収まる。
   ============================================================ */
/* 🎀 ソロ：案内役キャラを商品画像の横（.pm-timer-image-row の空き）に置く。
   ⚠️ 2026-08: 以前は max-height:72px（商品画像と同じ高さ）に収めていたが、
   「もっと大きくしたい」との要望で拡大した。ただし高さをそのまま増やすと
   行の高さが伸びてプレイエリアが圧迫されるため、行を基準に絶対配置して
   下端を揃え、上方向へはみ出させる（上は支払い待ちエリアの空きなので
   邪魔になりにくい）。pointer-events:none なので操作の妨げにもならない。 */
body.solo-mode #p1-section .pm-timer-image-row { position: relative; }

.char-dock-timerrow {
    position: absolute;
    right: 6px;
    bottom: 0;
    height: 118px;      /* 商品画像(72px)より一回り大きく見せる */
    width: auto;
    aspect-ratio: 3 / 4; /* 横長の表情画像(ノア)でも価格表示に被らないよう、従来画像と同じ枠に固定 */
    max-width: 46%;     /* 商品画像や価格表示に被らない範囲に収める */
    object-fit: contain;
    object-position: bottom right;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease-out;
}
.char-dock-timerrow.is-in { opacity: 0.95; }

/* 画面が低い端末では、上の行に食い込みすぎないよう控えめにする */
@media (max-height: 700px) {
    .char-dock-timerrow { height: 92px; }
}

/* 🎀 対戦モード専用：ピクセル解析の結果、赤枠は#p1-payment-area（アイコン列の
   横）ではなく、.ui-container（サイドバー）自体の中の、アイコン列より下に
   ある未使用の縦スペース（実測130px前後）だった。.ui-containerはflex-column
   構成なので、margin-top:auto で末尾に押し出すだけで自然に収まる。
   サイドバー自体の幅は変えない。 */
.char-dock-versus {
    flex: 0 0 auto;
    margin-top: auto;
    align-self: center;
    max-width: 90%;
    max-height: 90px;
    width: auto;
    height: auto;
    opacity: 0;
    transition: opacity 0.35s ease-out;
}
.char-dock-versus.is-in { opacity: 0.95; }

/* 画面が低い端末では、商品3択などでさらに窮屈になるため追加で縮める */
@media (max-height: 720px) {
    .char-dock-versus { max-height: 62px; }
}
/* さらに極端に低い端末向けの保険。#p1-image-boxの縮小とサイドバー拡幅で
   実際の3ボタンナビ機種（実測dvh約560px）は解消済みだが、それより
   さらに低い端末でも「非表示」ではなく「縮小」でしのげるようにしておく。 */
@media (max-height: 540px) {
    .char-dock-versus { max-height: 40px; }
}

/* 🧾 パーティモード：お会計成立の瞬間、進捗表示(¥現在/¥目標)を弾ませる。
   ソロ/対戦は盤面中央に専用のレジカウンターを出すが、パーティは
   元々このHUDに合計金額が常時出ているので、二重表示にせず
   こちらを主役にする。
   ⚠️ 光過敏症・酔い対策：点滅や色の急変はさせず、0.45秒で収まる
   緩やかな拡大のみ。位置は動かさない。 */
@keyframes partyRegisterSettle {
    0%   { transform: scale(1);    }
    35%  { transform: scale(1.35); }
    100% { transform: scale(1);    }
}
#party-chain-status.is-settled {
    display: inline-block;
    animation: partyRegisterSettle 0.45s cubic-bezier(.2,1.4,.4,1);
}

/* 🛍️ お会計中、コインが商品画像に吸い込まれるたびに商品が小さく反応する。
   「このコインがこの商品を買うために使われている」という因果を目で繋ぐための演出。
   ⚠️ 光過敏症・酔い対策：点滅や色の急変はさせず、0.18秒で収まる
   ごく小さな拡大のみ（1.06倍）。位置は動かさない。 */
@keyframes vendingCoinHit {
    0%   { transform: scale(1);    }
    45%  { transform: scale(1.06); }
    100% { transform: scale(1);    }
}
.vending-display.is-coin-hit {
    animation: vendingCoinHit 0.18s ease-out;
}

/* 🎁 商品を受け取った瞬間、案内役キャラがぴょこっと跳ねる。
   ⚠️ 光過敏症・酔い対策：色は変えず、上下6pxだけの小さな動きを
   0.35秒で1回きり。連続では鳴らさない（受け取りは購入時のみ）。 */
@keyframes charReceiveHop {
    0%   { transform: translateY(0);    }
    30%  { transform: translateY(-6px); }
    55%  { transform: translateY(0);    }
    70%  { transform: translateY(-3px); }
    100% { transform: translateY(0);    }
}
.char-receive-hop {
    animation: charReceiveHop 0.35s ease-out;
}

/* 🛍️📘 結果画面：このゲームで買った商品の一覧 */
.result-items-wrap {
    width: 100%;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 3px dotted rgba(255,159,28,0.45);
    box-sizing: border-box;
}
.result-items-title {
    font-size: 13px;
    font-weight: 900;
    color: #b35900;
    margin-bottom: 8px;
    white-space: nowrap;
}
/* 買った数が多くても縦に伸びすぎないよう、はみ出す分はスクロールさせる */
.result-items-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    max-height: 168px;
    overflow-y: auto;
}
.result-item-cell {
    position: relative;
    width: 62px;
}
.result-item-cell img {
    width: 62px;
    height: 62px;
    object-fit: cover;
    border-radius: 10px;
    border: 3px solid #fff;
    box-shadow: 0 3px 8px rgba(0,0,0,0.18);
    display: block;
}
.result-item-price {
    font-size: 11px;
    font-weight: 900;
    color: #5a4a2a;
    text-align: center;
    margin-top: 2px;
}
/* 新しくずかんに載ったものは目印を付ける（点滅はさせない） */
.result-item-new {
    position: absolute;
    top: -5px; left: -5px;
    background: linear-gradient(135deg, #ff4d6d, #c9184a);
    color: #fff;
    font-size: 9px;
    font-weight: 900;
    padding: 2px 5px;
    border-radius: 8px;
    border: 2px solid #fff;
    letter-spacing: 0.02em;
}
/* 同じ商品を複数回買った時の個数 */
.result-item-count {
    position: absolute;
    bottom: 18px; right: -4px;
    background: #fff;
    color: #b35900;
    font-size: 10px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 8px;
    border: 2px solid #ffb703;
}
.result-items-note {
    font-size: 12px;
    font-weight: 900;
    color: #c9184a;
    margin-top: 8px;
}

/* ============================================================
   🛒 「つぎに買うもの」の候補
   ------------------------------------------------------------
   タップで切り替えられるが、選ばなくても先頭が目標になるので
   対戦中に手が止まることはない。
   ソロは商品の絵つき、対戦(.is-compact)は狭いので金額だけ。
   ============================================================ */
.target-choices {
    display: flex;
    gap: 4px;
    width: 100%;
    margin-top: 3px;
    box-sizing: border-box;
}
.target-choice {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 2px 2px 1px;
    border-radius: 9px;
    border: 2px solid rgba(200,180,120,0.5);
    background: rgba(255,255,255,0.75);
    cursor: pointer;
    font-family: inherit;
    /* ⚠️ 2026-08: 未選択の2枠に影が無く、他のボタン（🏠など）が必ず持つ
       「浮き上がり影」が無いため、タップできる要素に見えず気づかれない
       （クローズドテストで指摘）。選択中だけでなく常に薄い影を付けて
       「押せるもの」だと伝える。 */
    box-shadow: 0 2px 0 rgba(160,140,90,0.35);
    /* 選択中が分かるよう色を変えるだけ。点滅はさせない（光過敏症対策） */
    transition: border-color 0.15s, background 0.15s;
}
/* ⚠️ 2026-08: サムネイルを幅いっぱいの正方形にしていたため、候補行だけで
   縦79pxを占め、ソロのプレイエリアを圧迫していた。高さを固定して
   横長に切り出し、行全体を薄くする（何の商品かは分かる大きさは保つ）。 */
.target-choice img {
    width: 100%;
    height: 18px;
    aspect-ratio: auto;
    object-fit: cover;
    border-radius: 6px;
    display: block;
}
.target-choice-price {
    font-size: 15px;
    font-weight: 900;
    color: #5a4a2a;
    line-height: 1.1;
    white-space: nowrap;
}
.target-choice.is-selected {
    border-color: #ff9f1c;
    background: #fff7e0;
    box-shadow: 0 2px 0 #e0a000;
}
.target-choice.is-selected .target-choice-price { color: #b35900; }
.target-choice:active { transform: scale(0.96); }

/* 対戦：サイドバーが狭いので金額だけを縦に詰めて並べる */
.target-choices.is-compact { flex-direction: column; gap: 3px; }
.target-choices.is-compact .target-choice { padding: 4px 2px; }
.target-choices.is-compact .target-choice-price { font-size: 12px; }

/* 画面が低い端末では、3択の縦積みがサイドバーの高さを圧迫する主因の
   一つだったため、パディングと行間をさらに詰める。 */
@media (max-height: 640px) {
    .target-choices.is-compact { gap: 2px; }
    .target-choices.is-compact .target-choice { padding: 2px 2px; }
}

/* ソロ：候補の右端に案内役キャラが絶対配置で立っているため、
   その分だけ場所を空けておく（空けないと3つ目がキャラの後ろに隠れる）。 */
body.solo-mode #p1-target-choices {
    margin-right: 88px;   /* 右端の案内役キャラの分を空ける */
    max-width: 200px;
}

/* タイトル下部のアイコンボタンは、立ち絵より手前に描く。
   ⚠️ 表記を漢字にしてボタン幅が変わった結果、右端の「設定」が
   立ち絵の後ろに回り込んで見えなくなっていた（pointer-events:none
   なので押せてはいたが、見えないボタンは無いのと同じ）。
   原因は行(.ts-icon-row)側の z-index:1 が立ち絵の z-index:2 より低く、
   行が独立した重ね合わせ文脈を作るためボタン単体のz-indexでは
   行の外へ出られなかったこと。行ごと手前に上げる。 */
.ts-icon-row--bottom { z-index: 6; }
.ts-icon-btn { position: relative; z-index: 6; }

/* 🏅 通算記録（ランキング画面の上部） */
.records-title {
    font-size: 13px; font-weight: 900; color: #b35900;
    margin-bottom: 6px; white-space: nowrap;
}
.records-grid {
    display: flex; flex-wrap: wrap; gap: 4px 10px; justify-content: center;
    font-size: 12px; font-weight: 900; color: #5a4a2a; line-height: 1.6;
}
.records-grid b { color: #ff9f1c; font-size: 13px; }
#records-summary {
    margin-bottom: 12px; padding-bottom: 10px;
    border-bottom: 3px dotted rgba(255,159,28,0.4);
}
#records-summary:empty { display: none; border: 0; margin: 0; padding: 0; }

/* ============================================================
   🎖️ 称号
   ⚠️ 点滅・明滅はさせない（光過敏症対策の方針を踏襲）。
      解放済みは色と✓で静かに示す。
   ============================================================ */
.titles-panel {
    background: #fffdf8; border-radius: 26px;
    border: 4px solid #ffb703; box-shadow: 0 8px 0 #a35700;
    padding: 18px 16px 16px; width: min(340px, 93vw);
    box-sizing: border-box; display: flex; flex-direction: column;
    max-height: 82vh;
}
.titles-head {
    display: flex; align-items: baseline; justify-content: center;
    gap: 10px; margin-bottom: 10px;
}
.titles-title { font-size: 18px; font-weight: 900; color: #a35700; white-space: nowrap; }
.titles-count { font-size: 13px; font-weight: 900; color: #ff9f1c; }
.titles-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.title-row {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 9px; border-radius: 12px;
    background: #f3f3f3; border: 2px solid #e2e2e2; text-align: left;
}
.title-row.is-got { background: #fff7e0; border-color: #ffb703; }
.title-icon { font-size: 20px; flex: 0 0 auto; }
.title-icon.is-locked { opacity: 0.5; }
.title-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.title-body b { font-size: 13px; font-weight: 900; color: #5a4a2a; }
.title-row.is-got .title-body b { color: #b35900; }
.title-body small { font-size: 10px; color: #8a8a8a; }
.title-check { font-size: 16px; font-weight: 900; color: #ff9f1c; flex: 0 0 auto; }
.title-num { font-size: 10px; font-weight: 900; color: #999; flex: 0 0 auto; white-space: nowrap; }
/* 進捗バー（アニメーションはさせず、幅で静的に示す） */
.title-bar {
    display: block; height: 4px; border-radius: 3px;
    background: #e0e0e0; margin-top: 4px; overflow: hidden;
}
.title-bar i { display: block; height: 100%; background: #ffb703; }

/* 🏆 ランキングのタブ（項目ごとの上位10件） */
.ranking-tabs {
    display: flex; gap: 4px; margin-bottom: 10px; width: 100%;
}
.rank-tab {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 1px;
    padding: 5px 2px; border-radius: 10px;
    border: 2px solid #e6d9b8; background: #fff;
    font-family: inherit; font-size: 14px; font-weight: 900;
    color: #8a7a5a; cursor: pointer;
    /* 選択中は色だけで示す。点滅はさせない（光過敏症対策） */
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.rank-tab span { font-size: 10px; }
.rank-tab.is-on {
    background: #fff3d6; border-color: #ff9f1c; color: #b35900;
    box-shadow: 0 2px 0 #e0a000;
}
.rank-tab:active { transform: scale(0.97); }

/* 🥤 自動販売機に商品が入っていない状態（チュートリアル序盤など）。
   空の枠だけだと「画像が読み込めていない」ように見えるため、
   準備中だと分かる控えめな表示にする。点滅はさせない。 */
.vending-display.is-empty::after {
    content: '準備中';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    color: #b9a88a;
    letter-spacing: 0.05em;
}

/* ============================================================
   🥊 対戦モード(CPU/友だち)のサイドバー簡略化
   ------------------------------------------------------------
   ユーザー提案の実装：
   ① 商品画像は常時出さず、購入演出の瞬間だけ見せる
      （#p1-item-imageのsrcはsetTargetDisplayで通常どおり更新され続けるので、
        購入時の飛行アニメーション(spawnProductDelivery)はそのまま動く。
        価格自体は既存の3択(target-choices)がテキストで見せているので、
        情報としては失われない）
   ② 自分側のタイマーは非表示（相手側と常に同じ値なので重複表示だった）
   ③ 「ポイント」という単語を消し、数字だけにする
   いずれも party モードには適用しない（party は別のDOM構造・別のHUDのため）。
   ============================================================ */
/* ⚠️ 2026-08: display:none にすると getBoundingClientRect() が
   すべて0になり、それを参照している2箇所が壊れていた。
     ・checkGlobalExchangePayment：コインの飛行先座標(destX/destY)が
       (0,0)＝画面左上になり、選んだ商品と違う場所へ飛んでいた
     ・spawnProductDelivery：幅0を「取得失敗」とみなして早期returnし、
       購入時に商品画像自体が出てこなくなっていた
   visibility:hidden なら座標（位置・サイズ）は保持したまま見た目だけ
   消せるため、両方とも正しく動く。
   ⚠️ トレードオフ：要素は「見えないが場所は占有したまま」になるので、
   意図していた「サイドバーの省スペース」の効果は無くなる
   （＝この枠の分の余白は空かない）。省スペース自体をやり直すなら、
   別の場所を削る、または枠を小さく縮小する方向で再検討が必要。 */
/* ⚠️ 2026-08: 上のコメントで「再検討が必要」と保留されていた「枠を小さく縮小」を
   実施。中の#p1-item-imageはwidth:100%だけ指定されていて高さは自動計算のため、
   枠が横に広い（サイドバーが広い）ほど正方形に近い形で縦にも伸びてしまい、
   見えないはずのこの枠が実測115pxもサイドバーの高さを占有していた
   （3ボタンナビ機種でお会計ゲージや3択が見切れる一因になっていた）。
   visibility:hidden のまま（座標計算は維持）、サイズだけ小さく固定する。 */
body:not(.solo-mode) #p1-image-box {
    visibility: hidden;
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    min-height: 0;
}
body:not(.solo-mode) #p1-battle-timer { display: none; }
body:not(.solo-mode) #p1-score-label,
body:not(.solo-mode) #p2-identity-label { display: none; }

/* ============================================================
   🖥️ 横長画面（タブレット・PC）用レイアウト
   ------------------------------------------------------------
   スマホは縦持ち前提の今のレイアウトのまま。画面が横長で、かつ
   高さに余裕がある（＝スマホの横持ちではない）時だけ切り替える。
   盤面(canvas)は440×600固定の比率で拡縮されるだけなので、
   ここで変えるのはHUDの置き場所だけ（物理・判定には影響しない）。
     ・ソロ：上に積んでいたHUDを盤面の左サイドバーへ移す
     ・対戦：上下2分割を左右2分割にし、相手盤面の180°回転を解除する
       （回転は1台のスマホを向かい合って覗く配置のためのもの）
   ============================================================ */
@media (orientation: landscape) and (min-height: 300px) { /* 📱 2026-11-06 横向き対応：500px→300px（スマホの横持ちにも使う） */

    /* ── ソロ：HUDを左サイドバーに ── */
    body.solo-mode #p1-section {
        flex-direction: row;
    }
    body.solo-mode #p1-section .ui-container {
        position: relative;
        width: clamp(240px, 26vw, 340px);
        min-width: 0;
        height: 100%;
        align-content: start;
        gap: 8px;
        padding: 10px;
        border-bottom: none;
        border-right: 3px solid #ffb3c6;
    }

    /* 🏠＋ポイント列：サイドバーが広い分、押しやすい大きさに戻す */
    body.solo-mode .pm-home-score-col { width: 72px; gap: 4px; }
    body.solo-mode .pm-home-score-col #home-btn { height: 44px; }
    body.solo-mode .pm-home-score-col .score-box { min-height: 40px; }
    body.solo-mode #p1-payment-area { max-height: 120px; }

    /* 商品画像を上に大きく、3択をその下に全幅で */
    body.solo-mode #p1-section .pm-timer-image-row {
        position: static;   /* キャラをサイドバー基準で置くため */
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    body.solo-mode #p1-image-box {
        width: 100%;
        height: clamp(96px, 18vh, 160px);
    }
    body.solo-mode #p1-item-image {
        width: 100%;
        height: 100%;
    }
    body.solo-mode #p1-target-choices {
        margin-right: 0;
        max-width: none;
    }
    body.solo-mode #p1-target-choices .target-choice img { height: 40px; }
    body.solo-mode #p1-target-choices .target-choice-price { font-size: 17px; }

    /* 高さ640px以下で精算ゲージを細くする既存ルールは縦レイアウト用。
       サイドバーには縦の余裕があるので、ラベルが切れない太さに戻す。 */
    .burst-bar-bg.checkout-gauge { height: 16px; margin-top: 2px; }

    /* 案内役キャラはサイドバー下部の空きに大きめに立たせる。
       上のHUDに被らないよう、残りの高さに合わせて縮む。 */
    body.solo-mode .char-dock-timerrow {
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0 auto;
        height: min(280px, max(90px, calc(100% - 380px)));
        max-width: 100%;
        aspect-ratio: auto; /* サイドバーは横に余裕があるので画像本来の比率で */
        object-position: bottom center;
    }

    /* ── 対戦（CPU・オンライン）：左右2分割 ── */
    body:not(.solo-mode) #main-layout {
        /* index.html側のインラインstyleに column が直書きされているため !important */
        flex-direction: row !important;
    }
    body:not(.solo-mode) #p2-section {
        order: 1;           /* 自分が左、相手が右 */
        /* ぷよぷよと同じく、点数などのHUDは両端（外側）に置き、
           2つの盤面を中央に寄せて並べる。相手側は並びを左右反転する。 */
        flex-direction: row-reverse;
    }
    body:not(.solo-mode) #p2-section .ui-container {
        border-right: none;
        border-left: 3px solid #90e0ef;
    }
    body:not(.solo-mode) #p2-section canvas {
        transform: none;
    }
    body:not(.solo-mode) .player-section .ui-container {
        width: clamp(100px, 11vw, 150px);
    }

    /* 🎀 対戦の案内役：縦レイアウト用の上限（90px、低い画面では62px）のままだと、
       PCではサイドバーの下に400px以上の空きがあるのに小さく見えていた。
       ソロのPC表示（最大280px）と同じく、サイドバーの残りの高さいっぱいまで大きくする。
       flex:1 で空きを埋め、object-fit で画像の縦横比を保ったまま下寄せにする。 */
    body:not(.solo-mode) .char-dock-versus {
        flex: 1 1 0;
        min-height: 0;
        width: 100%;
        max-width: 100%;
        max-height: 300px;
        object-fit: contain;
        object-position: bottom center;
    }

}

/* ── スマホを横持ちした時：縦向きにしてもらう案内 ──
   横長かつ低い画面で、指で操作する端末（＝スマホ）だけ。
   PCのウィンドウを低くした時は出さない（縦レイアウトのまま遊べる）。 */
#rotate-hint { display: none; }
@media (orientation: landscape) and (max-height: 499px) and (pointer: coarse) {
    #rotate-hint {
        display: flex;
        position: fixed;
        inset: 0;
        z-index: 100000;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 12px;
        background: linear-gradient(180deg, #fff1f5 0%, #ffe5ec 100%);
        color: var(--c-ink);
        font-weight: 900;
        font-size: 18px;
        text-align: center;
    }
    #rotate-hint .rotate-hint__icon {
        font-size: 56px;
        animation: rotate-hint-turn 1.8s ease-in-out infinite;
    }
}
/* アプリ版は向きをAndroid側で固定しているので案内は不要（main.js が付けるクラス） */
.is-native-app #rotate-hint { display: none !important; }
@keyframes rotate-hint-turn {
    0%, 30%   { transform: rotate(90deg); }
    60%, 100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
    #rotate-hint .rotate-hint__icon { animation: none; }
}

/* ============================================================
   📐 盤面を空いている場所いっぱいまで拡大（縦画面・横画面共通）
   ------------------------------------------------------------
   既定のcanvasは max-width/max-height で「縮む」だけなので、
   タブレット縦・PCでは本来の440×600のまま小さく残り、周りが木目だらけになる。
   枠(.canvas-container)の縦横どちらか狭い方に合わせて比率を保ったまま広げる。
   スマホは元々幅いっぱいまで縮んで表示されているので見た目はほぼ変わらない。
   （タップ位置の換算は getBoundingClientRect 基準なので拡大しても崩れない）
   ============================================================ */
#main-layout .canvas-container {
    container-type: size;
}
#main-layout .canvas-container canvas {
    width: auto;
    height: min(100cqh, 100cqw * 600 / 440);
}

/* 🎉 パーティ：縦画面でも盤面の高さ上限(780px)を外し、画面幅いっぱいまで使う。
   タブレット縦では上限のせいで盤面の上に大きな空きができていた。
   max-height は「幅96vwに収めた時の高さ」で、比率が崩れないための保険。 */
#party-canvas {
    height: calc(100dvh - 214px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    max-height: calc(96vw * 780 / 480);
}

/* 🏠 タイトル：大きい縦画面（タブレット）ではロゴとボタン一式が小さく中央に
   固まって見えるので、まとめて拡大する。スマホ・PC（高さ720px前後）は対象外。 */
@media (min-width: 600px) and (min-height: 1000px) {
    #menu-screen.title-screen > :not(.ts-bg):not(.ts-mascot) { zoom: 1.25; }
    .ts-mascot { height: min(22vh, 300px); }
}
@media (min-width: 760px) and (min-height: 1300px) {
    #menu-screen.title-screen > :not(.ts-bg):not(.ts-mascot) { zoom: 1.5; }
    .ts-mascot { height: min(22vh, 360px); }
}

/* ============================================================
   📼 リプレイ（やられた瞬間など）：横長画面（タブレット・PC）用レイアウト
   ------------------------------------------------------------
   リプレイは実プレイ画面の複製(dr-p1/dr-p2)なので、#main-layout 向けの
   横レイアウト指定が効かず、PCでも縦並びのまま小さく出ていた。
   実プレイと同じ並び（対戦＝左に自分・右に相手、点数エリアは両端の外側、
   相手盤面は回転なし／ソロ＝左にHUD・右に盤面）にそろえる。
   .has-p2 は openDeathReplay()（render.js）が対戦の時だけ付ける。
   ============================================================ */
@media (orientation: landscape) and (min-height: 300px) { /* 📱 2026-11-06 横向き対応：500px→300px（スマホの横持ちにも使う） */
    #death-replay-layout {
        flex-direction: row;
        max-width: none;
        width: min(94vw, 620px);
        height: min(calc(100dvh - 210px), 760px);
        gap: 8px;
    }
    #death-replay-layout.has-p2 {
        width: min(94vw, 1180px);
    }
    #dr-p2-section {
        order: 1;
        flex-direction: row-reverse;
    }
    #dr-p2-section canvas {
        transform: none;
    }
    #dr-p2-section .ui-container {
        border-right: none;
        border-left: 3px solid #ffb3c6;
    }
    #death-replay-layout .ui-container {
        width: clamp(100px, 11vw, 150px);
    }
    /* 盤面を枠いっぱいまで拡大（実プレイ画面と同じ考え方） */
    #death-replay-layout .canvas-container {
        container-type: size;
    }
    #death-replay-layout .canvas-container canvas {
        width: auto;
        height: min(100cqh, 100cqw * 600 / 440);
    }
}

/* ============================================================
   🎉 パーティ：横長画面（タブレット・PC）用レイアウト
   ------------------------------------------------------------
   縦向きでは「上にHUD・中央に盤面・下に弾く/投げる」だが、横長画面だと
   盤面が上下に挟まれて小さくなり、左右が大きく空く。そこで
     左：タイマー・買う商品・合計金額（#party-hud）
     中央：盤面（縦いっぱい）
     右：弾く／投げる
   の3列に並べ替える。#party-hud は index.html 側にインラインstyleで
   位置が書かれているため、その上書きには !important が要る。
   盤面のタップ位置換算は getBoundingClientRect 基準なので拡大しても崩れない。
   ============================================================ */
@media (orientation: landscape) and (min-height: 300px) { /* 📱 2026-11-06 横向き対応：500px→300px（スマホの横持ちにも使う） */
    #party-game-screen {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        gap: 28px;
        padding: 16px;
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    /* 左列：HUD。盤面を画面中央に保つため、右列と同じ幅にそろえる */
    #party-hud {
        position: static !important;
        order: 0;
        flex: 0 0 220px;
        width: 220px;
        padding: 0 !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    #party-hud > div:first-child {
        flex-direction: column;
        align-items: stretch !important;
        gap: 10px !important;
    }
    #party-hud > div:first-child > div:first-child {
        text-align: center;
        font-size: 18px !important;
        padding: 8px 12px !important;
    }
    #party-item-box {
        padding: 6px 12px 6px 6px !important;
    }
    #party-item-image {
        width: 56px !important;
        height: 56px !important;
    }
    #party-money-box {
        width: 100%;
        font-size: 13px !important;
        padding: 8px 12px !important;
    }

    /* 中央：盤面を縦いっぱいに（幅は両脇の列の残りまで） */
    #party-canvas {
        order: 1;
        flex: 0 1 auto;
        min-width: 0;
        height: min(calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom)), 900px);
        max-width: calc(100vw - 2 * 220px - 2 * 28px - 32px);
        max-height: calc((100vw - 2 * 220px - 2 * 28px - 32px) * 780 / 480);
    }

    /* 右列：弾く／投げるを縦に並べる */
    #party-mode-switch {
        order: 2;
        flex: 0 0 220px;
        width: 220px;
        flex-direction: column;
        align-items: center;
        gap: 14px;
    }
    #party-mode-switch .pm-mode {
        width: 160px;
        min-height: 60px;
        font-size: 15px;
    }
    #party-mode-switch .pm-ico { font-size: 20px; }
}

/* ============================================================
   🏁 決着表示：止まった盤面の上に「チャレンジ終了」などを1秒出し、
   そのあと「結果を見る」ボタンを出す（game.js startFinishIntro）
============================================================ */
.finish-title {
    position: fixed;
    left: 50%;
    top: 45%;
    transform: translate(-50%, -50%);
    z-index: 1950;
    pointer-events: none;
    text-align: center;
    background: transparent;
    font-family: 'Koicoin Pop', 'M PLUS Rounded 1c', sans-serif;
    font-synthesis: none; /* 太さは1種類だけなので、ブラウザによる疑似太字でつぶれないようにする */
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    /* 背景が無いぶん、コインに重なっても読めるよう文字に白いフチを付ける */
    text-shadow:
        3px 0 0 #fff, -3px 0 0 #fff, 0 3px 0 #fff, 0 -3px 0 #fff,
        2px 2px 0 #fff, -2px 2px 0 #fff, 2px -2px 0 #fff, -2px -2px 0 #fff,
        0 4px 10px rgba(0, 0, 0, 0.25);
    animation: finishTitleIn 0.35s cubic-bezier(.2, 1.5, .4, 1) both;
    transition: opacity 0.3s ease;
}
.finish-title.is-out { opacity: 0; }
/* 対戦：それぞれの盤面の真ん中に出す WIN! / LOSE / DRAW */
.finish-title--board {
    position: absolute;
    z-index: 60;
    white-space: nowrap;
    font-size: clamp(40px, 18cqw, 88px);
    line-height: 1;
}
.finish-title--win  { color: #ff9f1c; }
.finish-title--lose { color: #5b7bd5; }
.finish-title--draw { color: #778ca3; }
@keyframes finishTitleIn {
    0%   { transform: translate(-50%, -50%) scale(0.4); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1);   opacity: 1; }
}

/* ⚠️ 中央寄せに transform を使うと、.menu-btn の :hover/:active の transform に
      上書きされて右にずれるため、left/right:0 + margin:auto で寄せる */
.finish-next-btn {
    position: fixed;
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    bottom: calc(var(--safe-area-bottom, 0px) + 24px);
    z-index: 1950;
    width: fit-content;
    min-width: 200px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.finish-next-btn.is-in {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================
   🧪 試作：タイトル画面をお店らしく（しましまの日よけ・商品棚・カウンターの天板）
   ・黄色い壁＋木のカウンター（既存の背景）の上に重ねる見た目だけの層。
   ・z-index:1 … カウンターの木目(::before, 0)より上、ロゴ・ボタン(2)と案内役(2)より下。
   ・棚はスマホ縦では上の空き、PC横では左右の空きに置く。メニューと重なる狭い画面では出さない。
============================================================ */
/* ⚠️ 既存の「#menu-screen.title-screen > :not(.bg-floaters):not(.ts-mascot) { position: relative }」の方が
      詳細度が高く、そのままだと背景の層までメニューの縦並びに入ってしまう。!important で画面全体に重ねる。 */
#menu-screen.title-screen > .ts-shop {
    position: absolute !important;
    inset: 0;
    z-index: 1 !important;
    pointer-events: none;
    zoom: 1 !important;   /* タブレット向けの拡大（> :not(.ts-bg) に zoom）を背景には効かせない */
}

/* しましまの日よけ（お店の入り口の雰囲気）。下のふちは半円の波 */
.ts-awning {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: calc(env(safe-area-inset-top, 0px) + 30px);
    background: repeating-linear-gradient(90deg, #ff8fab 0 36px, #fff6f8 36px 72px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.04);
}
.ts-awning::after {
    content: "";
    position: absolute;
    left: 0; right: 0; top: 100%;
    height: 18px;
    background:
        radial-gradient(circle at 18px 0, #ff8fab 17.5px, transparent 18px) 0 0 / 72px 18px repeat-x,
        radial-gradient(circle at 54px 0, #fff6f8 17.5px, transparent 18px) 0 0 / 72px 18px repeat-x;
    filter: drop-shadow(0 3px 2px rgba(120, 60, 20, 0.15));
}

/* 商品棚：商品が棚板（下の木の板）の上に並ぶ */
.ts-shelf {
    position: absolute;
    display: flex;
    flex-direction: column;
    gap: 22px;
    --ts-item: 46px;
}
.ts-shelf-row {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 10px;
    padding: 0 12px;
    border-bottom: 9px solid #c98f55;
    border-radius: 0 0 3px 3px;
    box-shadow: 0 7px 6px -3px rgba(110, 60, 15, 0.28);
}
/* 棚の品物：特定の商品ではなく、形だけの「箱・びん・紙袋・ボトル」。色は HTML の --c で指定 */
.ts-goods {
    position: relative;
    width: var(--ts-item);
    height: var(--ts-item);
    flex: 0 0 auto;
}
.ts-goods::before, .ts-goods::after { content: ""; position: absolute; }
/* 箱：リボン付き */
.ts-goods--box::before {
    left: 6%; right: 6%; bottom: 0; height: 72%;
    background: var(--c);
    border-radius: 6px;
    box-shadow: inset 0 -4px 0 rgba(0,0,0,0.08), 0 2px 3px rgba(0,0,0,0.15);
}
.ts-goods--box::after {
    left: 44%; width: 12%; bottom: 0; height: 72%;
    background: rgba(255,255,255,0.75);
}
/* びん：ふた付き */
.ts-goods--jar::before {
    left: 14%; right: 14%; bottom: 0; height: 66%;
    background: var(--c);
    border-radius: 10px 10px 8px 8px;
    box-shadow: inset 6px 0 0 rgba(255,255,255,0.35), 0 2px 3px rgba(0,0,0,0.15);
}
.ts-goods--jar::after {
    left: 20%; right: 20%; bottom: 66%; height: 14%;
    background: #f4f4f4;
    border-radius: 4px 4px 2px 2px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
/* 紙袋：持ち手付き */
.ts-goods--bag::before {
    left: 10%; right: 10%; bottom: 0; height: 64%;
    background: var(--c);
    border-radius: 3px 3px 6px 6px;
    box-shadow: inset 0 6px 0 rgba(255,255,255,0.3), 0 2px 3px rgba(0,0,0,0.15);
}
.ts-goods--bag::after {
    left: 32%; right: 32%; bottom: 58%; height: 26%;
    border: 3px solid rgba(120, 80, 50, 0.55);
    border-bottom: none;
    border-radius: 10px 10px 0 0;
}
/* ボトル：細い首とキャップ */
.ts-goods--bottle::before {
    left: 26%; right: 26%; bottom: 0; height: 62%;
    background: var(--c);
    border-radius: 9px 9px 6px 6px;
    box-shadow: inset 4px 0 0 rgba(255,255,255,0.35), 0 2px 3px rgba(0,0,0,0.15);
}
.ts-goods--bottle::after {
    left: 40%; right: 40%; bottom: 60%; height: 28%;
    background: linear-gradient(180deg, #ff8fab 0 30%, var(--c) 30%);
    border-radius: 3px 3px 0 0;
}

/* カウンターの天板のふち（黄色い壁と木のカウンターの境目） */
.ts-counter-top {
    position: absolute;
    left: 0; right: 0;
    top: 55%;
    height: 12px;
    background: linear-gradient(180deg, #f3d6a8 0%, #e2b47a 70%, #c98f55 100%);
    box-shadow: 0 4px 6px rgba(90, 45, 5, 0.25);
}

/* スマホ縦：棚は上の空きに1段だけ。右の棚と2段目は出さない */
.ts-shelf--left  { top: calc(env(safe-area-inset-top, 0px) + 70px); left: 0; right: 0; }
.ts-shelf--left .ts-shelf-row { margin: 0 auto; }
.ts-shelf--left .ts-shelf-row:nth-child(2),
.ts-shelf--right { display: none; }
/* 縦が短いスマホでは、ロゴと重なるので棚を出さない */
@media (max-height: 760px) {
    .ts-shelf { display: none !important; }
}

/* PC・横長：左右の壁に2段ずつの棚 */
@media (orientation: landscape) and (min-height: 300px) { /* 📱 2026-11-06 横向き対応：500px→300px（スマホの横持ちにも使う） */
    .ts-shelf { display: flex !important; }
    .ts-shelf--left, .ts-shelf--right {
        top: 13vh;
        width: calc((100vw - 600px) / 2 - 3vw);
        max-width: 340px;
        --ts-item: clamp(40px, 4.4vw, 64px);
    }
    .ts-shelf--left  { left: 3vw; right: auto; }
    .ts-shelf--right { right: 3vw; left: auto; }
    .ts-shelf--left .ts-shelf-row:nth-child(2) { display: flex; }
    .ts-shelf-row { margin: 0; }
}
/* 横長でも幅が狭く、棚を置くとメニューに重なる時は出さない */
@media (orientation: landscape) and (max-width: 1060px) {
    .ts-shelf { display: none !important; }
}

/* ============================================================
   🧪 試作：お買い上げした商品が道具になる（js/tools_trial.js）
   ============================================================ */
.tool-bar{display:flex;gap:6px;align-items:stretch;justify-content:center;margin:2px 0;position:relative}
.tool-slot{flex:1;max-width:120px;min-height:46px;border-radius:12px;border:2px solid #f3c6d3;background:#fff;
  display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2px 4px;font-family:inherit;
  color:#5a3a4a;cursor:pointer;position:relative;box-shadow:0 2px 0 #f0b8c8}
.tool-slot img{position:absolute;left:4px;top:50%;transform:translateY(-50%);width:30px;height:30px;border-radius:8px}
.tool-slot .tool-name{font-weight:900;font-size:14px;margin-left:30px}
.tool-slot .tool-desc{font-size:10px;margin-left:30px;opacity:.8}
.tool-slot:active{transform:translateY(2px);box-shadow:none}
.tool-slot.is-empty{color:#d9b3c0;font-size:12px;border-style:dashed;box-shadow:none;cursor:default}
.tool-slot.is-new{animation:toolNew .6s ease-out}
@keyframes toolNew{0%{transform:scale(.6)}60%{transform:scale(1.12)}100%{transform:scale(1)}}
.tool-state{position:absolute;right:0;top:-18px;font-size:11px;font-weight:900;color:#1e90ff}
.canvas-container.tool-wall-on{box-shadow:inset 6px 0 0 #6fb6ff,inset -6px 0 0 #6fb6ff}
.canvas-container.tool-slow-on{filter:saturate(.6) hue-rotate(200deg)}
@keyframes toolFog{0%{opacity:0}8%{opacity:1}80%{opacity:1}100%{opacity:0}}
.tool-slot.is-attack{border-color:#f5a3b8;background:#fff3f6}
.tool-toast{position:absolute;left:50%;top:18%;transform:translateX(-50%);z-index:40;pointer-events:none;max-width:92%;text-align:center;
  font-weight:900;font-size:18px;background:rgba(255,255,255,.92);padding:4px 12px;border-radius:12px;animation:toolToast 1.6s ease-out forwards}
@keyframes toolToast{0%{opacity:0;transform:translate(-50%,8px)}15%{opacity:1;transform:translate(-50%,0)}80%{opacity:1}100%{opacity:0;transform:translate(-50%,-12px)}}
/* 対戦は横が狭いので、道具をたてに並べ、名前だけにする */
body:not(.solo-mode) .tool-bar{flex-direction:column;gap:3px;margin:2px 0}
body:not(.solo-mode) .tool-slot{max-width:none;min-height:30px;border-radius:9px;padding:1px 2px}
body:not(.solo-mode) .tool-slot img{width:22px;height:22px;left:2px;border-radius:6px}
body:not(.solo-mode) .tool-slot .tool-name{font-size:11px;margin-left:22px;line-height:1.1}
body:not(.solo-mode) .tool-slot .tool-desc{display:none}
body:not(.solo-mode) .tool-slot.is-empty{font-size:10px;min-height:22px}
body:not(.solo-mode) .tool-state{position:static;font-size:9px;text-align:center}
.tool-blackhole{position:fixed;transform:translate(-50%,-50%);border-radius:50%;z-index:900;pointer-events:none;
  background:radial-gradient(circle,#0b0420 0 22%,#2a1458 38%,rgba(120,70,200,.55) 58%,rgba(160,120,255,0) 72%);animation:toolBH 1.2s linear infinite}
.tool-blackhole::before{content:'';position:absolute;inset:6%;border-radius:50%;background:conic-gradient(from 0deg,rgba(255,255,255,0),rgba(200,170,255,.55),rgba(255,255,255,0) 40%,rgba(200,170,255,.45) 70%,rgba(255,255,255,0));mix-blend-mode:screen}
.tool-blackhole.is-closing{opacity:0;transition:opacity .5s}
@keyframes toolBH{to{transform:translate(-50%,-50%) rotate(360deg)}}
.tool-fog{position:fixed;z-index:900;pointer-events:none;border-radius:8px;
  background:radial-gradient(circle at 30% 40%,rgba(255,255,255,.97),rgba(235,240,250,.93) 60%,rgba(220,228,245,.9));transition:opacity .6s}
.tool-fog.is-closing{opacity:0}

/* 🧪 試作：図鑑に道具の能力（js/collection.js の zukanToolBadge・openZukanDetail） */
.zukan-cell-tool{font-size:9px;font-weight:900;color:#4a7bd0;line-height:1.1;margin-top:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.zukan-cell-tool.is-attack{color:#d0456f}
.zukan-ability{margin-top:10px;padding:10px 12px;border-radius:12px;background:#fff6f9;border:2px solid #f6c6d4;color:#5a3a4a;font-size:13px;line-height:1.5;text-align:left;max-width:320px}
.zukan-ability b{font-size:15px}
.zukan-ability-title{font-size:11px;font-weight:900;color:#c0708a;margin-bottom:4px}
.zukan-ability-mode{font-size:10px;font-weight:900;color:#fff;background:#c99ab0;border-radius:6px;padding:0 5px;margin-left:6px;vertical-align:2px}


/* 🧪 試作：対戦の候補にも商品の絵（js/ui.js の renderTargetChoices） */
.target-choices.is-compact .target-choice{display:flex;flex-direction:row;align-items:center;justify-content:center;gap:2px}
/* ボタンの大きさは変えない（ユーザー指定）：絵は値段の文字の高さに収め、高さを増やさない */
.target-choices.is-compact .target-choice img{width:1.15em;height:1.15em;font-size:12px;border-radius:3px;flex:none;object-fit:cover;margin:-2px 0}

.zukan-ability-note{margin-top:6px;font-size:11px;color:#a07888}

/* 🧪 試作：図鑑から対戦に持ちこむ（js/collection.js の zukanLoadoutButtonHtml・zukanLoadoutSummaryHtml） */
.zukan-loadout-btn{margin-top:8px;width:100%;padding:8px;border-radius:10px;border:2px solid #f3a6bd;background:#fff;color:#d0456f;font-weight:900;font-family:inherit;font-size:13px;cursor:pointer}
.zukan-loadout-btn.is-on{background:#ff7fa2;color:#fff;border-color:#ff7fa2}
.zukan-loadout-btn:disabled{color:#b9a0aa;border-color:#e6d3da;cursor:default}
.zukan-loadout-summary{grid-column:1/-1;font-size:12px;font-weight:900;color:#5a3a4a;background:#fff6f9;border:2px dashed #f3c0cf;border-radius:10px;padding:6px 8px;margin-bottom:4px}
.zukan-loadout-summary span{display:block;font-size:10px;color:#b07a90;font-weight:700}
/* 対戦で使った道具：灰色にして、お会計でもどるまで押せない */
.tool-slot.is-used{filter:grayscale(1);opacity:.55;box-shadow:none;cursor:default}
/* 持ちこむ商品を目立たせる：マスのピンクの枠と札、上の欄に絵つきで並べる */
.zukan-cell.is-carry{outline:3px solid #ff7fa2;outline-offset:-1px;position:relative}
.zukan-carry-tag{position:absolute;top:2px;left:2px;font-size:9px;font-weight:900;color:#fff;background:#ff5c8a;border-radius:6px;padding:0 4px;line-height:1.5}
.zukan-loadout-summary{position:sticky;top:0;z-index:5}
.zukan-carry-head{display:flex;justify-content:space-between;align-items:center;font-size:13px}
.zukan-carry-head b{color:#d0456f}
.zukan-carry-chips{display:flex;gap:6px;flex-wrap:wrap;margin:5px 0 3px}
.zukan-carry-chip{display:flex;flex-direction:column;align-items:center;width:58px;padding:3px 2px;border-radius:9px;border:2px solid #ff7fa2;background:#fff;font-family:inherit;cursor:pointer}
.zukan-carry-chip img{width:40px;height:40px;border-radius:7px}
.zukan-carry-chip span{font-size:10px;font-weight:900;color:#5a3a4a;line-height:1.2}
.zukan-carry-chip small{font-size:9px;color:#b07a90}
.zukan-carry-none{font-size:11px;color:#b9a0aa;margin:3px 0}

/* 🧪 試作：道具は1つだけ見せ、上下にスライドで選ぶ（js/tools_trial.js の toolsRender・toolsBindSwipe） */
.tool-bar{touch-action:none;user-select:none;-webkit-user-select:none;padding-right:22px}
.tool-bar .tool-slot{max-width:220px;width:100%}
.tool-count{position:absolute;right:0;top:50%;transform:translateY(-50%);display:flex;flex-direction:column;align-items:center;font-size:9px;font-weight:900;color:#d0456f;line-height:1.1}
.tool-count b{font-size:8px;color:#ff7fa2}
.tool-count b.is-off{visibility:hidden}
.tool-slot.slide-up{animation:toolSlideUp .18s ease-out}
.tool-slot.slide-down{animation:toolSlideDown .18s ease-out}
@keyframes toolSlideUp{from{transform:translateY(40%);opacity:.3}to{transform:none;opacity:1}}
@keyframes toolSlideDown{from{transform:translateY(-40%);opacity:.3}to{transform:none;opacity:1}}
body:not(.solo-mode) .tool-bar{padding-right:18px}
body:not(.solo-mode) .tool-slot{min-height:40px}
body:not(.solo-mode) .tool-slot .tool-desc{display:block;font-size:8px;margin-left:22px;line-height:1.1}
body:not(.solo-mode) .tool-count{font-size:8px}
/* 対戦の横の欄は幅が70pxほどしかないので、絵を上・名前を下に縦に積み、何番目かは下に横書きで出す（説明は出さない） */
body:not(.solo-mode) .tool-bar{padding-right:0;gap:2px}
body:not(.solo-mode) .tool-slot{min-height:0;padding:3px 2px 2px;flex:none}
body:not(.solo-mode) .tool-slot img{position:static;transform:none;width:30px;height:30px;margin:0 auto 1px}
body:not(.solo-mode) .tool-slot .tool-name{margin-left:0;font-size:10px;line-height:1.15;text-align:center;word-break:keep-all;overflow-wrap:anywhere}
body:not(.solo-mode) .tool-slot .tool-desc{display:none}
body:not(.solo-mode) .tool-count{position:static;transform:none;flex-direction:row;justify-content:center;gap:4px;font-size:9px}

/* 道具のアイコン（商品の絵の右下に重ねる）。対戦の狭い欄では名前を消してアイコンで見分ける */
.tool-slot .tool-icon{position:absolute;left:24px;top:calc(50% + 2px);font-size:15px;line-height:1;filter:drop-shadow(0 0 2px #fff) drop-shadow(0 0 1px #fff)}
body:not(.solo-mode) .tool-slot .tool-icon{left:calc(50% + 4px);top:20px;font-size:18px}
body:not(.solo-mode) .tool-slot .tool-name{display:none}
body:not(.solo-mode) .tool-slot.is-attack::after{content:'⚔';position:absolute;left:3px;top:1px;font-size:10px;color:#d0456f}

/* 🧪 試作（2026-10-28）：図鑑のマスに道具のアイコン（右上）・長押しで持ちこむ（collection.js の zukanBindPress） */
.zukan-cell--unlocked{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:manipulation}
.zukan-cell--unlocked img{-webkit-user-drag:none;pointer-events:none}
.zukan-cell--unlocked.is-pressing{transform:scale(0.9);transition:transform .45s ease}
.zukan-cell-icon{position:absolute;top:2px;right:2px;width:22px;height:22px;border-radius:50%;background:#fff;border:2px solid #4a7bd0;display:flex;align-items:center;justify-content:center;font-size:13px;line-height:1;box-shadow:0 1px 3px rgba(0,0,0,.18);z-index:2}
.zukan-cell-icon.is-attack{border-color:#d0456f}
.zukan-cell--locked .zukan-cell-icon{opacity:.55}
.zukan-toast{position:fixed;left:50%;bottom:18%;transform:translateX(-50%);z-index:99999;background:rgba(60,40,60,.88);color:#fff;font-weight:900;font-size:14px;padding:8px 14px;border-radius:12px;white-space:nowrap;pointer-events:none;animation:zukanToastIn .2s ease}
@keyframes zukanToastIn{from{opacity:0;transform:translate(-50%,8px)}to{opacity:1;transform:translate(-50%,0)}}
.zukan-cell--unlocked.is-cant-carry{opacity:.4}
.zukan-carry-chip{-webkit-touch-callout:none;-webkit-user-select:none;user-select:none;touch-action:manipulation}.zukan-carry-chip img{pointer-events:none;-webkit-user-drag:none}.zukan-carry-chip.is-pressing{transform:scale(0.9);transition:transform .45s ease}

/* 🧪 パーティモードの結果発表のランキング（2026-11-04） */
.p3rank { margin: 0 auto 12px; max-width: 320px; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.p3rank-row { display: flex; align-items: center; gap: 8px; padding: 4px 10px; border-radius: 12px; background: rgba(255,255,255,0.7); color: #6b21a8; font-size: clamp(13px,3.8vw,16px); }
.p3rank-row.me { background: #fde68a; box-shadow: 0 0 0 2px #f59e0b inset; }
.p3rank-no { width: 2.4em; text-align: center; flex: none; }
.p3rank-row i { width: 12px; height: 12px; border-radius: 50%; flex: none; border: 2px solid #fff; }
.p3rank-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p3rank-yen { flex: none; }

/* 📱 横向き対応（2026-11-06）：スマホの横持ちでも遊べるようにしたので、縦にしてね案内は出さない */
#rotate-hint { display: none !important; }

/* ============================================================
   📱 横向き対応（2026-11-06、D:\こいこいん_横向き対応 の試作）
   ------------------------------------------------------------
   ① タイトルが下に寄る：タイトルは画面の流れの中に置かれ（position:relative）、
      高さ100vhの中で中央寄せしていた。100vh はアドレスバーやナビゲーションバーの
      下まで含む高さになる端末があり、見えている範囲より中心が下にずれていた。
      また中身が画面より高いと上下にはみ出していた。
      → 画面に固定し、見えている高さ(100dvh)の中で、はみ出す時は上から並べる
        （safe center）。上下の余白はシステムバーの高さ（env と Capacitor の
        --safe-area-inset-*）を足す。
   ② スマホ横向き（高さ600px以下の横長）：縦並びだと下のボタンが画面の外に出て
      押せなかった → 左にロゴ・案内役、右にボタンの2列にする。
   ============================================================ */
:root {
    --sa-top:    max(env(safe-area-inset-top, 0px),    var(--safe-area-inset-top, 0px));
    --sa-bottom: max(env(safe-area-inset-bottom, 0px), var(--safe-area-inset-bottom, 0px));
    --sa-left:   max(env(safe-area-inset-left, 0px),   var(--safe-area-inset-left, 0px));
    --sa-right:  max(env(safe-area-inset-right, 0px),  var(--safe-area-inset-right, 0px));
}
#menu-screen.title-screen {
    position: fixed;
    inset: 0;
    min-height: 0;
    height: 100vh;
    height: 100dvh;
    justify-content: safe center;
    overflow-x: hidden;
    overflow-y: auto;
    padding-top: calc(var(--sa-top) + 16px);
    padding-bottom: calc(var(--sa-bottom) + 20px);
}

@media (orientation: landscape) and (max-height: 600px) {
    /* ui.js がタイトルにもどる時に style.display='flex' を直接入れるので、隠している時以外は !important で上書きする */
    #menu-screen.title-screen:not([style*="none"]) { display: grid !important; }
    #menu-screen.title-screen {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: 1fr auto auto 1.4fr;
        grid-template-areas:
            ".     btns"
            "logo  btns"
            "icons btns"
            ".     btns";
        align-items: center;
        justify-items: center;
        column-gap: 16px;
        padding: calc(var(--sa-top) + 8px) calc(var(--sa-right) + 16px)
                 calc(var(--sa-bottom) + 8px) calc(var(--sa-left) + 16px);
    }
    /* 壁を広く、床（木目）は画面の下3割に */
    #menu-screen.title-screen {
        background: linear-gradient(180deg, #fff8d2 0%, #ffe889 40%, #ffd45c 70%, #cfa06b 70%, #d9b07b 100%) !important;
    }
    #menu-screen.title-screen::before { height: 30%; }
    .ts-logo-wrap { grid-area: logo; margin-top: 0; }
    .ts-logo { font-size: clamp(30px, 6.4vw, 52px); }
    .ts-logo-sub { font-size: clamp(14px, 2.4vw, 20px); }
    .ts-main-btns {
        grid-area: btns;
        align-self: center;
        margin-top: 0;
        padding: 0;
        gap: clamp(8px, 2.4vh, 14px);
    }
    .ts-btn { padding: clamp(5px, 1.6vh, 9px) 14px; }
    .ts-btn-desc { font-size: 10px; }
    .ts-icon-row--bottom {
        grid-area: icons;
        align-self: start;
        margin-top: 10px;
        padding: 0;
    }
    /* 案内役は左の列の右下（ボタンにかからない所）に */
    .ts-mascot {
        right: auto;
        left: calc(50% - 8px);
        transform-origin: bottom center;
        translate: -100% 0;
        bottom: calc(var(--sa-bottom) + 2px);
        height: min(36vh, 160px);
        opacity: 1;
    }
}

/* どの画面も、中身が画面より高い時は上から並べる（中央寄せのままだと上が切れてスクロールでも戻れない） */
.overlay { justify-content: safe center; }

/* ── 📱 横向き：メニュー画面 ──
   .ls-row は index.html でカード2枚を包んだ箱。縦向きでは箱が無いのと同じ（display:contents）。 */
.ls-row { display: contents; }
#online-menu > .ls-row > div { backdrop-filter: blur(8px); }
@media (orientation: landscape) and (max-height: 600px) {
    .ls-row {
        display: flex;
        gap: 14px;
        justify-content: center;
        align-items: stretch;
        width: 100%;
    }
    .ls-row > div { margin-bottom: 10px !important; }

    /* パーティのロビー入口：説明は1行に、カードは横並び */
    #party-menu-select { width: min(620px, 94vw) !important; }
    #party-menu-select > h3 { margin-bottom: 4px !important; }
    #party-menu-select > p { margin-bottom: 8px !important; }
    #party-menu-select > p br { display: none; }
    #party-menu-select .ls-row > div { flex: 1 1 0; min-width: 0; }
    #party-menu-select > .menu-btn { width: min(300px, 90vw) !important; }

    /* パーティの待合室：参加者を2列にして縦に伸びないように */
    #party-lobby-wait { width: min(560px, 94vw) !important; }
    #party-player-list { display: grid !important; grid-template-columns: 1fr 1fr; }
    #party-lobby-wait > .menu-btn { width: min(300px, 90vw) !important; margin-left: auto; margin-right: auto; display: block; }

    /* 図鑑：横に広く、マスを5列に */
    #zukan-overlay > div { width: min(760px, 94vw) !important; }
    #zukan-overlay .zukan-grid { grid-template-columns: repeat(5, 1fr); }
    #zukan-overlay .ranking-panel h2 { font-size: 18px !important; }
    /* 図鑑のくわしい画面：絵の横に名前と説明 */
    #zukan-detail-overlay > div { width: min(560px, 92vw) !important; }
    #zukan-detail-overlay > div > div {
        display: grid;
        grid-template-columns: auto 1fr;
        grid-auto-rows: min-content;
        column-gap: 14px;
        align-items: center;
        text-align: left !important;
    }
    #zukan-detail-img { width: auto !important; max-width: 40vw; max-height: 62vh; grid-row: span 9; margin-bottom: 0 !important; }

    /* ランキング・称号：少し広く */
    #ranking-overlay > div { width: min(520px, 94vw) !important; }
}

/* ── 📱 横向き（低い画面）：試合画面 ──
   横長用の並び（左に情報・右に盤面）は高さ300px以上から使う（上の500px→300px）。
   低い画面では左の欄に案内役を置く余裕がないので、盤面の右の空き（木目）に立たせる。 */
@media (orientation: landscape) and (max-height: 600px) {
    body.solo-mode .char-dock-timerrow {
        position: fixed;
        left: auto;
        right: calc(var(--sa-right) + 6px);
        bottom: calc(var(--sa-bottom) + 36px);
        margin: 0;
        height: min(36vh, 150px);
        width: auto;
        max-width: none;
    }
    body.solo-mode #p1-section .ui-container { gap: 6px; padding: 8px; }
    body.solo-mode #p1-image-box { height: clamp(70px, 22vh, 120px); }
}

/* 横向きのスマホではナビゲーションバーが横に来るので、下の26pxの保険（縦向き用）はやめ、
   左右にカメラの切り欠き・ナビゲーションバーの分をあける */
@media (orientation: landscape) and (max-height: 600px) {
    :root { --safe-area-bottom: var(--sa-bottom); }
    body {
        padding-left: var(--sa-left);
        padding-right: var(--sa-right);
    }
}

/* 試合中の🏠（一時停止）：横向きでは横に広げ、遊び方のカードを1列に並べて縦を詰める */
@media (orientation: landscape) and (max-height: 600px) {
    #solo-explanation-panel { width: min(94vw, 720px) !important; max-height: 92vh !important; max-height: 92dvh !important; }
    #solo-explanation-panel .hp-grid { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); margin-bottom: 8px; }
    #solo-explanation-panel .hp-card { padding: 6px 3px 5px; }
    #solo-explanation-panel .hp-card .hp-ico { font-size: 24px; }
}

/* ── 📱 横向き：結果画面（左に結果、右にボタン。縦に積むと画面の倍ほどの高さになった） ── */
@media (orientation: landscape) and (max-height: 600px) {
    #result-screen { padding-top: calc(var(--sa-top) + 8px); }
    .result-window {
        display: grid;
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
        column-gap: 20px;
        align-items: center;
        justify-items: center;
        max-width: min(760px, 94vw);
        width: 94%;
        padding: 12px 20px;
    }
    .result-window > * { grid-column: 1; }
    .result-window > .result-btns { grid-column: 2; grid-row: 1 / span 20; align-self: center; width: 100%; }
    .result-window #result-text { margin: 0 0 4px; }
    .result-window .result-stats-col { flex-direction: row; flex-wrap: wrap; justify-content: center; margin-top: 4px; }
    .result-window .result-stats-col .result-stat-badge { max-width: none; }
    .result-window .menu-btn { margin-top: 6px; margin-bottom: 6px; }
}

/* ── 📱 横向き：全部の画面を1画面に（2026-11-06、実機の大きさ 835×376 で1つずつ測って直した） ── */
@media (orientation: landscape) and (max-height: 600px) {
    /* 画面のふちの余白を詰め、時計・ナビゲーションバー・カメラの分だけ空ける */
    .overlay {
        padding-top: calc(var(--sa-top) + 6px);
        padding-bottom: calc(var(--sa-bottom) + 6px);
        padding-left: calc(var(--sa-left) + 8px);
        padding-right: calc(var(--sa-right) + 8px);
    }

    /* CPUと対戦：レベル選びを左、ボタン2つを右に（ui.js が style.display='flex' を入れるので !important） */
    #cpu-mode-select:not([style*="none"]) {
        display: grid !important;
        grid-template-columns: auto auto;
        grid-template-areas: "t t" "p b1" "p b2";
        justify-content: center;
        align-content: center;
        align-items: center;
        column-gap: 24px;
    }
    #cpu-mode-select > .title-pop { grid-area: t; justify-self: center; margin-bottom: 10px !important; }
    #cpu-mode-select > #cpu-level-panel { grid-area: p; margin-bottom: 0; }
    #cpu-mode-select > .menu-btn:nth-of-type(1) { grid-area: b1; }
    #cpu-mode-select > .menu-btn:nth-of-type(2) { grid-area: b2; }

    /* パーティの待合室：部屋番号を左、参加者を右、ボタンは下に横並び（party.js が style.display='block' を入れる） */
    #party-lobby-wait:not([style*="none"]) {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
        column-gap: 12px;
        align-items: stretch;
        width: min(720px, 94vw) !important;
    }
    #party-lobby-wait > h3 { grid-column: 1 / -1; margin-bottom: 6px !important; }
    #party-lobby-wait > #party-room-display { margin-bottom: 10px !important; }
    #party-lobby-wait > div:not(#party-room-display) { margin-bottom: 10px !important; }
    #party-lobby-wait > .menu-btn { width: 100% !important; margin: 0 !important; }

    /* プレイエリアの背景：見本を低く */
    #bg-preview-wrap { height: 64px !important; }
    /* 乱入の受け付け：説明の文字を少し小さく */
    #raid-setting-overlay > div > div:nth-of-type(2) { font-size: 11px !important; line-height: 1.45 !important; }
}
@media (orientation: landscape) and (max-height: 600px) {
    /* 称号：一覧を少し低くして「閉じる」をふちから離す */
    #titles-list { max-height: calc(100dvh - 160px - var(--sa-top) - var(--sa-bottom)) !important; }
}
@media (orientation: landscape) and (max-height: 600px) {
    /* 図鑑・ランキング：窓の高さを画面の残りに合わせる（中は窓の中でスクロール） */
    #zukan-overlay .ranking-panel,
    #ranking-overlay .ranking-panel { max-height: calc(100dvh - 20px - var(--sa-top) - var(--sa-bottom)) !important; }
}

/* ============================================================
   🏪 タイトルをお店に（2026-11-07、ユーザーの見本画像2＝明るいお店から）
   ------------------------------------------------------------
   見本の画像（941×1672）から切り出した部品を並べる。images/title_shop/
     top.webp   … 緑の壁・コイン・ひさしの看板（ロゴの文字は絵のまま）・上の棚
     band.webp  … 上の棚の板（画面が top より広い時に横へくり返す）
     slat.webp  … 縦板の壁（くり返し）　floor.webp … 床
     stand.webp … 入門・実績・設定（・インストール）の台。札の中の絵と文字はHTML
   --s ＝ 見本の1pxを画面の何pxにするか。縦にも横にも収まる大きさ。
   ボタンは今までのHTML（色は見本に合わせてつやのある丸いボタンに）。案内役は今までどおり。
   スマホの横向き（高さ600px以下）は前の並びのまま。
   前の版（見本1の切り出し・骨董屋風）は android\public_backup_タイトルお店_骨董屋風_20261107
   ============================================================ */
@media (orientation: portrait), (min-height: 601px) {
    #menu-screen.title-screen {
        --s: min(calc(100dvh / 1672), calc(100vw / 941));
        --shop-top: var(--sa-top, 0px);
        justify-content: flex-start;
        padding-top: 0;
        padding-bottom: 0;
        background:
            var(--title-top, url("images/title_shop/top_wide.webp")) center var(--shop-top) / calc(4000 * var(--s)) calc(548 * var(--s)) no-repeat,   /* 🌐 英語は --title-top で top_wide_en.webp（style.css 末尾）。横に広げた版（作り方＝試作_その他/タイトルお店_横に広げる.py） */
            url("images/title_shop/band.webp") 0 calc(var(--shop-top) + 496 * var(--s)) / calc(8 * var(--s)) calc(52 * var(--s)) repeat-x,
            /* 広い画面で top の外に続く緑の格子の壁 */
            repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.13) 0 calc(3 * var(--s)), transparent calc(3 * var(--s)) calc(86 * var(--s))) 0 0 / 100% calc(var(--shop-top) + 500 * var(--s)) no-repeat,
            repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.13) 0 calc(3 * var(--s)), transparent calc(3 * var(--s)) calc(86 * var(--s))) 0 0 / 100% calc(var(--shop-top) + 500 * var(--s)) no-repeat,
            linear-gradient(180deg, #84cf5e 0, #5fae45 calc(var(--shop-top) + 500 * var(--s)), transparent calc(var(--shop-top) + 500 * var(--s))),
            url("images/title_shop/floor.webp") center bottom / auto calc(100 * var(--s) + var(--sa-bottom, 0px)) repeat-x,
            url("images/title_shop/slat.webp") center calc(var(--shop-top) + 548 * var(--s)) / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
            #e0a052 !important;
    }
    #menu-screen.title-screen::before,
    #menu-screen.title-screen .ts-bg,
    .ts-logo-coin-l, .ts-logo-coin-r { display: none !important; }

    /* ロゴは看板の絵に入っているので、文字は見えないまま場所だけ取る（読み上げ用に残す） */
    #menu-screen.title-screen .ts-logo-wrap {
        zoom: 1 !important;   /* タブレット用の拡大(zoom 1.25/1.5)を看板・台には効かせない（背景とずれる） */
        margin-top: var(--shop-top);
        height: calc(548 * var(--s));
        visibility: hidden;
        overflow: hidden;
    }

    /* ボタン：見本と同じ、太いふちとつやのある丸いボタン */
    #menu-screen.title-screen .ts-main-btns {
        zoom: 1 !important;
        margin-top: calc(4 * var(--s));
        gap: calc(17 * var(--s));
        padding: 0;
    }
    #menu-screen.title-screen .ts-btn {
        width: calc(790 * var(--s));
        max-width: none;
        height: calc(146 * var(--s));
        padding: 0 calc(40 * var(--s)) 0 calc(48 * var(--s));
        gap: calc(36 * var(--s));
        border-radius: calc(73 * var(--s));
        border: calc(5 * var(--s)) solid var(--btn-edge);
        /* !important：友だちと対戦のボタンは JS が style に色を直接入れる */
        background: linear-gradient(180deg, var(--btn-hi) 0%, var(--btn-mid) 52%, var(--btn-lo) 100%) !important;
        box-shadow: 0 calc(8 * var(--s)) 0 var(--btn-edge), 0 calc(12 * var(--s)) calc(16 * var(--s)) rgba(90, 50, 10, 0.3) !important;
    }
    #menu-screen.title-screen .ts-btn:active { box-shadow: 0 calc(3 * var(--s)) 0 var(--btn-edge) !important; }
    #menu-screen.title-screen .ts-btn::after {
        inset: calc(6 * var(--s)) calc(30 * var(--s)) auto calc(30 * var(--s));
        height: 42%;
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.08));
        border-radius: calc(60 * var(--s));
    }
    #menu-screen.title-screen .ts-btn-icon { font-size: calc(70 * var(--s)); }
    #menu-screen.title-screen .ts-btn-body { gap: calc(4 * var(--s)); }
    #menu-screen.title-screen .ts-btn-title {
        font-size: calc(48 * var(--s));
        line-height: 1.15;
        text-shadow: 0 calc(3 * var(--s)) 0 var(--btn-edge);
    }
    #menu-screen.title-screen .ts-btn-desc {
        font-size: max(9px, calc(28 * var(--s)));
        color: #fff;
        text-shadow: 0 calc(2 * var(--s)) 0 var(--btn-edge);
    }
    #menu-screen.title-screen .ts-btn-arrow { font-size: calc(76 * var(--s)); color: #fff; text-shadow: 0 calc(3 * var(--s)) 0 var(--btn-edge); }
    #menu-screen.title-screen .ts-btn-solo   { --btn-hi: #6cc93a; --btn-mid: #3fae1e; --btn-lo: #2a9312; --btn-edge: #1d6a0b; }   /* 2026-11-15 明るい緑だと白い文字と🧩が読みにくい（ユーザー）→ 濃く */
    #menu-screen.title-screen .ts-btn-solo .ts-btn-icon { filter: drop-shadow(0 0 calc(3 * var(--s)) #fff) drop-shadow(0 0 calc(3 * var(--s)) #fff); }
    #menu-screen.title-screen .ts-btn-cpu    { --btn-hi: #6cc2ff; --btn-mid: #3aa2f5; --btn-lo: #1f84e6; --btn-edge: #1560b8; }
    #menu-screen.title-screen .ts-btn-online { --btn-hi: #ff8fb4; --btn-mid: #ff5b8f; --btn-lo: #ef3d78; --btn-edge: #c0225a; }
    #menu-screen.title-screen .ts-btn-party  { --btn-hi: #d79bff; --btn-mid: #b464f5; --btn-lo: #973fe4; --btn-edge: #6d22b5; }
    #menu-screen.title-screen .ts-btn:disabled { --btn-hi: #d8d8d8; --btn-mid: #c4c4c4; --btn-lo: #b0b0b0; --btn-edge: #8a8a8a; }   /* 友だちと対戦の交代待ち */
    #menu-screen.title-screen .ts-btn-hoard  { --btn-hi: #ffc77a; --btn-mid: #f9a43f; --btn-lo: #ec8a1d; --btn-edge: #b5620b; }

    /* 入門・実績・設定は床の上の台に */
    #menu-screen.title-screen .ts-icon-row--bottom {
        zoom: 1 !important;
        margin-top: auto;
        padding: 0 calc(30 * var(--s)) calc(var(--sa-bottom, 0px) + 60 * var(--s));
        gap: calc(22 * var(--s));
        width: 100%;
        justify-content: center;
        align-items: flex-end;
    }
    #menu-screen.title-screen .ts-icon-btn {
        position: relative;
        width: calc(206 * var(--s));
        height: calc(272 * var(--s));
        min-width: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;   /* 元のボタンのすりガラスを消す（台のまわりが四角くぼけた） */
        background: url("images/title_shop/stand.webp") center / 100% 100% no-repeat;
    }
    #menu-screen.title-screen .ts-icon-btn::before { content: none; }
    #menu-screen.title-screen .ts-icon-btn span,
    #menu-screen.title-screen .ts-icon-btn small {
        position: absolute;
        left: 0;
        right: 0;
        text-align: center;
    }
    #menu-screen.title-screen .ts-icon-btn span { top: calc(36 * var(--s)); font-size: calc(72 * var(--s)); line-height: 1; }
    #menu-screen.title-screen .ts-icon-btn small { top: calc(130 * var(--s)); font-size: max(10px, calc(34 * var(--s))); font-weight: 900; color: #4a3020; }
}
/* 幅のせまいスマホは台を左に寄せ、右下の案内役と重ならないように */
@media (orientation: portrait) and (max-width: 560px) {
    #menu-screen.title-screen .ts-icon-row--bottom { justify-content: flex-start; }
}

/* ============================================================
   🏪 一人で遊ぶの画面も、タイトルのお店の中の続きに（2026-11-07）
   上に緑の格子の壁紙と棚の板（band）、その下は縦板の壁（slat）、いちばん下に床（floor）。
   部品はタイトルと同じ images/title_shop/。--s もタイトルと同じ（見本941×1672の1px）。
   ============================================================ */
/* お買い物モード・両替モードの「さいしょから／続きから」も同じ棚の壁 */
#solo-mode-select,
#shopping-mode-select,
#hoard-mode-select {
    --s: min(calc(100dvh / 1672), calc(100vw / 941));
    --wall-h: calc(var(--sa-top, 0px) + 236 * var(--s));
    background:
        /* 商品の棚：上の棚（板の上）と床の上の低い棚。部品は images/title_shop/goods_*.webp（作り方＝試作_その他/一人で遊ぶ_商品の棚_作り方.py） */
        url("images/title_shop/goods_top.webp") center calc(var(--wall-h) + 52 * var(--s) - 282 * var(--s)) / calc(941 * var(--s)) calc(282 * var(--s)) no-repeat,
        url("images/title_shop/goods_low.webp") center calc(100% - 92 * var(--s) - var(--sa-bottom, 0px)) / calc(941 * var(--s)) calc(262 * var(--s)) no-repeat,
        url("images/title_shop/band.webp") 0 var(--wall-h) / calc(8 * var(--s)) calc(52 * var(--s)) repeat-x,
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.13) 0 calc(3 * var(--s)), transparent calc(3 * var(--s)) calc(86 * var(--s))) 0 0 / 100% var(--wall-h) no-repeat,
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.13) 0 calc(3 * var(--s)), transparent calc(3 * var(--s)) calc(86 * var(--s))) 0 0 / 100% var(--wall-h) no-repeat,
        linear-gradient(180deg, #84cf5e 0, #5fae45 var(--wall-h), transparent var(--wall-h)),
        url("images/title_shop/floor.webp") center bottom / auto calc(100 * var(--s) + var(--sa-bottom, 0px)) repeat-x,
        url("images/title_shop/slat.webp") center calc(var(--wall-h) + 52 * var(--s)) / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
        #e0a052 !important;
}

/* ============================================================
   🏪 モードごとに「お店の別の場所」（2026-11-07）。小物の絵は images/title_shop/
   （作り方＝試作_その他/モード画面_お店の小物_作り方.py）
   ============================================================ */
#cpu-mode-select, #online-menu, #party-menu {
    --s: min(calc(100dvh / 1672), calc(100vw / 941));
}

/* ── 🤖 CPUと対戦＝レジカウンター：上に黒板（見出しとレベル）、下にカウンターとレジ、奥にCPUの店員 ── */
#cpu-mode-select {
    justify-content: space-between !important;
    padding: calc(var(--sa-top, 0px) + 7vh) 0 0 !important;
    --shelf-y: 50vh;   /* 壁の棚（商品つき）の板の上の高さ */
    background:
        url("images/title_shop/goods_top.webp") center calc(var(--shelf-y) + 52 * var(--s) - 282 * var(--s)) / calc(941 * var(--s)) calc(282 * var(--s)) no-repeat,
        url("images/title_shop/band.webp") 0 var(--shelf-y) / calc(8 * var(--s)) calc(52 * var(--s)) repeat-x,
        url("images/title_shop/slat.webp") center 0 / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
        #e0a052 !important;
}
#cpu-mode-select .cpu-board {
    position: relative;
    width: min(300px, 86vw);
    padding: 18px 16px 10px;
    box-sizing: border-box;
    background: radial-gradient(ellipse at 40% 30%, #3f6b52 0%, #2c4d3b 70%);
    border: 10px solid #a8642a;
    border-radius: 10px;
    box-shadow: inset 0 0 0 3px #7a4519, inset 0 0 18px rgba(0, 0, 0, 0.35), 0 8px 14px rgba(80, 40, 5, 0.35);
}
/* 黒板をつるすひも */
#cpu-mode-select .cpu-board::before {
    content: "";
    position: absolute;
    left: 50%;
    top: -48px;
    width: 120px;
    height: 44px;
    transform: translateX(-50%);
    background:
        radial-gradient(circle at 50% 6px, #d9a441 5px, transparent 6px),
        linear-gradient(to bottom right, transparent calc(50% - 1.5px), #6d3c12 calc(50% - 1.5px), #6d3c12 calc(50% + 1.5px), transparent calc(50% + 1.5px)) 0 0 / 50% 100% no-repeat,
        linear-gradient(to bottom left, transparent calc(50% - 1.5px), #6d3c12 calc(50% - 1.5px), #6d3c12 calc(50% + 1.5px), transparent calc(50% + 1.5px)) 100% 0 / 50% 100% no-repeat;
}
#cpu-mode-select .cpu-board .title-pop { margin-bottom: 10px !important; background: none !important; box-shadow: none !important; border: none !important; padding: 0 !important; }
#cpu-mode-select .cpu-board h2 { color: #fffbea !important; text-shadow: 0 0 2px rgba(255, 255, 255, 0.5); }
#cpu-mode-select #cpu-level-panel {
    width: 100% !important;
    box-sizing: border-box;
    background: transparent !important;
    border: 2px dashed rgba(255, 255, 255, 0.55) !important;
    box-shadow: none !important;
    margin-bottom: 6px !important;
}
#cpu-mode-select #cpu-level-panel > div:first-child { color: #ffe08a !important; }
#cpu-mode-select #cpu-level-panel > div:nth-child(2),
#cpu-mode-select #cpu-level-max-note { color: rgba(255, 255, 255, 0.75) !important; }
/* カウンター：天板＋前の板。ボタンは前の板に */
#cpu-mode-select .cpu-counter {
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 34px 16px calc(22px + var(--sa-bottom, 0px));
    box-sizing: border-box;
    background:
        linear-gradient(180deg, #f0b46a 0, #d98e45 14px, #8a4a18 14px, #8a4a18 20px, transparent 20px),
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.08) 0 2px, transparent 2px 64px),
        linear-gradient(180deg, #b8692b 0, #9c5520 100%);
    box-shadow: 0 -6px 12px rgba(80, 40, 5, 0.25);
}
/* レジ（天板の右の上） */
#cpu-mode-select .cpu-counter::after {
    content: "";
    position: absolute;
    right: max(4%, 10px);
    bottom: calc(100% - 8px);
    width: clamp(96px, 26vw, 180px);
    aspect-ratio: 260 / 230;
    background: url("images/title_shop/cpu_register.webp") center / contain no-repeat;
}
/* CPUの店員（カウンターの奥から顔を出す） */
#cpu-mode-select .cpu-counter::before {
    content: "🤖";
    position: absolute;
    left: max(8%, 14px);
    bottom: calc(100% - 6px);
    font-size: clamp(64px, 18vw, 110px);
    line-height: 1;
    z-index: -1;
    filter: drop-shadow(0 4px 4px rgba(80, 40, 5, 0.3));
}
#cpu-mode-select .cpu-counter .menu-btn { margin-bottom: 0; }

/* ── 👫 友だちと対戦＝お店の入口：空・看板・ひさし・左右のショーウィンドウ・ドア・歩道 ── */
#online-menu {
    --awn-y: calc(var(--sa-top, 0px) + 96px);
    justify-content: flex-start !important;
    padding: calc(var(--sa-top, 0px) + 14px) 10px calc(14px + var(--sa-bottom, 0px)) !important;
    background:
        /* ひさし：赤と生成りのしま＋下のなみなみ */
        radial-gradient(circle at 20px 0, #e8473f 19px, transparent 20px) 0 calc(var(--awn-y) + 34px) / 80px 22px repeat-x,
        radial-gradient(circle at 20px 0, #fff2d6 19px, transparent 20px) 40px calc(var(--awn-y) + 34px) / 80px 22px repeat-x,
        repeating-linear-gradient(90deg, #e8473f 0 40px, #fff2d6 40px 80px) 0 var(--awn-y) / 100% 36px no-repeat,
        /* 歩道 */
        repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 2px, transparent 2px 60px) 0 100% / 100% calc(50px + var(--sa-bottom, 0px)) no-repeat,
        linear-gradient(180deg, #b9b2a6 0, #a39b8e 100%) 0 100% / 100% calc(50px + var(--sa-bottom, 0px)) no-repeat,
        /* 空（ひさしの上）＋雲 */
        radial-gradient(ellipse 60px 22px at 18% 30px, #fff 60%, transparent 62%) 0 var(--sa-top, 0px) / 100% var(--awn-y) no-repeat,
        radial-gradient(ellipse 80px 26px at 82% 52px, #fff 60%, transparent 62%) 0 var(--sa-top, 0px) / 100% var(--awn-y) no-repeat,
        linear-gradient(180deg, #7cc8f5 0, #bfe6fb var(--awn-y), transparent var(--awn-y)),
        /* お店の壁（板） */
        url("images/title_shop/slat.webp") center 0 / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
        #e0a052 !important;
}
/* 看板 */
#online-menu .online-sign {
    background: linear-gradient(180deg, #a8642a, #8a4b1f);
    border: 4px solid #6d3812;
    border-radius: 14px;
    padding: 10px 26px;
    margin-bottom: 34px;
    box-shadow: 0 6px 10px rgba(60, 30, 5, 0.35);
}
#online-menu .online-sign h2 {
    font-size: clamp(18px, 6vw, 32px);
    font-weight: 900;
    color: #fff3c4;
    text-shadow: 0 2px 0 #5a2c0a;
    white-space: nowrap;
}
/* カード2枚を左右のショーウィンドウに（縦向きでも横に並べる） */
#online-menu .ls-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));   /* スマホは縦に1枚ずつ＝ボタンを大きく（2026-11-07「見栄えより遊びやすさ」） */
    gap: clamp(10px, 3vw, 22px);
    width: min(680px, 100%);
    align-items: stretch;
}
#online-menu .shop-window {
    position: relative;
    width: auto !important;
    margin: 0 !important;
    padding: clamp(12px, 3vw, 24px) clamp(8px, 2.4vw, 18px) !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
    border-radius: 4px !important;
    border: 9px solid #8a4b1f !important;
    box-shadow: inset 0 0 0 2px #5e2f0e, 0 6px 10px rgba(60, 30, 5, 0.3) !important;
    background:
        linear-gradient(125deg, transparent 0 18%, rgba(255, 255, 255, 0.55) 18% 24%, transparent 24% 30%, rgba(255, 255, 255, 0.35) 30% 33%, transparent 33%),
        linear-gradient(180deg, #e9f8ff 0%, #c4e8fb 100%) !important;
}
/* 文字とボタンは画面に合わせて大きく（2026-11-07 ユーザー「ちいさくて見にくい」） */
#online-menu .shop-window h4 { margin: 2px 0 clamp(8px, 2vw, 16px) !important; white-space: nowrap; font-size: clamp(16px, 4vw, 24px) !important; }
#online-menu .shop-window .menu-btn { white-space: normal; font-size: clamp(17px, 4.2vw, 24px) !important; padding: 16px 6px !important; min-height: 58px; }
#online-menu .shop-window input { width: 100%; box-sizing: border-box; font-size: clamp(17px, 4vw, 22px) !important; padding: 12px !important; min-height: 52px; }
#online-menu #room-number-display { padding: 10px 4px !important; }
#online-menu #room-id-numbers { font-size: clamp(26px, 8vw, 40px) !important; letter-spacing: 2px !important; }
/* 「タイトルへ」：ドアの形はやめ、押しやすい横長のボタンに（2026-11-07「見栄えより遊びやすさ」） */
#online-menu > .menu-btn:last-child {
    margin-top: auto;
    margin-bottom: calc(60px + var(--sa-bottom, 0px));
    width: min(320px, 90%) !important;
    min-height: 56px;
    font-size: 18px !important;
}

/* ── 🎉 パーティ＝倉庫：暗めの板の壁・コンクリートの床・飾りの旗・積んだ段ボール。中身は大きな段ボール箱に ── */
#party-menu {
    background:
        url("images/title_shop/party_flags.webp") 0 calc(var(--sa-top, 0px) + 6px) / 120px 52px repeat-x,
        url("images/title_shop/party_flags.webp") 60px calc(var(--sa-top, 0px) + 70px) / 120px 52px repeat-x,
        url("images/title_shop/party_boxes.webp") left -30px bottom calc(40px + var(--sa-bottom, 0px)) / auto min(42vh, 360px) no-repeat,
        linear-gradient(180deg, #8e8a84 0, #77736d 100%) 0 100% / 100% calc(52px + var(--sa-bottom, 0px)) no-repeat,
        linear-gradient(180deg, rgba(40, 20, 5, 0.38), rgba(40, 20, 5, 0.22)),
        url("images/title_shop/slat.webp") center 0 / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
        #b07a3e !important;
}
#party-menu { overflow-x: hidden; }   /* 右の段ボールが画面の外へはみ出す分で横にスクロールしないように */
/* 右の段ボール（左右反転） */
#party-menu::after {
    content: "";
    position: absolute;
    right: -30px;
    bottom: calc(40px + var(--sa-bottom, 0px));
    height: min(42vh, 360px);
    aspect-ratio: 260 / 520;
    background: url("images/title_shop/party_boxes.webp") center / contain no-repeat;
    transform: scaleX(-1);
    pointer-events: none;
}
#party-menu #party-menu-select,
#party-menu #party-lobby-wait {
    position: relative;
    z-index: 1;
    padding: 30px 14px 16px;
    box-sizing: border-box;
    width: min(330px, 92vw) !important;
    background:
        linear-gradient(90deg, transparent calc(50% - 26px), rgba(240, 222, 170, 0.95) calc(50% - 26px), rgba(240, 222, 170, 0.95) calc(50% + 26px), transparent calc(50% + 26px)) 0 0 / 100% 22px no-repeat,
        linear-gradient(180deg, #c68a4c 0 12px, #e2b072 12px);
    border: 4px solid #9a6431;
    border-radius: 6px;
    box-shadow: 0 10px 16px rgba(40, 20, 5, 0.4);
}
#party-menu #party-menu-select > p { color: #5a3a1a !important; }

/* 🖐 モード画面は見栄えより押しやすさ（2026-11-07 ユーザー指定）：ボタンは高さ56px以上・幅は画面の9割まで、文字は17px以上 */
#cpu-mode-select .menu-btn,
#party-menu .menu-btn,
#party-menu input {
    width: min(340px, 90vw) !important;
    min-height: 56px;
    font-size: max(17px, 1em) !important;
    box-sizing: border-box;
}
#party-menu #party-menu-select .menu-btn,
#party-menu #party-menu-select input { width: 100% !important; }
#party-menu #party-menu-select,
#party-menu #party-lobby-wait { width: min(380px, 94vw) !important; }
#party-menu button[onclick*="partyAdjustPlayerCount"] { width: 52px !important; height: 52px !important; min-height: 52px; }

/* 友だちと対戦：下半分が淋しい（2026-11-07）→ 中身を看板と下の飾りのあいだのまん中に寄せ、歩道の上にデュエルスペース（ユーザー案。机に盤面2つと VS、作り方＝試作_その他/友だちと対戦_デュエルスペース_作り方.py）、待っている知らせは白い札で大きく */
#online-menu .ls-row { margin-top: auto; }
#online-menu > .menu-btn:last-child {
    margin-top: 14px;
    margin-bottom: auto;
}
#online-menu {
    padding-bottom: calc(50px + 300 * var(--s) + 8px + var(--sa-bottom, 0px)) !important;
}
#online-menu::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(50px + var(--sa-bottom, 0px) - 8px);
    height: calc(300 * var(--s));
    background: url("images/title_shop/duel_space.webp") center bottom / auto 100% no-repeat;
    pointer-events: none;
}
#online-menu #matching-timer-container {
    margin-top: 12px;
    padding: 12px 18px;
    width: min(340px, 90vw) !important;
    box-sizing: border-box;
    background: #fffdf5;
    border: 3px solid #8a4b1f;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(60, 30, 5, 0.25);
    font-size: 17px !important;
    text-align: center;
}
#online-menu #matching-timer-container * { font-size: inherit !important; }
/* 横長（PC）は高さが足りないので、デュエルスペースを小さめに */
@media (orientation: landscape) {
    #online-menu { padding-bottom: calc(50px + 220 * var(--s) + 8px + var(--sa-bottom, 0px)) !important; }
    #online-menu::after { height: calc(220 * var(--s)); }
    #online-menu .online-sign { margin-bottom: 16px; }
}

/* 🎉 パーティ：下の段ボールをやめ、友だちと対戦と同じ「通信で遊ぶ」絵に（2026-11-07 ユーザー指定。ゲームの画面はパーティ＝みんなで1つの3Dの盤面。
   作り方＝試作_その他/パーティ_通信の絵_作り方.py）。中身の箱は旗と絵のあいだのまん中 */
#party-menu {
    padding-top: calc(var(--sa-top, 0px) + 20px) !important;
    padding-bottom: calc(52px + 300 * var(--s) + 8px + var(--sa-bottom, 0px)) !important;
    justify-content: center !important;
    background:
        url("images/title_shop/party_flags.webp") 0 calc(var(--sa-top, 0px) + 6px) / 120px 52px repeat-x,
        url("images/title_shop/party_flags.webp") 60px calc(var(--sa-top, 0px) + 70px) / 120px 52px repeat-x,
        linear-gradient(180deg, #8e8a84 0, #77736d 100%) 0 100% / 100% calc(52px + var(--sa-bottom, 0px)) no-repeat,
        linear-gradient(180deg, rgba(40, 20, 5, 0.38), rgba(40, 20, 5, 0.22)),
        url("images/title_shop/slat.webp") center 0 / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
        #b07a3e !important;
}
#party-menu::after {
    left: 0;
    right: 0;
    bottom: calc(52px + var(--sa-bottom, 0px) - 8px);
    height: calc(300 * var(--s));
    aspect-ratio: auto;
    background: url("images/title_shop/party_net.webp") center bottom / auto 100% no-repeat;
    transform: none;
}
@media (orientation: landscape) {
    #party-menu { padding-bottom: calc(52px + 220 * var(--s) + 8px + var(--sa-bottom, 0px)) !important; }
    #party-menu::after { height: calc(220 * var(--s)); }
}

/* CPUと対戦：ボタンは黒板のすぐ下へ（画面のいちばん下だと押しにくい、2026-11-07 ユーザー）。下のカウンターは飾りだけ */
#cpu-mode-select { justify-content: flex-start !important; }
#cpu-mode-select .cpu-actions {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: min(330px, 90vw);
    margin-top: 22px;
}
#cpu-mode-select .cpu-actions .menu-btn { width: 100%; margin-bottom: 0; }
#cpu-mode-select .cpu-counter {
    margin-top: auto;
    min-height: calc(70px + var(--sa-bottom, 0px));
    padding: 0 !important;
}
/* CPUと対戦：下半分に対戦台（自分の盤面 VS CPUの盤面、images/title_shop/cpu_vs.webp、作り方＝試作_その他/CPUと対戦_対戦台の絵_作り方.py）。
   ロボットは絵の中にいるので、カウンターの 🤖 は消す */
#cpu-mode-select .cpu-counter::before {
    content: "";
    left: 50%;
    bottom: calc(100% - 6px);
    width: min(600px, 100vw, 60vh);
    aspect-ratio: 941 / 540;
    transform: translateX(-50%);
    background: url("images/title_shop/cpu_vs.webp") center bottom / contain no-repeat;
    z-index: 0;
    filter: none;
}
#cpu-mode-select .cpu-counter::after { display: none; }   /* レジは盤面と重なるので出さない */
/* CPUと対戦：壁の棚（商品）はボタンと重なるのでやめる（レベルの欄が出ると黒板が伸びてボタンが棚に乗った、2026-11-07 ユーザー） */
#cpu-mode-select {
    background:
        url("images/title_shop/slat.webp") center 0 / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
        #e0a052 !important;
}

/* ============================================================
   🏪 設定・記録などの画面も、お店の中に（2026-11-07 ユーザー「設定画面などが寂しい、タイトルのようににぎやかに」）
   一人で遊ぶの画面と同じ部品（緑の格子の壁紙・棚の板・縦板の壁・床）。
   カードが小さい画面は棚と床に商品も並べる。中身が縦に長い画面（称号・ランキング・図鑑）は商品なし（カードの後ろからはみ出すため）
   ============================================================ */
#records-hub-overlay, #settings-overlay, #appearance-setting-overlay, #battle-setting-overlay, #bg-setting-overlay,
#char-setting-overlay, #audio-setting-overlay, #battletime-setting-overlay, #raid-setting-overlay,
#titles-overlay, #ranking-overlay, #zukan-overlay {
    --s: min(calc(100dvh / 1672), calc(100vw / 941));
    --wall-h: calc(var(--sa-top, 0px) + 236 * var(--s));
    background:
        url("images/title_shop/goods_top.webp") center calc(var(--wall-h) + 52 * var(--s) - 282 * var(--s)) / calc(941 * var(--s)) calc(282 * var(--s)) no-repeat,
        url("images/title_shop/goods_low.webp") center calc(100% - 92 * var(--s) - var(--sa-bottom, 0px)) / calc(941 * var(--s)) calc(262 * var(--s)) no-repeat,
        url("images/title_shop/band.webp") 0 var(--wall-h) / calc(8 * var(--s)) calc(52 * var(--s)) repeat-x,
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.13) 0 calc(3 * var(--s)), transparent calc(3 * var(--s)) calc(86 * var(--s))) 0 0 / 100% var(--wall-h) no-repeat,
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.13) 0 calc(3 * var(--s)), transparent calc(3 * var(--s)) calc(86 * var(--s))) 0 0 / 100% var(--wall-h) no-repeat,
        linear-gradient(180deg, #84cf5e 0, #5fae45 var(--wall-h), transparent var(--wall-h)),
        url("images/title_shop/floor.webp") center bottom / auto calc(100 * var(--s) + var(--sa-bottom, 0px)) repeat-x,
        url("images/title_shop/slat.webp") center calc(var(--wall-h) + 52 * var(--s)) / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
        #e0a052 !important;
}
#titles-overlay, #ranking-overlay, #zukan-overlay {
    background:
        url("images/title_shop/band.webp") 0 var(--wall-h) / calc(8 * var(--s)) calc(52 * var(--s)) repeat-x,
        repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.13) 0 calc(3 * var(--s)), transparent calc(3 * var(--s)) calc(86 * var(--s))) 0 0 / 100% var(--wall-h) no-repeat,
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.13) 0 calc(3 * var(--s)), transparent calc(3 * var(--s)) calc(86 * var(--s))) 0 0 / 100% var(--wall-h) no-repeat,
        linear-gradient(180deg, #84cf5e 0, #5fae45 var(--wall-h), transparent var(--wall-h)),
        url("images/title_shop/floor.webp") center bottom / auto calc(100 * var(--s) + var(--sa-bottom, 0px)) repeat-x,
        url("images/title_shop/slat.webp") center calc(var(--wall-h) + 52 * var(--s)) / calc(208 * var(--s)) calc(16 * var(--s)) repeat,
        #e0a052 !important;
}

/* ============================================================
   🍭 見出しとボタンは、タイトルの看板のようなポップな書体（Mochiy Pop One＝Koicoin Pop）に（2026-11-07 ユーザー
   「タイトルの画面のかわいいフォントのようなのを他の画面にも使いたい」）。
   長い説明・小さい注意書きは読みやすさを優先して丸ゴシック（M PLUS Rounded 1c）のまま。
   Mochiy Pop One は太さが1つだけなので、太字を作らせない（にじんで読みにくくなる）
   ============================================================ */
h1, h2, h3, h4,
button, .menu-btn,
.ts-btn-title, .ts-icon-btn,
.title-pop, .titles-title,
#party-result-screen .big, #result-screen h2 {
    font-family: 'Koicoin Pop', 'M PLUS Rounded 1c', sans-serif !important;
    font-weight: 400 !important;
    font-synthesis: none;
    letter-spacing: 0.02em;
}
/* ボタンの中の小さい説明（「自分のペースでお会計」など）は丸ゴシックにもどす */
.ts-btn-desc, button small, .menu-btn small, button .pm-lbl ~ *, #cpu-level-panel, #cpu-level-panel * {
    font-family: 'M PLUS Rounded 1c', sans-serif !important;
}
/* 🍭 大きさもタイトルに近づける（2026-11-07 ユーザー「大きさも」）：タイトルのボタンの文字は約21px・ほかの画面のボタンは13〜14pxだった。
   ボタン19px以上・モードのカードの名前21px・見出し26px（小見出し18px）。タイトルの画面（下の台の札）はそのまま */
.overlay:not(#menu-screen) .menu-btn { font-size: max(19px, 1rem) !important; }
.overlay:not(#menu-screen) .ts-btn-title { font-size: 21px !important; }
.overlay:not(#menu-screen) h2 { font-size: 26px !important; }
.overlay:not(#menu-screen) h3 { font-size: 24px !important; }
.overlay:not(#menu-screen) h4 { font-size: 18px !important; }
.overlay:not(#menu-screen) .char-pick-btn { font-size: 18px !important; }   /* 対戦時間・乱入・案内役の選ぶボタン */

/* ============================================================
   🔰 新しいチュートリアル（2026-11-13、js/tutorial2.js）
   上の小さいカード・スポットライト・コインの枚数・まちがえた時の一言・まとめ
   ============================================================ */
.t2-spot { position: fixed; z-index: 8990; border-radius: 14px; pointer-events: none; display: none;
  box-shadow: 0 0 0 3px #ffd166, 0 0 14px 4px rgba(255, 183, 3, .7); transition: all .25s ease; animation: t2-spot 1.2s ease-in-out infinite; }
.t2-spot.dim { box-shadow: 0 0 0 9999px rgba(20, 24, 40, .45), 0 0 0 3px #ffd166, 0 0 14px 4px rgba(255, 183, 3, .7); }
@keyframes t2-spot { 50% { outline: 3px solid rgba(255, 209, 102, .5); outline-offset: 4px; } }
.t2-card { position: fixed; z-index: 9000; box-sizing: border-box; pointer-events: none;
  background: #fffdf5; border: 3px solid #ffb703; border-radius: 14px; padding: 6px 10px 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,.18); color: #3d2c1e; font-size: 15px; line-height: 1.4; font-weight: 700; }
.t2-card button { pointer-events: auto; }
.t2-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.t2-dots i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #e6d8bf; margin-right: 4px; }
.t2-dots i.on { background: #ff8c42; }
.t2-skip { font: inherit; font-size: 13px; color: #7a6a58; background: #fff; border: 2px solid #d8c8ad; border-radius: 999px; padding: 4px 12px; min-height: 32px; }
.t2-body b { color: #d9480f; }
.t2-em { color: #7209b7; font-weight: 900; }
.t2-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.t2-chips span { font-size: 12px; background: #fff1d6; border: 1px solid #f2c27a; border-radius: 8px; padding: 1px 6px; }
.t2-bars { margin-top: 4px; display: grid; gap: 3px; }
.t2-bar { position: relative; height: 22px; border-radius: 8px; background: #eee5d6; overflow: hidden; font-size: 12px; }
.t2-bar i { position: absolute; left: 0; top: 0; bottom: 0; transition: width .3s ease; }
.t2-bar.drop i { background: #c9c3bb; }
.t2-bar.ex i { background: linear-gradient(90deg, #4cc9f0, #2a9dff); }
.t2-bar.time i { background: linear-gradient(90deg, #7cf5c4, #2ec4b6); }
.t2-bar span { position: absolute; left: 8px; top: 3px; z-index: 1; }
.t2-bar b { position: absolute; right: 8px; top: 3px; z-index: 1; color: #3d2c1e; }
.t2-note { font-size: 12px; margin-top: 3px; color: #5a4a3a; }
.t2-btns { margin-top: 6px; text-align: center; }
.t2-btn { font: inherit; font-size: 18px; min-height: 48px; min-width: 140px; padding: 6px 18px; border: none; border-radius: 14px; color: #fff;
  background: linear-gradient(135deg, #ffd166, #f77f00); box-shadow: 0 5px 0 #b35c00; cursor: pointer; }
.t2-btn.big { display: block; width: 100%; min-height: 56px; font-size: 20px; background: linear-gradient(135deg, #4cc9f0, #4361ee); box-shadow: 0 5px 0 #2a3eb1; }
.t2-btn.sub { display: block; width: 100%; margin-top: 12px; color: #5a4a3a; background: #fff; border: 2px solid #d8c8ad; box-shadow: none; }
.t2-count { position: fixed; z-index: 8995; transform: translate(-50%, -100%); pointer-events: none; display: none;
  background: #fff; color: #3d2c1e; border: 2px solid #ffb703; border-radius: 10px; padding: 1px 8px; font-size: 15px; font-weight: 900; white-space: nowrap; }
.t2-count.almost { border-color: #ff4d6d; color: #ff4d6d; }
.t2-toast { position: fixed; z-index: 9005; transform: translate(-50%, -50%) scale(.9); opacity: 0; pointer-events: none;
  background: rgba(255,255,255,.96); border-radius: 14px; padding: 8px 14px; font-size: 16px; font-weight: 900; text-align: center; line-height: 1.4;
  box-shadow: 0 6px 16px rgba(0,0,0,.2); transition: opacity .2s, transform .2s; max-width: 86vw; }
.t2-toast.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.t2-toast.bad { border: 3px solid #ff4d6d; color: #c9184a; }
.t2-toast.good { border: 3px solid #2ec4b6; color: #087f72; }
.t2-toast.info { border: 3px solid #ffb703; color: #3d2c1e; }
.t2-hand { position: fixed; z-index: 8995; font-size: 40px; pointer-events: none; display: none; transform: translate(-50%, 0);
  animation: t2-hand 1.6s ease-in-out infinite; }
@keyframes t2-hand { 0% { margin-left: -70px; opacity: 0; } 15% { opacity: 1; } 60% { margin-left: 50px; opacity: 1; } 75% { margin-left: 50px; transform: translate(-50%, 10px); opacity: 0; } 100% { opacity: 0; } }
.t2-finish { position: fixed; inset: 0; z-index: 9010; background: rgba(20,24,40,.55); display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.t2-fin-box { background: #fffdf5; border: 4px solid #ffb703; border-radius: 18px; padding: 16px 18px; max-width: 420px; width: 100%; color: #3d2c1e; font-weight: 700; }
.t2-fin-title { font-size: 22px; text-align: center; margin-bottom: 8px; }
.t2-fin-box ul { margin: 0 0 14px; padding-left: 20px; font-size: 15px; line-height: 1.5; }
.t2-fin-box li { margin-bottom: 6px; }
.t2-fin-box b { color: #d9480f; }
.hp-more.t2-again { margin-top: 6px; }


/* ============================================================
   📏 遊んでいる最中にルールが分かる見せ方（2026-11-13、js/rule_hints.js）
   ============================================================ */
.rh-count { position: fixed; z-index: 8800; transform: translate(-50%, -100%); pointer-events: none; display: none;
  background: #fff; color: #5b3a1e; border: 3px solid #ffb703; border-radius: 999px; padding: 2px 10px;
  font: 400 15px 'Koicoin Pop', 'M PLUS Rounded 1c', sans-serif; font-synthesis: none; white-space: nowrap;
  box-shadow: 0 3px 0 rgba(0,0,0,.15); transition: left .12s, top .12s; }
.rh-count b { font-size: 19px; color: #f77f00; }
.rh-count.almost { border-color: #ff4d6d; background: #fff0f3; animation: rh-throb .5s ease-in-out infinite alternate; }
.rh-count.almost b { color: #ff4d6d; }
@keyframes rh-throb { from { transform: translate(-50%, -100%) scale(1); } to { transform: translate(-50%, -100%) scale(1.15); } }

.rh-fly { position: fixed; z-index: 9200; pointer-events: none; transform: translate(-50%, -50%) scale(.3); opacity: 0;
  font: 400 26px 'Koicoin Pop', 'M PLUS Rounded 1c', sans-serif; font-synthesis: none; white-space: nowrap;
  padding: 4px 14px; border-radius: 999px; color: #fff; display: flex; align-items: center; gap: 6px;
  transition: transform .35s cubic-bezier(.2,1.6,.4,1), opacity .2s; }
.rh-fly.pop { transform: translate(-50%, -50%) scale(1.15); opacity: 1; }
.rh-fly.go { transition: left .6s cubic-bezier(.5,0,.8,.6), top .6s cubic-bezier(.3,-0.6,.7,.4), transform .6s ease-in, opacity .6s ease-in;
  transform: translate(-50%, -50%) scale(.55); opacity: .9; }
.rh-fly.ex { background: linear-gradient(135deg, #4cc9f0, #4361ee); border: 3px solid #fff; box-shadow: 0 0 18px 6px rgba(76,201,240,.75); }
.rh-fly.pt { background: linear-gradient(135deg, #ffd166, #f77f00); border: 3px solid #fff; box-shadow: 0 0 22px 8px rgba(255,183,3,.8); font-size: 32px; }
.rh-fly.pt small { font-size: 15px; }
.rh-ring { width: 18px; height: 18px; border-radius: 50%; border: 4px solid #fff; box-shadow: 0 0 6px #fff; }

.rh-burst { position: fixed; z-index: 9100; pointer-events: none; width: 20px; height: 20px; border-radius: 50%;
  transform: translate(-50%, -50%); animation: rh-burst .75s ease-out forwards; }
.rh-burst.ex { border: 6px solid #4cc9f0; box-shadow: 0 0 24px #4cc9f0; }
.rh-burst.pt { border: 8px solid #ffd166; box-shadow: 0 0 30px #ffb703; }
.rh-burst.revert { border: 5px dashed #9aa5b1; }
@keyframes rh-burst { from { width: 20px; height: 20px; opacity: 1; } to { width: 150px; height: 150px; opacity: 0; } }

.rh-gauge-hit { animation: rh-gauge-hit .8s ease-out; }
@keyframes rh-gauge-hit { 0% { box-shadow: 0 0 0 0 rgba(76,201,240,.9); transform: scale(1.04); } 100% { box-shadow: 0 0 0 18px rgba(76,201,240,0); transform: scale(1); } }
.rh-score-hit { animation: rh-score-hit .8s cubic-bezier(.2,1.6,.4,1); }
@keyframes rh-score-hit { 0% { transform: scale(1.35); box-shadow: 0 0 24px 8px rgba(255,183,3,.9); } 100% { transform: scale(1); box-shadow: none; } }

.rh-toast { position: fixed; z-index: 9300; transform: translate(-50%, -50%) scale(.6); opacity: 0; pointer-events: none;
  background: #fff; color: #4a3424; border: 4px solid #ffb703; border-radius: 18px; padding: 10px 16px; text-align: center;
  font: 700 17px/1.45 'M PLUS Rounded 1c', sans-serif; box-shadow: 0 6px 0 rgba(0,0,0,.15), 0 0 30px rgba(255,209,102,.7);
  transition: transform .3s cubic-bezier(.2,1.6,.4,1), opacity .25s; width: max-content; }
.rh-toast b { color: #e8590c; }
.rh-toast.on { transform: translate(-50%, -50%) scale(1); opacity: 1; }

/* 🎬 ルールの動画（2026-11-13、js/rules_video.js） */
#rv-overlay { position: fixed; inset: 0; z-index: 2147483000;   /* 一時停止の画面（z-index 10万）より上 */ background: #fff4e2; display: flex; align-items: center; justify-content: center; }
#rv-video { width: 100%; height: 100%; object-fit: contain; background: #fff4e2; }
#rv-skip { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; min-height: 48px; padding: 0 20px;
  border-radius: 999px; border: 3px solid #fff; background: rgba(74, 52, 36, .82); color: #fff;
  font: 400 18px 'Koicoin Pop', 'M PLUS Rounded 1c', sans-serif; font-synthesis: none; cursor: pointer; }

/* ========== 🏷️ 名前の設定（2026-11-13、js/player_name.js） ========== */
#name-setting-overlay .pn-card {
    background: #fff; border-radius: 28px; border: 4px solid #6d28d9; box-shadow: 0 8px 0 #4c1d95;
    padding: 22px 20px 20px; width: min(320px, 92vw); display: flex; flex-direction: column; align-items: center; gap: 12px;
}
#name-setting-overlay .pn-title { font-size: 26px; color: #4c1d95; font-family: 'Koicoin Pop', 'M PLUS Rounded 1c', sans-serif; }
#name-setting-overlay .pn-sub { font-size: 18px; color: #4c1d95; font-weight: 900; margin-top: 4px; }
#name-setting-overlay .pn-note { font-size: 13px; color: #777; text-align: center; line-height: 1.5; }
#name-setting-overlay .pn-input {
    width: 100%; box-sizing: border-box; font-size: 20px; padding: 12px 14px; min-height: 56px;
    border: 3px solid #c4b5fd; border-radius: 16px; text-align: center; font-family: inherit; color: #333;
}
#name-setting-overlay .pn-input:focus { outline: none; border-color: #6d28d9; }
#name-setting-overlay .pn-row { display: flex; gap: 8px; width: 100%; }
#name-setting-overlay .pn-row .char-pick-btn { flex: 1 1 0; min-height: 56px; justify-content: center; }
#name-setting-overlay .pn-close { width: 100%; margin: 0; background: linear-gradient(135deg, #bbb 0%, #999 100%); box-shadow: 0 5px 0 #777; }
/* オンライン対戦：相手の盤面の上のふちに相手の名前の札（ほかの人の名前を「表示する」の時だけ） */
#pn-opp-tag {
    position: absolute; top: 4px; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none;
    max-width: 80%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    background: rgba(109, 40, 217, 0.9); color: #fff; font-size: 14px; font-weight: 900; line-height: 1;
    padding: 5px 12px; border-radius: 999px; box-shadow: 0 2px 0 rgba(76, 29, 149, 0.6);
}


/* 🌐 言語の切りかえ（2026-11-15、js/i18n.js）：CSSの中の日本語 */
html:not(.lang-ja) .vending-display.is-empty::after { content: 'Soon'; }
/* 🌐 英語の時のタイトルの看板：「お買い物パズル」の板を Coin Puzzle に（作り方＝試作_その他/タイトル看板_英語版_作り方.py） */
html:not(.lang-ja) #menu-screen.title-screen { --title-top: url("images/title_shop/top_wide_en.webp"); }

/* ✏️ タイトルの全ての文字に極細の黒い枠（2026-11-15 ユーザー「試してみて」）。やめる時はこの節を消す */
#menu-screen.title-screen, #menu-screen.title-screen * {
    -webkit-text-stroke: 3px #000;   /* paint-order で文字の下に描くので、外に見えるのは半分の1.5px（ユーザー「もう少し太く」→「さっきのと中間」） */
    paint-order: stroke fill;
}
#menu-screen.title-screen .ts-btn-desc { -webkit-text-stroke-width: 2.5px; }   /* 小さい説明の字はつぶれないよう少し細く */
#menu-screen.title-screen .ts-icon-btn, #menu-screen.title-screen .ts-icon-btn * { -webkit-text-stroke: 0; }   /* 下の台の字はもともと黒っぽいので線は付けない（ユーザー） */

/* ============================================================
   📤 シェア と 🏆 みんなのランキング（2026-11-15。js/score_share.js・js/online_ranking.js）
   ============================================================ */
.share-row { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
.share-row .menu-btn { flex: 1 1 auto; width: auto; min-width: 0; min-height: 56px; font-size: 18px; margin: 0; padding: 10px 14px; white-space: nowrap; }
#result-screen .share-btn { background: linear-gradient(135deg, #5a5a5a 0%, #1f1f1f 100%) !important; box-shadow: 0 8px 0 #000 !important; color: #fff !important; }
#result-screen .rank-post-btn { background: linear-gradient(135deg, #ffd166 0%, #ff9f1c 100%) !important; box-shadow: 0 8px 0 #c26a00 !important; color: #5a2d0c !important; }
#result-screen .rank-post-btn:disabled { filter: grayscale(0.3) brightness(0.95); }
.rank-post-msg { width: 100%; box-sizing: border-box; background: #fffdf0; border: 3px solid #ffd166; border-radius: 16px; padding: 8px 10px; font-size: 17px; font-weight: 900; color: #c26a00; text-align: center; line-height: 1.5; }
.rank-post-msg small { font-size: 14px; color: #666; }
.rank-post-see { margin-top: 6px; min-height: 44px; padding: 6px 18px; font-size: 16px; font-weight: 900; border: none; border-radius: 22px; background: #4361ee; color: #fff; cursor: pointer; font-family: inherit; }

#share-overlay, #rank-agree-overlay { z-index: 6000; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); }
.share-panel, .rank-agree-panel { position: relative; width: min(560px, 94vw); max-height: 92vh; overflow-y: auto; box-sizing: border-box; background: #fff; border-radius: 24px; border: 6px solid #ffd166; padding: 18px 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.3); text-align: center; }
.share-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: none; border-radius: 50%; background: #ff4d6d; color: #fff; font-size: 24px; font-weight: bold; cursor: pointer; }
.share-title, .rank-agree-title { margin: 0 0 10px; color: #ff9f1c; font-size: 22px; }
.share-preview { width: 100%; height: auto; border-radius: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.25); }
.share-btns, .rank-agree-btns { display: flex; gap: 10px; margin-top: 12px; }
.share-btns, .rank-agree-btns { flex-wrap: wrap; }
.share-btns .menu-btn, .rank-agree-btns .menu-btn { flex: 1 1 auto; width: auto; min-width: 0; min-height: 56px; font-size: 18px; margin: 0; padding: 10px 14px; white-space: nowrap; }
.share-x-btn { background: linear-gradient(135deg, #3a3a3a 0%, #000 100%) !important; box-shadow: 0 6px 0 #444 !important; color: #fff !important; }
.share-save-btn { background: linear-gradient(135deg, #b5e2fa 0%, #90e0ef 100%) !important; box-shadow: 0 6px 0 #5fa8b3 !important; color: #03045e !important; }
.share-note, .rank-agree-small { font-size: 14px; color: #777; margin: 10px 0 0; line-height: 1.5; }
.rank-agree-text { font-size: 17px; color: #333; line-height: 1.6; margin: 0 0 12px; text-align: left; }
.rank-agree-label { display: block; font-size: 15px; font-weight: 900; color: #555; text-align: left; margin-bottom: 4px; }
.rank-agree-input { width: 100%; box-sizing: border-box; font-size: 20px; padding: 10px 12px; border: 3px solid #ffd166; border-radius: 14px; font-family: inherit; }
.rank-agree-warn { font-size: 16px; font-weight: 900; color: #e63946; margin: 10px 0 0; text-align: left; line-height: 1.5; }
.rank-agree-ok { background: linear-gradient(135deg, #ffd166 0%, #ff9f1c 100%) !important; box-shadow: 0 6px 0 #c26a00 !important; color: #5a2d0c !important; }
.rank-agree-no { background: linear-gradient(135deg, #e9ecef 0%, #ced4da 100%) !important; box-shadow: 0 6px 0 #8d99ae !important; color: #333 !important; }

.ork-switch { display: flex; gap: 6px; margin: 0 0 12px; }
.ork-switch button, .ork-periods button { flex: 1 1 0; min-height: 44px; font-size: 16px; font-weight: 900; border: 3px solid #ffd166; border-radius: 22px; background: #fff; color: #c26a00; cursor: pointer; font-family: inherit; }
.ork-switch button.is-on, .ork-periods button.is-on { background: #ff9f1c; border-color: #ff9f1c; color: #fff; }
.ork-periods { display: flex; gap: 6px; margin-bottom: 10px; }
.ork-periods button { min-height: 40px; font-size: 15px; border-width: 2px; }
.ork-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 6px; border-radius: 14px; background: #fff8e6; }
.ork-row.top1 { background: #fff1b8; } .ork-row.top2 { background: #eef1f5; } .ork-row.top3 { background: #fbe4d2; }
.ork-row.mine { outline: 3px solid #4361ee; background: #e7ecff; }
.ork-rank { width: 34px; text-align: center; font-size: 20px; font-weight: 900; color: #888; flex: none; }
.ork-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 17px; font-weight: 900; color: #333; text-align: left; }
.ork-me { font-size: 12px; color: #fff; background: #4361ee; border-radius: 8px; padding: 1px 6px; vertical-align: middle; }
.ork-score { flex: none; font-size: 18px; font-weight: 900; color: #ff7b00; }
.ork-score small { font-size: 12px; margin-left: 2px; }
.ork-gap { text-align: center; color: #aaa; margin: -2px 0 4px; }
.ork-note { font-size: 13px; color: #888; line-height: 1.5; margin: 10px 0 0; }
.ork-gpgs-btn { width: 100%; min-height: 56px; margin: 12px 0 0; font-size: 17px; background: linear-gradient(135deg, #34a853 0%, #1e7e34 100%) !important; box-shadow: 0 6px 0 #145a24 !important; color: #fff !important; }
/* 🏆 ランキング画面の「自動で載せる」の切りかえ（2026-11-15 続き） */
.ork-auto { display: block; width: 100%; min-height: 48px; margin: 10px 0 0; font-size: 16px; font-weight: 900; border: 3px solid #ced4da; border-radius: 24px; background: #fff; color: #555; cursor: pointer; font-family: inherit; }
.ork-auto.is-on { border-color: #34a853; color: #1e7e34; background: #eaf7ee; }
.ork-del { display: block; width: 100%; min-height: 48px; margin: 8px 0 0; font-size: 15px; font-weight: 700; border: 2px solid #e5b3b3; border-radius: 24px; background: #fff; color: #b03a3a; cursor: pointer; font-family: inherit; }
.ork-del:disabled { opacity: .6; }
#rank-agree-overlay .rank-agree-title { font-size: clamp(17px, 5.1vw, 22px); }   /* 「全国のプレイヤーと競おう！」がスマホで1行に入るように */


/* ============================================================
   🎂 名前を使う前に年齢を聞く（2026-11-18、js/age_gate.js）
   ============================================================ */
#age-gate-overlay { z-index: 7000; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); }
#age-gate-overlay .ag-card {
    background: #fff; border-radius: 24px; border: 5px solid #ffd166; box-shadow: 0 8px 0 #c26a00;
    padding: 22px 18px 18px; width: min(340px, 92vw); box-sizing: border-box; display: flex; flex-direction: column; align-items: stretch; gap: 12px;
}
#age-gate-overlay .ag-title { font-size: 24px; color: #c26a00; text-align: center; font-family: 'Koicoin Pop', 'M PLUS Rounded 1c', sans-serif; font-synthesis: none; }
#age-gate-overlay .ag-year { min-height: 56px; font-size: 22px; padding: 6px 12px; border: 3px solid #ffd166; border-radius: 16px; font-family: inherit; text-align: center; background: #fff; color: #333; }
#age-gate-overlay .menu-btn { width: 100%; margin: 0; min-height: 56px; font-size: 19px; }
#age-gate-overlay .ag-ok { background: linear-gradient(135deg, #ffd166 0%, #ff9f1c 100%) !important; box-shadow: 0 6px 0 #c26a00 !important; color: #5a2d0c !important; }
#age-gate-overlay .ag-ok:disabled { filter: grayscale(0.8); opacity: .6; }
#age-gate-overlay .ag-cancel { background: linear-gradient(135deg, #e9ecef 0%, #ced4da 100%) !important; box-shadow: 0 6px 0 #8d99ae !important; color: #333 !important; }
#age-gate-overlay .ag-note { font-size: 14px; color: #777; text-align: center; line-height: 1.5; }
.ag-picker { display: flex; gap: 8px; width: 100%; }
.ag-picker .ag-sel { flex: 1 1 0; min-width: 0; min-height: 56px; font-size: 19px; padding: 4px 8px; border: 3px solid #c4b5fd; border-radius: 16px; font-family: inherit; background: #fff; color: #333; }
.rank-agree-panel .ag-picker .ag-sel { border-color: #ffd166; }
#name-setting-overlay .ag-year-inline { width: 100%; min-height: 56px; font-size: 20px; padding: 4px 12px; border: 3px solid #c4b5fd; border-radius: 16px; font-family: inherit; background: #fff; color: #333; text-align: center; }   /* 🎂 生まれた年の欄（2026-11-19） */

/* 🚫 使えない名前（2026-11-19、js/name_ng.js） */
.pn-ng-msg { font-size: 15px; font-weight: 900; color: #d62828; text-align: center; line-height: 1.4; margin: 0; }
.pn-ng-input { border-color: #d62828 !important; background: #fff0f0 !important; }

/* 🔒 生まれた年は変えられない：まちがえた時の直し方（age_gate.js の .ag-fix、2026-11-20） */
#name-setting-overlay .ag-fix { font-size: 14px; color: #6b5a45; background: #fff6e5; border: 1px solid #f0d9ae; border-radius: 10px; padding: 8px 10px; margin: 6px 0 4px; line-height: 1.55; text-align: left; }
#name-setting-overlay .ag-year-inline:disabled { opacity: .75; }

/* 🔍 山の上の「n / 5枚」でコインが隠れないように（2026-11-20 ユーザー「端末によってはこの文字でコインが見えなくなる」）
   盤面の大きさに合わせて縮める（--rh-k は rule_hints.js が入れる、0.62〜1）・地を半分すかす・ふちを細く */
.rh-count { --rh-k: 1; font-size: calc(15px * var(--rh-k)); padding: calc(1px * var(--rh-k)) calc(8px * var(--rh-k));
  border-width: 2px; line-height: 1.1; background: rgba(255, 255, 255, .72); box-shadow: 0 2px 0 rgba(0,0,0,.10); }
.rh-count b { font-size: calc(19px * var(--rh-k)); }
.rh-count.almost { background: rgba(255, 240, 243, .78); }
.rh-count.covered { opacity: .3; }

/* 📝 年齢の窓：聞く理由（age_gate.js の .ag-why、2026-11-20） */
#age-gate-overlay .ag-why { font-size: 15px; color: #5b3a1e; text-align: center; line-height: 1.55; margin: -2px 0 4px; }
/* 🔎 あと1枚の札を、最初の5回だけ大きく（rule_hints.js の .big、2026-11-20） */
.rh-count.big { font-size: calc(17px * var(--rh-k)); padding: calc(3px * var(--rh-k)) calc(12px * var(--rh-k)); text-align: center; border-width: 3px; background: rgba(255, 240, 243, .92); z-index: 8810; }
.rh-count.big b { font-size: calc(24px * var(--rh-k)); }
.rh-count.big small { display: block; font-size: calc(14px * var(--rh-k)); color: #e63950; }
.rh-count.big.covered { opacity: .85; }


/* 🧪 2026-11-20：お邪魔石を送った時の札（atk_wave.js の atkSentLabel）。自分の盤面のまん中に出て上へ消える */
.atk-sent-label { position: fixed; z-index: 8900; pointer-events: none; transform: translate(-50%, -50%); white-space: nowrap;
  display: flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; border: 3px solid #fff;
  background: var(--atk-c, #5a5f6e); color: #fff; font-size: 18px; font-weight: 900; box-shadow: 0 4px 14px rgba(0,0,0,.3);
  animation: atkSentPop 1.6s ease-out forwards; }
.atk-sent-label b { font-size: 22px; }
@keyframes atkSentPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.15); }
  22% { transform: translate(-50%, -50%) scale(1); }
  70% { opacity: 1; transform: translate(-50%, -90%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -150%) scale(.95); }
}

/* ⚠️ 年齢の窓：13歳未満の年を選んだ時、決める前に出す注意（age_gate.js の .ag-warn、2026-11-20） */
#age-gate-overlay .ag-warn { background: #fff6d6; border: 3px solid #e0a100; border-radius: 12px; padding: 10px 12px; font-size: 15px; line-height: 1.5; color: #b3261e; text-align: left; font-weight: 700; }
#age-gate-overlay .ag-warn b { display: block; font-size: 16px; margin-bottom: 2px; }

/* 🏆 対戦の勝ち方：数えている間の1行（ui.js の #match-rule-tip）と、のこり20秒からの「リード中」（#vs-lead-tag）、2026-11-20 */
#match-start-overlay { flex-direction: column; }
#match-rule-tip { margin-top: 18px; max-width: min(92vw, 460px); background: rgba(255,255,255,.95); border: 3px solid #ffd166; border-radius: 14px; padding: 10px 14px; text-align: center; color: #5a2d0c; line-height: 1.45; }
#match-rule-tip b { display: block; font-size: 18px; }
#match-rule-tip span { display: block; font-size: 15px; font-weight: 700; }
#vs-lead-tag { margin-top: 4px; padding: 3px 6px; border-radius: 8px; font-size: 13px; font-weight: 900; text-align: center; white-space: nowrap; color: #fff; animation: vsLeadPulse 1s ease-in-out infinite; }
#vs-lead-tag.vs-lead-lead { background: #2a9d4b; }
#vs-lead-tag.vs-lead-behind { background: #e63950; }
#vs-lead-tag.vs-lead-tie { background: #8a8f9c; }
@keyframes vsLeadPulse { 50% { transform: scale(1.06); } }

/* 🔍 🏠の中のコインの見分け方（ui.js の helpLegendHtml、2026-11-20） */
.hp-legend { background: #fff; border: 2px solid #cfe3ff; border-radius: 12px; padding: 8px 10px; margin: 4px 0 10px; text-align: left; }
.hp-lg-title { font-size: 16px; font-weight: 900; color: #2a3eb1; margin-bottom: 4px; text-align: center; }
.hp-lg-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 14px; line-height: 1.4; color: #444; }
.hp-lg-row + .hp-lg-row { border-top: 1px dashed #dde6f3; }
.hp-lg-row b { font-size: 15px; color: #222; }
.hp-lg-coin { flex: 0 0 auto; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.hp-lg-coin img { width: 56px; height: 56px; }
.hp-lg-change { box-shadow: 0 0 0 3px #fff, 0 0 0 7px #22c3a6; width: 48px; height: 48px; margin: 4px; }
.hp-lg-change img { width: 48px; height: 48px; }

/* 🛒 商品の3択の上の、動かない見出し（2026-11-20、Codex「何を基準に選ぶのか分かりにくい」）。一人で遊ぶだけ */
.target-choices-col { display: contents; }
body.solo-mode .target-choices-col { display: flex; flex-direction: column; flex: 1 1 auto; min-width: 0; }
.target-choices-head { display: none; }
body.solo-mode .target-choices-head { display: block; font-size: 13px; font-weight: 900; color: #7a4a1e; margin: 2px 0 0; line-height: 1.2; white-space: nowrap; }
/* 両替モードには商品が無いので見出しも出さない（2026-11-21 ユーザー指定。data-nd-mode は game.js の startApp で入る） */
body[data-nd-mode="HOARD"] .target-choices-head { display: none !important; }

/* お買い物モード：木の作業台、ガラスの箱、メダルの値札。 */
body.shopping-counter #p1-section {
    background: #e9b77d url("images/title_shop/floor.webp") center / auto 112px repeat;
}
body.shopping-counter #p1-section .ui-container {
    background: linear-gradient(180deg, #fff5e6ec, #f6d5aaed);
    border-color: #ad7851;
    box-shadow: 0 3px 8px #66472a33;
}
body.shopping-counter #p1-section .score-box,
body.shopping-counter #p1-section #p1-image-box {
    background: linear-gradient(#fffdf7, #ffe8cd);
    border: 2px solid #c7976e;
    border-radius: 11px;
    box-shadow: inset 0 1px 0 white, 0 2px 0 #82533740;
}
body.shopping-counter #home-btn {
    background: linear-gradient(#ffab91, #ed7664);
    border-color: #ffddc2;
}
body.shopping-counter #p1-target-head { color: #5e3628; }
body.shopping-counter #p1-target-choices .target-choice {
    flex-direction: row;
    justify-content: center;
    gap: 3px;
    min-height: 40px;
    background: linear-gradient(#fffaf7, #f9dfed);
    border-color: #c895aa;
}
body.shopping-counter #p1-target-choices .target-choice:nth-child(2) {
    background: linear-gradient(#fafdff, #e0edf9);
    border-color: #9baec8;
}
body.shopping-counter #p1-target-choices .target-choice:nth-child(3) {
    background: linear-gradient(#fefbff, #eee2f7);
    border-color: #b4a1cc;
}
body.shopping-counter #p1-target-choices .target-choice.is-selected {
    border-color: #a6522c;
    box-shadow: inset 0 0 0 1px #a6522c, 0 2px 0 #9a643c77;
}
body.shopping-counter #p1-target-choices .target-choice img {
    width: clamp(13px, 3.6vw, 26px);
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 50%;
    flex: none;
}
body.shopping-counter #p1-target-choices .target-choice-price {
    font-size: clamp(11px, 3vw, 17px);
}
/* 🎨 横画面（PC）は案内役を元の大きさ・位置のまま（2026-11-21 ユーザー「前はこんな画面」） */
@media (orientation: portrait) {
body.shopping-counter #p1-section .pm-timer-image-row {
    /* 案内役の場所を商品列の右に確保し、盤面や値札に重ねない。 */
    display: flex;
    align-items: center;
}
body.shopping-counter #p1-section .char-dock-timerrow {
    position: static;
    align-self: center;
    flex: 0 0 auto;
    width: clamp(32px, 11vw, 66px);
    height: clamp(38px, 12vw, 72px);
    max-width: none;
    border: 1px solid #c7976e;
    border-radius: 12px;
    background: #fff6e9;
    object-position: center;
    animation: none;
}
}
body.shopping-counter #p1-burst-box {
    background: #dbe8f3;
    border-color: #87a6b9;
}
body.shopping-counter #p1-burst-fill {
    background: linear-gradient(180deg, #51b7f1, #2479cb) !important;
}
body.shopping-counter #p1-canvas-wrap canvas {
    background: linear-gradient(145deg, #fffaf1b8, #fff2df70 54%, #d2eafd99);
    border-color: #8daec4;
    border-radius: 8px 8px 15px 15px;
    box-shadow: 0 3px 8px #60412650;
}

/* 👆 一人で遊ぶの最初の1回だけの、なぞる案内（rule_hints.js の fdhTick） */
.fdh { position: fixed; z-index: 1400; pointer-events: none; transform: translate(-50%, -50%); text-align: center; }
.fdh-arrows { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 26px; color: #ff5c8a; text-shadow: 0 2px 0 #fff; animation: fdhSwing 1.4s ease-in-out infinite; }
.fdh-finger { font-size: 34px; }
.fdh-text { margin-top: 4px; background: rgba(255,255,255,.95); border: 3px solid #ff5c8a; border-radius: 999px; padding: 5px 14px; font-size: 17px; font-weight: 900; color: #5a2d0c; white-space: nowrap; box-shadow: 0 3px 10px rgba(0,0,0,.15); }
@keyframes fdhSwing { 0%, 100% { transform: translateX(-40px); } 50% { transform: translateX(40px); } }

/* 🧪 2026-11-20：お邪魔石が来た時の札（受けた側、atk_wave.js の atkGotLabel）と、始まる前の札の「⚔️」の行 */
.atk-got-label { background: #6b7080; }
.atk-got-label span small { display: block; font-size: 12px; font-weight: 700; opacity: .9; }
#match-rule-tip .mrt-atk { color: #c0264d; font-weight: 900; }

/* 🪨 石が降った時の壊し方の札（rule_hints.js の rbhWrap、最初の3回だけ） */
.rock-break-hint { position: fixed; z-index: 8900; pointer-events: none; transform: translate(-50%, -50%); white-space: nowrap;
  background: rgba(255,255,255,.96); border: 3px solid #6b7080; border-radius: 999px; padding: 6px 14px; font-size: 17px; font-weight: 900; color: #3d4150;
  box-shadow: 0 4px 12px rgba(0,0,0,.2); animation: rbhPop 2.4s ease-out forwards; }
@keyframes rbhPop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.6); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(1.08); } 18% { transform: translate(-50%, -50%) scale(1); } 85% { opacity: 1; } 100% { opacity: 0; } }

/* ⏸ 一時停止の窓：上下の空きをなくし、「保存」「タイトル」をいつも見える下の帯に横並び（2026-11-21 ユーザー「上が空いていて、タイトルに戻るがスクロールしないとたどりつかない」）
   前は高さ80%でまん中固定＝上下に約1割ずつ空き、保存・タイトルが窓の下にはみ出していた */
#solo-explanation-panel {
    max-height: calc(100vh - 16px) !important;
    max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
}
#solo-explanation-panel .hp-actions {
    position: sticky; bottom: 0; z-index: 3;
    display: flex; gap: 10px; align-items: flex-start;
    margin-top: 10px; padding: 8px 0 4px;
    background: #fdf0dc; border-top: 2px solid #efdfc4;
    box-shadow: 0 10px 0 #fdf0dc;   /* 窓の下の余白（padding）も同じ色でふさぎ、後ろの文字が見えないように */
}
#solo-explanation-panel .hp-actions:empty { display: none; }
#solo-explanation-panel .hp-actions > div { flex: 1 1 0; min-width: 0; }
#solo-explanation-panel .hp-actions .hp-btn { margin-top: 0; }

/* 🔤 🏠の遊び方カード：文字を13pxにした（Codex の f376168）ら「箱から こぼれたら負け」の「け」が3行目に落ちた → 字の間とカードの左右の余白を少しつめて2行に収める（幅360のスマホでも） */
#solo-explanation-panel .hp-card { padding-left: 1px !important; padding-right: 1px !important; }
#solo-explanation-panel .hp-card .hp-lbl { letter-spacing: -0.05em; }

/* 🏆 結果画面の「シェア」と「ランキング」は横に半分ずつ（2026-11-21 ユーザー「ずれと割り込み感が気になる」）
   前は2つが折り返して縦に並び、ほかのボタンより幅が広い・下にすきまが無い・誘いのボタンが大きくなったり小さくなったりで目立ちすぎた */
#result-screen .share-row { flex-wrap: nowrap; max-width: 280px; margin: 0 auto 12px; }   /* ほかのボタン（最大280px・まん中）と左右をそろえる */
#result-screen .share-row .menu-btn { flex: 1 1 auto; padding: 10px 6px !important; font-size: 18px !important; overflow: visible !important; }
#result-screen .share-row .share-btn { padding: 10px 16px !important; }   /* 文字の幅から同じだけ広げる（半分ずつだと「ランキング」が切れた。ランキングが隠れている時はシェアが1本の幅に） */

/* 📏 2026-11-22 ユーザー「対戦でキャラが見切れているのに上に隙間」：対戦の横の欄で、見えない商品の絵の箱（#p1-image-box、
   飛ぶ演出の目印に使うので消さない）が3択と「あと¥」の間に20px＋すき間を取っていた → 場所を取らないよう浮かせる */
body:not(.solo-mode) .pm-timer-image-row { position: relative; }
body:not(.solo-mode) #p1-image-box { position: absolute !important; left: 0; bottom: 0; }
/* 　同じ日：それでも欄が足りない端末（道具の欄が絵つきで高い時など）は、案内役の絵を縮めて欄の中に収める（はみ出して切れない） */
body:not(.solo-mode) .char-dock-versus { flex: 0 1 auto; min-height: 40px; object-fit: contain; }
/* 　同じ日ユーザー「上詰めで入れれば良い」：案内役を欄の下に寄せず、道具の欄のすぐ下に置く（縮むのは入りきらない時だけ） */
body:not(.solo-mode) .char-dock-versus { margin-top: auto; margin-bottom: -4px; object-position: 50% 100%; }   /* 2026-11-22 ユーザー「キャラの下側と盤面の一番下を合わせて」で下寄せにもどした（空きは上で詰めた） */

/* 🎬 見せ場の動画（2026-11-28、score_share.js）：結果画面のボタンと動画の窓 */
#result-screen .share-video-btn { display: block; width: 100%; max-width: 280px; min-height: 56px; margin: 0 auto 12px; font-size: 18px !important; padding: 10px 12px !important; white-space: nowrap;
    background: linear-gradient(135deg, #ff7eb3 0%, #e8457f 100%) !important; box-shadow: 0 8px 0 #a3204f !important; color: #fff !important; }
#result-screen .share-video-btn:disabled { filter: grayscale(0.3) brightness(0.95); }
#share-video-overlay { z-index: 6000; align-items: center; justify-content: center; background: rgba(0,0,0,0.55); }
#share-video-overlay video.share-preview { display: block; aspect-ratio: 1200 / 676; background: #3fa64a; }
#share-video-overlay a.share-save-btn { display: flex; align-items: center; justify-content: center; text-decoration: none; }
/* ☁️ パソコンの Play Games：アップした動画を消す（2026-11-28） */
#share-video-overlay .share-clip-del { display: block; margin: 6px auto 0; min-height: 40px; padding: 0 16px; border: none; background: none; color: #8a6d55; font-size: 14px; text-decoration: underline; cursor: pointer; }
