:root {
    --primary-color: #00ff88;
    --accent-color: #ff0055;
    --bg-dark: #0a0a1a;
    --bg-light: #1a1a2e;
    --text-main: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --shadow-glow: 0 0 20px rgba(0, 255, 136, 0.5);
    --font-heading: 'Bungee Spice', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
    /* ゲーム中のテキスト選択防止 */
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at center, #1a2a3a 0%, #000000 100%);
}

.game-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    aspect-ratio: 4/3;
    background: #000;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid var(--glass-border);
}

canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="%23ff0055" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><line x1="12" y1="8" x2="12" y2="16"/><line x1="8" y1="12" x2="16" y2="12"/></svg>') 16 16, crosshair;
    /* 簡易的な照準カーソル */
}

/* UI Overlay */
.ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    /* UIの下のCanvasをクリックできるようにする */
}

/* Header & HUD */
.game-header {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    pointer-events: none;
}

.score-board,
.timer-board {
    background: var(--glass-bg);
    padding: 10px 20px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.label {
    font-size: 0.8em;
    color: #ccc;
    font-family: var(--font-body);
    font-weight: 700;
}

#score {
    color: var(--primary-color);
}

#timer {
    color: var(--accent-color);
}

/* Screens (Start / Game Over) */
.screen {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    pointer-events: auto;
    /* ボタンをクリックできるようにする */
    transition: opacity 0.3s ease;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.game-title {
    font-family: var(--font-heading);
    font-size: 4rem;
    text-align: center;
    text-transform: uppercase;
    text-shadow: 2px 2px 0px #ff0055, 4px 4px 0px #ffffff;
    animation: float 3s ease-in-out infinite;
}

.subtitle {
    font-size: 1.2rem;
    letter-spacing: 4px;
    color: var(--primary-color);
    text-transform: uppercase;
}

.result-score {
    font-size: 2rem;
    font-weight: bold;
}

#final-score {
    color: var(--primary-color);
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--primary-color), #00cc6a);
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-family: var(--font-body);
    font-weight: 900;
    font-size: 1.5rem;
    color: #000;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
    transition: transform 0.1s, box-shadow 0.1s;
    text-transform: uppercase;
}

.primary-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.6);
}

.primary-btn:active {
    transform: scale(0.95);
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* レスポンシブ対応 */
@media (max-width: 600px) {
    .game-title {
        font-size: 2.5rem;
    }

    .game-container {
        border-radius: 0;
        height: 100vh;
    }

    .primary-btn {
        font-size: 1.2rem;
        padding: 12px 30px;
    }
}

/* 追加: ラッシュモード演出 */
.rush-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: rushPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.rush-overlay.hidden {
    display: none;
}

.rush-text {
    font-family: var(--font-heading);
    font-size: 5rem;
    line-height: 1;
    color: #ff0055;
    text-shadow: 0 0 20px #ff0055, 4px 4px 0px #fff;
    white-space: nowrap;
    animation: pulseText 0.2s infinite alternate;
}

.rush-sub {
    font-family: var(--font-body);
    font-size: 2rem;
    color: #fff;
    background: #ff0055;
    padding: 5px 20px;
    transform: skewX(-10deg);
    font-weight: 900;
    letter-spacing: 5px;
    margin-top: 10px;
    box-shadow: 0 0 20px #ff0055;
}

/* タイマーが少なくなった時の演出クラス */
.timer-critical {
    animation: criticalPulse 0.5s infinite;
    border-color: #ff0055 !important;
    background: rgba(255, 0, 85, 0.3) !important;
}

.timer-critical #timer {
    color: #fff !important;
    text-shadow: 0 0 10px #fff;
}

@keyframes rushPop {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes pulseText {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.1);
    }
}

@keyframes criticalPulse {
    0% {
        box-shadow: 0 0 10px #ff0055;
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 30px #ff0055, inset 0 0 20px #ff0055;
        transform: scale(1.1);
    }

    100% {
        box-shadow: 0 0 10px #ff0055;
        transform: scale(1);
    }
}