
/* ゲーム固有のスタイル調整 */
.game-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 60px;
    background-color: #222; 
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    aspect-ratio: 4/3; 
}

/* --- モバイルモード用スタイル --- */
.game-wrapper.mobile-mode {
    aspect-ratio: 9/16 !important;
    max-width: 600px; /* PC画面で見たとき用 */
}

#phaser-game {
    width: 100%;
    height: 100%;
    display: block;
}

/* HUD Overlay */
.hud-overlay {
    position: absolute;
    top: 20px;
    left: 20px;
    pointer-events: none; 
    z-index: 10;
    color: white;
    font-family: 'Courier New', monospace;
    text-shadow: 1px 1px 0 #000;
}

/* モバイル用 HUD Overlay 配置変更 */
.hud-overlay.mobile-mode {
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7); /* 背景あり */
    padding: 8px 12px;
    box-sizing: border-box;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hud-value-box {
    background: rgba(0, 0, 0, 0.6);
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    border-left: 4px solid #aaa;
    backdrop-filter: blur(2px);
    transition: border-color 0.3s;
}

/* モバイル用 HUD Box 変更 */
.hud-value-box.mobile-mode {
    background: transparent;
    padding: 0;
    margin: 0;
    border-left: none; /* 縦棒削除 */
    backdrop-filter: none;
    display: flex;
    align-items: baseline;
    gap: 10px;
    border-bottom: 3px solid #aaa; /* 下線に変更 */
}

.hud-label {
    font-size: 12px;
    opacity: 0.8;
    display: block;
}

.hud-value-box.mobile-mode .hud-label {
    display: inline-block;
    margin-right: 5px;
}

.hud-number {
    font-size: 24px;
    font-weight: bold;
    display: inline-block;
    margin-right: 8px;
}

.hud-value-box.mobile-mode .hud-number {
    font-size: 20px;
}

.hud-next {
    font-size: 14px;
    color: #aaa;
    vertical-align: middle;
}

.hud-value-box.odd { border-left-color: var(--accent-primary, #b51510); }
.hud-value-box.even { border-left-color: #7491b1; }
.hud-value-box.miracle { border-left-color: #c5a000; animation: pulse-gold 1s infinite; }

/* モバイル用ボーダーカラー */
.hud-value-box.mobile-mode.odd { border-bottom-color: #b51510; }
.hud-value-box.mobile-mode.even { border-bottom-color: #7491b1; }
.hud-value-box.mobile-mode.miracle { border-bottom-color: #c5a000; }

@keyframes pulse-gold {
    0% { box-shadow: 0 0 5px #c5a000; }
    50% { box-shadow: 0 0 15px #c5a000; }
    100% { box-shadow: 0 0 5px #c5a000; }
}

/* Danger Overlay (フリーフォール警告) */
.danger-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle, transparent 40%, rgba(255,0,0,0.3) 100%);
    z-index: 5;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.danger-overlay.level-1 {
    opacity: 1;
    animation: pulse-danger 2s infinite;
}
.danger-overlay.level-2 {
    opacity: 1;
    background: radial-gradient(circle, transparent 20%, rgba(255,0,0,0.6) 100%);
    animation: pulse-danger 0.8s infinite;
}

@keyframes pulse-danger {
    0% { opacity: 0.2; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0.2; transform: scale(1); }
}

.game-over-screen {
    display: none;
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    z-index: 20;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
}

.game-over-screen.active { display: flex; }

.go-title { font-size: 32px; font-weight: bold; margin-bottom: 20px; color: #ff5555; }
.go-score { font-size: 20px; margin-bottom: 30px; }

.restart-btn {
    background: white;
    color: black;
    border: none;
    padding: 10px 25px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: transform 0.2s;
    pointer-events: auto;
}
.restart-btn:hover { transform: scale(1.05); }

.mobile-controls-hint {
    position: absolute;
    bottom: 10px;
    width: 100%;
    text-align: center;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    pointer-events: none;
}

/* --- ランキング機能用スタイル (新規追加) --- */
.leaderboard-section {
    max-width: 800px;
    margin: 0 auto 60px;
    padding: 20px;
    /* 黒系背景に調整 */
    background-color: #222222; 
    border: 1px solid #444;
    border-radius: 4px;
    color: #FFFFFF;
}
.leaderboard-section h2 {
    font-size: 20px;
    border-bottom: 2px solid #B51510; /* 赤アクセント */
    padding-bottom: 10px;
    margin-bottom: 15px;
    color: #FFFFFF;
}
.leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.leaderboard-list li {
    padding: 10px;
    border-bottom: 1px solid #444;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.leaderboard-list li:last-child {
    border-bottom: none;
}
.rank-num {
    font-weight: bold;
    color: #D4AF37; /* 金色 */
    width: 30px;
}
.player-info {
    flex-grow: 1;
    text-align: left;
    padding-left: 10px;
}
.player-date {
    font-size: 0.8em;
    color: #888;
    margin-left: 10px;
}
.score-val {
    font-weight: bold;
    color: #FAFFFF;
}

/* 登録フォーム */
.registration-area {
    background-color: #333;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    border: 1px solid #D4AF37; /* ランクイン時は金色枠 */
    text-align: center;
    display: none; /* デフォルト非表示 */
}
.registration-area p {
    margin: 0 0 10px 0;
    color: #FFD700;
    font-weight: bold;
}
.registration-area input[type="text"] {
    padding: 8px;
    border: 1px solid #555;
    background-color: #111;
    color: #fff;
    border-radius: 3px;
    width: 150px;
}
.registration-area button {
    padding: 8px 16px;
    background-color: #B51510;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
}
.registration-area button:hover {
    background-color: #d93d38;
}