:root {
    --bg: #f7f6f2;
    --fg: #1f2328;
    --muted: #6b7280;
    --accent: #b8860b;
    --card: #ffffff;
    --border: #e3e0d8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    background: var(--bg);
    color: var(--fg);
    line-height: 1.6;
}

header, main, footer {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 24px;
}

header { padding-top: 32px; }

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.brand-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-sub { margin: 0; font-size: 1.05rem; color: #333; font-weight: 500; }
.logo { display: block; border-radius: 8px; flex-shrink: 0; }

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: system-ui, sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--fg);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 12px;
    transition: background 0.15s ease;
    flex-shrink: 0;
    align-self: flex-start;
}

.github-link:hover { background: var(--bg); }
.github-link:focus-visible,
.btn:focus-visible,
.footer-links a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.gh-stat {
    font-size: 0.85rem;
    color: var(--muted);
    padding-left: 6px;
    border-left: 1px solid var(--border);
}
.gh-stat b { color: var(--fg); font-weight: 600; }

h1 {
    font-size: 2rem;
    margin: 0;
    line-height: 1.2;
}

.tagline {
    font-size: 1.15rem;
    max-width: 760px;
    margin: 0 0 16px;
}

.subtitle {
    color: var(--muted);
    font-size: 1.05rem;
    max-width: 760px;
}

.subtitle.example { font-size: 0.98rem; }

.features {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    padding: 0;
    margin: 20px auto 4px;
    font-family: system-ui, sans-serif;
}

.features li {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--fg);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px;
}

.how {
    margin: 24px 0;
}

.how h2 { font-size: 1.3rem; margin: 0 0 8px; }
.how > p { color: var(--muted); font-size: 1rem; max-width: 760px; margin: 0 0 16px; }

.how-example {
    font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--fg);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin: 0 0 16px;
    overflow-x: auto;
    white-space: pre-wrap;
}

.how-example mark {
    display: inline-block;
    background: #fff3bf;
    border: 1px solid #f0d264;
    border-radius: 4px;
    padding: 1px 6px;
    font-weight: 600;
    color: var(--fg);
}

.how-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    margin: 0 0 16px;
    font-family: system-ui, sans-serif;
}

.chip {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.85rem;
    color: var(--muted);
}
.chip-title { display: block; font-weight: 600; color: var(--fg); margin-bottom: 2px; }

.how-qa {
    font-family: system-ui, sans-serif;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
}

.qa-row { display: flex; align-items: baseline; gap: 10px; font-size: 0.95rem; margin-bottom: 6px; }
.qa-label {
    flex-shrink: 0;
    width: 130px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
}
.qa-answer { font-weight: 700; color: #2f7a3d; }
.qa-note { font-size: 0.85rem; color: var(--muted); margin: 8px 0 0; line-height: 1.5; }
.qa-wrong { color: #b54708; font-weight: 600; }

@media (max-width: 560px) {
    .qa-row { flex-direction: column; gap: 2px; }
    .qa-label { width: auto; }
}

.needles {
    background: #fffaf0;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 12px 20px;
    margin: 24px 0;
}

.needles h2 { font-size: 1.1rem; margin: 4px 0; }
.needles ul { margin: 8px 0 4px; }
.needles li { font-style: italic; }

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch;
    margin-bottom: 8px;
}

.mode {
    font-family: system-ui, sans-serif;
    font-size: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px 12px;
    margin: 0;
}

.mode legend { font-weight: 600; padding: 0 6px; }
.mode label { display: block; margin-top: 6px; }
.mode strong { color: var(--accent); }

.answer-key-toggle {
    flex-basis: 100%;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-family: system-ui, sans-serif;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    cursor: pointer;
}
.answer-key-toggle input { flex-shrink: 0; margin-top: 3px; }
.answer-key-text { display: flex; flex-direction: column; gap: 3px; }
.answer-key-title { font-size: 0.95rem; font-weight: 600; line-height: 1.3; }
.answer-key-title .optional { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
.answer-key-desc { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }

main { padding-top: 40px; }

.download-heading { font-size: 1.6rem; margin: 0 0 4px; }
.download-sub { color: var(--muted); margin: 0 0 20px; }
.controls { margin-top: 0; }

#catalog {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    padding-bottom: 32px;
    align-items: stretch;
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card h3 { margin: 0 0 10px; font-size: 1.2rem; }

.meta-list {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    color: var(--muted);
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.size-badge {
    display: inline-block;
    font-weight: 600;
    color: var(--accent);
    background: #fffaf0;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 1px 8px;
    margin-right: 6px;
}

.buttons { display: flex; gap: 8px; margin-top: auto; }

.btn {
    flex: 1;
    text-align: center;
    text-decoration: none;
    font-family: system-ui, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border-radius: 6px;
    padding: 8px 10px;
    transition: background 0.15s ease;
}

.btn:hover { background: #9c7109; }

footer {
    color: var(--muted);
    font-family: system-ui, sans-serif;
    font-size: 0.9rem;
    margin-top: 56px;
    padding: 32px 24px 48px;
    border-top: 1px solid var(--border);
    text-align: center;
}

footer h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--fg);
    margin: 0 0 8px;
}

footer p { margin: 4px 0; }

footer a { color: var(--accent); font-weight: 600; text-decoration: none; }
footer a:hover { text-decoration: underline; }

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px 20px;
    margin-top: 14px;
}

.roadmap {
    max-width: 920px;
    margin: 0 auto;
    padding: 0 24px 64px;
    font-family: system-ui, sans-serif;
}

.roadmap h2 {
    font-size: 1.3rem;
    margin: 0 0 16px;
}

.roadmap-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
}

.roadmap-list li {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: var(--muted);
}

.roadmap-list li.done {
    color: var(--fg);
    font-weight: 600;
    border-left: 4px solid var(--accent);
}

@media (max-width: 560px) {
    h1 { font-size: 1.6rem; }
    .tagline { font-size: 1.05rem; }
    .controls { flex-direction: column; }
    .mode { flex-basis: 100%; }
}
