html {
    scroll-behavior: smooth;
}

body {
    background-color: #1a1a1a;
    color: #e0e0e0;
    font-family: 'Roboto', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    padding-top: 60px; /* Add padding to prevent content from being hidden by fixed nav */
    text-align: center;
    box-sizing: border-box;
}

#top-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(10, 10, 10, 0.95);
    z-index: 1000;
    padding: 10px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    border-bottom: 1px solid #b22222;
}

#top-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px 40px;
}

#top-nav li a {
    color: #e0e0e0;
    text-decoration: none;
    font-family: 'Creepster', cursive;
    font-size: 1.5rem;
    letter-spacing: 1px;
    transition: color 0.3s ease, text-shadow 0.3s ease;
    padding: 5px;
}

#top-nav li a:hover {
    color: #b22222;
    text-shadow: 0 0 5px #ff4500;
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#game-container {
    width: 90%;
    max-width: 1600px;
    padding: 20px;
}

header h1 {
    font-family: 'Creepster', cursive;
    font-size: 4rem;
    color: #b22222;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px #000;
}

#instructions {
    font-size: 1.2rem;
    margin-bottom: 20px;
}

#game-board {
    display: flex;
    justify-content: space-around;
    gap: 20px;
}

.image-column {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    justify-items: center;
}

#image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    justify-items: center;
}

.image-card {
    position: relative;
    width: 100%;
    padding-top: 100%; /* 1:1 Aspect Ratio */
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 8px;
    overflow: hidden;
    background-color: #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.image-card img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.image-card:hover {
    transform: scale(1.05);
    box-shadow: 0 0 15px #b22222;
}

.image-card.selected {
    outline: 4px solid #b22222;
    box-shadow: 0 0 20px #ff4500;
}

.image-card.matched {
    opacity: 0.5;
    outline: 4px solid #228b22;
    cursor: default;
}

.image-card.matched:hover {
    transform: none;
    box-shadow: none;
}

.image-card.matched::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    color: #228b22;
    text-shadow: 2px 2px 4px #000;
    font-weight: bold;
    opacity: 1;
}

.image-number {
    position: absolute;
    top: 8px;
    left: 8px;
    background-color: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    line-height: 1;
    font-family: 'Creepster', cursive;
    text-shadow: 1px 1px 2px #000;
    z-index: 10;
}

#answer-key {
    margin-top: 40px;
    padding: 20px;
    background-color: #222;
    border-radius: 8px;
    border: 1px solid #444;
    text-align: left;
}

#answer-key h3 {
    font-family: 'Creepster', cursive;
    font-size: 2.5rem;
    color: #b22222;
    margin-top: 0;
    margin-bottom: 15px;
    text-align: center;
}

#answer-key ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
}

#answer-key li {
    font-size: 1.1rem;
    background-color: #333;
    padding: 10px 15px;
    border-radius: 5px;
    font-family: 'Roboto', sans-serif;
}

#archetypes-section {
    background-image: url('/archetype_background.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    padding: 40px;
    margin: 60px auto 40px;
    max-width: 1000px;
    text-align: left;
    color: #f0f0f0;
    font-family: 'Gaegu', cursive; /* A more handwritten font */
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
    border: 1px solid #444;
}

@font-face {
    font-family: 'Gaegu';
    src: url('https://fonts.gstatic.com/s/gaegu/v12/xfso0bV22_f_p4dg-EPf.woff2') format('woff2');
}

#archetypes-section h2 {
    font-family: 'Creepster', cursive;
    font-size: 2.8rem;
    color: #e0e0e0;
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px #000;
}

#archetypes-section ul {
    list-style: none;
    padding: 0;
}

#archetypes-section li {
    margin-bottom: 20px;
    text-shadow: 1px 1px 3px #000;
}

#archetypes-section strong {
    font-family: 'Creepster', cursive;
    color: #ff4500;
    font-size: 1.6rem;
    display: block;
    margin-bottom: 3px;
    font-weight: normal;
}

#archetypes-section p {
    font-size: 1.2rem;
    line-height: 1.4;
    margin: 0;
    padding-left: 10px;
}

#message-area {
    margin-top: 20px;
    font-size: 1.5rem;
    height: 30px;
    font-weight: bold;
    font-family: 'Creepster', cursive;
    letter-spacing: 2px;
}

.success {
    color: #228b22;
}

.failure {
    color: #b22222;
}

#questionnaire-section {
    background-image: url('/cemetery_background.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    padding: 40px;
    margin: 60px auto 40px;
    max-width: 1000px;
    text-align: left;
    color: #f0f0f0;
    font-family: 'Roboto', sans-serif;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.7);
    border: 1px solid #444;
}

#questionnaire-section h2 {
    font-family: 'Creepster', cursive;
    font-size: 2.8rem;
    color: #b22222;
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px #000;
}

#horror-form fieldset {
    border: 1px solid #555;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
}

#horror-form legend {
    font-family: 'Creepster', cursive;
    font-size: 2rem;
    color: #ff4500;
    padding: 0 10px;
    margin-left: 10px;
    text-shadow: 1px 1px 2px #000;
}

#horror-form .form-group {
    margin-bottom: 25px;
}

#horror-form label {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 8px;
    text-shadow: 1px 1px 3px #000;
}

#horror-form .radio-group label,
#horror-form .checkbox-group label {
    display: block;
    font-size: 1rem;
    margin-bottom: 5px;
    font-weight: normal;
    text-shadow: none;
}

#horror-form .radio-group input,
#horror-form .checkbox-group input {
    margin-right: 8px;
    vertical-align: middle;
}

#horror-form .ranking-group {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

#horror-form .ranking-group label {
    display: flex;
    align-items: center;
    font-size: 1rem;
    margin-bottom: 0;
}

#horror-form .ranking-group input[type="number"] {
    width: 50px;
    margin-right: 10px;
    padding: 5px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid #555;
    color: #e0e0e0;
    border-radius: 4px;
    text-align: center;
}

#horror-form .other-label {
    display: inline-flex !important;
    align-items: center;
    margin-top: 5px;
}

#horror-form .other-label input[type="text"] {
    margin-left: 8px;
    width: auto;
    flex-grow: 1;
}

#horror-form input[type="text"],
#horror-form textarea {
    width: 100%;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 1px solid #555;
    color: #e0e0e0;
    border-radius: 5px;
    font-size: 1rem;
    font-family: 'Roboto', sans-serif;
    box-sizing: border-box; /* To include padding and border in the element's total width and height */
}

#horror-form input[type="text"]:focus,
#horror-form textarea:focus {
    outline: none;
    border-color: #b22222;
    box-shadow: 0 0 8px #b22222;
}

#horror-form button {
    font-family: 'Creepster', cursive;
    font-size: 1.5rem;
    padding: 10px 20px;
    cursor: pointer;
    background-color: #b22222;
    color: #fff;
    border: none;
    border-radius: 5px;
    text-shadow: 1px 1px 2px #000;
    transition: background-color 0.3s ease;
    display: block;
    margin: 20px auto 0;
}

#horror-form button:hover {
    background-color: #ff4500;
}

#form-message {
    text-align: center;
    margin-top: 20px;
    font-size: 1.2rem;
    color: #228b22;
    font-family: 'Creepster', cursive;
    letter-spacing: 1px;
    height: 25px; /* Reserve space */
}

#expressions-section {
    background-image: url('/blood_stained_paper_wide.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 60px 50px;
    margin: 60px auto 40px;
    max-width: 1000px;
    min-height: 750px;
    text-align: left;
    color: #3a1d1d;
    font-family: 'Special Elite', monospace;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.7);
    box-sizing: border-box;
}

#expressions-section h2 {
    font-family: 'Creepster', cursive;
    font-size: 2.8rem;
    color: #8b0000;
    text-align: center;
    margin-bottom: 35px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#expressions-section ul {
    list-style-type: none;
    padding: 0;
    column-count: 2;
    column-gap: 40px;
}

#expressions-section li {
    font-size: 1.1rem;
    margin-bottom: 15px;
    line-height: 1.6;
    break-inside: avoid-column;
}

#vocabulary-exercise-section {
    background-image: url('/blood_stained_paper_wide.png');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    padding: 60px 50px;
    margin: 60px auto 40px;
    max-width: 1000px;
    min-height: 750px;
    text-align: left;
    color: #3a1d1d;
    font-family: 'Special Elite', monospace;
    position: relative;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.7);
    box-sizing: border-box;
}

#vocabulary-exercise-section h2 {
    font-family: 'Creepster', cursive;
    font-size: 2.8rem;
    color: #8b0000;
    text-align: center;
    margin-bottom: 25px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

#vocabulary-exercise-section .instructions {
    font-size: 1.2rem;
    text-align: center;
    margin-bottom: 30px;
    font-style: italic;
}

#vocabulary-exercise-section .exercise-group {
    margin-bottom: 20px;
}

#vocabulary-exercise-section label {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 8px;
}

#vocabulary-exercise-section input[type="text"] {
    width: 100%;
    padding: 10px;
    background-color: rgba(255, 255, 255, 0.4);
    border: 1px solid #8b4513;
    border-bottom: 2px solid #8b4513;
    color: #3a1d1d;
    border-radius: 4px;
    font-size: 1rem;
    font-family: 'Special Elite', monospace;
    box-sizing: border-box;
}

#vocabulary-exercise-section input[type="text"]:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.7);
    border-color: #8b0000;
}

#vocabulary-exercise-section button {
    font-family: 'Creepster', cursive;
    font-size: 1.5rem;
    padding: 10px 20px;
    cursor: pointer;
    background-color: #8b0000;
    color: #f0f0f0;
    border: none;
    border-radius: 5px;
    text-shadow: 1px 1px 2px #000;
    transition: background-color 0.3s ease;
    display: block;
    margin: 30px auto 0;
}

#vocabulary-exercise-section button:hover {
    background-color: #b22222;
}

#vocab-feedback {
    text-align: center;
    margin-top: 20px;
    font-size: 1.3rem;
    color: #8b0000;
    font-family: 'Creepster', cursive;
    letter-spacing: 1px;
    height: 25px; /* Reserve space */
}

#reset-button {
    font-family: 'Creepster', cursive;
    font-size: 1.8rem;
    padding: 10px 20px;
    margin-top: 20px;
    cursor: pointer;
    background-color: #b22222;
    color: #fff;
    border: none;
    border-radius: 5px;
    text-shadow: 1px 1px 2px #000;
    transition: background-color 0.3s ease;
}

#reset-button:hover {
    background-color: #ff4500;
}

#reset-button.hidden {
    display: none;
}

.hidden {
    display: none !important;
}