/* --- 変数定義 --- */
:root {
    --bg: #1a1a1a;
    --accent: #00ff88;
    --error: #ff4b2b;
    --card: #2a2a2a;
    --twitter: #000000;
    --line: #06C755;
    --copy: #555555;
}

/* --- 基本レイアウト --- */
body {
    background: var(--bg);
    color: #fff;
    font-family: sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
}

#game-container {
    text-align: center;
    width: 95%;
    max-width: 440px;
    position: relative;
    padding: 10px 0;
}

/* --- 画面の切り替え --- */
.screen { display: none; flex-direction: column; gap: 12px; }
.screen.active { display: flex; }

/* --- 設定・解説セクション --- */
.settings-bar {
    background: #333;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 5px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-around;
    font-size: 0.85rem;
}

.settings-bar label { cursor: pointer; display: flex; align-items: center; gap: 5px; }

.info-section {
    background: var(--card);
    padding: 15px;
    border-radius: 10px;
    text-align: left;
    border-left: 4px solid var(--accent);
    max-height: 220px;
    overflow-y: auto;
}

.info-section h3 { font-size: 0.9rem; color: var(--accent); margin: 10px 0 5px; }
.info-section p { font-size: 0.8rem; margin: 0 0 10px; color: #ccc; }

/* --- ゲーム中のUI --- */
#hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

#timer-bar { width: 100%; height: 10px; background: #333; border-radius: 5px; overflow: hidden; }
#timer-fill { width: 100%; height: 100%; background: var(--accent); transition: width 0.1s linear; }

#target-word { font-size: 4.5rem; font-weight: 900; margin: 15px 0; min-height: 6rem; }

/* ボタンのグリッド：色が4つの時は2列、
  レベルが上がって増えた時も綺麗に並ぶよう自動調整
*/
#answer-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); 
    gap: 12px; 
}

.ans-btn { 
    height: 70px; 
    border: none; 
    border-radius: 15px; 
    cursor: pointer; 
    transition: transform 0.1s; 
    box-shadow: 0 4px rgba(0,0,0,0.3);
}
.ans-btn:active { transform: scale(0.95); }

/* --- ボタン共通 --- */
.main-btn {
    background: var(--accent);
    border: none;
    padding: 18px;
    font-size: 1.2rem;
    border-radius: 35px;
    cursor: pointer;
    font-weight: bold;
    color: #000;
}

.quit-btn {
    background: #444;
    border: none;
    color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
}

/* --- シェアエリア --- */
.share-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 5px 0;
}

.share-btn {
    border: none;
    color: #fff;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.85rem;
}

.share-btn.twitter { background: var(--twitter); border: 1px solid #444; }
.share-btn.line { background: var(--line); }
.share-btn.copy { background: var(--copy); grid-column: span 2; }

/* --- 結果表示 --- */
#age-display { font-size: 3.5rem; font-weight: 900; color: var(--accent); margin: 0; }
#nickname-display { font-size: 1.2rem; color: #ffeb3b; font-weight: bold; }
#explanation-box {
    background: var(--card);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    font-size: 0.75rem;
    line-height: 1.5;
}

/* --- 広告スペース --- */
.ad-space {
    width: 100%;
    min-height: 90px;
    background: rgba(255,255,255,0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
}

/* --- アニメーション --- */
.panic-vibrate { animation: vibrate 0.1s infinite; }
@keyframes vibrate { 25% { transform: translate(2px, 2px); } 75% { transform: translate(-2px, -2px); } }
.miss-flash { animation: flash 0.2s; }
@keyframes flash { 50% { background: #500; } }
