/* NIE WORKSHEET CBT Styles */

:root {
    --nie-cbt-color-primary: #0073aa;
    --nie-cbt-color-primary-hover: #005177;
    --nie-cbt-color-success: #28a745;
    --nie-cbt-color-success-bg: #d4edda;
    --nie-cbt-color-success-border: #c3e6cb;
    --nie-cbt-color-success-dark: #155724;
    --nie-cbt-color-error-bg: #f8d7da;
    --nie-cbt-color-error-border: #f5c6cb;
    --nie-cbt-color-error-dark: #721c24;
    --nie-cbt-color-border: #ddd;
    --nie-cbt-color-text-gray: #666;
    --nie-cbt-color-gold: #e6b800;
}

/* Modal Base */
.nie-worksheet-cbt-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 0;
}

.nie-worksheet-cbt-modal.is-open {
    display: flex;
}

.nie-worksheet-cbt-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.nie-worksheet-cbt-modal-inner {
    position: relative;
    background: #fff;
    width: 90%;
    max-width: calc(800px - 40px);
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 10000;
}

.nie-worksheet-cbt-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
}

/* Thumbnail（アイキャッチ画像エリア） */
.nie-cbt-thumbnail {
    width: 100%;
    margin: 0 0 10px;
    overflow: hidden;
    border-radius: 4px;
    /* モーダルヘッダーのボタンと重ならないよう上部に余白 */
    padding-top: 20px;
}

.nie-cbt-thumbnail img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
}

/* NO IMAGE プレースホルダー */
.nie-cbt-thumbnail--noimage {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 80px;
    background: #f0f0f0;
    color: #999;
    font-size: 0.9em;
    letter-spacing: 0.05em;
    border-radius: 4px;
}

/* Quiz Content */
.nie-worksheet-cbt-quiz-area {
    padding-top: 20px;
    min-height: 300px;
}

/* Question */
.nie-worksheet-cbt-header {
    margin-bottom: 15px;
    /* font-size: 0.9em; */
    color: var(--nie-cbt-color-text-gray);
    font-size: 18px;
}

.nie-worksheet-cbt-question-text {
    font-size: 1.2em;
    font-weight: bold;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Choices */
.nie-worksheet-cbt-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.nie-worksheet-cbt-choice-btn {
    display: flex;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--nie-cbt-color-border);
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    text-align: left;
    transition: background 0.2s, border-color 0.2s;
    font-size: 1em;
    width: 100%;
}

.nie-worksheet-cbt-choice-btn:hover:not(:disabled) {
    background: #f0f0f0;
}

.choice-marker {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 24px;
    height: 24px;
    border: 1px solid #ccc;
    border-radius: 50%;
    margin-right: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

.nie-worksheet-cbt-choice-btn.is-correct {
    background: var(--nie-cbt-color-success-bg);
    border-color: var(--nie-cbt-color-success-border);
    color: var(--nie-cbt-color-success-dark);
}
.nie-worksheet-cbt-choice-btn.is-correct .choice-marker {
    border-color: var(--nie-cbt-color-success-dark);
    background: var(--nie-cbt-color-success-dark);
    color: #fff;
}

.nie-worksheet-cbt-choice-btn.is-incorrect {
    background: var(--nie-cbt-color-error-bg);
    border-color: var(--nie-cbt-color-error-border);
    color: var(--nie-cbt-color-error-dark);
}
.nie-worksheet-cbt-choice-btn.is-incorrect .choice-marker {
    border-color: var(--nie-cbt-color-error-dark);
    background: var(--nie-cbt-color-error-dark);
    color: #fff;
}

.nie-worksheet-cbt-choice-btn.is-correct-answer {
     border: 2px solid var(--nie-cbt-color-success);
}

/* Footer */
.nie-worksheet-cbt-footer {
    text-align: center;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.nie-worksheet-cbt-feedback {
    font-weight: bold;
    font-size: 1.1em;
}
.nie-worksheet-cbt-feedback.is-correct { color: var(--nie-cbt-color-success); }
.nie-worksheet-cbt-feedback.is-incorrect { color: #dc3545; }

/* Nav（ぶんちゃんエリアの下） */
.nie-worksheet-cbt-nav {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 8px;
}

.nie-worksheet-cbt-nav button {
    padding: 8px 16px;
    cursor: pointer;
    border: 1px solid var(--nie-cbt-color-border);
    background: #f8f8f8;
    border-radius: 4px;
}
.nie-worksheet-cbt-nav button.nie-worksheet-cbt-next-btn {
    background: var(--nie-cbt-color-primary);
    color: #fff;
    border-color: var(--nie-cbt-color-primary);
}
.nie-worksheet-cbt-nav button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Result */
.nie-worksheet-cbt-result {
    text-align: center;
    padding: 20px;
}
.score-text {
    font-size: 1.5em;
    margin: 20px 0;
}
.score-num {
    font-size: 2em;
    font-weight: bold;
    color: var(--nie-cbt-color-primary);
}
.perfect-message .congrats {
    color: var(--nie-cbt-color-gold); /* Gold */
    font-weight: bold;
    font-size: 1.2em;
}
.complete-img {
    max-width: 150px;
    margin: 20px auto;
    display: block;
}

/* Animations */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ぶんちゃんキャラクター画像エリア */
.nie-cbt-bunchan-area {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0 0;
}

.nie-cbt-bunchan-img {
    /* max-width: 180px; */
    /* width: 100%; */
    /* height: auto; */
    display: block;
    /* border-radius: 4px; */
}

/* ぶんちゃん画像のフェードインアニメーション */
.nie-cbt-bunchan-fade-in {
    animation: bunchanFadeIn 0.4s ease-in-out;
}

@keyframes bunchanFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Start Button */
.nie-worksheet-cbt-start-btn {
    /* padding: 10px 20px; */
    /* font-size: 1.2em; */
    /* background: var(--nie-cbt-color-primary); */
    /* color: #fff; */
    border: none;
    /* border-radius: 5px; */
    cursor: pointer;
}
.nie-worksheet-cbt-start-btn:hover {
    /* background: var(--nie-cbt-color-primary-hover); */
    opacity: 0.8;
}
.nie-worksheet-cbt-start-btn > img {
    max-width: 320px;
    width: 100%;
    height: auto;
}
/* Result Buttons */
.nie-worksheet-cbt-retry-btn,
.nie-worksheet-cbt-close-result-btn {
    background: transparent;
    border: 2px solid var(--nie-cbt-color-primary);
    color: var(--nie-cbt-color-primary);
    font-weight: bold;
    padding: 10px 24px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 5px;
}

.nie-worksheet-cbt-retry-btn:hover {
    background: var(--nie-cbt-color-primary);
    color: #fff;
}

.nie-worksheet-cbt-close-result-btn {
    border-color: var(--nie-cbt-color-text-gray);
    color: var(--nie-cbt-color-text-gray);
}

.nie-worksheet-cbt-close-result-btn:hover {
    background: var(--nie-cbt-color-text-gray);
    color: #fff;
}

.cbt-start-btn-wrapper {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

