/* Kid-friendly top bar */
.site-topbar {
  background: #2ea44f;
  padding: 10px 16px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-topbar .site-home {
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.05em;
}
.site-topbar .site-home:hover { text-decoration: underline; }

.main-content { padding: 20px 18px 80px; max-width: 820px; margin: 0 auto; }

/* In-page Python runner */
.py-example {
  margin: 1.25em 0 0;
  border: 1px solid #d0d7de;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  overflow: hidden;
  background: #fff;
}
.py-panel-label {
  background: #eaeef2;
  padding: 7px 12px;
  font-size: 13px;
  color: #57606a;
  font-weight: 700;
  border-bottom: 1px solid #d0d7de;
}
.py-panel-label-edit { background: #d8f5e1; color: #1f6f3a; }
.py-panel-label-main { background: #fff3cd; color: #8a5a00; }

.py-source-updated {
  background: #fff3cd;
  color: #8a5a00;
  border-bottom: 1px solid #f1d977;
  padding: 8px 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.py-source-updated-btn {
  background: #2ea44f;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.py-source-updated-btn:hover { background: #2c974b; }

/* Hide the raw .py-starter and .py-solution elements before runner.js
   processes them, so the kid never sees the unformatted cumulative code
   or the solution leaking through. */
.py-starter,
.py-solution { display: none; }

/* The big main editor container (cumulative mode) */
.py-main {
  margin: 1.5em 0;
  border: 1px solid #d0d7de;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.py-main .py-runner-editor.py-main-editor { min-height: 260px; }

/* Turtle drawing area. Skulpt creates its own absolutely-positioned
   canvas + SVG layers inside a wrapper div, so we just give it a
   fixed-size, centered box and let it do its thing. */
.py-turtle-canvas {
  background: #4A752C;
  width: 500px;
  height: 500px;
  max-width: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-top: 1px solid #30363d;
  position: relative;
}
.py-turtle-canvas:empty {
  display: none;
}

pre.py-example-code {
  margin: 0 !important;
  padding: 12px 14px !important;
  background: #f6f8fa !important;
  color: #1f2328 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  overflow: auto !important;
  white-space: pre !important;
  border-radius: 0 !important;
  border: 0 !important;
}
pre.py-example-code code {
  background: transparent !important;
  padding: 0 !important;
  color: #1f2328 !important;
  font-size: inherit !important;
  -webkit-text-fill-color: #1f2328;
}

.py-runner {
  margin: 0 0 1.25em;
  border: 1px solid #d0d7de;
  border-radius: 0 0 10px 10px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.py-runner-editor {
  width: 100%;
  box-sizing: border-box;
  border: 0 !important;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  background: #ffffff !important;
  color: #1f2328 !important;
  -webkit-text-fill-color: #1f2328;
  caret-color: #2ea44f;
  resize: vertical;
  min-height: 80px;
  tab-size: 4;
  -webkit-appearance: none;
  border-radius: 0;
}
.py-runner-editor:focus { outline: 2px solid #2ea44f; outline-offset: -2px; }
.py-runner-editor::placeholder { color: #8b96a5; font-style: italic; }

/* Two-column wrapper: line-number gutter on the left, textarea on the right.
   Both children share line-height + font-size so numbers stay aligned with
   the actual lines of code. */
.py-runner-edit-wrap {
  display: flex;
  background: #ffffff;
  align-items: stretch;
}
.py-runner-edit-wrap > .py-runner-editor {
  flex: 1;
  min-width: 0;
}
.py-runner-gutter {
  flex: 0 0 auto;
  padding: 12px 8px 12px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.5;
  background: #f6f8fa;
  color: #8b96a5;
  text-align: right;
  white-space: pre;
  user-select: none;
  -webkit-user-select: none;
  border-right: 1px solid #eaeef2;
  overflow: hidden;
  min-width: 2.25em;
}

.py-runner-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f6f8fa;
  border-top: 1px solid #d0d7de;
}
.py-runner-run {
  background: #2ea44f;
  color: #fff;
  border: 0;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.py-runner-run:hover:not(:disabled) { background: #268a43; }
.py-runner-run:disabled { opacity: 0.7; cursor: wait; }

.py-runner-copy {
  background: #ddf4ff;
  color: #0969da;
  border: 1px solid #54aeff;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
}
.py-runner-copy:hover { background: #b6e3ff; }

.py-runner-reset {
  background: transparent;
  color: #57606a;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 14px;
  cursor: pointer;
}
.py-runner-reset:hover { background: #eaeef2; }

.py-runner-status { color: #57606a; font-size: 13px; margin-left: auto; }

.py-runner-output {
  margin: 0;
  padding: 10px 14px;
  max-height: 260px;
  overflow: auto;
  background: #0d1117;
  color: #e6edf3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  border-top: 1px solid #30363d;
  min-height: 1.6em;
}
.py-runner-output:empty::before {
  content: "Output will appear here after you tap Run.";
  color: #6e7781;
}
.py-runner-output.py-runner-error { color: #ffb4b4; }

/* Make the static code fallback (e.g. big reference blocks we opt out) match */
pre.py-runner-static {
  background: #0d1117;
  color: #e6edf3;
  padding: 12px 14px;
  border-radius: 10px;
  overflow: auto;
}

/* --- Progress tracker --- */
.tutorial-card {
  margin: 2em 0;
  padding: 1.25em 1.25em 1.5em;
  background: #ffffff;
  border: 1px solid #d0d7de;
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.05);
}
.tutorial-card[data-tutorial="snake"]  { border-top: 4px solid #2ea44f; }
.tutorial-card[data-tutorial="rallyx"] { border-top: 4px solid #FFD23F; }
.tutorial-card h2 { margin-top: 0; }

.snake-progress {
  margin: 1em 0 1.25em;
  padding: 12px 14px;
  background: #f6f8fa;
  border: 1px solid #d0d7de;
  border-radius: 10px;
}
.snake-progress-head { font-size: 15px; color: #1f2328; }
.snake-progress-bar {
  margin-top: 8px;
  height: 10px;
  background: #eaeef2;
  border-radius: 999px;
  overflow: hidden;
}
.snake-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2ea44f, #3fb950);
  transition: width 300ms ease;
}
.snake-continue {
  display: inline-block;
  background: #2ea44f;
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15em;
}
.snake-continue:hover { background: #268a43; }

.snake-clear {
  text-align: center;
  margin-top: 3em;
  font-size: 12px;
  color: #8b96a5;
}
.snake-clear a { color: #8b96a5; text-decoration: underline; }
.snake-clear a:hover { color: #57606a; }

/* Inline `code` inside headings should match the heading's font size,
   not shrink to body-text size. Theme CSS has high specificity AND
   uses `!important` on some rules, so force with !important and
   include both bare and `.main-content`-scoped selectors. */
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code,
.main-content h1 code, .main-content h2 code, .main-content h3 code,
.main-content h4 code, .main-content h5 code, .main-content h6 code {
  font-size: inherit !important;
  padding: 0.05em 0.25em !important;
  line-height: inherit !important;
}
