/* 组件速查：列表和详情共用。以中性底色承载内容，只用清亮绿色提示操作。 */

body.howtoIndex,
body.howtoDetail {
  min-height: 100vh;
  color: #202722;
  background: #f7f9f7;
}

/* 列表 */
.howtoIndex .howtoIndexHead { background: #fff; }
.howtoIndex .idxTools { background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); }
.howtoIndex .idxToolsInner { align-items: flex-start; }
.howtoSearchWrap {
  position: relative;
  display: flex;
  flex: 1 1 260px;
  min-width: 0;
}
.howtoSearchWrap svg {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: #718079;
  stroke-width: 1.8;
  transform: translateY(-50%);
  pointer-events: none;
}
.howtoSearchWrap .idxSearch { width: 100%; padding-left: 38px; background: #f4f7f5; }
.howtoIndexBody { padding-top: 20px; padding-bottom: 64px; }
.howtoIndexNote {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 16px;
  color: #526057;
  background: #eff8f2;
  border: 1px solid #d5eadc;
  border-radius: 12px;
  font-size: 13px;
}
.howtoIndexNote > span { font-size: 18px; line-height: 1.4; }
.howtoIndexNote p { margin: 0; line-height: 1.7; }
.howtoIndexNote b { color: #245c38; }
.howtoIndex .idxGroup { margin-top: 32px; }
.howtoIndex .idxGroupHead { align-items: center; }
.howtoIndex .idxGroupHead h2 { font-size: 18px; }
.howtoIndex .idxCount {
  padding: 2px 8px;
  color: #66746c;
  background: #e9eeeb;
  border-radius: 999px;
}
.howtoGrid { grid-template-columns: repeat(auto-fill, minmax(225px, 1fr)); }
.howtoCard { background: #fff; }
.howtoThumb {
  position: relative;
  height: 138px;
  aspect-ratio: auto;
  padding: 16px;
  /* 与教程首页卡片同一条浅边框，两个入口看起来是一套 */
  box-shadow: inset 0 0 0 1px rgba(28, 48, 34, .08);
  background: linear-gradient(145deg, #f2f7f3, #fbfcfb);
}
.howtoThumb img {
  object-fit: contain;
  /* 图标自身也描一圈，浅色截图落在浅底上时才有边界 */
  border: 1px solid rgba(28, 48, 34, .10);
  border-radius: 6px;
  background: #fff;
  filter: drop-shadow(0 5px 8px rgba(28, 48, 34, .08));
}
.howtoCategory {
  position: absolute;
  left: 10px;
  bottom: 9px;
  padding: 3px 8px;
  color: #27623d;
  background: rgba(241, 252, 245, .94);
  border: 1px solid #cee7d6;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.howtoCard .idxCardBody { padding-top: 14px; }
.howtoCard .idxCardTitle b { font-size: 16px; }
.howtoArrow { color: #2e7d48; font-size: 18px; transition: transform .15s ease; }
.howtoCard:hover .howtoArrow { transform: translateX(3px); }
.howtoCard .idxCardDesc { min-height: 42px; -webkit-line-clamp: 2; }
.howtoIndex .idxEmpty {
  flex-direction: column;
  gap: 6px;
  margin-top: 30px;
  padding: 54px 20px;
  background: #fff;
  border: 1px dashed #cdd7d0;
  border-radius: 14px;
}
.howtoIndex .idxEmpty.on { display: flex; }
.howtoIndex .idxEmpty b { color: #34423a; font-size: 17px; }
.howtoIndex .idxEmpty span { font-size: 13px; }

/* 详情 */
.howtoTopbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, .94);
  border-bottom: 1px solid #e0e6e2;
  backdrop-filter: blur(12px);
}
.howtoTopbarInner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(920px, calc(100% - 32px));
  min-height: 56px;
  margin: 0 auto;
}
.howtoBack,
.howtoTutorialHome {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: #526057;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}
.howtoBack:hover,
.howtoTutorialHome:hover { color: #176a35; text-decoration: none; }
.howtoBack > span:first-child {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  background: #edf6f0;
  border-radius: 8px;
  font-size: 16px;
}
.howtoArticleShell {
  width: min(920px, calc(100% - 32px));
  margin: 34px auto 72px;
}
.howtoArticle {
  overflow: hidden;
  background: #fff;
  border: 1px solid #dce4df;
  border-radius: 18px;
  box-shadow: 0 14px 38px rgba(37, 60, 44, .065);
}
.howtoArticleHead {
  padding: clamp(28px, 5vw, 48px) clamp(22px, 7vw, 68px) 30px;
  background: linear-gradient(145deg, #f1faf4 0%, #fff 64%);
  border-bottom: 1px solid #e1ebe4;
}
.howtoArticleCategory {
  display: inline-block;
  margin-bottom: 13px;
  padding: 4px 10px;
  color: #23623a;
  background: #def4e6;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
}
.howtoArticleHead h1 {
  margin: 0 0 10px;
  color: #1e2922;
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.15;
  letter-spacing: -.04em;
}
.howtoArticleHead > p {
  max-width: 650px;
  margin: 0;
  color: #647169;
  font-size: 15px;
  line-height: 1.75;
}
.howtoArticleTags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.howtoArticleTags span {
  padding: 3px 9px;
  color: #69766e;
  background: rgba(255, 255, 255, .85);
  border: 1px solid #dde6e0;
  border-radius: 999px;
  font-size: 11px;
}
.howtoArticleContent {
  max-width: 760px;
  margin: 0 auto;
  padding: 38px clamp(22px, 7vw, 58px) 54px;
  color: #344139;
  font-size: 16px;
  line-height: 1.85;
}
.howtoArticleContent h2 {
  position: relative;
  margin: 44px 0 14px;
  padding: 0 0 9px 17px;
  color: #203128;
  border-bottom: 1px solid #e3e9e5;
  font-size: 21px;
  line-height: 1.35;
}
.howtoArticleContent h2:first-child { margin-top: 0; }
.howtoArticleContent h2::before {
  content: "";
  position: absolute;
  top: .2em;
  bottom: .55em;
  left: 0;
  width: 5px;
  background: #42a464;
  border-radius: 999px;
}
.howtoArticleContent p { margin: 0 0 17px; }
.howtoArticleContent code {
  padding: 2px 6px;
  color: #155d31;
  background: #edf7f0;
  border: 1px solid #d6ebdc;
  border-radius: 5px;
  font-family: inherit;
  font-size: .92em;
  font-weight: 650;
}
.howtoArticleContent img {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  margin: 14px auto 30px;
  padding: 8px;
  background: #fbfcfb;
  border: 1px solid #dde5e0;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(34, 53, 40, .055);
}
.howtoArticleContent img.is-zoomable { cursor: zoom-in; }
.howtoArticleContent img.is-zoomable:focus-visible { outline: 3px solid rgba(45, 151, 78, .28); outline-offset: 3px; }
.howtoArticleContent a { color: #0969da; }
.howtoArticleContent a:has(img) { display: block; text-decoration: none; }
.howtoArticleContent a:has(img)::after {
  content: "打开视频演示 ↗";
  display: block;
  width: max-content;
  margin: -22px auto 30px;
  color: #176a35;
  font-size: 12px;
  font-weight: 700;
}
.howtoArticleFoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px clamp(22px, 7vw, 58px);
  background: #f5f8f6;
  border-top: 1px solid #e0e7e2;
}
.howtoArticleFoot b { color: #25352b; font-size: 15px; }
.howtoArticleFoot p { margin: 4px 0 0; color: #748078; font-size: 12px; }
.howtoArticleActions { display: flex; flex: none; gap: 8px; }
.howtoArticleActions a {
  padding: 8px 12px;
  color: #3f5146;
  background: #fff;
  border: 1px solid #d4ded7;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.howtoArticleActions a:hover { border-color: #9bc7a9; text-decoration: none; }
.howtoArticleActions a.is-primary { color: #fff; background: #287b45; border-color: #287b45; }
.howtoRelated { margin-top: 34px; }
.howtoRelated h2 { margin: 0 0 12px; color: #3a493f; font-size: 16px; }
.howtoRelated > div { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.howtoRelated a {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 14px 16px;
  color: #35433a;
  background: #fff;
  border: 1px solid #dce4df;
  border-radius: 11px;
  text-decoration: none;
}
.howtoRelated a:hover { border-color: #acd0b7; box-shadow: 0 5px 16px rgba(38, 64, 46, .055); text-decoration: none; }
.howtoRelated b { font-size: 14px; }
.howtoRelated span { color: #78837c; font-size: 11px; line-height: 1.55; }

/* 独立浏览时的图片查看器；嵌在开发环境中时由父页面接管。 */
.howtoLightbox[hidden] { display: none; }
.howtoLightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 50px 24px 28px;
  background: rgba(14, 20, 16, .88);
}
.howtoLightbox img {
  max-width: min(1100px, 94vw);
  max-height: 82vh;
  margin: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .4);
}
.howtoLightbox p { margin: 12px 0 0; color: #eef4f0; font-size: 13px; text-align: center; }
.howtoLightboxClose {
  position: fixed;
  top: 14px;
  right: 18px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #fff;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  font: 300 28px/1 inherit;
  cursor: pointer;
}
body.has-howto-lightbox { overflow: hidden; }

@media (max-width: 700px) {
  .howtoIndex .idxToolsInner { display: block; }
  .howtoIndex .idxFilters { margin-top: 9px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .howtoIndex .idxChip { flex: none; }
  .howtoGrid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .howtoThumb { height: 112px; padding: 13px; }
  .howtoCard .idxCardBody { padding: 11px 12px 13px; }
  .howtoCard .idxCardTitle b { font-size: 14px; }
  .howtoCard .idxCardDesc { min-height: 40px; font-size: 12px; }
  .howtoCard .idxTags { display: none; }
  .howtoArticleShell { width: min(100% - 20px, 920px); margin-top: 12px; }
  .howtoArticle { border-radius: 14px; }
  .howtoArticleHead { padding: 25px 20px 22px; }
  .howtoArticleContent { padding: 28px 18px 38px; font-size: 15px; }
  .howtoArticleContent h2 { margin-top: 34px; font-size: 19px; }
  .howtoArticleContent img { padding: 5px; margin-bottom: 24px; }
  .howtoArticleFoot { align-items: flex-start; flex-direction: column; padding: 20px; }
  .howtoArticleActions { width: 100%; }
  .howtoArticleActions a { flex: 1; text-align: center; }
}

/* App Inventor 300px 侧边栏：列表卡片改横版行卡，缩略图缩成小方块；
   类别角标省掉（分组标题已经说明类别）。 */
@media (max-width: 420px) {
  .howtoIndexBody { padding-top: 12px; padding-bottom: 40px; }
  .howtoIndexNote { padding: 10px 12px; font-size: 12px; }
  .howtoIndexNote > span { font-size: 15px; }
  .howtoIndex .idxGroup { margin-top: 18px; }
  .howtoIndex .idxGroupHead h2 { font-size: 15px; }
  .howtoGrid { display: flex; flex-direction: column; gap: 8px; }
  .howtoCard {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
  }
  .howtoCard:hover { transform: none; }
  .howtoThumb {
    width: 84px;
    height: 62px;
    padding: 7px;
    border-bottom: 0;
    border-right: 1px solid #e3eae5;
  }
  .howtoCategory { display: none; }
  .howtoCard .idxCardBody { padding: 8px 10px 9px; }
  .howtoCard .idxCardTitle b { font-size: 14px; }
  .howtoCard .idxCardDesc { min-height: 0; font-size: 12px; -webkit-line-clamp: 2; }
  .howtoCard .idxTags { display: none; }

  .howtoArticleShell { width: calc(100% - 20px); margin-top: 10px; }
  .howtoArticle { border-radius: 12px; }
  .howtoArticleHead { padding: 18px 15px 15px; }
  .howtoArticleHead h1 { font-size: 23px; }
  .howtoArticleHead > p { font-size: 13.5px; }
  .howtoArticleTags { margin-top: 12px; }
  .howtoArticleContent { padding: 22px 14px 30px; font-size: 14.5px; }
  .howtoArticleContent h2 { margin-top: 30px; font-size: 18px; }
  .howtoArticleFoot { padding: 16px 15px; }
  .howtoRelated { margin-top: 22px; }
  .howtoRelated > div { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .howtoCard,
  .howtoArrow { transition: none; }
}
