﻿/* ========================================
   音声トグルボタン
======================================== */
.audio-toggle-container {
    position: fixed;
    top: 10px;
    right: 35px;
    z-index: 9999;
}

.audio-toggle-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: 3px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
}

.audio-toggle-btn:hover {
    transform: scale(1.1);
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

.audio-toggle-btn:active {
    transform: scale(0.95);
}

.audio-icon {
    font-size: 24px;
    color: white;
    user-select: none;
}

/* 音声設定パネル */
.audio-settings-panel {
    position: absolute;
    top: 60px;
    right: 0;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
    padding: 20px;
    min-width: 250px;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.audio-setting-item {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.audio-label {
    font-size: 16px;
    font-weight: bold;
    color: #333;
}

/* トグルスイッチ */
.audio-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

    .audio-switch input {
        opacity: 0;
        width: 0;
        height: 0;
    }

.audio-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

    .audio-slider:before {
        position: absolute;
        content: "";
        height: 20px;
        width: 20px;
        left: 4px;
        bottom: 4px;
        background-color: white;
        transition: 0.4s;
        border-radius: 50%;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

.audio-switch input:checked + .audio-slider {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

    .audio-switch input:checked + .audio-slider:before {
        transform: translateX(22px);
    }

/* 音量スライダー */
.audio-volume-item {
    margin-bottom: 15px;
}

.volume-label {
    display: block;
    font-size: 14px;
    color: #666;
    margin-bottom: 8px;
}

.volume-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e0e0e0;
    outline: none;
    -webkit-appearance: none;
}

    .volume-slider::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    .volume-slider::-moz-range-thumb {
        width: 18px;
        height: 18px;
        border-radius: 50%;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        cursor: pointer;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
        border: none;
    }

/* ゲーム中は少し透明に */
.game-container:not(.start-screen-active) .audio-toggle-container {
    opacity: 0.8;
}

    .game-container:not(.start-screen-active) .audio-toggle-container:hover {
        opacity: 1;
    }

/* モバイル対応 */
@media (max-width: 768px) {
    .audio-toggle-container {
        top: 8px;
        right: 50px;
    }

    .audio-toggle-btn {
        width: 35px;
        height: 35px;
    }

    .audio-settings-panel {
        right: -30px;
        min-width: 200px;
        padding: 15px;
    }

    .audio-setting-item {
        gap: 10px;
        margin-bottom: 15px;
        padding-bottom: 10px;
    }

    .audio-label {
        font-size: 14px;
    }

    .audio-switch {
        width: 44px;
        height: 24px;
    }

    .audio-slider:before {
        height: 18px;
        width: 18px;
        left: 3px;
        bottom: 3px;
    }

    .audio-switch input:checked + .audio-slider:before {
        transform: translateX(20px);
    }

    .volume-label {
        font-size: 12px;
    }

    .audio-volume-item {
        margin-bottom: 10px;
    }
}

/* 横画面対応 */
@media (orientation: landscape) and (max-height: 600px) {
    .audio-toggle-container {
        top: 20px;
        right: 15px;
    }

    .audio-toggle-btn {
        width: 40px;
        height: 40px;
    }
}

/* 音声ヒントのアニメーション */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}

/* 音声開始ヒント */
.audio-hint {
    position: fixed !important;
    bottom: 100px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(118, 75, 162, 0.95) !important;
    color: white !important;
    padding: 12px 24px !important;
    border-radius: 25px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    z-index: 10000 !important;
    pointer-events: none !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
    animation: audioHintPulse 2s infinite !important;
    opacity: 0;
    transition: opacity 0.5s ease;
}

@keyframes audioHintPulse {
    0% {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }

    50% {
        transform: translateX(-50%) scale(1.05);
        box-shadow: 0 6px 20px rgba(118, 75, 162, 0.5);
    }

    100% {
        transform: translateX(-50%) scale(1);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    }
}

/* モバイル対応 */
@media (max-width: 768px) {
    .audio-hint {
        bottom: 10px !important;
        font-size: 14px !important;
        padding: 10px 20px !important;
    }
}
