:root {
  --bg: #faf7f2; --card: #ffffff; --ink: #1f1d1a; --muted: #6b655c;
  --accent: #b8321f; --accent-ink: #ffffff; --line: #e6e0d6; --soft: #f3ece1;
  --warn: #fff6e0; --warn-line: #e8c770; --ok: #2f7d4f; --danger-bg: #fdecea; --danger-line: #e5a39a;
  --kid: #2b6cb0; --kid-soft: #e8f1fb;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #171513; --card: #211e1b; --ink: #f1ece5; --muted: #a59d92; --accent: #e0563f;
    --line: #36312b; --soft: #2c2722; --warn: #2e2716; --warn-line: #7a6424; --ok: #5cbf86;
    --danger-bg: #3a1f1b; --danger-line: #7d3a31; --kid: #6aa8ea; --kid-soft: #1c2a3a; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif; }
.wrap { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; }
a { color: inherit; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0 16px; }
.logo { font-family: Georgia, "Times New Roman", serif; font-size: 1.6rem; font-weight: 700; text-decoration: none; letter-spacing: -0.01em; }
.logo span { color: var(--accent); }
body.kid .logo span { color: var(--kid); }
nav { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
nav a, nav button { font-size: 0.92rem; }
h1 { font-family: Georgia, serif; font-size: 1.7rem; margin: 0 0 6px; }
h2 { font-size: 1.15rem; margin: 0 0 8px; }
p.lead { color: var(--muted); margin: 0 0 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.notice { background: var(--warn); border: 1px solid var(--warn-line); border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 0.93rem; }
.notice strong { display: block; }
.alert { background: var(--danger-bg); border: 1px solid var(--danger-line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=tel] {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font: inherit; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
button, .btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 8px; padding: 11px 18px;
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center; }
body.kid button:not(.secondary):not(.link), body.kid .btn:not(.secondary) { background: var(--kid); }
button.secondary, .btn.secondary { background: var(--soft); color: var(--ink); }
button.link { background: none; color: var(--muted); padding: 4px 6px; text-decoration: underline; font-weight: 400; }
button:disabled { opacity: 0.5; cursor: default; }
.error { color: var(--accent); min-height: 1.4em; margin: 10px 0 0; font-size: 0.93rem; }
.ok { color: var(--ok); font-size: 0.93rem; }
.small { color: var(--muted); font-size: 0.86rem; }
.stack { display: grid; gap: 10px; }
.langs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.langs button { padding: 16px; font-size: 1.05rem; }
.choices { display: grid; gap: 12px; }
.choices .btn { padding: 18px; font-size: 1.05rem; }
.log { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.msg { padding: 12px 14px; border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user { background: var(--soft); align-self: flex-end; max-width: 85%; }
.msg.assistant { background: var(--card); border: 1px solid var(--line); max-width: 92%; }
body.kid .msg.user { background: var(--kid-soft); }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }
.empty em { display: block; margin-top: 8px; font-style: normal; }
form.ask { display: flex; gap: 8px; align-items: flex-end; }
textarea { flex: 1; resize: vertical; min-height: 52px; max-height: 220px; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); font: inherit; min-width: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 1.5rem; letter-spacing: 0.15em; font-weight: 700; }
.topics { display: grid; gap: 6px; margin: 6px 0 10px; }
.topics label { font-weight: 400; margin: 0; display: flex; gap: 8px; align-items: center; }
.topics .locked { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 520px) { .grid2 { grid-template-columns: 1fr; } }
details { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
summary { cursor: pointer; font-weight: 600; }
.tag { display: inline-block; font-size: 0.78rem; background: var(--soft); border-radius: 99px; padding: 2px 9px; color: var(--muted); }
ul.plain { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 12px; background: var(--soft); border-radius: 10px; }
.pins { display: flex; gap: 8px; flex-wrap: wrap; }
.pins button { min-width: 120px; }
footer { margin-top: 28px; color: var(--muted); font-size: 0.82rem; }
.summary-text { white-space: pre-wrap; }
