* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans JP', sans-serif;
    background: #000000;
    color: #f0e6d2;
    min-height: 100vh;
    padding: 20px;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 20%, rgba(255, 215, 0, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(138, 43, 226, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-family: 'Noto Serif JP', serif;
    font-size: 2.5em;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 10px;
}

.header p a {
    color: #FFD700; /* Bright gold color */
    text-decoration: none; /* Remove underline */
    transition: color 0.3s ease;
}

.header p a:hover {
    color: #daa520; /* Darker gold on hover */
}

.start-button {
    background: linear-gradient(135deg, #daa520 0%, #b8860b 100%);
    color: #1a0f0a;
    border: 2px solid transparent; /* ホバー時の枠線表示のため */
    padding: 15px 30px;
    font-size: 1.2em;
    font-weight: bold;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 40px auto;
    display: block;
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.3);
}

.celtic-image {
    display: block;
    margin: 40px auto 20px auto; /* Center and add space below */
    max-width: 100%;
    width: 40%; /* Set width to 40% of its container */
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.start-button:hover {
    background: linear-gradient(135deg, #b8860b 0%, #a0780a 100%); /* Darker gold on hover */
    box-shadow: 0 6px 20px rgba(218, 165, 32, 0.4);
    border: 2px solid #FFD700; /* Bright gold border */
}

.celtic-cross {
    display: none; /* This will be set to 'grid' by JS */
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 20px;
    width: 100%;
    max-width: 600px;
    height: 600px;
    margin: 40px auto;
    padding: 20px;
}

.card {
    position: relative; /* For card-info positioning */
    height: 100%;
    aspect-ratio: 2 / 3; /* Keep a vertical aspect ratio */
    margin: auto; /* Center the card within the grid cell */
    background: url('images/card-back.jpg') no-repeat center center;
    background-size: cover;
    border: 2px solid #daa520;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9em;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.card:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(218, 165, 32, 0.4);
}

.card.flipped {
    background: #fff; /* Flipped card background */
    color: #2c1810;
    border-color: #b8860b;
    padding: 5px; /* Add some padding for the image */
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensure the image covers the card area */
    border-radius: 5px; /* Slightly rounded corners for the image */
    transition: transform 0.5s;
}

.reversed-image {
    transform: rotate(180deg);
}

.card.revealed {
    animation: flipCard 0.6s ease-in-out;
}

@keyframes flipCard {
    0% { transform: rotateY(0deg); }
    50% { transform: rotateY(90deg); }
    100% { transform: rotateY(0deg); }
}

/* ケルト十字の配置 (Grid) */
.card:nth-child(1) { grid-area: 2 / 2 / 3 / 3; z-index: 2; }
.card:nth-child(2) { grid-area: 2 / 2 / 3 / 3; transform: rotate(90deg); z-index: 3; }
.card:nth-child(3) { grid-area: 1 / 2 / 2 / 3; }
.card:nth-child(4) { grid-area: 3 / 2 / 4 / 3; }
.card:nth-child(5) { grid-area: 2 / 3 / 3 / 4; }
.card:nth-child(6) { grid-area: 2 / 1 / 3 / 2; }
.card:nth-child(7) { grid-area: 1 / 4 / 2 / 5; }
.card:nth-child(8) { grid-area: 2 / 4 / 3 / 5; }
.card:nth-child(9) { grid-area: 3 / 4 / 4 / 5; }
.card:nth-child(10) { grid-area: 4 / 4 / 5 / 5; }

.card-info {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: #daa520;
    text-align: center;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.card:hover .card-info {
    opacity: 1;
}

.results {
    display: none;
    margin-top: 50px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    border: 2px solid #daa520;
}

.results h2 {
    color: #daa520;
    margin-bottom: 20px;
    text-align: center;
}

.result-item {
    margin-bottom: 15px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border-left: 4px solid #daa520;
}

.result-item h3 {
    color: #daa520;
    margin-bottom: 5px;
}

.result-item p {
    white-space: pre-wrap; /* Preserve newlines and spaces */
}

.reset-button {
    background: linear-gradient(135deg, #daa520 0%, #b8860b 100%); /* Gold gradient */
    color: #1a0f0a; /* Dark text for contrast */
    border: none;
    padding: 12px 25px;
    font-size: 1em;
    font-weight: bold;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 20px auto;
    display: block;
    box-shadow: 0 4px 15px rgba(218, 165, 32, 0.3); /* Gold shadow */
}

.reset-button:hover {
    background: linear-gradient(135deg, #b8860b 0%, #a0780a 100%); /* Darker gold on hover */
    box-shadow: 0 6px 20px rgba(218, 165, 32, 0.4);
    border: 2px solid #FFD700; /* Bright gold border */
}

.progress {
    text-align: center;
    margin: 20px 0;
    color: #daa520;
    font-size: 1.1em;
}

.gold-line {
    border: none;
    border-top: 1px solid #FFD700;
    margin: 10px auto;
    width: 100%;
}

/* レスポンシブデザイン */
@media (max-width: 768px) {
    .header h1 {
        font-size: 2em;
    }

    .celtic-cross {
        max-width: 500px;
        height: 500px;
        gap: 15px;
    }

    .card {
        font-size: 0.7em;
    }
}

@media (max-width: 640px) {
    .celtic-cross {
        max-width: 100%;
        height: 450px;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    .celtic-cross {
        gap: 5px;
        height: 350px;
    }
    .card {
        font-size: 0.6em;
    }
    .card-info {
        font-size: 0.7em;
        bottom: -25px;
    }
}

.footer-text {
    text-align: center;
    font-size: 0.8em;
    color: #888888; /* Gray color */
    margin-top: 50px;
    padding-bottom: 20px;
}

#backToTopBtn {
    opacity: 0; /* Start fully transparent */
    visibility: hidden; /* Hidden by default, but allows transition */
    position: fixed; /* Fixed at the bottom right */
    bottom: 20px;
    right: 30px;
    z-index: 99; /* Ensure it's above other content */
    border: none;
    outline: none;
    background-color: #daa520; /* Gold background */
    color: #000000;
    font-weight: bold;
    cursor: pointer;
    width: 50px; /* Make it square */
    height: 50px; /* Make it square */
    border-radius: 50%; /* Make it circular */
    font-size: 18px;
    display: flex; /* Use flexbox for centering content */
    align-items: center; /* Center vertically */
    justify-content: center; /* Center horizontally */
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out; /* Smooth fade in/out */
}

#backToTopBtn:hover {
    background-color: #b8860b; /* Darker gold on hover */
}

#backToTopBtn.show {
    opacity: 1; /* Fully opaque when shown */
    visibility: visible; /* Make it visible */
}