/* リセット */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1e3c72, #2a5298, #7e57c2);
    height: 100%;
    overflow: hidden;
    position: relative;
}

/* 背景の星アニメーション */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(2px 2px at 20% 30%, white, transparent),
        radial-gradient(2px 2px at 60% 70%, white, transparent),
        radial-gradient(1px 1px at 50% 50%, white, transparent),
        radial-gradient(1px 1px at 80% 10%, white, transparent),
        radial-gradient(2px 2px at 90% 60%, white, transparent);
    background-size: 200% 200%;
    animation: moveStars 50s linear infinite;
    z-index: 0;
}

@keyframes moveStars {
    from { transform: translateY(0); }
    to { transform: translateY(-100%); }
}

/* 画面共通スタイル */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 1;
}

.hidden {
    display: none !important;
}

/* スタート画面 */
.title-container {
    text-align: center;
    margin-bottom: 40px;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-title {
    font-size: 64px;
    color: #FFD700;
    text-shadow:
        3px 3px 0 #FF6B6B,
        6px 6px 0 #4ECDC4,
        9px 9px 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
    letter-spacing: 4px;
}

.star-icon {
    display: inline-block;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.subtitle {
    font-size: 24px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: pulse 2s ease-in-out infinite;
}

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

/* メニューコンテナ */
.menu-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
}

/* ボタンスタイル */
.menu-btn {
    display: block;
    width: 100%;
    padding: 18px 30px;
    margin: 15px 0;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.menu-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.primary-btn {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    font-size: 24px;
}

.btn-icon {
    margin-right: 10px;
    font-size: 24px;
}

/* 難易度選択 */
.difficulty-selector {
    margin: 30px 0;
    padding: 20px;
    background: rgba(230, 230, 250, 0.3);
    border-radius: 20px;
}

.difficulty-label {
    text-align: center;
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    font-weight: bold;
}

.difficulty-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.diff-btn {
    flex: 1;
    padding: 12px 15px;
    background: white;
    border: 3px solid #ddd;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

.diff-btn.active {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    border-color: #FFD700;
    transform: scale(1.05);
}

.diff-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.diff-icon {
    display: block;
    font-size: 24px;
    margin-bottom: 5px;
}

/* 浮遊する星 */
.floating-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.floating-star {
    position: absolute;
    font-size: 30px;
    animation: float 6s ease-in-out infinite;
}

.floating-star:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-star:nth-child(2) {
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

.floating-star:nth-child(3) {
    bottom: 20%;
    left: 50%;
    animation-delay: 4s;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-30px) rotate(180deg); }
}

/* モーダルコンテンツ */
.modal-content {
    background: white;
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-title {
    text-align: center;
    font-size: 36px;
    color: #333;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 遊び方画面 */
.instructions {
    margin: 20px 0;
}

.instruction-item {
    display: flex;
    align-items: flex-start;
    margin: 20px 0;
    padding: 15px;
    background: linear-gradient(135deg, #f5f7fa, #c3cfe2);
    border-radius: 15px;
}

.instruction-icon {
    font-size: 40px;
    margin-right: 20px;
}

.instruction-text h3 {
    color: #333;
    margin-bottom: 8px;
    font-size: 18px;
}

.instruction-text p {
    color: #666;
    line-height: 1.5;
}

/* ハイスコア画面 */
.score-list {
    margin: 20px 0;
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin: 10px 0;
    background: linear-gradient(135deg, #ffecd2, #fcb69f);
    border-radius: 15px;
    font-size: 18px;
    font-weight: bold;
}

.score-item.gold {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: white;
    font-size: 22px;
}

.score-item.silver {
    background: linear-gradient(135deg, #C0C0C0, #888);
    color: white;
    font-size: 20px;
}

.score-item.bronze {
    background: linear-gradient(135deg, #CD7F32, #8B4513);
    color: white;
}

.score-rank {
    display: inline-block;
    width: 40px;
    text-align: center;
}

.score-name {
    flex: 1;
    margin: 0 20px;
}

.score-value {
    font-size: 20px;
}

/* スコア入力 */
.score-input {
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    border-radius: 20px;
    margin: 20px 0;
}

.new-record {
    font-size: 24px;
    color: white;
    margin-bottom: 15px;
    animation: blink 1s ease-in-out infinite;
}

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

#playerName {
    padding: 12px 20px;
    font-size: 18px;
    border: 3px solid #FFD700;
    border-radius: 25px;
    width: 100%;
    margin-bottom: 15px;
    text-align: center;
}

/* ゲーム画面 */
.game-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10;
}

.score-display,
.level-display,
.lives-display {
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.label {
    font-size: 16px;
    color: #666;
    font-weight: bold;
}

.value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.heart {
    font-size: 24px;
    margin: 0 2px;
    transition: all 0.3s;
}

.heart.lost {
    opacity: 0.3;
    filter: grayscale(100%);
}

.pause-btn {
    padding: 10px 15px;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
}

.pause-btn:hover {
    background: white;
    transform: scale(1.1);
}

/* キャンバス */
#gameCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* コンボ表示 */
.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    animation: comboAnimation 1s ease-out;
}

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

.combo-number {
    display: block;
    font-size: 72px;
    font-weight: bold;
    color: #FFD700;
    text-shadow:
        3px 3px 0 #FF6B6B,
        6px 6px 20px rgba(0, 0, 0, 0.5);
}

.combo-text {
    font-size: 36px;
    color: white;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
}

/* パワーアップ表示 */
.powerup-display {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #FFD700, #FFA500);
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: powerupAnimation 2s ease-out;
}

@keyframes powerupAnimation {
    0% {
        transform: translateX(-50%) translateY(100px);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 0;
    }
}

.powerup-icon {
    font-size: 36px;
    margin-right: 10px;
}

.powerup-text {
    font-size: 24px;
    font-weight: bold;
    color: white;
}

/* オーバーレイ */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* ゲームオーバー画面 */
.final-score {
    text-align: center;
    margin: 30px 0;
    padding: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 20px;
}

.final-score-label {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
}

.final-score-value {
    font-size: 48px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.new-high-score {
    text-align: center;
    margin: 20px 0;
}

.celebration {
    font-size: 28px;
    color: #FFD700;
    animation: celebrate 1s ease-in-out infinite;
}

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

.game-over-buttons {
    display: flex;
    gap: 15px;
}

.game-over-buttons .menu-btn {
    flex: 1;
}

/* サウンドコントロール */
.sound-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 10px;
    z-index: 10;
}

.sound-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.sound-btn:hover {
    transform: scale(1.1);
    background: white;
}

.sound-btn.muted {
    opacity: 0.5;
    text-decoration: line-through;
}

/* カオスモード */
.chaos-mode {
    animation: chaosAnimation 0.5s ease-in-out infinite !important;
    background: linear-gradient(-45deg, #ff0080, #ff8c00, #ffd700, #00ff00, #00ffff, #ff00ff) !important;
    background-size: 400% 400% !important;
}

@keyframes chaosAnimation {
    0%, 100% {
        transform: translateX(-50%) scale(1) rotate(0deg);
        background-position: 0% 50%;
    }
    25% {
        transform: translateX(-50%) scale(1.1) rotate(5deg);
        background-position: 50% 50%;
    }
    50% {
        transform: translateX(-50%) scale(1.2) rotate(-5deg);
        background-position: 100% 50%;
    }
    75% {
        transform: translateX(-50%) scale(1.1) rotate(5deg);
        background-position: 50% 50%;
    }
}

#gameCanvas.chaos-mode {
    animation: canvasChaos 0.1s linear infinite;
}

@keyframes canvasChaos {
    0% { filter: hue-rotate(0deg) saturate(1.5); }
    100% { filter: hue-rotate(360deg) saturate(1.5); }
}

/* カオスモード時のタイマー表示 */
.chaos-timer {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ff0080, #ff8c00);
    color: white;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 24px;
    font-weight: bold;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: pulse 0.5s ease-in-out infinite;
    z-index: 100;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .game-title {
        font-size: 48px;
    }

    .subtitle {
        font-size: 18px;
    }

    .menu-container {
        padding: 30px 20px;
    }

    .menu-btn {
        padding: 15px 25px;
        font-size: 18px;
    }

    .game-header {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px;
    }

    .score-display,
    .level-display,
    .lives-display {
        padding: 8px 15px;
    }

    .label {
        font-size: 14px;
    }

    .value {
        font-size: 20px;
    }
}