/* 開始画面など、各種画面のレイアウト */
.game-over, .start-screen, .pause-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
    border: 2px solid rgba(255, 255, 255, 0.3);
    max-width: 90vw;
}

.start-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 20px;  /* 30px から 20px に変更 */
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
    border: 2px solid rgba(255, 255, 255, 0.3);
    max-width: 90vw;
    max-height: 100%;  /* 追加 */
    overflow-y: auto;  /* 追加 */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.start-screen h2 {
    margin: 0 0 10px 0;
    font-size: 2.5em;
    background: linear-gradient(90deg, #ff4444 0%, #4488ff 50%, #ffdd44 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.start-screen .game-title {
    margin: 0 0 10px 0;
    font-size: 2.5em;
    background: linear-gradient(90deg, #ff4444 0%, #4488ff 50%, #ffdd44 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.start-screen .game-subtitle {
    margin: 0 0 20px 0;
    font-size: 1.1em;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    letter-spacing: 1px;
}

.start-screen .game-description {
    margin-bottom: 25px;
    font-size: 1.1em;
    line-height: 1.6;
}

/* タイトルとゲームスタートボタンを囲むコンテナ */
.title-game-container {
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
}


.game-start-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2em;
    font-weight: bold;
    margin: 0 0 15px 0;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* スタート画面の音声ボタン */
.game-start-section .audio-btn {
    margin: 0 5px 0 5px; /* 左右にわずかなマージン */
    font-size: 0.9em; /* 少し小さめのフォントサイズ */
}

.game-start-section .audio-btn + .audio-btn {
    margin-left: 10px; /* 音声ボタン同士の間隔 */
}

/* スタートボタンのコンテナ */
.start-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    margin-top: 20px; /* 音声ボタンとの間にマージンを追加 */
}

.start-btn {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border: none;
    padding: 15px 30px;
    border-radius: 30px;
    color: white;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    min-width: 200px;
}

.start-screen .start-btn + .start-btn {
    margin-top: 0; /* 変更: 25px から 0 へ（gapで管理するため） */
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 25px rgba(0, 0, 0, 0.4);
}

.game-over, .pause-screen {
    display: none;
}

.pause-screen h2 {
    margin: 0 0 20px 0;
    font-size: 2em;
    color: #4ecdc4;
}

/* --- ランキング画面のスタイル（旧バージョン - コメントアウト） --- */
/*
.ranking-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 90vw;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    display: none;
    box-sizing: border-box;
}

.ranking-screen .close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: white;
    font-size: 30px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
}

.ranking-screen .close-btn:hover {
    color: #ff6b6b;
}

.ranking-tabs {
    margin: 20px 0;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.tab-btn {
    background: rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    color: #fff;
    padding: 8px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: rgba(255,255,255,0.1);
}

.tab-btn.active {
    background: #4ecdc4;
    color: #222;
    font-weight: bold;
}

.ranking-list {
    margin: 20px 0 10px;
    padding: 0;
    text-align: left;
}

.ranking-item {
    display: grid;
    grid-template-columns: 35px 1fr 75px 80px;
    gap: 15px;
    padding: 12px 5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    align-items: center;
}

.ranking-item:last-child {
    border-bottom: none;
}

.ranking-item .rank   { order: 1; }
.ranking-item .player { order: 2; }
.ranking-item .score  { order: 3; }
.ranking-item .date   { order: 4; }

.ranking-item .rank {
    text-align: center;
    font-weight: bold;
    font-size: 1.1em;
}

.ranking-item .player {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ranking-item .score {
    text-align: right;
    font-weight: bold;
    color: #4ecdc4;
}

.ranking-item .date {
    text-align: right;
    font-size: 0.9em;
    opacity: 0.7;
}

.ranking-item:nth-child(1) .rank { color: #ffd700; }
.ranking-item:nth-child(2) .rank { color: #c0c0c0; }
.ranking-item:nth-child(3) .rank { color: #cd7f32; }

.ranking-item.authenticated-user {
    background: rgba(0, 123, 255, 0.1);
    border-left: 3px solid #007bff;
}

.ranking-item.authenticated-user .player {
    color: #007bff;
    font-weight: 600;
}

.ranking-item.authenticated-user .player::after {
    content: " ✓";
    color: #28a745;
    font-size: 0.9em;
}
*/

/* --- 新しいランキング画面のスタイル（マイスコア画面と同様） --- */
.ranking-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1500;
    display: none;
}

.ranking-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.ranking-modal {
    background: rgba(0, 0, 0, 0.95);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.ranking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.ranking-header h2 {
    margin: 0;
    color: white;
    font-size: 1.8em;
    background: linear-gradient(90deg, #ff4444 0%, #4488ff 50%, #ffdd44 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ranking-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.ranking-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ranking-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
}

/* ランキングフィルター機能 */
.ranking-filters {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.ranking-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ranking-filters .filter-group label {
    color: white;
    font-size: 0.9em;
    font-weight: bold;
}

.ranking-filters .filter-group select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: white;
    padding: 5px 8px;
    font-size: 0.9em;
}

.ranking-filters .filter-group select option {
    background: #333;
    color: white;
}

.ranking-filters .filter-refresh-btn {
    background: rgba(68, 136, 255, 0.8);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.ranking-filters .filter-refresh-btn:hover {
    background: rgba(68, 136, 255, 1);
}

/* ランキングローディング表示 */
.ranking-loading {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

.ranking-loading .loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4488ff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

/* ランキングエラー表示 */
.ranking-error {
    text-align: center;
    padding: 30px 20px;
    color: #ff6b6b;
}

.ranking-error .error-message {
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* ランキング一覧 */
.ranking-list-container {
    position: relative;
}

.ranking-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.ranking-empty p {
    margin: 8px 0;
    line-height: 1.5;
}

.ranking-table-container {
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.ranking-table th,
.ranking-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-table th {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ranking-table td {
    color: rgba(255, 255, 255, 0.9);
}

.ranking-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ランキング行の特別スタイル */
.ranking-rank {
    font-weight: bold;
    color: #ffdd44;
    text-align: center;
}

.ranking-username {
    font-weight: bold;
}

.ranking-username.authenticated {
    color: #007bff;
}

.ranking-score {
    font-weight: bold;
    color: #4488ff;
    text-align: right;
}

.ranking-date {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
    text-align: center;
}

/* 1位から3位の特別なスタイル */
.ranking-table tbody tr:nth-child(1) .ranking-rank { color: #ffd700; } /* Gold */
.ranking-table tbody tr:nth-child(2) .ranking-rank { color: #c0c0c0; } /* Silver */
.ranking-table tbody tr:nth-child(3) .ranking-rank { color: #cd7f32; } /* Bronze */


/* スコア登録画面のスタイル */
.score-submit-screen {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 300px;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    z-index: 1000;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: none;
}

/* 最終スコア表示のリッチなスタイル */
.final-score-display {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, rgba(255, 68, 68, 0.2), rgba(68, 136, 255, 0.2));
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.final-score-label {
    font-size: 1.2em;
    color: #ccc;
    margin-bottom: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.final-score-value {
    font-size: 3em;
    font-weight: bold;
    background: linear-gradient(90deg, #ff4444 0%, #4488ff 50%, #ffdd44 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
    0% {
        filter: brightness(1);
        transform: scale(1);
    }
    100% {
        filter: brightness(1.2);
        transform: scale(1.05);
    }
}

.ranking-btn {
    background: linear-gradient(135deg, #4ecdc4, #44a08d);
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

/* メニューボタンエリア */
.menu-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
}

.auth-only-buttons {
    display: flex;
    flex-direction: row;
    gap: 15px;
    margin-top: 10px;
}

.my-score-btn, .achievements-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    color: white;
    font-size: 1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 100px;
}

.my-score-btn:hover, .achievements-btn:hover {
    background: linear-gradient(135deg, #0056b3, #003f7f);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
}

.achievements-btn {
    background: linear-gradient(135deg, #28a745, #1e7e34);
}

.achievements-btn:hover {
    background: linear-gradient(135deg, #1e7e34, #155724);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* 認証画面のスタイル */
.auth-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1200;
}

.auth-container {
    background: rgba(20, 20, 30, 0.95);
    border-radius: 15px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

.auth-container .close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.auth-container .close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* 認証タブ */
.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-tab {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.3s;
    font-size: 16px;
    border-bottom: 2px solid transparent;
}

.auth-tab.active {
    color: #4ecdc4;
    border-bottom-color: #4ecdc4;
}

.auth-tab:hover {
    color: #fff;
}

/* 認証フォーム */
.auth-form {
    animation: fadeIn 0.3s ease;
}

.auth-form h3 {
    margin: 0 0 25px 0;
    color: #fff;
    text-align: center;
    font-size: 24px;
}

.auth-form .input-group {
    margin-bottom: 20px;
}

.auth-form input {
    width: 100%;
    padding: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 16px;
    transition: border-color 0.3s;
    box-sizing: border-box;
}

.auth-form input:focus {
    outline: none;
    border-color: #4ecdc4;
}

.auth-form input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* 認証エラー表示 */
.auth-error {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid #ff6b6b;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
    color: #ff6b6b;
    font-size: 14px;
    display: none;
}

.auth-error.show {
    display: block;
    animation: slideDown 0.3s ease;
}

/* 認証ボタン */
.auth-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #4ecdc4, #45b7d1);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.auth-btn:hover {
    background: linear-gradient(45deg, #45b7d1, #4ecdc4);
    transform: translateY(-2px);
}

.auth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 認証説明文 */
.auth-description {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    line-height: 1.5;
    text-align: center;
}

.auth-description p {
    margin: 5px 0;
}

/* ローディング表示 */
.auth-loading {
    display: none;
    text-align: center;
    padding: 30px 0;
}

.auth-loading.show {
    display: block;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top: 4px solid #4ecdc4;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.auth-loading p {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

/* スタート画面の認証状態表示 */
.auth-status {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-user-info {
    text-align: center;
    color: #fff;
    font-size: 16px;
}

.auth-welcome {
    color: rgba(255, 255, 255, 0.8);
}

.auth-username {
    color: #4ecdc4;
    font-weight: bold;
    margin: 0 5px;
}

.auth-logout-btn {
    background: rgba(255, 107, 107, 0.8);
    border: none;
    color: white;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    margin-left: 15px;
    transition: background-color 0.3s;
}

.auth-logout-btn:hover {
    background: rgba(255, 107, 107, 1);
}

.auth-login-prompt {
    text-align: center;
}

.auth-login-btn {
    background: linear-gradient(45deg, #4ecdc4, #45b7d1);
    border: none;
    color: white;
    padding: 12px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

.auth-login-btn:hover {
    background: linear-gradient(45deg, #45b7d1, #4ecdc4);
    transform: translateY(-2px);
}

.auth-guest-text {
    color: rgba(255, 255, 255, 0.6);
    margin: 0 10px;
    font-size: 14px;
}

.auth-guest-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.auth-guest-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* ===================================
   認証メニュー（ヘッダードロップダウン）
   =================================== */

.auth-menu {
    position: absolute;
    top: 50px;
    left: 15px;
    background: rgba(0, 0, 0, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 8px 0;
    min-width: 180px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    animation: fadeInSlideDown 0.2s ease-out;
}

.auth-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-size: 0.9em;
}

.auth-menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.auth-menu-icon {
    font-size: 1.1em;
    width: 20px;
    text-align: center;
}

.auth-menu-text {
    color: white;
    font-weight: 500;
}

.auth-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
    margin: 5px 0;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 100px; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeInSlideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =================================== */
/* マイスコア履歴画面のスタイル           */
/* =================================== */

.my-scores-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1500;
    display: none;
}

.my-scores-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

.my-scores-modal {
    background: rgba(0, 0, 0, 0.95);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.my-scores-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.my-scores-header h2 {
    margin: 0;
    color: white;
    font-size: 1.8em;
    background: linear-gradient(90deg, #ff4444 0%, #4488ff 50%, #ffdd44 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.my-scores-close-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
}

.my-scores-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.my-scores-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px;
}

/* フィルター機能 */
.my-scores-filters {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    color: white;
    font-size: 0.9em;
    font-weight: bold;
}

.filter-group select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: white;
    padding: 5px 8px;
    font-size: 0.9em;
}

.filter-group select option {
    background: #333;
    color: white;
}

.filter-refresh-btn {
    background: rgba(68, 136, 255, 0.8);
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.filter-refresh-btn:hover {
    background: rgba(68, 136, 255, 1);
}

/* 統計情報 */
.my-scores-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 16px;
    text-align: center;
    flex: 1;
    min-width: 120px;
}

.stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.85em;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    color: white;
    font-size: 1.4em;
    font-weight: bold;
}

/* ローディング表示 */
.my-scores-loading {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

.my-scores-loading .loading-spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #4488ff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px auto;
}

/* エラー表示 */
.my-scores-error {
    text-align: center;
    padding: 30px 20px;
    color: #ff6b6b;
}

.error-message {
    margin-bottom: 15px;
    font-size: 1.1em;
}

/* スコア一覧 */
.my-scores-list {
    position: relative;
}

.my-scores-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.my-scores-empty p {
    margin: 8px 0;
    line-height: 1.5;
}

.my-scores-table-container {
    overflow-x: auto;
}

.my-scores-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

.my-scores-table th,
.my-scores-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.my-scores-table th {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: bold;
    position: sticky;
    top: 0;
    z-index: 10;
}

.my-scores-table td {
    color: rgba(255, 255, 255, 0.9);
}

.my-scores-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* スコア行の特別スタイル */
.score-rank {
    font-weight: bold;
    color: #ffdd44;
}

.score-value {
    font-weight: bold;
    color: #4488ff;
}

.score-mode {
    background: rgba(68, 136, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.85em;
}

.score-date {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}

/* =================================== */
/* 実績画面のスタイル                  */
/* =================================== */

.achievements-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1500;
    display: none;
    background: rgba(0, 0, 0, 0.8);
    overflow-y: auto;
    padding: 0; /* パディングをリセット */
}

.achievements-screen::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: -1;
}

.achievements-screen > * {
    position: relative;
    z-index: 1;
}

.achievements-screen h2 {
    text-align: center;
    margin: 20px 0;
    color: white;
    font-size: 2.2em;
    background: linear-gradient(90deg, #ff4444 0%, #4488ff 50%, #ffdd44 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding: 0 20px; /* 左右に統一されたパディングを追加 */
}

.achievements-screen .close-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s ease;
    z-index: 1600;
}

.achievements-screen .close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* 実績統計情報 */
.achievements-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin: 20px 0;
    flex-wrap: wrap;
    padding: 0 20px;
}

.achievements-stats .stat-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px 20px;
    text-align: center;
    min-width: 120px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.achievements-stats .stat-label {
    display: block;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
    margin-bottom: 5px;
}

.achievements-stats .stat-value {
    display: inline-block;
    color: #ffdd44;
    font-size: 1.5em;
    font-weight: bold;
    margin-right: 3px;
}

.achievements-stats .stat-unit {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.9em;
}

/* 実績フィルター */
.achievements-filters {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
    padding: 0 20px;
}

.achievements-filters .filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.achievements-filters label {
    color: white;
    font-size: 0.9em;
    white-space: nowrap;
}

.achievements-filters select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: white;
    padding: 8px 12px;
    font-size: 0.9em;
    min-width: 100px;
}

.achievements-filters select:focus {
    outline: none;
    border-color: #4488ff;
    box-shadow: 0 0 0 2px rgba(68, 136, 255, 0.3);
}

.achievements-filters select option {
    background: #333;
    color: white;
}

/* ローディング・エラー表示 */
.achievements-loading,
.achievements-error {
    text-align: center;
    padding: 40px 20px;
    color: white;
}

.achievements-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #4488ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.achievements-error {
    display: none;
}

.achievements-error .error-message {
    color: #ff4444;
    margin-bottom: 20px;
}

.achievements-error .btn {
    background: rgba(68, 136, 255, 0.8);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

.achievements-error .btn:hover {
    background: rgba(68, 136, 255, 1);
}

/* 実績一覧 */
.achievements-list {
    padding: 0 20px 20px 20px; /* 左右のパディングを明確に指定 */
    max-width: 1000px;
    margin: 0 auto;
}

.achievements-empty {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.7);
}

.achievements-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    padding: 0; /* コンテナ自体のパディングは不要 */
}

/* 実績アイテム */
.achievement-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.achievement-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.achievement-item.achieved {
    border-color: #ffdd44;
    background: linear-gradient(135deg, rgba(255, 221, 68, 0.1) 0%, rgba(255, 255, 255, 0.1) 100%);
}

.achievement-item.achieved::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ffdd44, #ff4444);
}

.achievement-item.not-achieved {
    opacity: 0.6;
}

.achievement-header {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.achievement-icon {
    font-size: 2em;
    margin-right: 15px;
    filter: grayscale(0);
}

.achievement-item.not-achieved .achievement-icon {
    filter: grayscale(1);
    opacity: 0.5;
}

.achievement-info {
    flex: 1;
}

.achievement-title {
    color: white;
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 5px;
}

.achievement-category {
    background: rgba(68, 136, 255, 0.3);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    text-transform: uppercase;
    font-weight: bold;
}

.achievement-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9em;
    line-height: 1.4;
    margin-bottom: 15px;
}

.achievement-progress {
    margin-bottom: 10px;
}

.achievement-progress-bar {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    height: 6px;
    overflow: hidden;
    margin-top: 5px;
}

.achievement-progress-fill {
    background: linear-gradient(90deg, #4488ff, #ffdd44);
    height: 100%;
    border-radius: 10px;
    transition: width 0.3s ease;
}

.achievement-progress-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.8em;
    margin-top: 5px;
}

.achievement-reward {
    color: #ffdd44;
    font-size: 0.85em;
    font-weight: bold;
}

.achievement-date {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75em;
    margin-top: 10px;
}

.achievement-status {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8em;
}

.achievement-status.achieved {
    background: #ffdd44;
    color: #333;
}

.achievement-status.not-achieved {
    background: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.5);
}

/* 戻るボタン */
.achievements-screen .back-btn {
    display: block;
    margin: 20px auto 40px;
    background: rgba(68, 136, 255, 0.8);
    border: none;
    color: white;
    padding: 12px 30px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    transition: all 0.3s ease;
    text-decoration: none;
    max-width: 1000px; /* 他の要素と同じ最大幅 */
    width: calc(100% - 40px); /* 左右20pxずつのマージンを考慮 */
}

.achievements-screen .back-btn:hover {
    background: rgba(68, 136, 255, 1);
    transform: translateY(-1px);
}

/* ===== 実績達成通知システム ===== */

.achievement-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.5s ease-in-out;
    opacity: 0;
    pointer-events: none;
}

.achievement-notification.show {
    transform: translateX(0);
    opacity: 1;
    animation: achievement-bounce 0.6s ease-out;
}

.achievement-notification.hide {
    transform: translateX(100%);
    opacity: 0;
}

@keyframes achievement-bounce {
    0% {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translateX(-10px) scale(1.05);
        opacity: 1;
    }
    100% {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

.achievement-notification-content {
    background: linear-gradient(135deg, #ffdd44 0%, #ff8844 100%);
    border-radius: 15px;
    padding: 15px 20px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 280px;
    position: relative;
    overflow: hidden;
}

.achievement-notification-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: achievement-shine 2s ease-in-out;
}

@keyframes achievement-shine {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.achievement-notification-icon {
    font-size: 2.5em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: achievement-icon-pulse 1.5s ease-in-out infinite;
}

@keyframes achievement-icon-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

.achievement-notification-text {
    flex: 1;
    color: #333;
}

.achievement-notification-title {
    font-size: 1.1em;
    font-weight: bold;
    margin-bottom: 3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.achievement-notification-name {
    font-size: 0.9em;
    opacity: 0.9;
    font-weight: 500;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .achievement-notification {
        top: 15px;
        right: 15px;
        left: 15px;
        transform: translateY(-100%);
    }
    
    .achievement-notification.show {
        transform: translateY(0);
    }
    
    .achievement-notification.hide {
        transform: translateY(-100%);
    }
    
    @keyframes achievement-bounce {
        0% {
            transform: translateY(-100%) scale(0.8);
            opacity: 0;
        }
        50% {
            transform: translateY(-10px) scale(1.05);
            opacity: 1;
        }
        100% {
            transform: translateY(0) scale(1);
            opacity: 1;
        }
    }
    
    .achievement-notification-content {
        min-width: auto;
        padding: 12px 15px;
    }
    
    .achievement-notification-icon {
        font-size: 2em;
    }
    
    .achievement-notification-title {
        font-size: 1em;
    }
    
    .achievement-notification-name {
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .achievement-notification {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .achievement-notification-content {
        padding: 10px 12px;
        gap: 10px;
    }
    
    .achievement-notification-icon {
        font-size: 1.8em;
    }
    
    .achievement-notification-title {
        font-size: 0.9em;
    }
    
    .achievement-notification-name {
        font-size: 0.8em;
    }
}

/* モバイル端末でのタイトルゲームコンテナの調整 */
@media (max-width: 480px) {
    .title-game-container {
        padding: 20px 15px;
        margin-bottom: 15px;
    }
    
    .game-start-label {
        font-size: 1.1em;
        margin-bottom: 12px;
    }
    
    .start-buttons {
        gap: 12px;
    }
    
    .start-btn {
        padding: 12px 25px;
        font-size: 1.2em;
        min-width: 180px;
    }
    
    .start-screen .game-title {
        font-size: 2.2em;
    }
    
    .start-screen .game-subtitle {
        font-size: 1em;
        margin-bottom: 15px;
    }
}

/* ===== エンド ===== */
