/* 基本設定 */
html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
}

body {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* コンテナ */
.container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    width: 100%;
    box-sizing: border-box;
    overflow-y: auto;
}

/* タイトル */
h1 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.8em;
}

/* セットアップエリア */
.setup-area {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

select {
    padding: 10px 15px;
    margin: -10px 0 5px 0; /* 上方向にマイナス値でずらす */
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
}


/* ローディング表示 */
#loading {
    display: none;
    text-align: center;
    color: #007bff;
    font-size: 18px;
    margin: 10px 0;
}

/* クイズエリア */
#quiz-area {
    display: none;
    flex: 1;
    flex-direction: column;
    justify-content: flex-start;
}

#progress-area {
    width: calc(100% - 40px);
    max-width: 600px;
    margin: -20px auto 10px auto; /* 上に10pxずらす */
    font-weight: bold;
    text-align: right;
    box-sizing: border-box;
}


/* 問題文 */
#question-text {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 15px;
    color: #333;
    text-align: center;
    border: 2px solid #007bff;
    border-radius: 6px;
    padding: 12px;
    background-color: #f9fcff;
    width: calc(100% - 40px);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

#options-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    top: -7px; /* 上方向に20pxずらす */
}


.option-item {
    padding: 12px;
    margin: 4px 0;
    background-color: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 40px);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
    font-size: 1rem;
}

/* ホバー */
.option-item:hover {
    background-color: #e9ecef;
    border-color: #007bff;
}

/* ○／×マーク（文字の頭に） */
.option-item::before {
    content: attr(data-symbol);
    margin-right: 8px;
    font-weight: bold;
    font-size: 1.8rem;
}

/* 正解 */
.option-item.correct {
    background-color: #d4edda;
    border-color: #28a745;
    color: #155724;
}
.option-item.correct::before {
    color: #28a745;
}

/* 不正解 */
.option-item.incorrect {
    background-color: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}
.option-item.incorrect::before {
    color: #dc3545;
}

#rationale-box {
    display: none;
    margin: -20px auto 0 auto; /* 外側の余白は必要に応じて調整 */
    padding: 2px 8px;          /* 上下の内側余白を狭くする */
    background-color: #e7f3ff;
    border-left: 4px solid #007bff;
    border-radius: 5px;
    font-size: 0.95em;
    width: calc(100% - 40px);
    max-width: 600px;
    box-sizing: border-box;
}

/* rationale-box 内の各解説ブロック */
#rationale-box .rationale-item {
    background-color: #e7f3ff;
    padding: 15px 8px;      /* 上下左右の余白を小さく */
    margin-bottom: 4px;    /* 下の余白を小さく */
    border-radius: 5px;
}



.rationale-incorrect {
    background-color: #f8d7da;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 8px;
    margin-top: -15px; /* 上にずらす */
}

/* 次の問題ボタン */
#next-question-btn {
    display: block;            
    margin: 1px auto 0 auto;
    padding: 10px 15px;
    width: calc(100% - 40px);
    max-width: 300px;
    background-color: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    box-sizing: border-box;
    transition: background-color 0.3s;
}

#next-question-btn:hover {
    background-color: #218838;
}

/* APIキー入力エリア（任意） */
.api-key-area {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 5px;
}

.api-key-area input {
    width: 100%;
    max-width: 400px;
    padding: 8px;
    margin: 5px 0;
    box-sizing: border-box;
}

/* スマホ対応 */
@media (max-width: 480px) {
    .container {
        padding: 10px;
    }

    #question-text,
    .option-item,
    #rationale-box,
    #next-question-btn {
        width: 100%;
        max-width: 100%;
        padding: 12px;
        box-sizing: border-box;
    }

    .option-item::before {
        font-size: 1.5rem;
        margin-right: 6px;
    }
}
