/* ═══════════════════════════════════════
   給家長的麥塊入門指南
   ═══════════════════════════════════════ */

:root {
  --bg:        #fbfaf7;
  --surface:   #ffffff;
  --text:      #23201c;
  --muted:     #6b645b;
  --line:      #e5e0d8;
  --accent:    #4a7c3f;   /* 草地綠 */
  --accent-dk: #386030;
  --earth:     #8a6240;   /* 泥土棕 */
  --warn-bg:   #fdf6e3;
  --warn-line: #d9a441;
  --danger-bg: #fdf0ee;
  --danger-line: #c4523d;
  --radius: 10px;
  --wrap: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #16181a;
    --surface:   #1e2124;
    --text:      #e6e3de;
    --muted:     #9b958c;
    --line:      #32363a;
    --accent:    #7cb46b;
    --accent-dk: #9ccf8b;
    --earth:     #b98a63;
    --warn-bg:   #2a2418;
    --warn-line: #b08832;
    --danger-bg: #2b1d1a;
    --danger-line: #b85744;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans TC", "Microsoft JhengHei", "PingFang TC",
               -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Hero ─────────────────────────────── */

/* 圖示雪碧圖本體不顯示，只供 <use> 引用 */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.hero {
  position: relative;
  overflow: hidden;
  background-color: #2f4a2b;
  background-image:
    linear-gradient(180deg, rgba(16,26,14,.58), rgba(16,26,14,.78)),
    url("img/hero-taiga.jpg");
  background-size: cover;
  background-position: center 60%;
  color: #fff;
  padding: 5.5rem 0 5rem;
  text-align: center;
  text-shadow: 0 1px 12px rgba(0,0,0,.45);
}

.hero .wrap { position: relative; z-index: 1; }

/* ── 遊戲畫面 ─────────────────────────── */

.shot { margin: 1.75rem 0; }

.shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.shot figcaption {
  margin-top: .55rem;
  color: var(--muted);
  font-size: .87rem;
  line-height: 1.7;
  text-align: center;
}

/* 怪物並排 */
.mobs {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  align-items: end;
}

.mobs .shot { margin: 1.25rem 0; }

.mobs img[src$="enderman.png"] {
  object-fit: contain;
  background: linear-gradient(180deg, #2a2438, #171426);
  padding: .5rem 0;
}

.hero .kicker {
  margin: 0 0 .5rem;
  font-size: .8rem;
  letter-spacing: .35em;
  text-indent: .35em;
  opacity: .8;
}

.hero h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.1rem, 6vw, 3.1rem);
  line-height: 1.25;
  letter-spacing: .04em;
}

.hero .lede {
  margin: 0 auto;
  max-width: 34rem;
  font-size: 1.02rem;
  line-height: 1.9;
  opacity: .93;
}

/* ── 目錄列 ───────────────────────────── */

.toc {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.toc .wrap {
  display: flex;
  gap: .35rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-top: .5rem;
  padding-bottom: .5rem;
}
.toc .wrap::-webkit-scrollbar { display: none; }

.toc a {
  flex: none;
  padding: .35rem .7rem;
  border-radius: 99px;
  color: var(--muted);
  font-size: .88rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.toc a:hover {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent-dk);
}

/* ── 區塊 ─────────────────────────────── */

main { padding-bottom: 2rem; }

section {
  padding: 3.5rem 0 1rem;
  border-bottom: 1px solid var(--line);
}
section:last-child { border-bottom: 0; }

h2 {
  margin: 0 0 1.5rem;
  font-size: 1.6rem;
  line-height: 1.4;
  letter-spacing: .02em;
  position: relative;
  padding-left: .9rem;
}

h2::before {
  content: "";
  position: absolute;
  left: 0; top: .38em;
  width: 4px; height: 1.05em;
  border-radius: 2px;
  background: var(--accent);
}

h3 { font-size: 1.12rem; line-height: 1.6; margin: 0 0 .6rem; }

h3.sub {
  margin: 2.5rem 0 .9rem;
  padding-bottom: .4rem;
  border-bottom: 1px dashed var(--line);
  color: var(--accent-dk);
}

p { margin: 0 0 1rem; }

strong { font-weight: 700; }

kbd {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .82em;
  padding: .1em .45em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
}

.note {
  color: var(--muted);
  font-size: .93rem;
}

.highlight {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 3px solid var(--accent);
  padding: .85rem 1.1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.25rem;
}
.highlight p:last-child { margin-bottom: 0; }

/* ── 卡片 ─────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem .9rem;
}

.card h3 { color: var(--accent-dk); }
.card p:last-child { margin-bottom: .5rem; }

/* ── 清單 ─────────────────────────────── */

.reasons, .qa, .links { list-style: none; padding: 0; margin: 0 0 1rem; }

.reasons li {
  position: relative;
  padding-left: 1.4rem;
  margin-bottom: .7rem;
}
.reasons li::before {
  content: "";
  position: absolute;
  left: .15rem; top: .78em;
  width: 7px; height: 7px;
  border-radius: 2px;
  background: var(--accent);
}

.qa li {
  padding: .7rem 0;
  border-bottom: 1px dashed var(--line);
}
.qa li:last-child { border-bottom: 0; }
.qa span { color: var(--muted); font-size: .9rem; }

/* ── 編號步驟 ─────────────────────────── */

.steps {
  list-style: none;
  counter-reset: s;
  padding: 0;
  margin: 0 0 1.25rem;
}

.steps > li {
  counter-increment: s;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 1.6rem;
}

.steps > li::before {
  content: counter(s);
  position: absolute;
  left: 0; top: .1em;
  width: 2rem; height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .92rem;
  font-weight: 700;
}

.steps > li p:last-child { margin-bottom: 0; }

.steps.compact > li { margin-bottom: .8rem; padding-left: 2.6rem; }
.steps.compact > li::before {
  width: 1.7rem; height: 1.7rem;
  font-size: .82rem;
  top: .18em;
}

/* ── 像素圖示 ─────────────────────────── */

.steps.iconed > li { padding-right: 3.4rem; }

.ico {
  position: absolute;
  right: .3rem;
  top: .05em;
  width: 2.15rem;
  height: 2.15rem;
  image-rendering: pixelated;
}

.ico-sm {
  width: 1.15rem;
  height: 1.15rem;
  vertical-align: -.22em;
  margin-right: .45rem;
  image-rendering: pixelated;
}

/* ── 提示框 ───────────────────────────── */

.warn, .danger {
  border-radius: var(--radius);
  padding: 1.2rem 1.35rem .5rem;
  margin: 1.75rem 0;
}

.warn {
  background: var(--warn-bg);
  border-left: 4px solid var(--warn-line);
}

.danger {
  background: var(--danger-bg);
  border-left: 4px solid var(--danger-line);
}

.warn h3 { color: var(--warn-line); }
.danger h3 { color: var(--danger-line); }
.warn h3::before  { content: "⚠️ "; }
.danger h3::before { content: "🚨 "; }

/* ── 表格 ─────────────────────────────── */

.tablewrap {
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .95rem;
  background: var(--surface);
}

th, td {
  padding: .75rem .9rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

thead th {
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent-dk);
  white-space: nowrap;
}

tbody th {
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  width: 1%;
}

tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

td.yes { color: var(--accent-dk); font-weight: 600; }

/* ── 進程 ─────────────────────────────── */

.progression {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent-dk);
}

/* ── 資源連結 ─────────────────────────── */

.links li {
  padding: .9rem 0;
  border-bottom: 1px solid var(--line);
}
.links li:last-child { border-bottom: 0; }

.links a, .links .plain {
  display: inline-block;
  font-weight: 700;
  margin-bottom: .25rem;
}

.links a { color: var(--accent-dk); }
.links a:hover { text-decoration: underline; }

.links p { margin: 0; color: var(--muted); font-size: .94rem; }

/* ── 結語 ─────────────────────────────── */

.final {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2.2rem 1.75rem 1.5rem;
  text-align: center;
}

.final h2 { padding-left: 0; margin-bottom: 1.25rem; }
.final h2::before { display: none; }

.final .big {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--accent-dk);
  line-height: 1.7;
}

/* ── 頁尾 ─────────────────────────────── */

footer {
  border-top: 1px solid var(--line);
  padding: 2.25rem 0;
  color: var(--muted);
  font-size: .88rem;
  text-align: center;
}

footer p { margin: 0 0 .4rem; }
footer a { color: var(--accent-dk); }
footer .credits { font-size: .82rem; opacity: .9; }
footer .small { font-size: .8rem; opacity: .75; }

/* ── 手機 ─────────────────────────────── */

@media (max-width: 30rem) {
  body { font-size: 16px; }
  .hero { padding: 3.5rem 0 3.25rem; }
  .mobs { grid-template-columns: 1fr; }
  .mobs img[src$="enderman.png"] { max-height: 16rem; }
  .ico { width: 1.7rem; height: 1.7rem; }
  .steps.iconed > li { padding-right: 2.6rem; }
  section { padding-top: 2.75rem; }
  .card { padding: 1.15rem 1.15rem .75rem; }
  .final { padding: 1.75rem 1.15rem 1rem; }
}
