:root {
    --cream: #f7f3e8;
    --cream-dark: #ede8db;
    --ink: #1a1a1a;
    --ink-light: #3d3d3d;
    --burgundy: #722f37;
    --burgundy-light: #8b3a44;
    --gold: #c4a35a;
    --gold-muted: #b8a056;
    --sage: #7a8b7a;
    --paper: #fdfbf7;
    --border: rgba(26, 26, 26, 0.1);
    --card-shadow:
        0 4px 24px rgba(26, 26, 26, 0.08), 0 1px 4px rgba(26, 26, 26, 0.04);
    --card-shadow-hover:
        0 8px 32px rgba(26, 26, 26, 0.12), 0 2px 8px rgba(26, 26, 26, 0.06);
}

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

body {
    font-family: "Libre Baskerville", Georgia, serif;
    background: var(--cream);
    color: var(--ink);
    min-height: 100vh;
    line-height: 1.6;
    background-image:
        radial-gradient(
            ellipse at 20% 0%,
            rgba(196, 163, 90, 0.08) 0%,
            transparent 50%
        ),
        radial-gradient(
            ellipse at 80% 100%,
            rgba(114, 47, 55, 0.06) 0%,
            transparent 50%
        ),
        url("data:image/svg+xml,%3Csvg viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
}

.top-bar {
    position: relative;
    width: 100%;
    max-width: none;
    height: 1px;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 24px 80px;
}

header {
    text-align: center;
    margin: 24px 0 48px;
    opacity: 0;
    transform: translateY(-20px);
    animation: fadeInDown 0.8s ease forwards;
}

header .logo {
    margin: 0;
    display: inline-block;
    text-decoration: none;
}

.logo,
.logo:hover,
.logo:active,
.logo:visited,
.logo:focus {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: clamp(3rem, 10vw, 4.5rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--ink);
    text-decoration: none;
    cursor: pointer;
    outline: none;
}

.logo span,
.logo span:hover,
.logo span:active,
.logo span:visited {
    color: var(--burgundy);
}

.tagline {
    margin: 8px 0 0;
    font-size: 0.95rem;
    color: var(--ink-light);
    font-style: italic;
    letter-spacing: 0.06em;
}

.language-selector {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 100;
}

.language-btn {
    background: none;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 3px;
    transition: all 0.2s ease;
    font-family: "Libre Baskerville", Georgia, serif;
    color: var(--ink-light);
}

.language-btn:hover {
    background: rgba(26, 26, 26, 0.08);
    border: 1px solid rgba(26, 26, 26, 0.06);
}

.globe-icon {
    width: 14px;
    height: 14px;
    color: var(--ink-light);
}

.current-lang {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--ink-light);
}

.language-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--cream-dark);
    border: 1px solid rgba(26, 26, 26, 0.06);
    border-radius: 4px;
    display: none;
}

.language-dropdown.open {
    display: block;
    animation: fadeIn 0.2s ease;
}

.language-option {
    display: block;
    width: 100%;
    padding: 6px 8px;
    background: transparent;
    border: none;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    cursor: pointer;
    transition: background 0.2s ease;
    text-align: left;
    color: var(--ink-light);
}

.language-option:hover {
    background: rgba(26, 26, 26, 0.08);
}
.language-option:first-child {
    border-radius: 4px 4px 0 0;
}
.language-option:last-child {
    border-radius: 0 0 4px 4px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 24px;
    padding: 16px 24px;
    background: var(--cream-dark);
    border-radius: 4px;
    border: 1px solid rgba(26, 26, 26, 0.06);
    opacity: 0;
    animation: fadeIn 0.6s ease 0.3s forwards;
    flex-wrap: wrap;
}

.stat {
    text-align: center;
}

.stat-value {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--burgundy);
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-light);
    margin-top: 2px;
}

.streak-flame {
    display: inline-block;
    margin-right: 4px;
    transition: transform 0.3s ease;
}
.streak-flame.active {
    animation: flame 0.5s ease infinite alternate;
}

.card {
    background: #fff;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
    padding: 32px;
    margin-bottom: 24px;
    border: 1px solid rgba(26, 26, 26, 0.04);
    opacity: 0;
    transform: translateY(20px);
}

.card.visible {
    animation: fadeInUp 0.6s ease forwards;
}

.card-header {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 24px;
}

.article-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 2px 2px 8px rgba(26, 26, 26, 0.1);
    background: var(--cream-dark);
    flex-shrink: 0;
}

.article-info {
    flex: 1;
    min-width: 0;
}

.article-title {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--ink);
    margin-bottom: 8px;
}

.article-meta {
    font-size: 0.75rem;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.difficulty-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-left: 12px;
    line-height: 16px;
}

.difficulty-easy {
    background: rgba(122, 139, 122, 0.15);
    color: var(--sage);
}
.difficulty-medium {
    background: rgba(196, 163, 90, 0.15);
    color: var(--gold-muted);
}
.difficulty-hard {
    background: rgba(114, 47, 55, 0.12);
    color: var(--burgundy);
}

.article-summary {
    font-size: 0.95rem;
    color: var(--ink-light);
    line-height: 1.75;
    padding-top: 16px;
    border-top: 1px solid rgba(26, 26, 26, 0.08);
}

.article-summary::first-letter {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 3.2rem;
    float: left;
    line-height: 1;
    margin-right: 10px;
    margin-top: 2px;
    color: var(--burgundy);
    font-weight: 700;
}

.article-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    font-size: 0.8rem;
    color: var(--burgundy);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: all 0.2s ease;
}

.article-link:hover {
    color: var(--burgundy-light);
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 36px;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--burgundy);
    color: #fff;
    box-shadow: 0 4px 12px rgba(114, 47, 55, 0.25);
}

.btn-primary:hover {
    background: var(--burgundy-light);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(114, 47, 55, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--ink-light);
}

.btn-secondary:hover {
    background: var(--ink);
    color: #fff;
}
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.loading {
    text-align: center;
    padding: 60px 20px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--cream-dark);
    border-top-color: var(--burgundy);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-text {
    font-size: 0.9rem;
    color: var(--ink-light);
    font-style: italic;
}

.quiz-section {
    display: none;
}
.quiz-section.active {
    display: block;
}

.options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option {
    position: relative;
    padding: 18px 20px;
    background: var(--cream);
    border: 1px solid rgba(26, 26, 26, 0.1);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    gap: 14px;
}

.option:hover:not(.disabled) {
    background: var(--cream-dark);
    border-color: var(--ink-light);
    padding-left: 24px;
}
.option.selected {
    border-color: var(--burgundy);
    background: rgba(114, 47, 55, 0.06);
}
.option.correct {
    border-color: var(--sage);
    background: rgba(122, 139, 122, 0.12);
}
.option.incorrect {
    border-color: var(--burgundy);
    background: rgba(114, 47, 55, 0.1);
}
.option.disabled {
    cursor: default;
    pointer-events: none;
}

.option-letter {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    color: #fff;
    border-radius: 50%;
    font-family: "Cormorant Garamond", Georgia, serif;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.option.correct .option-letter {
    background: var(--sage);
}
.option.incorrect .option-letter {
    background: var(--burgundy);
}
.option-text {
    flex: 1;
    font-size: 0.95rem;
}

.question-text {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 1.4rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--ink);
    margin-bottom: 28px;
}

.fact-card {
    padding: 20px 24px;
    border-radius: 12px;
    color: var(--ink);
    text-align: center;
    animation: fadeIn 0.3s ease;
    margin-bottom: 16px;
}

.fact-card strong {
    display: block;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 24px;
    opacity: 0.7;
    font-style: italic;
}

.fact-card p {
    line-height: 1.5;
    margin-bottom: 16px;
}
.fact-section {
    text-align: center;
}

.question-number {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--ink-light);
}

.question-number-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.question-timer {
    font-weight: 600;
    font-size: 0.725rem;
    min-width: 80px;
    text-align: right;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
}

.question-timer.warning {
    color: #e67e22;
}
.question-timer.danger {
    color: var(--burgundy);
}

.question-number > .feedback {
    margin-left: auto;
    min-width: 80px;
    text-align: left;
}
.feedback {
    display: none;
}

.feedback.visible {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    animation: fadeIn 0.4s ease;
    min-width: 80px;
}

.feedback-correct {
    color: var(--sage);
}
.feedback-incorrect {
    color: var(--burgundy);
}
.feedback-icon {
    font-size: 0.725rem;
    display: inline;
}
.feedback-text {
    display: inline;
    margin: 0;
}

.results {
    text-align: center;
}

.results-score {
    font-family: "Cormorant Garamond", Georgia, serif;
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--burgundy);
    line-height: 1;
}

.results-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-light);
    margin-top: 8px;
}

.results-message {
    font-size: 1.1rem;
    font-style: italic;
    margin: 24px 0;
    color: var(--ink-light);
}

.btn-share {
    display: inline-block;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--gold) 0%, var(--gold-muted) 100%);
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}
@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes fadeInDown {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
@keyframes flame {
    to {
        transform: scale(1.15) rotate(-5deg);
    }
}
@keyframes celebrate {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 540px) {
    .container {
        padding: 24px 16px 60px;
    }
    .card {
        padding: 24px 20px;
    }
    .card-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .article-image {
        width: 100%;
        height: 200px;
    }
    .article-title {
        font-size: 1.4rem;
    }
    .stats-bar {
        gap: 20px;
    }
    .actions {
        flex-direction: column;
    }
    .btn {
        width: 100%;
    }
}

.footer {
    text-align: center;
    padding: 16px 0;
    margin-top: 14em;
    font-size: 0.75rem;
    color: var(--ink-light);
    opacity: 0.7;
}

.footer a {
    font-size: 0.75rem;
    color: var(--ink-light);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.footer a:hover {
    opacity: 1;
}
.clear {
    padding-top: 0.625em;
}

.ad-placeholder {
    background: #f0f0f0;
    border: 2px dashed #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
    font-size: 12px;
    font-family: Arial, sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px auto;
}

.ad-rectangle {
    width: 300px;
    height: 250px;
}

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

.ads-row .ad-placeholder {
    margin: 0;
}
.ads-row .show-desktop {
    display: flex;
}

@media (max-width: 640px) {
    .ads-row {
        flex-direction: column;
        align-items: center;
    }
    .ads-row .show-desktop {
        display: none;
    }
}
