/* ==========================================================================
   yr 教程页（yr/tutorials/*.md）的排版样式。

   作用域全部限定在 body.md 之下 —— 只有 _layouts/tutorial.html 带这个 class，
   老面板 index.html 的 body 没有，所以这里怎么改都溢不出去。

   加载顺序在 style.css 之后，用来覆盖 jQuery UI 主题（scrollstyle.css）和
   style.css 里的老规则。
   ========================================================================== */

body.md {
  --fg:        #1f2328;
  --fg-muted:  #59636e;
  --bg:        #ffffff;
  --bg-soft:   #f6f8fa;
  --border:    #d1d9e0;
  --accent:    #1a7f37;   /* 与「下一步」按钮的绿色同源 */
  --accent-dk: #116329;
  --link:      #0969da;
  --warn-bg:   #fff8c5;
  --warn-bd:   #d4a72c;

  color: var(--fg);
  background: var(--bg);
  /* 中文字体栈：原来只有 Arial，中文会掉进宋体 */
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

/* 正文限宽居中；窄栏（iframe 教程面板）里自动退化成满宽 */
body.md .accordion {
  max-width: 48rem;
  margin: 0 auto;
  padding: 0 4px;
}

/* --------------------------------------------------------------------------
   折叠栏标题（markdown.js 把每个 # 变成 .ui-accordion-header）
   -------------------------------------------------------------------------- */

body.md .ui-accordion .ui-accordion-header {
  position: relative;
  display: block;
  margin: 10px 0 0;
  padding: 14px 16px 14px 38px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--fg);
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}

/* 折叠箭头自己画。原来靠 jQuery UI 的精灵图 ui-icons_*.png，
   但 css/images/ 目录根本不存在，那些图标一直是 404。 */
body.md .ui-accordion .ui-accordion-header::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -5px;
  border-right: 2px solid var(--fg-muted);
  border-bottom: 2px solid var(--fg-muted);
  transform: rotate(-45deg);
  transition: transform .2s ease;
}

body.md .ui-accordion .ui-accordion-header.ui-state-active::before {
  margin-top: -7px;
  transform: rotate(45deg);
}

/* jQuery UI 自己插的图标 span，没图可显示，藏掉 */
body.md .ui-accordion-header-icon { display: none; }

body.md .ui-accordion .ui-accordion-header:hover {
  background: #eef2f6;
  border-color: #b8c2cc;
}

body.md .ui-accordion .ui-accordion-header.ui-state-active {
  background: var(--bg-soft);
  border-color: var(--border);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

body.md .ui-accordion .ui-accordion-content {
  padding: 4px 18px 22px;
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 10px 10px;
  overflow: visible;   /* 老规则是 auto，会把长代码块裁掉 */
}

/* ==========================================================================
   正文排版 —— 整段放进 @layer，故意压低优先级

   这些是 p / a / img / pre / code / table 这类**通用元素**选择器，
   `body.md img` 的特异性是 (0,1,2)，而 ai2-blocks 预览组件自己的
   `.ai2-block-preview img` 只有 (0,1,1) —— 不分层的话我们永远赢，
   组件被套上我们的边框、圆角、display:block，排版就烂了。

   未分层的样式优先级高于任何 @layer，所以组件的 blockly.css /
   ai2blockly.css（由 loader 动态插入 head，本来就在我们之后）自动胜出，
   不需要再逐条去「还原」——那是补不完的。

   反过来，需要压过 jQuery UI 主题的规则（.ui-accordion-*）和我们自己加的
   UI（.tutorial*）都留在 layer 外面，保持高优先级。

   注：浏览器若不支持 @layer 会整块忽略，退化成无排版，但不会出错。
   ========================================================================== */

@layer tutorial-base {

body.md .ui-accordion-content h2,
body.md .ui-accordion-content h3,
body.md .ui-accordion-content h4 {
  margin: 1.6em 0 .6em;
  font-weight: 600;
  line-height: 1.35;
  color: var(--fg);
}

body.md .ui-accordion-content h2 { font-size: 20px; }
body.md .ui-accordion-content h3 { font-size: 17px; }
body.md .ui-accordion-content h4 { font-size: 16px; color: var(--fg-muted); }

/* 步骤页里第一个标题不要顶太多空 */
body.md .tutorialContentPage > :first-child { margin-top: .4em; }

body.md p { margin: 0 0 1em; }
body.md strong { font-weight: 600; }

body.md a { color: var(--link); text-decoration: none; }
body.md a:hover { text-decoration: underline; }

body.md ol, body.md ul { margin: 0 0 1em; padding-left: 1.6em; }
body.md li { margin: .35em 0; }
body.md li > ul, body.md li > ol { margin: .35em 0; }

body.md hr {
  height: 1px; border: 0; margin: 2em 0;
  background: var(--border);
}

body.md blockquote {
  margin: 1em 0;
  padding: .6em 1em;
  color: var(--fg-muted);
  border-left: 4px solid var(--border);
  background: var(--bg-soft);
  border-radius: 0 8px 8px 0;
}

/* VIP 内容隐藏提示，沿用组件文档页的 .locked 视觉和文案结构。 */
body.md .locked {
  max-width: 500px;
  overflow: hidden;
  margin: 20px 0;
  padding: 17px 8px 16px 38px;
  border: 2px dashed #9c6521;
  background: #fff url('../yr/images/lock.png') no-repeat 12px 50%;
  background-size: 18px auto;
  font-size: 14px;
  color: #9c6521;
}

body.md .locked a {
  color: #9c6521;
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   代码
   -------------------------------------------------------------------------- */

body.md code,
body.md pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

/* 行内代码 */
body.md :not(pre) > code {
  padding: .15em .4em;
  font-size: .88em;
  background: rgba(129, 139, 152, .14);
  border-radius: 6px;
}

body.md pre {
  margin: 0 0 1.2em;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;          /* 长行横向滚动，不撑破面板 */
}

body.md pre > code {
  padding: 0;
  background: none;
  white-space: pre;
}

/* --------------------------------------------------------------------------
   表格
   -------------------------------------------------------------------------- */

body.md .ui-accordion-content table {
  width: 100%;
  margin: 0 0 1.2em;
  border-collapse: collapse;
  font-size: 14.5px;
  display: block;
  overflow-x: auto;          /* 窄栏里表格自己滚，页面不横滚 */
}

body.md .ui-accordion-content th,
body.md .ui-accordion-content td {
  padding: 8px 12px;
  text-align: left;
  border: 1px solid var(--border);
  vertical-align: top;
}

body.md .ui-accordion-content th {
  font-weight: 600;
  background: var(--bg-soft);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   图片
   -------------------------------------------------------------------------- */

body.md img {
  max-width: 100%;
  height: auto;
  margin: .4em auto 1.2em;
  display: block;
  border-radius: 8px;
}

body.md img.enlargeImage,
body.md img.enlargeImageVip {
  border: 1px solid var(--border);
  cursor: zoom-in;
}

body.md img.iconImg { display: inline; margin: 0; border: 0; border-radius: 0; }

}  /* ← @layer tutorial-base 结束 */

/* --------------------------------------------------------------------------
   步骤导航（tutorialPage.js 生成）
   -------------------------------------------------------------------------- */

body.md .tutorialNavigationHeader {
  display: grid !important;
  grid-template-columns: max-content minmax(38px, 1fr) max-content !important;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  flex-wrap: nowrap !important;
  margin: 6px 0 14px;
  padding-bottom: 10px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}

/* JS 写死了 float 和百分比宽度，这里用 flex 接管 */
body.md .tutorialNavigationHeader > div {
  float: none !important;
  width: auto !important;
}

body.md .countDiv {
  justify-self: center;
  min-width: max-content;
  text-align: center;
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}

body.md .tutorialPreviousButton,
body.md .tutorialNextButton { cursor: pointer; }

body.md .tutorialPreviousButton {
  color: var(--fg-muted);
  font-size: 14px;
}
body.md .tutorialPreviousButton:hover { color: var(--link); }

/* 「下一步」按钮：原来是 24pt，在窄栏里会顶破 */
body.md .tutorialNextButtonContainer {
  margin: 1.6em 0 .6em;
  text-align: center;
}

/* markdown.js 给它加的是 class="btn btn-success btn-lg"，但教程页已经不加载
   bootstrap 了，所以这里要把 .btn 原本提供的基础属性一并补上 */
body.md .tutorialNextButtonContainer > button,
body.md button.tutorialNextButton {
  display: inline-block;
  vertical-align: middle;
  padding: 10px 30px;
  font-family: inherit;
  font-size: 16px !important;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
  text-align: center;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  user-select: none;
  transition: background .15s ease;
}

body.md .tutorialNextButtonContainer > button:hover,
body.md button.tutorialNextButton:hover { background: var(--accent-dk); }

/* --------------------------------------------------------------------------
   顶部返回条
   -------------------------------------------------------------------------- */

body.md .tutorialTopBar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 48rem;
  margin: 0 auto 4px;
  padding: 10px 6px;
  font-size: 14px;
  color: var(--fg-muted);
}

body.md .tutorialTopBar a {
  color: var(--fg-muted);
  cursor: pointer;
}
body.md .tutorialTopBar a:hover { color: var(--link); text-decoration: none; }

body.md .tutorialTopBar .tutorialTitle {
  font-weight: 600;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   进度条 + 步骤目录（tutorialEnhance.js 生成）
   -------------------------------------------------------------------------- */

body.md .tutorialProgress {
  height: 4px;
  margin: -8px 0 14px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

body.md .tutorialProgressBar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: 999px;
  transition: width .25s ease;
}

body.md .tutorialTocToggle {
  cursor: pointer;
  user-select: none;
}
body.md .tutorialTocToggle:hover { color: var(--link); }
body.md .tutorialTocToggle::after {
  content: " ▾";
  font-size: 11px;
}

body.md .tutorialToc {
  display: none;
  margin: 0 0 14px;
  padding: 6px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}
body.md .tutorialToc.open { display: block; }

body.md .tutorialTocList {
  margin: 0;
  padding: 0 0 0 1.8em;
  font-size: 14px;
}

body.md .tutorialTocItem {
  margin: 0;
  padding: 5px 8px;
  cursor: pointer;
  border-radius: 6px;
}
body.md .tutorialTocItem:hover { background: #e8edf2; color: var(--link); }
body.md .tutorialTocItem.current {
  font-weight: 600;
  color: var(--accent-dk);
}

/* --------------------------------------------------------------------------
   代码块复制按钮
   -------------------------------------------------------------------------- */

body.md pre { position: relative; }

body.md .tutorialCopyButton {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  font-size: 12px;
  font-family: inherit;
  color: var(--fg-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, color .15s ease;
}

body.md pre:hover .tutorialCopyButton,
body.md .tutorialCopyButton:focus { opacity: 1; }
body.md .tutorialCopyButton:hover { color: var(--link); border-color: var(--link); }
body.md .tutorialCopyButton.done { opacity: 1; color: var(--accent); border-color: var(--accent); }

/* 触屏没有 hover，常驻显示 */
@media (hover: none) {
  body.md .tutorialCopyButton { opacity: 1; }
}

/* --------------------------------------------------------------------------
   图片放大兜底（只在没有父窗口接管时启用）
   -------------------------------------------------------------------------- */

body.md .tutorialLightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 24px;
  background: rgba(0, 0, 0, .82);
  cursor: zoom-out;
}
body.md .tutorialLightbox.open {
  display: flex;
  align-items: center;
  justify-content: center;
}
body.md .tutorialLightbox img {
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
}

/* --------------------------------------------------------------------------
   窄屏 / 手机
   -------------------------------------------------------------------------- */

@media (max-width: 640px) {
  body.md { font-size: 15px; }
  body.md .accordion { padding: 0; }
  body.md .ui-accordion .ui-accordion-header { padding: 12px 12px 12px 32px; font-size: 16px; }
  body.md .ui-accordion .ui-accordion-content { padding: 4px 12px 18px; }
  body.md .tutorialTopBar { padding: 8px 12px; }
  body.md pre { font-size: 12.5px; padding: 12px; }
  body.md .ui-accordion-content table { font-size: 13.5px; }
}

/* ==========================================================================
   从 style.css 搬过来的规则（style.css 已删）

   搬家的原因：上面的正文排版进了 @layer，而未分层的规则胜过任何 layer——
   style.css 里的老 `body { font-family: Arial }` 会反过来盖掉中文字体栈。
   与其两个文件互相打架，不如把还需要的 39 条并进来，其余 26 条（.projectbox
   .left .right p.small .ui-helper-reset 等老面板遗留）直接丢掉。

   这些都留在 layer 外：它们是具体 class，不会误伤第三方组件。
   ========================================================================== */

/* AI2 代码块配色 —— 对应编辑器里各抽屉的颜色，正文用 <span class="control"> 引用，别改 */
.control {
	background-color: #b18e35;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.variables {
	background-color: #d05f2d;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.procedures {
	background-color: #7c5385;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.text {
	background-color: #b32d5e;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.getters {
	background-color: #439970;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.setters {
	background-color: #266643;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.logic {
	background-color: #8ab74e;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.math {
	background-color: #3f71b5;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.lists {
	background-color: #49a6d4;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.dictionary {
	background-color: #2d1799;
	border: 1px dashed #000;
	color: white;
	padding:1px;}
.tutorialDiv:hover .enlargeImage {
  opacity: 0.75;}
.tutorialDiv {
    position: relative;
    display: inline-block;}
.enlargeImage {
  opacity: 1;
  display: block;
  transition: .5s ease;
  backface-visibility: hidden;
  max-width: 100%;
  max-height: 400px;}
.enlargeImageVip {
 opacity: 0.5;
 display: block;
 transition: .5s ease;
 backface-visibility: hidden;
 max-width: 100%;
 max-height: 400px;}
.zoom {
  transition: .5s ease;
  opacity: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -ms-transform: translate(-50%, -50%);}
.lock {
 transition: .5s ease;
 opacity: 1;
 position: absolute;
 top: 50%;
 left: 50%;
 transform: translate(-50%, -50%);
 -ms-transform: translate(-50%, -50%);
 cursor: pointer;}
.lock:hover {
	opacity: 0.6;}
.tutorialDiv:hover .enlargeImage {
  opacity: 0.3;}
.tutorialDiv:hover .zoom {
  opacity: 1;}
.properties {
	font-weight: bold; 
	color: #3399ff;}
.hint {
	background-color: #eef2e0;
	border-radius: 3px;
	padding: 10px;
	margin-top: 10px;
	margin-bottom: 10px;}
.hint .hint {
	padding: 10px 0;}
.hideHint {
	display: none;}
.properties {
	font-weight: bold; 
	color: #3399ff;}
.tabs {
  width:100%;
  height: 40px;
  text-align:center;
  background-color: #f6f6f6;
  margin-bottom: 10px;}
#youthMobilePowerTab {
  float:left;
  height:40px;
  width:50%;
  background-color: #ccdea8;
  padding-top: 8px;}
#howToTab {
  float:left;
  height:40px;
  width:50%;
  background-color: #f6f6f6;
  padding-top: 8px;}
.noemulator {
  display: none;}
.noemulator.setup {
  display: block;}
.noemulator .emulator {
  display: none;}
.noemulator span.noemulator {
  display: inline;}
::-webkit-scrollbar {
	width: 12px;
	height: 12px;
	background: transparent;}
::-webkit-scrollbar-thumb {
	box-shadow: inset 0 0 10px 10px #ddd;
	border-radius: 30px;
	border: solid 3px transparent;
	background: transparent;
	color: transparent;}
::-webkit-scrollbar-track {
	box-shadow: inset 0 0 10px 10px transparent;
	border: solid 3px transparent;
	background: transparent;}
.video {
	position: relative;}
.video_page {
	width:100%;
	opacity: 0.75;}
.video_page:hover {
	opacity: 0.9;}
.video_icon {
	width: 54px;
    height: 54px;
    position: absolute;
    z-index: 999;
	right: 20px;
    bottom: 0px;}
.video_icon:hover {
	opacity: 0.75;}

/* ==========================================================================
   2026 学习工作区

   设计目标不是再做一层“文档皮肤”，而是把教程变成一个有路径、有状态、有反馈的
   学习产品。以下规则位于文件末尾，统一接管旧版 jQuery UI 与 tabs 的视觉表现。
   ========================================================================== */

body.md {
  --fg: #24313b;
  --fg-muted: #687681;
  --bg: #fbfefc;
  --bg-soft: #f4f8f6;
  --surface: #ffffff;
  --border: #dce8e1;
  --accent: #2fa76f;
  --accent-dk: #188653;
  --accent-soft: #e8f9f0;
  --mint: #6bd7a2;
  --amber: #f1aa38;
  --link: #168a5a;
  min-height: 100vh;
  margin: 0;
  color: var(--fg);
  background: var(--bg);
}

body.md *, body.md *::before, body.md *::after { box-sizing: border-box; }

body.md .tutorialSkipLink {
  position: fixed;
  left: 14px;
  top: -60px;
  z-index: 10000;
  padding: 9px 14px;
  color: #fff;
  background: var(--accent-dk);
  border-radius: 0 0 9px 9px;
  transition: top .15s ease;
}
body.md .tutorialSkipLink:focus { top: 0; }

body.md .tutorialAppBar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 0 28px;
  color: var(--fg);
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 7px 24px rgba(31, 51, 40, .055);
  backdrop-filter: blur(14px);
}

body.md .tutorialBack,
body.md .tutorialAppIdentity {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: #5f6f68;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .02em;
  text-decoration: none;
}
body.md .tutorialBack {
  width: max-content;
  min-height: 38px;
  gap: 7px;
  padding: 7px 13px 7px 11px;
  color: #496258;
  background: #f3f9f5;
  border: 1px solid #d8e9df;
  border-radius: 999px;
  font-weight: 750;
  transition: color .16s ease, background .16s ease, border-color .16s ease,
              box-shadow .16s ease, transform .16s ease;
}
body.md .tutorialBackIcon {
  width: 19px;
  height: 19px;
  display: grid;
  place-items: center;
  color: var(--accent-dk);
  transition: transform .16s ease;
}
body.md .tutorialBackIcon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
body.md .tutorialBack:hover {
  color: var(--accent-dk);
  background: #eaf8f0;
  border-color: #bce3cb;
  box-shadow: 0 6px 15px rgba(36,143,88,.10);
  transform: translateY(-1px);
  text-decoration: none;
}
body.md .tutorialBack:hover .tutorialBackIcon { transform: scale(1.05); }
body.md .tutorialBack:focus-visible { outline: 3px solid rgba(47,167,111,.22); outline-offset: 2px; }

body.md .tutorialAppIdentity { justify-self: center; color: #294238; letter-spacing: .12em; }
/* 课程标题默认不显示，只在手机顶栏出现（≤560px 展开它，见文件末尾） */
body.md .tutorialAppCourse { display: none; }
body.md .tutorialAppMark {
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  padding: 5px;
  color: #fff;
  background: linear-gradient(145deg, #63dda0, #28ad70);
  border-radius: 8px;
  box-shadow: 0 5px 14px rgba(40,173,112,.22);
}
body.md .tutorialAppMark svg,
body.md .tutorialTabLearn svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.md .tutorialHeaderProgress {
  width: min(245px, 100%);
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  color: #718078;
  font-size: 11px;
  white-space: nowrap;
}
body.md .tutorialHeaderTrack {
  width: 76px;
  height: 4px;
  overflow: hidden;
  background: #e5efe9;
  border-radius: 99px;
}
body.md .tutorialHeaderTrack i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2faf70, #75dba7);
  border-radius: inherit;
  transition: width .35s ease;
}

body.md .tutorialShell {
  width: min(1540px, 100%);
  min-height: calc(100vh - 64px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
}

body.md .tutorialSidebar {
  position: sticky;
  top: 64px;
  align-self: start;
  height: calc(100vh - 64px);
  overflow-y: auto;
  padding: 31px 24px 28px;
  background: rgba(255,255,255,.88);
  border-right: 1px solid var(--border);
  box-shadow: 12px 0 36px rgba(36,63,48,.025);
  backdrop-filter: blur(14px);
  scrollbar-width: thin;
}

body.md .tutorialEyebrow,
body.md .tutorialOutlineLabel {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}
body.md .tutorialSidebarIntro h1 {
  margin: 7px 0 9px;
  font-size: 25px;
  line-height: 1.22;
  letter-spacing: -.03em;
}
body.md .tutorialSidebarIntro p {
  margin: 0;
  color: var(--fg-muted);
  font-size: 13px;
  line-height: 1.65;
}
body.md .tutorialMeta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 15px; }
body.md .tutorialMeta > span {
  padding: 5px 9px;
  color: #65736c;
  background: #f5f9f7;
  border: 1px solid #e0eae4;
  border-radius: 7px;
  font-size: 11px;
}
body.md .tutorialMeta b { color: #e29419; letter-spacing: .06em; }

/* 主模式 tab：不再用 float + 内联背景色，状态、键盘与 ARIA 完整统一 */
body.md .tabs {
  width: auto;
  height: auto;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  margin: 24px 0 19px;
  padding: 5px;
  background: #f3f8f5;
  border: 1px solid #dfeae3;
  border-radius: 13px;
  text-align: left;
}
body.md #youthMobilePowerTab,
body.md #howToTab {
  float: none;
  width: 100%;
  height: auto;
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  color: #6c7a73;
  background: transparent !important;
  border: 0;
  border-radius: 10px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
body.md #youthMobilePowerTab:hover,
body.md #howToTab:hover { color: var(--fg); background: rgba(255,255,255,.65) !important; }
body.md #youthMobilePowerTab.is-active,
body.md #howToTab.is-active {
  color: var(--fg);
  background: #fff !important;
  box-shadow: 0 6px 18px rgba(35,62,46,.065), 0 0 0 1px rgba(47,167,111,.08);
}
body.md #youthMobilePowerTab:focus-visible,
body.md #howToTab:focus-visible { outline: 2px solid rgba(47,167,111,.34); outline-offset: 2px; }
body.md .tabs button > span:last-child { display: grid; gap: 1px; }
body.md .tabs button b { font-size: 13px; }
body.md .tabs button small { color: #849189; font-size: 10px; }
body.md .tutorialTabIcon {
  width: 31px;
  height: 31px;
  flex: none;
  display: grid;
  place-items: center;
  color: #fff;
  background: #92a39a;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 800;
  transition: background .18s ease;
}
body.md .tutorialTabLearn { padding: 7px; }
body.md .is-active .tutorialTabIcon { background: linear-gradient(145deg, #56d391, #25a969); box-shadow: 0 4px 11px rgba(37,169,105,.18); }

body.md .tutorialJourney {
  padding: 14px;
  background: linear-gradient(145deg, #edfbf4, #f8fffb);
  border: 1px solid #d8eee1;
  border-radius: 13px;
}
body.md .tutorialJourneyHead { display: flex; justify-content: space-between; font-size: 12px; font-weight: 700; }
body.md .tutorialJourneyHead b { color: var(--accent); font-variant-numeric: tabular-nums; }
body.md .tutorialJourneyTrack { height: 5px; margin: 10px 0 8px; overflow: hidden; background: #dfeee5; border-radius: 99px; }
body.md .tutorialJourneyTrack i { display: block; width: 0; height: 100%; background: linear-gradient(90deg, var(--accent), var(--mint)); border-radius: inherit; transition: width .35s ease; }
body.md .tutorialJourney p { margin: 0; color: #718078; font-size: 10.5px; line-height: 1.55; }

body.md .tutorialOutline { margin-top: 23px; }
body.md .tutorialOutlineLabel { margin: 0 0 9px 8px; color: #819087; }
body.md #tutorialOutlineList { display: grid; gap: 3px; }
body.md .tutorialOutlineItem {
  width: 100%;
  display: grid;
  grid-template-columns: 28px minmax(0,1fr) 18px;
  align-items: center;
  gap: 7px;
  padding: 9px 8px;
  color: #68776f;
  background: transparent;
  border: 0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  transition: color .15s ease, background .15s ease;
}
body.md .tutorialOutlineItem:hover { color: var(--fg); background: #f0f8f3; }
body.md .tutorialOutlineItem.is-current { color: var(--accent-dk); background: var(--accent-soft); font-weight: 700; }
body.md .tutorialOutlineNumber {
  color: #8f9d95;
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
}
body.md .tutorialOutlineItem.is-current .tutorialOutlineNumber { color: var(--accent); }
body.md .tutorialOutlineText { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.md .tutorialOutlineCheck { opacity: 0; width: 17px; height: 17px; display: grid; place-items: center; color: #fff; background: var(--mint); border-radius: 50%; font-size: 10px; }
body.md .tutorialOutlineItem.is-done .tutorialOutlineCheck { opacity: 1; }
body.md .tutorialShortcut { margin: 24px 6px 0; color: #89978f; font-size: 10px; }
body.md kbd { padding: 2px 5px; color: #6f7772; background: #fff; border: 1px solid #dfe4e1; border-bottom-width: 2px; border-radius: 4px; font: 10px/1.2 inherit; }

body.md .tutorialWorkspace {
  min-width: 0;
  padding: 42px clamp(22px, 5vw, 72px) 0;
  /* 顶部一层极淡的薄荷色光晕，让工作区和侧栏有空间层次，不抢正文 */
  background:
    radial-gradient(1100px 300px at 68% -140px, rgba(107, 215, 162, .10), transparent 70%),
    linear-gradient(180deg, #f7fcf9 0%, rgba(251, 254, 252, 0) 280px);
}
body.md .tutorialWorkspaceTop {
  width: min(950px, 100%);
  min-height: 64px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 18px;
}
body.md .tutorialWorkspaceTop h2 { margin: 5px 0 0; font-size: clamp(21px, 2.2vw, 30px); line-height: 1.25; letter-spacing: -.035em; }
body.md .tutorialResume {
  flex: none;
  padding: 9px 14px;
  color: var(--accent-dk);
  background: #fff;
  border: 1px solid #d6e8dd;
  border-radius: 9px;
  box-shadow: 0 5px 16px rgba(31,70,46,.055);
  font: 650 12px/1.4 inherit;
  cursor: pointer;
}
body.md .tutorialResume:hover { border-color: #a9d7bb; transform: translateY(-1px); }

body.md .accordion { width: min(950px, 100%); max-width: none; margin: 0 auto; padding: 0; }
body.md #youthRadioAccordion[hidden],
body.md #howToPanel[hidden] { display: none !important; }

/* 章节是清晰的课程单元，不再像系统设置页的折叠控件。
   左侧的章节序号徽章用 CSS counter 生成（01/02/…），课程感一目了然。 */
body.md #youthRadioAccordion { counter-reset: tutorial-chapter; }
body.md .ui-accordion .ui-accordion-header {
  counter-increment: tutorial-chapter;
  margin: 9px 0 0;
  padding: 16px 50px 16px 64px;
  color: #3f4d46;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 13px;
  box-shadow: 0 2px 8px rgba(31,56,41,.025);
  font-size: 15px;
  font-weight: 700;
  transition: color .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
body.md .ui-accordion .ui-accordion-header::after {
  content: counter(tutorial-chapter, decimal-leading-zero);
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 32px;
  padding: 3px 0;
  text-align: center;
  color: #4c7a5d;
  background: #eef7f1;
  border: 1px solid #dcece2;
  border-radius: 8px;
  /* 数字用正文同款无衬线 + 等宽数字变体：比等宽字体的数字柔和，
     01→10 宽度保持一致，徽章不会被撑得忽宽忽窄 */
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 750;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  letter-spacing: .02em;
  transition: color .18s ease, background .18s ease, border-color .18s ease;
}
body.md .ui-accordion .ui-accordion-header::before {
  left: auto;
  right: 20px;
  width: 8px;
  height: 8px;
  margin-top: -6px;
  border-color: #7d9085;
}
body.md .ui-accordion .ui-accordion-header:hover { color: var(--accent-dk); background: #fff; border-color: #b9ddc7; transform: translateY(-1px); box-shadow: 0 7px 20px rgba(29,76,48,.055); }
body.md .ui-accordion .ui-accordion-header.ui-state-active {
  color: var(--accent-dk);
  background: linear-gradient(100deg, #e8f9f0, #f5fcf8);
  border-color: #cce9d7;
  border-radius: 15px 15px 0 0;
  box-shadow: 0 8px 22px rgba(34,91,55,.065);
}
body.md .ui-accordion .ui-accordion-header.ui-state-active::after {
  color: #fff;
  background: linear-gradient(145deg, #35b273, #1f9259);
  border-color: transparent;
}
body.md .ui-accordion .ui-accordion-header.ui-state-active::before { border-color: var(--accent); }
body.md .ui-accordion .ui-accordion-content {
  padding: 25px clamp(16px, 3vw, 36px) 34px;
  background: #fff;
  border: 1px solid #dae7df;
  border-top: 0;
  border-radius: 0 0 15px 15px;
  box-shadow: 0 14px 32px rgba(27,61,39,.05);
}

body.md .tutorialHelpIntro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin: 0 0 26px;
  padding: 24px;
  color: var(--fg);
  background: #f7faf8;
  border: 1px solid #dfe8e2;
  border-radius: 15px;
}
body.md .tutorialHelpIntro > div > span {
  display: block;
  margin-bottom: 5px;
  color: #328354;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
}
body.md .tutorialHelpIntro h2 { margin: 0 0 5px; font-size: 22px; }
body.md .tutorialHelpIntro p { max-width: 560px; margin: 0; color: var(--fg-muted); font-size: 13px; }
body.md .tutorialHelpIntro > a {
  flex: none;
  padding: 9px 12px;
  color: #236a3d;
  background: #fff;
  border: 1px solid #cee2d5;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
body.md .tutorialHelpIntro > a:hover { color: #155b30; border-color: #9fc9ad; text-decoration: none; }
body.md .tutorialHelpGroups { width: min(950px, 100%); margin: 0 auto; }
body.md .tutorialHelpGroup { margin: 0 0 27px; }
body.md .tutorialHelpGroupHead {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
}
body.md .tutorialHelpGroupHead h3 { margin: 0; color: #35443b; font-size: 15px; }
body.md .tutorialHelpGroupHead span {
  padding: 2px 7px;
  color: #758078;
  background: #eef2ef;
  border-radius: 999px;
  font-size: 9px;
}
body.md .tutorialHelpGrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}
body.md .tutorialHelpGrid > a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 14px 15px;
  color: #35443b;
  background: #fff;
  border: 1px solid #dce5df;
  border-radius: 11px;
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
body.md .tutorialHelpGrid > a:hover {
  color: var(--accent-dk);
  border-color: #abd1b7;
  box-shadow: 0 6px 18px rgba(29, 67, 41, .055);
  transform: translateY(-1px);
  text-decoration: none;
}
body.md .tutorialHelpCardText { min-width: 0; }
body.md .tutorialHelpCardText b,
body.md .tutorialHelpCardText small { display: block; }
body.md .tutorialHelpCardText b { margin-bottom: 4px; font-size: 13px; }
body.md .tutorialHelpCardText small {
  overflow: hidden;
  color: #7a867e;
  font-size: 10px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.md .tutorialHelpCardArrow { flex: none; color: #4b9565; font-size: 14px; }

@media (max-width: 640px) {
  body.md .tutorialHelpIntro { align-items: flex-start; flex-direction: column; padding: 19px; }
  body.md .tutorialHelpIntro > a { width: 100%; text-align: center; }
  body.md .tutorialHelpGrid { grid-template-columns: 1fr; }
}

/* 步骤导航：强操作按钮 + 可点击步骤计数 */
body.md .tutorialNavigationHeader {
  gap: 10px;
  margin: 0 0 14px;
  padding: 0 0 13px;
  border-bottom: 1px solid #e2ebe5;
}
body.md .tutorialNavigationHeader > .previousLinkContainer,
body.md .tutorialNavigationHeader > .nextLinkContainer {
  display: flex !important;
  width: max-content !important;
  min-width: max-content;
  flex: none !important;
  white-space: nowrap;
}
body.md .tutorialNavigationHeader > .previousLinkContainer { justify-self: start; }
body.md .tutorialNavigationHeader > .nextLinkContainer { justify-self: end; }
body.md .tutorialNavigationHeader a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  color: #5e7066;
  background: #f4f9f6;
  border: 1px solid #dfe9e3;
  border-radius: 8px;
  font-weight: 650;
  line-height: 1.25;
  white-space: nowrap;
  text-decoration: none;
}
body.md .tutorialNavigationHeader a:hover { color: var(--accent-dk); background: var(--accent-soft); border-color: #bde3cc; text-decoration: none; }
body.md .countDiv { font-size: 12px; font-weight: 650; }
body.md .tutorialProgress { height: 5px; margin: -2px 0 18px; background: #e1eee6; }
body.md .tutorialProgressBar { background: linear-gradient(90deg, var(--accent), var(--mint)); }
body.md .tutorialToc {
  margin: -7px 0 18px;
  padding: 8px;
  background: #f4f9f6;
  border-color: #dce9e1;
  border-radius: 12px;
}
body.md .tutorialTocItem { padding: 8px 10px; }
body.md .tutorialTocItem:hover { color: var(--accent-dk); background: var(--accent-soft); }
body.md .tutorialTocItem.current { color: var(--accent-dk); }

/* Markdown 的 ### 子步骤：保留二级分页，但视觉上从属于当前 ## 主步骤。 */
body.md .tutorialSubflow {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 18px 0 6px;
  /* 只用一条左竖线表示「从属于上面那个主步骤」。
     原来是渐变卡片 + 1px 边 + 4px 左粗边，在主步骤的白底里形成框中框，
     视觉重量压过了主步骤本身。 */
  padding: 2px 0 4px 18px;
  background: none;
  border: 0;
  border-left: 2px solid #d6e9dd;
  border-radius: 0;
}
body.md .tutorialSubflow::before {
  content: "分步进行";
  order: -2;
  width: max-content;
  margin: 0 0 10px;
  padding: 0;
  color: #7d9a8a;
  background: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
body.md .tutorialSubflow > .tutorialContentPage { order: 0; }

/* 子步骤标题 —— 这一小步叫什么，是读者最先要看到的 */
body.md .tutorialSubflow > .tutorialContentPage > h3:first-child {
  margin: 0 0 .5em;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent-dk);
}
body.md .tutorialSubflow > .tutorialNavigationHeader {
  order: 20;
  grid-template-columns: max-content minmax(38px, 1fr) max-content !important;
  width: 100%;
  margin: 13px 0 0;
  padding: 10px 0 0;
  overflow: visible;
  /* 实线细分隔即可，虚线在已经有左竖线的区块里显得碎 */
  border-top: 1px solid #e6efe9;
  border-bottom: 0;
}
/* 子步骤的翻页按钮：比主步骤轻一档，但别小到点不准。
   原来 11px + 白底，在浅色区块里几乎看不见边界。 */
body.md .tutorialSubflow > .tutorialNavigationHeader a {
  gap: 5px;
  min-height: 32px;
  padding: 6px 12px;
  color: #35704d;
  background: #f2faf5;
  border: 1px solid #cfe5d7;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
body.md .tutorialSubflow > .tutorialNavigationHeader a:hover {
  color: #1a7f37;
  background: #e3f7ea;
  border-color: #a9d6ba;
}
/* 箭头用 border 画的几何 chevron，不用 ← → 这类字符——字符箭头在不同
   字体下粗细和基线都不一样，放大后尤其毛糙。这里和折叠面板的箭头同一套
   画法，颜色跟着 currentColor 走，hover 时自动变。 */
body.md .tutorialSubflow > .tutorialNavigationHeader .tutorialPreviousButton::before,
body.md .tutorialSubflow > .tutorialNavigationHeader .tutorialNextButton::after {
  content: "";
  flex: none;
  width: 5px;
  height: 5px;
  border-style: solid;
  border-color: currentColor;
  transform: rotate(45deg);
}
body.md .tutorialSubflow > .tutorialNavigationHeader .tutorialPreviousButton::before {
  border-width: 0 0 1.5px 1.5px;   /* 左下两条边 → 指向左 */
  margin-right: 1px;
}
body.md .tutorialSubflow > .tutorialNavigationHeader .tutorialNextButton::after {
  border-width: 1.5px 1.5px 0 0;   /* 右上两条边 → 指向右 */
  margin-left: 1px;
}
body.md .tutorialSubflow > .tutorialNavigationHeader .countDiv {
  color: #6b8879;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}
body.md .tutorialSubflow > .tutorialProgress {
  order: 21;
  height: 3px;
  margin: 9px 0 0;
  background: #dceee3;
}
body.md .tutorialSubflow > .tutorialToc { order: 22; margin: 8px 0 0; }
body.md .tutorialSubflow > .tutorialIndexDiv { order: 30; }

body.md .tutorialNextButtonContainer { margin: 29px 0 2px; }
body.md .tutorialNextButtonContainer > button,
body.md button.tutorialNextButton {
  min-width: 154px;
  padding: 11px 28px;
  background: linear-gradient(125deg, #2fad70, #55c98c);
  border-radius: 10px;
  box-shadow: 0 9px 20px rgba(38,158,99,.20);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
body.md .tutorialNextButtonContainer > button:hover,
body.md button.tutorialNextButton:hover { background: linear-gradient(125deg, #198e58, #39b876); transform: translateY(-1px); box-shadow: 0 11px 23px rgba(30,142,87,.24); }

/* 教学内容细节 */
body.md .ui-accordion-content blockquote { border-left-color: var(--amber); background: #fff9ed; }
body.md .ui-accordion-content table { border-radius: 10px; }
body.md .ui-accordion-content th { color: #4f6257; background: #f3f8f5; }
body.md .ui-accordion-content th, body.md .ui-accordion-content td { border-color: #dee8e2; }
body.md .hintContainer { margin: 16px 0; border: 1px solid #d9e8df; border-radius: 12px; overflow: hidden; }
body.md .hintContainer > button {
  width: 100%;
  padding: 11px 14px;
  color: var(--accent-dk);
  background: #eaf8f0;
  border: 0;
  font: 700 13px/1.4 inherit;
  text-align: left;
  cursor: pointer;
}
body.md .hintContainer > button::before { content: "✦"; margin-right: 8px; }
body.md .hintContainer > .hint { margin: 0; padding: 14px 16px; background: #fbfefc; border-radius: 0; }

/* ── AI2 可视化代码实验室 ───────────────────────────────────────────── */
body.md .ai2-block-preview {
  position: relative;
  margin: 20px 0 23px;
  /* 不留底部内边距：内容直接铺到卡片边缘，由 overflow:hidden + 圆角裁形。
     留着的话代码区下面会多出一条白边，白边下面才是圆角，像多包了一层。
     右下角的水印是 pointer-events:none 的浮层，本来就压在内容上，不需要留位。 */
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid #dbe6e0;
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(24, 45, 33, .05);
}

/* 顶栏原来是 #1d2933 的深色条，压在浅色卡片上、下面又接深色代码区，
   一张图里三种底色，断得厉害。整体改成同一套浅色。
   （另：原先这里还有一条 ::before "AI2 积木预览" 标题，已去掉——
   tab 栏本身就说明了这是什么。） */
body.md .ai2-block-preview-tabbar {
  min-height: 40px;
  gap: 4px;
  margin: 0 !important;
  padding: 6px 10px;
  color: #5a6b62;
  background: #f4f8f6;
  border-bottom: 1px solid #e3ece7;
  font-family: inherit;
  font-size: 12px;
}
body.md .ai2-block-preview-tab {
  padding: 5px 11px;
  color: #64756b;
  background: none;
  border: 1px solid transparent;
  border-radius: 7px;
  transition: background .15s ease, color .15s ease;
}
body.md .ai2-block-preview-tab:hover { color: #27623d; background: #e8f2ec; }
/* 选中的 tab 用白底浮起来，像浏览器标签页 */
body.md .ai2-block-preview-tab.active {
  color: #1a7f37;
  background: #fff;
  border-color: #cfe5d7;
  box-shadow: 0 1px 2px rgba(24, 45, 33, .06);
}

body.md .ai2-block-preview-tools { gap: 4px; }
body.md .ai2-block-preview-tool {
  color: #7b8c83;
  border: 1px solid transparent;
  border-radius: 7px;
  transition: background .15s ease, color .15s ease;
}
body.md .ai2-block-preview-tool:hover {
  color: #1a7f37;
  background: #e8f2ec;
  border-color: #cfe5d7;
}

/* 块图画布：浅色网点，衬得积木更清楚 */
body.md .ai2-block-preview-blocks {
  background-color: #fbfdfc;
  background-image: radial-gradient(#dde8e2 1px, transparent 1px);
  background-size: 18px 18px;
}

/* 代码 tab 的文本：跟正文里其它代码块同一套浅色，不再是黑底 */
body.md .ai2-block-preview-codewrap {
  margin: 0;
  background: var(--bg-soft);
  border-radius: 0;
}
body.md pre.ai2-block-preview-code {
  margin: 0;
  padding: 18px 20px 20px;
  color: var(--fg);
  background: var(--bg-soft);
  border: 0;
  border-radius: 0;
  font-size: 12.5px;
  line-height: 1.7;
}

body.md .ai2-block-preview-watermark { right: 11px; bottom: 5px; color: #adbcb4; }
body.md .ai2-block-preview-fs { padding: 0 !important; }
body.md .ai2-block-preview-toast {
  border: 1px solid rgba(24, 45, 33, .10);
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(8, 12, 10, .18);
}

/* 预览没画出来时退回显示原始代码。这里原本是 #172129 黑底配深色标题条，
   跟改成浅色的预览卡片对不上；改成浅琥珀，既能读，又一眼看出是「降级了」
   而不是正常的代码块。 */
body.md pre.tutorialPreviewFallback {
  padding-top: 42px;
  color: var(--fg);
  background: #fffaf0;
  border: 1px solid #f0dcb4;
  border-radius: 12px;
  box-shadow: none;
}
body.md pre.tutorialPreviewFallback::before {
  content: "文本预览 · 可视化引擎暂未连接";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 9px 14px;
  color: #8a6413;
  background: #fdf3dd;
  border-bottom: 1px solid #f0dcb4;
  font: 600 11px/1.5 inherit;
  letter-spacing: .02em;
}
body.md .tutorialPreviewDegraded::before { content: "积木预览 · 已自动切换到可读原文"; }

/* 局部滚动条也纳入视觉系统 */
body.md ::-webkit-scrollbar { width: 9px; height: 9px; }
body.md ::-webkit-scrollbar-thumb { background: #cadbd1; border: 2px solid transparent; background-clip: padding-box; border-radius: 99px; box-shadow: none; }
body.md ::-webkit-scrollbar-track { background: transparent; box-shadow: none; }

/* ── 课程导航容器 ────────────────────────────────────────────────────────
   桌面：display:contents 摊回侧栏，布局和旧版完全一致；
   窄栏（≤820px，含 App Inventor 的 300px 侧边栏）：整个变成左侧抽屉，
   由 tutorialWorkspaceTop 上的「目录」按钮唤出。旧的窄栏方案是直接把
   目录 display:none —— 学习者在侧边栏里反而失去了全局导航。 */
@media (min-width: 821px) {
  body.md .tutorialCourseNav { display: contents; }
  body.md .tutorialDrawerHead { display: none; }
  body.md .tutorialOutlineToggle { display: none; }
}
body.md .tutorialDrawerScrim { display: none; }

@media (max-width: 1050px) {
  body.md .tutorialShell { grid-template-columns: 278px minmax(0,1fr); }
  body.md .tutorialSidebar { padding-inline: 18px; }
  body.md .tutorialWorkspace { padding-inline: 28px; }
}

@media (max-width: 820px) {
  /* 顶栏压成一行，进度改贴底边的全宽细线 —— 常驻可见又不占高度 */
  body.md .tutorialAppBar { height: 54px; grid-template-columns: auto 1fr auto; padding-inline: 14px; }
  body.md .tutorialAppIdentity { justify-self: end; }
  body.md .tutorialHeaderProgress {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 1;
    display: block;
    width: auto;
    height: 3px;
  }
  body.md #tutorialHeaderProgressText { display: none; }
  body.md .tutorialHeaderTrack {
    display: block;   /* 父级不再是 flex，span 必须显式块级，宽度才生效 */
    width: 100%;
    height: 3px;
    background: #e6efe9;
  }

  body.md .tutorialShell { display: block; min-height: calc(100vh - 54px); }
  body.md .tutorialSidebar {
    position: static;
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 18px 16px 14px;
    background: #fff;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    backdrop-filter: none;
  }
  /* 开篇介绍在窄栏里是「课程抬头」，不能占掉一屏：去装饰、压字号、截两行 */
  body.md .tutorialEyebrow { display: none; }
  body.md .tutorialSidebarIntro h1 { margin: 2px 0 6px; font-size: 19px; }
  body.md .tutorialSidebarIntro p {
    max-width: 650px;
    font-size: 12px;
    line-height: 1.6;
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  body.md .tutorialMeta { margin-top: 10px; }

  /* 模式切换改成分段控件：一行装得下，两个世界依然分得清 */
  body.md .tabs { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 3px; margin: 13px 0 11px; padding: 3px; border-radius: 12px; }
  body.md #youthMobilePowerTab,
  body.md #howToTab { min-height: 38px; gap: 8px; padding: 6px 9px; border-radius: 9px; }
  body.md .tutorialTabIcon { width: 22px; height: 22px; border-radius: 7px; font-size: 12px; }
  body.md .tutorialTabLearn { padding: 5px; }
  body.md .tabs button small { display: none; }
  body.md .tabs button b { font-size: 12.5px; }

  body.md .tutorialWorkspace { padding: 18px 16px 0; }
  /* 章节标题为主，目录按钮常驻右上；「继续学习」放下一行整宽 */
  body.md .tutorialWorkspaceTop {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title toggle" "resume resume";
    align-items: center;
    min-height: 0;
    gap: 8px 10px;
    margin: 0 auto 12px;
  }
  body.md .tutorialWorkspaceTop > div:first-child { grid-area: title; min-width: 0; }
  body.md .tutorialWorkspaceTop h2 { margin: 0; font-size: 18px; }
  body.md .tutorialResume { grid-area: resume; width: 100%; margin-top: 2px; }
  body.md .tutorialOutlineToggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 12px;
    color: #2c6b46;
    background: #fff;
    border: 1px solid #cbe1d3;
    border-radius: 9px;
    font: 700 12px/1.3 inherit;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
  }
  body.md .tutorialOutlineToggle svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
  }
  body.md .tutorialOutlineToggle:hover { color: #175c34; background: #f2faf5; border-color: #a8d4b8; }

  /* 目录抽屉：从左滑出，遮罩 + Esc + 点目录项自动收起（见 tutorialEnhance.js） */
  body.md .tutorialCourseNav {
    position: fixed;
    z-index: 230;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(85vw, 316px);
    padding: 0 16px 26px;
    background: #fff;
    border-right: 1px solid #e2ece6;
    box-shadow: 26px 0 64px rgba(23, 44, 32, .16);
    overflow-y: auto;
    transform: translateX(-103%);
    visibility: hidden;
    transition: transform .26s ease, visibility .26s;
  }
  body.md.has-open-drawer .tutorialCourseNav { transform: none; visibility: visible; }
  body.md .tutorialDrawerScrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 220;
    background: rgba(15, 26, 19, .38);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  body.md.has-open-drawer .tutorialDrawerScrim { opacity: 1; pointer-events: auto; }
  body.md.has-open-drawer { overflow: hidden; }
  body.md .tutorialDrawerHead {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -16px 14px;
    padding: 13px 16px 11px;
    background: #fff;
    border-bottom: 1px solid #eaf2ec;
  }
  body.md .tutorialDrawerHead b { color: #2c4436; font-size: 13px; letter-spacing: .05em; }
  body.md .tutorialDrawerClose {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    color: #67766d;
    background: #f2f7f4;
    border: 1px solid #e0eae3;
    border-radius: 8px;
    cursor: pointer;
  }
  body.md .tutorialDrawerClose svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2.2;
    stroke-linecap: round;
  }
  body.md .tutorialDrawerClose:hover { color: #1c6b3c; background: #e9f6ee; border-color: #c4e2cf; }
  body.md .tutorialJourney { padding: 11px 13px; }
  body.md .tutorialOutline { margin-top: 14px; }
  body.md .tutorialOutlineLabel { display: none; }
  body.md .tutorialShortcut { margin: 18px 4px 0; }
}

@media (max-width: 560px) {
  body.md { font-size: 15px; }
  body.md .tutorialAppBar { height: 50px; padding-inline: 12px; }
  body.md .tutorialAppName { display: none; }
  /* 手机顶栏：品牌名让位给课程标题，随时知道自己在哪篇教程里 */
  body.md .tutorialAppIdentity {
    justify-self: stretch;
    min-width: 0;
    gap: 8px;
    letter-spacing: 0;
  }
  body.md .tutorialAppCourse {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #24313b;
    font-size: 14.5px;
    font-weight: 700;
  }
  body.md .tutorialShell { min-height: calc(100vh - 50px); }
  /* 手机上不再有「左侧菜单」：介绍块整个收掉（标题已进顶栏，目录在抽屉里），
     侧栏只剩「项目教程 / 组件帮助」切换条；没有切换条的教程连白条一起隐藏，
     正文紧跟顶栏。 */
  body.md .tutorialSidebarIntro { display: none; }
  body.md .tutorialSidebar:not(:has(.tabs)) { display: none; }
  body.md .tutorialSidebar { padding: 10px 12px 9px; }
  body.md .tabs { margin: 0; }
  body.md #youthMobilePowerTab,
  body.md #howToTab { min-height: 36px; }
  body.md .tutorialTabIcon { width: 20px; height: 20px; }
  body.md .tutorialTabLearn { padding: 4.5px; }
  body.md .tabs button b { font-size: 12px; }
  body.md .tutorialWorkspace { padding: 14px 10px 0; }
  body.md .tutorialWorkspaceTop h2 { font-size: 16.5px; }
  body.md .tutorialResume { padding: 8px; font-size: 11.5px; text-align: center; }
  body.md .tutorialOutlineToggle { min-height: 31px; padding: 5px 10px; font-size: 11.5px; }
  body.md .ui-accordion .ui-accordion-header { padding: 12px 38px 12px 52px; border-radius: 11px; font-size: 14px; }
  body.md .ui-accordion .ui-accordion-header::after { left: 10px; min-width: 27px; padding: 2px 0; font-size: 10.5px; }
  body.md .ui-accordion .ui-accordion-header.ui-state-active { border-radius: 12px 12px 0 0; }
  body.md .ui-accordion .ui-accordion-content { padding: 16px 11px 22px; border-radius: 0 0 12px 12px; }
  body.md .tutorialNavigationHeader a { min-height: 30px; padding: 5px 8px; font-size: 11px; }
  body.md .tutorialNavigationHeader { gap: 6px; }
  body.md .countDiv { white-space: nowrap; }
  body.md .tutorialSubflow { margin: 16px 0 6px; padding: 2px 0 4px 13px; }
  body.md .tutorialSubflow > .tutorialNavigationHeader { gap: 4px; }
  body.md .tutorialSubflow > .tutorialNavigationHeader a { padding: 6px 10px; font-size: 11.5px; }
  body.md .ai2-block-preview { margin: 16px 0 19px; border-radius: 12px; }
  body.md .ai2-block-preview-tabbar { min-height: 36px; padding: 5px 7px; }
  body.md .ai2-block-preview-tab { padding: 5px 7px; font-size: 11px; }
  body.md .ai2-block-preview-tabspacer { display: none; }
  body.md .ai2-block-preview-tools { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  body.md *, body.md *::before, body.md *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
