* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background-color: #000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: #fff;
}

canvas {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1;
}

/* スクリーンリーダー用の隠しテキスト */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 初期メッセージオーバーレイ */
.initial-message-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.initial-message-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.initial-message-content {
    text-align: center;
    color: #fff;
}

.message-line {
    margin: 0 0 12px 0;
    font-size: 16px;
    line-height: 1.5;
}

.message-line:first-child {
    font-size: 28px;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: blink 1.5s ease-in-out infinite;
}

.message-line:last-child {
    margin-bottom: 0;
}

/* 点滅アニメーション */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

/* ドロワートリガーボタン */
#drawer-trigger {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 20;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#drawer-trigger:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#drawer-trigger:focus {
    outline: none;
}

/* ドロワーオーバーレイ */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 15;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ドロワーパネル基本設定 */
.info-drawer {
    position: fixed;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 16;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.drawer-header h1 {
    font-size: 20px;
    margin: 0;
    background: linear-gradient(45deg, #ff006e, #8338ec, #3a86ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#drawer-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.2s ease;
}

#drawer-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

#drawer-close:focus {
    outline: 2px solid #3a86ff;
    outline-offset: 2px;
}

.drawer-content {
    padding: 20px;
}

.controls {
    font-size: 14px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.8);
}

.controls h3 {
    font-size: 16px;
    margin: 0 0 12px 0;
    color: #fff;
    font-weight: 600;
}

.controls ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.controls li {
    margin-bottom: 8px;
    padding-left: 0;
}

/* デスクトップ用コントロール説明 */
.controls-desktop {
    display: block;
}

.controls-mobile {
    display: none;
}

.sound-controls {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.8);
    border-radius: 25px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#pause-button,
#mute-button {
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
}

#pause-button:hover,
#mute-button:hover {
    transform: scale(1.1);
    filter: brightness(1.2);
}

#pause-button:focus,
#mute-button:focus {
    outline: 2px solid #3a86ff;
    outline-offset: 2px;
}

.effect-buttons {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

.effect-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    padding: 2px;
    opacity: 0.6;
}

.effect-btn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

.effect-btn.active {
    opacity: 1;
    filter: brightness(1.3);
    transform: scale(1.05);
}

/* デスクトップ・タブレット用ドロワー（左からスライドイン） */
@media (min-width: 769px) {
    .info-drawer {
        top: 0;
        left: 0;
        width: 400px;
        height: 100%;
        border-radius: 0 10px 10px 0;
        transform: translateX(-100%);
    }
    
    .info-drawer.active {
        transform: translateX(0);
    }
}

/* タブレット用調整 */
@media (min-width: 769px) and (max-width: 1023px) {
    .info-drawer {
        width: 75%;
        max-width: 350px;
    }
}

/* タブレット・モバイル用コントロール説明の切り替え */
@media (max-width: 1023px) {
    .controls-desktop {
        display: none;
    }
    
    .controls-mobile {
        display: block;
    }
}

/* モバイル用ドロワー（下からスライドアップ） */
@media (max-width: 768px) {
    #drawer-trigger {
        top: 10px;
        left: 10px;
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .info-drawer {
        bottom: 0;
        left: 0;
        width: 100%;
        height: 70%;
        border-radius: 15px 15px 0 0;
        transform: translateY(100%);
    }
    
    .info-drawer.active {
        transform: translateY(0);
    }
    
    .drawer-header {
        padding: 15px 20px;
    }
    
    .drawer-header h1 {
        font-size: 16px;
    }
    
    .drawer-content {
        padding: 15px 20px;
    }
    
    .controls {
        font-size: 12px;
    }
    
    .controls h3 {
        font-size: 14px;
    }
    
    .sound-controls {
        bottom: 15px;
        padding: 10px 16px;
        gap: 8px;
    }
    
    #pause-button,
    #mute-button {
        font-size: 18px;
    }
    
    .effect-btn {
        font-size: 14px;
    }
    
    /* 初期メッセージのモバイル対応 */
    .message-line {
        font-size: 12px;
    }
    
    .message-line:first-child {
        font-size: 20px;
        margin-bottom: 16px;
        animation: blink 1.5s ease-in-out infinite;
    }
}

/* アクセシビリティ：フォーカス表示 */
.info-drawer:focus-within {
    outline: 2px solid #3a86ff;
    outline-offset: -2px;
}

/* アニメーション：reduced motion対応 */
@media (prefers-reduced-motion: reduce) {
    .info-drawer,
    .drawer-overlay,
    #drawer-trigger {
        transition: none;
    }
}