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

body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #2D3748;
    font-family: 'Segoe UI', sans-serif;
    overflow: hidden;
    touch-action: manipulation;
}

#gameContainer {
    position: relative;
    max-width: 100vw;
    max-height: 100vh;
}

canvas {
    border: 4px solid #444;
    border-radius: 12px;
    cursor: pointer;
    display: block;
    max-width: 100%;
    height: auto;
    touch-action: none;
}

#ui {
    position: absolute;
    top: 15px;
    left: 20px;
    color: #fff;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#ui div {
    margin-bottom: 5px;
}

/* コンボ表示 */
#comboDisplay {
    margin-top: 10px;
    padding: 8px 15px;
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    border-radius: 20px;
    font-size: 18px;
    color: #fff;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
    animation: comboPulse 0.5s ease-in-out;
    transition: opacity 0.3s ease;
}

#comboDisplay.hidden {
    display: none;
}

#comboDisplay.fading {
    opacity: 0.5;
}

#comboCount {
    font-size: 24px;
    font-weight: bold;
    color: #fff200;
}

#comboMultiplier {
    font-weight: bold;
    color: #7fff00;
}

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

#message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 36px;
    font-weight: bold;
    color: #e74c3c;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.7);
    display: none;
    text-align: center;
    background: rgba(0,0,0,0.7);
    padding: 30px 50px;
    border-radius: 15px;
}

#message .restart {
    font-size: 18px;
    margin-top: 15px;
    color: #fff;
}

#instruction {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    color: #aaa;
    font-size: 14px;
}

#lives {
    color: #e74c3c;
}

/* スタート画面 */
#startScreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 12px;
    z-index: 10;
}

#startScreen .title {
    font-size: 48px;
    font-weight: bold;
    color: #fff;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    margin-bottom: 15px;
}

#startScreen .subtitle {
    font-size: 18px;
    color: #aaa;
    margin-bottom: 40px;
}

#startScreen .start-button {
    font-size: 24px;
    font-weight: bold;
    color: #fff;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    padding: 15px 50px;
    border-radius: 50px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
}

#startScreen .start-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.6);
}

#startScreen .how-to-play {
    margin-top: 40px;
    text-align: center;
    color: #ccc;
    font-size: 14px;
    line-height: 1.8;
}

#startScreen .how-title {
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 10px;
}

#startScreen.hidden {
    display: none;
}

/* スマホ縦向き対応 */
@media (max-width: 600px) {
    #ui {
        font-size: 14px;
        top: 10px;
        left: 10px;
    }

    #message {
        font-size: 24px;
        padding: 20px 30px;
    }

    #message .restart {
        font-size: 14px;
    }

    #instruction {
        font-size: 11px;
        bottom: 10px;
    }

    #startScreen .title {
        font-size: 28px;
    }

    #startScreen .subtitle {
        font-size: 14px;
        padding: 0 20px;
    }

    #startScreen .start-button {
        font-size: 18px;
        padding: 12px 35px;
    }

    #startScreen .how-to-play {
        font-size: 12px;
        padding: 0 15px;
    }

    #startScreen .how-title {
        font-size: 14px;
    }

    canvas {
        border-width: 2px;
        border-radius: 8px;
    }

    #comboDisplay {
        font-size: 12px;
        padding: 5px 10px;
    }

    #comboCount {
        font-size: 16px;
    }
}

/* スマホ横向き対応 */
@media (max-height: 450px) and (orientation: landscape) {
    #ui {
        font-size: 12px;
        top: 5px;
        left: 10px;
    }

    #instruction {
        display: none;
    }

    #startScreen .title {
        font-size: 24px;
        margin-bottom: 10px;
    }

    #startScreen .subtitle {
        font-size: 12px;
        margin-bottom: 20px;
    }

    #startScreen .how-to-play {
        display: none;
    }

    #startScreen .start-button {
        font-size: 16px;
        padding: 10px 30px;
    }
}
