@import url('https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@700&family=Outfit:wght@700&display=swap');

:root {
    --primary-color: #ff4757;
    --secondary-color: #2ed573;
    --bg-color: #0c1445;
    /* 深いネイビー（真夜中） */
    --text-color: #ffffff;
    /* 白文字 */
    --canvas-bg: transparent;
    /* 背景と一体化 */
    --prize-bg: rgba(12, 20, 69, 0.95);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    /* スマホのタップ時の青枠消し */
}

body {
    font-family: 'M PLUS Rounded 1c', sans-serif;
    background-color: #ffffff;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow: hidden;
    touch-action: manipulation;
    /* ダブルタップズーム防止 */
}

#game-container {
    position: relative;
    width: 100vw;
    /* 画面端まで広げる */
    max-width: none;
    padding: 0;
}

h1 {
    position: absolute;
    top: 5vh;
    left: 0;
    width: 100%;
    font-size: 2.5rem;
    text-align: center;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    z-index: 10;
    pointer-events: none;
    /* 下のCanvasのタップを邪魔しない */
}

#game-canvas {
    background-color: var(--bg-color);
    display: block;
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    object-position: top;
    cursor: pointer;
}

#ui-layer {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: center;
    /* 中央に配置 */
    pointer-events: none;
    font-size: 1.2rem;
    font-weight: bold;
}

.score-box {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    backdrop-filter: blur(8px);
    font-size: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.overlay-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--prize-bg);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    text-align: center;
    padding: 20px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

#prize-screen h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

#prize-name {
    font-size: 2.2rem;
    background: linear-gradient(45deg, #fff, #74b9ff);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 15px;
    border: 4px solid #ffffff;
    border-radius: 12px;
    margin: 10px 0;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.instructions {
    position: absolute;
    top: calc(var(--ground-y-percent) + 3rem);
    /* 地面ラインから1rem下 */
    width: 100%;
    font-size: 1.3rem;
    color: #ff6666;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    display: none;
    /* 初期状態は非表示 */
}

.button-group {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.retry-button,
.back-to-title-button {
    padding: 12px 25px;
    font-size: 1.1rem;
    cursor: pointer;
    border-radius: 50px;
    border: none;
    font-weight: bold;
    transition: all 0.2s;
    z-index: 101;
}

.retry-button {
    background: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 15px rgba(46, 213, 115, 0.3);
}

.back-to-title-button {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(5px);
}

.retry-button:active,
.back-to-title-button:active {
    transform: scale(0.95);
}

.prize-link-button {
    margin-top: 40px;
    margin-bottom: 40px;
    padding: 18px 40px;
    font-size: 1.1rem;
    color: #fff;
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    border: none;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
    transition: all 0.3s ease;
    display: inline-block;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 40px rgba(241, 196, 15, 0.8);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(241, 196, 15, 0.5);
    }
}

.prize-link-button:hover {
    filter: brightness(1.2);
}

/* 全画面の雪 */
#snow-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    /* 全ての上に重ねる */
}

.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    top: -10px;
    animation: fall linear forwards;
}

@keyframes fall {
    to {
        transform: translateY(110vh) rotate(540deg);
    }
}