/* ==========================================================================
   Semikods — dizaina sistēma
   Zīmola krāsa ņemta no logo: #1e78c2
   ========================================================================== */

:root {
  --brand: #1e78c2;
  --brand-strong: #165f9c;
  --brand-ink: #0d4778;
  --brand-soft: #e8f1fb;
  --accent: #f5a524;
  --ok: #158a5b;
  --lv-red: #9e3039;      /* oficiālā karoga karmīnsarkanā */
  --lv-red-text: #9e3039;

  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --surface-3: #e3e9f1;
  --ink: #0e1a2b;
  --ink-2: #46546a;
  --ink-3: #78869a;
  --line: #dde4ee;
  --line-strong: #c8d2e0;

  --logo-fill: #ffffff;
  --logo-stroke: #1e78c2;

  --code-bg: #0e1626;
  --code-head: #141f34;
  --code-ink: #d6e0f1;
  --code-dim: #6c7c97;
  --code-line: #1f2b44;

  --shadow-sm: 0 1px 2px rgb(14 26 43 / .06);
  --shadow: 0 1px 2px rgb(14 26 43 / .05), 0 10px 30px -12px rgb(14 26 43 / .16);
  --shadow-lg: 0 30px 70px -24px rgb(14 26 43 / .35);

  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Bricolage Grotesque", var(--font);
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --wrap: 1180px;
  --header-h: 72px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --brand: #4ea3ec;
  --brand-strong: #79bbf3;
  --brand-ink: #a9d3f7;
  --brand-soft: #13263f;
  --lv-red-text: #e0606b;
  --ok: #3cc58c;
  --bg: #0a111d;
  --surface: #101a2a;
  --surface-2: #162236;
  --surface-3: #1d2b42;
  --ink: #e7eef9;
  --ink-2: #a6b4ca;
  --ink-3: #74839b;
  --line: #213049;
  --line-strong: #2d3f5d;
  --logo-fill: #101a2a;
  --logo-stroke: #4ea3ec;
  --code-bg: #0b1322;
  --code-head: #111b2e;
  --code-line: #1c2840;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 30px -12px rgb(0 0 0 / .5);
  --shadow-lg: 0 30px 70px -24px rgb(0 0 0 / .7);
  color-scheme: dark;
}

/* Kursu krāsas */
.c-blue   { --c: #1e78c2; }
.c-violet { --c: #7c4ddb; }
.c-amber  { --c: #d9870b; }
.c-green  { --c: #179b68; }
.c-teal   { --c: #0e8f9a; }
.c-rose   { --c: #d0435b; }
[data-theme="dark"] .c-rose { --c: #f07a8e; }
[data-theme="dark"] .c-teal { --c: #3cc7d2; }
[data-theme="dark"] .c-blue { --c: #4ea3ec; }
[data-theme="dark"] .c-violet { --c: #a483f0; }
[data-theme="dark"] .c-amber { --c: #f2b046; }
[data-theme="dark"] .c-green { --c: #3cc58c; }
[class*="c-"] { --c-soft: color-mix(in srgb, var(--c) 12%, transparent); }

/* --------------------------------------------------------------------------
   Pamati
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
::selection { background: color-mix(in srgb, var(--brand) 25%, transparent); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }
@media (max-width: 640px) { .wrap { padding-inline: 16px; } }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: var(--r-sm);
}
.skip:focus { top: 12px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--brand);
  display: inline-flex; align-items: center; gap: 8px;
}
.semi { color: var(--accent); font-weight: 700; }
.muted { color: var(--ink-3); }

/* --------------------------------------------------------------------------
   Pogas
   -------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--btn-line);
  background: var(--btn-bg);
  color: var(--btn-ink);
  font: 600 15px/1 var(--font);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn:hover { color: var(--btn-ink); border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  --btn-bg: var(--brand);
  --btn-ink: #fff;
  --btn-line: transparent;
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--brand) 80%, transparent);
}
[data-theme="dark"] .btn-primary { --btn-ink: #06121f; }
.btn-primary:hover { --btn-bg: var(--brand-strong); border-color: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-line: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); border-color: transparent; }
.btn-ok { --btn-bg: var(--ok); --btn-ink: #fff; --btn-line: transparent; }
.btn-lg { height: 52px; padding: 0 26px; font-size: 16px; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }
.btn .arrow { transition: transform .15s ease; }
.btn:hover .arrow { transform: translateX(3px); }

.icon-btn {
  width: 40px; height: 40px; border-radius: 999px;
  display: inline-grid; place-items: center;
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

.link-arrow { font-weight: 600; text-decoration: none; white-space: nowrap; }
.link-arrow:hover { text-decoration: underline; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--ink-2);
  white-space: nowrap;
}
.badge-ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }

/* --------------------------------------------------------------------------
   Galvene
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 32px; }
.brand { display: inline-flex; align-items: center; flex: none; }
.logo { height: 46px; width: auto; }
.logo .logo-cloud { fill: var(--logo-fill); stroke: var(--logo-stroke); stroke-width: 15; }
.logo .logo-text { fill: var(--logo-stroke); font-family: "Myriad Pro", "Segoe UI", "Helvetica Neue", Arial, sans-serif; font-size: 70px; }

.main-nav { display: flex; gap: 4px; }
.main-nav a {
  color: var(--ink-2); text-decoration: none; font-weight: 500; font-size: 15px;
  padding: 8px 14px; border-radius: 999px;
}
.main-nav a:hover { color: var(--ink); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.user-chip {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 4px 14px 4px 4px; border-radius: 999px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.user-chip:hover { color: var(--ink); border-color: var(--line-strong); }
.avatar {
  width: 32px; height: 32px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  font: 700 13px/1 var(--font);
}
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }

.theme-toggle .i-sun { display: none; }
[data-theme="dark"] .theme-toggle .i-sun { display: block; }
[data-theme="dark"] .theme-toggle .i-moon { display: none; }

.mobile-nav { display: none; position: relative; }
.mobile-nav summary { list-style: none; }
.mobile-nav summary::-webkit-details-marker { display: none; }
.mobile-nav-panel {
  position: absolute; right: 0; top: 48px; width: min(300px, calc(100vw - 32px));
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow-lg); padding: 8px; display: grid; gap: 2px;
}
.mobile-nav-panel a { padding: 12px 14px; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 500; }
.mobile-nav-panel a:hover { background: var(--surface-2); }
.mobile-nav-panel hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

@media (max-width: 760px) {
  .main-nav, .header-actions .hide-sm { display: none; }
  .mobile-nav { display: block; }
  .header-inner { gap: 12px; }
  .logo { height: 40px; }
}

/* --------------------------------------------------------------------------
   Sākumlapa — hero
   -------------------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 96px; }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 70% 40%, #000 20%, transparent 75%);
  opacity: .7;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 56px; align-items: center; }
.hero-grid > * { min-width: 0; }
.hero h1 { font-size: clamp(44px, 6.4vw, 78px); margin: 18px 0 22px; letter-spacing: -0.035em; }
/* "Latviski." — Latvijas karoga krāsās (karmīnsarkans–balts–karmīnsarkans, 2:1:2) */
.hero h1 .hl { color: var(--lv-red-text); position: relative; white-space: nowrap; }
.hero h1 .hl::after {
  content: ""; position: absolute; left: .02em; right: .08em; bottom: -.04em; height: .2em;
  background: linear-gradient(to bottom, var(--lv-red) 0 40%, #fff 40% 60%, var(--lv-red) 60% 100%);
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgb(14 26 43 / .08);
}

.lv-flag {
  display: inline-block; width: 1.5em; height: .75em; vertical-align: -.05em; border-radius: 2px;
  background: linear-gradient(to bottom, var(--lv-red) 0 40%, #fff 40% 60%, var(--lv-red) 60% 100%);
  box-shadow: 0 0 0 1px rgb(14 26 43 / .12);
}
.lead { font-size: 19px; color: var(--ink-2); max-width: 34em; line-height: 1.6; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.hero-points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--ink-2); font-size: 15px; }
.hero-points li { display: inline-flex; align-items: center; gap: 8px; }
.hero-points svg { width: 18px; height: 18px; color: var(--ok); }

.hero-visual { position: relative; }
.editor {
  background: var(--code-bg); color: var(--code-ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid color-mix(in srgb, #fff 6%, transparent);
  transform: rotate(-1deg);
}
.editor-bar { display: flex; align-items: center; gap: 14px; height: 44px; padding: 0 16px; background: var(--code-head); border-bottom: 1px solid var(--code-line); }
.dots { display: flex; gap: 7px; }
.dots i { width: 11px; height: 11px; border-radius: 50%; background: #2a3752; }
.dots i:nth-child(1) { background: #ff6a5f; }
.dots i:nth-child(2) { background: #ffbd2e; }
.dots i:nth-child(3) { background: #29c840; }
.editor-tab { font: 500 13px var(--font-mono); color: var(--code-ink); padding: 6px 12px; border-radius: 8px; background: color-mix(in srgb, #fff 6%, transparent); }
.editor pre { margin: 0; padding: 22px 24px; font: 14.5px/1.75 var(--font-mono); overflow-x: auto; background: transparent; }
.editor pre code { background: none; padding: 0; color: inherit; }
.editor-out { border-top: 1px solid var(--code-line); padding: 14px 24px 18px; font: 14px/1.7 var(--font-mono); }
.editor-out .label { color: var(--code-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.editor-out .ok { color: #7ee2a8; }
.caret { display: inline-block; width: 8px; height: 1.1em; vertical-align: -3px; background: var(--code-ink); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.float-card {
  position: absolute; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--shadow); padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; font-size: 14px;
  z-index: 2;
}
.float-card strong { display: block; font-size: 14px; }
.float-card small { color: var(--ink-3); font-size: 12.5px; }
.float-done { left: -32px; bottom: -44px; transform: rotate(1.5deg); }
.float-done .tick { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.float-progress { right: -18px; top: -48px; transform: rotate(2deg); }
.mini-bar { width: 120px; height: 6px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.mini-bar span { display: block; height: 100%; background: var(--brand); border-radius: inherit; }

@media (max-width: 960px) {
  .hero { padding: 40px 0 72px; }
  .hero-grid { grid-template-columns: 1fr; gap: 56px; }
  .float-done { left: 8px; }
  .float-progress { right: 8px; }
}
@media (max-width: 520px) {
  .hero h1 { font-size: 40px; }
  .lead { font-size: 17px; }
  .cta-row .btn-lg { width: 100%; }
  .editor { transform: none; }
  .editor pre { font-size: 12px; padding: 18px; }
  .editor-out { padding: 12px 18px 16px; font-size: 12.5px; }
  .float-progress { display: none; }
}

/* --------------------------------------------------------------------------
   Sadaļas
   -------------------------------------------------------------------------- */
.section { padding: 88px 0; }
.section + .section { padding-top: 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 36px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(30px, 3.6vw, 42px); margin-top: 10px; max-width: 18em; }
.section-head p.sub { color: var(--ink-2); margin-top: 12px; max-width: 40em; font-size: 17px; }

/* Kursu kartītes */
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.course-card {
  position: relative; display: flex; flex-direction: column; gap: 14px;
  padding: 24px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  min-height: 280px;
}
.course-card::before {
  content: ""; position: absolute; left: 24px; right: 24px; top: -1px; height: 3px;
  background: var(--c); border-radius: 0 0 4px 4px;
}
.course-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.course-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.course-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: grid; place-items: center;
  background: var(--c-soft); color: var(--c);
  font: 700 17px/1 var(--font-mono); letter-spacing: -0.04em;
}
.course-card h3 { font-size: 22px; }
.course-card p { color: var(--ink-2); font-size: 15px; flex: 1; }
.course-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; color: var(--ink-3); }
.course-meta span { display: inline-flex; align-items: center; gap: 6px; }
.course-meta span + span::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: currentColor; margin-right: 8px; }
.course-card.is-soon { background: transparent; border-style: dashed; }
.course-card.is-soon:hover { transform: none; box-shadow: none; }
.course-card.is-soon h3, .course-card.is-soon .course-icon { opacity: .75; }

.progress { display: grid; gap: 6px; }
.progress-top { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--c, var(--brand)); border-radius: inherit; transition: width .6s cubic-bezier(.2,.8,.2,1); }

/* Soļi */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.step { padding: 28px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); position: relative; }
.step-num { font: 700 14px var(--font-mono); color: var(--brand); display: block; margin-bottom: 26px; }
.step-num::after { content: ";"; color: var(--accent); }
.step h3 { font-size: 21px; margin-bottom: 10px; }
.step p { color: var(--ink-2); font-size: 15.5px; }
@media (max-width: 860px) { .steps { grid-template-columns: 1fr; } }

/* Izcelsme */
.origin {
  border-radius: 28px; overflow: hidden; position: relative;
  background: var(--brand); color: #fff;
  padding: 64px;
  display: grid; grid-template-columns: 1.3fr 1fr; gap: 48px; align-items: center;
}
[data-theme="dark"] .origin { background: #13365a; }
.origin::after {
  content: ";"; position: absolute; right: 24px; top: -40px;
  font: 800 360px/1 var(--font-display); color: rgb(255 255 255 / .07);
  pointer-events: none;
}
.origin .eyebrow { color: rgb(255 255 255 / .8); }
.origin h2 { font-size: clamp(30px, 3.4vw, 42px); margin: 12px 0 16px; color: #fff; }
.origin p { color: rgb(255 255 255 / .85); font-size: 17px; max-width: 34em; }
.origin .btn { --btn-bg: #fff; --btn-ink: #0d4778; --btn-line: transparent; }
.origin .btn:hover { --btn-bg: #eaf3fc; }
.origin-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; position: relative; z-index: 1; }
.origin-stat { background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .16); border-radius: var(--r); padding: 20px; }
.origin-stat strong { display: block; font: 700 34px/1 var(--font-display); margin-bottom: 6px; }
.origin-stat span { color: rgb(255 255 255 / .8); font-size: 14px; }
@media (max-width: 860px) { .origin { grid-template-columns: 1fr; padding: 40px 24px; } }

/* --------------------------------------------------------------------------
   Lapu galvenes (kursi, kurss)
   -------------------------------------------------------------------------- */
.page-head { padding: 56px 0 40px; }
.page-head h1 { font-size: clamp(36px, 5vw, 56px); margin: 12px 0 14px; }
.page-head p { color: var(--ink-2); font-size: 18px; max-width: 38em; }

.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); }
.crumbs a { color: var(--ink-2); text-decoration: none; }
.crumbs a:hover { color: var(--brand); }
.crumbs .sep { opacity: .6; }

.course-hero { padding: 40px 0 48px; background: linear-gradient(180deg, var(--c-soft), transparent); border-bottom: 1px solid var(--line); }
.course-hero-grid { display: grid; grid-template-columns: 1fr 340px; gap: 48px; align-items: end; }
.course-hero .course-icon { width: 68px; height: 68px; border-radius: 18px; font-size: 22px; margin: 26px 0 20px; background: var(--surface); box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.course-hero h1 { font-size: clamp(36px, 5vw, 56px); margin-bottom: 14px; }
.course-hero p { color: var(--ink-2); font-size: 18px; max-width: 36em; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2); }
.chip svg { width: 16px; height: 16px; color: var(--c); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; box-shadow: var(--shadow-sm); }
.progress-panel { display: grid; gap: 18px; }
.ring-row { display: flex; align-items: center; gap: 18px; }
.ring { width: 76px; height: 76px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; }
.ring .track { stroke: var(--surface-3); }
.ring .value { stroke: var(--c, var(--brand)); stroke-linecap: round; transition: stroke-dasharray .6s ease; }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font: 700 18px var(--font-display); }
.ring-row strong { display: block; font-size: 17px; }
.ring-row span { color: var(--ink-3); font-size: 14px; }
@media (max-width: 860px) { .course-hero-grid { grid-template-columns: 1fr; gap: 28px; } }

/* Nodarbību saraksts */
.course-body { padding: 48px 0 96px; }
.list-title { font-size: 14px; font-family: var(--font-mono); color: var(--ink-3); font-weight: 600; margin-bottom: 14px; }
.lesson-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; max-width: 820px; }
.lesson-row > a, .lesson-row > div {
  display: grid; grid-template-columns: 56px 1fr auto 32px; align-items: center; gap: 18px;
  padding: 18px 20px; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); text-decoration: none;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.lesson-row > a:hover { color: var(--ink); border-color: var(--c, var(--brand)); box-shadow: var(--shadow); transform: translateX(3px); }
.lesson-num { font: 700 18px var(--font-mono); color: var(--ink-3); }
.lesson-num::after { content: ";"; color: var(--accent); }
.lesson-info strong { font-size: 17px; font-weight: 600; }
.term { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); margin-left: 8px; }
.lesson-info small { display: block; color: var(--ink-2); font-size: 14.5px; margin-top: 2px; }
.lesson-time { font-size: 13.5px; color: var(--ink-3); white-space: nowrap; }
.state { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-strong); color: transparent; }
.state svg { width: 15px; height: 15px; }
.is-done .state { background: var(--ok); border-color: var(--ok); color: #fff; }
.is-done .lesson-num { color: var(--ok); }
.lesson-row.is-planned > div { background: transparent; border-style: dashed; color: var(--ink-3); }
.lesson-row.is-planned strong { color: var(--ink-3); font-weight: 500; }
.lesson-row.is-planned .state { border-style: dashed; }
@media (max-width: 600px) {
  .lesson-row > a, .lesson-row > div { grid-template-columns: 40px 1fr 28px; gap: 12px; padding: 16px; }
  .lesson-time { display: none; }
  .term { display: none; }
}

.course-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 48px; align-items: start; }
.course-aside { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 16px; }
.course-aside h3 { font-size: 18px; margin-bottom: 10px; }
.course-aside ul { padding-left: 18px; margin: 0; color: var(--ink-2); font-size: 15px; display: grid; gap: 6px; }
@media (max-width: 960px) { .course-layout { grid-template-columns: 1fr; } .course-aside { position: static; } }

/* --------------------------------------------------------------------------
   Nodarbība
   -------------------------------------------------------------------------- */
.lesson-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 210px;
  gap: 56px;
  padding-top: 40px; padding-bottom: 96px;
  align-items: start;
}
.lesson-side { position: sticky; top: calc(var(--header-h) + 24px); max-height: calc(100vh - var(--header-h) - 48px); overflow: auto; }
.side-box summary { list-style: none; cursor: pointer; }
.side-box summary::-webkit-details-marker { display: none; }
.side-title { display: block; font-weight: 700; font-family: var(--font-display); font-size: 17px; color: var(--ink); text-decoration: none; }
.side-sub { display: block; font-size: 13px; color: var(--ink-3); margin: 4px 0 12px; }
.side-box .bar { height: 5px; margin-bottom: 18px; }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.side-list a, .side-list span.planned {
  display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: center;
  padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 14.5px; color: var(--ink-2); text-decoration: none; line-height: 1.35;
}
.side-list a:hover { background: var(--surface-2); color: var(--ink); }
.side-list a[aria-current="page"] { background: var(--c-soft, var(--brand-soft)); color: var(--ink); font-weight: 600; }
.side-list .dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; color: transparent; }
.side-list .dot svg { width: 11px; height: 11px; }
.side-list .is-done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.side-list a[aria-current="page"] .dot { border-color: var(--c, var(--brand)); }
.side-list span.planned { color: var(--ink-3); opacity: .7; }
.side-list span.planned .dot { border-style: dashed; }

.lesson-main { min-width: 0; }
.lesson-head { margin: 18px 0 36px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }
.lesson-head h1 { font-size: clamp(36px, 4.6vw, 52px); margin: 12px 0 10px; }
.term-line { font-family: var(--font-mono); color: var(--ink-3); font-size: 14px; }
.term-line em { font-style: normal; color: var(--ink-2); }

.toc { position: sticky; top: calc(var(--header-h) + 24px); }
.toc-title { font: 600 12px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 12px; }
.toc ol { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--line); }
.toc a { display: block; padding: 6px 0 6px 14px; margin-left: -2px; border-left: 2px solid transparent; color: var(--ink-3); text-decoration: none; font-size: 14px; line-height: 1.4; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--brand); border-left-color: var(--brand); font-weight: 600; }

@media (max-width: 1180px) {
  .lesson-layout { grid-template-columns: 230px minmax(0, 1fr); gap: 40px; }
  .toc-col { display: none; }
}
@media (max-width: 860px) {
  .lesson-layout { grid-template-columns: 1fr; gap: 0; padding-top: 20px; }
  .lesson-side { position: static; max-height: none; overflow: visible; }
  .side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
  .side-box summary { display: flex; justify-content: space-between; align-items: center; }
  .side-box summary::after { content: "▾"; color: var(--ink-3); }
  .side-box[open] summary::after { content: "▴"; }
  .side-sub { margin-bottom: 0; }
  .side-box[open] .side-sub { margin-bottom: 12px; }
}

/* Raksta tipogrāfija */
.prose { font-size: 17.5px; line-height: 1.78; color: var(--ink); max-width: 72ch; }
.prose > * + * { margin-top: 1.15em; }
.prose h2 { font-size: 28px; margin-top: 2em; padding-top: .2em; }
.prose h3 { font-size: 21px; margin-top: 1.6em; }
.prose h2 + *, .prose h3 + * { margin-top: .7em; }
.prose strong { font-weight: 650; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: .35em; }
.prose li::marker { color: var(--brand); }
.prose :not(pre) > code {
  font-family: var(--font-mono); font-size: .86em;
  background: var(--surface-2); border: 1px solid var(--line);
  padding: .12em .4em; border-radius: 6px; color: var(--ink);
  white-space: nowrap;
}
.prose table { display: block; overflow-x: auto; border-collapse: separate; border-spacing: 0; width: 100%; font-size: 15px; line-height: 1.55; border: 1px solid var(--line); border-radius: var(--r); }
.prose th, .prose td { padding: 12px 16px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.prose th { background: var(--surface-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.prose tr:last-child td { border-bottom: 0; }
.prose td code { white-space: nowrap; }
.prose blockquote { margin: 1.4em 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--line-strong); color: var(--ink-2); }

.prose .padoms, .prose .uzmanibu {
  position: relative;
  padding: 18px 20px 18px 56px; border-radius: var(--r);
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 22%, transparent);
  font-size: 16px; line-height: 1.65;
}
.prose .padoms::before {
  content: ";"; position: absolute; left: 18px; top: 13px;
  width: 26px; height: 26px; border-radius: 8px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff; font: 800 17px/1 var(--font-mono);
}
.prose .uzmanibu { background: color-mix(in srgb, var(--accent) 14%, transparent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.prose .uzmanibu::before { content: "!"; position: absolute; left: 18px; top: 13px; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--accent); color: #2b1a00; font: 800 15px/1 var(--font-mono); }

/* Koda bloki */
.code-block { background: var(--code-bg); border-radius: var(--r); overflow: hidden; border: 1px solid var(--code-line); box-shadow: var(--shadow-sm); }
.prose .code-block { margin-top: 1.4em; margin-bottom: 1.4em; }
.code-head { display: flex; align-items: center; justify-content: space-between; height: 40px; padding: 0 8px 0 16px; background: var(--code-head); border-bottom: 1px solid var(--code-line); }
.code-lang { font: 600 12px var(--font-mono); color: var(--code-dim); text-transform: uppercase; letter-spacing: .08em; }
.copy-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 6px; border: 0; background: transparent; color: var(--code-dim); font: 500 13px var(--font); cursor: pointer; }
.copy-btn:hover { background: rgb(255 255 255 / .07); color: var(--code-ink); }
.copy-btn svg { width: 14px; height: 14px; }
.copy-btn.copied { color: #7ee2a8; }
.prose pre, .code-block pre { margin: 0; padding: 18px 20px; overflow-x: auto; font: 14.5px/1.7 var(--font-mono); color: var(--code-ink); background: var(--code-bg); tab-size: 4; }
.prose pre { border-radius: var(--r); }
.code-block pre { border-radius: 0; }
.prose pre code { font: inherit; background: none; border: 0; padding: 0; color: inherit; white-space: pre; }

/* Bez ligatūrām: iesācējiem jāredz tieši tie simboli, kas jāraksta (=> nevis ⇒) */
/* !important, jo vēlākie "font:" saīsinājumi šīs īpašības atiestata */
pre, code, .run-lines, .editor { font-variant-ligatures: none !important; font-feature-settings: "liga" 0, "calt" 0 !important; }

/* Palaižami (rediģējami) JavaScript bloki */
.code-tools { display: flex; align-items: center; gap: 2px; }
.code-editable { text-transform: none; letter-spacing: 0; font-weight: 500; opacity: .75; }
.is-runnable pre code { outline: none; caret-color: #7cc4ff; display: block; min-height: 1.7em; }
.is-runnable:focus-within { border-color: color-mix(in srgb, var(--brand) 60%, var(--code-line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.run-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px 0 10px; margin-left: 4px;
  border: 0; border-radius: 999px; cursor: pointer;
  background: #2fb877; color: #04150c; font: 700 13px var(--font);
  transition: background .15s ease;
}
.run-btn:hover { background: #3fd08b; }
.run-btn svg { width: 12px; height: 12px; }
.run-btn.is-running { background: #f2b046; }
.reset-btn[hidden] { display: none; }
.run-out { border-top: 1px solid var(--code-line); background: #0a111e; }
.run-out[hidden] { display: none; }
.run-frame { display: block; width: calc(100% - 24px); height: 260px; margin: 0 12px 12px; border: 0; border-radius: 8px; background: #fff; resize: vertical; }
.run-frame + .run-lines:empty { display: none; }
.run-out-head { display: flex; justify-content: space-between; align-items: center; height: 34px; padding: 0 8px 0 20px; font: 600 11.5px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--code-dim); }
.run-lines { padding: 2px 20px 14px; font: 14px/1.65 var(--font-mono); color: var(--code-ink); max-height: 320px; overflow: auto; }
.run-line { white-space: pre-wrap; word-break: break-word; padding: 1px 0; }
.run-line + .run-line { border-top: 1px solid rgb(255 255 255 / .04); }
.run-result { color: #9fb3d1; }
.run-warn { color: #f2c46d; }
.run-error { color: #ff8a80; }
.run-hint { color: #8fa3c2; font-family: var(--font); font-size: 13.5px; font-style: italic; border-top: 0 !important; padding-bottom: 4px; }
.is-running .run-lines::after { content: "…"; color: var(--code-dim); }

/* Automātiskās pārbaudes */
.check-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 12px 0 10px; margin-left: 4px;
  border: 1px solid #2fb877; border-radius: 999px; cursor: pointer;
  background: transparent; color: #7ee2a8; font: 700 13px var(--font);
}
.check-btn:hover { background: rgb(47 184 119 / .15); }
.check-btn svg { width: 12px; height: 12px; }
.run-pass { color: #7ee2a8; }
.run-fail { color: #ff8a80; }
.run-summary-ok, .run-summary-fail { font-family: var(--font); font-weight: 700; font-size: 15px; padding: 10px 12px !important; margin-top: 8px; border-radius: 8px; border-top: 0 !important; }
.run-summary-ok { background: rgb(47 184 119 / .16); color: #8ef0b5; }
.run-summary-fail { background: rgb(255 138 128 / .12); color: #ffaba3; }

/* Konsoles lapa */
.playground .code-block pre { min-height: 340px; }
.playground .run-lines { max-height: 420px; min-height: 60px; }
.konsole-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 24px; }
.konsole-notes .panel h3 { font-size: 17px; margin-bottom: 6px; }
.konsole-notes .panel p { color: var(--ink-2); font-size: 15px; }
.kbd { font: 600 12.5px var(--font-mono); padding: 2px 7px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line); }
@media (max-width: 860px) { .konsole-notes { grid-template-columns: 1fr; } }

/* Sintakses krāsas (highlight.js) */
.hljs-comment, .hljs-quote { color: #6f809c; font-style: italic; }
.hljs-keyword, .hljs-selector-tag, .hljs-built_in, .hljs-type { color: #c49cff; }
.hljs-string, .hljs-attr .hljs-string, .hljs-template-tag { color: #9ee6a8; }
.hljs-number, .hljs-literal { color: #ffb86b; }
.hljs-title, .hljs-title.function_, .hljs-function .hljs-title { color: #7cc4ff; }
.hljs-title.class_ { color: #ffd479; }
.hljs-attr, .hljs-property, .hljs-variable, .hljs-params { color: #d6e0f1; }
.hljs-subst { color: #d6e0f1; }
.hljs-meta, .hljs-symbol { color: #ff8fb1; }
.hljs-operator, .hljs-punctuation { color: #a9b8d0; }

/* Pabeigšana + lapošana */
.complete-box {
  margin-top: 56px; padding: 28px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.complete-box h2 { font-size: 21px; margin-bottom: 4px; }
.complete-box p { color: var(--ink-2); font-size: 15px; }
.complete-box .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.complete-box.is-done { background: color-mix(in srgb, var(--ok) 8%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.complete-box.is-done h2 { color: var(--ok); display: flex; align-items: center; gap: 10px; }
.complete-box.is-done h2 svg { width: 24px; height: 24px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--ink-3); font: 500 14px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--ink); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.pager a { display: grid; gap: 4px; padding: 18px 20px; border-radius: var(--r); border: 1px solid var(--line); text-decoration: none; color: var(--ink); background: var(--surface); transition: border-color .15s ease; }
.pager a:hover { color: var(--ink); border-color: var(--brand); }
.pager small { color: var(--ink-3); font-size: 13px; }
.pager strong { font-weight: 600; }
.pager .next { text-align: right; grid-column: 2; }
@media (max-width: 600px) { .pager { grid-template-columns: 1fr; } .pager .next { grid-column: auto; } }

/* --------------------------------------------------------------------------
   Autentifikācija
   -------------------------------------------------------------------------- */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - var(--header-h)); }
.auth-side {
  position: relative; overflow: hidden;
  background: var(--brand); color: #fff;
  padding: 64px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
[data-theme="dark"] .auth-side { background: #13365a; }
.auth-side::after {
  content: ";"; position: absolute; right: 40px; top: 50%; transform: translateY(-55%);
  font: 800 420px/1 var(--font-display); color: rgb(255 255 255 / .07); pointer-events: none;
}
.auth-side h2 { font-size: clamp(30px, 3.2vw, 44px); max-width: 12em; color: #fff; }
.auth-side p { color: rgb(255 255 255 / .85); font-size: 17px; max-width: 28em; margin-top: 16px; }
.auth-side ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.auth-side li { display: flex; gap: 12px; align-items: center; font-size: 16px; }
.auth-side li span { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgb(255 255 255 / .14); font: 700 14px var(--font-mono); flex: none; }
.auth-main { display: grid; place-items: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 36px; margin-bottom: 8px; }
.auth-card > p { color: var(--ink-2); margin-bottom: 32px; }
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field label { font-weight: 600; font-size: 14.5px; display: flex; justify-content: space-between; }
.field label a { font-weight: 500; font-size: 14px; text-decoration: none; }
.input {
  height: 50px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: 16px var(--font); width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder { color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }
.input.invalid { border-color: #d9493e; }
.field-error { color: #d9493e; font-size: 13.5px; }
.form-error { padding: 12px 16px; border-radius: 12px; background: color-mix(in srgb, #d9493e 10%, transparent); color: #c0392b; font-size: 14.5px; }
.hint { font-size: 13px; color: var(--ink-3); }
.check { display: flex; gap: 10px; align-items: center; font-size: 14.5px; color: var(--ink-2); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); }
.divider { display: flex; align-items: center; gap: 14px; color: var(--ink-3); font-size: 13px; margin: 6px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-switch { margin-top: 28px; text-align: center; color: var(--ink-2); font-size: 15px; }
/* Pieslēgšanās ar Google / GitHub / Apple */
.ext-logins { display: grid; gap: 10px; }
.ext-btn { height: 48px; justify-content: center; gap: 12px; font-size: 15px; }
.ext-icon { width: 18px; height: 18px; flex: none; }
.ext-apple .ext-icon { width: 16px; }
.logins-panel, .export-panel { grid-column: 1 / -1; }
.login-methods { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.login-methods li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.login-methods li:first-child { border-top: 0; }
.login-methods .login-name { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; flex: 1; }
.login-methods form { margin: 0; }
.hp { position: absolute !important; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }
.demo-note { margin-top: 24px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-strong); color: var(--ink-3); font-size: 13.5px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; min-height: 0; }
  .auth-side { display: none; }
}

/* --------------------------------------------------------------------------
   Profils
   -------------------------------------------------------------------------- */
.profile-head { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; padding: 48px 0 36px; }
.profile-head h1 { font-size: clamp(30px, 4vw, 42px); }
.profile-head p { color: var(--ink-3); }
.profile-head form { margin-left: auto; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 960px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.stat { padding: 22px 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.stat span { color: var(--ink-3); font-size: 14px; }
.stat strong { display: block; font: 700 40px/1.1 var(--font-display); margin-top: 6px; letter-spacing: -0.02em; }
.stat strong small { font-size: 18px; color: var(--ink-3); font-weight: 600; margin-left: 4px; }
@media (max-width: 700px) { .stats { grid-template-columns: 1fr; } }
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; margin: 24px 0 96px; align-items: start; }
.profile-grid h2 { font-size: 22px; margin-bottom: 16px; }
.pcourse { display: grid; grid-template-columns: 52px 1fr auto; gap: 16px; align-items: center; padding: 18px 0; border-top: 1px solid var(--line); }
.pcourse:first-of-type { border-top: 0; padding-top: 0; }
.pcourse h3 { font-size: 17px; margin-bottom: 8px; }
.pcourse .bar { height: 6px; }
.pcourse .progress-top { margin-bottom: 0; }
.activity { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.activity li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 10px 0; align-items: start; }
.activity .state { width: 24px; height: 24px; background: var(--ok); border-color: var(--ok); color: #fff; }
.activity .state svg { width: 13px; height: 13px; }
.activity a { color: var(--ink); text-decoration: none; font-weight: 600; font-size: 15px; }
.activity a:hover { color: var(--brand); }
.activity small { display: block; color: var(--ink-3); font-size: 13px; }
.empty { text-align: center; padding: 36px 20px; color: var(--ink-2); }
.empty strong { display: block; font-family: var(--font-display); font-size: 20px; color: var(--ink); margin-bottom: 6px; }
@media (max-width: 960px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-actions { margin-left: auto; display: flex; gap: 8px; }
.profile-actions form { margin: 0; }

/* Iestatījumi */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-bottom: 96px; }
.settings-grid .panel { display: grid; gap: 6px; align-content: start; }
.settings-grid h2 { font-size: 21px; }
.settings-grid .form { margin-top: 14px; }
.danger-panel { grid-column: 1 / -1; border-color: color-mix(in srgb, #d9493e 30%, var(--line)); }
.danger-panel details > summary { list-style: none; width: fit-content; margin-top: 10px; }
.danger-panel details > summary::-webkit-details-marker { display: none; }
.danger-panel .form { max-width: 420px; }
.btn-danger { --btn-bg: #d9493e; --btn-ink: #fff; --btn-line: transparent; }
.btn-danger:hover { --btn-bg: #b8382e; }
.btn-danger-ghost { --btn-ink: #c0392b; --btn-line: color-mix(in srgb, #d9493e 40%, transparent); }
.btn-danger-ghost:hover { --btn-bg: color-mix(in srgb, #d9493e 8%, transparent); border-color: #d9493e; color: #c0392b; }
.flash {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; margin-bottom: 20px; border-radius: var(--r);
  background: color-mix(in srgb, var(--ok) 10%, var(--surface)); color: var(--ok);
  border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); font-weight: 600;
}
.flash svg { width: 20px; height: 20px; flex: none; }
.form-error a { color: inherit; font-weight: 600; }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; } .profile-actions { margin-left: 0; } }

/* --------------------------------------------------------------------------
   Projekti
   -------------------------------------------------------------------------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.project-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 22px 24px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--c);
  color: var(--ink); text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}
.project-card:hover { color: var(--ink); transform: translateY(-3px); box-shadow: var(--shadow); }
.project-card h3 { font-size: 21px; }
.project-card p { color: var(--ink-2); font-size: 15px; flex: 1; }
.project-card.is-done { background: color-mix(in srgb, var(--ok) 5%, var(--surface)); }
.project-top { display: flex; justify-content: space-between; align-items: center; }
.project-num { font: 700 15px var(--font-mono); color: var(--c); }
.skill-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.skill-chips span { font-size: 12.5px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); }
.has-tests-meta { color: var(--ok); font-weight: 600; }
.has-tests-meta svg { width: 13px; height: 13px; }
.badge.level-easy { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.level-mid { background: color-mix(in srgb, var(--accent) 20%, transparent); color: #a86400; }
.badge.level-hard { background: color-mix(in srgb, #d9493e 14%, transparent); color: #c0392b; }
[data-theme="dark"] .badge.level-mid { color: #f2b046; }
[data-theme="dark"] .badge.level-hard { color: #ff8a80; }

.project-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; padding-top: 40px; padding-bottom: 96px; align-items: start; }
.project-side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 16px; }
.project-side h2 { font-size: 15px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; }
.project-side h3 { font-size: 14px; margin: 16px 0 8px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; margin: 0; font-size: 14.5px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; }
.side-course { display: flex; align-items: center; gap: 12px; margin-top: 10px; text-decoration: none; color: var(--ink); }
.side-course .course-icon { width: 40px; height: 40px; font-size: 14px; }
.side-course:hover strong { color: var(--brand); }
.prose details { border: 1px solid var(--line); border-radius: var(--r); padding: 4px 18px; background: var(--surface); }
.prose details + details { margin-top: 10px; }
.prose details > summary { cursor: pointer; font-weight: 600; padding: 10px 0; }
.prose details[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.prose ul.contains-task-list { list-style: none; padding-left: 4px; }
.prose .task-list-item input { margin-right: 8px; accent-color: var(--brand); }
@media (max-width: 960px) { .project-layout { grid-template-columns: 1fr; gap: 32px; } .project-side { position: static; } }

.lesson-row.is-project .lesson-num { color: var(--c, var(--brand)); }

/* --------------------------------------------------------------------------
   Vārdnīca
   -------------------------------------------------------------------------- */
/* Saite tekstā uz vārdnīcas terminu */
.prose a.term-link {
  color: inherit; text-decoration: underline dotted; text-decoration-color: var(--brand);
  text-decoration-thickness: 2px; text-underline-offset: 4px; cursor: help;
}
.prose a.term-link:hover { color: var(--brand); text-decoration-style: solid; }
.prose a.term-missing { text-decoration-color: #d9493e; text-decoration-style: wavy; }

.term-pop {
  position: fixed; z-index: 60; display: block;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg);
  padding: 14px 16px; font: 400 14.5px/1.5 var(--font); text-align: left; white-space: normal;
  opacity: 0; transform: translateY(4px); pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.term-pop.show { opacity: 1; transform: none; pointer-events: auto; }
/* Neredzams "tilts" virs kartītes, lai pele, pārvietojoties no saites, to nepazaudētu */
.term-pop::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 10px; }
.term-pop .pop-head { display: block; }
.term-pop strong { font-family: var(--font-display); font-size: 17px; }
.term-pop .en { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-3); margin-left: 6px; }
.term-pop .pop-def { display: block; color: var(--ink-2); margin-top: 4px; }
.term-pop .pop-src { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.term-pop .pop-src a {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; font-weight: 500; text-decoration: none;
}
.term-pop .pop-src a:hover { background: var(--brand-soft); color: var(--brand); }
.term-pop .pop-src .ext { opacity: .6; margin-left: 2px; }
.term-pop .more { display: inline-block; margin-top: 12px; color: var(--brand); font-size: 13.5px; font-weight: 600; text-decoration: none; }
.term-pop .more:hover { text-decoration: underline; }

/* Saraksts */
.gloss-search { margin-top: 28px; max-width: 520px; }
.letters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; }
.letters a { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 14px; }
.letters a:hover { border-color: var(--brand); color: var(--brand); }
.gloss-group { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 22px 0; border-top: 1px solid var(--line); }
.gloss-group[hidden] { display: none; }
.gloss-letter { font-size: 34px; color: var(--brand); }
.gloss-group ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; }
.gloss-group li[hidden] { display: none; }
.gloss-group li a { display: block; height: 100%; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; transition: border-color .15s ease; }
.gloss-group li a:hover { border-color: var(--brand); }
.gloss-title { font-weight: 650; font-size: 16.5px; }
.gloss-group small { display: block; color: var(--ink-2); font-size: 14px; margin-top: 3px; line-height: 1.45; }
@media (max-width: 600px) { .gloss-group { grid-template-columns: 1fr; gap: 8px; } .gloss-group ul { grid-template-columns: 1fr; } }

/* Termina lapa */
.term-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 56px; padding-top: 40px; padding-bottom: 96px; align-items: start; }
.term-head { margin: 18px 0 32px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.term-head h1 { font-size: clamp(40px, 5vw, 60px); margin: 14px 0 8px; }
.term-short { font-size: 19px; color: var(--ink-2); margin-top: 14px; max-width: 36em; }
.term-side { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 16px; }
.term-side h2 { font-size: 15px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 12px; }
.ext-links, .used-in { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ext-links a { display: grid; gap: 1px; padding: 10px 12px; margin: 0 -12px; border-radius: var(--r-sm); text-decoration: none; color: var(--ink); }
.ext-links a:hover { background: var(--surface-2); }
.ext-links span { font-weight: 600; font-size: 15px; }
.ext-links small, .used-in small { color: var(--ink-3); font-size: 13px; display: block; }
.used-in li { padding: 6px 0; }
.used-in a { font-weight: 600; text-decoration: none; }
.term-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.term-chips .chip { text-decoration: none; color: var(--ink); }
.term-chips .chip:hover { border-color: var(--brand); color: var(--brand); }
@media (max-width: 960px) { .term-layout { grid-template-columns: 1fr; gap: 32px; } .term-side { position: static; } }

/* --------------------------------------------------------------------------
   Vienkāršas teksta lapas
   -------------------------------------------------------------------------- */
.text-page { padding: 56px 0 96px; }
.text-page .prose { margin-top: 32px; }
.error-page { padding: 96px 0; text-align: center; display: grid; justify-items: center; gap: 16px; }
.error-code { font: 800 120px/1 var(--font-display); color: var(--brand); letter-spacing: -0.05em; }
.error-code span { color: var(--accent); }
.error-page p { color: var(--ink-2); font-size: 18px; max-width: 30em; }

/* --------------------------------------------------------------------------
   Kājene
   -------------------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); padding: 56px 0 32px; margin-top: auto; }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.footer-grid .logo { height: 52px; margin-bottom: 14px; }
.footer-grid p { color: var(--ink-2); font-size: 15px; max-width: 24em; }
.footer-grid h4 { font: 600 12px var(--font-mono); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 14px; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.footer-grid a { color: var(--ink-2); text-decoration: none; font-size: 15px; }
.footer-grid a:hover { color: var(--brand); }
.footer-bottom { margin-top: 44px; padding-top: 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink-3); font-size: 14px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > :first-child { grid-column: 1 / -1; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
