html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100vw;
    background: #000;
    color: #fff;
    font-family: 'Noto Serif JP', 'Yuji Syuku', serif;
    overflow: hidden;
    font-weight: 400;
    letter-spacing: 0.02em;
}

/* スマホブラウザ対応：動的ビューポート高度 */
:root {
    --vh: 1vh;
}

.title-bg-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(var(--vh, 1vh) * 100);
    z-index: 0;
    object-fit: cover;
    background: #000;
    pointer-events: none;
    transition: opacity 1.5s;
}

.title-bg-video.hide {
    opacity: 0;
    pointer-events: none;
}

.title-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(var(--vh, 1vh) * 100);
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0,0,0,0.18);
    transition: opacity 1.5s;
}

.title-screen.hide {
    opacity: 0;
    pointer-events: none;
}

.loading-container {
    text-align: center;
    background: rgba(0,0,0,0.4);
    border-radius: 18px;
    padding: 2.5rem 2.5rem 2.3rem 2.5rem;
    box-shadow: 0 8px 48px 0 rgba(99,102,241,0.16);
    min-width: 260px;
    max-width: 96vw;
    margin: 0 auto;
    position: relative;
    z-index: 12;
}

.loading-bar-outer {
    width: 240px;
    background: rgba(255,255,255,0.10);
    border-radius: 8px;
    margin: 0 auto;
    height: 18px;
    overflow: hidden;
    box-shadow: 0 2px 12px 0 rgba(99,102,241,0.18);
    margin-bottom: 1.7rem;
}

.loading-bar-inner {
    background: linear-gradient(90deg,#6366F1 0%,#a5b4fc 100%);
    height: 100%;
    width: 0%;
    border-radius: 8px;
    transition: width 0.2s;
    box-shadow: 0 0 10px #6366F1;
}

.loading-text {
    font-size: 1.18rem;
    color: rgba(255,255,255,0.82);
    letter-spacing: 0.02em;
    font-family: 'Yuji Syuku', serif;
    text-shadow: 0 0 8px #6366F1, 0 1px 2px #000;
}

/* 英語切替ボタン */
.language-button {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: rgba(0,0,0,0.7);
    border: 1px solid #6366F1;
    border-radius: 5px;
    padding: 5px 10px;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    z-index: 30;
    text-decoration: none;
    transition: all 0.3s;
}

.language-button:hover {
    background-color: rgba(99,102,241,0.5);
}

/* ========== タッチ対策強化 ========== */
.novel-container {
    width: 100vw;
    height: calc(var(--vh, 1vh) * 100);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(var(--vh, 1vh) * 100);
    z-index: 1;
    opacity: 0;
    transition: opacity 1.5s;
    pointer-events: none;
}

.background video {
    width: 100vw;
    height: calc(var(--vh, 1vh) * 100);
    object-fit: cover;
    background: #111;
}

.background.active {
    opacity: 1;
    pointer-events: auto;
}

/* ========== 縦書きテキストコンテナ（完全右寄せ版・フォントサイズ動的制御対応） ========== */
.text-container {
    position: fixed;
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    width: 96vw;
    max-width: 750px;
    height: 75vh;
    min-height: 280px;
    max-height: 82vh;
    padding: 1.5em 1.5em 1.5em 1em;
    z-index: 10;
    overflow-y: hidden;
    overflow-x: auto;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    justify-content: flex-start;
    /* ❌ font-size固定値を削除 - JavaScriptで動的制御 */
    line-height: 1.5;
    transition: all 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    /* 完全透明 */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    outline: none !important;
    /* テキスト選択無効化 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    /* 横スクロールバー完全非表示 */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* 横スクロールバー完全非表示 */
.text-container::-webkit-scrollbar {
    display: none;
}

.text-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.text-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    justify-content: flex-start;
    /* 完全透明 */
    background: transparent !important;
    border: none !important;
    outline: none !important;
}

/* ========== 縦書き段落スタイル（行間改善版・フォントサイズ動的制御対応） ========== */
.text-paragraph {
    /* 縦書き設定 */
    writing-mode: vertical-rl;
    text-orientation: upright;
    /* 基本設定 */
    margin-right: 3.5em;
    margin-left: 0;
    margin-top: 0;
    margin-bottom: 0;
    height: 100%;
    width: auto;
    min-width: 60px;
    max-width: 100px;
    /* ❌ font-size固定値を削除 - JavaScriptで動的制御 */
    line-height: 1.5 !important;
    opacity: 1;
    transition: all 0.5s ease-out;
    flex-shrink: 0;
    flex-grow: 0;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    /* 超強力なテキストシャドウ */
    text-shadow:
        4px 4px 8px rgba(0,0,0,1),
        -4px 4px 8px rgba(0,0,0,1),
        4px -4px 8px rgba(0,0,0,1),
        -4px -4px 8px rgba(0,0,0,1),
        3px 3px 6px rgba(0,0,0,0.98),
        -3px 3px 6px rgba(0,0,0,0.98),
        3px -3px 6px rgba(0,0,0,0.98),
        -3px -3px 6px rgba(0,0,0,0.98),
        2px 2px 4px rgba(0,0,0,0.95),
        -2px 2px 4px rgba(0,0,0,0.95),
        2px -2px 4px rgba(0,0,0,0.95),
        -2px -2px 4px rgba(0,0,0,0.95),
        0 0 15px rgba(0,0,0,0.9),
        0 0 25px rgba(0,0,0,0.8),
        0 0 35px rgba(0,0,0,0.6);
    /* テキスト選択無効化 */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    word-break: keep-all;
    white-space: pre-wrap;
    padding: 0 !important;
    overflow-wrap: break-word;
}

/* ========== 【バックアップ】旧lines指定システム（行間改善版） ========== */
/*
.text-paragraph.lines-2 {
    margin-right: 2.5em !important;
    min-width: 55px;
    max-width: 90px;
    line-height: 1.45 !important;
}

.text-paragraph.lines-4 {
    margin-right: 4.5em !important;
    min-width: 75px;
    max-width: 120px;
    line-height: 1.55 !important;
}
*/

/* ========== 【新版】縦書き専用lines指定システム（列間隔制御版） ========== */
.text-paragraph.lines-1 {
    margin-right: 1.8em !important;
    min-width: 45px;
    max-width: 75px;
    line-height: 1.4 !important;
}

.text-paragraph.lines-2 {
    margin-right: 2.5em !important;
    min-width: 55px;
    max-width: 90px;
    line-height: 1.45 !important;
}

.text-paragraph.lines-3 {
    margin-right: 3.5em !important;
    min-width: 65px;
    max-width: 105px;
    line-height: 1.5 !important;
}

.text-paragraph.lines-4 {
    margin-right: 4.5em !important;
    min-width: 75px;
    max-width: 120px;
    line-height: 1.55 !important;
}

.text-paragraph.title-text {
    margin-right: 1.8em !important;
    min-width: 80px;
    max-width: 150px;
    /* ❌ font-size固定値を削除 - JavaScriptで動的制御 */
    line-height: 1.5 !important;
}

/* ========== キャラクター名ゴールド ========== */
.character-name {
    font-weight: bold;
    color: #FFD700 !important;
    margin-bottom: 0.3em;
    display: block;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    text-shadow:
        0 0 8px rgba(255,215,0,0.4),
        0 0 12px rgba(255,215,0,0.3),
        0 0 16px rgba(255,215,0,0.2),
        4px 4px 8px rgba(0,0,0,1),
        -4px 4px 8px rgba(0,0,0,1),
        4px -4px 8px rgba(0,0,0,1),
        -4px -4px 8px rgba(0,0,0,1),
        3px 3px 6px rgba(0,0,0,0.98),
        2px 2px 4px rgba(0,0,0,0.98),
        1px 1px 2px rgba(0,0,0,0.99);
}

@keyframes fadeIn {
    from {opacity:0;}
    to {opacity:1;}
}

.emphasis {
    color: #ffcc00 !important;
    font-weight: bold;
    font-size: 1.3em;
    letter-spacing: 0.08em;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    text-shadow:
        0 0 25px rgba(255,204,0,0.9),
        0 0 35px rgba(255,204,0,0.8),
        0 0 45px rgba(255,204,0,0.6),
        5px 5px 10px rgba(0,0,0,1),
        -5px 5px 10px rgba(0,0,0,1),
        5px -5px 10px rgba(0,0,0,1),
        -5px -5px 10px rgba(0,0,0,1),
        4px 4px 8px rgba(0,0,0,0.98),
        3px 3px 6px rgba(0,0,0,0.95),
        2px 2px 4px rgba(0,0,0,0.98),
        1px 1px 2px rgba(0,0,0,0.99);
    margin-bottom: 0.8em;
    display: block;
}

.effect {
    position: fixed;
    pointer-events: none;
    z-index: 100;
}

.blue-aura {
    border-radius: 50%;
    background: radial-gradient(circle,rgba(32,156,255,0.9) 0%,rgba(32,156,255,0.2) 60%,rgba(32,156,255,0) 100%);
    box-shadow: 0 0 30px rgba(32,156,255,0.8);
    animation: pulse 1s ease-out forwards;
}

.red-aura {
    border-radius: 50%;
    background: radial-gradient(circle,rgba(255, 32, 32, 0.9) 0%,rgba(255,32,32,0.2) 60%,rgba(255,32,32,0) 100%);
    box-shadow: 0 0 30px rgba(255,32,32,0.8);
    animation: pulse 1s ease-out forwards;
}

.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    pointer-events: none;
    animation: particleAnim var(--duration,1s) cubic-bezier(0.165,0.84,0.44,1) forwards;
    opacity: 0.92;
    z-index: 101;
}

@keyframes particleAnim {
    0% { transform: translate(0,0) scale(1) rotate(0deg); opacity: 1;}
    40% { opacity: 0.8;}
    80% { opacity: 0.5; transform: translate(calc(var(--x) * 0.8), calc(var(--y) * 0.8)) scale(0.5) rotate(calc(var(--r) * 0.8));}
    100% { transform: translate(var(--x), var(--y)) scale(0) rotate(var(--r)); opacity: 0;}
}

@keyframes pulse {
    0% { transform: scale(0.1); opacity: 0;}
    50% { transform: scale(1.2); opacity: 0.8;}
    100% { transform: scale(2.5); opacity: 0;}
}

#click-prompt {
    position: absolute;
    bottom: 15px;
    right: 20px;
    color: rgba(255,255,255,0.7);
    animation: blink 1.5s infinite;
    font-size: 0.9rem;
    z-index: 20;
}

@keyframes blink {
    0%,100% {opacity: 0.3;}
    50% {opacity: 1;}
}

/* シンプル化されたコントロール配置 */
.controls {
    position: fixed;
    bottom: 18px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 20;
}

.control-button {
    width: 40px;
    height: 40px;
    background-color: rgba(0,0,0,0.7);
    border: 1px solid #6366F1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    font-size: 20px;
    transition: background-color 0.3s;
}

.control-button:hover {
    background-color: rgba(99,102,241,0.3);
}

.control-button.active {
    background-color: rgba(99,102,241,0.5);
}

/* 巻き戻しボタンのスタイル */
.back-button {
    border-color: #ff6b6b;
}

.back-button:hover {
    background-color: rgba(255,107,107,0.3);
}

/* 早送りボタンのスタイル */
.forward-button {
    border-color: #10b981;
}

.forward-button:hover {
    background-color: rgba(16,185,129,0.3);
}

.copyright-notice {
    position: fixed;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    font-weight: 300;
    letter-spacing: 0.5px;
    z-index: 5;
    pointer-events: none;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
    transition: opacity 0.3s ease;
}

.copyright-notice:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* ========== 控えめで美しいエンディングダイアログ ========== */
.ending-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.1);
    z-index: 200;
    display: flex;
    justify-content: flex-end;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 2s ease-out;
    backdrop-filter: blur(1px);
    pointer-events: none;
}

.ending-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.ending-dialog {
    position: relative;
    background: linear-gradient(135deg, rgba(0,0,0,0.85) 0%, rgba(30,30,30,0.90) 100%);
    border: 1px solid rgba(99,102,241,0.6);
    border-radius: 12px;
    padding: 20px 25px;
    max-width: 280px;
    margin: 0 20px 80px 0;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 20px rgba(99,102,241,0.1);
    transform: translateY(30px) scale(0.95);
    transition: all 1.5s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.ending-dialog.active {
    transform: translateY(0) scale(1);
}

.ending-glow {
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    background: linear-gradient(45deg, rgba(99,102,241,0.3), rgba(165,180,252,0.2), rgba(99,102,241,0.3));
    border-radius: 15px;
    opacity: 0.5;
    z-index: -1;
    animation: endingGlow 4s ease-in-out infinite alternate;
}

@keyframes endingGlow {
    0% { opacity: 0.3; transform: scale(1); }
    100% { opacity: 0.6; transform: scale(1.01); }
}

.ending-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #FFD700;
    margin-bottom: 12px;
    text-shadow:
        0 0 15px rgba(255,215,0,0.5),
        1px 1px 3px rgba(0,0,0,0.8);
    animation: titlePulse 3s ease-in-out infinite alternate;
}

@keyframes titlePulse {
    0% { text-shadow: 0 0 15px rgba(255,215,0,0.5), 1px 1px 3px rgba(0,0,0,0.8); }
    100% { text-shadow: 0 0 25px rgba(255,215,0,0.7), 1px 1px 3px rgba(0,0,0,0.8); }
}

.ending-message {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    line-height: 1.4;
    margin-bottom: 16px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

.ending-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.ending-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 120px;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.ending-btn-primary {
    background: linear-gradient(135deg, #6366F1 0%, #a5b4fc 100%);
    color: white;
    border: 1px solid transparent;
}

.ending-btn-primary:hover {
    background: linear-gradient(135deg, #5048e5 0%, #9ca3f3 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

.ending-btn-secondary {
    background: transparent;
    color: #6366F1;
    border: 1px solid #6366F1;
}

.ending-btn-secondary:hover {
    background: rgba(99,102,241,0.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.2);
}

/* フェードアウトアニメーション */
@keyframes fadeOut {
    to { opacity: 0; transform: scale(0.95); }
}

@keyframes fadeToWhite {
    0% { background: rgba(0,0,0,0.1); }
    50% { background: rgba(255,255,255,0.3); }
    100% { background: rgba(255,255,255,1); }
}

.audio-notice {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    border: 2px solid #6366F1;
    border-radius: 12px;
    padding: 20px 30px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    box-shadow: 0 8px 32px rgba(99,102,241,0.3);
    animation: audioNoticePulse 2s infinite;
}

.audio-notice-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.audio-notice i {
    font-size: 1.5rem;
    color: #6366F1;
}

@keyframes audioNoticePulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ========== 音声切り替えプロンプトシステム（新規追加） ========== */
.audio-switch-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.7);
    background: linear-gradient(135deg, rgba(0,0,0,0.95) 0%, rgba(20,20,40,0.95) 100%);
    border: 2px solid transparent;
    border-radius: 25px;
    padding: 30px 40px;
    z-index: 180;
    cursor: pointer;
    opacity: 0;
    transition: all 0.7s cubic-bezier(0.4, 0.0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 20px 60px rgba(99,102,241,0.3),
        0 0 80px rgba(99,102,241,0.2),
        inset 0 1px 0 rgba(255,255,255,0.1);
}

.audio-switch-prompt.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.audio-switch-prompt.fade-out {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
}

.prompt-bg-glow {
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, #6366F1, #a5b4fc, #6366F1);
    border-radius: 30px;
    opacity: 0.3;
    z-index: -1;
    animation: promBgGlow 3s ease-in-out infinite alternate;
}

@keyframes promBgGlow {
    0% { opacity: 0.2; transform: scale(1); }
    100% { opacity: 0.4; transform: scale(1.02); }
}

.prompt-border-glow {
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, 
        transparent, #6366F1, transparent, #a5b4fc, 
        transparent, #6366F1, transparent);
    border-radius: 27px;
    z-index: -1;
    animation: borderRotate 4s linear infinite;
}

@keyframes borderRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.prompt-content {
    text-align: center;
    color: white;
    position: relative;
    z-index: 1;
}

.prompt-icon-container {
    position: relative;
    display: inline-block;
    margin-bottom: 15px;
}

.prompt-icon {
    font-size: 3rem;
    display: block;
    animation: musicFloat 2s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 20px #6366F1);
}

@keyframes musicFloat {
    0% { transform: translateY(0px) rotate(-5deg); }
    100% { transform: translateY(-8px) rotate(5deg); }
}

.prompt-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    border: 3px solid #6366F1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: musicPulse 2s ease-out infinite;
}

@keyframes musicPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

.prompt-text {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(45deg, #FFD700, #FFA500);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(255,215,0,0.5);
    animation: textShimmer 3s ease-in-out infinite alternate;
}

@keyframes textShimmer {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.2); }
}

.prompt-sub {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.8);
    margin-bottom: 20px;
    animation: subTextPulse 2s ease-in-out infinite alternate;
}

@keyframes subTextPulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

.prompt-touch-indicator {
    position: relative;
    width: 60px;
    height: 60px;
    margin: 0 auto;
    border: 2px solid rgba(99,102,241,0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-touch-indicator::before {
    content: '👆';
    font-size: 1.5rem;
    animation: pointFinger 1.5s ease-in-out infinite;
}

@keyframes pointFinger {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.touch-ripple {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    border: 2px solid #6366F1;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: touchRipple 2s ease-out infinite;
}

@keyframes touchRipple {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(2);
        opacity: 0;
    }
}

.audio-switch-particle {
    position: fixed;
    font-size: 1.5rem;
    color: #6366F1;
    pointer-events: none;
    z-index: 175;
    opacity: 0;
    transition: all 3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    filter: drop-shadow(0 0 10px #6366F1);
}

.audio-switch-particle.animate {
    opacity: 1;
    transform: translate(
        calc(var(--end-x) - var(--start-x, 0px)), 
        calc(var(--end-y) - var(--start-y, 0px))
    ) rotate(720deg);
}

.audio-switch-particle.fade-out {
    opacity: 0;
    transform: scale(0);
}

.touch-explosion {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #FFD700;
    border-radius: 50%;
    pointer-events: none;
    z-index: 190;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px #FFD700;
    animation: explosionCore 1s ease-out forwards;
}

@keyframes explosionCore {
    0% { 
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(3);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(5);
        opacity: 0;
    }
}

.explosion-fragment {
    position: fixed;
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 185;
    transform: translate(-50%, -50%);
    opacity: 1;
    transition: none;
}

.explosion-fragment.explode {
    transform: translate(
        calc(-50% + var(--end-x)), 
        calc(-50% + var(--end-y))
    ) rotate(360deg) scale(0);
    opacity: 0;
    transition: all 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ========== 縦幅狭いブラウザ専用調整 ========== */
@media (max-height: 600px) {
    .text-container {
        right: 1vw !important;
        width: 98vw !important;
        padding: 1.2em 1em 1.2em 0.5em !important;
    }
}

/* ========== タブレット用行間調整（フォントサイズ動的制御対応） ========== */
@media (max-width: 768px) {
    .text-container {
        right: 2vw;
        width: 95vw;
        height: 72vh !important;
        min-height: 260px !important;
        /* ❌ font-size固定値を削除 - JavaScriptで動的制御 */
        line-height: 1.5 !important;
        padding: 1.5em 1.2em 1.5em 1em !important;
    }

    .text-paragraph {
        /* ❌ font-size固定値を削除 - JavaScriptで動的制御 */
        line-height: 1.5 !important;
        margin-right: 3em !important;
        min-width: 55px !important;
        max-width: 95px !important;
    }

    /* 【バックアップ】タブレット旧版 */
    /* .text-paragraph.lines-2 { margin-right: 2.2em !important; line-height: 1.45 !important; } */
    /* .text-paragraph.lines-4 { margin-right: 3.8em !important; line-height: 1.55 !important; } */
    
    /* 【新版】タブレット用縦書きlines設定 */
    .text-paragraph.lines-1 {
        margin-right: 1.5em !important;
        line-height: 1.4 !important;
    }

    .text-paragraph.lines-2 {
        margin-right: 2.2em !important;
        line-height: 1.45 !important;
    }

    .text-paragraph.lines-3 {
        margin-right: 3.0em !important;
        line-height: 1.5 !important;
    }

    .text-paragraph.lines-4 {
        margin-right: 3.8em !important;
        line-height: 1.55 !important;
    }

    .text-paragraph.title-text {
        margin-right: 1.5em !important;
        line-height: 1.5 !important;
    }

    .audio-switch-prompt {
        padding: 25px 30px;
        margin: 0 20px;
        max-width: calc(100vw - 40px);
    }
    
    .prompt-icon {
        font-size: 2.5rem;
    }
    
    .prompt-text {
        font-size: 1.1rem;
    }
    
    .prompt-sub {
        font-size: 0.85rem;
    }
    
    .prompt-touch-indicator {
        width: 50px;
        height: 50px;
    }
}

/* ========== スマホ用行間調整（フォントサイズ動的制御対応） ========== */
@media (max-width: 600px) {
    .text-container {
        right: 1.5vw;
        width: 96vw;
        /* ❌ font-size固定値を削除 - JavaScriptで動的制御 */
        padding: 1.2em 1em 1.2em 0.5em !important;
        height: 78vh !important;
        min-height: 300px !important;
        line-height: 1.45 !important;
    }
    
    /* 縦幅狭いスマホの追加調整 */
    @media (max-height: 650px) {
        .text-container {
            right: 0.5vw !important;
            width: 98.5vw !important;
        }
    }

    .text-paragraph {
        /* ❌ font-size固定値を削除 - JavaScriptで動的制御 */
        line-height: 1.45 !important;
        margin-right: 2.8em !important;
        min-width: 45px !important;
        max-width: 85px !important;
    }

    /* 【バックアップ】スマホ旧版 */
    /* .text-paragraph.lines-2 { margin-right: 2em !important; line-height: 1.4 !important; } */
    /* .text-paragraph.lines-4 { margin-right: 3.5em !important; max-width: 100px; line-height: 1.5 !important; } */
    
    /* 【新版】スマホ用縦書きlines設定 */
    .text-paragraph.lines-1 {
        margin-right: 1.3em !important;
        line-height: 1.35 !important;
    }

    .text-paragraph.lines-2 {
        margin-right: 2em !important;
        line-height: 1.4 !important;
    }

    .text-paragraph.lines-3 {
        margin-right: 2.8em !important;
        line-height: 1.45 !important;
    }

    .text-paragraph.lines-4 {
        margin-right: 3.5em !important;
        max-width: 100px;
        line-height: 1.5 !important;
    }

    .text-paragraph.title-text {
        margin-right: 1.2em !important;
        max-width: 110px;
        line-height: 1.45 !important;
    }

    .copyright-notice {
        font-size: 0.7rem;
        bottom: 6px;
    }

    .controls {
        left: 15px;
        gap: 8px;
    }

    .control-button {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    /* エンディングダイアログのモバイル対応 */
    .ending-overlay {
        justify-content: center;
        align-items: center;
    }

    .ending-dialog {
        margin: 20px;
        max-width: 90vw;
    }

    .ending-title {
        font-size: 1rem;
    }

    .ending-message {
        font-size: 0.8rem;
    }

    .ending-btn {
        min-width: 140px;
        font-size: 0.75rem;
    }
}

/* ========== 極小スマホ用行間調整（フォントサイズ動的制御対応） ========== */
@media (max-width: 480px) {
    .text-container {
        right: 0.5vw;
        width: 98vw;
        height: 80vh !important;
        min-height: 320px !important;
        padding: 1.2em 0.8em 1.2em 0.3em !important;
    }
    
    /* 極小で縦幅狭い場合の追加調整 */
    @media (max-height: 600px) {
        .text-container {
            right: 0.2vw !important;
            width: 99vw !important;
        }
    }

    .text-paragraph {
        margin-right: 2.5em !important;
        min-width: 40px !important;
        max-width: 75px !important;
        /* ❌ font-size固定値を削除 - JavaScriptで動的制御 */
        line-height: 1.45 !important;
    }

    /* 【バックアップ】極小スマホ旧版 */
    /* .text-paragraph.lines-2 { margin-right: 1.8em !important; line-height: 1.4 !important; } */
    /* .text-paragraph.lines-4 { margin-right: 3em !important; line-height: 1.5 !important; } */
    
    /* 【新版】極小スマホ用縦書きlines設定 */
    .text-paragraph.lines-1 {
        margin-right: 1.2em !important;
        line-height: 1.35 !important;
    }

    .text-paragraph.lines-2 {
        margin-right: 1.8em !important;
        line-height: 1.4 !important;
    }

    .text-paragraph.lines-3 {
        margin-right: 2.4em !important;
        line-height: 1.45 !important;
    }

    .text-paragraph.lines-4 {
        margin-right: 3em !important;
        line-height: 1.5 !important;
    }

    .text-paragraph.title-text {
        margin-right: 1em !important;
        line-height: 1.45 !important;
    }
}