:root {
    --bg: #f6f5f2;
    --card: #ffffff;
    --text: #1d1d1f;
    --muted: #6b6b70;
    --line: #e4e2dc;
    --accent: #2f5bea;
    --accent-text: #ffffff;
    --danger: #c62828;
    --ok-bg: #e7f6ec;
    --ok-text: #1e6b3a;
    --err-bg: #fdecec;
    --err-text: #a12626;
    --info-bg: #eaf0fe;
    --info-text: #1f3f9e;
    --radius: 14px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #121214;
        --card: #1c1c1f;
        --text: #f2f2f4;
        --muted: #a0a0a8;
        --line: #2e2e33;
        --accent: #6b8cff;
        --accent-text: #0b0b0d;
        --danger: #ff6b6b;
        --ok-bg: #12301f;
        --ok-text: #8fe0ab;
        --err-bg: #3a1616;
        --err-text: #ffb3b3;
        --info-bg: #17223f;
        --info-text: #b8c8ff;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
code { font-size: .9em; background: var(--line); padding: .1em .35em; border-radius: 6px; }

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem 1.25rem;
    border-bottom: 1px solid var(--line);
    background: var(--card);
}
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
nav { display: flex; align-items: center; gap: 1rem; }
nav a { text-decoration: none; }

main { max-width: 960px; margin: 0 auto; padding: 2rem 1rem 3rem; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 0 1rem 2rem; }

.hero { text-align: center; padding: 2rem 0 2.5rem; }
.hero h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0 0 .5rem; }
.lead { color: var(--muted); max-width: 36rem; margin: 0 auto 1.5rem; font-size: 1.1rem; }

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

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.card h3 { margin-top: 0; }
.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.muted { color: var(--muted); }

label { display: block; margin-bottom: 1rem; font-weight: 600; }
label small { font-weight: 400; color: var(--muted); }
input, select, textarea {
    display: block;
    width: 100%;
    margin-top: .35rem;
    padding: .7rem .8rem;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 10px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.button, button.button {
    display: inline-block;
    padding: .7rem 1.2rem;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-text);
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}
.button.small { padding: .4rem .8rem; font-size: .9rem; }
.button.wide { width: 100%; }
.button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.button.danger { background: var(--danger); color: #fff; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
form.inline { display: inline; margin: 0; }

.flash { padding: .75rem 1rem; border-radius: 10px; background: var(--info-bg); color: var(--info-text); }
.flash.success { background: var(--ok-bg); color: var(--ok-text); }
.flash.error { background: var(--err-bg); color: var(--err-text); }

details.danger summary { cursor: pointer; color: var(--danger); font-weight: 600; }
details.danger form { margin-top: 1rem; }

.answer { margin-top: 1rem; padding: 1rem; border-left: 3px solid var(--accent); background: var(--bg); border-radius: 8px; }

/* ---- WikiWiz ---- */
body.ww { --accent: #5b3df5; --accent-text: #fff; --bg: #f5f3ff; --line: #e2dcff; }
@media (prefers-color-scheme: dark) { body.ww { --accent: #a594ff; --accent-text: #110b2e; --bg: #100d1f; --line: #2a2448; } }
.ww .brand { color: var(--accent); }
.ww-hero { text-align: center; padding: 2.5rem 0 1rem; }
.ww-hero h1 { font-size: clamp(2.2rem, 7vw, 3.6rem); line-height: 1.1; margin: 0 0 .75rem; letter-spacing: -0.03em; }
.ww-hero h1 span { color: var(--accent); }
.ww-search { display: flex; gap: .5rem; max-width: 620px; margin: 1.25rem auto 0; }
.ww-search input { margin: 0; font-size: 1.05rem; }
.ww-search .button { white-space: nowrap; }
.ww-card { display: block; color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.ww-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(91,61,245,.12); }
.ww-card h3 { margin: .3rem 0; }
.ww-emoji { font-size: 2rem; }
section h2 { margin-top: 2.2rem; }
.ww-how { margin-top: 2rem; }
.ww-ask { margin-top: 2.5rem; border-top: 4px solid var(--accent); }
.ww-wanted, .ww-list { padding-left: 1.2rem; line-height: 1.9; }
.ww-article h1 { font-size: clamp(1.9rem, 6vw, 2.8rem); margin-bottom: .25rem; }
.ww-levels { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.5rem 0 1rem; }
.ww-levels input { position: absolute; opacity: 0; pointer-events: none; }
.ww-levels label { margin: 0; padding: .55rem 1rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; background: var(--card); }
.ww-levels input:checked + label { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.ww-panel { display: none; width: 100%; font-size: 1.08rem; line-height: 1.7; margin-top: .5rem; }
#lv-kid:checked ~ .ww-kid, #lv-beginner:checked ~ .ww-beginner, #lv-expert:checked ~ .ww-expert { display: block; }
