html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100vw;
    background: #000;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-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;
}

/* ========== Enhanced Loading Text with Helvetica ========== */
.loading-text {
    font-size: 1.18rem;
    color: rgba(255,255,255,0.82);
    letter-spacing: 0.02em;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, 'Segoe UI', sans-serif;
    font-weight: 400;
    text-shadow: 0 0 8px #6366F1, 0 1px 2px #000;
    line-height: 1.4;
}

/* Japanese Version Switch Button */
.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;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 500;
}

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

/* ========== Enhanced Touch Controls ========== */
.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;
}

/* ========== 🌟 Perfect Text Container with Enhanced Space Handling 🌟 ========== */
.text-container {
    position: fixed;
    left: 50%;
    top: 42%;
    transform: translate(-50%, -50%);
    justify-content: center;
    width: 88vw;
    max-width: 700px;
    height: 28vh;
    min-height: 110px;
    max-height: 38vh;
    padding: 1.0em 1.5em;
    z-index: 10;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    font-size: 30px;
    line-height: 1.65;
    transition: all 0.8s cubic-bezier(0.4, 0.0, 0.2, 1);
    
    /* Complete transparency */
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    
    /* Text selection prevention */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Enhanced scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: rgba(99,102,241,0.3) transparent;
}

/* Enhanced scrollbar webkit styling */
.text-container::-webkit-scrollbar {
    width: 6px;
}

.text-container::-webkit-scrollbar-track {
    background: transparent;
}

.text-container::-webkit-scrollbar-thumb {
    background: rgba(99,102,241,0.3);
    border-radius: 3px;
}

.text-container::-webkit-scrollbar-thumb:hover {
    background: rgba(99,102,241,0.5);
}

/* ========== Perfect 3-Level Position Control System ========== */
.text-container.text-position-top {
    top: 15vh !important;
    transform: translate(-50%, 0) !important;
    justify-content: flex-start !important;
}

.text-container.text-position-center {
    top: 42% !important;
    transform: translate(-50%, -50%) !important;
    justify-content: center !important;
}

.text-container.text-position-bottom {
    top: auto !important;
    bottom: 22vh !important;
    transform: translate(-50%, 0) !important;
    justify-content: flex-end !important;
}

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

.text-content {
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ========== 🚨 PERFECT: Ultimate Text Rendering with Perfect Spacing ========== */
.text-paragraph {
    margin-bottom: 1.3em;
    opacity: 0;
    animation: fadeIn 0.5s forwards;
    width: 100%;
    word-break: break-word;
    
    /* ===== CRITICAL: Perfect English-Japanese Spacing System ===== */
    white-space: pre-wrap;
    word-spacing: 0.05em;         /* Perfect English word spacing */
    letter-spacing: 0;
    
    /* Enhanced text rendering for perfect cross-language support */
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* ===== UNIFIED: Perfect Font Family for English-Japanese ===== */
    font-family: 
        /* Primary: Helvetica family for English perfection */
        -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial,
        /* Fallback: Japanese fonts */
        'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo',
        /* Final fallback */
        sans-serif;
    
    /* Ultra-powerful text shadow for maximum readability */
    text-shadow: 
        /* Outer strong black outline */
        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),
        /* Mid-layer shadows */
        4px 4px 8px rgba(0,0,0,0.98),
        -4px -4px 8px rgba(0,0,0,0.98),
        4px -4px 8px rgba(0,0,0,0.98),
        -4px 4px 8px rgba(0,0,0,0.98),
        /* Inner fine shadows */
        3px 3px 6px rgba(0,0,0,0.95),
        -3px -3px 6px rgba(0,0,0,0.95),
        3px -3px 6px rgba(0,0,0,0.95),
        -3px 3px 6px rgba(0,0,0,0.95),
        /* Outermost blur */
        0 0 18px rgba(0,0,0,0.9),
        0 0 28px rgba(0,0,0,0.8),
        0 0 38px rgba(0,0,0,0.6);
        
    /* Text selection prevention */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* ===== PERFECT: Typewriter Text Rendering ===== */
.typewriter-text {
    display: inline;
    white-space: pre-wrap;
    word-spacing: 0.05em;         /* Perfect English word spacing */
    letter-spacing: 0;
    font-family: inherit;
}

/* ===== Enhanced Character Name with Perfect Font ===== */
.character-name {
    font-weight: bold;
    color: #FFD700 !important;
    margin-right: 0.3em;
    
    /* Perfect unified font for character names */
    font-family: 
        -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial,
        'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo',
        sans-serif;
    
    /* Enhanced gold shadow */
    text-shadow: 
        /* Gold glow effect */
        0 0 10px rgba(255,215,0,0.5),
        0 0 15px rgba(255,215,0,0.4),
        0 0 20px rgba(255,215,0,0.3),
        /* Black outline (main) */
        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),
        /* Additional black shadows */
        4px 4px 8px rgba(0,0,0,0.98),
        3px 3px 6px rgba(0,0,0,0.98),
        2px 2px 4px rgba(0,0,0,0.99);
}

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

.emphasis {
    color: #ffcc00 !important;
    font-weight: bold;
    font-size: 1.2em;
    letter-spacing: 0.08em;
    
    /* Perfect unified font for emphasis */
    font-family: 
        -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial,
        'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo',
        sans-serif;
    
    /* Ultra-powerful emphasis shadow */
    text-shadow:
        /* Golden glow */
        0 0 30px rgba(255,204,0,0.9),
        0 0 40px rgba(255,204,0,0.8),
        0 0 50px rgba(255,204,0,0.6),
        /* Powerful black outline */
        6px 6px 12px rgba(0,0,0,1),
        -6px -6px 12px rgba(0,0,0,1),
        6px -6px 12px rgba(0,0,0,1),
        -6px 6px 12px rgba(0,0,0,1),
        /* Additional black shadow layers */
        5px 5px 10px rgba(0,0,0,0.98),
        4px 4px 8px rgba(0,0,0,0.95),
        3px 3px 6px rgba(0,0,0,0.98),
        2px 2px 4px rgba(0,0,0,0.99);
        
    text-transform: uppercase;
    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;}
}

/* Enhanced Control Layout */
.controls {
    position: fixed;
    bottom: 18px;
    left: 20px;
    display: flex;
    gap: 10px;
    z-index: 20;
}

.control-button {
    width: 42px;
    height: 42px;
    background-color: rgba(0,0,0,0.75);
    border: 1px solid #6366F1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    font-size: 21px;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}

.control-button:hover {
    background-color: rgba(99,102,241,0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.control-button.active {
    background-color: rgba(99,102,241,0.6);
    box-shadow: 0 4px 12px rgba(99,102,241,0.4);
}

/* Enhanced Scene Navigation Buttons */
.back-button {
    border-color: #ff6b6b;
}

.back-button:hover {
    background-color: rgba(255,107,107,0.3);
    box-shadow: 0 4px 12px rgba(255,107,107,0.3);
}

.forward-button {
    border-color: #10b981;
}

.forward-button:hover {
    background-color: rgba(16,185,129,0.3);
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.settings-button {
    position: fixed;
    top: 18px;
    right: 18px;
    width: 40px;
    height: 40px;
    background-color: rgba(0,0,0,0.8);
    border: 1px solid #6366F1;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: white;
    font-size: 20px;
    z-index: 40;
    transition: background-color 0.3s;
}

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

.settings-panel {
    position: fixed;
    top: 65px;
    right: 18px;
    background-color: rgba(0,0,0,0.92);
    border: 1px solid #6366F1;
    border-radius: 8px;
    padding: 15px;
    z-index: 50;
    min-width: 220px;
    display: none;
}

.settings-panel.active {
    display: block;
}

.settings-title {
    font-size: 1em;
    margin-bottom: 10px;
    color: #fff;
    text-align: center;
    border-bottom: 1px solid rgba(99,102,241,0.5);
    padding-bottom: 5px;
}

.setting-group {
    margin-bottom: 15px;
}

.setting-label {
    display: block;
    margin-bottom: 5px;
    color: #fff;
    font-size: 0.9em;
}

.range-with-value {
    display: flex;
    align-items: center;
}

.setting-range {
    flex-grow: 1;
    margin-right: 10px;
}

.setting-value {
    width: 60px;
    text-align: right;
    color: #6366F1;
}

.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);
}

/* ========== Enhanced Subtle Ending Dialog ========== */
.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);
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.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);
}

/* Fade-out animations */
@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;
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
}

.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 System ========== */
.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);
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

.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);
}

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

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

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

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

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

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

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

@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);
}

/* ========== 🌟 Mobile Perfect Responsive Design 🌟 ========== */
@media (max-width: 600px) {
    .text-container {
        font-size: 27px;
        padding: 1.0em 1.0em;
        height: 26vh;
        min-height: 95px;
        max-width: 95vw;
        top: 38% !important;
    }

    .text-container.text-position-top {
        top: 12vh !important;
    }

    .text-container.text-position-bottom {
        bottom: 20vh !important;
    }

    .settings-panel {
        min-width: 160px;
        top: 55px;
        right: 10px;
    }

    .settings-button {
        top: 10px;
        right: 10px;
    }

    .loading-bar-outer {
        width: 90vw;
        min-width: 120px;
    }

    .loading-container {
        padding: 1.3rem 0.4rem 1.1rem 0.4rem;
    }

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

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

    .control-button {
        width: 38px;
        height: 38px;
        font-size: 19px;
    }

    .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;
    }

    .audio-switch-prompt {
        padding: 25px 30px;
        margin: 0 20px;
        max-width: calc(100vw - 40px);
    }
}