/* === Audio Settings UI === */

.audio-cog {
    position: fixed;
    z-index: 1090;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.92), rgba(46, 134, 222, 0.92));
    color: #fff;
    box-shadow: 0 10px 28px rgba(46, 134, 222, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.06) inset;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.audio-cog:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 14px 32px rgba(108, 92, 231, 0.55);
}

.audio-cog:active {
    transform: translateY(0) scale(0.96);
}

.audio-cog.audio-pos-top-right {
    top: 16px;
    right: 16px;
}

.audio-cog.audio-pos-top-left {
    top: 16px;
    left: 16px;
}

.audio-cog.audio-pos-bottom-right {
    bottom: 16px;
    right: 16px;
}

.audio-cog.audio-pos-game-corner {
    top: 62px;
    right: 14px;
    width: 40px;
    height: 40px;
}

.audio-cog-icon {
    display: block;
    pointer-events: none;
}

.audio-cog-active {
    background: linear-gradient(135deg, #ff7e5f, #feb47b);
    box-shadow: 0 14px 32px rgba(254, 180, 123, 0.55);
}

.audio-cog-muted .audio-cog-wave {
    opacity: 0.2;
}

.audio-cog-muted::after {
    content: "";
    position: absolute;
    width: 30px;
    height: 2px;
    background: #fff;
    transform: rotate(-45deg);
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.audio-cog-wave {
    transform-origin: 12px 12px;
    transition: opacity 0.2s ease;
}

.audio-cog:not(.audio-cog-muted) .audio-cog-wave-1 {
    animation: audio-wave 2.2s ease-in-out infinite;
}

.audio-cog:not(.audio-cog-muted) .audio-cog-wave-2 {
    animation: audio-wave 2.2s ease-in-out 0.3s infinite;
}

@keyframes audio-wave {
    0%, 100% { opacity: 0.55; }
    50% { opacity: 1; }
}

.audio-cog-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: transparent;
    pointer-events: none;
}

/* === Panel === */

.audio-panel {
    position: fixed;
    width: 320px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 96px);
    overflow-y: auto;
    z-index: 1089;
    background: linear-gradient(180deg, rgba(20, 22, 36, 0.95), rgba(15, 16, 28, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
    color: #f3f4ff;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    transform-origin: top right;
    transition: opacity 0.2s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.audio-panel-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px) scale(0.95);
}

.audio-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.audio-panel-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 0.98rem;
}

.audio-panel-icon {
    font-size: 1.2rem;
}

.audio-panel-close {
    border: none;
    background: rgba(255, 255, 255, 0.08);
    color: #f3f4ff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.audio-panel-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: rotate(90deg);
}

.audio-panel-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* === Toggle === */

.audio-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    user-select: none;
}

.audio-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.94rem;
}

.audio-toggle-emoji {
    font-size: 1.1rem;
}

.audio-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.audio-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.audio-switch-track {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    transition: background 0.2s ease;
}

.audio-switch-track::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}

.audio-switch input:checked + .audio-switch-track {
    background: linear-gradient(90deg, #00d2d3, #54a0ff);
}

.audio-switch input:checked + .audio-switch-track::before {
    transform: translateX(20px);
}

/* === Sliders === */

.audio-slider {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.audio-slider-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 600;
    color: #d6d9f2;
}

.audio-slider-val {
    font-variant-numeric: tabular-nums;
    color: #8be9fd;
    font-weight: 700;
    background: rgba(139, 233, 253, 0.1);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.82rem;
}

.audio-range {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #6c5ce7, #00cec9);
    outline: none;
    cursor: pointer;
}

.audio-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.18), 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.audio-range::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 0 6px rgba(108, 92, 231, 0.28), 0 6px 14px rgba(0, 0, 0, 0.5);
}

.audio-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.18), 0 4px 10px rgba(0, 0, 0, 0.4);
}

.audio-range::-moz-range-thumb:hover {
    transform: scale(1.15);
}

/* === Test Sounds === */

.audio-test {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.audio-test-label {
    font-size: 0.82rem;
    color: #9ea3c5;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

.audio-test-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.audio-test-btn {
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04);
    color: #f3f4ff;
    border-radius: 8px;
    padding: 6px 4px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.12s ease, background 0.18s ease, border-color 0.18s ease;
}

.audio-test-btn:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.35), rgba(46, 134, 222, 0.35));
    border-color: rgba(108, 92, 231, 0.55);
    transform: translateY(-2px);
}

.audio-test-btn:active {
    transform: translateY(0) scale(0.96);
}

/* === Mobile === */

@media (max-width: 480px) {
    .audio-cog.audio-pos-top-right {
        top: 12px;
        right: 12px;
        width: 42px;
        height: 42px;
    }

    .audio-panel {
        top: 64px;
        right: 12px;
        left: 12px;
        width: auto;
        max-width: none;
    }

    .audio-test-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    .audio-cog,
    .audio-panel,
    .audio-panel-close,
    .audio-switch-track::before,
    .audio-range::-webkit-slider-thumb,
    .audio-test-btn {
        transition: none !important;
        animation: none !important;
    }
}
