:root {
    --primary-color: #6d4c41;
    /* 落ち着いた茶色（古文書） */
    --secondary-color: #3e2723;
    /* 濃い茶色 */
    --accent-color: #c62828;
    /* 朱色 */
    --bg-color: #f5f5f5;
    --paper-color: #fff9c4;
    /* 和紙風の黄色 */
    --text-color: #2b1d0e;
    --correct-color: #2e7d32;
    --incorrect-color: #d32f2f;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
    background-image: radial-gradient(#d7ccc8 1px, transparent 1px);
    background-size: 30px 30px;
}

.scroll-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    opacity: 0.15;
}

.hist-icon {
    position: absolute;
    font-size: 5rem;
    filter: sepia(1);
}

.container {
    max-width: 800px;
    margin: 40px auto;
    padding: 20px;
    width: 100%;
    flex: 1;
    z-index: 1;
}

.progress-bar-container {
    width: 100%;
    height: 12px;
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    margin-bottom: 30px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.4s ease;
}

.screen {
    display: none;
    background: white;
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 8px double var(--primary-color);
    animation: fadeIn 0.6s ease-out;
    background-image: url('https://www.transparenttextures.com/patterns/papyree.png');
    /* 古文書のような質感 */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.screen.active {
    display: block;
}

.era-badge {
    display: inline-block;
    padding: 5px 15px;
    background: var(--accent-color);
    color: white;
    border-radius: 5px;
    font-weight: bold;
    margin-bottom: 15px;
    letter-spacing: 2px;
}

h1 {
    color: var(--secondary-color);
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.hero-image {
    font-size: 4rem;
    margin: 20px 0;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.btn {
    padding: 15px 40px;
    font-size: 1.2rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    font-family: 'Zen Maru Gothic', sans-serif;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn.large {
    background-color: var(--accent-color);
    color: white;
}

.back-link {
    display: block;
    margin-top: 25px;
    color: var(--primary-color);
    text-decoration: none;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--secondary-color);
    border-bottom: 2px solid var(--paper-color);
    padding-bottom: 10px;
}

.question-box {
    background: var(--paper-color);
    padding: 20px;
    border-radius: 15px;
    margin-bottom: 20px;
    border: 2px solid #e0e0e0;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.05);
}

#question-text {
    font-size: 1.35rem;
    color: var(--text-color);
    line-height: 1.6;
}

.choices-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.choice-btn {
    padding: 15px 20px;
    font-size: 1.15rem;
    font-weight: bold;
    background-color: #fff;
    border: 3px solid #eee;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: 'Zen Maru Gothic', sans-serif;
}

.choice-btn:hover {
    background-color: var(--paper-color);
    border-color: var(--primary-color);
    padding-left: 35px;
}

.choice-btn.correct {
    background-color: var(--correct-color);
    color: white;
    border-color: var(--correct-color);
}

.choice-btn.incorrect {
    background-color: var(--incorrect-color);
    color: white;
    border-color: var(--incorrect-color);
}

.feedback-area {
    margin-top: 35px;
    padding: 25px;
    background-color: #fafafa;
    border-radius: 20px;
    border-left: 10px solid var(--accent-color);
    text-align: left;
}

.feedback-area h3 {
    margin-top: 0;
}

.btn.next,
.btn.retry {
    background-color: var(--secondary-color);
    color: white;
    margin-top: 20px;
    width: 100%;
}

.final-score {
    margin: 30px 0;
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--accent-color);
}

footer {
    text-align: center;
    padding: 25px;
    background: #fff;
    border-top: 1px solid #ddd;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .screen {
        padding: 25px 15px;
    }

    h1 {
        font-size: 1.6rem;
    }

    #question-text {
        font-size: 1.3rem;
    }

    .choice-btn {
        font-size: 1.1rem;
    }
}