body {
    margin: 0;
    padding: 0;
    background-color: #2c3e50;
    color: #ecf0f1;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 800px;
    height: 600px;
    background-color: #34495e;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

canvas {
    display: block;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#title {
    position: absolute;
    top: 10px;
    left: 20px;
    margin: 0;
    font-size: 24px;
    color: #f1c40f;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#highscore-display {
    position: absolute;
    top: 10px;
    right: 20px;
    margin: 0;
    font-size: 18px;
    font-weight: bold;
    color: #f39c12; /* タイトルと少し似たゴールド色 */
}

#rank-title {
    font-size: 16px;
    color: #ffd700; /* ゴールド */
    margin-left: 5px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
}

#time-display {
    position: absolute;
    top: 70px;
    right: 20px;
    margin: 0;
    font-size: 20px;
    font-weight: bold;
    color: #ecf0f1;
}

#score-display {
    position: absolute;
    top: 40px;
    right: 20px;
    margin: 0;
    font-size: 24px;
    font-weight: bold;
}

#title-screen, #how-to-play-screen, #gameplay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#gameplay-screen {
    pointer-events: none; /* UI外のキャンバスにクリックを通す */
}

#title-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(26, 37, 47, 0.85); /* ダークな半透明 */
    backdrop-filter: blur(3px);
}

#title-screen h1 {
    font-size: 64px;
    color: #f1c40f;
    text-shadow: 4px 4px 0px #d35400, 8px 8px 10px rgba(0,0,0,0.5);
    margin-bottom: 50px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
    100% { transform: translateY(0px); }
}

#how-to-play-screen {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(26, 37, 47, 0.90);
    backdrop-filter: blur(3px);
}

.rules-content {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 10px;
    text-align: left;
    max-width: 600px;
    margin-bottom: 30px;
}

.rules-content ul {
    font-size: 18px;
    line-height: 1.8;
}

#game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(44, 62, 80, 0.95);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    border: 2px solid #e74c3c;
    pointer-events: auto;
    box-shadow: 0 0 20px rgba(0,0,0,0.8);
    transition: all 0.3s ease;
}

.hidden {
    display: none !important;
}

h2 {
    color: #e74c3c;
    margin-top: 0;
    font-size: 36px;
}

button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 18px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    margin-top: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

button:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(1px);
    box-shadow: 0 2px 3px rgba(0,0,0,0.3);
}
