/* =================================================================
 *  パスワード認証画面用のスタイル
 * ================================================================= */
.password-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #f0f2f5;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.password-box {
    background-color: white;
    padding: 30px 40px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    text-align: center;
    width: 90%;
    max-width: 400px;
}
.password-box h2 {
    color: #00529b;
    margin-top: 0;
    margin-bottom: 20px;
}
.password-box input {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    border: 1px solid #ced4da;
    border-radius: 8px;
    margin-bottom: 20px;
    box-sizing: border-box;
}
.password-box button {
    width: 100%;
    padding: 12px;
    font-size: 1.1em;
    color: white;
    background-color: #007bff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.password-box button:hover {
    background-color: #0069d9;
}
.error-message {
    color: #dc3545;
    margin-top: 15px;
    height: 1.2em;
}

/* =================================================================
 *  基本レイアウトとメインコンテナ
 * ================================================================= */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
}
.container {
    background-color: white;
    padding: 25px 40px;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 650px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}
h1, h2 {
    color: #00529b;
    margin-top: 0;
    margin-bottom: 25px;
}

/* =================================================================
 *  スタート画面 (学習ダッシュボード)
 * ================================================================= */
#start-container p {
    font-size: 1.1em;
    color: #6c757d;
}
#dashboard-list {
    text-align: left;
    max-height: 450px;
    overflow-y: auto;
    border-top: 1px solid #eee;
    margin-top: 20px;
    margin-bottom: 20px;
    width: 100%;
}
.dashboard-large-cat {
    margin-top: 15px;
    margin-bottom: 0;
    padding: 10px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
    color: #00529b;
    font-size: 1.2em;
}
.dashboard-large-cat:first-child {
    margin-top: 0;
}
.dashboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 10px;
    border-bottom: 1px solid #f0f0f0;
}
.dashboard-item:last-child {
    border-bottom: none;
}
.dashboard-cat-name {
    flex-grow: 1;
}
.dashboard-cat-name .medium-cat {
    font-size: 0.9em;
    color: #6c757d;
    display: block;
}
.dashboard-cat-name .small-cat {
    font-weight: bold;
    font-size: 1.1em;
}
.dashboard-progress {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
    font-size: 0.9em;
    color: #6c757d;
    min-width: 120px;
}
.dashboard-progress .score.perfect {
    color: #28a745;
    font-weight: bold;
}
.dashboard-buttons {
    display: flex;
    gap: 8px;
}
.dashboard-watch-btn, .dashboard-quiz-btn {
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    border: none;
    transition: background-color 0.2s;
    min-width: 70px;
}
.dashboard-watch-btn {
    background-color: #ffc107;
    color: #212529;
}
.dashboard-watch-btn:hover:not(:disabled) {
    background-color: #e0a800;
}
.dashboard-watch-btn:disabled {
    background-color: #e9ecef;
    color: #adb5bd;
    cursor: not-allowed;
}
.dashboard-quiz-btn {
    background-color: #007bff;
    color: white;
}
.dashboard-quiz-btn:hover {
    background-color: #0069d9;
}
.start-menu-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 400px;
}
.start-menu-buttons button {
    flex: 1;
    margin: 0;
    padding: 10px 15px;
    font-size: 1em;
    border-radius: 8px;
    cursor: pointer;
    border: none;
}
.secondary-btn {
    background-color: #6c757d !important;
    color: white;
}
.secondary-btn:hover {
    background-color: #5a6268 !important;
}

/* =================================================================
 *  動画学習画面
 * ================================================================= */
#video-container {
    width: 100%;
}
.video-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    margin-bottom: 20px;
    background-color: #000;
}
.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
#video-container .secondary-btn {
    margin-top: 10px;
}
#proceed-to-quiz-btn {
    font-size: 1.1em;
    padding: 12px 25px;
    margin: 10px 5px;
    border-radius: 8px;
    cursor: pointer;
    background-color: #28a745;
    color: white;
    border: none;
    transition: background-color 0.2s;
}
#proceed-to-quiz-btn:hover {
    background-color: #218838;
}

/* =================================================================
 *  クイズ画面
 * ================================================================= */
.category-display {
    font-size: 0.9em;
    color: #6c757d;
    margin-bottom: -10px;
    margin-top: -10px;
    text-align: left;
}
#question {
    font-size: 1.6em;
    margin-bottom: 25px;
    line-height: 1.4;
    min-height: 80px;
}
.choices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}
.choice-btn {
    width: 100%;
    padding: 15px;
    font-size: 1em;
    border: 2px solid #ddd;
    border-radius: 8px;
    background-color: #f9f9f9;
    cursor: pointer;
    transition: all 0.2s ease;
}
.choice-btn:hover:not(:disabled) {
    background-color: #e9ecef;
    border-color: #007bff;
}
.choice-btn:disabled {
    cursor: not-allowed;
}
#feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.2em;
    font-weight: bold;
    line-height: 1.5;
    min-height: 50px;
}
#feedback p {
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
}
.next-btn {
    display: block;
    width: 100%;
    max-width: 200px;
    margin: 15px auto 0;
    padding: 10px 20px;
    font-size: 1em;
    font-weight: bold;
    color: white;
    background-color: #007bff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}
.next-btn:hover {
    background-color: #0069d9;
}

/* =================================================================
 *  結果・振り返り・履歴画面の共通スタイル
 * ================================================================= */
#result-container p,
#review-container > p,
#history-container > p {
    font-size: 1.2em;
}
.result-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 25px;
}
.result-buttons button, #history-container button {
    margin: 0;
    padding: 12px 20px;
    font-size: 1em;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}
#save-review-image-btn { background-color: #ffc107; color: #212529; }
#save-review-image-btn:hover { background-color: #e0a800; }
#save-review-image-btn:disabled { background-color: #e9ecef; color: #6c757d; cursor: wait; }
#review-btn { background-color: #007bff; }
#review-btn:hover { background-color: #0069d9; }
#back-to-start-btn, #restart-btn, #back-to-start-from-history-btn { background-color: #28a745; }
#back-to-start-btn:hover, #restart-btn:hover, #back-to-start-from-history-btn:hover { background-color: #218838; }

/* =================================================================
 *  リストスタイル（解答一覧・学習履歴）
 * ================================================================= */
#review-list, #history-list {
    text-align: left;
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 10px 20px;
    border-radius: 8px;
    margin-top: 20px;
    margin-bottom: 20px;
}
.review-item, .history-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
}
.review-item:last-child, .history-item:last-child {
    border-bottom: none;
}
.review-question, .history-question {
    font-weight: bold;
    font-size: 1.1em;
    margin-bottom: 10px;
}
.review-user-answer, .review-correct-answer {
    margin: 5px 0 5px 20px;
    padding-left: 15px;
    border-left: 3px solid #ccc;
}
.review-correct-answer {
    color: #28a745;
    border-left-color: #28a745;
}
.review-user-answer.incorrect {
    color: #dc3545;
    border-left-color: #dc3545;
}
.mark {
    font-size: 0.9em;
    font-weight: bold;
    margin-left: 10px;
}
.mark.correct { color: #28a745; }
.mark.incorrect { color: #dc3545; }
.history-stats {
    display: flex;
    gap: 20px;
    margin-left: 15px;
}
.history-correct { color: #28a745; }
.history-incorrect { color: #dc3545; }