* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    font-family: 'M PLUS Rounded 1c', sans-serif;
}

body {
    background-color: #1a1a2e; /* PC view background */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    touch-action: none; /* スマホでのスクロールを防止 */
}

/* スマホの縦画面を基準としたコンテナ */
#game-container {
    position: relative;
    width: 100%;
    max-width: 450px; /* スマホサイズ */
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.4);
}

@media (min-width: 451px) {
    #game-container {
        height: 90vh;
        max-height: 900px;
        border-radius: 20px;
        border: 6px solid #fff;
    }
}

/* 動く背景ロジック */
.sky-bg {
    position: absolute; width: 100%; height: 100%; top: 0; left: 0;
    transition: opacity 5s ease;
    z-index: 0;
    pointer-events: none;
}
#sky-day { background: linear-gradient(180deg, #6EC1E4 0%, #E8F4FA 100%); z-index: 1; opacity: 1; }
#sky-sunset { background: linear-gradient(180deg, #FF7B9C 0%, #FFD700 100%); z-index: 2; opacity: 0; }
#sky-night { background: linear-gradient(180deg, #2A3B5C 0%, #75628C 100%); z-index: 3; opacity: 0; }

#background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
    transition: transform 0.1s ease-out; /* 横スクロール（視差効果）用 */
}

.clouds {
    position: absolute;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    background-image: radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.6) 0%, rgba(255, 255, 255, 0) 15%),
                      radial-gradient(circle at 75% 85%, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 18%),
                      radial-gradient(circle at 60% 20%, rgba(255, 255, 255, 0.7) 0%, rgba(255, 255, 255, 0) 25%);
    background-size: 50% 100%;
    animation: moveCloudsHorizontal 15s linear infinite;
}

.distant-clouds {
    background-image: radial-gradient(circle at 40% 70%, rgba(255, 255, 255, 0.3) 0%, rgba(255, 255, 255, 0) 10%),
                      radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 12%);
    background-size: 50% 100%;
    animation: moveCloudsHorizontal 25s linear infinite; /* separate speed */
}

@keyframes moveCloudsHorizontal {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* UI デザイン */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
    display: flex;
    flex-direction: column;
}

#status-board {
    margin: 20px;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    font-size: 20px;
    font-weight: 700;
    color: #333;
    align-self: center;
    width: 90%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 3px solid rgba(255,255,255,0.9);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.status-item {
    text-align: center;
    color: #FF5E8E;
    font-size: 20px;
}

#time-left {
    font-size: 28px;
}

.progress-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.progress-text {
    font-size: 14px;
    color: #666;
    text-align: right;
}

.progress-bg {
    width: 100%;
    height: 12px;
    background: rgba(0,0,0,0.1);
    border-radius: 6px;
    overflow: hidden;
}

#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #FF7B9C 0%, #FF9A76 100%);
    border-radius: 6px;
    transition: width 1s linear;
}

/* ガラスパネル（メニュー） */
.glass-panel {
    pointer-events: auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85%;
    padding: 35px 25px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    border-radius: 28px;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.7);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.glass-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -40%) scale(0.95);
}

.glass-panel h1, .glass-panel h2 {
    color: #FF5E8E;
    font-size: 32px;
    margin-bottom: 12px;
    line-height: 1.2;
}

.glass-panel p {
    color: #555;
    font-size: 16px;
    margin-bottom: 25px;
    font-weight: 700;
}

.controls-info {
    background: rgba(0, 0, 0, 0.03);
    padding: 15px;
    border-radius: 16px;
    font-size: 14px;
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
    text-align: left;
    display: inline-block;
    width: 100%;
}
.controls-info p { margin-bottom: 0px !important; font-size: 14px; font-weight: 400; text-align: center; }

.final-score {
    font-size: 60px;
    font-weight: 700;
    color: #FF5E8E;
    margin-bottom: 30px;
    text-shadow: 0 4px 10px rgba(255, 94, 142, 0.3);
}

button {
    background: linear-gradient(135deg, #FF7B9C 0%, #FF9A76 100%);
    color: white;
    border: none;
    padding: 18px 30px;
    font-size: 20px;
    font-weight: 700;
    border-radius: 35px;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(255, 123, 156, 0.4);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    width: 100%;
}

button:active {
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(255, 123, 156, 0.4);
}

/* プレイエリアと要素 */
#play-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

#player {
    position: absolute;
    bottom: 20px;
    left: 0;
    width: 80px;
    height: 100px;
    transform: translateX(0);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

#player-flipper {
    width: 100%;
    height: 100%;
}

#player-img {
    position: relative;
    width: 100%;
    height: 100%;
}

.player-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center bottom;
    backface-visibility: hidden;
    -webkit-user-drag: none;
}

.frame-1 {
    animation: frameOneBlink 1s steps(1, end) infinite;
}

.frame-2 {
    animation: frameTwoBlink 1s steps(1, end) infinite;
}

@keyframes frameOneBlink {
    0%, 49.9%, 100% { opacity: 1; }
    50%, 99.9% { opacity: 0; }
}

@keyframes frameTwoBlink {
    0%, 49.9%, 100% { opacity: 0; }
    50%, 99.9% { opacity: 1; }
}

.falling-item {
    position: absolute;
    width: 100px;
    height: 100px;
    font-size: 45px;
    line-height: 50px;
    text-align: center;
    animation: bounceSpin 3s linear infinite;
}

@keyframes bounceSpin {
    0% { rotate: -5deg; }
    50% { rotate: 5deg; }
    100% { rotate: -5deg; }
}

.catch-effect {
    position: absolute;
    font-size: 26px;
    color: #FFD700;
    font-weight: 700;
    pointer-events: none;
    animation: floatUpBurst 0.7s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
    z-index: 4;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@keyframes floatUpBurst {
    0% { transform: translateY(0) scale(0.5); opacity: 1; }
    50% { transform: translateY(-30px) scale(1.3); opacity: 1; }
    100% { transform: translateY(-60px) scale(1); opacity: 0; }
}
