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

body {
    font-family: 'Noto Sans JP', 'Helvetica Neue', Arial, sans-serif;
    background: radial-gradient(circle at top, rgba(64, 118, 255, 0.35), transparent 45%),
        linear-gradient(140deg, #0b1026 0%, #070a16 45%, #0d0f1c 100%);
    color: #f4f7ff;
    overflow: hidden;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

/* タイトル画面 */
#title-screen {
    text-align: center;
    padding: 2.5rem 3rem;
    background: rgba(12, 16, 32, 0.7);
    border-radius: 28px;
    border: 1px solid rgba(130, 160, 255, 0.25);
    box-shadow: 0 30px 80px rgba(3, 6, 18, 0.6);
    backdrop-filter: blur(18px);
    max-width: 640px;
}

#title-screen h1 {
    font-family: 'Orbitron', 'Noto Sans JP', sans-serif;
    font-size: 3.8rem;
    margin-bottom: 0.8rem;
    letter-spacing: 0.08em;
    text-shadow: 0 0 24px rgba(120, 170, 255, 0.6);
}

.tagline {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.85;
}

.controls-info {
    background: rgba(20, 30, 60, 0.7);
    padding: 1.5rem;
    border-radius: 18px;
    border: 1px solid rgba(120, 160, 255, 0.2);
    margin-bottom: 2rem;
    text-align: left;
}

.controls-info h3 {
    margin-bottom: 1rem;
    text-align: center;
    font-weight: 600;
}

.controls-info ul {
    list-style: none;
}

.controls-info li {
    padding: 0.5rem;
    font-size: 1rem;
}

button {
    background: linear-gradient(135deg, #7af7ff 0%, #6b8cff 45%, #b66cff 100%);
    color: #070a16;
    border: none;
    padding: 0.9rem 2.8rem;
    font-size: 1.2rem;
    border-radius: 999px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-weight: bold;
    letter-spacing: 0.05em;
    box-shadow: 0 12px 30px rgba(90, 130, 255, 0.35);
}

button:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 16px 36px rgba(120, 180, 255, 0.5);
}

button:active {
    transform: scale(0.95);
}

.info {
    margin-top: 1rem;
    font-size: 0.85rem;
    opacity: 0.65;
}

/* ゲーム画面 */
#game-screen {
    width: 100%;
    height: 100%;
    position: relative;
}

/* カメラプレビューコンテナ */
#camera-preview {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 240px;
    height: 180px;
    border: 2px solid rgba(120, 160, 255, 0.5);
    border-radius: 16px;
    background: rgba(6, 8, 18, 0.6);
    box-shadow: 0 10px 30px rgba(3, 6, 18, 0.6);
    z-index: 100;
    overflow: hidden;
}

#camera-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1); /* 鏡像反転 */
}

#camera-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleX(-1); /* 鏡像反転 */
    pointer-events: none;
}

#debug-canvas {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 320px;
    height: 240px;
    border: 2px solid rgba(120, 160, 255, 0.3);
    border-radius: 12px;
    background: rgba(8, 12, 24, 0.6);
    display: none;
}

#debug-canvas.active {
    display: block;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* UI オーバーレイ */
#ui-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none;
}

#ui-overlay > * {
    pointer-events: auto;
}

#score-display, #hp-display {
    background: rgba(10, 14, 30, 0.8);
    padding: 10px 20px;
    border-radius: 14px;
    border: 1px solid rgba(120, 160, 255, 0.25);
    font-size: 1.3rem;
    font-weight: bold;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 24px rgba(4, 8, 20, 0.5);
}

#toggle-camera {
    padding: 8px 16px;
    font-size: 0.85rem;
    background: rgba(10, 14, 30, 0.8);
    color: #f4f7ff;
    backdrop-filter: blur(8px);
    box-shadow: 0 8px 20px rgba(4, 8, 20, 0.4);
}

/* アクション説明 */
#action-guide {
    position: absolute;
    top: 80px;
    left: 20px;
    background: rgba(10, 14, 30, 0.75);
    padding: 15px 20px;
    border-radius: 18px;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(120, 160, 255, 0.25);
    z-index: 50;
    min-width: 220px;
}

#action-guide h4 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    text-align: center;
    color: #f4f7ff;
    border-bottom: 1px solid rgba(120, 160, 255, 0.3);
    padding-bottom: 8px;
}

.action-item {
    display: flex;
    align-items: center;
    margin: 8px 0;
    padding: 6px 0;
}

.action-icon {
    font-size: 1.5rem;
    margin-right: 12px;
    width: 30px;
    text-align: center;
}

.action-text {
    font-size: 0.9rem;
    color: #d7defa;
    flex: 1;
}

/* ゲームオーバー画面 */
#gameover-screen {
    text-align: center;
    padding: 2rem;
    background: rgba(12, 16, 32, 0.8);
    border-radius: 26px;
    border: 1px solid rgba(120, 160, 255, 0.25);
    backdrop-filter: blur(16px);
    box-shadow: 0 26px 70px rgba(4, 8, 22, 0.6);
}

#gameover-screen h1 {
    font-family: 'Orbitron', 'Noto Sans JP', sans-serif;
    font-size: 3.5rem;
    margin-bottom: 2rem;
    color: #ff9fb4;
    text-shadow: 0 0 24px rgba(255, 140, 180, 0.6);
}

.final-score {
    font-size: 1.8rem;
    margin-bottom: 2rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    #title-screen h1 {
        font-size: 2.5rem;
    }

    .controls-info li {
        font-size: 0.9rem;
    }

    #debug-canvas {
        width: 200px;
        height: 150px;
    }

    #camera-preview {
        width: 160px;
        height: 120px;
        bottom: 10px;
        right: 10px;
    }

    #action-guide {
        top: 60px;
        left: 10px;
        padding: 10px 15px;
        min-width: 180px;
    }

    #action-guide h4 {
        font-size: 0.85rem;
    }

    .action-icon {
        font-size: 1.2rem;
        width: 25px;
    }

    .action-text {
        font-size: 0.75rem;
    }
}
