/* Common Styles */
/* Header Styles */
.header {
    background-color: #fff;
    color: #064583;
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
    position: relative; /* Add this for toggle button positioning */
}

.header-title {
    color: #064583;
    text-decoration: none;
    display: block;
}

.header h1 {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 2.5rem;
    margin-bottom: 5px;
    color: #064583; 
}

.header .subtitle {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    color: #8ABAD3; 
    font-size: 1.2rem;
}

.subtitle span {
    font-weight: bold;
    color: #064583; 
    font-size: 2.0rem;
}

/* Toggle buttons styles */
.toggle-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
}

.toggle-btn {
    width: auto;
    padding: 8px 16px;
    margin: 0;
    background-color: #00AEEF;
    color: #fff;
    border: 2px solid #00AEEF;
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    background-color: #064583;
    border-color: #064583;
}

button, select, input[type="text"] {
    border-color: #00AEEF; 
}

button {
    background-color: #064583;
}

button:hover {
    background-color: #008ec5; 
}

.options .option.correct {
    background-color: #d0e9c6; /* 薄い緑 */
}

.options .option.incorrect {
    background-color: #f8d7da; /* 薄い赤 */
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #fff;
    margin: 0;
    padding: 0;
}

/* ------------------------------------------------------------
   Modern UI refinements (CSS-only): keep the same color palette
   ------------------------------------------------------------ */
:root {
    --caves-blue: #064583;
    --caves-cyan: #00AEEF;
    --caves-light: #D6F4FE;
    --caves-muted: #8ABAD3;

    --radius-lg: 16px;
    --radius-md: 12px;
    --shadow-sm: 0 2px 10px rgba(6, 69, 131, 0.08);
    --shadow-md: 0 10px 30px rgba(6, 69, 131, 0.12);
}

body {
    /* Subtle near-white to make cards pop while keeping the same "white" feel */
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 20px auto;
    padding: 24px;
    background-color: #fff;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    box-sizing: border-box;
}

/* Make each section feel like a card block */
.input-section {
    margin-bottom: 18px;
}

.input-section label {
    font-weight: 700;
    color: var(--caves-blue);
    letter-spacing: 0.2px;
}

.flex-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}

.flex-container > div {
    flex: 1 1 auto;
    margin: 0.5em;
    text-align: center;
}

h1 {
    color: #333;
    text-align: center;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.subtitle {
    color: #666;
    text-align: center;
    font-size: 1rem;
    margin-bottom: 20px;
}

.input-section {
    margin-bottom: 15px;
}

.input-section label {
    font-weight: bold;
    display: block;
    margin-bottom: 5px;
}

.input-section input[type="text"],
.input-section select {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: var(--radius-md);
    box-sizing: border-box;
    font-size: 1rem;
    background-color: #fff;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.input-section input[type="text"]:focus,
.input-section select:focus {
    outline: none;
    border-color: var(--caves-cyan);
    box-shadow: 0 0 0 4px rgba(0, 174, 239, 0.18);
}

button {
    width: 100%;
    padding: 15px;
    background-color: var(--caves-blue);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.25s ease, transform 0.15s ease, box-shadow 0.25s ease;
    display: block;
    margin: 0 auto;
    box-shadow: var(--shadow-sm);
}

button:hover {
    background-color: #04386a;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

button:active {
    transform: translateY(0);
}

/* Mode-select buttons (still <button>, but styled like selectable cards) */
#mode-select .toggle-btn {
    width: 100% !important;
    padding: 16px 16px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0, 174, 239, 0.45);
    background: #fff;
    color: var(--caves-blue);
    box-shadow: var(--shadow-sm);
    text-align: left;
    font-weight: 700;
}

#mode-select .toggle-btn:hover {
    background: var(--caves-light);
    border-color: var(--caves-cyan);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Keep the header toggle buttons as "pill" buttons */
.toggle-buttons .toggle-btn {
    width: auto;
    padding: 8px 16px;
    border-radius: 999px;
    background-color: var(--caves-cyan);
    border: 2px solid var(--caves-cyan);
    color: #fff;
    box-shadow: none;
    text-align: center;
    font-weight: 600;
}

.toggle-buttons .toggle-btn:hover {
    background-color: var(--caves-blue);
    border-color: var(--caves-blue);
    transform: none;
    box-shadow: none;
}

#loading {
    text-align: center;
    padding: 20px;
}

.loader {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}


#quiz-section {
    margin-top: 20px;
}

#question-text {
    font-size: 1rem;
    margin-bottom: 15px;
    padding: 12px;
    background-color: #fff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 174, 239, 0.25);
    box-shadow: var(--shadow-sm);
    line-height: 1.6;
}

.options {
    margin-bottom: 15px;
}

.options .option {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 12px;
    background-color: #fff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(214, 244, 254, 1);
    box-shadow: 0 1px 8px rgba(6, 69, 131, 0.06);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

/* ------------------------------
   Native Rating (1-5) UI
   ------------------------------ */
.rating-row {
    padding: 12px;
    margin-bottom: 10px;
    background-color: #fff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(214, 244, 254, 1);
    box-shadow: 0 1px 8px rgba(6, 69, 131, 0.06);
}

.rating-word {
    font-weight: 700;
    color: var(--caves-blue);
    margin-bottom: 8px;
}

.rating-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.rating-option {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(0, 174, 239, 0.35);
    background: #fbfdff;
    cursor: pointer;
}

.rating-option input[type="radio"] {
    margin: 0;
}

.rating-legend {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
}

.options .option:hover {
    background-color: #fbfdff;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.options input[type="radio"] {
    margin-right: 10px;
}

#evaluation {
    margin-top: 15px;
}

.probability-item {
    display: flex;
    flex-direction: column;
    padding: 10px;
    margin-bottom: 8px;
    background-color: #fff;
    border-radius: var(--radius-md);
    border: 1px solid rgba(214, 244, 254, 1);
    box-shadow: 0 1px 8px rgba(6, 69, 131, 0.06);
}

.probability-item.selected {
    background-color: #b3e0f5; 
}

.explanation {
    margin-top: 15px;
    padding: 12px;
    background-color: #b3e0f5; 
    border-radius: var(--radius-md);
}

#final-results {
    text-align: center;
    margin-top: 25px;
}

#average-score h4 {
    margin-bottom: 8px;
    font-size: 1.2rem;
}

#average-score p.average {
    font-size: 2.5rem;
    color: #ff0000;
    margin: 0;
}

.summary-table {
    width: 100%;
    margin: 15px 0;
    border-collapse: collapse;
}

.summary-table th,
.summary-table td {
    border: 1px solid #D6F4FE;
    padding: 10px;
    font-size: 0.9rem;
}

.summary-table th {
    background-color: #D6F4FE;
}

.checkbox-container {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    margin-bottom: 0;
}

.checkbox-container input[type="checkbox"] {
    width: auto;
    margin-right: 10px;
    margin-bottom: 0;
}

.checkmark {
    margin-left: 5px;
}

/* Help icon styles */
.help-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: #00AEEF;
    color: white;
    text-align: center;
    line-height: 20px;
    font-size: 14px;
    font-weight: bold;
    margin-left: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.help-icon:hover {
    background-color: #064583;
}

/* Modal styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: none;
    border-radius: 8px;
    width: 80%;
    max-width: 500px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
}

.modal-content h3 {
    color: #064583;
    margin-top: 0;
}

.modal-content ul {
    text-align: left;
    line-height: 1.6;
}

.modal-content li {
    margin-bottom: 10px;
}

/* Responsive Design */

/* For smartphones (screens less than 600px wide) */
@media (max-width: 600px) {
    body {
        font-size: 1rem;
    }

    .container {
        max-width: 350px;
        padding: 10px;
        margin: 10px auto;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    button {
        padding: 10px;
        font-size: 1rem;
    }

    #question-text {
        font-size: 1rem;
        padding: 10px;
    }

    .options .option {
        padding: 10px;
        font-size: 1rem;
    }

    .probability-item {
        padding: 8px;
        font-size: 1rem;
    }

    .explanation {
        padding: 10px;
        font-size: 1rem;
    }

    #average-score h4 {
        font-size: 1rem;
    }

    #average-score p.average {
        font-size: 2rem;
    }

    .summary-table th,
    .summary-table td {
        padding: 8px;
        font-size: 0.9rem;
    }
    .checkbox-container {
        font-size: 14px;
    }
        .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 15px;
    }
    
    .help-icon {
        width: 18px;
        height: 18px;
        line-height: 18px;
        font-size: 12px;
    }
}

.footer {
    background-color: #00AEEF;
    color: #fff;
    padding: 20px;
    text-align: center;
    margin-top: 20px; 
}

.footer-text {
    font-family: 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    margin: 5px 0;
}
