/* ============================================================
 * 我的世界新手指南 · 样式（Minecraft 像素风）
 * ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --grass: #5a9e3f;
  --grass-dark: #3a7a2a;
  --dirt: #8b5a2b;
  --stone: #7a7a7a;
  --bg: #c9e4b8;
  --panel: #e8f3d8;
  --ink: #2b3a1a;
  --radius: 6px;
  /* 像素风硬边阴影 */
  --px-shadow: 0 4px 0 #2d4d1a;
  --px-shadow-sm: 0 3px 0 rgba(0,0,0,.25);
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg);
  background-image:
    linear-gradient(rgba(255,255,255,.08) 50%, transparent 50%),
    linear-gradient(90deg, rgba(255,255,255,.08) 50%, transparent 50%);
  background-size: 32px 32px;
  color: var(--ink);
  line-height: 1.7;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(180deg, var(--grass-dark), var(--grass));
  border-bottom: 4px solid #2d4d1a;
  color: #fff;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar .logo {
  font-size: 22px;
  font-weight: 900;
  text-shadow: 2px 2px 0 #2d4d1a;
  letter-spacing: 1px;
}
.topbar .tagline {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  opacity: .95;
  text-shadow: 1px 1px 0 rgba(0,0,0,.3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar .home-btn {
  background: linear-gradient(180deg, #ffd23f, #ff9d2e);
  color: #5a3000;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 3px 0 #b36a00;
  transition: transform .1s, box-shadow .1s;
}
.topbar .home-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #b36a00; }
.topbar .home-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #b36a00; }

/* ---------- Hero ---------- */
.hero {
  text-align: center;
  padding: 40px 20px 10px;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 46px);
  color: var(--grass-dark);
  text-shadow: 3px 3px 0 #fff;
  letter-spacing: 2px;
}
.hero p { color: #4a5a3a; margin-top: 8px; font-size: 16px; font-weight: 600; }

/* ---------- 容器 ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 24px 20px 60px; }

/* ---------- 首页分类网格 ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 20px;
}
.cat-card {
  background: var(--panel);
  border: 3px solid var(--grass-dark);
  border-radius: var(--radius);
  box-shadow: var(--px-shadow);
  overflow: hidden;
  display: block;
  transition: transform .12s, box-shadow .12s;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: 0 6px 0 #2d4d1a; }
.cat-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  display: block;
  border-bottom: 3px solid var(--grass-dark);
}
.cat-info { padding: 10px 12px 14px; }
.cat-emoji { font-size: 22px; line-height: 1; }
.cat-name { font-size: 16px; font-weight: 900; color: var(--grass-dark); }
.cat-desc { font-size: 12px; color: #5a6a4a; margin-top: 3px; }
.cat-count {
  display: inline-block;
  margin-top: 8px;
  background: var(--grass);
  color: #fff;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 4px;
  font-weight: 700;
}

/* ---------- 参考资料 ---------- */
.ref-section { margin-top: 36px; }
.ref-title { font-size: 20px; font-weight: 900; color: var(--grass-dark); margin-bottom: 14px; }
.ref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.ref-card {
  background: var(--panel);
  border: 3px solid var(--grass-dark);
  border-radius: var(--radius);
  box-shadow: var(--px-shadow);
  overflow: hidden;
  display: block;
  transition: transform .12s, box-shadow .12s;
  text-align: center;
}
.ref-card:hover { transform: translateY(-3px); box-shadow: 0 6px 0 #2d4d1a; }
.ref-card img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  border-bottom: 3px solid var(--grass-dark);
}
.ref-name { padding: 10px; font-weight: 800; font-size: 14px; }

/* ---------- 分类页布局 ---------- */
.layout { display: flex; gap: 24px; align-items: flex-start; }
.sidebar {
  width: 190px;
  flex-shrink: 0;
  position: sticky;
  top: 84px;
}
.side-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
  background: var(--panel);
  border: 2px solid transparent;
  box-shadow: var(--px-shadow-sm);
  transition: transform .1s, background .1s;
}
.side-item:hover { transform: translateX(3px); border-color: var(--grass); }
.side-item.active {
  background: var(--grass);
  color: #fff;
  border-color: var(--grass-dark);
}
.side-item .cnt { margin-left: auto; font-size: 12px; opacity: .85; }
.sidebar.tut-sidebar {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  gap: 10px;
}
.side-col {
  flex: 1;
  min-width: 0;
}
.side-item.tut-link {
  font-size: 13px;
  padding: 9px 12px;
  line-height: 1.4;
}
.side-item.tut-link.active {
  background: var(--dirt);
  border-color: #5a3a1a;
}
.content { flex: 1; min-width: 0; }

/* ---------- 分类页标题 ---------- */
.cat-header { margin: 4px 0 6px; }
.cat-header h2 { font-size: clamp(24px, 4vw, 32px); color: var(--grass-dark); text-shadow: 2px 2px 0 #fff; }
.cat-header p { color: #5a6a4a; margin-top: 4px; font-weight: 600; }

/* ---------- 教程卡片网格 ---------- */
.tut-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.tut-card {
  background: var(--panel);
  border: 3px solid var(--grass-dark);
  border-radius: var(--radius);
  box-shadow: var(--px-shadow-sm);
  padding: 18px;
  display: block;
  transition: transform .12s, box-shadow .12s;
}
.tut-card:hover { transform: translateY(-3px); box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.tut-num {
  display: inline-block;
  background: var(--dirt);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 4px;
}
.tut-title { font-size: 17px; font-weight: 800; margin-top: 10px; color: var(--ink); }

/* ---------- 教程详情 ---------- */
.tut-detail {
  background: var(--panel);
  border: 3px solid var(--grass-dark);
  border-radius: var(--radius);
  box-shadow: var(--px-shadow);
  padding: 28px;
  margin-top: 8px;
}
.tut-detail h2 { font-size: 26px; color: var(--grass-dark); margin-bottom: 6px; }
.tut-detail .tut-hero {
  display: block;
  max-width: 480px;
  width: 100%;
  margin: 18px auto;
  border-radius: var(--radius);
  border: 3px solid var(--grass-dark);
}
.tut-detail .crumbs {
  font-size: 14px;
  color: #6a7a5a;
  margin-bottom: 18px;
  font-weight: 600;
}
.tut-detail .crumbs a {
  color: var(--grass-dark);
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 4px;
  background: #e8f3d8;
  transition: background .1s;
}
.tut-detail .crumbs a:hover {
  background: #d4e8b8;
  text-decoration: underline;
}
.tut-detail .steps { list-style: none; counter-reset: step; }
.tut-detail .steps li {
  counter-increment: step;
  position: relative;
  padding: 12px 14px 12px 52px;
  margin-bottom: 10px;
  background: #fff;
  border: 2px solid #bcd89a;
  border-radius: var(--radius);
  font-size: 15px;
}
.tut-detail .steps li::before {
  content: counter(step);
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  background: var(--grass);
  color: #fff;
  border: 2px solid var(--grass-dark);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
}
.detail-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
  gap: 12px;
}
.detail-nav a {
  background: linear-gradient(180deg, var(--grass), var(--grass-dark));
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 700;
  box-shadow: 0 3px 0 #2d4d1a;
  transition: transform .1s;
}
.detail-nav a:hover { transform: translateY(-2px); }
.detail-nav a.disabled { opacity: .4; pointer-events: none; }

.empty { color: #6a7a5a; padding: 40px 0; text-align: center; font-weight: 600; }
.empty a { color: var(--grass-dark); text-decoration: underline; }

footer {
  text-align: center;
  color: #4a5a3a;
  font-size: 13px;
  padding: 24px 0 30px;
  font-weight: 600;
}

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    position: static;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }
  .sidebar.tut-sidebar {
    width: 100%;
    flex-direction: column;
  }
  .side-item { white-space: nowrap; margin-bottom: 0; flex-shrink: 0; }
}
@media (max-width: 480px) {
  .cat-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .container { padding: 16px 14px 40px; }
  .tut-detail { padding: 18px; }
}
