:root {
    --bg: #f6f1e7;
    --surface: #fffaf0;
    --text: #2b2620;
    --muted: #7a6f60;
    --accent: #8a4b2a;
    --accent-soft: #f0dfcf;
    --border: #e2d6c3;
    --error: #a3271f;
    --font-story: Georgia, 'Iowan Old Style', 'Times New Roman', serif;
    --font-ui: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1b1916;
        --surface: #24211d;
        --text: #e9e2d6;
        --muted: #a39887;
        --accent: #e0a37c;
        --accent-soft: #3a2e25;
        --border: #3a352e;
        --error: #ff8a80;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-ui);
    line-height: 1.5;
}

.game {
    max-width: 44rem;
    margin: 0 auto;
    padding: 1.5rem 1rem 4rem;
}

.game__header {
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

.game__bar {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.game__title {
    font-family: var(--font-story);
    font-weight: normal;
    font-size: 1.75rem;
    margin: 0 0 0.5rem;
}

.link-button {
    background: none;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.story {
    font-family: var(--font-story);
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.entry p { margin: 0 0 0.75rem; }

.entry--choice {
    color: var(--muted);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    margin-top: 1.25rem;
}

.entry--choice p::before { content: '› '; color: var(--accent); }

.entry--new { animation: appear 0.4s ease-out; }

@keyframes appear {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

.choices {
    display: grid;
    gap: 1.25rem;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
}

.choices__heading {
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    margin: 0 0 0.5rem;
    text-transform: uppercase;
}

.choices__list {
    display: grid;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.choice {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s;
}

.choice:hover, .choice:focus-visible {
    background: var(--accent-soft);
    border-color: var(--accent);
    outline: none;
}

.is-busy .choice { opacity: 0.6; pointer-events: none; }

.error { color: var(--error); }

.debug {
    margin-top: 2.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.debug pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    overflow-x: auto;
    padding: 0.75rem;
}
