:root {
    --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --bg: #fefcfa;
    --bg-alt: #f5f1ec;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --accent: #d94032;
    --accent-soft: rgba(217, 64, 50, 0.08);
    --accent-hover: rgba(217, 64, 50, 0.15);
    --passage-bg: rgba(217, 64, 50, 0.06);
    --passage-hover: rgba(217, 64, 50, 0.13);
    --card-bg: #ffffff;
    --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    --border: #e5e0d8;
    --radius: 10px;
    --max-width: 760px;
    --line-height: 1.75;
    --copied-bg: rgba(34, 139, 34, 0.1);
}

[data-theme="dark"] {
    --bg: #1a1a2e;
    --bg-alt: #222240;
    --text: #e0ddd5;
    --text-muted: #9a9a9a;
    --accent: #f06050;
    --accent-soft: rgba(240, 96, 80, 0.1);
    --accent-hover: rgba(240, 96, 80, 0.2);
    --passage-bg: rgba(240, 96, 80, 0.08);
    --passage-hover: rgba(240, 96, 80, 0.16);
    --card-bg: #222240;
    --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    --border: #3a3a5c;
    --copied-bg: rgba(34, 139, 34, 0.15);
}

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

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-size: 1.125rem;
    line-height: var(--line-height);
    color: var(--text);
    background: var(--bg);
    padding: 0 1.5rem;
    transition: background 0.3s, color 0.3s;
}

a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    text-decoration-thickness: 2px;
}

/* Layout */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
}

/* Hero */
.hero {
    text-align: center;
    padding: 5rem 0 3rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

.hero h1 .ale-accent {
    font-weight: 800;
}

.hero .author {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.hero .meta {
    font-size: 1rem;
    color: var(--text-muted);
}

.meta-inline {
    font-size: 0.75em;
    font-weight: 400;
    color: var(--text-muted);
}

/* Sections */
.section {
    padding: 3rem 0;
}

.section h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.section h2 .ale-accent {
    font-weight: 700;
}

.section p {
    margin-bottom: 1rem;
}

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

/* Author card */
.author-card {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    background: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}

.author-card img {
    width: 160px;
    height: auto;
    border-radius: var(--radius);
    flex-shrink: 0;
}

.author-card .author-bio h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.author-card .author-bio p {
    font-size: 1rem;
    color: var(--text-muted);
}

/* Book info */
.book-info {
    background: var(--bg-alt);
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
}

/* Feuilleton */
.feuilleton {
    padding: 2rem 0 3rem;
}

.feuilleton p {
    margin-bottom: 1.25rem;
    text-align: justify;
    hyphens: auto;
    -webkit-hyphens: auto;
}

.divider {
    text-align: center;
    margin: 2.5rem 0;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    letter-spacing: 0.3em;
    user-select: none;
}

/* Ale highlighting */
.ale {
    font-weight: 600;
    font-style: normal;
}

.ale-word {
    font-weight: 600;
}

/* Passages (copyable inline/block) */
.passage {
    cursor: pointer;
    position: relative;
    transition: background-color 0.2s ease;
}

blockquote.passage {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--passage-bg);
    border-radius: var(--radius);
}

blockquote.passage p {
    margin-bottom: 0;
    font-style: italic;
    text-align: left;
}

blockquote.passage:hover {
    background: var(--passage-hover);
}

blockquote.passage::after {
    content: '';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
    background-size: contain;
    opacity: 0;
    transition: opacity 0.2s;
}

blockquote.passage:hover::after {
    opacity: 0.5;
}

span.passage {
    background: var(--passage-bg);
    padding: 0.1em 0.3em;
    border-radius: 4px;
}

span.passage:hover {
    background: var(--passage-hover);
}

/* Advantages list */
.vyhody {
    list-style: none;
    margin: 1rem 0 1.5rem;
    padding: 0;
    counter-reset: vyhoda;
}

.vyhody li {
    counter-increment: vyhoda;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    transition: background-color 0.2s;
}

.vyhody li::before {
    content: counter(vyhoda) ". ";
    font-weight: 700;
    color: var(--accent);
}

.vyhody li.passage:hover {
    background: var(--passage-hover);
}

/* Finale */
.finale {
    font-size: 1.375rem;
    font-weight: 700;
    text-align: center;
    padding: 1.25rem;
    background: var(--accent-soft);
    border-radius: var(--radius);
    margin-top: 2rem;
}

.finale:hover {
    background: var(--accent-hover);
}

.year {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 2rem;
    font-size: 1rem;
}

/* Copied state */
.passage.copied,
.response-card.copied {
    background-color: var(--copied-bg);
}

/* Checklist */
.checklist {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 0.75rem;
}

.checklist li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    font-size: 1rem;
}

.checklist li svg {
    flex-shrink: 0;
    margin-top: 0.15rem;
    color: var(--accent);
}

/* Response cards */
.cards-grid {
    display: grid;
    gap: 1rem;
}

.response-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s;
}

.response-card:hover {
    transform: translateY(-1px);
}

.response-card .card-text {
    flex: 1;
}

.response-card .card-quote {
    font-size: 1.0625rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.response-card .card-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.response-card .copy-icon {
    flex-shrink: 0;
    color: var(--text-muted);
    opacity: 0.4;
    transition: opacity 0.2s;
}

.response-card:hover .copy-icon {
    opacity: 1;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(0.5rem);
    background: var(--text);
    color: var(--bg);
    font-size: 0.9rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 100;
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Theme toggle */
.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--text-muted);
    box-shadow: var(--card-shadow);
    transition: color 0.2s, background 0.2s;
    z-index: 50;
}

.theme-toggle:hover {
    color: var(--text);
}

/* Footer */
.footer {
    max-width: var(--max-width);
    margin: 2rem auto 0;
    padding: 2.5rem 0 3rem;
    font-size: 1rem;
    color: var(--text-muted);
}

.footer-divider {
    height: 1px;
    background: var(--border);
    margin-bottom: 2rem;
}

.footer-heading {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.footer ul {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.footer li {
    margin-bottom: 0.4rem;
}

.footer .copyright {
    font-size: 0.85rem;
}

/* Hint */
.copy-hint {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    opacity: 0.7;
}

.copy-hint svg {
    vertical-align: middle;
    margin-right: 0.25rem;
}

/* Responsive */
@media (max-width: 640px) {
    body {
        font-size: 1rem;
        padding: 0 1rem;
    }

    .hero {
        padding: 3rem 0 2rem;
    }

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

    .section {
        padding: 2rem 0;
    }

    .section h2 {
        font-size: 1.375rem;
    }

    .author-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.25rem;
        padding: 1.5rem;
    }

    .author-card img {
        width: 120px;
    }

    blockquote.passage {
        padding: 1rem;
    }

    .response-card {
        padding: 1rem;
    }

    .finale {
        font-size: 1.125rem;
    }
}
