/* 1. 基本設定とリセット */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: sans-serif;
    background: #212121;
    color: #ffffff;
    overflow: hidden; /* スマホでの画面はみ出し・スクロールを完全禁止 */
    position: relative;
    width: 100vw;
    height: 100vh;
}

/* 背景の星レイヤー */
.starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* ゲーム全体を画面のド真ん中に固定するコンテナ */
.scaler-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vmin;
    height: 90vmin;
    max-width: 720px;
    max-height: 720px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* メインコンテナ */
.card {
    background: rgba(33, 33, 33, 0.85); 
    width: 100%;
    height: 100%;
    padding: 4vmin;
    border-radius: 16px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

/* ヘッダー */
.game-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    height: 6vmin;
    max-height: 40px; 
    margin-bottom: 3vmin;
}

.game-status {
    font-weight: bold; 
    color: #a3a3a3;
    font-size: min(2.5vmin, 18px); 
}

.timer-display {
    font-size: min(3.5vmin, 24px); 
    font-weight: bold; 
    color: #38bdf8; 
    font-family: monospace;
}

/* 数字画面：PCでもスマホでも常に最大のスペースをキープ */
.number-display {
    flex: 1; 
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2); 
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.03);
    margin-bottom: 3vmin;
    
    /* 💡 改善：文字サイズが小さくなるバグを修正 */
    /* スマホ時は画面幅（vw）で自動縮小し、PC大画面では最大6.5rem（超極大）でガチッと固定します */
    font-size: min(18vw, 6.5rem); 
    text-align: center;
}

/* ボトムスペース：ボタン専用のサイズ */
.button-dock {
    width: 100%;
    height: 30vmin;
    max-height: 210px; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* 開始ボタンと2択ボタンを格納する、高さが絶対に変動しない共有ボックス */
.btn-box {
    width: 100%;
    height: 8vmin;
    max-height: 56px; 
    position: relative;
}

/* ボタン基本設定 */
.btn {
    width: 100%;
    height: 100%; 
    font-size: min(2.8vmin, 20px); 
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: opacity 0.15s, background 0.2s, transform 0.1s;
    font-weight: bold;
    -webkit-tap-highlight-color: transparent;
}

.btn:active {
    transform: scale(0.98);
}

/* 〇✕ボタンの横並び */
.answer-buttons {
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    gap: min(2vmin, 16px);
    width: 100%;
    height: 100%;
    z-index: 1;
}

.answer-buttons .btn {
    flex: 1;
}

/* ボタンの色 */
.btn-o { background: #ff4d4d; color: white; }
.btn-o:hover { background: #e63939; }

.btn-x { background: #3b82f6; color: white; }
.btn-x:hover { background: #2563eb; }

.btn-next { background: #10b981; color: white; }
.btn-next:hover { background: #059669; }

/* 3連設定ボタン */
.settings-dock {
    border-top: 1px solid rgba(255,255,255,0.1); 
    padding-top: min(2.5vmin, 20px); 
    display: flex; 
    gap: min(1.5vmin, 12px); 
    width: 100%;
    height: 11vmin;
    max-height: 76px; 
}

.settings-dock select {
    flex: 1; 
    height: 100%;
    border-radius: 8px;
    background: #2a2a2a;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.2);
    font-weight: bold;
    font-size: min(2.3vmin, 16px); 
    text-align: center;
    cursor: pointer;
    outline: none;
}

.question-text {
    font-weight: bold;
    line-height: 1.6;
    text-align: center;
    word-break: break-all;
}

.result-score-text {
    font-size: min(4vw, 28px);
    font-weight: bold;
    color: #38bdf8;
    margin-bottom: 12px;
}

.clear-sub-text {
    font-weight: bold;
}