/* 全体的なボックスサイジング設定 */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    /* LINEブラウザでの横スクロール対策 */
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

.screen {
    display: none;
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* 年齢層選択画面 */
#ageSelectScreen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    /* LINEブラウザ対応 */
    width: 100%;
    max-width: 100vw;
}

#ageSelectScreen.active {
    display: flex;
    align-items: center;
    justify-content: center;
    /* 中央配置を確実にする */
    padding: 0;
    margin: 0;
}

#ageSelectScreen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: float 20s linear infinite;
    /* 背景を中央から開始 */
    background-position: center center;
}

.age-select-container {
    position: relative;
    z-index: 10;
    text-align: center;
    width: 100%;
    max-width: 800px;
    padding: 20px;
    /* 中央配置を確実にする */
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.age-select-content {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    margin: 0 auto;
    /* 幅を明確に指定 */
    width: 100%;
    max-width: 100%;
    /* 左右のスペースを統一 */
    position: relative;
}

.age-select-content h2 {
    color: #40CFFF;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(64, 207, 255, 0.5);
}

.age-description {
    font-size: 1.2rem;
    margin-bottom: 40px;
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
}

.age-button-container {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin: 40px 0;
    flex-wrap: wrap;
}

.age-button {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 20px;
    padding: 30px 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    text-align: center;
    min-width: 200px;
    backdrop-filter: blur(5px);
    position: relative;
    overflow: hidden;
}

.age-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.age-button:hover::before {
    left: 100%;
}

.age-button:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.age-button.senior-child:hover {
    border-color: rgba(76, 175, 80, 0.8);
    box-shadow: 0 10px 30px rgba(76, 175, 80, 0.3);
}

.age-button.adult:hover {
    border-color: rgba(255, 152, 0, 0.8);
    box-shadow: 0 10px 30px rgba(255, 152, 0, 0.3);
}

.age-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.age-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.age-subtitle {
    font-size: 1rem;
    opacity: 0.8;
    line-height: 1.4;
}

.age-note {
    background: rgba(64, 207, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin-top: 40px;
    border: 1px solid rgba(64, 207, 255, 0.2);
}

.age-note p {
    margin: 5px 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* 年齢選択画面のゲームをプレイボタン */
.age-select-play-button {
    width: 100%;
    max-width: 400px;
    margin: 30px auto 0;
    display: block;
    padding: 16px 32px;
    background: linear-gradient(135deg, #4ADE80, #60A5FA);
    color: white;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.4);
}

.age-select-play-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.5);
}

.age-select-play-button:active {
    transform: translateY(0);
}

/* タイマー設定エリア */
.timer-setting {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    margin: 30px 0 20px 0;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.timer-setting h3 {
    color: #40CFFF;
    font-size: 1.3rem;
    margin-bottom: 15px;
    text-align: center;
}

.timer-toggle-container {
    text-align: center;
}

.timer-toggle {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 1.1rem;
    color: white;
    margin-bottom: 10px;
}

.timer-toggle input {
    display: none;
}

.toggle-slider {
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 25px;
    position: relative;
    margin-right: 15px;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.timer-toggle input:checked + .toggle-slider {
    background: linear-gradient(135deg, #40CFFF, #5555FF);
    border-color: #40CFFF;
}

.timer-toggle input:checked + .toggle-slider::before {
    transform: translateX(30px);
}

.timer-toggle:hover .toggle-slider {
    box-shadow: 0 0 20px rgba(64, 207, 255, 0.3);
}

.timer-description {
    font-size: 0.9rem;
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.9);
    margin: 5px 0 0 0;
}

/* アカウント設定スタイル */
.account-setting {
    margin: 30px 0;
    padding: 25px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    border: 2px solid rgba(64, 207, 255, 0.3);
}

.account-setting h3 {
    color: #40CFFF;
    margin: 0 0 20px 0;
    font-size: 1.3rem;
    text-align: center;
}

.account-info {
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    text-align: center;
}

.account-status {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin: 5px 0;
}

.account-status.logged-in {
    color: #40CFFF;
}

.logout-button {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #FF4444, #CC0000);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
}

.logout-button:hover {
    background: linear-gradient(135deg, #CC0000, #990000);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 68, 68, 0.4);
}

.logout-button:active {
    transform: translateY(0);
}

/* 設定ボタンのスタイル */
.settings-btn {
    background: linear-gradient(135deg, #40CFFF, #5555FF) !important;
}

.settings-btn:hover {
    background: linear-gradient(135deg, #5555FF, #40CFFF) !important;
}

/* ゲーム紹介ボタンのスタイル */
.guide-btn {
    background: linear-gradient(135deg, #9b59b6, #8e44ad) !important;
}

.guide-btn:hover {
    background: linear-gradient(135deg, #8e44ad, #7d3c98) !important;
}

.contact-btn {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
}

.contact-btn:hover {
    background: linear-gradient(135deg, #5568d3, #6a3f8e) !important;
}

/* ========================================
   ようこそセクションのスタイル
   ======================================== */

.welcome-section {
    margin: 30px 0;
    width: 100%;
}

.welcome-title {
    color: #40CFFF;
    font-size: 2rem;
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 0 0 20px rgba(64, 207, 255, 0.5);
}

.welcome-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 特徴ボックス */
.feature-box {
    background: rgba(64, 207, 255, 0.1);
    border: 2px solid rgba(64, 207, 255, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.feature-box h3 {
    color: #40CFFF;
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    text-align: center;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.feature-list li {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 10px 0;
    padding-left: 10px;
}

.feature-list strong {
    color: #FFD700;
}

/* 遊び方ボックス */
.howto-box {
    background: rgba(255, 215, 0, 0.1);
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.howto-box h3 {
    color: #FFD700;
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    text-align: center;
}

.step-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.step-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 15px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.step-item:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(5px);
}

.step-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #FFD700;
    min-width: 35px;
}

.step-text {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.1rem;
}

/* おすすめボックス */
.recommend-box {
    background: rgba(147, 51, 234, 0.1);
    border: 2px solid rgba(147, 51, 234, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.recommend-box h3 {
    color: #C084FC;
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    text-align: center;
}

.recommend-text {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.05rem;
    line-height: 1.8;
    text-align: center;
}

/* ミニFAQボックス */
.mini-faq-box {
    background: rgba(34, 197, 94, 0.1);
    border: 2px solid rgba(34, 197, 94, 0.3);
    border-radius: 15px;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.mini-faq-box h3 {
    color: #4ADE80;
    font-size: 1.5rem;
    margin: 0 0 15px 0;
    text-align: center;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.faq-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.faq-item strong {
    color: #4ADE80;
    font-size: 0.95rem;
    display: block;
    margin-bottom: 5px;
}

.faq-item p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    margin: 0;
}

/* その他の特徴 */
.extra-features {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 15px;
    padding: 15px;
    text-align: center;
}

.extra-features p {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1.05rem;
    margin: 8px 0;
}

/* クリエイトモードボックス */
.create-mode-box {
    background: linear-gradient(135deg, rgba(74, 222, 128, 0.15), rgba(59, 130, 246, 0.15));
    border: 2px solid rgba(74, 222, 128, 0.3);
    border-radius: 15px;
    padding: 20px;
    margin-top: 20px;
}

.create-mode-box h3 {
    color: #4ADE80;
    font-size: 1.3rem;
    margin: 0 0 15px 0;
    text-align: center;
}

.create-intro {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 20px;
    text-align: center;
}

.create-intro strong {
    color: #4ADE80;
}

.create-rules {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 15px;
    margin: 15px 0;
}

.rules-title {
    color: #60A5FA;
    font-size: 1.05rem;
    font-weight: bold;
    margin: 0 0 12px 0;
    text-align: center;
}

.rule-steps {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.rule-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
}

.rule-number {
    background: #60A5FA;
    color: #000;
    font-weight: bold;
    font-size: 0.9rem;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rule-text {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
}

.rules-note {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
    text-align: center;
}

.create-feature {
    color: rgba(255, 255, 255, 0.95);
    font-size: 1rem;
    line-height: 1.6;
    margin: 15px 0 0 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border-left: 4px solid #4ADE80;
}

.create-feature strong {
    color: #4ADE80;
}

/* ★ゲーム紹介動画セクション */
.video-section {
    margin: 25px 0;
    padding: 25px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 15px;
    border: 2px solid rgba(64, 207, 255, 0.3);
}

.video-section h3 {
    color: #40CFFF;
    font-size: 1.5rem;
    margin: 0 0 12px 0;
    text-shadow: 0 0 10px rgba(64, 207, 255, 0.3);
}

.video-intro {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    margin: 0 0 20px 0;
    line-height: 1.6;
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 アスペクト比 */
    height: 0;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

.video-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
    margin: 15px 0 0 0;
    text-align: center;
    line-height: 1.5;
}

/* お問い合わせボタン */
.contact-box {
    margin-top: 20px;
    text-align: center;
}

.contact-button {
    display: inline-block;
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.contact-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.contact-button:active {
    transform: translateY(0);
}


/* ゲームサブタイトル */
.game-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1rem;
    text-align: center;
    margin-top: 10px;
    font-weight: 400;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .welcome-title {
        font-size: 1.6rem;
    }
    
    .feature-box h3,
    .howto-box h3,
    .recommend-box h3,
    .mini-faq-box h3 {
        font-size: 1.3rem;
    }
    
    .feature-list li {
        font-size: 1rem;
    }
    
    .step-text {
        font-size: 1rem;
    }
    
    .recommend-text {
        font-size: 0.95rem;
    }
    
    .faq-grid {
        grid-template-columns: 1fr;
    }
    
    .game-subtitle {
        font-size: 0.95rem;
    }
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    /* LINEブラウザ対応：全体のコンテナ調整 */
    .age-select-container {
        width: 100%;
        max-width: 100vw; /* ビューポート幅を超えないよう制限 */
        padding: 10px; /* 左右均等なパディング */
        box-sizing: border-box; /* パディングを幅に含める */
        margin: 0; /* マージンをリセット */
    }
    
    .age-select-content {
        padding: 20px 15px; /* 左右パディングを統一 */
        margin: 0 auto; /* 中央配置を確実にする */
        width: calc(100% - 0px); /* 左右のスペースを完全に統一 */
        max-width: 100%; /* 最大幅を制限 */
        box-sizing: border-box; /* パディングを幅に含める */
        /* 位置を中央に固定 */
        position: relative;
        left: 0;
        right: 0;
    }
    
    .age-select-content h2 {
        font-size: 1.8rem; /* フォントサイズを縮小 */
        margin-bottom: 15px;
        line-height: 1.2; /* 行間を調整 */
    }
    
    .age-description {
        font-size: 1rem; /* フォントサイズを縮小 */
        margin-bottom: 25px;
        padding: 0 5px; /* 左右に少しパディング */
    }
    
    .age-button-container {
        flex-direction: column;
        align-items: center;
        gap: 15px; /* ギャップを縮小 */
        margin: 20px 0; /* マージンを縮小 */
    }
    
    .age-button {
        min-width: 0; /* 最小幅を解除 */
        width: 100%; /* 幅を100%に設定 */
        max-width: 280px; /* 最大幅を設定 */
        padding: 20px 15px; /* パディングを調整 */
        box-sizing: border-box;
    }
    
    .age-icon {
        font-size: 2.2rem; /* アイコンサイズ調整 */
    }
    
    .age-title {
        font-size: 1.2rem; /* タイトルサイズ調整 */
    }
    
    .age-subtitle {
        font-size: 0.9rem; /* サブタイトルサイズ調整 */
    }
    
    /* タイマー設定エリアも調整 */
    .timer-setting {
        margin: 20px 0; /* マージンを縮小 */
        padding: 15px 10px; /* パディングを調整 */
    }
    
    .timer-setting h3 {
        font-size: 1.1rem; /* フォントサイズ調整 */
    }
    
    .age-note {
        margin-top: 20px; /* マージンを縮小 */
        padding: 15px 10px; /* パディングを調整 */
    }
    
    .age-note p {
        font-size: 0.8rem; /* フォントサイズを縮小 */
    }
}

/* 超小型デバイス・LINEブラウザ対応（480px以下） */
@media (max-width: 480px) {
    .age-select-container {
        padding: 8px; /* 均等なパディング */
        margin: 0 auto; /* 中央配置 */
    }
    
    .age-select-content {
        padding: 15px 12px; /* 左右パディングを均等に */
        border-radius: 15px; /* 角丸を少し縮小 */
        width: calc(100% - 0px); /* 幅を統一 */
        margin: 0 auto; /* 完全中央配置 */
    }
    
    .age-select-content h2 {
        font-size: 1.5rem; /* さらにフォントサイズ縮小 */
        margin-bottom: 10px;
    }
    
    .age-description {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .age-button {
        max-width: 260px; /* 最大幅をさらに制限 */
        padding: 18px 12px;
    }
    
    .age-icon {
        font-size: 2rem;
    }
    
    .age-title {
        font-size: 1.1rem;
    }
    
    .age-subtitle {
        font-size: 0.85rem;
    }
    
    .timer-setting {
        padding: 12px 8px;
        margin: 15px 0;
    }
    
    .timer-setting h3 {
        font-size: 1rem;
    }
    
    .age-note {
        padding: 12px 8px;
        margin-top: 15px;
    }
    
    .age-note p {
        font-size: 0.75rem;
    }
}

/* 極小型デバイス・LINEブラウザの狭い画面対応（360px以下） */
@media (max-width: 360px) {
    .age-select-container {
        padding: 6px; /* 最小限だが均等なパディング */
        margin: 0 auto;
    }
    
    .age-select-content {
        padding: 12px 10px; /* 左右パディングを均等に */
        width: calc(100% - 0px); /* 完全に統一された幅 */
        margin: 0 auto; /* 中央配置 */
    }
    
    .age-select-content h2 {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }
    
    .age-button {
        max-width: 240px;
        padding: 15px 10px;
    }
    
    .age-icon {
        font-size: 1.8rem;
    }
    
    .age-title {
        font-size: 1rem;
    }
    
    .age-subtitle {
        font-size: 0.8rem;
    }
}

/* PC大画面向けスタイル */
@media (min-width: 1024px) {
    .age-select-content {
        padding: 60px;
        max-width: 900px;
    }
    
    .age-select-content h2 {
        font-size: 3rem;
        margin-bottom: 30px;
    }
    
    .age-description {
        font-size: 1.4rem;
        margin-bottom: 50px;
    }
    
    .age-button-container {
        gap: 40px;
        margin: 50px 0;
    }
    
    .age-button {
        min-width: 220px;
        padding: 35px 30px;
    }
    
    .age-icon {
        font-size: 3.5rem;
        margin-bottom: 15px;
    }
    
    .age-title {
        font-size: 1.6rem;
        margin-bottom: 8px;
    }
    
    .age-subtitle {
        font-size: 1rem;
    }
    
    .timer-setting {
        padding: 30px;
        margin: 40px 0 30px 0;
    }
    
    .timer-setting h3 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .timer-toggle {
        font-size: 1.2rem;
    }
    
    .toggle-slider {
        width: 70px;
        height: 35px;
        margin-right: 20px;
    }
    
    .toggle-slider::before {
        width: 27px;
        height: 27px;
        top: 2px;
        left: 2px;
    }
    
    .timer-toggle input:checked + .toggle-slider::before {
        transform: translateX(35px);
    }
}

/* メインメニュー */
#mainMenu {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
    /* キャンバスの透過を防ぐ */
    z-index: 100;
}

/* 背景装飾 */
#mainMenu::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center center;
}

.title-container {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 30px 40px;
    border-radius: 20px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 90vw;
    width: auto;
    /* 中央配置を確実にする */
    margin-left: auto;
    margin-right: auto;
    position: relative;
    left: 0;
    right: 0;
}

.game-title {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: bold;
    color: #fff;
    text-shadow: 
        0 0 10px rgba(255, 255, 255, 0.8),
        0 0 20px rgba(64, 207, 255, 0.6),
        0 0 30px rgba(64, 207, 255, 0.4),
        0 0 40px rgba(64, 207, 255, 0.2);
    margin: 0;
    letter-spacing: clamp(2px, 2vw, 8px);
    text-align: center;
    background: linear-gradient(45deg, #fff, #40CFFF, #fff);
    background-size: 200% 200%;
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: glow 2s ease-in-out infinite alternate, shimmer 3s ease-in-out infinite;
    /* 省略表示を解除してタイトル全体を表示 */
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    /* 改行を許可 */
    word-break: keep-all;
    line-height: 1.1;
}

@keyframes glow {
    from { 
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.5), 0 0 20px rgba(64, 207, 255, 0.3), 0 0 30px rgba(64, 207, 255, 0.2);
    }
    to { 
        text-shadow: 0 0 20px rgba(255, 255, 255, 0.8), 0 0 30px rgba(64, 207, 255, 0.6), 0 0 40px rgba(64, 207, 255, 0.4);
    }
}

@keyframes shimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ★スマホ向けの調整 */
@media (max-width: 768px) {
    .screen.active {
        justify-content: flex-start !important;
    }
    
    #mainMenu {
        padding: 0 !important;
        justify-content: flex-start !important;
        align-items: stretch !important;
        transform: scale(0.75); /* ★表示倍率を75%に設定 */
        transform-origin: top center; /* ★倍率の基準点を画面上部中央に設定 */
    }
    
    /* メインメニューのタイトルのみ固定 */
    #mainMenu .title-container {
        position: fixed !important;
        top: 10px !important; /* ★タイトルを画面上部から10pxに配置（約1cm） */
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 8px 12px !important; /* パディングを少し増やす */
        background: rgba(0, 0, 0, 0.3) !important;
        backdrop-filter: blur(10px) !important;
        border-radius: 10px !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3) !important;
        z-index: 1000 !important;
        margin-bottom: 0 !important;
        width: auto !important;
        max-width: calc(100vw - 16px) !important; /* 余白を少し縮小 */
        /* 中央配置を確実にする */
        margin-left: 0 !important;
        margin-right: 0 !important;
        /* タイトル全体が収まるように */
        min-width: 280px !important;
    }
    
    /* 年齢選択画面のタイトルは固定しない */
    #ageSelectScreen .title-container {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        margin-bottom: 20px !important;
    }
    
    .game-title {
        font-size: 1.8rem !important; /* フォントサイズを少し縮小 */
        letter-spacing: 0.5px !important; /* 文字間隔を縮小 */
        text-align: center !important;
        margin: 0 !important;
        /* 省略表示を解除 */
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: keep-all !important;
        line-height: 1.1 !important;
    }
    
    .menu-content {
        margin-top: 100px !important; /* ★タイトルの下に余白を追加 */
        position: relative !important;
        z-index: 500 !important;
        /* 左右のスペースを統一 */
        width: calc(100vw - 20px) !important; /* 左右10pxずつの余白 */
        max-width: 400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
        left: 0 !important;
        right: 0 !important;
        /* パディングを調整 */
        padding: 25px 20px !important;
        box-sizing: border-box !important;
    }
    
    /* 終了画面とルール画面 */
    #endScreen {
        padding-top: 20px !important;
        justify-content: flex-start !important;
    }
    
    .end-content {
        margin-top: 20px !important;
    }
    
    #rulesScreen {
        padding-top: 20px !important;
        justify-content: flex-start !important;
    }
    
    .rules-content {
        margin-top: 20px !important;
    }
}

/* 超小型デバイス（480px以下）の調整 */
@media (max-width: 480px) {
    .title-container {
        top: 5px !important; /* ★さらに小さい画面では5pxに配置 */
        padding: 6px 10px !important; /* パディング調整 */
        max-width: calc(100vw - 12px) !important; /* 左右6pxずつの余白 */
        min-width: 260px !important; /* 最小幅を調整 */
    }

    .game-title {
        font-size: 1.6rem !important; /* さらにフォントサイズ縮小 */
        letter-spacing: 0.3px !important; /* 文字間隔をさらに縮小 */
        /* 省略表示を解除 */
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: keep-all !important;
        line-height: 1.1 !important;
    }

    .menu-content {
        margin-top: 80px !important; /* ★タイトルの下に余白を追加 */
    }
}

/* メニューコンテンツ */
.menu-content {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 30px 40px;
    border-radius: 20px;
    text-align: center;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 400px;
    width: 90%;
    /* 中央配置を確実にする */
    margin: 0 auto;
    position: relative;
    /* 左右のスペースを統一 */
    left: 0;
    right: 0;
}

.menu-content h2 {
    color: #fff;
    font-size: 2rem;
    margin-bottom: 20px;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* レベル選択 */
#levelSelect {
    width: 100%;
    padding: 15px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 18px;
    margin-bottom: 20px;
    backdrop-filter: blur(5px);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><polyline points="6,9 12,15 18,9"/></svg>');
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 20px;
}

#levelSelect:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(64, 207, 255, 0.5);
    box-shadow: 0 0 15px rgba(64, 207, 255, 0.3);
}

#levelSelect:focus {
    outline: none;
    border-color: #40CFFF;
    box-shadow: 0 0 20px rgba(64, 207, 255, 0.5);
}

#levelSelect option {
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 10px;
    font-size: 16px;
    border: none;
}

/* 設定 */
.settings {
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(5px);
}

.settings label {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.settings label:hover {
    color: #40CFFF;
}

.settings input[type="checkbox"] {
    margin-right: 10px;
    width: 20px;
    height: 20px;
    accent-color: #40CFFF;
    cursor: pointer;
}

/* ボタンコンテナ */
.button-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

/* メニューボタン */
.menu-button {
    background: linear-gradient(135deg, #40CFFF, #5555FF);
    color: white;
    font-size: 20px;
    font-weight: bold;
    padding: 15px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(64, 207, 255, 0.4);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.menu-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.menu-button:hover::before {
    left: 100%;
}

.menu-button:hover {
    background: linear-gradient(135deg, #5555FF, #40CFFF);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(64, 207, 255, 0.6);
}

.menu-button:active {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(64, 207, 255, 0.4);
}

/* 著作権表示 */
.copyright-notice {
    margin-top: 30px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
    text-align: center;
    line-height: 1.4;
}

.copyright-notice p {
    margin: 2px 0;
}

/* ルール画面 */
#rulesScreen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

.rules-content {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    width: 90%;
}

.rules-content h2 {
    color: #40CFFF;
    font-size: 1.3rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(64, 207, 255, 0.5);
}

.rules-text p {
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 15px 0;
    color: rgba(255, 255, 255, 0.9);
}

/* ゲーム画面 */
#gameScreen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 20px;
    position: relative;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 50%, #2c3e50 100%);
    min-height: 100vh;
}

#gameScreen.active {
    display: flex;
}

.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 10px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(52, 73, 94, 0.8));
    border-radius: 15px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 4px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 400px;
}

#timer {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    font-size: 20px;
    font-weight: bold;
    padding: 12px 24px;
    border-radius: 25px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    box-shadow: 
        0 4px 15px rgba(52, 152, 219, 0.3),
        inset 0 1px 3px rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.2);
    min-width: 120px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

#timer::before {
    content: '⏰';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    animation: tick 1s infinite;
}

@keyframes tick {
    0%, 50% { transform: translateY(-50%) scale(1); }
    25% { transform: translateY(-50%) scale(1.1); }
}

.small-button {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    color: white;
    font-size: 18px;
    font-weight: bold;
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    box-shadow: 
        0 4px 15px rgba(231, 76, 60, 0.3),
        inset 0 1px 3px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.small-button::before {
    content: '🚪';
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.small-button:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 20px rgba(231, 76, 60, 0.4),
        inset 0 1px 3px rgba(255, 255, 255, 0.2);
}

.small-button:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 8px rgba(231, 76, 60, 0.3),
        inset 0 1px 3px rgba(255, 255, 255, 0.2);
}

#gameCanvas {
    border: 4px solid #34495e;
    border-radius: 20px;
    background: linear-gradient(135deg, #ecf0f1 0%, #d5dbdb 50%, #bdc3c7 100%);
    box-shadow: 
        0 15px 40px rgba(0, 0, 0, 0.2),
        inset 0 2px 8px rgba(255, 255, 255, 0.6),
        inset 0 -2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

#gameCanvas::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.05) 0%, transparent 50%);
    pointer-events: none;
    border-radius: 16px;
}

/* 終了画面 */
#endScreen {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    position: relative;
    overflow: hidden;
}

#endScreen::before {
    content: '🎉';
    position: absolute;
    top: 10%;
    left: 10%;
    font-size: 5rem;
    animation: confetti1 3s infinite ease-in-out;
}

#endScreen::after {
    content: '🎊';
    position: absolute;
    top: 20%;
    right: 15%;
    font-size: 4rem;
    animation: confetti2 2.5s infinite ease-in-out;
}

@keyframes confetti1 {
    0%, 100% { transform: rotate(0deg) translateY(0px); }
    50% { transform: rotate(180deg) translateY(-20px); }
}

@keyframes confetti2 {
    0%, 100% { transform: rotate(0deg) translateY(0px); }
    50% { transform: rotate(-180deg) translateY(-15px); }
}

.end-content {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    padding: 60px 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    color: #fff;
    max-width: 500px;
    width: 90%;
    position: relative;
    z-index: 10;
}

.end-content h2 {
    color: #40CFFF;
    font-size: 4rem;
    margin-bottom: 30px;
    text-shadow: 
        0 0 20px rgba(64, 207, 255, 0.5),
        0 0 40px rgba(64, 207, 255, 0.3);
    animation: glow 2s ease-in-out infinite alternate;
}

#levelClearInfo {
    font-size: 1.5rem;
    margin: 20px 0;
    color: #FFD700;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

#clearTime {
    font-size: 1.8rem;
    margin: 25px 0;
    color: #40CFFF;
    font-weight: bold;
    text-shadow: 0 0 15px rgba(64, 207, 255, 0.5);
}

/* 手数表示のスタイル */
#moveCounter {
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    margin-left: 20px;
}

/* ゲーム情報エリアの調整 */
.game-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
    flex-wrap: wrap;
    padding: 10px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(52, 73, 94, 0.8));
    border-radius: 15px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        inset 0 1px 4px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 400px;
}

/* 統計表示の調整 */
.stats-container {
    display: flex;
    gap: 30px;
    margin: 20px 0;
    justify-content: center;
}

.stat-item {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    min-width: 120px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 5px;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #7f8c8d;
    text-transform: uppercase;
}

.map-area {
        display: flex;
        flex-direction: row; /* 横方向に拡張 */
        align-items: flex-start; /* 上揃え */
        justify-content: flex-start; /* 左揃え */
        position: relative; /* 絶対位置調整用 */
    }
    canvas {
        margin-right: 10px; /* マップ間の余白 */
    }


    .piece {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: 1px solid #888;
        margin: 4px;
        text-align: center;
        background: #eee;
        cursor: pointer;
        transition: background 0.3s, box-shadow 0.3s;
    }
    .piece.highlight {
        background: #f39c12; /* ハイライト色 */
        box-shadow: 0 0 10px #f39c12;
    }
    .sidebar {
        flex-shrink: 0; /* サイズが縮まないように固定 */
    }

/* ★記録表のスタイル */
.records-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
}

.records-content h2 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.records-table-container {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

.records-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.records-table thead {
    background: linear-gradient(135deg, #40CFFF 0%, #5555FF 100%);
    color: white;
}

.records-table th {
    padding: 15px 10px;
    font-weight: bold;
    font-size: 1.1rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.records-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e9ecef;
    transition: background-color 0.3s ease;
}

.records-table tbody tr:hover {
    background-color: #f8f9fa;
}

.records-table tbody tr:nth-child(even) {
    background-color: #f1f3f4;
}

.level-cell {
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.1rem;
}

.cleared-cell {
    color: #27ae60;
    font-weight: bold;
}

.not-cleared-cell {
    color: #95a5a6;
    font-style: italic;
}

.record-cell {
    font-family: 'Courier New', monospace;
    color: #34495e;
}

.best-record {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    font-weight: bold;
    color: #2d3436;
}

.records-buttons {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.danger-button {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    font-size: 1rem;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.danger-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.danger-button:active {
    transform: translateY(0);
}

/* ★レスポンシブ対応 */
@media (max-width: 768px) {
    .records-table {
        font-size: 0.9rem;
    }
    
    .records-table th,
    .records-table td {
        padding: 8px 5px;
    }
    
    .records-content h2 {
        font-size: 2rem;
    }
    
    .records-buttons {
        flex-direction: column;
        align-items: center;
    }
}

/* ★スマホ版広告の修正 */
@media (max-width: 768px) {
    /* タイトル下の広告を適切に配置 */
    .top-ad {
        margin: 120px auto 20px auto !important; /* タイトル分の余白を確保 */
        position: relative !important; /* 固定位置を解除 */
        z-index: 100 !important; /* タイトルより下に配置 */
        background: rgba(255, 255, 255, 0.1) !important;
        backdrop-filter: blur(10px) !important;
        border: 1px solid rgba(255, 255, 255, 0.2) !important;
    }
    
    /* メニューコンテンツの調整 */
    .menu-content {
        margin-top: 20px !important; /* 広告分の余白を追加 */
        position: relative !important;
        z-index: 500 !important;
    }
    
    /* 全ての広告コンテナのスクロール対策 */
    .ad-container {
        text-align: center;
        position: relative !important; /* fixed解除 */
        transform: none !important; /* transform解除 */
        margin: 15px auto !important;
        padding: 10px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-height: 60px;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        
        /* オーバーレイ効果を削除 */
        backdrop-filter: none !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border-radius: 8px !important;
        border: 1px solid #ddd !important;
    }
    
    /* 広告iframe自体の調整 */
    .ad-container iframe {
        width: 100% !important;
        max-width: 320px !important;
        height: 50px !important;
        position: relative !important; /* 固定位置解除 */
        display: block !important;
        margin: 0 auto !important;
        border-radius: 5px !important;
    }
    
    /* PC広告を完全に隠す */
    .pc-ad {
        display: none !important;
    }
    
    /* スマホ広告のみ表示 */
    .mobile-ad {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
    }
}

/* 超小型デバイス（480px以下）の調整 */
@media (max-width: 480px) {
    .top-ad {
        margin: 100px auto 15px auto !important; /* より狭い画面用 */
    }
    
    .menu-content {
        margin-top: 15px !important;
    }
    
    .ad-container {
        text-align: center;
        margin: 10px auto !important;
        padding: 8px !important;
        max-width: 300px;
        min-height: 60px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
    
    .ad-container iframe {
        max-width: 300px !important;
        height: 50px !important;
    }
}

/* ★ゲーム画面での広告調整 */
@media (max-width: 768px) {
    .game-bottom-ad {
        position: relative !important;
        margin: 20px auto !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: none !important;
    }
    
    .clear-ad {
        position: relative !important;
        margin: 20px auto !important;
        background: rgba(64, 207, 255, 0.1) !important;
        backdrop-filter: none !important;
    }
    
    .records-bottom-ad {
        position: relative !important;
        margin: 20px auto !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: none !important;
    }
    
    .retire-ad {
        position: relative !important;
        margin: 20px auto !important;
        background: rgba(231, 76, 60, 0.1) !important;
        backdrop-filter: none !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 15px !important;
        max-width: 728px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(231, 76, 60, 0.2) !important;
        min-height: 60px !important;
    }
    
    /* ★stuck-ad のスマホ版対応（重要） */
    .stuck-ad {
        position: relative !important;
        margin: 20px auto !important;
        background: rgba(255, 193, 7, 0.1) !important;
        backdrop-filter: none !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 15px !important;
        max-width: 728px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(255, 193, 7, 0.2) !important;
        min-height: 60px !important;
    }
}

/* ★広告ラベルのスマホ調整 */
@media (max-width: 768px) {
    .ad-container::before {
        font-size: 0.6rem !important;
        color: #666 !important;
        margin-bottom: 5px !important;
        text-align: center !important;
    }
    
    .retire-ad::before {
        content: "広告" !important; /* 長いメッセージを短縮 */
        color: #e74c3c !important;
    }
    
    .stuck-ad::before {
        content: "広告" !important; /* 長いメッセージを短縮 */
        color: #ffc107 !important;
    }
    
    .clear-ad::before {
        color: #40CFFF !important;
    }
}

/* ★スクロール時の広告固定化防止 */
@media (max-width: 768px) {
    body {
        overflow-x: hidden !important; /* 横スクロール防止 */
    }
    
    .screen.active {
        position: relative !important;
        width: 100% !important;
        min-height: 100vh !important;
        overflow-y: auto !important; /* 縦スクロール許可 */
        padding-bottom: 20px !important; /* 下部余白 */
    }
    
    /* 全体的なz-index調整 */
    .title-container {
        z-index: 1000 !important; /* 最上位 */
    }
    
    .menu-content {
        z-index: 500 !important; /* タイトルと広告の間 */
    }
}

/* 広告コンテナのスタイル */
.ad-container {
    text-align: center;
    margin: 20px auto;
    padding: 15px;
    max-width: 728px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.ad-placeholder {
    padding: 20px;
    background: rgba(64, 207, 255, 0.1);
    border: 2px dashed rgba(64, 207, 255, 0.3);
    border-radius: 8px;
    color: #666;
    font-size: 0.9rem;
}

.ad-container::before {
    content: "広告";
    display: block;
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 各位置の調整 */
.top-ad {
    margin: 20px auto 30px auto;
}

.menu-bottom-ad {
    margin: 30px auto 20px auto;
    background: rgba(64, 207, 255, 0.05);
    border-color: rgba(64, 207, 255, 0.1);
}

.menu-bottom-ad::before {
    content: "広告";
    color: #40CFFF;
}

.game-bottom-ad {
    margin: 20px auto;
}

.game-bottom-ad-2 {
    margin: 15px auto;
    background: rgba(52, 73, 94, 0.1);
    border-color: rgba(52, 73, 94, 0.2);
}

.game-bottom-ad-2::before {
    content: "広告";
    color: #34495e;
}

.clear-ad {
    margin: 20px auto;
    background: rgba(64, 207, 255, 0.1);
    border-color: rgba(64, 207, 255, 0.2);
}

.clear-ad-2 {
    margin: 15px auto;
    background: rgba(64, 207, 255, 0.15);
    border-color: rgba(64, 207, 255, 0.3);
}

.clear-ad-2::before {
    content: "広告";
    color: #40CFFF;
}

.records-bottom-ad {
    margin: 30px auto 20px auto;
}

.retire-ad {
    text-align: center;
    margin: 20px auto;
    padding: 15px;
    max-width: 728px;
    background: rgba(231, 76, 60, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(231, 76, 60, 0.2);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.retire-ad::before {
    content: "広告";
    color: #e74c3c;
}

.retire-ad-2 {
    text-align: center;
    margin: 15px auto;
    padding: 15px;
    max-width: 728px;
    background: rgba(231, 76, 60, 0.15);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(231, 76, 60, 0.3);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.retire-ad-2::before {
    content: "広告";
    color: #e74c3c;
}

.stuck-ad {
    text-align: center;
    margin: 20px auto;
    padding: 15px;
    max-width: 728px;
    background: rgba(255, 193, 7, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 193, 7, 0.2);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stuck-ad::before {
    content: "広告";
    color: #ffc107;
}

.stuck-ad-2 {
    text-align: center;
    margin: 15px auto;
    padding: 15px;
    max-width: 728px;
    background: rgba(255, 193, 7, 0.2);
    border-radius: 12px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 193, 7, 0.3);
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.stuck-ad-2::before {
    content: "広告";
    color: #ffc107;
}

/* 忍者AdMax レスポンシブ広告の調整 */

/* プレースホルダーを隠す */
.ad-placeholder {
    display: none !important;
}

/* PC/スマホ広告の切り替え */
.pc-ad {
    display: block;
}

.mobile-ad {
    display: none;
}

/* 768px以下でスマホ広告に切り替え */
@media (max-width: 768px) {
    .pc-ad {
        display: none;
    }
    
    .mobile-ad {
        display: block;
    }
}

/* 忍者AdMax広告フレームの調整 */
.ad-container iframe {
    border-radius: 8px;
    max-width: 100%;
    display: block;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.9);
}

/* PC用広告の最適化 */
@media (min-width: 769px) {
    .ad-container iframe {
        width: 728px;
        height: 90px;
    }
}

/* スマホ用広告の最適化 */
@media (max-width: 768px) {
    .ad-container iframe {
        width: 320px !important;
        height: 50px !important;
        max-width: 320px !important;
        max-height: 50px !important;
    }
}

/* 広告ラベルの再調整 */
.ad-container::before {
    content: "広告";
    display: block;
    font-size: 0.7rem;
    color: #999;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-align: center;
}

/* 各広告位置の微調整 */
.top-ad {
    margin: 30px auto 30px auto;
}

/* スマホではタイトル固定のため、広告の上マージンを大きくする */
@media (max-width: 768px) {
    .top-ad {
        margin-top: 100px !important;
        margin-bottom: 20px !important;
    }
}

.game-bottom-ad {
    margin: 20px auto;
}

.clear-ad {
    margin: 20px auto;
    background: rgba(64, 207, 255, 0.1);
    border-color: rgba(64, 207, 255, 0.2);
}

.clear-ad::before {
    color: #40CFFF;
}

.records-bottom-ad {
    margin: 30px auto 20px auto;
}

/* 忍者AdMax レスポンシブ広告の調整 */

/* プレースホルダーを隠す */
.ad-placeholder {
    display: none !important;
}

/* 年齢層による広告制御 */
.ad-container.hidden {
    display: none !important;
    visibility: hidden !important;
}

.ad-container.safe-mode {
    /* シニア・子供向けの安全モード */
    display: none !important;
}

/* ポリシーページ用スタイル */
.policy-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: white;
    line-height: 1.6;
}

.policy-container h1 {
    text-align: center;
    color: #fff;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-size: 2.5rem;
}

.policy-container h2 {
    color: #fff;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    padding-bottom: 8px;
    margin-top: 30px;
    margin-bottom: 15px;
    font-size: 1.3rem;
}

.policy-container p {
    margin-bottom: 15px;
    font-size: 1rem;
}

.policy-container ul {
    padding-left: 20px;
    margin-bottom: 15px;
}

.policy-container li {
    margin-bottom: 8px;
}

.policy-dates {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-top: 30px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.back-link {
    text-align: center;
    margin-top: 40px;
}

.back-link .menu-button {
    background: rgba(255,255,255,0.2);
    border: 2px solid rgba(255,255,255,0.3);
    color: white;
    padding: 12px 30px;
    text-decoration: none;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.back-link .menu-button:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .policy-container {
        padding: 20px 15px;
    }
    
    .policy-container h1 {
        font-size: 2rem;
    }
    
    .policy-container h2 {
        font-size: 1.2rem;
    }
}

/* ★新規追加広告のスタイル修正 */
.menu-bottom-ad {
    margin: 30px auto 20px auto;
    background: rgba(64, 207, 255, 0.05);
    border-color: rgba(64, 207, 255, 0.1);
}

.menu-bottom-ad::before {
    content: "広告";
    color: #40CFFF;
}

.game-bottom-ad-2 {
    margin: 15px auto;
    background: rgba(52, 73, 94, 0.1);
    border-color: rgba(52, 73, 94, 0.2);
}

.game-bottom-ad-2::before {
    content: "広告";
    color: #34495e;
}

.clear-ad-2 {
    margin: 15px auto;
    background: rgba(64, 207, 255, 0.15);
    border-color: rgba(64, 207, 255, 0.3);
}

.clear-ad-2::before {
    content: "広告";
    color: #40CFFF;
}

/* ★スマホ版での新規広告調整（重要） */
@media (max-width: 768px) {
    .menu-bottom-ad {
        position: relative !important;
        margin: 20px auto !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: none !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 15px !important;
        max-width: 728px !important;
        border-radius: 12px !important;
        min-height: 60px !important;
    }
    
    .game-bottom-ad-2 {
        position: relative !important;
        margin: 15px auto !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: none !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 15px !important;
        max-width: 728px !important;
        border-radius: 12px !important;
        min-height: 60px !important;
    }
    
    .clear-ad-2 {
        position: relative !important;
        margin: 15px auto !important;
        background: rgba(64, 207, 255, 0.1) !important;
        backdrop-filter: none !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        text-align: center !important;
        padding: 15px !important;
        max-width: 728px !important;
        border-radius: 12px !important;
        min-height: 60px !important;
    }
    
    .retire-ad-2 {
        text-align: center !important;
        position: relative !important;
        margin: 15px auto !important;
        padding: 15px !important;
        max-width: 728px !important;
        background: rgba(231, 76, 60, 0.1) !important;
        border-radius: 12px !important;
        backdrop-filter: none !important;
        border: 1px solid rgba(231, 76, 60, 0.3) !important;
        min-height: 60px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    /* ★stuck-ad-2 のスマホ版対応（重要） */
    .stuck-ad-2 {
        text-align: center !important;
        position: relative !important;
        margin: 15px auto !important;
        padding: 15px !important;
        max-width: 728px !important;
        background: rgba(255, 193, 7, 0.1) !important;
        border-radius: 12px !important;
        backdrop-filter: none !important;
        border: 1px solid rgba(255, 193, 7, 0.3) !important;
        min-height: 60px !important;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
    }
    
    /* 新規追加広告のラベル調整 */
    .menu-bottom-ad::before {
        content: "広告" !important;
        color: #40CFFF !important;
    }
    
    .game-bottom-ad-2::before {
        content: "広告" !important;
        color: #666 !important;
    }
    
    .clear-ad-2::before {
        content: "広告" !important;
        color: #40CFFF !important;
    }
    
    .retire-ad-2::before {
        content: "広告" !important;
        color: #e74c3c !important;
    }
    
    /* ★stuck-ad-2 のラベル調整（重要） */
    .stuck-ad-2::before {
        content: "広告" !important;
        color: #ffc107 !important;
    }
}

/* スクロール可能にするためのスタイルを追加 */
#mapContainer {
    overflow: auto;
    max-width: 100%;
    max-height: 100%;
}

/* 横スクロールを可能にする */
body {
    overflow-x: auto;
    /* スマホでのピンチズーム対応を強化 */
    touch-action: pan-x pan-y pinch-zoom;
}

/* ゲームキャンバスのスマホ対応を強化 */
#gameCanvas {
    /* タッチ操作の最適化：パンとズームを許可、ダブルタップズームも許可 */
    touch-action: pan-x pan-y pinch-zoom;
    /* 拡大時のスムージング */
    image-rendering: auto;
    /* 最大幅を画面幅に制限しない（拡大時に横スクロール可能） */
    max-width: none !important;
    /* タッチ時のハイライトを無効化 */
    -webkit-tap-highlight-color: transparent;
}

/* スマホでの拡大対応 */
@media (max-width: 768px) {
    /* メタビューポートでuser-scalable=yesが設定されているため、拡大可能 */
    
    /* ゲーム画面全体のスクロール対応 */
    #gameScreen {
        overflow: auto !important;
        /* 最小幅を確保して横スクロールを可能にする */
        min-width: 100vw;
        max-width: none;
        /* スムーズなスクロール */
        -webkit-overflow-scrolling: touch;
        /* タッチアクションを許可 */
        touch-action: pan-x pan-y pinch-zoom;
    }
    
    /* キャンバス周りのコンテナ調整 */
    #gameScreen.active {
        align-items: flex-start !important;
        justify-content: flex-start !important;
        padding: 10px;
        /* 拡大時のコンテンツ配置 */
        display: block !important;
    }
    
    /* ゲーム情報バーも横スクロールに対応 */
    .game-info {
        min-width: 400px !important;
        max-width: none !important;
        flex-shrink: 0;
        /* 固定位置から相対位置に変更 */
        position: relative !important;
        margin-bottom: 10px;
    }
    
    /* キャンバス自体の最小サイズを保証 */
    #gameCanvas {
        min-width: 400px !important;
        flex-shrink: 0 !important;
        /* 拡大時の品質維持 */
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
        /* 中央配置を解除 */
        display: block !important;
        margin: 0 !important;
    }
    
    /* ゲームキャンバスの親コンテナ */
    #gameScreen .game-content {
        width: fit-content;
        min-width: 100%;
    }
}

/* 超小型デバイスでの追加調整 */
@media (max-width: 480px) {
    #gameCanvas {
        min-width: 350px !important;
    }
    
    .game-info {
        min-width: 350px !important;
    }
}

/* ========================================
   ランキング機能のスタイル
   ======================================== */

/* タブ切り替え */
.records-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #ddd;
}

.tab-button {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: #666;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: #40CFFF;
}

.tab-button.active {
    color: #40CFFF;
    border-bottom-color: #40CFFF;
}

/* タブコンテンツ */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ログイン状態表示 */
.login-status {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
}

.login-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

#userNicknameDisplay {
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
}

.nickname-edit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 10px;
}

#nicknameInput {
    padding: 8px 12px;
    border: 2px solid #40CFFF;
    border-radius: 5px;
    font-size: 1rem;
    width: 200px;
}

/* レベル選択 */
.ranking-level-select {
    text-align: center;
    margin-bottom: 20px;
}

.ranking-level-select label {
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    margin-right: 10px;
}

.ranking-level-select select {
    padding: 8px 12px;
    border: 2px solid #40CFFF;
    border-radius: 5px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
}

/* ランキングタイプ切り替え */
.ranking-type-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.ranking-type-button {
    padding: 10px 20px;
    background: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    color: #666;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.ranking-type-button:hover {
    background: #e0e0e0;
    border-color: #40CFFF;
}

.ranking-type-button.active {
    background: linear-gradient(135deg, #40CFFF 0%, #5555FF 100%);
    color: white;
    border-color: #40CFFF;
}

/* レベル統計 */
.level-stats {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.stat-box {
    flex: 1;
    min-width: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.stat-box .stat-label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 5px;
}

.stat-box .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #FFD700;
}

/* ランキングテーブル */
.ranking-table-container {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.ranking-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.ranking-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ranking-table th {
    padding: 15px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
}

.ranking-table tbody tr {
    transition: background 0.3s ease;
}

.ranking-table tbody tr:hover {
    background: #f0f8ff;
}

.ranking-table tbody tr:nth-child(odd) {
    background: #f9f9f9;
}

.ranking-table td {
    padding: 12px;
    text-align: center;
    border-bottom: 1px solid #eee;
}

/* 順位の特別スタイル */
.ranking-table tbody tr:nth-child(1) td:first-child {
    color: #FFD700;
    font-size: 1.2rem;
    font-weight: bold;
}

.ranking-table tbody tr:nth-child(2) td:first-child {
    color: #C0C0C0;
    font-size: 1.1rem;
    font-weight: bold;
}

.ranking-table tbody tr:nth-child(3) td:first-child {
    color: #CD7F32;
    font-size: 1.1rem;
    font-weight: bold;
}

/* ランキング更新情報 */
.ranking-update-info {
    background: #e3f2fd;
    border: 2px solid #2196f3;
    border-radius: 10px;
    padding: 10px 15px;
    margin: 15px 0;
    text-align: center;
}

.ranking-update-info p {
    margin: 5px 0;
    color: #1565c0;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ランキング注意書き */
.ranking-note {
    background: #fff3cd;
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.ranking-note p {
    margin: 5px 0;
    color: #856404;
    font-size: 0.95rem;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .records-tabs {
        flex-direction: column;
    }
    
    .tab-button {
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .tab-button.active {
        border-left-color: #40CFFF;
    }
    
    .level-stats {
        flex-direction: column;
    }
    
    .stat-box {
        min-width: 100%;
    }
    
    .ranking-table th,
    .ranking-table td {
        padding: 8px;
        font-size: 0.9rem;
    }
    
    .login-info {
        flex-direction: column;
    }
    
    #nicknameInput {
        width: 100%;
        max-width: 250px;
    }
}

/* ========================================
   クリア画面のランキング参加促進UI
   ======================================== */

.ranking-prompt {
    background: linear-gradient(135deg, #fff9e6 0%, #ffe8cc 100%);
    border: 3px solid #FFD700;
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
    animation: rankingPromptPulse 2s ease-in-out infinite;
}

@keyframes rankingPromptPulse {
    0%, 100% {
        box-shadow: 0 6px 20px rgba(255, 215, 0, 0.3);
    }
    50% {
        box-shadow: 0 6px 30px rgba(255, 215, 0, 0.5);
    }
}

.ranking-prompt-content {
    text-align: center;
}

.ranking-prompt-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: rankingIconBounce 1s ease-in-out infinite;
}

@keyframes rankingIconBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.ranking-prompt-content h3 {
    color: #ff6b00;
    font-size: 1.8rem;
    margin: 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.ranking-prompt-text {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
    margin: 15px 0;
}

.ranking-prompt-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.ranking-login-button {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #fff;
    font-size: 1.2rem;
    font-weight: bold;
    padding: 15px 30px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 165, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ranking-login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 165, 0, 0.6);
}

.ranking-login-button:active {
    transform: translateY(0);
}

.ranking-view-button {
    background: linear-gradient(135deg, #40CFFF 0%, #5555FF 100%);
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 12px 25px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(64, 207, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.ranking-view-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(64, 207, 255, 0.6);
}

.ranking-view-button:active {
    transform: translateY(0);
}

.button-icon {
    font-size: 1.3rem;
}

.ranking-prompt-note {
    color: #999;
    font-size: 0.9rem;
    margin-top: 15px;
}

/* ログイン済み表示 */
.ranking-saved {
    background: linear-gradient(135deg, #e6f7ff 0%, #d0f0ff 100%);
    border: 3px solid #40CFFF;
    border-radius: 15px;
    padding: 25px;
    margin: 20px 0;
    box-shadow: 0 6px 20px rgba(64, 207, 255, 0.3);
}

.ranking-saved-content {
    text-align: center;
}

.ranking-saved-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    animation: rankingSavedCheck 0.5s ease-out;
}

@keyframes rankingSavedCheck {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.ranking-saved-content h3 {
    color: #0088cc;
    font-size: 1.6rem;
    margin: 10px 0;
}

.ranking-saved-text {
    color: #555;
    font-size: 1.1rem;
    margin: 15px 0;
}

#savedUserNickname {
    font-weight: bold;
    color: #0088cc;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .ranking-prompt {
        padding: 20px 15px;
    }
    
    .ranking-prompt-icon {
        font-size: 3rem;
    }
    
    .ranking-prompt-content h3 {
        font-size: 1.5rem;
    }
    
    .ranking-prompt-text {
        font-size: 1rem;
    }
    
    .ranking-login-button {
        font-size: 1.1rem;
        padding: 12px 20px;
    }
    
    .ranking-view-button {
        font-size: 1rem;
        padding: 10px 20px;
    }
    
    .ranking-saved-icon {
        font-size: 3rem;
    }
    
    .ranking-saved-content h3 {
        font-size: 1.4rem;
    }
}

/* ========================================
   グローバルフッターナビゲーション
   ======================================== */

.footer-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(52, 73, 94, 0.95));
    backdrop-filter: blur(10px);
    border-top: 2px solid rgba(64, 207, 255, 0.5);
    padding: 12px 20px;
    z-index: 2000;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

/* フッターのゲームをプレイボタン */
.footer-play-button {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 10px;
    display: block;
    padding: 14px 28px;
    background: linear-gradient(135deg, #4ADE80, #60A5FA);
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.3);
}

.footer-play-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
}

.footer-play-button:active {
    transform: translateY(0);
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.footer-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 15px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-link:hover {
    background: rgba(64, 207, 255, 0.2);
    border-color: rgba(64, 207, 255, 0.5);
    color: #40CFFF;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(64, 207, 255, 0.3);
}

.footer-icon {
    font-size: 1.1rem;
}

.footer-text {
    font-weight: 500;
}

.footer-link-primary {
    background: linear-gradient(135deg, #40CFFF, #5555FF);
    border-color: #40CFFF;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(64, 207, 255, 0.4);
}

.footer-link-primary:hover {
    background: linear-gradient(135deg, #5555FF, #40CFFF);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(64, 207, 255, 0.6);
}

/* フッター非表示時 */
.footer-nav.hidden {
    display: none;
}

/* モバイル対応 */
@media (max-width: 768px) {
    .footer-nav {
        position: fixed;
        padding: 10px 15px;
    }
    
    .footer-links {
        gap: 10px;
    }
    
    .footer-link {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .footer-icon {
        font-size: 1rem;
    }
    
    .footer-text {
        font-size: 0.85rem;
    }
    
    /* クリエイトモードボックス - モバイル対応 */
    .create-mode-box {
        padding: 15px;
    }
    
    .create-mode-box h3 {
        font-size: 1.15rem;
    }
    
    .create-intro {
        font-size: 0.95rem;
    }
    
    .rules-title {
        font-size: 1rem;
    }
    
    .rule-step {
        padding: 8px;
    }
    
    .rule-number {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
    }
    
    .rule-text {
        font-size: 0.95rem;
    }
    
    .rules-note {
        font-size: 0.85rem;
    }
    
    .create-feature {
        font-size: 0.95rem;
    }
}

/* 超小型デバイス対応 */
@media (max-width: 480px) {
    .footer-nav {
        position: fixed;
        padding: 8px 10px;
    }
    
    .footer-links {
        gap: 8px;
    }
    
    .footer-link {
        font-size: 0.8rem;
        padding: 5px 10px;
    }
    
    .footer-icon {
        font-size: 0.9rem;
    }
    
    .footer-text {
        font-size: 0.8rem;
    }
    
    /* クリエイトモードボックス - 超小型デバイス対応 */
    .create-mode-box {
        padding: 12px;
    }
    
    .create-mode-box h3 {
        font-size: 1.05rem;
    }
    
    .create-intro {
        font-size: 0.9rem;
    }
    
    .rule-steps {
        gap: 8px;
    }
    
    .rule-step {
        padding: 6px;
        gap: 10px;
    }
    
    .rule-number {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    .rule-text {
        font-size: 0.9rem;
    }
}
