:root {
  --paper: #f6f5f2;
  --surface: #ffffff;
  --ink: #121317;
  --ink-2: #3a3d46;
  --muted: #74777f;
  --hair: rgba(18, 19, 23, 0.08);
  --hair-2: rgba(18, 19, 23, 0.14);
  --accent: #3d5afe;
  --accent-soft: rgba(61, 90, 254, 0.08);
  --warm: #9a5b00;
  --warm-soft: #fbf3e4;
  --brand: linear-gradient(135deg, #feda75 0%, #fa7e1e 28%, #d62976 55%, #962fbf 78%, #4f5bd5 100%);
  --shadow: 0 1px 2px rgba(18, 19, 23, 0.04), 0 12px 40px -12px rgba(28, 35, 64, 0.16);
  --sans: "Inter", "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: "JetBrains Mono", Consolas, Menlo, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans);
  font-size: 17px; line-height: 1.8; letter-spacing: 0.01em; -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
::selection { background: rgba(61, 90, 254, 0.18); }

/* header */
.bar {
  position: sticky; top: 0; z-index: 10; background: rgba(246, 245, 242, 0.82);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--hair);
}
.bar-in { max-width: 1160px; margin: 0 auto; padding: 0 24px; height: 64px; display: flex; align-items: center; gap: 16px; }
.mark { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.mark i { width: 26px; height: 26px; border-radius: 8px; background: var(--brand); box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }
.mark b { font-weight: 600; font-size: 15px; letter-spacing: 0.02em; }
.mark span { color: var(--muted); font-size: 15px; }
.bar nav { margin-left: auto; display: flex; gap: 22px; font-size: 14px; }
.bar nav a { color: var(--muted); text-decoration: none; }
.bar nav a:hover { color: var(--ink); }

/* type */
.eyebrow { font-size: 12.5px; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
h1 { font-size: clamp(34px, 5vw, 54px); line-height: 1.18; letter-spacing: -0.02em; font-weight: 700; margin: 14px 0 16px; }
h2 { font-size: 28px; line-height: 1.3; letter-spacing: -0.01em; font-weight: 700; margin: 0; }
h3 { font-size: 19px; font-weight: 600; margin: 40px 0 6px; }
p { margin: 12px 0; color: var(--ink-2); }
.sub { font-size: 19px; color: var(--muted); max-width: 640px; margin: 0; }
code { font-family: var(--mono); font-size: 0.86em; background: rgba(18, 19, 23, 0.05); padding: 2px 7px; border-radius: 6px; color: var(--ink); }
strong { color: var(--ink); font-weight: 600; }

/* home */
.home-hero { max-width: 1160px; margin: 0 auto; padding: 96px 24px 56px; }
.home-hero h1 { max-width: 760px; }
.library { max-width: 1160px; margin: 0 auto; padding: 0 24px 120px; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: 28px; }
.entry {
  display: grid; grid-template-columns: 168px 1fr; gap: 28px; align-items: center; background: var(--surface);
  border: 1px solid var(--hair); border-radius: 24px; padding: 18px; text-decoration: none; box-shadow: var(--shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}
.entry:hover { transform: translateY(-3px); box-shadow: 0 1px 2px rgba(18,19,23,.04), 0 22px 50px -16px rgba(28,35,64,.24); }
.entry img { width: 168px; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 14px; }
.entry .eyebrow { font-size: 11.5px; }
.entry h2 { font-size: 22px; margin: 8px 0 6px; }
.entry p { font-size: 15px; color: var(--muted); margin: 0 0 14px; line-height: 1.7; }
.entry .go { font-size: 14px; font-weight: 600; color: var(--accent); }
.entry.soon { box-shadow: none; background: transparent; border-style: dashed; pointer-events: none; }
.entry.soon img { filter: grayscale(1); opacity: .55; }
.entry.soon .go { color: var(--muted); }

/* tutorial hero */
.hero { max-width: 1160px; margin: 0 auto; padding: 72px 24px 40px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.facts span { font-size: 14px; padding: 6px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--hair); color: var(--ink-2); }
.strip { max-width: 1160px; margin: 0 auto; padding: 8px 24px 24px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.strip img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 22px; box-shadow: var(--shadow); border: 1px solid var(--hair); }
.strip img:nth-child(even) { transform: translateY(28px); }

/* tutorial body */
.doc { max-width: 1160px; margin: 0 auto; padding: 72px 24px 120px; display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 72px; }
.toc { position: sticky; top: 100px; align-self: start; font-size: 14.5px; }
.toc a { display: block; padding: 7px 0 7px 16px; color: var(--muted); text-decoration: none; border-left: 1.5px solid var(--hair); }
.toc a:hover { color: var(--ink); border-left-color: var(--ink); }
.toc .eyebrow { display: block; margin-bottom: 12px; }
.content { max-width: 760px; }
section { padding-bottom: 72px; margin-bottom: 72px; border-bottom: 1px solid var(--hair); }
section:last-child { border-bottom: 0; margin-bottom: 0; }
.head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 8px; }
.num { font-size: 15px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.lede { color: var(--muted); margin: 6px 0 24px; }

/* steps */
ol.steps { list-style: none; counter-reset: s; padding: 0; margin: 20px 0; }
ol.steps > li { counter-increment: s; position: relative; padding: 0 0 0 44px; margin: 0 0 16px; color: var(--ink-2); }
ol.steps > li::before {
  content: counter(s); position: absolute; left: 0; top: 3px; width: 26px; height: 26px; border-radius: 50%;
  border: 1px solid var(--hair-2); color: var(--ink); font-size: 13px; font-weight: 600; display: grid; place-items: center; background: var(--surface);
}
.ui { font-weight: 600; color: var(--ink); }

/* figures */
figure { margin: 28px 0 36px; }
figure a { display: block; }
figure img { display: block; width: 100%; border-radius: 20px; border: 1px solid var(--hair); box-shadow: var(--shadow); background: #f0f0f4; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 12px; text-align: center; }

/* prep */
.prep { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin: 24px 0 8px; }
.prep div { background: var(--surface); border: 1px solid var(--hair); border-radius: 18px; padding: 18px 20px; display: flex; flex-direction: column; align-items: flex-start; }
.prep b { display: block; font-weight: 600; font-size: 16px; }
.prep span { font-size: 14.5px; color: var(--muted); line-height: 1.65; margin-top: 4px; flex: 1; }
.prep em {
  display: inline-block; margin-top: 12px; font-style: normal; font-size: 12.5px; font-weight: 600; letter-spacing: .02em;
  padding: 2px 10px; border-radius: 999px; background: rgba(18, 136, 90, 0.08); color: #11785a;
}
.prep em.paid { background: var(--warm-soft); color: var(--warm); }

/* tables */
.keys { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 15px; }
.keys th, .keys td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.keys th { font-size: 12.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.keys td:first-child { white-space: nowrap; }

/* callouts */
.callout { border-radius: 16px; padding: 14px 18px; margin: 22px 0; font-size: 15.5px; line-height: 1.75; }
.callout.info { background: var(--accent-soft); color: var(--ink-2); }
.callout.warn { background: var(--warm-soft); color: var(--warm); }
.callout.warn strong { color: var(--warm); }

/* copyable blocks */
.copy { position: relative; margin: 16px 0; }
.copy pre {
  margin: 0; background: var(--surface); border: 1px solid var(--hair); border-radius: 18px; padding: 22px 24px; padding-right: 96px;
  font-family: var(--mono); font-size: 14px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; word-break: break-word;
  box-shadow: 0 1px 2px rgba(18,19,23,.03);
}
.copy.long pre { max-height: 360px; overflow: auto; }
.copy button {
  position: absolute; top: 14px; right: 14px; border: 1px solid var(--hair-2); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 5px 14px; font: 600 13px var(--sans); cursor: pointer; transition: background .2s;
}
.copy button:hover { background: var(--paper); }
.say { display: grid; gap: 10px; margin: 16px 0; }
.say .copy { margin: 0; }
.say .copy pre { font-family: var(--sans); font-size: 15.5px; padding: 14px 96px 14px 20px; border-radius: 14px; color: var(--ink); }
.say .copy button { top: 9px; }

footer { border-top: 1px solid var(--hair); }
footer div { max-width: 1160px; margin: 0 auto; padding: 28px 24px 48px; font-size: 13.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

@media (max-width: 960px) {
  .doc { grid-template-columns: 1fr; gap: 0; padding-top: 48px; }
  .toc { display: none; }
  .strip { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .strip img:nth-child(even) { transform: none; }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .bar-in { padding: 0 16px; }
  .bar nav { display: none; }
  .home-hero, .hero { padding-left: 16px; padding-right: 16px; }
  .home-hero { padding-top: 56px; }
  .hero { padding-top: 44px; }
  .library, .strip, .doc { padding-left: 16px; padding-right: 16px; }
  .entry { grid-template-columns: 104px 1fr; gap: 16px; }
  .entry img { width: 104px; }
  .prep { gap: 10px; }
  .prep div { padding: 14px 14px; border-radius: 14px; }
  .prep b { font-size: 15px; }
  .prep span { font-size: 13.5px; line-height: 1.6; }
  .sub { font-size: 17px; }
  section { padding-bottom: 52px; margin-bottom: 52px; }
  figure img { border-radius: 14px; }
}
