/* 背景のグラデーション */
body {
    margin: 0;
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
    color: #e0e0e0;
}

/* ゲーム全体を包むコンテナ */
#game-wrapper {
    width: 100%;
    max-width: 600px;
    padding: 0 16px;
    box-sizing: border-box;
    position: relative;
}

/* 上部ボタン */
#top-buttons {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
}

.button {
    background-color: #102a43;
    color: #00eaff;
    padding: 8px 16px;
    border: 1px solid #00eaff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.button:hover {
    background-color: #133b5c;
    box-shadow: 0 0 6px #00eaff;
}

/* ゲームエリア */
#game-area {
    background-color: #1c3042;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* タイマーとスコア */
#timer-score {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-size: 18px;
}

/* 設定（モード選択・入力方法） */
#settings {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 14px;
}

#settings label {
    margin-right: 4px;
}

#settings select {
    background-color: #102a43;
    color: #00eaff;
    border: 1px solid #00eaff;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
}

/* 問題表示エリア */
#question-area {
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 32px;
    min-height: 80px;
    margin-bottom: 20px;
    word-break: break-all;
    color: #00eaff;
}

/* 回答入力エリア */
#answer-area {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 8px;
}

#answer-input {
    font-size: 24px;
    padding: 6px 8px;
    width: 140px;
    border: 1px solid #00eaff;
    border-radius: 4px;
    text-align: center;
    background-color: #102a43;
    color: #00eaff;
}

/* オンスクリーン数字キーボード */
#onscreen-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}

#onscreen-keypad .key {
    font-size: 20px;
    padding: 12px;
    border-radius: 4px;
    background-color: #102a43;
    color: #00eaff;
    border: 1px solid #00eaff;
    cursor: pointer;
    box-shadow: 0 0 4px #00eaff;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

#onscreen-keypad .key:hover {
    background-color: #133b5c;
    box-shadow: 0 0 8px #00eaff;
}

/* hidden クラスが付与された場合にキーボードを非表示にする */
#onscreen-keypad.hidden {
    display: none;
}

/* オーバーレイ共通スタイル */
.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 10;
}

.hidden {
    display: none;
}

.overlay-content {
    background-color: #1c3042;
    padding: 24px 32px;
    border-radius: 8px;
    text-align: center;
    max-width: 420px;
    color: #e0e0e0;
}

.overlay-content h2 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 24px;
    color: #00eaff;
}

.overlay-content p {
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.5;
    color: #e0e0e0;
}

/* オーバーレイがhiddenクラスを持つ場合は完全に非表示にする */
#how-to-overlay.hidden, #game-over.hidden {
    display: none;
}

/* 説明パネル */
.instructions {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.6);
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 20;
    backdrop-filter: blur(4px);
}

/* hidden クラスが付いた説明パネルは非表示にする（display: none に強制する） */
.instructions.hidden {
    display: none !important;
}

.instructions-content {
    background-color: #1c3042;
    padding: 24px 32px;
    border-radius: 8px;
    text-align: center;
    max-width: 460px;
    color: #e0e0e0;
    box-shadow: 0 8px 16px rgba(0,0,0,0.5);
}

.instructions-content h2 {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 24px;
    color: #00eaff;
}

.instructions-content p {
    margin-bottom: 20px;
    font-size: 18px;
    line-height: 1.5;
    color: #e0e0e0;
}

/* ゲームオーバー画面のボタン並び */
#game-over-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}