:root {
    --primary: #f59e0b; /* Vibrant amber/yellow for Swahili warmth */
    --primary-hover: #d97706;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --danger: #ef4444;
    --surface: #ffffff;
    --background: #fdfbf7;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --radius: 16px;
    --font: 'Poppins', sans-serif;
}

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

body {
    font-family: var(--font);
    background-color: var(--background);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* Navbar */
.navbar {
    width: 100%;
    background: var(--surface);
    padding: 16px 32px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 50;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.logo {
    height: 48px;
    width: 48px;
    object-fit: contain;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-hover);
    letter-spacing: -0.5px;
}

/* Application Layout */
.app-container {
    width: 100%;
    max-width: 900px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    flex: 1;
}

.game-container {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    padding: 40px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.screen {
    display: none;
    flex-direction: column;
    height: 100%;
    animation: fadeIn 0.4s ease-out forwards;
    width: 100%;
}

.screen.active {
    display: flex;
}

/* Typography elements */
.library-header {
    text-align: center;
    margin-bottom: 32px;
}

.screen h2 {
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--primary-hover);
}

.screen p {
    color: var(--text-muted);
    line-height: 1.5;
}

/* Grid of Vignettes */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    width: 100%;
}

.game-card {
    background: var(--background);
    border-radius: calc(var(--radius) - 4px);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
    border-color: var(--primary);
}

.card-image-content {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #e2e8f0;
}

.card-image-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.game-card:hover .card-image-content img {
    transform: scale(1.05);
}

.card-info {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.card-info h3 {
    font-size: 1.25rem;
    color: var(--text-main);
}

.card-info p {
    font-size: 0.9rem;
    margin-bottom: auto;
    text-align: left;
}

/* Buttons */
.btn {
    border: none;
    padding: 16px 32px;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.small-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
}

.primary-btn {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.2);
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(245, 158, 11, 0.3);
}

/* Quiz UI */
.quiz-top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.quiz-top-bar h2 {
    margin-bottom: 0;
    font-size: 1.5rem;
    flex: 1;
    text-align: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    margin-bottom: 24px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: var(--secondary);
    width: 0%;
    transition: width 0.3s ease;
}

.question-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 16px;
}

#question-text {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 32px;
    width: 100%;
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto 24px auto;
}

.option-btn {
    background: var(--background);
    border: 2px solid transparent;
    color: var(--text-main);
    width: 100%;
}

.option-btn:hover:not(:disabled) {
    background: #fef3c7;
    color: var(--primary-hover);
}

.option-btn.correct {
    background: #d1fae5;
    border-color: var(--secondary);
    color: var(--secondary-hover);
}

.option-btn.wrong {
    background: #fee2e2;
    border-color: var(--danger);
    color: #b91c1c;
}

.action-row {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    max-width: 600px;
    margin: 0 auto;
}

.action-row-center {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}

.secondary-btn {
    background: var(--text-main);
    color: #fff;
}

.secondary-btn:hover {
    background: #000;
}

.hidden {
    display: none !important;
}

/* Results */
#result-screen {
    align-items: center;
    justify-content: center;
}

.score-display {
    font-size: 4rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 24px 0;
}

footer {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: auto;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
