/* ================================================================
 * ツキモノシューティング - work prototype スタイル
 * ----------------------------------------------------------------
 * デザイン方針:
 * - 静かに機能し、素材で語り、余白で呼吸する
 * - メンフィス風のアクセントは控えめ（背景の幾何のみ）
 * - ボタン階層 Primary / Secondary / Tertiary を視覚的に分ける
 * - 機能色（HP残量で色変化）は残す
 * - 左border強調デザインは使わない
 * ================================================================ */

/* ----------------------------------------------------------------
 * テーマ・WP 由来の見出しスタイル打ち消し
 *   SWELL などのテーマが h1〜h6 に border-bottom や擬似要素アクセント、
 *   独自の margin/padding を当ててくるため、プラグイン領域内では完全リセット。
 *   各クラス（.ts-shooting-result-title 等）で必要な装飾を改めて指定する。
 * ---------------------------------------------------------------- */
.ts-shooting-container h1,
.ts-shooting-container h2,
.ts-shooting-container h3,
.ts-shooting-container h4,
.ts-shooting-container h5,
.ts-shooting-container h6,
.ts-shooting-screen h1,
.ts-shooting-screen h2,
.ts-shooting-screen h3,
.ts-shooting-screen h4,
.ts-shooting-screen h5,
.ts-shooting-screen h6 {
    background: none !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    padding: 0 !important;
    text-shadow: none !important;
    text-decoration: none !important;
    text-align: inherit;
    color: inherit;
    font-family: inherit;
    line-height: 1.4;
}

.ts-shooting-container h1::before,
.ts-shooting-container h1::after,
.ts-shooting-container h2::before,
.ts-shooting-container h2::after,
.ts-shooting-container h3::before,
.ts-shooting-container h3::after,
.ts-shooting-container h4::before,
.ts-shooting-container h4::after,
.ts-shooting-container h5::before,
.ts-shooting-container h5::after,
.ts-shooting-container h6::before,
.ts-shooting-container h6::after,
.ts-shooting-screen h1::before,
.ts-shooting-screen h1::after,
.ts-shooting-screen h2::before,
.ts-shooting-screen h2::after,
.ts-shooting-screen h3::before,
.ts-shooting-screen h3::after,
.ts-shooting-screen h4::before,
.ts-shooting-screen h4::after,
.ts-shooting-screen h5::before,
.ts-shooting-screen h5::after,
.ts-shooting-screen h6::before,
.ts-shooting-screen h6::after {
    content: none !important;
    background: none !important;
    border: 0 !important;
    display: none !important;
}

/* デザイントークン（プラグイン内クローズドのカスタムプロパティ） */
.ts-shooting-container {
    --tss-bg: #f5f1e8;
    --tss-paper: #fff9f0;
    --tss-ink: #1a1a1a;
    --tss-ink-soft: #555555;
    --tss-ink-mute: #6e6e6e; /* WCAG AA: #fff9f0 上で約4.6:1（テキストにも使う） */
    --tss-accent: #d4232a;
    --tss-accent-deep: #b01b21;
    --tss-warn: #e07b1a;
    --tss-danger: #b71c1c;
    --tss-line: rgba(26, 26, 26, 0.18);
    --tss-shadow: 8px 8px 0 var(--tss-ink);

    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 24px 16px;
    background: var(--tss-bg);
    color: var(--tss-ink);
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
    width: 100%;
    min-height: 720px;
}

.ts-shooting-container *,
.ts-shooting-container *::before,
.ts-shooting-container *::after {
    box-sizing: border-box;
}

/* ========== スクリーン共通 ========== */

.ts-shooting-screen {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 24px;
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    border-radius: 6px;
    box-shadow: var(--tss-shadow);
    min-height: 600px;
}

/* ========== タイトル画面（賑やかメンフィス＋物語感ハイブリッド） ========== */

.ts-shooting-title {
    position: relative;
    overflow: hidden;
    padding: 0;
    min-height: 600px;
    justify-content: stretch;
    align-items: stretch;
    /* 背景は赤ベース（ラケ希望、ツキモノ世界観のメインカラー） */
    background: var(--tss-accent);
}

/* ----- メンフィス装飾（赤背景に合わせて 黒 ＋ クリームの2色構成） ----- */
.ts-title-deco {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 0;
}
.ts-title-shape {
    position: absolute;
    display: block;
}
/* 左上：黒い円（赤背景に黒のアクセント、主役にならないサイズに） */
.ts-title-shape-circle1 {
    top: 28px; left: 36px;
    width: 100px; height: 100px;
    background: var(--tss-ink);
    border-radius: 50%;
    opacity: 0.75;
}
/* 右下：クリーム色の円 */
.ts-title-shape-circle2 {
    bottom: 38px; right: 64px;
    width: 90px; height: 90px;
    background: var(--tss-paper);
    border-radius: 50%;
    opacity: 0.95;
    box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.18);
}
/* 右上：黒い三角 */
.ts-title-shape-tri1 {
    top: 90px; right: 60px;
    width: 0; height: 0;
    border-left: 60px solid transparent;
    border-right: 60px solid transparent;
    border-bottom: 90px solid var(--tss-ink);
    opacity: 0.85;
    transform: rotate(18deg);
}
/* 左中：クリーム色の三角（元は赤三角、赤背景と同化するからクリームに） */
.ts-title-shape-tri2 {
    bottom: 200px; left: 30px;
    width: 0; height: 0;
    border-left: 40px solid transparent;
    border-right: 40px solid transparent;
    border-top: 65px solid var(--tss-paper);
    opacity: 0.85;
    transform: rotate(-12deg);
}
/* 右上の下：黒いジグザグ（斜めストライプ） */
.ts-title-shape-zig {
    top: 220px; right: 30px;
    width: 110px; height: 28px;
    background: repeating-linear-gradient(135deg,
        var(--tss-ink) 0 8px, transparent 8px 16px);
    transform: rotate(-8deg);
    opacity: 0.85;
}
/* 左下：黒のドット模様 */
.ts-title-shape-dots {
    bottom: 30px; left: 40px;
    width: 120px; height: 70px;
    background-image: radial-gradient(var(--tss-ink) 24%, transparent 26%);
    background-size: 14px 14px;
    opacity: 0.55;
}

/* ----- ツキモノたちのアバター（背景にちりばめる） ----- */
.ts-title-cast {
    position: absolute; inset: 0;
    pointer-events: none;
    z-index: 3;
}
.ts-title-tsukimono {
    position: absolute;
    width: 68px; height: 68px;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    opacity: 0.95;
    animation: tsTitleBob 4s ease-in-out infinite;
}
@keyframes tsTitleBob {
    0%, 100% { transform: translateY(0) rotate(0); }
    50%      { transform: translateY(-10px) rotate(2deg); }
}
/* 配置：ロゴ（上中央）/ 主役（中央）/ ボタン（下中央）を避けて、画面の外周にちりばめる */
.ts-t-gure     { top: 4%;    left: 16%; animation-delay: -0.2s; }
.ts-t-tamausa  { top: 26%;   left: 4%;  animation-delay: -0.6s; }
.ts-t-pari     { top: 18%;   left: 80%; animation-delay: -1.0s; }
.ts-t-nihiri   { top: 26%;   left: 88%; animation-delay: -1.4s; }
.ts-t-hitodama { top: 50%;   left: 4%;  animation-delay: -1.8s; width: 60px; height: 60px; }
.ts-t-mokkun   { top: 50%;   left: 88%; animation-delay: -2.2s; }
.ts-t-pukuta   { bottom: 50%; left: 16%; animation-delay: -2.6s; width: 62px; height: 62px; }
.ts-t-kua      { bottom: 18%; left: 4%; animation-delay: -3.0s; width: 62px; height: 62px; }
.ts-t-moguhana { bottom: 36%; left: 76%; animation-delay: -3.4s; width: 65px; height: 65px; }
.ts-t-momenkun { bottom: 18%; left: 84%; animation-delay: -3.8s; width: 72px; height: 72px; }
.ts-t-kuti     { top: 38%;   left: 12%; animation-delay: -1.2s; width: 60px; height: 60px; }

/* ----- 相瀬とぴよ丸（主役級、大きめに） ----- */
.ts-title-hero {
    position: absolute;
    left: 50%;
    bottom: 20%;
    transform: translateX(-50%);
    z-index: 4;
    pointer-events: none;
    width: 270px;
    height: 170px;
}
.ts-title-aise {
    position: absolute;
    left: 10px; bottom: 0;
    /* upscayl で 64x64 → 256x256 にした aise-mae。アスペクト 1:1 */
    width: 160px; height: 160px;
    object-fit: contain;
    image-rendering: pixelated;
}
.ts-title-piyo {
    position: absolute;
    right: 0; top: 0;
    width: 95px; height: 95px;
    object-fit: contain;
    image-rendering: pixelated;
    animation: tsTitleBob 2.6s ease-in-out infinite;
}

/* ----- ボスの影（右下隅、予兆） ----- */
.ts-title-boss {
    position: absolute;
    right: 8px;
    bottom: 8px;
    width: 110px;
    height: 110px;
    z-index: 3;
    object-fit: contain;
    image-rendering: pixelated;
    opacity: 0.30;
    filter: brightness(0.5) saturate(0.4);
    pointer-events: none;
}

/* ----- ロゴ（クリームパネル＋黒影、赤背景に映える2段構成） ----- */
.ts-title-logo-wrap {
    position: absolute;
    left: 50%;
    top: 14%;
    transform: translateX(-50%);
    z-index: 4;
    text-align: center;
    pointer-events: none;
}
.ts-title-logo {
    margin: 0;
    display: inline-block;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", sans-serif;
    font-weight: 900;
    color: var(--tss-ink);
    letter-spacing: 0.04em;
    line-height: 1;
}
.ts-title-logo-l1,
.ts-title-logo-l2 {
    display: inline-block;
    background: var(--tss-paper);
    padding: 4px 18px;
    box-shadow: 6px 6px 0 var(--tss-ink);
    border: 3px solid var(--tss-ink);
    transform: rotate(-2deg);
    color: var(--tss-ink);
}
.ts-title-logo-l1 {
    font-size: 44px;
    margin-bottom: 8px;
}
.ts-title-logo-l2 {
    font-size: 32px;
    transform: rotate(1.5deg);
}
.ts-title-sub {
    margin-top: 14px;
    font-size: 12px;
    /* 赤背景(--tss-accent #d4232a)上で WCAG AA 通過のため純白を使う（#fff9f0 は約4.0:1で未達） */
    color: #ffffff;
    letter-spacing: 0.18em;
    font-weight: 700;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

/* ----- ボタン群 ----- */
.ts-title-actions {
    position: absolute;
    left: 50%;
    bottom: 36px;
    transform: translateX(-50%);
    z-index: 4;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    width: 100%;
}
.ts-title-actions .ts-shooting-btn-primary {
    font-size: 18px;
    padding: 14px 44px;
    min-width: 200px;
}
.ts-title-sub-actions {
    display: flex;
    gap: 20px;
}

/* ===== タイトル右上：「おみくじ」 独立ボタン =====
   メニュー（サブアクション）から分離して、「ちょっと立ち寄る」 感を出す。
   絵馬風のクリームパネル＋黒影で、 タイトル世界観に馴染ませる。 */
.ts-title-omikuji-btn {
    position: absolute;
    top: 24px;
    right: 24px;
    z-index: 5;
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid var(--tss-ink);
    border-radius: 4px;
    background: var(--tss-paper);
    color: var(--tss-ink);
    font-family: inherit;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.12em;
    padding: 10px 20px;
    min-height: 40px;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--tss-ink);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.ts-title-omikuji-btn:hover {
    transform: translate(-1px, -1px);
    box-shadow: 4px 4px 0 var(--tss-ink);
}
.ts-title-omikuji-btn:active {
    transform: translate(2px, 2px);
    box-shadow: 1px 1px 0 var(--tss-ink);
}
.ts-title-omikuji-btn:focus-visible {
    outline: 2px solid #ffd35a;
    outline-offset: 2px;
}
.ts-title-sub-actions .ts-shooting-btn-tertiary {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 13px;
    /* 赤背景(--tss-accent #d4232a)上で WCAG AA 通過のため純白（#fff9f0 は未達） */
    color: #ffffff;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
    font-weight: 700;
}
.ts-title-sub-actions .ts-shooting-btn-tertiary:hover {
    color: var(--tss-paper);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* ========== ステージ（プレイ中） ========== */

.ts-shooting-stage {
    position: relative; /* ゲーム内コーチを Canvas に重ねるための基準 */
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.ts-shooting-hud {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 10px 4px 12px;
    font-size: 13px;
    color: var(--tss-ink-soft);
}

.ts-shooting-hp {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: var(--tss-ink);
}

.ts-shooting-hp-label {
    font-size: 13px;
    letter-spacing: 0.08em;
}

.ts-shooting-hp-dots {
    display: inline-flex;
    gap: 8px;
}

.ts-shooting-hp-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--tss-accent);
    border: 1.5px solid var(--tss-accent-deep);
    transition: background-color 120ms ease, border-color 120ms ease, opacity 120ms ease;
}

/* HP色変化（機能色）:
   JS の updateHpDisplay() が .ts-shooting-hp 要素に data-hp="残量"、
   各ドットに .is-lost（失ったぶん）を付与する契約。
   ここでは「残量に応じて、残っているドット（:not(.is-lost)）の色を変える」を表現する。 */
.ts-shooting-hp[data-hp="3"] .ts-shooting-hp-dot:not(.is-lost) {
    background: var(--tss-accent);
    border-color: var(--tss-accent-deep);
}
.ts-shooting-hp[data-hp="2"] .ts-shooting-hp-dot:not(.is-lost) {
    background: var(--tss-warn);
    border-color: #a05315;
}
.ts-shooting-hp[data-hp="1"] .ts-shooting-hp-dot:not(.is-lost) {
    background: var(--tss-danger);
    border-color: #7a1313;
}

.ts-shooting-hp-dot.is-lost {
    background: transparent;
    border-color: var(--tss-ink-mute);
}

.ts-shooting-keys {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
    color: var(--tss-ink-mute);
    letter-spacing: 0.04em;
}
/* ルール凡例：操作キーの下に常時表示。 クティ／反魂 の挙動が初見でわかるように */
.ts-shooting-rules {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-size: 12px;
    color: var(--tss-ink-mute);
    letter-spacing: 0.04em;
    margin-top: 4px;
}

/* 音設定（BGMオン/オフ + 音量スライダー）。狭い時は折り返しで縦に積む */
.ts-shooting-audio {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    font-size: 11px;
    color: var(--tss-ink-soft);
}
.ts-shooting-audio-btn {
    appearance: none;
    -webkit-appearance: none;
    background: var(--tss-ink);
    color: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    cursor: pointer;
    font-family: inherit;
    min-height: 28px;
    transition: background-color 120ms ease, color 120ms ease;
}
.ts-shooting-audio-btn[aria-pressed="false"] {
    background: var(--tss-paper);
    color: var(--tss-ink-mute);
}
.ts-shooting-audio-btn:focus-visible {
    outline: 2px solid var(--tss-accent);
    outline-offset: 2px;
}
.ts-shooting-audio-slider {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.ts-shooting-audio-slider input[type="range"] {
    width: 70px;
    height: 14px;
    cursor: pointer;
    accent-color: var(--tss-accent);
}

/* 反魂ゲージ（C キーで消費、離せば回復） */
.ts-shooting-reap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--tss-ink-soft);
    margin-left: 16px;
}
.ts-shooting-reap-label {
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--tss-ink);
}
.ts-shooting-reap-bar {
    position: relative;
    width: 120px;
    height: 8px;
    background: rgba(26, 26, 26, 0.12);
    border: 1.5px solid var(--tss-ink);
    border-radius: 4px;
    overflow: hidden;
}
.ts-shooting-reap-bar-fill {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    background: #7e9bff;
    transition: width 80ms linear, background-color 160ms ease;
}
/* 残量低下：再使用ロックゾーン以下では赤系で警告 */
.ts-shooting-reap[data-locked="true"] .ts-shooting-reap-bar-fill {
    background: var(--tss-warn);
}

/* Canvas 自体 */
#ts-shooting-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 800 / 600;
    max-width: 800px;
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    border-radius: 6px;
    box-shadow: var(--tss-shadow);
    outline: none;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

#ts-shooting-canvas:focus-visible {
    border-color: var(--tss-accent);
    box-shadow: 8px 8px 0 var(--tss-ink), 0 0 0 3px rgba(212, 35, 42, 0.18);
}

/* ========== 結果画面 ========== */

.ts-shooting-result-eyebrow {
    font-size: 12px;
    color: var(--tss-ink-mute);
    letter-spacing: 0.18em;
    margin: 0 0 16px;
}

.ts-shooting-result-title {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--tss-ink);
    letter-spacing: 0.06em;
}

/* ========== フェーズ完了画面（「つづく…」+ 感想誘導） ========== */

.ts-shooting-phase-end {
    margin: 24px 0 12px;
    text-align: center;
}

.ts-shooting-tsuzuku {
    font-size: 72px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--tss-ink);
    margin: 0 0 32px;
    line-height: 1;
    text-shadow: 4px 4px 0 var(--tss-accent);
    font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", sans-serif;
}

.ts-shooting-phase-end-message {
    margin: 0 auto 28px;
    max-width: 520px;
    color: var(--tss-ink);
    line-height: 1.8;
}

.ts-shooting-phase-end-message p {
    margin: 0 0 10px;
    font-size: 15px;
}

.ts-shooting-phase-end-message p:first-child {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 18px;
}

.ts-shooting-feedback-btn {
    display: inline-block;
    margin: 0 0 24px;
    padding: 12px 32px;
    font-size: 18px;
    text-decoration: none;
}

/* フェーズ完了「つづく…」表示中：Canvas に重ねる3ボタン（感想／もう一度／タイトル） */
.ts-shooting-phase-end-wait {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    pointer-events: none; /* 子要素のボタンだけクリック可能にする */
    z-index: 5;
}

/* Canvas オーバーレイ用：暗い背景でも視認できるよう専用スタイルで上書き */
.ts-shooting-phase-end-wait .ts-shooting-phase-btn {
    pointer-events: auto;
    padding: 12px 22px;
    font-size: 15px;
    min-width: 132px;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
}

/* Primary（感想を送る）：暖色アクセントで目立たせる（強い行動誘導） */
.ts-shooting-phase-end-wait .ts-shooting-btn-primary {
    background: #ffe27a;
    color: var(--tss-ink);
    border-color: #ffe27a;
}
.ts-shooting-phase-end-wait .ts-shooting-btn-primary:hover {
    background: #ffd35a;
    border-color: #ffd35a;
    color: var(--tss-ink);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.55);
}

/* Secondary（もう一度）：明るい紙色の塗りで暗背景に浮かぶ */
.ts-shooting-phase-end-wait .ts-shooting-btn-secondary {
    background: var(--tss-paper);
    color: var(--tss-ink);
    border-color: var(--tss-paper);
}
.ts-shooting-phase-end-wait .ts-shooting-btn-secondary:hover {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--tss-ink);
}

/* Tertiary（タイトルへ）：背景うっすら、文字は明色で読める */
.ts-shooting-phase-end-wait .ts-shooting-btn-tertiary {
    background: rgba(20, 14, 8, 0.55);
    color: var(--tss-paper);
    border: 1px solid rgba(255, 249, 240, 0.6);
    min-height: 48px;
    min-width: 132px;
    padding: 12px 22px;
    font-weight: 600;
}
.ts-shooting-phase-end-wait .ts-shooting-btn-tertiary:hover {
    background: rgba(20, 14, 8, 0.78);
    color: #ffffff;
    text-decoration: none;
}

/* ========== 探索パート専用：右上「進む」ボタン ========== */
/* Canvas を包むラッパー：ボタンを Canvas に追従させるための基準 */
.ts-canvas-wrap {
    position: relative;
    display: inline-block;
    line-height: 0;
}
.ts-explore-exit-btn {
    position: absolute;
    /* Canvas 内の「みつけた N / N」 帯（y=0〜30、 Canvas高さ600の5%）の直下。
       PC/スマホ問わず Canvas に追従するよう % 指定 */
    top: 6%;
    right: 1.5%;
    z-index: 6;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #ffe27a;
    border-radius: 4px;
    background: rgba(20, 14, 8, 0.88);
    color: #ffe27a;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 12px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    transition: background 0.1s ease, transform 0.1s ease;
    line-height: 1.4;
}
.ts-explore-exit-btn:hover {
    background: rgba(40, 28, 16, 0.95);
}
.ts-explore-exit-btn:active {
    transform: translateY(1px);
}
/* 「メモ」 ボタン：進むボタンと同じスタイル、 進むボタンの左隣に配置。
   進むボタン右端（1.5%）から余裕を持って 100px 離す（PC「メモ (B)」 約 70px / SP「メモ」 約 50px のどちらでも進むボタンと重ならない距離） */
.ts-explore-notes-btn {
    position: absolute;
    top: 6%;
    right: calc(1.5% + 100px);
    z-index: 6;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #ffe27a;
    border-radius: 4px;
    background: rgba(20, 14, 8, 0.88);
    color: #ffe27a;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 12px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    transition: background 0.1s ease, transform 0.1s ease;
    line-height: 1.4;
}
.ts-explore-notes-btn:hover {
    background: rgba(40, 28, 16, 0.95);
}
.ts-explore-notes-btn:active {
    transform: translateY(1px);
}
/* スマホ（タッチ操作モード）では「(B)」 表記を隠して「メモ」 のみ表示。
   B キーが意味を持たないため、 ラベルを短く整える */
.ts-shooting-touch .ts-explore-notes-btn .ts-explore-notes-key {
    display: none;
}

/* 自販機ミニゲーム play 中の「やめる」 ボタン。 右下、 スコア / HP 表示帯と被らない位置 */
.ts-vending-quit-btn {
    position: absolute;
    bottom: 4%;
    right: 1.5%;
    z-index: 6;
    appearance: none;
    -webkit-appearance: none;
    border: 1.5px solid #ffe27a;
    border-radius: 4px;
    background: rgba(20, 14, 8, 0.88);
    color: #ffe27a;
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 4px 12px;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45);
    transition: background 0.1s ease, transform 0.1s ease;
    line-height: 1.4;
}
.ts-vending-quit-btn:hover {
    background: rgba(40, 28, 16, 0.95);
}
.ts-vending-quit-btn:active {
    transform: translateY(1px);
}

/* ゲームプレイ中（タイトル以外）は親テーマの追従ヘッダー＆「上部に戻る」 ボタンを隠す。
   反魂ボタンと戻るボタンの物理的な被り回避 + プレイ中のヘッダー追従による視界圧迫の解消。
   セレクタは SWELL 標準（#fix_header / .p-fixBtnWrap）に対応。 タイトル戻り時に body から
   クラスが外れて元に戻る */
body.ts-shooting-fullscreen #fix_header,
body.ts-shooting-fullscreen .p-fixBtnWrap {
    display: none !important;
}

/* スマホ横持ち時、 ページの通常ヘッダー（#header）も隠して画面を最大限ゲームに使う。
   縦持ち時は SWELL のナビゲーションを残す（ページ内移動が必要なため）。 タイトル戻りで復活 */
@media (orientation: landscape) and (max-width: 1024px) {
    body.ts-shooting-fullscreen #header {
        display: none !important;
    }
}

/* スマホ横持ち対応：横持ちレイアウト。
   Canvas はアスペクト比 4:3 を維持して画面の縦サイズいっぱいに中央表示。
   controller は画面全体に被せて、 スティック／反魂・オートを左右の余白に絶対配置。
   PSP GO 風の物理コントローラー感を横持ちでも再現 */
@media (orientation: landscape) and (max-width: 1024px) {
    /* container 全体に幅制限と中央寄せ。 タイトル / クリア / オーバー / 図鑑 / あそびかた /
       技変更 等の HTML 系画面が横長端末で広がりすぎないように */
    .ts-shooting-container.ts-shooting-touch {
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
    }
    .ts-shooting-touch #ts-shooting-canvas {
        max-height: 92vh;
        width: auto;
        max-width: 100%;
        margin: 0 auto;
    }
    .ts-shooting-touch .ts-shooting-stage {
        align-items: center;
    }
    /* controller は画面全体に透明で被せ、 子要素を左右の余白に絶対配置する */
    .ts-shooting-touch .ts-shooting-touch-controller {
        position: fixed;
        left: 0; right: 0; top: 0; bottom: 0;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        pointer-events: none;
        z-index: 100;
    }
    .ts-shooting-touch .ts-shooting-stick-base {
        position: absolute;
        left: 3vw;
        bottom: 5vh;
        pointer-events: auto;
    }
    .ts-shooting-touch .ts-shooting-touch-right {
        position: absolute;
        right: 3vw;
        bottom: 5vh;
        pointer-events: auto;
    }
    /* 利き手切替（is-mirror）：スティック右／ボタン左 */
    .ts-shooting-touch .ts-shooting-touch-controller.is-mirror .ts-shooting-stick-base {
        left: auto;
        right: 3vw;
    }
    .ts-shooting-touch .ts-shooting-touch-controller.is-mirror .ts-shooting-touch-right {
        right: auto;
        left: 3vw;
    }
}

/* ミニゆけ！ぴよ丸のリザルト画面でだけ表示する「本編へ」 リンクボタン。
   GBC ベゼル下部に重なる位置で、 タイトル黄＋茶系のレトロトーン。 */
.ts-runner-fullgame-btn {
    position: absolute;
    left: 50%;
    bottom: 8%;
    transform: translateX(-50%);
    z-index: 10;
    appearance: none;
    -webkit-appearance: none;
    text-decoration: none;
    display: inline-block;
    border: 2px solid #ffd35a;
    border-radius: 6px;
    background: #3b2f5c;
    color: #ffd35a;
    font-family: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 8px 18px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
    transition: background 0.1s ease, transform 0.1s ease;
}
.ts-runner-fullgame-btn:hover {
    background: #4d3f72;
}
.ts-runner-fullgame-btn:active {
    transform: translateX(-50%) translateY(1px);
}

/* ========== 一時停止メニュー（プレイ中フェーズで表示） ========== */
.ts-shooting-pause-menu {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 6;
}
.ts-pause-menu-panel {
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 6px 6px 0 var(--tss-ink);
    padding: 24px 32px 28px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
}
.ts-pause-menu-title {
    margin: 0 0 4px;
    text-align: center;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--tss-ink);
}
.ts-pause-menu-panel .ts-shooting-btn {
    width: 100%;
    padding: 12px 16px;
    text-align: center;
}

/* ========== 確認モーダル：押し間違い防止（タイトルへ戻る等） ========== */
.ts-shooting-confirm-modal {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    padding: 16px;
    box-sizing: border-box;
}
.ts-confirm-panel {
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 6px 6px 0 var(--tss-ink);
    padding: 22px 24px 20px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}
.ts-confirm-text {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--tss-ink);
}
.ts-confirm-sub {
    margin: 0 0 18px;
    font-size: 12px;
    color: var(--tss-ink-mute);
}
.ts-confirm-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}
.ts-confirm-buttons .ts-shooting-btn {
    min-width: 220px;
    padding: 12px 18px;
    white-space: nowrap;
}

.ts-shooting-result-body {
    font-size: 14px;
    color: var(--tss-ink-soft);
    margin: 0 0 32px;
    line-height: 1.8;
}

/* 隠し要素の匂わせ／解放通知 ── 達成時のみ表示 ── */
.ts-shooting-hidden-hint {
    margin: -16px 0 24px;
    font-family: "Hiragino Mincho ProN","Yu Mincho","MS Mincho",serif;
    font-size: 13px;
    letter-spacing: 0.14em;
    color: rgba(120, 90, 130, 0.85);
    font-style: italic;
    animation: tssHintFade 1.2s ease-out;
}
.ts-shooting-hidden-hint.is-unlock {
    font-size: 16px;
    font-weight: 700;
    font-style: normal;
    letter-spacing: 0.2em;
    color: #b8860b;
    text-shadow: 0 0 8px rgba(255, 215, 100, 0.45);
    animation: tssUnlockGlow 1.6s ease-out;
}
@keyframes tssHintFade {
    0% { opacity: 0; transform: translateY(-6px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes tssUnlockGlow {
    0% { opacity: 0; transform: scale(0.95); }
    60% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 1; transform: scale(1); }
}

/* スコア表示（クリア時） */
.ts-shooting-score {
    width: 100%;
    max-width: 360px;
    margin: 0 auto 32px;
    background: rgba(26, 26, 26, 0.05);
    border: 1.5px solid var(--tss-ink);
    border-radius: 6px;
    padding: 16px 20px;
}
.ts-shooting-score-list {
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ts-shooting-score-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 13px;
    color: var(--tss-ink-soft);
}
.ts-shooting-score-row dt {
    margin: 0;
    letter-spacing: 0.04em;
}
.ts-shooting-score-row dd {
    margin: 0;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}
.ts-shooting-score-row.ts-shooting-score-total {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1.5px dashed var(--tss-ink);
    font-size: 16px;
    color: var(--tss-ink);
}
.ts-shooting-score-row.ts-shooting-score-total dd {
    font-size: 22px;
    color: var(--tss-accent);
}

/* オーバー画面「探索へ戻る」 ボタン：副選択肢として控えめに、 他の主要ボタンより小さく */
#ts-shooting-explore-from-over {
    padding: 8px 18px;
    font-size: 13px;
    min-height: 36px;
    min-width: 140px;
    letter-spacing: 0.04em;
}

/* ========== ボタン階層 ========== */

.ts-shooting-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 2px solid transparent;
    border-radius: 6px;
    padding: 12px 28px;
    /* ▶と文字を inline-flex で並べることで、 ▶と文字を近接配置できる
       （以前は ::before を position:absolute で左固定していたため、
       padding-left を広げざるを得ず▶と文字が離れて見える問題があった） */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.06em;
    cursor: pointer;
    font-family: inherit;
    min-height: 48px;
    min-width: 168px;
    position: relative;
    transition: transform 120ms ease, box-shadow 120ms ease, background-color 120ms ease, color 120ms ease;
}

/* カーソルマーカー▶：フォーカス時のみ表示。 flex item として文字の直前に並ぶ
   非フォーカス時は opacity:0 だが領域はキープし、 フォーカスで文字位置が動かないようにする */
.ts-shooting-btn::before {
    content: '▶';
    opacity: 0;
    transition: opacity 120ms ease;
    font-weight: 700;
    font-size: 0.95em;
    line-height: 1;
    pointer-events: none;
}
.ts-shooting-btn:focus::before,
.ts-shooting-btn:focus-visible::before {
    opacity: 1;
}
/* 右側の見えないスペーサー：左の▶と同じ幅を確保して、 文字をボタンの視覚的中央に寄せる */
.ts-shooting-btn::after {
    content: '▶';
    visibility: hidden;
    font-weight: 700;
    font-size: 0.95em;
    line-height: 1;
    pointer-events: none;
}

/* 縦並びになる「クリア/オーバー画面」の直下のボタン同士にだけ縦余白を入れる。
   以前はグローバルな .ts-shooting-btn + .ts-shooting-btn ルールだったが、
   横並びレイアウト（sub-actions / howto-nav / phase-end-wait / pause-menu）でも
   2 個目以降に余白が乗ってズレる事故が連発したため、 セレクタを縦並びの場所だけに限定した。
   各横並びコンテナは flex の gap で隙間を作る。 */
.ts-shooting-screen > .ts-shooting-btn + .ts-shooting-btn {
    margin-top: 12px;
}

/* フォーカスは ::before の ▶ マーカーで明示しているので、 outline は付けない */
.ts-shooting-btn:focus-visible {
    outline: none;
}

/* Primary: 塗り、最も目立つ */
.ts-shooting-btn-primary {
    background: var(--tss-ink);
    color: var(--tss-paper);
    border-color: var(--tss-ink);
    box-shadow: 4px 4px 0 var(--tss-accent);
}

.ts-shooting-btn-primary:hover {
    /* accent-deep を使うことで paper の上で約5.5:1 を確保（hover時の文字読みやすさ） */
    background: var(--tss-accent-deep);
    border-color: var(--tss-accent-deep);
    box-shadow: 4px 4px 0 var(--tss-ink);
}

.ts-shooting-btn-primary:active {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--tss-ink);
}

/* Secondary: 枠線のみ */
.ts-shooting-btn-secondary {
    background: transparent;
    color: var(--tss-ink);
    border-color: var(--tss-ink);
}

.ts-shooting-btn-secondary:hover {
    background: var(--tss-ink);
    color: var(--tss-paper);
}

/* Tertiary: 枠なし、テキストのみ */
.ts-shooting-btn-tertiary {
    background: transparent;
    color: var(--tss-ink-soft);
    border-color: transparent;
    min-height: 44px; /* WCAG タッチターゲット最小サイズ */
    min-width: 0;
    padding: 10px 28px;             /* 左右対称、 base より少しコンパクト（控えめボタン） */
    font-weight: 500;
    box-shadow: none;
}

.ts-shooting-btn-tertiary:hover {
    color: var(--tss-ink);
    text-decoration: underline;
    text-underline-offset: 4px;
}

/* ========== モバイル時の案内 ========== */

.ts-shooting-mobile-message {
    display: none;
    text-align: center;
    padding: 48px 24px;
    color: var(--tss-ink-soft);
    line-height: 2;
}

.ts-shooting-mobile-message p {
    margin: 4px 0;
}

/* PC専用: 横幅 720px 未満ではコンテナ本体を隠してメッセージを表示。
   JSがインラインstyleで各スクリーンの display を切り替える設計なので、
   メディアクエリ側はそれを上書きする必要がある（ここだけ !important を意図的に使う）。 */
/* ============================================================
   あそびかた（読み物）画面
   タイトルからいつでも開ける。初回自動表示やゲーム開始連動は持たない。
   ゲーム内コーチとは別の役割：全体像の参照用。
   ============================================================ */
.ts-shooting-howto-screen {
    background: var(--tss-accent);
    padding: 32px 28px 28px;
    height: 720px;          /* 固定高さ：ページごとにサイズが変わらないように統一 */
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ts-howto-header {
    position: relative;
    text-align: center;
    margin-bottom: 18px;
    padding: 0 100px;
}
.ts-howto-close {
    position: absolute;
    top: 4px;
    right: 0;
    background: transparent;
    border: 2px solid var(--tss-paper);
    color: var(--tss-paper);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 6px 14px;
    cursor: pointer;
    transition: background 0.1s ease, color 0.1s ease;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.25);
}
.ts-howto-close:hover,
.ts-howto-close:focus-visible {
    background: var(--tss-paper);
    color: var(--tss-accent-deep);
    outline: none;
}
.ts-howto-title {
    display: inline-block;
    margin: 0 0 6px;
    padding: 6px 18px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--tss-ink);
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 4px 4px 0 var(--tss-ink);
}
.ts-howto-page-num {
    margin: 6px 0 0;
    font-size: 12px;
    letter-spacing: 0.18em;
    /* 赤背景(--tss-accent #d4232a)上で WCAG AA 通過のため純白を使う（paper #fff9f0 は約4.0:1で未達） */
    color: #ffffff;
    font-weight: 700;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}
/* あそびかた本体：JRPG ダイアログボックス風の1つの箱。
   話者（アド・フォーク）は箱の左上角に小さなポートレート＋名前ラベルで控えめに表示。
   本文（heading＋paragraph）が主役。補助情報（テーマ画像＋keys）は箱の下部にまとめる。 */
.ts-howto-body {
    flex: 1;
    max-width: 760px;
    width: 100%;
    margin: 0 auto 18px;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    display: flex;
    flex-direction: column;
    min-height: 0;       /* flex子要素が縦スクロールできるよう min-height: 0 を明示 */
}
.ts-howto-box {
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 6px 6px 0 var(--tss-ink);
    padding: 16px 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;   /* 親 .ts-shooting-screen の text-align:center を打ち消す */
    flex: 1;
    min-height: 0;
    overflow: hidden;    /* 上下キーはナビ操作専用にするため内部スクロールはしない（収まる前提でボリューム調整） */
}
/* 話者ヘッダー：上に小さく [ポートレート] アド・フォーク（解説役） */
.ts-howto-speaker {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid var(--tss-line);
}
.ts-howto-speaker-img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    image-rendering: pixelated;
    background: var(--tss-bg);
    border: 1.5px solid var(--tss-ink);
    padding: 3px;
    box-sizing: border-box;
    flex-shrink: 0;
}
.ts-howto-speaker-name {
    font-size: 14px;
    font-weight: 800;
    color: var(--tss-ink);
    letter-spacing: 0.06em;
}
.ts-howto-speaker-role {
    font-size: 12px;
    color: var(--tss-ink-mute);
}
/* メイン：左にテーマ画像、右に説明テキスト */
.ts-howto-main {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    min-height: 160px;
}
.ts-howto-topic {
    flex: 0 0 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tss-bg);
    border: 1.5px solid var(--tss-ink);
}
.ts-howto-topic img {
    width: 86%;
    height: 86%;
    object-fit: contain;
    image-rendering: pixelated;
}
/* 複数画像（クティとぐれ等）を横並びにする */
.ts-howto-topic-multi {
    flex-direction: row;
    gap: 8px;
    padding: 6px;
    box-sizing: border-box;
}
.ts-howto-topic-multi img {
    width: 100%;
    height: 100%;
    flex: 1 1 0;
    min-width: 0;
}
.ts-howto-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* intro：画像と並ぶ位置に出す導入文（挨拶文など）。本文より少し控えめに */
.ts-howto-intro {
    margin: 0 0 4px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--tss-ink);
    white-space: pre-line;
}
.ts-howto-eyebrow {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.14em;
    color: var(--tss-ink-mute);
    font-weight: 700;
}
.ts-howto-heading {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--tss-ink);
    line-height: 1.4;
}
.ts-howto-paragraph {
    margin: 0;
    font-size: 14px;
    line-height: 1.85;
    color: var(--tss-ink);
    white-space: pre-line;
}
.ts-howto-keys {
    margin: 6px 0 0;
    padding: 8px 10px;
    background: var(--tss-bg);
    border: 1.5px dashed var(--tss-ink);
    font-size: 12px;
    line-height: 1.8;
    color: var(--tss-ink);
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    letter-spacing: 0.02em;
    white-space: pre-line;
}
.ts-howto-nav {
    width: 100%;
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}
/* もどる／つぎへ：縦サイズ統一＋box-sizing揃え（primary/secondary でズレないように） */
.ts-howto-nav .ts-shooting-btn {
    min-height: 56px;
    padding: 14px 22px;
    box-sizing: border-box;
    line-height: 1;
}
.ts-howto-nav .ts-shooting-btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================================
   ゲーム内コーチ（アド・フォークが文脈で解説する）
   Canvas の下部に重ねる。表示中はゲームを一時停止。
   ============================================================ */
.ts-shooting-coach {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 20;
    display: flex;
    align-items: stretch;
    gap: 14px;
    padding: 12px 14px;
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 4px 4px 0 var(--tss-ink);
}
.ts-coach-portrait {
    flex: 0 0 84px;
    height: 84px;
    background: var(--tss-bg);
    border: 1.5px solid var(--tss-ink);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ts-coach-portrait-img {
    width: 88%;
    height: 88%;
    object-fit: contain;
    image-rendering: pixelated;
}
.ts-coach-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
}
.ts-coach-name {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    color: var(--tss-accent-deep);
    letter-spacing: 0.08em;
}
.ts-coach-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.65;
    color: var(--tss-ink);
    white-space: pre-line;
}
.ts-coach-hint {
    margin: 2px 0 0;
    font-size: 10px;
    color: var(--tss-ink-mute);
    letter-spacing: 0.06em;
}
.ts-coach-next {
    align-self: center;
    background: var(--tss-ink);
    color: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    padding: 8px 14px;
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.06em;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--tss-ink-mute);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
    font-family: inherit;
}
.ts-coach-next:hover,
.ts-coach-next:focus-visible {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--tss-ink-mute);
    outline: none;
}

/* pc_only 警告と SP レイアウトのブレイクポイントを 720px に統一
   （かつてここだけ 719 だったため、ちょうど 720px の幅で
   「SPスタイル発火 / pc_only警告は非発火」 の 1px ギャップがあった） */
@media (max-width: 720px) {
    .ts-shooting-container.pc_only > *:not(.ts-shooting-mobile-message) {
        display: none !important;
    }
    .ts-shooting-container.pc_only .ts-shooting-mobile-message {
        display: block;
    }
}

/* ============================================================
   ツキモノ図鑑 codex screen
   タイトル画面と同じ赤ベース。カードはクリーム＋黒の二色構成。
   ============================================================ */
.ts-shooting-codex-screen {
    background: var(--tss-accent);
    padding: 32px 28px 28px;
    min-height: 600px;
    position: relative;
}
.ts-codex-header {
    text-align: center;
    margin-bottom: 18px;
}
.ts-codex-title {
    display: inline-block;
    margin: 0 0 6px;
    padding: 6px 18px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--tss-ink);
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 4px 4px 0 var(--tss-ink);
}
.ts-codex-sub {
    margin: 4px 0 0;
    font-size: 13px;
    /* 赤背景上で WCAG AA 通過のため純白（paper は約4.0:1で未達） */
    color: #ffffff;
    letter-spacing: 0.04em;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}
.ts-codex-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    max-width: 760px;
    margin: 0 auto 18px;
}
.ts-codex-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 8px 6px 10px;
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 3px 3px 0 var(--tss-ink);
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease;
    font: inherit;
    color: var(--tss-ink);
    text-align: center;
}
.ts-codex-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: 5px 5px 0 var(--tss-ink);
    outline: none;
}
/* キー操作のフォーカスは装備カードと同じく「金枠＋うっすら金背景＋浮き上がり」で明示 */
.ts-codex-card:focus,
.ts-codex-card:focus-visible {
    transform: translate(-2px, -2px);
    box-shadow: 6px 6px 0 var(--tss-ink), inset 0 0 0 3px #ffd35a;
    background: #fff5d4;
    outline: none;
}
.ts-codex-card:active {
    transform: translate(1px, 1px);
    box-shadow: 1px 1px 0 var(--tss-ink);
}
.ts-codex-card-art {
    width: 76px;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.ts-codex-card-art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}
.ts-codex-card.locked .ts-codex-card-art img {
    filter: brightness(0);
    opacity: 0.55;
}
.ts-codex-card-name {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--tss-ink);
}
.ts-codex-card.locked .ts-codex-card-name {
    color: var(--tss-ink-mute);
}
.ts-codex-card-count {
    position: absolute;
    top: 4px;
    right: 4px;
    min-width: 22px;
    height: 18px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--tss-paper);
    background: var(--tss-ink);
    border: 1.5px solid var(--tss-ink);
    letter-spacing: 0;
}
.ts-codex-card.companion .ts-codex-card-count {
    background: var(--tss-accent-deep);
    border-color: var(--tss-accent-deep);
}
.ts-codex-card.boss .ts-codex-card-count {
    background: var(--tss-accent-deep);
    border-color: var(--tss-ink);
}
.ts-codex-actions {
    text-align: center;
}

/* 詳細パネル：グリッド画面の上にかぶせる（背景は完全不透明） */
.ts-codex-detail {
    position: absolute;
    inset: 0;
    background: var(--tss-accent);
    padding: 28px 24px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    z-index: 5;
}
.ts-codex-detail-inner {
    display: flex;
    gap: 22px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 6px 6px 0 var(--tss-ink);
    padding: 22px 24px;
}
.ts-codex-detail-art {
    flex: 0 0 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tss-bg);
    border: 1.5px solid var(--tss-ink);
}
.ts-codex-detail-img {
    width: 92%;
    height: 92%;
    object-fit: contain;
    image-rendering: pixelated;
}
.ts-codex-detail-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ts-codex-detail-role {
    margin: 0;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--tss-ink-mute);
}
.ts-codex-detail-name {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: var(--tss-ink);
}
.ts-codex-detail-stats {
    margin: 0 0 8px;
    padding: 8px 10px;
    border: 1.5px dashed var(--tss-ink);
    background: var(--tss-bg);
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    font-size: 12px;
}
.ts-codex-detail-row {
    display: flex;
    gap: 10px;
}
.ts-codex-detail-row dt {
    flex: 0 0 64px;
    color: var(--tss-ink-soft);
    font-weight: 700;
}
.ts-codex-detail-row dd {
    margin: 0;
    color: var(--tss-ink);
}
.ts-codex-detail-flavor {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.7;
    color: var(--tss-ink);
    white-space: pre-line;
}
#ts-codex-detail-close {
    align-self: center;
}

/* ============================================================
   装備画面（武器選択）
   タイトルからの遷移先。カードを2枚並べて、選択中は反転スタイル
   将来は霊弾/霊剣の覚醒形態など他の装備カードもここに並ぶ
   ============================================================ */
.ts-shooting-equip-screen {
    background: var(--tss-accent);
    padding: 32px 28px 28px;
    min-height: 600px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}
.ts-equip-header {
    text-align: center;
    margin-bottom: 22px;
}
.ts-equip-title {
    display: inline-block;
    margin: 0 0 6px;
    padding: 6px 22px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--tss-ink);
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 4px 4px 0 var(--tss-ink);
}
.ts-equip-sub {
    margin: 4px 0 0;
    font-size: 13px;
    /* 赤背景上で WCAG AA 通過のため純白（paper は約4.0:1で未達） */
    color: #ffffff;
    letter-spacing: 0.04em;
    text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}
.ts-equip-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    max-width: 640px;
    margin: 0 auto 22px;
    width: 100%;
}
.ts-equip-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 18px 18px 16px;
    background: var(--tss-paper);
    border: 2px solid var(--tss-ink);
    box-shadow: 4px 4px 0 var(--tss-ink);
    cursor: pointer;
    transition: transform 0.08s ease, box-shadow 0.08s ease, background 0.1s ease;
    font: inherit;
    color: var(--tss-ink);
    text-align: left;
}
.ts-equip-card:hover {
    transform: translate(-1px, -1px);
    box-shadow: 6px 6px 0 var(--tss-ink);
    outline: none;
}
/* フォーカス時は明確に「選ばれてる」と分かるよう、背景うっすら金＋内側に黄色の枠＋浮き上がり */
.ts-equip-card:focus,
.ts-equip-card:focus-visible {
    transform: translate(-3px, -3px);
    box-shadow: 8px 8px 0 var(--tss-ink), inset 0 0 0 4px #ffd35a;
    background: #fff5d4;
    outline: none;
}
.ts-equip-card[aria-pressed="true"]:focus,
.ts-equip-card[aria-pressed="true"]:focus-visible {
    /* 装備中カードがフォーカス時：暗背景に金枠 */
    background: var(--tss-ink);
    color: var(--tss-paper);
    box-shadow: 8px 8px 0 var(--tss-ink), inset 0 0 0 4px #ffd35a;
}
.ts-equip-card[aria-pressed="true"] {
    background: var(--tss-ink);
    color: var(--tss-paper);
}
/* 使用中カードに「使用中」バッジ（非使用カードにはラベルなし） */
.ts-equip-card[aria-pressed="true"]::after {
    content: '使用中';
    display: inline-block;
    align-self: flex-start;
    margin-top: 12px;
    padding: 4px 10px;
    background: #ffd35a;
    color: var(--tss-ink);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    border-radius: 3px;
}
.ts-equip-card-name {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}
.ts-equip-card-desc {
    font-size: 12px;
    line-height: 1.6;
    opacity: 0.86;
}
.ts-equip-actions {
    display: flex;
    justify-content: center;
    margin-top: auto;
}

/* ============================================================
   スマホ／タブレット対応：タッチ端末で発動するスタイル
   JS が .ts-shooting-container から pc_only を剥がして
   .ts-shooting-touch を付けたときだけ効く
   ============================================================ */

/* Canvas のブラウザ標準動作（スクロール・ピンチズーム・長押し選択）を抑える */
.ts-shooting-touch #ts-shooting-canvas {
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* HUD のキー説明はタッチ端末では意味がないので非表示（PCでは引き続き表示） */
.ts-shooting-touch .ts-shooting-keys {
    display: none;
}
/* 「操作: スティック左/右」切替ボタンはタッチ端末でのみ意味があるので、PCでは非表示 */
.ts-shooting-container:not(.ts-shooting-touch) #ts-shooting-controller-side {
    display: none;
}

/* ─────────────────────────────────────────────
   タッチ操作のコントローラーパネル
   PSP GO 風レイアウト。和の物理コントローラー感
   配色：墨黒（#1a1a1a 系）＋朱（var(--tss-accent) #d4232a）
   ───────────────────────────────────────────── */
.ts-shooting-touch-controller {
    display: none;
    background:
        linear-gradient(180deg, #1f1f1f 0%, #0e0e0e 60%, #050505 100%);
    border-top: 1px solid #2c2c2c;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.06),
        inset 0 -2px 6px rgba(0, 0, 0, 0.55);
    padding: 14px 16px max(14px, env(safe-area-inset-bottom, 14px));
    padding-left: max(18px, env(safe-area-inset-left, 18px));
    padding-right: max(18px, env(safe-area-inset-right, 18px));
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-sizing: border-box;
}
/* 左右配置の切替（利き手対応）：スティックを右、ボタンを左にミラー */
.ts-shooting-touch-controller.is-mirror {
    flex-direction: row-reverse;
}
.ts-shooting-touch .ts-shooting-touch-controller.is-visible {
    display: flex;
}

/* ── 仮想スティック ベース：墨色の凹んだ円盤 ── */
.ts-shooting-stick-base {
    position: relative;
    flex-shrink: 0;
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 30%, #2c2c2c 0%, #0a0a0a 65%, #000 100%);
    border: 1px solid #3a3a3a;
    box-shadow:
        inset 0 -6px 14px rgba(0, 0, 0, 0.7),
        inset 0 4px 10px rgba(255, 255, 255, 0.05),
        0 4px 12px rgba(0, 0, 0, 0.55),
        0 0 0 1px rgba(0, 0, 0, 0.6);
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}
/* ベース内側の凹み：奥行きを強調 */
.ts-shooting-stick-base::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 76%; height: 76%;
    border-radius: 50%;
    background:
        radial-gradient(circle at 30% 25%, #1a1a1a 0%, #050505 75%);
    box-shadow:
        inset 0 3px 10px rgba(0, 0, 0, 0.7),
        inset 0 -2px 4px rgba(80, 80, 80, 0.18);
    pointer-events: none;
}
/* ベース上端の細い金属反射ライン */
.ts-shooting-stick-base::after {
    content: '';
    position: absolute;
    top: 4%; left: 14%;
    width: 72%; height: 32%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.1) 0%, transparent 60%);
    pointer-events: none;
}

/* ── スティック ノブ：朱色の半球体、立体感あり ── */
.ts-shooting-stick-knob {
    position: absolute;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background:
        radial-gradient(circle at 35% 28%,
            #ee4a52 0%,
            var(--tss-accent) 45%,
            var(--tss-accent-deep) 78%,
            #6e1014 100%);
    border: 1.5px solid #0a0a0a;
    box-shadow:
        inset 0 -5px 10px rgba(0, 0, 0, 0.5),
        inset 0 4px 8px rgba(255, 220, 220, 0.35),
        0 3px 10px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(0, 0, 0, 0.4);
    left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: transform 50ms ease;
}
/* ノブの白い光沢ハイライト */
.ts-shooting-stick-knob::before {
    content: '';
    position: absolute;
    top: 14%; left: 22%;
    width: 42%; height: 28%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 50% 50%, rgba(255, 240, 240, 0.7) 0%, rgba(255, 200, 200, 0.18) 50%, transparent 80%);
    pointer-events: none;
}

/* ── 右側ボタン群コンテナ：オート浄化（小）と反魂（大）を横並びにまとめる ── */
.ts-shooting-touch-right {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

/* ── オート浄化トグルボタン：アーケード風プッシュボタン、ON/OFFで色が変わる ── */
.ts-shooting-autofire-touch-btn {
    position: relative;
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    border-radius: 50%;
    /* OFF時：墨銀の落ち着いた状態。中央のラジアルで「上面の凸」を演出 */
    background:
        radial-gradient(circle at 50% 35%,
            #7a7066 0%,
            #4a4540 35%,
            #2a2620 75%,
            #100c08 100%);
    color: rgba(255, 243, 223, 0.55);
    font-family: inherit;
    /* メタリックリム＋本体内の光沢／影（反魂と同じ構造） */
    box-shadow:
        inset 0 3px 5px rgba(220, 200, 160, 0.25),
        inset 0 -5px 10px rgba(0, 0, 0, 0.65),
        0 0 0 1.5px #0a0a0a,
        0 0 0 3px #7a7a7a,
        0 0 0 4.5px #161616,
        0 4px 8px rgba(0, 0, 0, 0.55),
        0 7px 14px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 100ms ease, box-shadow 100ms ease, background 120ms ease, color 120ms ease;
}
/* 上面の光沢ハイライト */
.ts-shooting-autofire-touch-btn::before {
    content: '';
    position: absolute;
    top: 6%; left: 16%;
    width: 60%; height: 32%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 50% 50%, rgba(255, 240, 200, 0.7) 0%, rgba(255, 220, 160, 0.25) 45%, transparent 75%);
    pointer-events: none;
    opacity: 0.5;
}
.ts-shooting-autofire-touch-btn .ts-shooting-autofire-label {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    margin-bottom: 1px;
}
.ts-shooting-autofire-touch-btn .ts-shooting-autofire-state {
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.55);
}
/* ON状態：金色に光るアーケードボタン */
.ts-shooting-autofire-touch-btn.is-on {
    background:
        radial-gradient(circle at 50% 35%,
            #fff8c8 0%,
            #ffe27a 35%,
            #d4a83a 75%,
            #7a5a14 100%);
    color: #1a1a1a;
    box-shadow:
        inset 0 4px 6px rgba(255, 248, 220, 0.65),
        inset 0 -5px 10px rgba(80, 55, 10, 0.5),
        0 0 0 1.5px #0a0a0a,
        0 0 0 3px #c6a64d,
        0 0 0 4.5px #1a1612,
        0 4px 8px rgba(0, 0, 0, 0.55),
        0 7px 14px rgba(0, 0, 0, 0.4),
        0 0 14px 3px rgba(255, 226, 122, 0.5);
}
.ts-shooting-autofire-touch-btn.is-on::before {
    opacity: 1;
}
.ts-shooting-autofire-touch-btn.is-on .ts-shooting-autofire-state {
    text-shadow: 0 1px 1px rgba(255, 250, 220, 0.6), 0 -1px 0 rgba(80, 60, 10, 0.5);
}
/* 押下：アーケード風に下に沈み込む */
.ts-shooting-autofire-touch-btn:active {
    transform: translateY(2px) scale(0.97);
    box-shadow:
        inset 0 5px 10px rgba(0, 0, 0, 0.7),
        inset 0 -2px 4px rgba(220, 200, 160, 0.15),
        0 0 0 1.5px #0a0a0a,
        0 0 0 3px #6a6a6a,
        0 0 0 4.5px #161616,
        0 2px 4px rgba(0, 0, 0, 0.55);
}

/* ── 反魂ボタン：アーケードゲームのプッシュボタン風 ──
   メタリックリム（銀＋黒の二層）＋上面プラスチック光沢＋深い沈み込み */
.ts-shooting-reap-btn {
    position: relative;
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    margin: 0;
    border: none;
    outline: none;
    -webkit-tap-highlight-color: transparent;
    border-radius: 50%;
    /* 本体：上から見たアクリルキャップ風。中央のラジアルで「上面の凸」を演出 */
    background:
        radial-gradient(circle at 50% 35%,
            #ff5e66 0%,
            #ee3038 25%,
            var(--tss-accent) 55%,
            var(--tss-accent-deep) 85%,
            #5e0e12 100%);
    color: #fff9f0;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.1em;
    font-family: inherit;
    text-shadow:
        0 -1px 1px rgba(0, 0, 0, 0.55),
        0 1px 1px rgba(255, 220, 220, 0.25);
    /* メタリックリム（外側）＋本体内の光沢／影 */
    box-shadow:
        /* 上面の白い反射（プラスチック感） */
        inset 0 4px 6px rgba(255, 240, 220, 0.5),
        /* 下面の深い影（厚み感） */
        inset 0 -6px 12px rgba(0, 0, 0, 0.65),
        /* リム内側の細い暗線（縁の段差） */
        0 0 0 1.5px #0a0a0a,
        /* 金属シルバーリング */
        0 0 0 3px #7a7a7a,
        /* リム外側の暗線 */
        0 0 0 4.5px #161616,
        /* 落ち影（高さを感じさせる） */
        0 5px 8px rgba(0, 0, 0, 0.55),
        0 8px 16px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 60ms ease-out, box-shadow 60ms ease-out, background 80ms ease;
    z-index: 1;
}
/* 上面の強い光沢ハイライト（アクリルキャップの反射感） */
.ts-shooting-reap-btn::before {
    content: '';
    position: absolute;
    top: 6%; left: 16%;
    width: 60%; height: 32%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 50% 50%, rgba(255, 245, 235, 0.9) 0%, rgba(255, 210, 210, 0.4) 45%, transparent 75%);
    pointer-events: none;
}
/* 下端のうっすら反射（厚みを感じさせる細い光ライン） */
.ts-shooting-reap-btn::after {
    content: '';
    position: absolute;
    bottom: 8%; left: 24%;
    width: 52%; height: 12%;
    border-radius: 50%;
    background:
        radial-gradient(ellipse at 50% 100%, rgba(255, 200, 200, 0.3) 0%, transparent 70%);
    pointer-events: none;
}
/* 押下：本体が物理的に沈む。リムは固定、上面だけ凹む感じを translateY と影の縮みで */
.ts-shooting-reap-btn.is-active {
    background:
        radial-gradient(circle at 50% 35%,
            #c91c24 0%,
            var(--tss-accent-deep) 35%,
            #7a1216 70%,
            #4a0a0d 100%);
    transform: translateY(3px) scale(0.96);
    box-shadow:
        inset 0 5px 10px rgba(0, 0, 0, 0.75),
        inset 0 -2px 4px rgba(255, 200, 200, 0.12),
        0 0 0 1.5px #0a0a0a,
        0 0 0 3px #6a6a6a,
        0 0 0 4.5px #161616,
        0 2px 4px rgba(0, 0, 0, 0.6),
        0 0 16px 3px rgba(212, 35, 42, 0.55),
        0 0 32px 6px rgba(212, 35, 42, 0.22);
}
.ts-shooting-reap-btn.is-active::before {
    opacity: 0.35;
    top: 10%;
}

/* ============================================================
   レスポンシブ対応（スマホ・タブレット縦持ち想定: 〜720px）
   タイトル / あそびかた / 図鑑 / コーチダイアログを画面に収める。
   .ts-shooting-touch 限定にせず画面幅で判定して、PCの細幅ウィンドウでも効くようにする。
   ============================================================ */
@media (max-width: 720px) {
    /* === 外殻：WPテーマ（SWELL等）の padding を打ち消して画面端まで広げる === */
    .ts-shooting-container {
        margin-inline: calc(50% - 50vw);
        width: 100vw;
        max-width: 100vw;
        padding: 0;
        min-height: 100vh;
        min-height: 100svh;
    }

    /* === スクリーン共通：PCでは「雑誌風の浮きあがった枠付きパネル」だが、
       スマホでは全画面で表示するため枠・角丸・影を解除してフラットに === */
    .ts-shooting-screen {
        border: none;
        border-radius: 0;
        box-shadow: none;
        max-width: 100vw;
    }

    /* === タイトル ===
       中身を画面に均等配分（space-around）。
       center だと中央に集中して上下に余白が広がって縦長に見える。
       space-around で各要素間に自然な余白を配分する。 */
    .ts-shooting-title {
        padding: 12px;
        min-height: 100vh;
        min-height: 100svh;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        align-items: center;
        gap: 12px;
        overflow: hidden;
    }
    .ts-title-logo-wrap {
        position: static;
        transform: none;
        order: 1;
        text-align: center;
    }
    .ts-title-hero {
        position: relative;   /* 子の aise/piyo の絶対座標の基準として relative に */
        left: auto;
        bottom: auto;
        transform: none;
        order: 2;
        width: 200px;
        height: 130px;
        margin: 0 auto;
    }
    .ts-title-actions {
        position: static;
        transform: none;
        order: 3;
        width: 100%;
        max-width: 360px;
    }
    /* ロゴ：子クラス l1/l2 に font-size が直接指定されているので、ここでオーバーライドする
       （親 .ts-title-logo にいくら clamp を当てても効かない） */
    .ts-title-logo-l1 {
        font-size: clamp(22px, 7vw, 36px);
        padding: 3px 12px;
        box-shadow: 4px 4px 0 var(--tss-ink);
        margin-bottom: 4px;
    }
    .ts-title-logo-l2 {
        font-size: clamp(16px, 5.2vw, 28px);
        padding: 3px 12px;
        box-shadow: 4px 4px 0 var(--tss-ink);
    }
    .ts-title-sub {
        font-size: clamp(10px, 2.8vw, 14px);
        white-space: nowrap;
        margin-top: 8px;
    }
    /* キャストは 6体表示（ぐれ・たまうさ・もめんくん・クティ・にひり・人魂）。
       他はスマホで重なって見づらいので非表示。
       ヒーロー（中央のアイセ・ぴよ丸）周りに散らして世界観を伝える */
    .ts-title-cast {
        display: block;
    }
    .ts-t-pari,
    .ts-t-mokkun,
    .ts-t-pukuta,
    .ts-t-kua,
    .ts-t-moguhana {
        display: none;
    }
    .ts-t-gure     { top: 6%;   left: 4%;   width: 44px; height: 44px; }
    .ts-t-kuti     { top: 6%;   left: 80%;  width: 44px; height: 44px; }
    .ts-t-tamausa  { top: 32%;  left: 84%;  width: 42px; height: 42px; }
    .ts-t-momenkun { top: 38%;  left: 2%;   width: 48px; height: 48px; }
    .ts-t-hitodama { top: 62%;  left: 4%;   width: 38px; height: 38px; }
    .ts-t-nihiri   { top: 62%;  left: 84%;  width: 42px; height: 42px; }
    .ts-title-shape {
        opacity: 0.12;
    }
    /* 大きすぎる三角はスマホで邪魔なので非表示 */
    .ts-title-shape-tri1,
    .ts-title-shape-tri2 {
        display: none;
    }
    .ts-title-aise {
        position: absolute;
        left: 10px; bottom: 0;
        width: 110px; height: 110px;
    }
    .ts-title-piyo {
        position: absolute;
        right: 8px; top: 0;
        width: 60px; height: 60px;
    }
    .ts-title-boss {
        /* スマホでは見えない位置になるので非表示 */
        display: none;
    }
    .ts-title-actions .ts-shooting-btn-primary {
        font-size: 16px;
        padding: 12px 28px;
        min-width: 160px;
    }
    /* サブアクション：2列グリッドで5ボタン（最後の1個は中央寄せ） */
    .ts-title-sub-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px 12px;
        max-width: 300px;
        margin: 0 auto;
    }
    .ts-title-sub-actions .ts-shooting-btn-tertiary {
        font-size: 12px;
        padding: 12px 10px;
        min-height: 44px;
        white-space: nowrap;
    }
    /* スマホ用：おみくじボタンを少しコンパクトに（タッチターゲット 44px は確保） */
    .ts-title-omikuji-btn {
        top: 14px;
        right: 14px;
        font-size: 12px;
        padding: 10px 14px;
        min-height: 44px;
        box-shadow: 2px 2px 0 var(--tss-ink);
    }

    /* === あそびかた === */
    /* PC では height:720px の固定箱に collapse して overflow:hidden で隠れる。
       スマホでは中身が画面に収まらないので、固定高さを解除して
       screen 全体で縦スクロールできるようにする。 */
    .ts-shooting-howto-screen {
        padding: 12px 10px 16px;
        min-height: 100vh;
        min-height: 100svh;
        height: auto;
        max-height: none;
        overflow-y: auto;
        box-sizing: border-box;
    }
    .ts-howto-header {
        padding: 0 64px;
        margin-bottom: 10px;
    }
    .ts-howto-title {
        font-size: 18px;
        padding: 4px 12px;
        box-shadow: 2px 2px 0 var(--tss-ink);
    }
    .ts-howto-close {
        font-size: 10px;
        padding: 4px 10px;
    }
    .ts-howto-page-num {
        font-size: 10px;
    }
    .ts-howto-body {
        flex: none;
        gap: 0;
        padding: 0;
        max-width: 100%;
        box-shadow: none;
        margin-bottom: 14px;
    }
    .ts-howto-box {
        flex: none;
        padding: 14px 16px;
        gap: 12px;
        overflow: visible;
        box-shadow: 3px 3px 0 var(--tss-ink);
    }
    .ts-howto-speaker-img {
        width: 34px;
        height: 34px;
        padding: 2px;
    }
    .ts-howto-speaker-name {
        font-size: 12px;
    }
    .ts-howto-speaker-role {
        font-size: 11px;
    }
    /* スマホは縦並びに：画が上、テキストが下 */
    .ts-howto-main {
        flex-direction: column;
        gap: 12px;
        min-height: auto;
    }
    .ts-howto-topic {
        flex: 0 0 auto;
        width: 100%;
        height: 130px;
    }
    .ts-howto-heading {
        font-size: 16px;
    }
    .ts-howto-paragraph {
        font-size: 13px;
        line-height: 1.75;
    }
    .ts-howto-keys {
        font-size: 11px;
    }
    .ts-howto-nav {
        gap: 8px;
    }
    .ts-howto-nav .ts-shooting-btn {
        min-width: 0;
        flex: 1;
        font-size: 13px;
        padding: 10px 8px;
    }

    /* === 図鑑 === */
    .ts-shooting-codex-screen {
        padding: 12px 10px 16px;
        min-height: 100vh;
        min-height: 100svh;
        max-height: 100vh;
        max-height: 100svh;
        overflow-y: auto;
        box-sizing: border-box;
    }
    .ts-codex-header {
        margin-bottom: 10px;
    }
    .ts-codex-title {
        font-size: 18px;
        padding: 4px 12px;
        box-shadow: 2px 2px 0 var(--tss-ink);
    }
    .ts-codex-sub {
        font-size: 11px;
    }
    .ts-codex-grid {
        grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
        gap: 8px;
        margin: 0 auto 12px;
    }
    .ts-codex-card {
        min-width: 0;
        padding: 6px 4px 8px;
        box-shadow: 2px 2px 0 var(--tss-ink);
    }
    .ts-codex-card-art {
        width: 56px;
        height: 56px;
    }
    .ts-codex-card-name {
        font-size: 10px;
    }
    .ts-codex-card-count {
        font-size: 9px;
        top: 2px;
        right: 2px;
        min-width: 18px;
        height: 16px;
    }
    .ts-codex-actions .ts-shooting-btn-primary {
        font-size: 14px;
        padding: 10px 22px;
    }
    .ts-codex-detail {
        padding: 10px;
        justify-content: flex-start;
        gap: 12px;
    }
    .ts-codex-detail-inner {
        flex-direction: column;
        gap: 10px;
        padding: 14px 16px;
        box-shadow: 3px 3px 0 var(--tss-ink);
    }
    .ts-codex-detail-art {
        flex: 0 0 110px;
        height: 110px;
        align-self: center;
        width: 110px;
    }
    /* detail-img は PC 定義の width:92%; height:92% を SP でもそのまま継承（小さく中央に） */
    .ts-codex-detail-role {
        font-size: 10px;
    }
    .ts-codex-detail-name {
        font-size: 16px;
        margin-bottom: 4px;
    }
    .ts-codex-detail-stats {
        font-size: 11px;
        padding: 6px 8px;
    }
    .ts-codex-detail-row dt {
        flex: 0 0 52px;
    }
    .ts-codex-detail-flavor {
        font-size: 12px;
        line-height: 1.6;
    }
    #ts-codex-detail-close {
        align-self: center;
        font-size: 14px;
        padding: 10px 22px;
    }

    /* === コーチ（アド・フォーク）ダイアログ === */
    .ts-shooting-coach {
        flex-direction: column;
        padding: 10px;
        gap: 8px;
        left: 8px;
        right: 8px;
        bottom: 8px;
    }
    .ts-coach-portrait {
        flex: 0 0 60px;
        height: 60px;
        align-self: flex-start;
    }
    .ts-coach-name {
        font-size: 11px;
    }
    .ts-coach-text {
        font-size: 12px;
        line-height: 1.55;
    }
    .ts-coach-hint {
        font-size: 9px;
    }
    .ts-coach-next {
        font-size: 12px;
        padding: 6px 12px;
        align-self: flex-end;
    }

    /* === 技変更（equip） === */
    .ts-shooting-equip-screen {
        padding: 14px 12px 12px;
        min-height: 100vh;
        min-height: 100svh;
        max-height: 100vh;
        max-height: 100svh;
        overflow-y: auto;
        box-sizing: border-box;
    }
    .ts-equip-header {
        margin-bottom: 14px;
    }
    .ts-equip-title {
        font-size: 18px;
        padding: 4px 14px;
        box-shadow: 2px 2px 0 var(--tss-ink);
    }
    .ts-equip-sub {
        font-size: 11px;
        margin-top: 4px;
    }
    .ts-equip-grid {
        gap: 10px;
        margin: 0 auto 14px;
    }
    .ts-equip-card {
        padding: 12px 14px 10px;
        box-shadow: 3px 3px 0 var(--tss-ink);
    }
    .ts-equip-card:focus,
    .ts-equip-card:focus-visible {
        transform: translate(-2px, -2px);
        box-shadow: 5px 5px 0 var(--tss-ink), inset 0 0 0 3px #ffd35a;
    }
    .ts-equip-card[aria-pressed="true"]:focus,
    .ts-equip-card[aria-pressed="true"]:focus-visible {
        box-shadow: 5px 5px 0 var(--tss-ink), inset 0 0 0 3px #ffd35a;
    }
    .ts-equip-card-name {
        font-size: 16px;
        margin-bottom: 6px;
    }
    .ts-equip-card-desc {
        font-size: 11px;
        line-height: 1.55;
    }
    .ts-equip-card[aria-pressed="true"]::after {
        font-size: 10px;
        padding: 3px 8px;
        margin-top: 8px;
    }

    /* === タッチコントローラ：スティック右配置（is-mirror）時、
       左側に来るボタン群の中で「反魂→オート」の順に並べ替える
       （反魂は主操作なので親指の届きやすい外側に配置） === */
    .ts-shooting-touch-controller.is-mirror .ts-shooting-touch-right {
        flex-direction: row-reverse;
    }

    /* === ステージHUD：PC では横並びだが、スマホでは縦に積まないと
       rules バー（操作ヒント）が見切れて「クティ」「反魂」のラベルしか見えない === */
    .ts-shooting-hud {
        flex-direction: column;
        align-items: stretch;
        padding: 6px 8px 8px;
        gap: 4px;
    }
    .ts-shooting-rules {
        font-size: 11px;
        margin-top: 0;
        text-align: center;
        line-height: 1.5;
    }
    .ts-shooting-audio {
        gap: 6px;
        flex-wrap: wrap;
        justify-content: center;
        font-size: 10px;
    }
    /* HUD audio ボタン：スマホでは記号化して 44x44 の正方形タイルに（WCAG タッチターゲット推奨）。
       textContent は PC 用にそのまま残し（font-size:0 で見えなく）、
       SP では ::before / ::after で記号＋状態（ON/OFF）を表示する */
    .ts-shooting-audio-btn {
        font-size: 0;
        min-width: 0;
        width: 44px;
        height: 44px;
        padding: 0;
        min-height: 44px;
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        line-height: 1;
        gap: 1px;
    }
    /* オート浄化：「オート」+「ON/OFF」の2行 */
    #ts-shooting-auto-fire::before {
        content: 'オート';
        font-size: 9px;
        font-weight: 700;
        letter-spacing: 0;
    }
    #ts-shooting-auto-fire[aria-pressed="true"]::after {
        content: 'ON';
        font-size: 10px;
        font-weight: 800;
    }
    #ts-shooting-auto-fire[aria-pressed="false"]::after {
        content: 'OFF';
        font-size: 10px;
        font-weight: 800;
    }
    /* 一時停止：プレイ中は「||」、 一時停止中は「▶」 */
    #ts-shooting-pause::before {
        content: '| |';
        font-size: 18px;
        font-weight: 800;
        letter-spacing: -1px;
    }
    #ts-shooting-pause[aria-pressed="true"]::before {
        content: '▶';
        font-size: 16px;
        letter-spacing: 0;
    }
    /* 解説：「?」 */
    #ts-shooting-howto-ingame::before {
        content: '?';
        font-size: 20px;
        font-weight: 800;
        font-family: serif;
    }
    /* BGM/SE 統合トグル：オンは「♪」、 オフは薄い「♪」 */
    #ts-shooting-bgm-toggle::before {
        content: '♪';
        font-size: 22px;
    }
    #ts-shooting-bgm-toggle[aria-pressed="false"]::before {
        opacity: 0.4;
    }
    /* スライダーラベルとつまみを縮小して1行に収める */
    .ts-shooting-audio-slider {
        font-size: 9px;
        gap: 4px;
    }
    .ts-shooting-audio-slider input[type="range"] {
        width: 48px;
    }
}
