:root {
  --bg: #f7f4ee; --surface: #ffffff; --ink: #1f2937; --muted: #5b6577; --brand: #243045; --accent: #3f8f5a; --accent-ink: #ffffff;
  --line: #e6e0d4; --soft: #eef3ec; --tip: #e8f3ec; --tip-line: #3f8f5a; --warn: #fff4dc; --warn-line: #d79a1c; --note: #e9f0fa; --note-line: #4a7bc0;
  --code: #eef0f4;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #151b27; --surface: #1d2535; --ink: #e8ecf3; --muted: #a3adc0; --brand: #e8ecf3; --accent: #5fbf84; --accent-ink: #0f1a13; --line: #2c3649; --soft: #1a2a24;
    --tip: #17301f; --tip-line: #5fbf84; --warn: #3a2f12; --warn-line: #e0b04a; --note: #14263d; --note-line: #6fa0e0; --code: #232c3e; }
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; line-height: 1.7; font-size: 17px; }
h1, h2, h3 { font-family: 'Outfit', system-ui, sans-serif; line-height: 1.2; margin: 0 0 .5em; letter-spacing: .005em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); } h2 { font-size: 1.55rem; margin-top: 2.2em; } h3 { font-size: 1.2rem; margin-top: 1.6em; }
a { color: var(--accent); } a:hover { text-decoration: none; }
p, li { max-width: 68ch; } ul, ol { padding-left: 1.3em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }

header.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top .bar { flex-wrap: wrap; display: flex; align-items: center; gap: 14px; padding: 10px 16px; max-width: 1200px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: 'Outfit', sans-serif; font-weight: 600; font-size: 1.15rem; white-space: nowrap; }
.brand img { height: 34px; width: auto; }
.brand small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.menu-btn { margin-left: 12px; display: none; background: none; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; color: var(--ink); font: inherit; font-size: .95rem; cursor: pointer; }
.langs { margin-left: auto; font-size: .9rem; white-space: nowrap; }
.langs a { color: var(--accent); } .langs .lang-now { font-weight: 600; }
.top-links { margin-left: 18px; display: flex; gap: 16px; font-size: .95rem; }
.top-links a { color: var(--muted); text-decoration: none; } .top-links a:hover { color: var(--ink); }

.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 36px; max-width: 1200px; margin: 0 auto; padding: 24px 16px 80px; }
nav.toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; padding-right: 6px; font-size: .95rem; }
nav.toc h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 8px; }
nav.toc ol { list-style: none; padding: 0; margin: 0; counter-reset: lesson; }
nav.toc li { margin: 2px 0; max-width: none; counter-increment: lesson; }
nav.toc a { display: flex; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
nav.toc a::before { content: counter(lesson); flex: none; width: 1.6em; height: 1.6em; border-radius: 50%; background: var(--soft); color: var(--accent); font-size: .8rem; display: grid; place-items: center; margin-top: 2px; }
nav.toc a:hover { background: var(--soft); }
nav.toc a[aria-current="page"] { background: var(--soft); font-weight: 600; }
nav.toc a.done::before { content: "✓"; background: var(--accent); color: var(--accent-ink); }
nav.toc .extra a::before { content: "•"; }
nav.toc .extra { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); counter-reset: none; }

main { min-width: 0; }
.crumbs { font-size: .9rem; color: var(--muted); margin-bottom: 10px; } .crumbs a { color: var(--muted); }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 62ch; }
.meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 6px; font-size: .92rem; color: var(--muted); }
.meta span { display: inline-flex; gap: 6px; align-items: center; }
.pill { display: inline-block; background: var(--soft); color: var(--accent); border-radius: 999px; padding: 3px 12px; font-size: .85rem; font-weight: 500; }

.box { border-left: 5px solid var(--note-line); background: var(--note); border-radius: 10px; padding: 12px 16px; margin: 20px 0; max-width: 72ch; }
.box > :first-child { margin-top: 0; } .box > :last-child { margin-bottom: 0; }
.box strong.label { display: block; font-family: 'Outfit', sans-serif; font-size: .95rem; margin-bottom: 2px; }
.box.tip { border-color: var(--tip-line); background: var(--tip); } .box.warn { border-color: var(--warn-line); background: var(--warn); }
.goal { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px 20px; margin: 22px 0; }
.goal h2 { margin: 0 0 6px; font-size: 1.05rem; } .goal ul { margin: 0; }

ol.steps { list-style: none; padding: 0; counter-reset: step; margin: 18px 0; }
ol.steps > li { counter-increment: step; position: relative; padding: 0 0 18px 52px; max-width: none; }
ol.steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 600; font-family: 'Outfit', sans-serif; }
ol.steps > li::after { content: ""; position: absolute; left: 17px; top: 38px; bottom: 4px; width: 2px; background: var(--line); }
ol.steps > li:last-child::after { display: none; }
ol.steps > li > p:first-child { margin-top: 0; }

.btn-name { display: inline-block; background: var(--code); border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-weight: 600; font-size: .92em; white-space: nowrap; }
kbd { background: var(--code); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; font-size: .88em; }

figure.shot { margin: 18px 0; } figure.shot figcaption { font-size: .9rem; color: var(--muted); margin-top: 8px; max-width: 62ch; }
.shots { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; margin: 18px 0; }
.shots figure { margin: 0; }
img.phone { width: min(300px, 100%); height: auto; border-radius: 22px; border: 6px solid #111827; box-shadow: 0 10px 28px rgba(0,0,0,.18); display: block; background: #111827; }
img.wide { width: 100%; max-width: 760px; height: auto; border-radius: 12px; border: 1px solid var(--line); display: block; }
img.crop { max-width: min(560px, 100%); height: auto; border-radius: 14px; border: 1px solid var(--line); display: block; }
.shots.side { gap: 28px; } 

table { border-collapse: collapse; width: 100%; max-width: 760px; margin: 16px 0; font-size: .96rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; } th { color: var(--muted); font-weight: 600; font-size: .85rem; text-transform: uppercase; letter-spacing: .05em; }
dl.gloss dt { font-weight: 600; margin-top: 14px; } dl.gloss dd { margin: 2px 0 0; color: var(--muted); max-width: 66ch; }
details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 4px 16px; margin: 10px 0; max-width: 72ch; }
details summary { cursor: pointer; font-weight: 600; padding: 10px 0; } details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 8px; }

.try { background: var(--soft); border: 2px dashed var(--accent); border-radius: 14px; padding: 14px 20px; margin: 28px 0; max-width: 72ch; }
.try h3 { margin: 0 0 6px; font-size: 1.05rem; } .try ol { margin: 0; }
.recap { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 20px; margin: 28px 0; max-width: 72ch; }
.recap h3 { margin-top: 0; font-size: 1.05rem; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 44px; flex-wrap: wrap; }
.pager a { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; text-decoration: none; color: var(--ink); min-width: 220px; max-width: 48%; }
.pager a small { display: block; color: var(--muted); font-size: .8rem; } .pager a:hover { border-color: var(--accent); } .pager .next { margin-left: auto; text-align: right; }
.done-btn { margin-top: 26px; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 12px 22px; font: inherit; font-weight: 600; cursor: pointer; }
.done-btn[aria-pressed="true"] { background: var(--soft); color: var(--accent); border: 1px solid var(--accent); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin: 20px 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px 18px; text-decoration: none; color: var(--ink); display: block; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); } .card h3 { margin: 6px 0 4px; font-size: 1.1rem; } .card p { margin: 0; color: var(--muted); font-size: .94rem; }
.card .num { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--soft); color: var(--accent); font-weight: 600; }
.card.done .num { background: var(--accent); color: var(--accent-ink); }
.hero { padding: 8px 0 8px; } .hero .actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 12px 24px; font-weight: 600; text-decoration: none; } .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
footer { border-top: 1px solid var(--line); padding: 22px 16px; text-align: center; color: var(--muted); font-size: .9rem; }

@media (max-width: 900px) {
  .langs { margin-left: auto; font-size: .82rem; white-space: normal; text-align: right; }
  .brand small { display: none; }
  .menu-btn { padding: 6px 10px; }
  .btn-name { white-space: normal; }
  table { display: block; overflow-x: auto; }
  .layout { grid-template-columns: 1fr; gap: 0; }
  .menu-btn { display: block; } .top-links { display: none; }
  nav.toc { position: static; max-height: none; display: none; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 18px; }
  nav.toc.open { display: block; }
  .pager a { max-width: 100%; width: 100%; }
}
@media print { header.top, nav.toc, .pager, .done-btn { display: none; } .layout { display: block; } body { background: #fff; color: #000; } }

/* search */
form.search { position: relative; flex: 1 1 220px; max-width: 340px; margin-left: 12px; }
form.search input { width: 100%; font: inherit; font-size: .95rem; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
form.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: min(420px, 92vw); max-height: 70vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 34px rgba(0,0,0,.2); z-index: 20; padding: 6px; }
.results[hidden] { display: none; }
.results a { display: block; padding: 9px 12px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.results a:hover, .results a[aria-selected="true"] { background: var(--soft); }
.results .r-title { font-weight: 600; font-size: .95rem; }
.results .r-where { font-size: .78rem; color: var(--muted); }
.results .r-snip { font-size: .86rem; color: var(--muted); margin-top: 2px; line-height: 1.45; max-width: none; }
.results mark { background: #ffe9a8; color: #1f2937; border-radius: 3px; padding: 0 1px; }
.results .r-none { padding: 12px; color: var(--muted); font-size: .92rem; max-width: none; }
@media (max-width: 900px) { form.search { order: 5; flex: 1 1 100%; max-width: none; margin: 8px 0 0; } .results { min-width: 0; } }
h2[id], h3[id] { scroll-margin-top: 84px; }
.results a { line-height: 1.4; }
