:root {
    --primary-color: #4CAF50;
    --primary-hover: #45a049;
    --bg-color: #f9f7f1;
    --text-color: #333333;
    --card-bg: #ffffff;
    --accent-color: #f39c12;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    animation: fadeInBody 1s ease-in-out;
}

@keyframes fadeInBody {
    from { opacity: 0; }
    to { opacity: 1; }
}

header {
    text-align: center;
    background-color: var(--primary-color);
    color: white;
    padding: 25px 20px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    animation: slideDown 0.8s ease-out;
    margin-bottom: 20px;
}

@keyframes slideDown {
    from { transform: translateY(-50px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

h1, h2, h3 {
    margin: 0 0 10px 0;
    text-align: center;
}

p {
    text-align: center;
    line-height: 1.6;
}

button {
    background-color: var(--primary-color);
    color: white;
    padding: 12px 24px;
    border: none;
    cursor: pointer;
    margin: 8px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

button:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

button:active {
    transform: translateY(0);
}

.category-filters button {
    background-color: var(--accent-color);
    font-size: 14px;
    padding: 8px 16px;
}

.category-filters button:hover {
    background-color: #e67e22;
}

.main-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.character-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.character {
    background-color: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s ease;
    animation: fadeInUp 0.8s ease-in-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.character:hover {
    transform: translateY(-5px);
}

@keyframes fadeInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.character h3 {
    color: var(--primary-color);
    font-size: 1.4em;
}

.character button {
    background-color: var(--accent-color);
    width: 100%;
    margin: 15px 0 0 0;
}

.character button:hover {
    background-color: #e67e22;
}

#quiz-screen, .missions-screen {
    padding: 20px;
    max-width: 600px;
    margin: auto;
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.quiz-question input {
    width: calc(100% - 24px);
    padding: 12px;
    margin: 15px 0;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
}

.quiz-question button {
    width: 100%;
    margin: 5px 0;
    background-color: var(--accent-color);
}

.quiz-question button:hover {
    background-color: #e67e22;
}

.missions-list {
    list-style-type: none;
    padding: 0;
}

.missions-list li {
    background-color: #fdfbf7;
    padding: 15px;
    margin-bottom: 12px;
    border-radius: 8px;
    border-left: 5px solid var(--primary-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.missions-list .reward {
    font-weight: bold;
    color: var(--accent-color);
}

#deck-builder-screen {
    padding: 20px;
    max-width: 900px;
    margin: auto;
}

.deck-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.slot {
    padding: 15px 5px;
    background-color: #eaeaea;
    border: 2px dashed #bbb;
    border-radius: 8px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s;
    font-weight: bold;
}

.slot.filled {
    background-color: var(--primary-color);
    border-style: solid;
    border-color: var(--primary-hover);
    color: white;
}

.card-selection-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 20px;
}

.card {
    padding: 12px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 8px;
    width: 130px;
    cursor: pointer;
    font-weight: bold;
    text-align: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s;
}

.card:hover {
    transform: scale(1.05);
}

.roulette-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 20px;
    padding: 30px;
    background-color: var(--card-bg);
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    max-width: 450px;
    margin: 20px auto;
}

.roulette-pointer {
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 30px solid #e74c3c;
    z-index: 10;
}

#wheel-canvas {
    max-width: 100%;
    height: auto;
    transition: transform 5s cubic-bezier(0.25, 0.1, 0.25, 1);
}

#score-display {
    position: absolute;
    top: 20px;
    right: 20px;
    font-weight: bold;
    font-size: 18px;
    background-color: var(--card-bg);
    color: var(--text-color);
    padding: 10px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 10;
    border: 2px solid var(--primary-color);
}

#toggle-music {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
    border-radius: 50px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

#leaderboard table {
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    border-collapse: collapse;
    background-color: var(--card-bg);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

#leaderboard th, #leaderboard td {
    padding: 15px;
    border-bottom: 1px solid #eee;
    text-align: center;
}

#leaderboard th {
    background-color: var(--primary-color);
    color: white;
}

@media (max-width: 768px) {
    header { padding: 15px; }
    .main-options { grid-template-columns: 1fr; }
    #score-display { top: 10px; right: 10px; font-size: 14px; }
    .deck-slots { grid-template-columns: repeat(2, 1fr); }
    .character-list { grid-template-columns: 1fr; }
}