/* CSS Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-bg: #f8f6f3;
    --color-surface: #ffffff;
    --color-text: #2d2a26;
    --color-text-muted: #6b6560;
    --color-primary: #6b4c7a;
    --color-primary-hover: #553d61;
    --color-primary-light: #f3eff5;
    --color-accent: #8b7355;
    --color-border: #e5e0d9;
    --color-success: #4a7c59;
    --color-protestant: #5d7a3d;
    --color-catholic: #7a4a6b;
    --font-serif: 'Crimson Pro', Georgia, serif;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.05);
    --radius: 10px;
    --radius-sm: 6px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

.page-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.site-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.site-logo {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.site-logo:hover {
    color: var(--color-primary-hover);
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    flex: 1;
}

.site-footer {
    padding: 1.5rem;
    text-align: center;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface);
}

.site-footer p {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0;
}

.site-footer a {
    color: var(--color-primary);
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-serif);
    font-weight: normal;
    line-height: 1.3;
}

h1 {
    font-size: 2.25rem;
    margin-bottom: 1rem;
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background-color: var(--color-bg);
}

/* Cards */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 2rem;
    margin-bottom: 1.5rem;
}

/* Landing Page */
.landing {
    text-align: center;
    padding-top: 2rem;
}

.landing-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.9;
}

.landing h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.landing .subtitle {
    font-size: 1.125rem;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--color-text-muted);
    margin-bottom: 2.5rem;
}

.landing-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    margin-bottom: 2rem;
    text-align: left;
}

.landing-card h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.landing-card p {
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.landing-card p:last-child {
    margin-bottom: 0;
}

.landing-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.landing-card li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--color-text-muted);
}

.landing-card li::before {
    content: "~";
    position: absolute;
    left: 0;
    color: var(--color-primary);
    font-weight: 600;
}

.start-section {
    padding: 1rem 0 2rem;
}

.start-btn {
    font-size: 1.125rem;
    padding: 1rem 3rem;
    box-shadow: var(--shadow-md);
}

.question-count {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin-top: 1rem;
}

.author-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-top: 2rem;
    text-align: left;
}

.author-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-border);
}

.author-info {
    flex: 1;
}

.author-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    color: var(--color-text);
}

.author-contact {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
}

.author-contact a {
    color: var(--color-primary);
    text-decoration: none;
}

.author-contact a:hover {
    text-decoration: underline;
}

.author-contact .discord {
    font-family: monospace;
    background: var(--color-bg);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

/* Quiz Page */
.quiz-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--color-border);
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    margin-top: 1rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.question-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 3px solid transparent;
    transition: border-color 0.2s ease;
}

.question-card.answered {
    border-left-color: var(--color-primary);
}

.question-card.focused {
    box-shadow: var(--shadow-md), 0 0 0 2px var(--color-primary);
}

.question-number {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.question-category {
    display: inline-block;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: var(--color-bg);
    border-radius: 4px;
    color: var(--color-text-muted);
    margin-left: 0.5rem;
}

.question-text {
    font-size: 1.05rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.question-text strong {
    color: var(--color-primary);
}

.answer-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.answer-btn {
    flex: 1;
    min-width: 80px;
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.15s ease;
}

.answer-btn:hover {
    background: var(--color-bg);
    border-color: var(--color-primary);
}

.answer-btn.selected {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

/* Submit Section */
.submit-section {
    text-align: center;
    padding: 2rem;
    margin-top: 1rem;
}

.submit-section .btn {
    min-width: 200px;
}

.questions-remaining {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-top: 0.75rem;
}

/* Results Page */
.results-header {
    text-align: center;
    padding: 2rem 0 1rem;
}

.result-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
}

.result-title {
    font-size: 2.25rem;
    font-family: var(--font-serif);
    color: var(--color-primary);
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.result-score {
    font-size: 4rem;
    font-weight: 300;
    color: var(--color-text);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.result-score span {
    font-size: 1.75rem;
    color: var(--color-text-muted);
}

.result-description {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--color-text-muted);
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

.score-bar-container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.score-bar {
    height: 28px;
    background: linear-gradient(to right, var(--color-protestant) 0%, #8b7355 50%, var(--color-catholic) 100%);
    border-radius: 14px;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

.score-marker {
    position: absolute;
    top: -6px;
    width: 6px;
    height: 40px;
    background: var(--color-text);
    border-radius: 3px;
    transform: translateX(-50%);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.score-marker::after {
    content: "";
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 8px solid var(--color-text);
}

.score-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.score-labels .protestant {
    color: var(--color-protestant);
}

.score-labels .catholic {
    color: var(--color-catholic);
}

/* Category Breakdown */
.breakdown-section {
    margin-top: 2rem;
}

.breakdown-section h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.breakdown-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
}

.category-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--color-border);
}

.category-row:last-child {
    border-bottom: none;
}

.category-name {
    font-weight: 500;
    font-size: 0.95rem;
}

.category-score {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.category-bar {
    flex: 1;
    height: 6px;
    background: var(--color-border);
    border-radius: 3px;
    margin: 0 1rem;
    overflow: hidden;
}

.category-fill {
    height: 100%;
    background: linear-gradient(to right, var(--color-protestant), var(--color-catholic));
    border-radius: 3px;
}

/* Actions */
.result-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2.5rem;
    flex-wrap: wrap;
}

/* Share section */
.share-section {
    margin-top: 2rem;
    text-align: center;
}

.share-section h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--color-text-muted);
}

.share-url {
    display: flex;
    gap: 0.5rem;
    max-width: 400px;
    margin: 0 auto;
}

.share-url input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    background: var(--color-surface);
}

.share-url button {
    padding: 0.75rem 1.25rem;
    background: var(--color-primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
}

.share-url button:hover {
    background: var(--color-primary-hover);
}

/* Error Pages */
.error-page {
    text-align: center;
    padding: 3rem 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.error-page h1 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
}

.error-message {
    font-size: 1.1rem;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.error-quote {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--color-text-muted);
    background: var(--color-surface);
    padding: 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.quote-ref {
    display: block;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-style: normal;
    color: var(--color-accent);
}

.error-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1.5rem 1rem;
    }

    h1 {
        font-size: 1.75rem;
    }

    .landing h1 {
        font-size: 2rem;
    }

    .landing-card {
        padding: 1.5rem;
    }

    .question-card {
        padding: 1.25rem;
    }

    .answer-options {
        flex-direction: column;
    }

    .answer-btn {
        width: 100%;
    }

    .result-score {
        font-size: 3rem;
    }

    .result-title {
        font-size: 1.75rem;
    }

    .category-bar {
        display: none;
    }

    .share-url {
        flex-direction: column;
    }
}
