* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f4f6f8;
    color: #222;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans JP",
        sans-serif;
}

.container {
    width: min(1100px, 94%);
    margin: 0 auto;
}

.header {
    padding: 32px 0 20px;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header h1 {
    margin: 0;
    font-size: 32px;
}

.header p {
    margin: 8px 0 0;
    color: #666;
}

.card {
    background: #fff;
    margin: 18px 0;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 22px;
}

.card-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.setting-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.setting-item {
    padding: 16px;
    background: #f7f8fa;
    border-radius: 8px;
}

.label {
    display: block;
    margin-bottom: 6px;
    color: #777;
    font-size: 13px;
}

.question-status {
    display: flex;
    align-items: center;
}

.big-number {
    font-size: 42px;
    margin-right: 4px;
}

.notice {
    margin-top: 20px;
    padding: 16px;
    background: #fff8e1;
    border-radius: 8px;
}

.notice p {
    margin-bottom: 0;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.category {
    padding: 18px 10px;
    text-align: center;
    background: #f1f4f7;
    border-radius: 8px;
    font-weight: 600;
}

.feature-list {
    margin: 0;
    padding-left: 24px;
    line-height: 2;
}

.footer {
    padding: 30px 0 50px;
    text-align: center;
    color: #888;
    font-size: 13px;
}


/* ============================================================
   Buttons
   ============================================================ */

.button {
    display: inline-block;
    padding: 11px 18px;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid transparent;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        border-color 0.15s ease,
        opacity 0.15s ease;
}

.button:hover {
    opacity: 0.85;
}

.button.primary {
    background: #2563eb;
    color: #fff;
}

.button.secondary {
    background: #fff;
    color: #333;
    border-color: #d1d5db;
}


/* ============================================================
   Settings form
   ============================================================ */

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-group select,
.form-group input[type="number"] {
    width: 100%;
    max-width: 560px;
    padding: 12px 14px;
    border: 1px solid #cfd4da;
    border-radius: 8px;
    background: #fff;
    color: #222;
    font-size: 16px;
}

.form-group select:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.form-help {
    max-width: 560px;
    margin: 7px 0 0;
    color: #777;
    font-size: 13px;
    line-height: 1.6;
}

.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 30px;
}


/* ============================================================
   Flash messages
   ============================================================ */

.flash {
    margin: 18px 0;
    padding: 14px 16px;
    border-radius: 8px;
    font-weight: 600;
}

.flash.success {
    background: #e8f5e9;
    color: #216e39;
    border: 1px solid #b7dfc0;
}

.flash.error {
    background: #fdecec;
    color: #a12a2a;
    border: 1px solid #efb4b4;
}


/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 700px) {

    .setting-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .header-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .header h1 {
        font-size: 26px;
    }

    .card {
        padding: 18px;
    }

    .form-group select,
    .form-group input[type="number"] {
        max-width: none;
    }

}

@media (max-width: 450px) {

    .setting-grid {
        grid-template-columns: 1fr;
    }

}


/* ============================================================
   Study
   ============================================================ */

.study-progress {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;

    margin: 18px 0;
    padding: 16px 20px;

    background: #fff;
    border-radius: 12px;

    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.study-progress strong {
    font-size: 20px;
}

.study-card {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.question-number {
    margin-bottom: 18px;

    color: #666;
    font-size: 14px;
    font-weight: 600;
}

.question-text {
    margin-bottom: 28px;

    font-size: 22px;
    line-height: 1.8;
    white-space: pre-wrap;
}

.translation {
    margin-bottom: 24px;
    padding: 14px 16px;

    background: #f7f8fa;
    border-radius: 8px;

    color: #666;
    line-height: 1.7;
    white-space: pre-wrap;
}

.choice-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.choice {
    display: flex;
    align-items: flex-start;
    gap: 12px;

    padding: 16px;

    border: 1px solid #d1d5db;
    border-radius: 10px;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        border-color 0.15s ease;
}

.choice:hover {
    background: #f7f8fa;
}

.choice input {
    margin-top: 4px;
}

.choice-number {
    min-width: 28px;

    font-weight: 700;
}

.choice-text {
    line-height: 1.6;
}

.disabled {
    background: #e5e7eb;
    color: #777;
    cursor: not-allowed;
}


/* ============================================================
   Result
   ============================================================ */

.result-summary {
    text-align: center;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.result-item {
    padding: 20px;

    background: #f7f8fa;
    border-radius: 10px;
}

.result-big {
    display: block;

    margin: 8px 0;

    font-size: 36px;
}


.result-table-wrapper {
    overflow-x: auto;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
}

.result-table th,
.result-table td {
    padding: 12px;

    border-bottom: 1px solid #e5e7eb;

    text-align: left;
}

.result-table th {
    background: #f7f8fa;
}

.wrong-question-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.question-result {
    padding: 16px;

    border-radius: 8px;

    line-height: 1.6;
}


.question-result-correct {
    background: #f2faf3;

    border: 1px solid #b9dfc0;
}


.question-result-wrong {
    background: #fff7f7;

    border: 1px solid #f0caca;
}


/*
   「今回間違えた問題」は従来どおり赤系
*/

.wrong-question {
    padding: 16px;

    background: #fff7f7;

    border: 1px solid #f0caca;
    border-radius: 8px;

    line-height: 1.6;
}

.wrong-question-number {
    margin-bottom: 6px;

    font-weight: 700;
}

.question-category {
    margin-top: 8px;

    color: #777;
    font-size: 13px;
}


/* ============================================================
   Study / Result Responsive
   ============================================================ */

@media (max-width: 700px) {

    .study-progress {
        align-items: flex-start;
        flex-direction: column;
    }

    .question-text {
        font-size: 19px;
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

}


/* ============================================================
   Listening feedback
   ============================================================ */

.feedback-card {
    max-width: 900px;
}


.feedback-audio {
    margin-bottom: 28px;
}


.feedback-audio audio {
    width: 100%;
    max-width: 700px;
}


.feedback-result {
    margin-bottom: 28px;
    padding: 18px 20px;

    border-radius: 10px;

    font-size: 22px;
    font-weight: 700;
}


.feedback-correct {
    background: #eef8f0;
    border: 1px solid #b9dfc0;
}


.feedback-incorrect {
    background: #fff1f1;
    border: 1px solid #e2bcbc;
}


.feedback-result-title {
    line-height: 1.5;
}


.feedback-choices {
    display: flex;
    flex-direction: column;
    gap: 10px;

    margin-bottom: 34px;
}


.feedback-choice {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 14px 16px;

    border: 1px solid #ddd;
    border-radius: 8px;

    background: #fff;
}


.feedback-choice-correct {
    border-color: #8fc69a;
    background: #f2faf3;
}


.feedback-choice-selected-wrong {
    border-color: #d8a0a0;
    background: #fff5f5;
}


.feedback-choice-label {
    margin-left: auto;

    font-size: 13px;
    font-weight: 700;

    white-space: nowrap;
}


.feedback-section {
    margin-top: 32px;
}


.feedback-section h2 {
    margin-bottom: 12px;

    font-size: 18px;
    line-height: 1.5;
}


.feedback-text {
    padding: 16px;

    border-radius: 8px;

    background: #f7f8fa;

    line-height: 1.8;

    white-space: pre-wrap;
}


.feedback-text.transcript {
    font-family:
        ui-monospace,
        SFMono-Regular,
        Menlo,
        Monaco,
        Consolas,
        "Liberation Mono",
        monospace;
}


.feedback-actions {
    margin-top: 36px;
}


@media (max-width: 600px) {

    .feedback-result {
        font-size: 20px;
    }


    .feedback-choice {
        padding: 12px;
    }


    .feedback-choice-label {
        font-size: 12px;
    }


    .feedback-text {
        padding: 14px;
    }

}
