﻿:root {
    --primary-color: #4CAF50;
    --danger-color: #f44336;
    --bg-color: #f0f4f8;
    --text-color: #333;
}

body {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    text-align: center;
    user-select: none;
}

header {
    background: #fff;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    height: 50px;
}

header button { padding: 5px 10px; cursor: pointer; }
#title-text { font-weight: bold; font-size: 1.2rem; }
#game-timer { font-family: monospace; font-size: 1.2rem; font-weight: bold; }

main {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    display: block !important;
}

.screen { display: none; flex-direction: column; align-items: center; }
.screen.active { display: flex; }

.main-title { font-size: 2.5rem; margin: 40px 0 20px; color: #2c3e50; }

.difficulty-selection {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    gap: 15px;
    width: 100%;
    max-width: 800px;
    margin: 30px auto;
}

.diff-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    min-width: 180px;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    border-radius: 12px;
    border: none;
    transition: transform 0.2s, background-color 0.2s;
}

.diff-btn:hover { transform: scale(1.05); }
.diff-btn:active { transform: scale(0.98); }
.diff-detail { display: block; font-size: 0.75rem; font-weight: normal; margin-top: 8px; opacity: 0.9; }

@media (max-width: 600px) {
    .difficulty-selection { flex-direction: column; align-items: center; }
    .diff-btn { width: 100%; max-width: 300px; }
}

.btn-easy { background-color: #4CAF50; color: white; }
.btn-normal { background-color: #FF9800; color: white; }
.btn-hard { background-color: #f44336; color: white; }

.audio-notice { display: flex; align-items: center; gap: 5px; margin: 20px 0; color: #666; font-size: 0.9rem; }
.footer-buttons { display: flex; gap: 10px; margin-top: 30px; }
.small-btn { padding: 8px 12px; background: #e0e0e0; border: none; border-radius: 4px; cursor: pointer; font-size: 0.8rem; }

#quiz-screen {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    position: relative;
    min-height: 500px;
}

#quiz-screen.active { display: flex; }

.timer-container {
    width: 100% !important;
    height: 24px !important;
    background-color: #e0e0e0 !important;
    border-radius: 12px;
    margin: 20px 0;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

#remaining-time-bar {
    width: 100%;
    height: 100%;
    background-color: #4CAF50;
    transition: width 0.1s linear, background-color 0.3s;
    border-radius: 12px;
}

#life-container { display: flex; justify-content: center; gap: 8px; margin-bottom: 15px; font-size: 1.5rem; min-height: 2rem; }
.heart { color: #ff4d4d; font-size: 1.8rem; margin: 0 2px; display: inline-block; }

#question-text { font-size: 1.5rem; font-weight: bold; margin: 20px 0 20px; min-height: 3rem; }

/* 4択ボタンレイアウト */
#choices-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.choice-btn {
    padding: 15px 10px;
    font-size: 1.1rem;
    font-weight: bold;
    color: #333;
    background-color: #fff;
    border: 3px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 0 #ccc;
}

.choice-btn:hover:not(:disabled) { background-color: #f8f8f8; border-color: #bbb; }
.choice-btn:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 2px 0 #ccc; }

.choice-btn:disabled {
    background-color: #d1d1d1 !important;
    border-color: #bbbbbb !important;
    color: #888888 !important;
    opacity: 0.8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none !important;
}
.circle-mark {
    display: inline-block;
    width: 140px;
    height: 140px;
    border: 20px solid #4CAF50;
    border-radius: 50%;
}

#explanation-area {
    width: 100%;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    text-align: center;
    box-sizing: border-box;
    margin: 0 auto 20px;
}

#explanation-area.show { visibility: visible; opacity: 1; }
.label, #exp-label { font-size: 0.85rem; color: #888; margin-bottom: 5px; font-weight: bold; display: block; }
#exp-answer-text { font-size: 1.6rem; font-weight: bold; color: #f44336; margin-bottom: 20px; }
#exp-text { font-size: 1rem; line-height: 1.5; color: #333; display: inline-block; }
#exp-label { border-top: 1px solid #eee; padding-top: 15px; margin-top: 10px; }

#feedback-overlay {
    position: absolute;
    top: 180px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: none;
    width: 100%;
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
}

#feedback-overlay:not(:has(.circle-mark)):not(:has(.time-up-text)) {
    font-size: 10rem !important; /* 15remから少し縮小 */
    font-weight: bold;
}

#next-btn-container {
    width: 100%;
    display: flex;
    justify-content: center;
}
.time-up-text { color: #f44336; font-size: 5rem; font-weight: bold; text-shadow: 2px 2px 0px rgba(0,0,0,0.2); display: block; }

#result-title { font-size: 2.5rem; color: #f44336; margin-top: 20px; }
.result-stats { font-size: 1.2rem; margin: 30px 0; line-height: 1.8; text-align: left; display: inline-block; }

#modal-overlay { display:none; position:fixed; top:0; left:0; width:100%; height:100%; background:rgba(0,0,0,0.6); z-index:2000; justify-content:center; align-items:center; }
#modal-content { background:white; padding:25px; border-radius:15px; width:90%; max-width:500px; position:relative; text-align:center; }

/* 結果画面のレイアウト */
#result-screen {
    gap: 10px;
}

.result-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px; /* ボタン間の余白 */
    width: 100%;
    margin-top: 20px;
}

/* タイトルへ戻るボタンのスタイル微調整 */
.result-buttons .btn-normal {
    margin-top: 0; /* JS側の指定と重複しないようリセット */
    width: 100%;
    max-width: 300px; /* 広がりすぎないよう制限 */
}
