/* --- General & Layout --- */
:root {
    --bg-color: #121212;
    --primary-color: #1e1e1e;
    --secondary-color: #2a2a2a;
    --text-color: #e0e0e0;
    --highlight-color: #bb86fc;
}

body, html {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex-grow: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
}

a {
    color: var(--highlight-color);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

h1, h2, h3 { color: var(--text-color); }

hr {
    border: none;
    border-top: 1px solid var(--secondary-color);
    margin: 30px 0;
}

/* --- Header & Navigation --- */
header {
    width: 100%;
    background-color: var(--primary-color);
    border-bottom: 1px solid var(--secondary-color);
    padding: 10px 0;
}

nav {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo { font-size: 1.5em; font-weight: bold; color: #fff; }
.logo:hover { text-decoration: none; }

nav ul { list-style: none; display: flex; gap: 20px; margin: 0; padding: 0; align-items: center; }

.create-btn {
    background-color: var(--highlight-color);
    color: #000;
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.2s;
}
.create-btn:hover { background-color: #fff; text-decoration: none; }

/* --- Footer --- */
footer {
    width: 100%;
    background-color: var(--primary-color);
    border-top: 1px solid var(--secondary-color);
    padding: 20px 0;
    text-align: center;
    font-size: 0.9em;
    color: #888;
}
footer p { margin: 5px 0; }

/* --- Homepage Grid --- */
#quiz-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    width: 100%;
    max-width: 1200px;
}

.quiz-card {
    background-color: var(--primary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    padding: 20px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
.quiz-card:hover { transform: translateY(-5px); box-shadow: 0 10px 20px rgba(0,0,0,0.4); }
.quiz-card h2 { margin-top: 0; font-size: 1.3em; }
.quiz-card p { color: #888; text-align: center; }

/* --- Quiz Play Page --- */
.quiz-play-container { width: 100%; max-width: 700px; text-align: center; display: flex; flex-direction: column; align-items: center; }
#quiz-area, #result-area { width: 100%; }
#progress-bar-container { width: 100%; height: 8px; background-color: var(--secondary-color); border-radius: 4px; margin: 20px 0; }
#progress-bar { width: 0%; height: 100%; background-color: var(--highlight-color); border-radius: 4px; transition: width 0.3s ease; }
.quiz-image-container { width: 100%; max-width: 700px; margin: 0 auto; }
.quiz-image-container .image-placeholder { height: 400px; border-radius: 8px; background-color: #000; display: flex; justify-content: center; align-items: center; color: #555; font-weight: bold; margin: 0 auto; }

#answer-form { display: flex; margin: 20px auto; max-width: 500px; }
#answer-input { flex-grow: 1; padding: 15px; font-size: 1.2em; background-color: var(--secondary-color); border: 1px solid #444; border-radius: 5px 0 0 5px; color: var(--text-color); outline: none; }
#submit-answer { padding: 0 25px; font-size: 1.2em; background-color: var(--highlight-color); color: #000; border: none; border-radius: 0 5px 5px 0; cursor: pointer; font-weight: bold; }

#feedback { min-height: 30px; font-size: 1.2em; font-weight: bold; text-align: center; }
#feedback.correct { color: #00e676; }
#feedback.incorrect { color: #ff5252; }

#result-area { text-align: center; }
#result-area.hidden { display: none; }
#quiz-area.hidden { display: none; }
.result-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
}
#retry-category-btn {
    background-color: var(--highlight-color);
    color: #000;
}
.back-link {
    background-color: var(--secondary-color);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 5px;
}

/* --- Create Page --- */
.page-content { width: 100%; max-width: 800px; }
.form-group { margin-bottom: 25px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; font-weight: bold; }
.form-group input { width: 100%; padding: 12px; background-color: var(--secondary-color); border: 1px solid #444; border-radius: 5px; color: var(--text-color); font-size: 1em; box-sizing: border-box; }

.question-block {
    background-color: var(--primary-color);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid var(--secondary-color);
}
.answers-group .answer-input { margin-bottom: 10px; }

button {
    display: inline-block;
    padding: 12px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
}
.add-answer-btn { background-color: #444; color: var(--text-color); margin-top: 5px; }
#add-question-btn { width: 100%; background-color: var(--secondary-color); color: var(--text-color); }
#submit-deck-btn { width: 100%; background-color: var(--highlight-color); color: #000; font-size: 1.2em; }
.back-link { margin-top: 20px; display: inline-block; }
