/* ======================================
   避けゲームのスタイル
   ====================================== */

/* ページ全体のスタイル */
* {
    /* すべての要素の余白をリセット */
    margin: 0;
    padding: 0;
    /* ボックスモデルの計算方法を統一 */
    box-sizing: border-box;
}

/* ボディ要素のスタイル */
body {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #222;
    font-family: Arial, sans-serif;
    color: white;
    overflow: hidden;
}

/* コンテナ（全体を包み込む） */
.container {
    position: relative;
    width: 400px;
    height: 720px;
    background-color: #111;
    border: 2px solid white;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

/* スコア表示 */
.score-display,
.difficulty-display,
.best-score-display,
.life-display {
    position: absolute;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 15px;
    border: 1px solid white;
    font-size: 18px;
    font-weight: bold;
    z-index: 10;
    border-radius: 5px;
}

.score-display {
    top: 10px;
    left: 10px;
}

/* 難易度表示 */
.difficulty-display {
    top: 10px;
    right: 10px;
}

/* ベストスコア表示 */
.best-score-display {
    top: 48px;
    right: 10px;
}

/* スタートボタン */
.start-btn {
    position: absolute;
    top: 340px;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    padding: 20px 40px;
    background-color: #7700ff;
    color: #fff;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    z-index: 250;
    transition: 0.3s;
}

.start-btn:hover {
    background-color: #9900ff;
    transform: translate(-50%, -50%) scale(1.1);
}

/* カウントダウン表示 */
.countdown {
    position: absolute;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 72px;
    color: #fff;
    font-weight: bold;
    z-index: 20;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
}

.game-area {
    position: relative;
    width: 100%;
    height: 600px;
    background: linear-gradient(180deg, #2f2f2f, #121212);
}
/* 行動可能範囲 */
.movement-boundary {
    position: absolute;
    top: 40px;
    left: 40px;
    width: calc(100% - 80px);
    height: calc(100% - 80px);
    border: 2px dashed rgba(255, 255, 255, 0.8);
    pointer-events: none;
    z-index: 2;
}

/* タッチ操作ボタン */
.touch-controls {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    display: grid;
    grid-template-columns: repeat(3, 70px);
    grid-template-rows: repeat(2, 70px);
    gap: 8px;
    justify-content: center;
    
    z-index: 20;
}
.life-display {
    top: 86px;
    right: 10px;
}

.mode-select {
    position: absolute;
    top: 280px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 30;
    display: flex;
    gap: 12px;
}

.mode-btn {
    padding: 12px 22px;
    border: 2px solid white;
    border-radius: 10px;
    background-color: #222;
    color: white;
    font-weight: bold;
    cursor: pointer;
}

.mode-btn.selected {
    background-color: #00ff00;
    color: black;
}
.touch-btn {
    width: 70px;
    height: 70px;
    border: 1px solid white;
    border-radius: 12px;
    font-size: 24px;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.6);
    pointer-events: all;
    touch-action: none;
}

.touch-btn:active {
    background-color: rgba(255, 255, 255, 0.25);
}

/* タッチレイアウト配置 */
#upBtn { grid-column: 2 / 3; grid-row: 1 / 2; }
#leftBtn { grid-column: 1 / 2; grid-row: 2 / 3; }
#downBtn { grid-column: 2 / 3; grid-row: 2 / 3; }
#rightBtn { grid-column: 3 / 4; grid-row: 2 / 3; }

/* プレイヤー（操作キャラクター） */
.player {
    position: absolute;
    width: 30px;
    height: 30px;
    background-color: #00ff00;
    left: 180px;
    top: 540px;
    border-radius: 3px;
    z-index: 5;
}

/* 障害物のスタイル */
.obstacle {
    position: absolute;
    width: 28px;
    height: 28px;
    background-color: #ff0000;
    border-radius: 3px;
}

/* 追尾障害物のスタイル */
.obstacle.homing {
    background-color: #0000ff;
}

.obstacle.homing.ultra-fast {
    background-color: #66b3ff;
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: none;
}

/* 反射障害物のスタイル */
.obstacle.reflective {
    background-color: #ffff00;
    border: 2px solid #ffffff;
    box-shadow: 0 0 20px #ffff00;
}

.hard-mode-item {
    position: absolute;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid #fff;
    background: radial-gradient(circle, #fff8d6 0%, #ffcc66 45%, #ff5a00 100%);
    box-shadow: 0 0 16px rgba(255, 120, 0, 0.95);
    z-index: 6;
    animation: hardModeItemPulse 0.6s infinite alternate;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 18px;
    font-weight: 900;
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

@keyframes hardModeItemPulse {
    from {
        transform: scale(0.95);
        box-shadow: 0 0 10px rgba(255, 120, 0, 0.8);
    }
    to {
        transform: scale(1.12);
        box-shadow: 0 0 22px rgba(255, 80, 0, 1);
    }
}

.hard-mode-countdown {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 40, 40, 0.95);
    border: 2px solid #fff;
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.04em;
    box-shadow: 0 0 16px rgba(255, 90, 90, 0.8);
}

.hard-mode-countdown.hidden {
    display: none !important;
}

/* ゲームオーバー画面 */
.game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

/* ゲームオーバーのコンテンツ */
.game-over-content {
    text-align: center;
    width: 340px;
    max-height: 90%;
    overflow-y: auto;
    padding: 10px 0;
}

/* ゲームオーバー画面の見出し */
.game-over-content h1 {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ff0000;
}

/* ゲームオーバー画面の説明文 */
.game-over-content p {
    /* 文字サイズ */
    font-size: 24px;
    /* マージン */
    margin-bottom: 30px;
}

/* リスタートボタン */
.restart-btn {
    font-size: 18px;
    padding: 15px 40px;
    background-color: #00ff00;
    color: #000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.3s;
}

.restart-btn:hover {
    background-color: #00cc00;
    transform: scale(1.1);
}

.ranking-panel {
    margin-top: 24px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.35);
    text-align: left;
}

.ranking-panel h2 {
    font-size: 20px;
    margin-bottom: 12px;
    text-align: center;
}

.ranking-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.ranking-tab {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    font-weight: bold;
}

.ranking-tab.active {
    background: #00b7ff;
    color: #001018;
}

.ranking-form {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.player-name-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    outline: none;
}

.player-name-input::placeholder {
    color: rgba(255, 255, 255, 0.55);
}

.ranking-submit-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    background: #00b7ff;
    color: #001018;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
    white-space: nowrap;
}

.ranking-submit-btn:hover {
    background: #4cc8ff;
}

.ranking-submit-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.ranking-status {
    min-height: 20px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #c8d6e0;
}

.ranking-period {
    margin: 0 0 10px;
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: #c8d6e0;
}

.leaderboard-list {
    list-style: decimal;
    padding-left: 20px;
    margin: 0;
    display: grid;
    gap: 8px;
}

.leaderboard-list li {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 14px;
    line-height: 1.4;
}

.leaderboard-meta {
    display: block;
    margin-top: 4px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* 難易度選択画面 */
.difficulty-select-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.difficulty-select-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.difficulty-select-content h1 {
    font-size: 32px;
    color: #fff;
    margin-bottom: 6px;
}

.difficulty-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.difficulty-select-btn {
    font-size: 22px;
    padding: 20px 34px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 800;
    transition: 0.25s;
    min-width: 132px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.easy-btn {
    background-color: #00cc00;
    color: #000;
}

.easy-btn:hover {
    transform: scale(1.04);
}

.hard-btn {
    background-color: #ff6600;
    color: #fff;
}

.hard-btn:hover {
    transform: scale(1.04);
}

.difficulty-description {
    font-size: 18px;
    color: #aaa;
    min-height: 24px;
}

.ranking-btn {
    align-self: center;
    padding: 10px 18px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    transition: 0.2s;
}

.ranking-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* パッチノートボタン */
.patch-note-btn {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    z-index: 210;
    transition: 0.2s;
}

.patch-note-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* パッチノート画面 */
.patch-note-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.patch-note-content {
    text-align: center;
    width: 340px;
    max-height: 90%;
    overflow-y: auto;
    padding: 10px 0;
}

.patch-note-content h1 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #fff;
}

.patch-note-list {
    text-align: left;
    margin-bottom: 24px;
}

.patch-note-item {
    padding: 14px 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    margin-bottom: 12px;
}

.patch-note-date {
    font-size: 13px;
    font-weight: bold;
    color: #c8d6e0;
    margin-bottom: 6px;
}

.patch-note-text {
    font-size: 15px;
    color: #fff;
    line-height: 1.6;
}

.close-patch-note-btn {
    font-size: 18px;
    padding: 12px 36px;
    background-color: #00ff00;
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.close-patch-note-btn:hover {
    background-color: #00cc00;
    transform: scale(1.05);
}

/* 音量設定ボタン */
.volume-settings-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    z-index: 210;
    transition: 0.2s;
}

.volume-settings-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

/* 音量設定画面 */
.volume-settings-screen,
.ranking-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.volume-settings-content,
.ranking-screen-content {
    text-align: center;
    width: 340px;
    max-height: 90%;
    overflow-y: auto;
    padding: 20px 0;
}

.volume-settings-content h1 {
    font-size: 32px;
    margin-bottom: 30px;
    color: #fff;
}

.volume-control {
    margin-bottom: 24px;
    padding: 16px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
}

.volume-control label {
    display: block;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    margin-bottom: 12px;
}

.volume-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #00ff00;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #00ff00;
    cursor: pointer;
    border: none;
}

.volume-control span {
    display: block;
    margin-top: 10px;
    font-size: 18px;
    font-weight: bold;
    color: #c8d6e0;
}

.close-volume-settings-btn {
    font-size: 18px;
    padding: 12px 36px;
    background-color: #00ff00;
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
    margin-top: 10px;
}

.close-volume-settings-btn:hover {
    background-color: #00cc00;
    transform: scale(1.05);
}

.ranking-screen-content h1 {
    font-size: 32px;
    margin-bottom: 20px;
    color: #fff;
}

.ranking-mode-tabs,
.ranking-period-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.ranking-mode-tab,
.ranking-period-tab {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    font-weight: bold;
}

.ranking-mode-tab.active,
.ranking-period-tab.active {
    background: #00b7ff;
    color: #001018;
}

.ranking-screen-period {
    margin: 0 0 10px;
    text-align: center;
    font-size: 13px;
    font-weight: bold;
    color: #c8d6e0;
}

.ranking-screen-list {
    list-style: decimal;
    padding-left: 20px;
    margin: 0 0 16px;
    display: grid;
    gap: 8px;
    text-align: left;
}

.ranking-screen-list li {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 14px;
    line-height: 1.4;
}

.close-ranking-btn {
    font-size: 18px;
    padding: 12px 36px;
    background-color: #00ff00;
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: 0.2s;
}

.close-ranking-btn:hover {
    background-color: #00cc00;
    transform: scale(1.05);
}

/* 最終更新日時表示 */
.last-update-display {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border: 1px solid white;
    font-size: 12px;
    font-weight: bold;
    color: #c8d6e0;
    z-index: 10;
    border-radius: 5px;
}

/* 非表示クラス（最初はゲームオーバー画面を隠す） */
.hidden {
    /* 非表示にする */
    display: none !important;
}
