:root {
  --bg: #0d1117; --fg: #d1d7e0; --dim: #7d8590; --accent: #e3a35a; --ok: #56d364; --err: #f47067;
  --cmd: #6cb6ff; --think: #9e8ac7; --bar: #161b22;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); }
body { display: flex; flex-direction: column; font: 14px/1.5 ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace; }
#wrap { flex: 1; display: flex; min-height: 0; }
#term { flex: 1; min-width: 0; overflow-y: auto; padding: 12px 16px 4px; }
#pane { width: min(420px, 42vw); display: flex; flex-direction: column; border-left: 1px solid #30363d; background: #010409; }
#pane[hidden] { display: none; }
#panebar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 4px 10px; color: var(--dim); font-size: 12px; background: var(--bar); }
#panebar button, #panebar a { font: inherit; color: var(--cmd); background: none; border: 0; cursor: pointer; text-decoration: none; padding: 2px 4px; }
#preview { flex: 1; width: 100%; border: 0; background: #2b1b0e; }
#out { white-space: pre-wrap; word-break: break-word; }
#out > div { margin: 0; }
.dim { color: var(--dim); }
.ok { color: var(--ok); }
.err { color: var(--err); }
.you { color: var(--accent); }
.cmd { color: var(--cmd); }
.think { color: var(--think); font-style: italic; }
.stdout { color: var(--fg); border-left: 2px solid #30363d; padding-left: 8px; }
.stderr { color: var(--err); border-left: 2px solid #5a2a28; padding-left: 8px; }
.cursor::after { content: "▋"; color: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
/* the working line under the newest output while the AI works (console.js setWork) */
#working { padding: 6px 0 2px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#working[hidden] { display: none; }
#working .spin { display: inline-block; width: 1.2em; color: var(--accent); }
#working .word { font-weight: 700; background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 35%, #fff 50%, var(--accent) 65%, var(--accent) 100%);
  background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shimmer 2s linear infinite; }
body.kids #working .word { background-image: linear-gradient(90deg, #f1c40f, #ff6b9a, #7fd6ff, #56d364, #f1c40f); background-size: 400% 100%; animation-duration: 3s; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { #working .word { animation: none; color: var(--accent); background: none; } }
#line { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0 12px; }
#prompt { color: var(--accent); white-space: nowrap; padding-top: 1px; }
#cmd { flex: 1; background: transparent; border: 0; outline: 0; color: var(--fg); font: inherit; resize: none; padding: 0; min-height: 1.5em; caret-color: var(--accent); }
#cmd.secret { -webkit-text-security: disc; }
#bar { display: flex; justify-content: space-between; gap: 12px; background: var(--bar); color: var(--dim); padding: 4px 16px; font-size: 12px; }
#status.busy { color: var(--accent); }
#status .hint { opacity: 0.75; }
kbd { font: inherit; border: 1px solid #30363d; border-radius: 4px; padding: 0 4px; }
@media (max-width: 760px) {
  body { font-size: 13px; }
  #meta { display: none; }
  #wrap { flex-direction: column-reverse; }
  #pane { width: auto; height: 46vh; border-left: 0; border-bottom: 1px solid #30363d; }
}

/* kid mode (/code/): a friendlier face on the same console */
body.kids { font-size: 15px; --accent: #f1c40f; --cmd: #7fd6ff; }
body.kids #meta { display: inline; color: #f1c40f; font-weight: 700; }

/* kids: their games list (each row opens the game) and the reviewers' note */
.game-row { cursor: pointer; color: var(--fg, inherit); }
.game-row:hover, .game-row:focus-visible { color: var(--accent); text-decoration: underline; outline: none; }
.note { color: var(--ok); font-weight: 700; }

/* the helper's question (interactive prompting, when the grown-up allows it) */
.artcard { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin: 8px 0; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 10px; }
.artcard canvas { width: 160px; height: 160px; image-rendering: pixelated; border-radius: 8px; background: repeating-conic-gradient(#e2e6ec 0 25%, #eef1f5 0 50%) 0 0 / 20px 20px; }
.artcard .side { flex: 1; min-width: 180px; display: grid; gap: 8px; }
.artcard .q { font-weight: 700; }
.artcard button { font: inherit; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--accent); background: transparent; color: inherit; cursor: pointer; }
.artcard button:hover, .artcard button:focus-visible { background: var(--accent); color: #111; }
.artcard .choices { display: flex; flex-wrap: wrap; gap: 8px; }
.askkid { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--ok); border-radius: 10px; }
.askkid .q { font-weight: 700; margin-bottom: 8px; }
.askkid .choices { display: flex; flex-wrap: wrap; gap: 8px; }
.askkid button { font: inherit; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--ok); background: transparent; color: inherit; cursor: pointer; }
.askkid button:hover:not(:disabled), .askkid button:focus-visible { background: var(--ok); color: #111; }
.askkid button:disabled { opacity: .5; cursor: default; }
.askkid .typed { display: flex; gap: 8px; margin-top: 8px; }
.askkid .typed input { flex: 1; font: inherit; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--ok); background: transparent; color: inherit; }

/* easy mode: big buttons instead of commands (console.js kidButtons) */
#kidbar { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 14px; }
#kidbar button { font: inherit; font-size: 15px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--accent); background: transparent; color: var(--fg); cursor: pointer; }
#kidbar button:hover, #kidbar button:focus-visible { background: var(--accent); color: #111; }
