:root {
    --primary-color: #e67e22;
    /* ツールボックスオレンジ */
    --secondary-color: #d35400;
    /* 濃いオレンジ */
    --accent-color: #34495e;
    /* メタリックグレー */
    --bg-color: #f3e5ab;
    /* 明るい木の色 */
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --correct-color: #27ae60;
    --incorrect-color: #3ce7cb;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Zen Maru Gothic', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

.background-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.03) 100%);
}

.gear {
    position: absolute;
    font-size: 5rem;
    opacity: 0.15;
    color: #7f8c8d;
    /* 灰色（アスベスト） */
    animation: rotateGear 10s linear infinite;
    filter: drop-shadow(0 0 5px rgba(0, 0, 0, 0.1));
}

.gear-1 {
    top: -40px;
    left: -40px;
}

.gear-2 {
    bottom: -40px;
    right: -40px;
    animation-duration: 15s;
    animation-direction: reverse;
}

.gear-3 {
    top: 50%;
    right: -20px;
    font-size: 5rem;
    animation-duration: 12s;
}

@keyframes rotateGear {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.tool-bg-icon {
    position: absolute;
    font-size: 3rem;
    opacity: 0.05;
    filter: grayscale(1);
    transform: rotate(15deg);
}

.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;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.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: var(--card-bg);
    padding: 30px;
    border-radius: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    text-align: center;
    border-top: 10px solid var(--primary-color);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.screen.active {
    display: block;
}

.icon {
    font-size: 5rem;
    margin: 30px 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CSSアート: 道具箱 */
.css-toolbox {
    width: 200px;
    height: 120px;
    background-color: #c0392b;
    /* 赤い道具箱 */
    border-radius: 10px;
    position: relative;
    box-shadow: 0 10px 0 #962d22, 0 15px 25px rgba(0, 0, 0, 0.2);
    margin: 40px auto;
}

.css-toolbox::before {
    content: '';
    position: absolute;
    top: -20px;
    left: 40px;
    right: 40px;
    height: 20px;
    background-color: #34495e;
    border-radius: 10px 10px 0 0;
    z-index: -1;
}

.css-toolbox-handle {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 40px;
    border: 8px solid #b2bec3;
    border-bottom: none;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.css-toolbox-latch {
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 20px;
    background-color: #f1c40f;
    border-radius: 3px;
}

.css-toolbox-shadow {
    position: absolute;
    bottom: -15px;
    left: 10%;
    width: 80%;
    height: 10px;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 50%;
    filter: blur(5px);
}

.tool-sticking-out {
    position: absolute;
    font-size: 3rem;
    z-index: -1;
    animation: toolBounce 2s ease-in-out infinite;
}

@keyframes toolBounce {

    0%,
    100% {
        transform: translateY(0) rotate(15deg);
    }

    50% {
        transform: translateY(-15px) rotate(20deg);
    }
}

.btn {
    padding: 12px 35px;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Zen Maru Gothic', sans-serif;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.btn:active {
    transform: scale(0.95);
}

.btn.large {
    background-color: var(--primary-color);
    color: white;
}

.back-link {
    display: block;
    margin-top: 20px;
    color: #888;
    text-decoration: none;
    font-size: 1rem;
}

.back-link:hover {
    text-decoration: underline;
}

.quiz-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent-color);
}

.question-box {
    background: #fdfaf0;
    padding: 30px;
    border-radius: 20px;
    margin-bottom: 30px;
    border: 2px dashed var(--primary-color);
}

.question-box h2 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--text-color);
}

.choices-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.choice-btn {
    padding: 15px 20px;
    font-size: 1.2rem;
    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;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.choice-btn:hover {
    background-color: #f9f9f9;
    border-color: var(--primary-color);
    transform: translateX(5px);
}

.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: #f8f9fa;
    border-radius: 20px;
    border-left: 8px solid var(--primary-color);
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.hidden {
    display: none;
}

.explanation-box {
    margin: 15px 0;
    text-align: left;
    font-size: 1.1rem;
    line-height: 1.8;
}

.btn.next,
.btn.retry {
    background-color: var(--accent-color);
    color: white;
    margin-top: 15px;
    width: 100%;
}

.final-score {
    margin: 20px 0;
    font-size: 2.2rem;
    font-weight: bold;
    color: var(--primary-color);
}

footer {
    text-align: center;
    padding: 25px;
    color: #666;
    background: white;
    border-top: 5px solid var(--accent-color);
}

@media (max-width: 600px) {
    .container {
        padding: 10px;
        margin: 10px auto;
    }

    .screen {
        padding: 25px;
    }

    h1 {
        font-size: 1.8rem;
    }

    .question-box h2 {
        font-size: 1.4rem;
    }

    .choice-btn {
        font-size: 1.2rem;
    }
}