body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #ff9a8b, #fad0c4);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

/* 認証画面スタイル */
.auth-section {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 30px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.auth-container h2 {
    color: #ff6b6b;
    margin-bottom: 10px;
    font-size: 2em;
}

.auth-container p {
    color: #666;
    margin-bottom: 20px;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid #eee;
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    transition: all 0.3s ease;
}

.auth-tab.active {
    color: #ff6b6b;
    border-bottom: 2px solid #ff6b6b;
}

.auth-form {
    text-align: left;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #333;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #ff6b6b;
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #ff6b6b, #ff8a80);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.auth-btn:hover {
    transform: translateY(-2px);
}

.auth-note {
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    text-align: center;
}

.auth-message {
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
    text-align: center;
}

.auth-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.auth-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.auth-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.guest-btn {
    width: 100%;
    padding: 10px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 15px;
}

.guest-btn:hover {
    background: #5a6268;
}

/* ゲーム画面のユーザー情報 */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: #495057;
}

#logoutBtn {
    padding: 5px 10px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
}

#logoutBtn:hover {
    background: #c82333;
}

/* モーダルスタイル */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 15px;
    padding: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.modal-header h2 {
    margin: 0;
    color: #ff6b6b;
}

.close {
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

/* ランキングタブ */
.ranking-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.ranking-tab {
    flex: 1;
    padding: 10px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
}

.ranking-tab.active {
    color: #ff6b6b;
    border-bottom: 2px solid #ff6b6b;
}

/* ランキングリスト */
.rankings-list {
    min-height: 200px;
}

.ranking-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid #eee;
    transition: background-color 0.2s ease;
}

.ranking-item:hover {
    background-color: #f8f9fa;
}

.ranking-item.user-score {
    background-color: #e3f2fd;
    font-weight: bold;
}

.rank-number {
    font-weight: bold;
    color: #ff6b6b;
    min-width: 30px;
}

.rank-number.gold { color: #ffd700; }
.rank-number.silver { color: #c0c0c0; }
.rank-number.bronze { color: #cd7f32; }

.player-name {
    flex: 1;
    text-align: left;
    margin-left: 10px;
}

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

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

/* ゲーム終了モーダル */
.game-over-content {
    text-align: center;
}

.final-score {
    margin-bottom: 20px;
}

.final-score h3 {
    color: #ff6b6b;
    font-size: 1.5em;
    margin: 0;
}

#scoreSubmitSection {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.submit-score-btn {
    padding: 10px 20px;
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

.submit-score-btn:hover {
    transform: translateY(-1px);
}

.game-over-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.game-over-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

#playAgainBtn {
    background: #007bff;
    color: white;
}

#backToTitleFromGameOver {
    background: #6c757d;
    color: white;
}

/* 表示名変更モーダル */
.edit-name-content {
    text-align: left;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.form-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}

.cancel-btn {
    background: #6c757d;
    color: white;
}

.cancel-btn:hover {
    background: #5a6268;
}

#editNameBtn {
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

#editNameBtn:hover {
    opacity: 1;
}

.game-container {
    background: white;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 10px;
    text-align: center;
}

h1 {
    color: #ff6b6b;
    margin-bottom: 20px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
    gap: 20px;
}

.score-board {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px 10px;
    font-size: 1.2em;
    font-weight: bold;
    color: #495057;
    flex: 1;
}

.next-fruit {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 4px;
    text-align: center;
    min-width: 80px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.next-fruit:hover {
    background: #e9ecef;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.next-label {
    font-size: 0.9em;
    font-weight: bold;
    color: #495057;
    margin-bottom: 5px;
}

.next-display {
    font-size: 2em;
    line-height: 1;
    transition: opacity 0.3s ease;
    min-height: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-area {
    border: 3px solid #495057;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 4px;
    position: relative;
}

#gameCanvas {
    display: block;
    background: linear-gradient(to bottom, #87ceeb 0%, #98fb98 100%);
}

.game-controls {
    margin-bottom: 4px;
}

.game-controls button {
    background: #ff6b6b;
    color: white;
    border: none;
    padding: 4px 10px;
    margin: 0 4px;
    border-radius: 12px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.game-controls button:hover {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.game-controls button:active {
    transform: translateY(0);
}

.game-over {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 20px;
    border-radius: 10px;
    font-size: 1.5em;
    z-index: 10;
}

/* タイトル画面 */
.title-screen {
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    padding: 40px 20px;
    text-align: center;
    max-width: 500px;
    margin: 0 auto;
}

.title-screen h1 {
    color: #ff6b6b;
    margin-bottom: 20px;
    font-size: 3em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.title-version-info {
    font-size: 14px;
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
}

.title-user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: #f8f9fa;
    border-radius: 10px;
    min-height: 50px;
}

.title-user-display {
    flex: 1;
    text-align: left;
    font-weight: bold;
    color: #495057;
    font-size: 1.1em;
}

.title-logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.title-logout-btn:hover {
    background: #c82333;
}

.mode-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #ff6b6b, #ff8e8e);
    color: white;
    border: none;
    padding: 20px;
    margin: 15px 0;
    border-radius: 15px;
    font-size: 1.2em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    line-height: 1.4;
}

.mode-btn:hover {
    background: linear-gradient(135deg, #ff5252, #ff7575);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 107, 107, 0.4);
}

.mode-btn:active {
    transform: translateY(0);
}

.mode-desc {
    font-size: 0.8em;
    font-weight: normal;
    opacity: 0.9;
}

/* ランキングボタンのスタイル */
.rankings-btn {
    background: linear-gradient(135deg, #6c757d, #8e9198) !important;
    margin-top: 20px;
}

.rankings-btn:hover {
    background: linear-gradient(135deg, #5a6268, #7b7f86) !important;
}

/* タイマー表示（画面下部） */
.timer-display-bottom {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 10px 20px;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}


.timer-content {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
}

.timer-text {
    font-size: 1.5em;
    font-weight: bold;
    color: #dc3545;
    min-width: 80px;
    text-align: center;
}

.timer-bar-container {
    flex: 1;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.timer-bar {
    height: 100%;
    background: linear-gradient(90deg, #28a745 0%, #ffc107 50%, #dc3545 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 100%;
}

/* タイマー警告点滅アニメーション */
@keyframes timer-text-warning-slow {
    0%, 50% { color: #dc3545; }
    51%, 100% { color: #ff6b6b; }
}

@keyframes timer-text-warning-medium {
    0%, 50% { color: #dc3545; }
    51%, 100% { color: #ff6b6b; }
}

@keyframes timer-text-warning-fast {
    0%, 50% { color: #dc3545; }
    51%, 100% { color: #ff6b6b; }
}

@keyframes timer-bar-warning-slow {
    0%, 50% { background: #e9ecef; }
    51%, 100% { background: #f8d7da; }
}

@keyframes timer-bar-warning-medium {
    0%, 50% { background: #e9ecef; }
    51%, 100% { background: #f8d7da; }
}

@keyframes timer-bar-warning-fast {
    0%, 50% { background: #e9ecef; }
    51%, 100% { background: #f8d7da; }
}

.timer-text-warning-slow {
    animation: timer-text-warning-slow 0.6s infinite;
}

.timer-text-warning-medium {
    animation: timer-text-warning-medium 0.3s infinite;
}

.timer-text-warning-fast {
    animation: timer-text-warning-fast 0.15s infinite;
}

.timer-bar-warning-slow {
    animation: timer-bar-warning-slow 0.6s infinite;
}

.timer-bar-warning-medium {
    animation: timer-bar-warning-medium 0.3s infinite;
}

.timer-bar-warning-fast {
    animation: timer-bar-warning-fast 0.15s infinite;
}

/* ゲーム終了メッセージ */
.game-end-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 4em;
    font-weight: bold;
    text-align: center;
    padding: 40px 60px;
    border-radius: 20px;
    z-index: 1000;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: none;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.game-end-message.show {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}