/* Etymology Tutorial — roots, branches, classical wood ink layout */
:root {
  --ink: #1a1f1b;
  --ink-soft: #3f4a40;
  --muted: #7c857c;
  --paper: #f7f3e8;
  --paper-2: #efe9d6;
  --surface: #fffdf6;
  --line: #e3dcc4;
  --line-strong: #cdc4a3;
  --bark: #6b4a23;
  --bark-dark: #4b3315;
  --leaf: #527764;
  --leaf-dark: #284d3a;
  --brass: #b7791f;
  --brass-dark: #8a5a14;
  --copper: #c0743a;
  --terra: #a64b2a;
  --rust: #8c4321;
  --code-bg: #221a10;
  --code-text: #f5ebd2;
  --mono: 'SF Mono', 'Fira Code', Consolas, monospace;
  --display: 'Songti SC', 'STSong', 'Noto Serif CJK SC', 'Iowan Old Style', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Noto Sans CJK SC', sans-serif;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(ellipse at 12% 0%, rgba(107,74,35,.08), transparent 55%),
    radial-gradient(ellipse at 88% 100%, rgba(40,77,58,.08), transparent 55%),
    linear-gradient(90deg, rgba(107,74,35,.05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(40,77,58,.045) 1px, transparent 1px),
    var(--paper);
  background-size: auto, auto, 30px 30px, 30px 30px, auto;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  min-height: 54px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(247,243,232,.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.nav-back { color: var(--leaf-dark); text-decoration: none; font-size: .88rem; font-weight: 700; }
.nav-back::before { content: '‹'; margin-right: 4px; font-size: 1.2rem; }
.nav-title { flex: 1; min-width: 0; color: var(--ink-soft); font-size: .92rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { color: #fff; background: var(--leaf-dark); border-radius: 999px; padding: 3px 10px; font-size: .68rem; font-weight: 800; letter-spacing: .06em; }
.hero {
  color: #fdf8e9;
  background:
    linear-gradient(135deg, rgba(20,32,24,.95), rgba(40,77,58,.92) 55%, rgba(75,51,21,.9)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.04) 0 1px, transparent 1px 60px);
  padding: 74px 24px 58px;
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: '';
  position: absolute; right: -60px; top: -40px; width: 360px; height: 360px;
  background: radial-gradient(circle at center, rgba(183,121,31,.18), transparent 60%);
  pointer-events: none;
}
.hero-grid { max-width: 1060px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(280px, .92fr); gap: 34px; align-items: center; position: relative; }
.hero-eyebrow, .section-label, .ch-num, .nav-dir { font-family: var(--mono); text-transform: uppercase; letter-spacing: .16em; }
.hero-eyebrow { color: #e3c98a; font-size: .72rem; margin-bottom: 12px; }
.hero h1 { font-family: var(--display); font-size: clamp(2.35rem, 6vw, 4.5rem); line-height: 1.04; margin: 0 0 18px; font-weight: 800; letter-spacing: 0; color: #fdf8e9; }
.hero-sub { max-width: 620px; margin: 0 0 24px; color: rgba(253,248,233,.78); font-size: 1rem; line-height: 1.85; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid rgba(227,201,138,.32); background: rgba(255,255,255,.07); border-radius: 999px; padding: 5px 12px; font-size: .76rem; color: rgba(253,248,233,.86); }
.root-board { border: 1px solid rgba(227,201,138,.28); background: rgba(0,0,0,.18); border-radius: var(--radius); padding: 24px; box-shadow: 0 22px 70px rgba(0,0,0,.32); }
.board-tree { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 14px; }
.tree-row { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 10px; align-items: center; }
.tree-cell { display: grid; place-items: center; min-height: 48px; border-radius: 6px; font-family: var(--mono); font-weight: 800; font-size: .76rem; padding: 6px 8px; text-align: center; }
.cell-prefix { background: #d6c187; color: #3b2c0a; }
.cell-root { background: #b7791f; color: #1a1208; }
.cell-suffix { background: #c8d7ef; color: #14223a; }
.tree-arrow { color: rgba(253,248,233,.55); font-weight: 900; }
.board-decode { background: rgba(0,0,0,.32); border: 1px solid rgba(227,201,138,.18); border-radius: 6px; padding: 14px; color: rgba(253,248,233,.9); font-size: .92rem; font-family: var(--mono); }
.board-decode b { color: #f0c97a; }
.board-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.board-tags span { font-size: .72rem; color: rgba(253,248,233,.74); border-bottom: 1px solid rgba(227,201,138,.36); padding-bottom: 2px; }
.container, .content { width: 100%; max-width: 900px; margin: 0 auto; padding: 38px 24px 84px; }
.content { max-width: 820px; }
.content > * { max-width: 100%; }
.section-label { color: var(--bark); font-size: .68rem; font-weight: 900; margin: 32px 0 10px 2px; }
.card, .feature, .chapter-nav a { background: rgba(255,253,246,.92); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 12px 28px rgba(40,32,12,.06); }
.card { padding: 22px; margin-bottom: 16px; }
.intro-card p:last-child, .prose p:last-child { margin-bottom: 0; }
p { color: var(--ink-soft); margin: 0 0 15px; font-size: .95rem; }
.content p, .content li, .chapter-hero p { overflow-wrap: anywhere; word-break: break-all; }
.prose h2 { margin: 0 0 12px; font-size: 1.18rem; color: var(--leaf-dark); }
.prose ol { margin-bottom: 0; }
strong { color: var(--ink); }
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.feature { padding: 18px; }
.feature span { font-family: var(--mono); color: var(--brass); font-weight: 900; font-size: .72rem; }
.feature h3 { margin: 7px 0 6px; font-size: 1rem; color: var(--leaf-dark); }
.feature p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.65; }
.list-card { padding: 0; overflow: hidden; }
.card-list { list-style: none; margin: 0; padding: 0; }
.card-list li { border-bottom: 1px solid var(--line); }
.card-list li:last-child { border-bottom: 0; }
.card-list a { display: flex; gap: 14px; align-items: flex-start; padding: 15px 16px; color: inherit; text-decoration: none; transition: background .16s, transform .16s; }
.card-list a:hover { background: var(--paper-2); }
.list-num { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: linear-gradient(135deg, var(--leaf-dark), var(--bark)); color: #fdf8e9; font-family: var(--mono); font-size: .72rem; font-weight: 900; }
.list-content { flex: 1; min-width: 0; }
.list-title { color: var(--ink); font-weight: 800; font-size: .96rem; margin-bottom: 2px; }
.list-desc { color: var(--muted); font-size: .8rem; line-height: 1.55; }
.list-chevron { color: var(--line-strong); font-size: 1.2rem; align-self: center; }
.chapter-hero {
  background:
    linear-gradient(135deg, rgba(20,32,24,.94), rgba(40,77,58,.92) 55%, rgba(107,74,35,.92));
  color: #fdf8e9;
  text-align: center;
  padding: 54px 24px 46px;
  overflow: hidden;
  position: relative;
}
.chapter-hero::after {
  content: '';
  position: absolute; left: 50%; bottom: -120px; width: 480px; height: 240px; transform: translateX(-50%);
  background: radial-gradient(ellipse at center top, rgba(183,121,31,.22), transparent 70%);
  pointer-events: none;
}
.chapter-hero .ch-num { color: rgba(227,201,138,.78); font-size: .68rem; margin-bottom: 10px; position: relative; }
.chapter-hero h1 { font-family: var(--display); font-size: clamp(1.9rem, 5vw, 3rem); line-height: 1.12; margin: 0 auto 12px; letter-spacing: 0; max-width: 760px; overflow-wrap: anywhere; color: #fdf8e9; position: relative; }
.chapter-hero h1 br { display: none; }
.chapter-hero p { color: rgba(253,248,233,.82); max-width: 620px; margin: 0 auto; overflow-wrap: anywhere; position: relative; }
.progress { height: 5px; background: var(--line); border-radius: 99px; margin-bottom: 34px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--leaf-dark), var(--bark), var(--brass)); border-radius: inherit; }
.content h2 { font-family: var(--display); color: var(--ink); font-size: 1.52rem; line-height: 1.28; margin: 42px 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--line); letter-spacing: 0; }
.content h2:first-child { margin-top: 0; }
.content h2 { position: relative; }
.content h2::before { content: ''; position: absolute; left: -14px; top: 50%; width: 6px; height: 18px; background: linear-gradient(180deg, var(--leaf-dark), var(--brass)); border-radius: 2px; transform: translateY(-50%); }
@media (max-width: 760px) { .content h2::before { left: -10px; width: 4px; } }
.content h3 { color: var(--leaf-dark); font-size: 1.08rem; margin: 28px 0 10px; }
.content h4 { color: var(--brass); font-size: .76rem; margin: 22px 0 8px; letter-spacing: .08em; text-transform: uppercase; }
.content ul, .content ol { color: var(--ink-soft); padding-left: 24px; margin: 10px 0 16px; font-size: .93rem; }
.content li { margin: 4px 0; }
pre { background: var(--code-bg); color: var(--code-text); border-radius: var(--radius); padding: 17px 18px; overflow-x: auto; font-size: .88rem; line-height: 1.72; margin: 16px 0; border: 1px solid rgba(227,201,138,.12); white-space: pre-wrap; overflow-wrap: anywhere; }
pre code { color: inherit; }
pre b { color: #f0c97a; font-weight: 700; }
pre i { color: #b8d8b8; font-style: normal; }
pre u { color: #f4a672; text-decoration: none; }
code { font-family: var(--mono); }
p code, li code, td code { background: #f3eed8; color: var(--bark-dark); border: 1px solid #e0d5a8; border-radius: 5px; padding: 1px 5px; font-size: .86em; }
.table-wrap { overflow-x: auto; margin: 18px 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: .86rem; min-width: 560px; }
th { background: var(--paper-2); color: var(--ink); font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--line-strong); }
td { color: var(--ink-soft); padding: 11px 13px; border-top: 1px solid var(--line); vertical-align: top; }
tr:first-child td { border-top: 0; }
td b, td strong { color: var(--bark-dark); }
td .lang-tag { display: inline-block; font-family: var(--mono); font-size: .7rem; padding: 1px 6px; border-radius: 4px; background: #efe9d6; color: var(--bark-dark); border: 1px solid #d8cda3; margin-right: 4px; }
td .lang-tag.gk { background: #e3eee5; color: var(--leaf-dark); border-color: #c2d6c5; }
.callout { margin: 18px 0; padding: 15px 16px; border-radius: var(--radius); background: #f1ecda; border-left: 4px solid var(--bark); }
.callout-mark { display: block; color: var(--bark-dark); font-size: .76rem; font-weight: 900; margin-bottom: 4px; letter-spacing: .08em; }
.callout p { margin: 0; }
.callout.tip { background: #e8efe6; border-left-color: var(--leaf); }
.callout.tip .callout-mark { color: var(--leaf-dark); }
.callout.warn { background: #f6ead8; border-left-color: var(--brass); }
.callout.warn .callout-mark { color: var(--brass-dark); }
.callout.danger { background: #f5e1d6; border-left-color: var(--terra); }
.callout.danger .callout-mark { color: var(--rust); }
.chapter-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--line); }
.chapter-nav a { display: flex; flex-direction: column; padding: 14px; text-decoration: none; color: inherit; min-height: 80px; justify-content: center; }
.chapter-nav a:hover { border-color: var(--bark); background: var(--surface); }
.next { text-align: right; }
.nav-dir { color: var(--muted); font-size: .66rem; font-weight: 900; }
.nav-title-text { color: var(--leaf-dark); font-weight: 800; font-size: .88rem; line-height: 1.45; }
.site-footer { border-top: 1px solid var(--line); background: rgba(239,233,214,.7); padding: 28px 24px; text-align: center; color: var(--muted); font-size: .82rem; }
.site-footer a { color: var(--leaf-dark); text-decoration: none; font-weight: 700; }
@media (max-width: 760px) {
  .nav { padding: 0 16px; gap: 10px; }
  .nav-badge { display: none; }
  .hero { padding: 54px 18px 40px; }
  .hero-grid { grid-template-columns: 1fr; }
  .root-board { padding: 16px; }
  .tree-row { grid-template-columns: 1fr; }
  .tree-arrow { display: none; }
  .container, .content { padding-left: 18px; padding-right: 18px; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
  .chapter-nav { grid-template-columns: 1fr; }
  .next { text-align: left; }
  .chapter-hero h1 { font-size: 1.72rem; word-break: break-all; }
  .chapter-hero h1 br { display: block; }
}
@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; }
  .card-list a { padding: 14px; }
  .list-num { width: 30px; height: 30px; }
}
