/* 全体の容器：ここを基準に背景を動かす */
#game-container { 
    max-width: 600px !important; 
    margin: 0 auto !important; 
    padding: 20px !important; 
    background: #f0f2f5 !important; 
    min-height: 100vh !important; 
    position: relative; 
    z-index: 1;
}

/* 【修正】背景ゴースト：確実に最背面に配置し、色を少し濃くしました */
#ghost-bg-filler {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%; /* JSで可変 */
    background: rgba(40, 167, 69, 0.25); /* 緑色の濃度アップ */
    box-shadow: 0 0 30px rgba(40, 167, 69, 0.3) inset;
    transition: height 0.5s ease-out;
    pointer-events: none;
    z-index: -1; /* カードより後ろ */
}

.screen { display: none; flex-direction: column; align-items: center; width: 100%; }
.screen.active { display: flex !important; }

/* カードのスタイル：背景が見えるように透過させる */
.num-card { 
    aspect-ratio: 1/1; 
    background: rgba(255, 255, 255, 0.85); 
    border: 2px solid #007bff; 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    /* フォントサイズをレスポンシブに（画面幅に応じて微調整） */
    font-size: clamp(1rem, 4vw, 1.4rem); 
    font-weight: bold; 
    color: #007bff; 
    cursor: pointer;
    /* 枠線が外にはみ出さないように計算に含める */
    box-sizing: border-box; 
    width: 100%;
}
.num-card.hit { visibility: hidden; }

/* その他レイアウト */
.main-card { background: #fff; border-radius: 20px; padding: 25px 20px; width: 100%; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 20px; }
.info-box { text-align: left; margin-bottom: 20px; }
.settings-bar { border-left: 5px solid #28a745; padding-left: 10px; margin: 15px 0 8px; font-weight: bold; color: #333; }
.description-text { font-size: 0.85rem; line-height: 1.6; color: #444; }
.benefit-list { list-style: none; padding: 0; font-size: 0.85rem; }
.benefit-list li span { color: #28a745; font-weight: bold; }
.level-selector { display: flex; gap: 15px; justify-content: center; }
.level-btn { flex: 1; padding: 15px 10px; border: 2px solid #e0e0e0; border-radius: 12px; background: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; }
.level-btn.highlight { border-color: #28a745; }
.level-btn strong { font-size: 1.2rem; color: #28a745; }
.best-tag { font-style: normal; font-size: 0.75rem; color: #e83e8c; font-weight: bold; margin-top: 5px; }
#number-grid { 
    display: grid; 
    gap: 6px; /* 隙間を少し狭くして余裕を作る */
    width: 100%; 
    max-width: 500px; /* 画面が大きすぎても広がりすぎないように制限 */
    margin: 20px auto; 
    /* 横幅に合わせてカードが自動で縮小するように設定 */
    grid-template-columns: repeat(var(--grid-cols, 4), 1fr); 
}
.rank-badge { font-size: 1.1rem; font-weight: bold; color: #28a745; margin-bottom: 5px; }
#age-display { font-size: 3.5rem; font-weight: bold; color: #e83e8c; line-height: 1; margin-bottom: 10px; }
.comparison-box { background: #fff3cd; padding: 12px; border-radius: 8px; margin: 10px 0; font-size: 0.9rem; width: 100%; }
.analysis-text { background: #e7f3ff; padding: 12px; border-radius: 8px; font-size: 0.85rem; color: #0c5460; line-height: 1.5; text-align: left; width: 100%; }
.main-btn { width: 100%; padding: 15px; background: #28a745; color: #fff; border: none; border-radius: 30px; font-size: 1.1rem; cursor: pointer; }
