/* BGlinguo site — built from the app's own design system (app/src/theme): Nunito, violet brand, "3D" faces with a
   darker bottom edge, the unit path, the Капан hazard card and Чочо. */
@font-face { font-family: "Nunito"; font-weight: 400; font-display: swap; src: url("fonts/nunito-400.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 800; font-display: swap; src: url("fonts/nunito-800.woff2") format("woff2"); }
@font-face { font-family: "Nunito"; font-weight: 900; font-display: swap; src: url("fonts/nunito-900.woff2") format("woff2"); }

:root {
  --bg: #ffffff;
  --surface: #f7f7f7;
  --border: #e5e5e5;
  --text: #3c3c3c;
  --muted: #6f6f6f;
  --primary: #7b61ff;
  --primary-edge: #5b43d6;
  --link: #5b43d6;
  --primary-soft: #f0edff;
  --bubble: #ffffff;
  /* Капан card (same as the app) */
  --trap: #2d3142;
  --trap-edge: #1b1e2b;
  --trap-accent: #ffc800;
  /* Unit path colours (app: UNIT_PALETTES) */
  --p1: #7b61ff; --p1e: #5b43d6;
  --p2: #3dbe29; --p2e: #2e9a1e;
  --p3: #1fa2f2; --p3e: #1683c7;
  --p4: #ff5da2; --p4e: #d9407f;
  --violet-soft: #e6e0ff; --sky-soft: #d3edfd; --orange-soft: #ffe9cc;
  --violet: #7b61ff; --sky: #1683c7; --orange: #d97e00;
  --radius: 20px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131521;
    --surface: #1d2030;
    --border: #2d3142;
    --text: #ececec;
    --muted: #a3a3b2;
    --primary: #a594ff;
    --link: #a594ff;
    --primary-soft: #262342;
    --bubble: #1d2030;
    --trap: #1d2030;
    --trap-edge: #0c0e17;
    --violet-soft: #2b2650; --sky-soft: #12304a; --orange-soft: #3d2a10;
    --violet: #a594ff; --sky: #5cc0ff; --orange: #ffab3d;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.65 "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}
h1, h2, h3 { font-weight: 800; line-height: 1.15; }
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 3px; border-radius: 6px; }
img { max-width: 100%; height: auto; }
.wrap { max-width: 1040px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.narrow { max-width: 760px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Header ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; padding-bottom: 14px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; font-size: 28px; color: var(--primary); text-decoration: none; letter-spacing: -0.5px; }
.logo b { font-weight: inherit; }
.logo img { width: 36px; height: 36px; border-radius: 9px; }
.logo span { color: var(--text); }
.nav { display: flex; gap: 4px; }
.nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px;
  color: var(--muted); text-decoration: none; font-weight: 800; font-size: 16px; border-radius: 12px;
}
.nav a:hover { color: var(--link); background: var(--primary-soft); }

/* ---------- Hero ---------- */
.hero { display: grid; gap: 8px; align-items: center; padding-top: 8px; padding-bottom: 32px; text-align: center; }
.hero-art { position: relative; width: 260px; margin: 0 auto; padding-top: 56px; }
.hero-art picture, .hero-art img { display: block; width: 210px; margin: 0 auto; }
.bubble {
  position: absolute; z-index: 1; padding: 6px 16px; border-radius: 18px; font-weight: 900; font-size: 22px; line-height: 1.3;
  background: var(--bubble); color: var(--text); border: 2px solid var(--border); box-shadow: 0 4px 0 var(--border);
}
.bubble::after {
  content: ""; position: absolute; bottom: -9px; width: 14px; height: 14px; background: inherit;
  border-right: 2px solid var(--border); border-bottom: 2px solid var(--border); transform: rotate(45deg);
}
.bubble.bg { left: 0; top: 30px; transform: rotate(-4deg); }
.bubble.bg::after { left: 28px; }
.bubble.en { right: 4px; top: 16px; transform: rotate(5deg); background: var(--primary); color: #fff; border-color: var(--primary-edge); box-shadow: 0 4px 0 var(--primary-edge); }
.bubble.en::after { right: 22px; border-color: var(--primary-edge); }
.hero h1 { font-size: clamp(34px, 6.2vw, 54px); margin: 0 0 14px; letter-spacing: -0.8px; }
.hero h1 em { font-style: normal; color: var(--primary); }
.lead { color: var(--muted); font-size: 19px; margin: 0 auto 26px; max-width: 540px; }

.badge {
  display: inline-flex; align-items: center; gap: 12px; margin: 0;
  background: #2d3142; color: #fff; padding: 10px 22px 10px 16px; border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.14); box-shadow: 0 4px 0 #1b1e2b; text-align: left; line-height: 1.2;
}
.badge svg { flex: none; }
.badge small { display: block; font-size: 13px; opacity: 0.85; }
.badge strong { font-size: 19px; font-weight: 800; }

@media (min-width: 860px) {
  .hero { grid-template-columns: 1.15fr 0.85fr; text-align: left; padding-top: 32px; padding-bottom: 56px; }
  .hero-copy { order: 1; }
  .hero-art { order: 2; width: 300px; padding-top: 50px; }
  .hero-art picture, .hero-art img { width: 250px; }
  .lead { margin-left: 0; }
}

/* ---------- Sections ---------- */
.section { padding-top: 40px; padding-bottom: 40px; }
.section-title { text-align: center; font-size: clamp(26px, 4.5vw, 34px); margin: 0 0 8px; }
.section-sub { text-align: center; color: var(--muted); margin: 0 auto 32px; max-width: 560px; }

/* ---------- Level path (like the app's home screen) ---------- */
.path { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; position: relative; }
.path::before {
  content: ""; position: absolute; left: 50%; top: 36px; bottom: 60px; width: 0;
  border-left: 6px dotted var(--border); transform: translateX(-50%);
}
.step { position: relative; display: flex; align-items: center; gap: 16px; margin: 0 0 26px; width: calc(50% + 39px); }
.step:nth-child(odd) { flex-direction: row-reverse; text-align: right; }
.step:nth-child(even) { margin-left: calc(50% - 39px); }
.node {
  flex: none; width: 78px; height: 72px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 900; font-size: 24px; position: relative; z-index: 1;
}
.n1 { background: var(--p1); box-shadow: 0 7px 0 var(--p1e); }
.n2 { background: var(--p2); box-shadow: 0 7px 0 var(--p2e); }
.n3 { background: var(--p3); box-shadow: 0 7px 0 var(--p3e); }
.n4 { background: var(--p4); box-shadow: 0 7px 0 var(--p4e); }
.step b { display: block; font-size: 18px; font-weight: 800; line-height: 1.3; }
.step div > span { color: var(--muted); font-size: 15px; line-height: 1.4; display: block; }
.stats { text-align: center; color: var(--muted); margin: 8px auto 0; max-width: 34em; }
.stats strong { color: var(--text); font-weight: 900; font-variant-numeric: tabular-nums; }

/* ---------- Капан card ---------- */
.trap { background: var(--trap); color: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: 0 6px 0 var(--trap-edge); max-width: 760px; margin: 0 auto; }
.stripes { height: 14px; background: repeating-linear-gradient(-45deg, var(--trap-accent) 0 16px, #1b1e2b 16px 32px); }
.trap-body { padding: 22px 22px 26px; }
.trap h2 { color: var(--trap-accent); font-size: clamp(28px, 5vw, 36px); margin: 0 0 6px; }
.trap p { margin: 0 0 18px; color: rgba(255, 255, 255, 0.82); }
.fixes { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.fix { background: rgba(255, 255, 255, 0.06); border: 2px solid rgba(255, 255, 255, 0.1); border-radius: 14px; padding: 10px 14px; }
.fix .no, .fix .yes { display: flex; gap: 10px; align-items: baseline; font-weight: 800; }
.fix .no { color: #ff9b9b; }
.fix .no span { text-decoration: line-through; text-decoration-thickness: 2px; }
.fix .yes { color: #8be27a; }
.fix .mark { width: 16px; height: 16px; flex: none; align-self: center; }

/* ---------- Features: heading left, plain list right (no cards) ---------- */
.split { display: grid; gap: 24px; align-items: start; max-width: 920px; }
.split-head h2 { font-size: clamp(26px, 4.5vw, 34px); margin: 0 0 10px; }
.split-head p { color: var(--muted); margin: 0; max-width: 32em; }
.features { list-style: none; margin: 0; padding: 0; }
.feature { display: flex; gap: 16px; align-items: flex-start; padding: 18px 0; border-top: 1px solid var(--border); }
.feature:last-child { border-bottom: 1px solid var(--border); }
.feature h3 { font-size: 19px; margin: 0 0 2px; }
.feature p { margin: 0; color: var(--muted); font-size: 16px; }
.icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.icon svg { width: 24px; height: 24px; }
.i-violet { background: var(--violet-soft); color: var(--violet); }
.i-sky { background: var(--sky-soft); color: var(--sky); }
.i-orange { background: var(--orange-soft); color: var(--orange); }
@media (min-width: 760px) { .split { grid-template-columns: 0.9fr 1.1fr; gap: 48px; } .split-head { position: sticky; top: 24px; } }

/* ---------- Contact ---------- */
.contact { background: var(--primary-soft); border-radius: var(--radius); padding: 18px 22px; display: flex; gap: 16px; align-items: center; max-width: 760px; margin: 0 auto; }
.contact img { width: 76px; flex: none; }
.contact h2 { font-size: 19px; margin: 0 0 2px; }
.contact p { margin: 0; }
.contact a { font-weight: 800; white-space: nowrap; }
@media (max-width: 480px) { .contact img { display: none; } }

/* ---------- Privacy page ---------- */
.doc { max-width: 760px; }
.doc h1, .doc .h1 { color: var(--primary); font-size: clamp(30px, 6vw, 38px); margin: 16px 0 4px; }
.doc h2 { font-size: 21px; margin: 36px 0 6px; }
.muted { color: var(--muted); }
.summary { background: var(--primary-soft); border-radius: 16px; padding: 14px 18px; margin: 20px 0; }
.toc { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 0; list-style: none; }
.toc a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 12px;
  border: 2px solid var(--border); border-bottom-width: 4px; text-decoration: none; font-weight: 800; font-size: 15px;
}
.toc a:hover { background: var(--primary-soft); }
.doc hr { border: none; border-top: 2px solid var(--border); margin: 56px 0 8px; }

/* ---------- Footer ---------- */
.footer { border-top: 2px solid var(--border); margin-top: 48px; padding-top: 20px; padding-bottom: 40px; color: var(--muted); font-size: 15px; text-align: center; }
.footer a { color: var(--muted); }
.footer p { margin: 4px 0; }

/* Phones: one column, nodes on the left, the dotted line runs through them. */
@media (max-width: 600px) {
  .path::before { left: 39px; transform: none; margin-left: -3px; }
  .step, .step:nth-child(even) { width: auto; margin-left: 0; }
  .step:nth-child(odd) { flex-direction: row; text-align: left; }
}

/* ---------- Browser surfaces, rhythm, small craft ---------- */
::selection { background: var(--primary); color: #fff; }
html { accent-color: var(--primary); caret-color: var(--primary); scrollbar-color: var(--border) var(--bg); }
h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }
.section h2 { margin-top: 0; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 10; padding: 10px 16px; border-radius: 12px;
  background: var(--primary); color: #fff; font-weight: 800; text-decoration: none; transition: top 0.2s ease-out;
}
.skip:focus { top: 12px; }
.nav a, .toc a, .footer a, a { transition: color 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1); }
.nav a:active, .toc a:active { transform: translateY(1px); }
/* A soft violet glow behind Чочо gives the hero depth without a gradient on text. */
.hero-art::before {
  content: ""; position: absolute; left: 50%; top: 58%; width: 300px; height: 300px; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(closest-side, var(--primary-soft), transparent); z-index: -1;
}
.hero-art { isolation: isolate; }
.doc p { max-width: 68ch; }
/* 404 */
.lost { text-align: center; padding: 32px 0 16px; }
.lost img { width: 180px; }
.lost h1 { font-size: clamp(30px, 6vw, 42px); margin: 8px 0; }
.lost p { color: var(--muted); margin: 0 auto 24px; max-width: 30em; }
.btn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 24px; border-radius: 16px;
  background: #7b61ff; color: #fff; font-size: 19px; font-weight: 800; text-decoration: none; box-shadow: 0 4px 0 #5b43d6;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}
.btn:hover { color: #fff; }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 #5b43d6; }
