:root {
    --bg-color: #3d2c1d;
    --panel-bg: rgba(20, 15, 10, 0.6);
    --text-color: #f5f5f5;
    --primary-color: #ff9800;
    --correct-color: #4CAF50;
    --incorrect-color: #f44336;
    --font-family-title: 'Zen Maru Gothic', sans-serif;
    --font-family-body: 'Noto Sans JP', sans-serif;
}

body {
    margin: 0;
    font-family: var(--font-family-body);
    background-color: var(--bg-color);
    background-image: 
        linear-gradient(135deg, rgba(0,0,0,0.2) 25%, transparent 25%),
        linear-gradient(225deg, rgba(0,0,0,0.2) 25%, transparent 25%),
        linear-gradient(45deg, rgba(0,0,0,0.2) 25%, transparent 25%),
        linear-gradient(315deg, rgba(0,0,0,0.2) 25%, #3d2c1d 25%);
    background-size: 20px 20px;
    background-attachment: fixed; /* Fix background during scroll */
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    box-sizing: border-box;
    overflow-x: hidden;
    position: relative;
}

/* Flash effect for correct/incorrect answers */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease-out;
}
body.correct-flash::after {
    background-color: var(--correct-color);
    opacity: 0.3;
}
body.incorrect-flash::after {
    background-color: var(--incorrect-color);
    opacity: 0.3;
}

.container {
    width: 100%;
    max-width: 600px;
    background: var(--panel-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 2rem;
    box-sizing: border-box;
    text-align: center;
    animation: fadeIn 0.8s ease-out;
    z-index: 10;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none;
}

/* --- Start Screen --- */
#start-screen h1 {
    font-family: var(--font-family-title);
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-shadow: 0 0 15px var(--primary-color);
}

#start-screen p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    line-height: 1.6;
}

.sauna-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: steam 3s infinite ease-in-out;
}

@keyframes steam {
    0%, 100% { transform: translateY(0) scale(1); opacity: 0.8; }
    50% { transform: translateY(-10px) scale(1.05); opacity: 1; }
}

/* --- Quiz Screen --- */
#question-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
}

#question-text {
    font-size: 1.5rem;
    font-weight: 500;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1.5;
    margin-bottom: 2rem;
}

#choices-container {
    display: grid;
    gap: 1rem;
}

.choice-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    padding: 1rem;
    font-size: 1.1rem;
    font-family: var(--font-family-body);
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.choice-btn:hover:not(:disabled) {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(255, 152, 0, 0.3);
}

.choice-btn:disabled {
    cursor: not-allowed;
}

.choice-btn.correct {
    background-color: var(--correct-color);
    border-color: var(--correct-color);
    color: white;
    transform: scale(1.02);
}

.choice-btn.incorrect {
    background-color: var(--incorrect-color);
    border-color: var(--incorrect-color);
    color: white;
}

.choice-btn:disabled:not(.correct):not(.incorrect) {
     opacity: 0.6;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* --- Explanation Modal --- */
#explanation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#explanation-modal.visible {
    opacity: 1;
    pointer-events: auto;
}

.explanation-content {
    background: var(--panel-bg);
    padding: 2rem 2.5rem;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

#explanation-modal.visible .explanation-content {
    transform: scale(1);
}

#explanation-title {
    font-size: 1.8rem;
    font-family: var(--font-family-title);
    margin-top: 0;
    margin-bottom: 1rem;
}

#explanation-title.correct { color: var(--correct-color); }
#explanation-title.incorrect { color: var(--incorrect-color); }

#explanation-text {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    text-align: left;
}

/* --- Result Screen --- */
#result-screen h2 {
    font-family: var(--font-family-title);
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.result-chart-container {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 2rem auto;
}

.result-chart-container svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.chart-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 15;
}

.chart-bar {
    fill: none;
    stroke: url(#gradient);
    stroke-width: 15;
    stroke-linecap: round;
    stroke-dasharray: 565.48; /* 2 * PI * 90 */
    stroke-dashoffset: 565.48;
    transition: stroke-dashoffset 2s cubic-bezier(0.65, 0, 0.35, 1);
}

.chart-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#score-percentage {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-color);
}

#score-percentage span {
    font-size: 1.5rem;
}

#result-title {
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font-family-title);
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

#result-message {
    font-size: 1.1rem;
    line-height: 1.7;
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.btn {
    background-color: var(--primary-color);
    color: var(--bg-color);
    font-family: var(--font-family-title);
    font-weight: 700;
    font-size: 1.2rem;
    padding: 0.8rem 2rem;
    border-radius: 50px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(255, 152, 0, 0.4);
}

/* --- Media Queries for smaller screens --- */
@media (max-width: 480px) {
    .container { padding: 1.5rem; }
    #start-screen h1 { font-size: 2rem; }
    #question-text { font-size: 1.3rem; min-height: 80px; }
    .choice-btn { font-size: 1rem; padding: 0.8rem; }
    #result-screen h2 { font-size: 1.8rem; }
    .result-chart-container { width: 180px; height: 180px; }
    #score-percentage { font-size: 2.5rem; }
    #result-title { font-size: 1.5rem; }
    #result-message { font-size: 1rem; }
    .explanation-content { padding: 1.5rem; }
    #explanation-title { font-size: 1.5rem; }
    #explanation-text { font-size: 1rem; }
}
