:root {
  --bg: #f5f3ed;
  --surface: #faf9f5;
  --text: #2a2824;
  --muted: #6f6a60;
  --line: #e3dfd4;
  --code-bg: #efece3;
  --teal: #3fa58a;
  --blue: #3f86d8;
  --yellow: #e0ad1f;
  --pink: #d9649f;
  --accent: var(--teal);
  --accent-soft: rgba(63, 165, 138, .12);
  --radius: 24px;
  --danger: #b0372f;
  --danger-soft: #fbe6e1;
  --star: #d99a1e;
  --heat-0: #e8e4da;
  --heat-1: #bfe3d8;
  --heat-2: #6fc4ab;
  --heat-3: #2f8f76;
  --on-teal: #fff;
  --soft: 0 1px 2px rgba(42, 40, 36, .06), 0 12px 32px rgba(42, 40, 36, .07);
  --soft-sm: 0 1px 2px rgba(42, 40, 36, .08);
  --tile: #ebe7dd;
  --ink: #237a63;
  --btn: #237a63; --btn-text: #fff; --btn-edge: #1a5c4b;
  --kr-bg: #2a2824; --kr-text: #f5f3ed; --kr-muted: #c9c4b7; --kr-accent: #5cc3a6; --kr-field: #3a3832; --kr-on-accent: #10231d;
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
/* Темна тема: за системою, або примусово з налаштувань профілю (data-theme на <html>) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1c1b19;
    --surface: #24231f;
    --text: #ece8de;
    --muted: #a39d90;
    --line: #36342e;
    --code-bg: #2c2a25;
    --teal: #5cc3a6;
    --blue: #6aa8ee;
    --yellow: #f2c94c;
    --pink: #ee8cc0;
    --accent-soft: rgba(92, 195, 166, .14);
    --danger: #f08a7e;
    --danger-soft: #3d2420;
    --star: #f2c94c;
    --heat-0: #2c2a25;
    --heat-1: #1f4a3e;
    --heat-2: #2f8a72;
    --heat-3: #5cc3a6;
    --on-teal: #10231d;
    --soft: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .3);
    --soft-sm: 0 1px 2px rgba(0, 0, 0, .45);
    --tile: #2e2c27; --ink: #5cc3a6;
    --btn: #5cc3a6; --btn-text: #10231d; --btn-edge: #2f8a72;
    --kr-bg: #10231d; --kr-text: #ece8de; --kr-muted: #a8c9bd; --kr-field: #1b3a31;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1c1b19;
  --surface: #24231f;
  --text: #ece8de;
  --muted: #a39d90;
  --line: #36342e;
  --code-bg: #2c2a25;
  --teal: #5cc3a6;
  --blue: #6aa8ee;
  --yellow: #f2c94c;
  --pink: #ee8cc0;
  --accent-soft: rgba(92, 195, 166, .14);
  --danger: #f08a7e;
  --danger-soft: #3d2420;
  --star: #f2c94c;
  --heat-0: #2c2a25;
  --heat-1: #1f4a3e;
  --heat-2: #2f8a72;
  --heat-3: #5cc3a6;
  --on-teal: #10231d;
  --soft: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px rgba(0, 0, 0, .3);
  --soft-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --tile: #2e2c27; --ink: #5cc3a6;
  --btn: #5cc3a6; --btn-text: #10231d; --btn-edge: #2f8a72;
  --kr-bg: #10231d; --kr-text: #ece8de; --kr-muted: #a8c9bd; --kr-field: #1b3a31;
  color-scheme: dark;
}
.accent-1 { --accent: var(--teal); --accent-soft: color-mix(in srgb, var(--teal) 13%, transparent); }
.accent-2 { --accent: var(--blue); --accent-soft: color-mix(in srgb, var(--blue) 13%, transparent); }
.accent-3 { --accent: var(--yellow); --accent-soft: color-mix(in srgb, var(--yellow) 16%, transparent); }
.accent-0 { --accent: var(--pink); --accent-soft: color-mix(in srgb, var(--pink) 13%, transparent); }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
:root[data-font="large"] body { font-size: 18.5px; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; min-height: 100vh;
  display: flex; flex-direction: column;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
}
a { color: var(--blue); }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; margin: 0 auto;
  padding: 18px 16px 6px; max-width: 1120px; padding-top: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-size: 20px; letter-spacing: -.01em; }
.brand b { color: var(--teal); }
.alpha-badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  background: var(--yellow); color: #2a2824;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; line-height: 1.3;
  align-self: center; white-space: nowrap;
}
.top-link { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; padding: 8px 14px; border-radius: 999px; }
.top-link:hover { background: var(--surface); color: var(--text); box-shadow: var(--soft-sm); }

.wrap { width: 100%; margin: 0 auto; padding: 8px 16px 40px; flex: 1; max-width: 1120px; }
.foot { text-align: center; color: var(--muted); font-size: 13px; padding: 24px 16px 32px; }

.card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--soft);
}

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); margin: 8px 4px 16px; font-size: 13.5px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }

.kicker {
  margin: 0 0 6px; font-weight: 700; text-transform: uppercase; font-family: var(--mono); font-size: 13px;
  letter-spacing: .04em; color: var(--accent-ink, var(--ink));
}
h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 0 0 8px; font-weight: 800; letter-spacing: -.03em; }
.subtitle { margin: 0 0 22px; color: var(--muted); font-style: normal; font-size: 17px; }
.lead { font-size: 18px; color: var(--muted); max-width: 640px; }

.btn {
  display: inline-flex; align-items: center; gap: 10px; border: 0; color: var(--text); font: inherit;
  text-decoration: none; cursor: pointer; border-radius: 14px; background: var(--tile); box-shadow: none;
  padding: 12px 20px; font-weight: 700; transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: none; }
.btn.primary { background: var(--btn); color: var(--btn-text); box-shadow: 0 4px 0 var(--btn-edge); }

/* home */
.hero { padding: clamp(24px, 5vw, 44px); margin-bottom: 36px; }
.hero h1 { max-width: 640px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.section-title { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 2px 16px; }
.modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.mod {
  display: flex; color: var(--text); text-decoration: none; transition: transform .15s ease; align-items: center;
  gap: 16px; padding: 16px 18px; border-radius: 20px; box-shadow: var(--soft-sm);
}
a.mod:hover { transform: translateY(-2px); box-shadow: var(--soft); }
.mod h3 { margin: 0; line-height: 1.3; font-size: 16.5px; }
.mod p { margin: 2px 0 0; color: var(--muted); line-height: 1.4; font-size: 13.5px; }
.mod .mod-meta { margin-top: 2px; font-weight: 500; color: var(--muted); }
.mod.soon { opacity: 1; box-shadow: none; background: transparent; border: 1.5px dashed var(--line); color: var(--muted); }
.mod.soon .mod-meta { color: var(--muted); font-weight: 500; }
.mod-done:not(:empty)::before { content: "· "; }

/* module page */
.module-head { padding: clamp(24px, 5vw, 40px); margin-bottom: 26px; box-shadow: var(--soft); }
.module-head > p:last-child { margin-bottom: 0; }
.lessons { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.lesson {
  display: flex; align-items: center; gap: 16px; color: var(--text); text-decoration: none;
  transition: transform .15s ease; border-radius: 18px; box-shadow: var(--soft-sm); padding: 14px 16px;
}
.lesson:hover { transform: translateX(3px); box-shadow: var(--soft); }
.l-num {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; font-weight: 800; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent-ink); font-family: var(--mono); box-shadow: none;
}
.lessons { --accent: var(--teal); --accent-soft: color-mix(in srgb, var(--teal) 13%, transparent); gap: 10px; }
.l-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.l-text small { color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 2px; }
.l-check { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: transparent; border: 2px solid var(--line); flex: none; }
.lesson.is-done .l-check { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }

/* lesson content */
.prose { padding: clamp(22px, 5vw, 48px); }
.prose h2 {
  margin: 40px 0 14px; padding-top: 4px; display: flex; align-items: center; gap: 10px; font-size: 23px;
  font-weight: 800; letter-spacing: -.015em;
}
.prose h2::before { content: ""; background: var(--accent); width: 12px; height: 12px; border-radius: 4px; }
.prose h3 { font-size: 19px; margin: 28px 0 10px; }
.prose p, .prose li { max-width: 72ch; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: 4px 0; }
.prose strong { font-weight: 700; }
.prose del { color: var(--muted); }
.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .92em;
  background: var(--code-bg); padding: .12em .4em; border-radius: 6px;
}
.prose pre {
  background: var(--code-bg); padding: 16px 20px; overflow-x: auto; line-height: 1.45; display: inline-block;
  min-width: min(100%, 260px); max-width: 100%; margin: 6px 0 14px; border-radius: 16px;
}
.prose pre code { background: none; padding: 0; font-size: 17px; }
.prose blockquote {
  margin: 18px 0; border-left: 0; border-radius: 16px; background: var(--accent-soft); padding: 12px 18px;
}
.prose blockquote p { margin: 6px 0; }
.table-wrap { overflow-x: auto; margin: 14px 0 20px; border-radius: 16px; border: 0; box-shadow: inset 0 0 0 1.5px var(--line); }
.prose table { border-collapse: collapse; width: 100%; font-size: 15.5px; }
.prose th, .prose td { padding: 9px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose tr:last-child td { border-bottom: 0; }
.prose th { font-weight: 700; white-space: nowrap; background: var(--tile); }
.prose details { border: 0; box-shadow: none; border-radius: 16px; background: var(--tile); padding: 0 18px; margin: 16px 0; }
.prose details[open] { padding-bottom: 14px; }
.prose summary { cursor: pointer; font-weight: 700; color: var(--ink); padding: 14px 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }

.done-row { margin-top: 36px; border-top: 0; padding-top: 6px; }
.done-btn.is-done { background: var(--accent-soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--teal); }

.pager { display: flex; justify-content: space-between; gap: 14px; margin-top: 28px; }
.pager .btn { max-width: 48%; border-radius: 16px; }
.pager .btn span { display: flex; flex-direction: column; line-height: 1.3; }
.pager .btn small { font-weight: 500; opacity: .75; font-size: 13px; }
.pager .btn.primary { text-align: right; margin-left: auto; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .pager { flex-direction: column; }
  .pager .btn { max-width: none; }
}

/* =====================================================================
   Акаунт: шапка, реєстрація, вхід, профіль, інструменти під уроком
   ===================================================================== */
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* шапка */
.top-right { display: flex; align-items: center; gap: 6px; }
.account { display: flex; align-items: center; gap: 8px; }
.btn.btn-sm { font-size: 15px; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer;
  background: var(--surface); color: var(--muted);
}
.icon-btn:hover { color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.user-chip {
  display: flex; align-items: center; gap: 8px; padding: 4px 14px 4px 4px; border-radius: 999px;
  color: var(--text); text-decoration: none; font-weight: 650; font-size: 15px; background: var(--surface);
}
@media (max-width: 600px) {
  .hide-sm, .user-chip-name { display: none; }
  .user-chip { padding: 4px; }
  .brand span:not(.alpha-badge) { font-size: 18px; }
}
@media (max-width: 400px) {
  .brand span:not(.alpha-badge) { display: none; }
  /* на вузькому екрані лишається лише «α», повний текст — для екранних читачів і в підказці */
  .alpha-badge { font-size: 0; letter-spacing: 0; padding: 2px 7px; }
  .alpha-badge::after { content: "α"; font-size: 13px; text-transform: none; }
}

/* аватар */
.avatar {
  display: inline-grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; overflow: hidden;
  flex: none; line-height: 1; user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* картки на сторінках акаунта */
.account-page .card { padding: clamp(18px, 4vw, 28px); margin-bottom: 20px; }
.account-page h2 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.01em; }
.account-page h3 { font-size: 18px; margin: 0 0 12px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card-title h3 { margin: 0; }
.card-title a { font-size: 14px; }

/* форми */
.field { margin-bottom: 16px; }
.field label, .label { display: block; font-weight: 650; margin-bottom: 6px; font-size: 15px; }
.hint { color: var(--muted); font-size: 13.5px; margin: 6px 0 0; }
input[type="text"], input[type="email"], input[type="password"], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text); padding: 11px 14px; min-height: 46px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; box-shadow: none;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal); outline-offset: 1px; }
input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 14px; margin: 6px 0 0; }
.field-error:empty { display: none; }
.check, .field label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; cursor: pointer; margin: 0; }
.check input { width: 19px; height: 19px; margin-top: 3px; accent-color: var(--teal); flex: none; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 100px; }
.pw-toggle {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%); font: inherit; font-size: 13px; font-weight: 650;
  border: 0; background: var(--surface); color: var(--muted); padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.strength { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.strength span { height: 5px; border-radius: 3px; background: var(--line); }
.strength[data-level="1"] span:nth-child(-n+1) { background: var(--danger); }
.strength[data-level="2"] span:nth-child(-n+2) { background: var(--yellow); }
.strength[data-level="3"] span:nth-child(-n+3) { background: var(--teal); }
.strength[data-level="4"] span { background: var(--teal); }
.alert { border-radius: 14px; padding: 12px 16px; margin-bottom: 16px; font-size: 15px; }
.alert:empty { display: none; }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-info { background: var(--accent-soft); }
.btn-block { width: 100%; justify-content: center; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn.btn-danger { background: var(--danger); color: var(--surface); }
.btn.btn-danger-ghost { color: var(--danger); }

/* реєстрація й вхід — див. «Екран входу» нижче */
.steps { display: flex; gap: 8px; margin-bottom: 18px; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--teal); }
.choice-grid { display: grid; gap: 10px; }
.choice, .field label.choice {
  display: flex; gap: 12px; align-items: center; font-weight: 500; margin: 0; padding: 12px 14px; border-radius: 14px; cursor: pointer;
  background: var(--surface);
}
.choice input { accent-color: var(--teal); width: 18px; height: 18px; flex: none; }
.choice:has(input:checked) { color: var(--teal); box-shadow: inset 0 0 0 2px var(--teal); }

/* профіль: шапка й вкладки */
.profile-head { display: flex; gap: 20px; align-items: center; padding: 8px 4px 4px; flex-wrap: wrap; }
.profile-head h1 { margin: 0; font-size: clamp(26px, 4vw, 34px); }
.profile-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 14px; margin-top: 6px; }
.profile-head .actions { margin-left: auto; display: flex; gap: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--teal); }
.profile-page .alert-info { margin-top: 14px; }
.tabs {
  display: flex; gap: 4px; margin: 22px 0 22px; padding: 6px; border-radius: 999px; overflow-x: auto; scrollbar-width: none;
  background: var(--bg);
}
.tabs button {
  font: inherit; font-size: 15px; font-weight: 650; background: none; border: 0; color: var(--muted);
  padding: 9px 16px; border-radius: 999px; cursor: pointer; white-space: nowrap;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); }
.tab-panel[hidden] { display: none; }
.grid-2 { display: grid; grid-template-columns: 1.35fr 1fr; gap: 0 20px; align-items: start; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* огляд */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat {
  background: var(--surface); border-radius: 18px; padding: 14px 16px;
}
.stat b { display: block; font-size: 26px; line-height: 1.15; font-family: var(--mono); }
.stat span { color: var(--muted); font-size: 13.5px; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.continue { display: flex; gap: 22px; align-items: center; }
.continue .grow { flex: 1; min-width: 0; }
@media (max-width: 520px) { .continue { flex-direction: column; align-items: flex-start; } }
.ring {
  --p: 0; width: 116px; height: 116px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--line) 0);
}
.ring::before { content: ""; grid-area: 1 / 1; width: 88px; height: 88px; border-radius: 50%; background: var(--surface); }
.ring b { grid-area: 1 / 1; font-size: 24px; position: relative; }
.bar { height: 9px; border-radius: 5px; overflow: hidden; box-shadow: none; background: var(--tile); }
.bar > span { display: block; height: 100%; background: var(--teal); border-radius: 5px; transition: width .3s; }
.module-progress { display: grid; gap: 14px; }
.mp-head { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; margin-bottom: 5px; }
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; overflow-x: auto; padding-bottom: 4px; }
.heatmap i { width: 13px; height: 13px; border-radius: 3px; background: var(--heat-0); }
.heatmap i[data-l="1"] { background: var(--heat-1); }
.heatmap i[data-l="2"] { background: var(--heat-2); }
.heatmap i[data-l="3"] { background: var(--heat-3); }
.heatmap i.future { visibility: hidden; }
.legend { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.goal-today { display: flex; gap: 8px; margin-top: 10px; }
.goal-today span { width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.goal-today span.on { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.badge {
  border-radius: 18px; padding: 16px 12px; text-align: center; background: var(--surface);
}
.badge .b-ico { font-size: 30px; display: block; margin-bottom: 6px; }
.badge b { display: block; font-size: 15px; line-height: 1.3; }
.badge span { font-size: 13px; color: var(--muted); line-height: 1.35; display: block; margin-top: 2px; }
.badge.locked { opacity: .55; box-shadow: none; border: 1.5px dashed var(--line); }
.badge.locked .b-ico { filter: grayscale(1); }

/* прогрес, нотатки, обране */
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.lesson-row:last-child { border-bottom: 0; }
.lesson-row .lr-title { flex: 1; min-width: 0; line-height: 1.35; }
.lesson-row .lr-title a { color: var(--text); text-decoration: none; font-weight: 650; }
.lesson-row .lr-title a:hover { color: var(--teal); }
.lesson-row .lr-title small { display: block; color: var(--muted); font-size: 13.5px; }
.lesson-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--teal); flex: none; }
.lesson-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; flex: none; background: var(--accent-soft); color: var(--teal); }
.lesson-num.done { background: var(--teal); color: var(--on-teal); }
.tag { font-size: 12px; font-weight: 650; padding: 2px 10px; border-radius: 999px; background: var(--line); color: var(--muted); white-space: nowrap; }
.star-btn { background: none; border: 0; font-size: 20px; cursor: pointer; padding: 4px; line-height: 1; color: var(--muted); }
.star-btn[aria-pressed="true"] { color: var(--star); }
.note-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.note-item:last-child { border-bottom: 0; }
.note-item p { white-space: pre-wrap; margin: 4px 0 0; }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; margin: 0; }

/* редагування профілю */
.avatar-editor { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.seg {
  display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 5px; border-radius: 999px; background: var(--bg);
}
.seg button { font: inherit; font-size: 15px; font-weight: 600; border: 0; background: transparent; color: var(--muted); padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 42px); gap: 8px; }
@media (max-width: 460px) { .emoji-grid { grid-template-columns: repeat(6, 42px); } }
.emoji-grid button {
  width: 42px; height: 42px; border-radius: 12px; border: 0; background: var(--surface); font-size: 22px;
  cursor: pointer; box-shadow: var(--soft-sm);
}
.emoji-grid button[aria-pressed="true"] { outline: 2px solid var(--teal); box-shadow: none; }
.color-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.color-grid button { width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; }
.color-grid button[aria-pressed="true"] { outline: 3px solid var(--text); outline-offset: 2px; }

/* налаштування */
.setting { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.setting:last-child { border-bottom: 0; }
.setting p { margin: 0; }
.danger-zone h3 { color: var(--danger); }

/* під уроком */
.lesson-tools:empty { display: none; }
.lesson-tools { margin-top: 22px; }
.tools-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tools-teaser { padding: 16px 18px; border-radius: 16px; background: var(--accent-soft); }
.tools-teaser p { margin: 0; }
.tools-teaser .hero-actions { margin-top: 12px; }

/* повідомлення */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg);
  padding: 12px 20px; opacity: 0; pointer-events: none; z-index: 50; font-weight: 650;
  transition: opacity .2s, transform .2s; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
  border-radius: 16px; text-align: center; line-height: 1.35;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { background: var(--teal); color: var(--on-teal); }
.toast.error { background: var(--danger); color: var(--surface); }
.btn-row .btn { justify-content: center; }

/* =====================================================================
   Адмінка (/admin): огляд, учні, уроки, журнал
   ===================================================================== */
.icon-btn.admin-link { color: var(--teal); text-decoration: none; }
.admin-head .actions { align-self: center; }
.stat small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.stats-sm { gap: 10px; margin: 16px 0; }
.stats-sm .stat { padding: 10px 12px; }
.stats-sm .stat b { font-size: 21px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 20px; align-items: start; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }
.dist { display: grid; gap: 12px; }
.d-row .mp-head { font-size: 14px; }
.d-row .mp-head .muted { white-space: nowrap; }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.lockouts { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 8px; }
.lockouts li { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; word-break: break-all; }

/* діаграма: тонкі стовпчики з 2px проміжком, заокруглення лише зверху, ледь помітна сітка */
.chart { position: relative; }
.c-plot { position: relative; height: 150px; margin-left: 30px; border-bottom: 1px solid var(--line); }
.c-grid span { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--line); }
.c-grid b { position: absolute; right: calc(100% + 6px); top: -9px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.c-bars { position: absolute; inset: 0; display: flex; align-items: stretch; gap: 2px; }
.c-col {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; padding: 0; border: 0; background: none; cursor: default; border-radius: 4px 4px 0 0;
}
.c-col i { display: block; width: 100%; max-width: 22px; margin: 0 auto; background: var(--teal); border-radius: 4px 4px 0 0; transition: opacity .12s; }
.c-bars:hover .c-col i, .c-bars:focus-within .c-col i { opacity: .55; }
.c-col.hover i, .c-col:focus i { opacity: 1 !important; }
.c-col:hover, .c-col.hover { background: var(--accent-soft); }
.c-col:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }
.c-axis { display: flex; justify-content: space-between; margin: 6px 0 0 30px; font-size: 12px; color: var(--muted); }
.c-table { margin-top: 10px; font-size: 14px; }
.c-table summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.c-table .table-wrap { max-height: 240px; overflow-y: auto; }
.c-table table { width: 100%; border-collapse: collapse; }
.c-table td, .c-table th { padding: 6px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.chart-tip {
  position: fixed; z-index: 60; pointer-events: none; padding: 8px 12px; border-radius: 12px; font-size: 14px; line-height: 1.35;
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.chart-tip small { display: block; color: var(--muted); font-size: 12.5px; }

/* список учнів */
.admin-toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.admin-toolbar .field { margin-bottom: 10px; min-width: 170px; }
.admin-toolbar .grow { flex: 1; min-width: 220px; }
.admin-list.card { padding: 6px; }
.admin-list .empty { padding: 26px 8px; }
.admin-list[aria-busy="true"] { opacity: .6; }
.u-row {
  display: grid; grid-template-columns: 40px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: center;
  width: 100%; padding: 12px 14px; border: 0; border-radius: 16px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.u-row + .u-row { border-top: 1px solid var(--line); }
.u-row:hover, .u-row:focus-visible { background: var(--bg); border-radius: 16px; }
.u-row:focus-visible { outline: 2px solid var(--teal); }
.u-main, .u-progress, .u-dates { display: grid; gap: 3px; min-width: 0; line-height: 1.35; }
.u-main b { font-weight: 650; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.u-main small, .u-dates small, .u-progress small { color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-dates b { color: var(--text); font-weight: 600; }
.u-row .pill, .u-row .tag { font-size: 11.5px; padding: 1px 9px; }
@media (max-width: 720px) {
  .u-row { grid-template-columns: 40px minmax(0, 1fr); gap: 6px 12px; }
  .u-progress, .u-dates { grid-column: 2; }
  .u-dates { display: flex; flex-wrap: wrap; gap: 0 12px; }
  .u-dates small { white-space: normal; }
}
.admin-pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 4px 0 20px; }
.admin-pager:empty { display: none; }

/* уроки */
.table-wrap.plain { border: 0; margin: 0; }
.lesson-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.lesson-table th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; white-space: nowrap; }
.lesson-table td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.lesson-table td.num, .lesson-table th:nth-child(n+4) { text-align: right; white-space: nowrap; }
.lesson-table .lt a { color: var(--text); font-weight: 650; text-decoration: none; }
.lesson-table .lt a:hover { color: var(--teal); }
.lesson-table .lt small { display: block; color: var(--muted); font-size: 13px; }
.mini { display: grid; grid-template-columns: 90px auto 40px; gap: 8px; align-items: center; justify-content: end; }
.mini .muted { font-size: 13px; }
@media (max-width: 560px) { .mini { grid-template-columns: auto 34px; } .mini .bar { display: none; } }

/* журнал */
.log-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) auto; gap: 12px; padding: 12px 14px; align-items: baseline; font-size: 15px; }
.log-row + .log-row { border-top: 1px solid var(--line); }
.log-time { color: var(--muted); font-size: 13.5px; }
.log-main { min-width: 0; overflow-wrap: anywhere; }
.log-main small { display: block; color: var(--muted); font-size: 13.5px; }
.log-who { overflow-wrap: anywhere; }
@media (max-width: 640px) { .log-row { grid-template-columns: 1fr; gap: 2px; } }

/* картка учня */
.admin-dialog {
  width: min(760px, calc(100% - 24px)); max-height: min(92dvh, 1000px); padding: 0; border: 1px solid var(--line); border-radius: 24px;
  background: var(--surface); color: var(--text); box-shadow: 0 12px 50px rgba(0, 0, 0, .25); overflow: auto;
}
.admin-dialog[open] { animation: sheet-up .25s cubic-bezier(.2, .8, .3, 1); }
.admin-dialog::backdrop { background: rgba(28, 27, 25, .42); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.ud-body { padding: clamp(18px, 4vw, 28px); }
.ud-body h3 { font-size: 17px; margin: 24px 0 10px; }
.ud-head { display: flex; gap: 16px; align-items: flex-start; }
.ud-head .grow { flex: 1; min-width: 0; }
.ud-head h2 { margin: 0; font-size: 24px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ud-head p { margin: 2px 0 0; overflow-wrap: anywhere; }
.ud-head .icon-btn { font-size: 24px; line-height: 1; color: var(--text); flex: none; }
.ud-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px !important; }
.ud-meta { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; margin: 0; }
.ud-meta dt { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ud-meta dd { margin: 0; font-size: 15px; }
.ud-bio { font-style: italic; color: var(--muted); margin: 14px 0 0; }
.ud-body .heatmap { justify-content: start; }
.ud-notes { margin-top: 20px; }
.ud-notes summary { cursor: pointer; font-weight: 650; }
.ud-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ud-danger { margin-top: 20px; padding: 14px 16px 16px; border-radius: 16px; border: 1px solid var(--danger-soft); background: color-mix(in srgb, var(--danger-soft) 45%, transparent); }
.ud-danger h3 { margin: 0 0 10px; color: var(--danger); }
.ud-history { border: 1px solid var(--line); border-radius: 16px; }
.temp-pass { margin-top: 12px; }
.temp-pass p { margin: 0 0 6px; }
.tp-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tp-row code { font-size: 20px; font-weight: 700; letter-spacing: .04em; padding: 4px 12px; border-radius: 10px; background: var(--surface); user-select: all; }
@media (prefers-reduced-motion: reduce) { .admin-dialog[open] { animation: none; } }

/* =====================================================================
   Екран входу й реєстрації: окреме вікно з анімаціями
   ===================================================================== */
@view-transition { navigation: auto; } /* плавний перехід між /login і /register (Chrome, Edge, Safari 18+) */
.auth-body { overflow-x: hidden; }
.auth-bg { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob {
  position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%;
  filter: blur(70px); opacity: .32; animation: blob-move 24s ease-in-out infinite alternate;
}
.b1 { background: var(--teal); top: -20vmax; left: -14vmax; }
.b2 { background: var(--yellow); bottom: -22vmax; right: -16vmax; opacity: .26; animation-delay: -8s; animation-duration: 28s; }
.b3 { background: var(--blue); top: 38%; left: 62%; width: 26vmax; height: 26vmax; opacity: .14; animation-delay: -14s; }
@keyframes blob-move {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(7vmax, 5vmax) scale(1.14); }
  100% { transform: translate(-5vmax, 9vmax) scale(.94); }
}
.sym {
  position: absolute; bottom: -12vh; left: var(--x); font-size: var(--s); font-weight: 800; line-height: 1;
  color: var(--c); opacity: 0; animation: sym-rise var(--d) linear var(--delay) infinite; will-change: transform;
}
@keyframes sym-rise {
  0%   { transform: translateY(0) rotate(0); opacity: 0; }
  12%  { opacity: var(--o); }
  85%  { opacity: var(--o); }
  100% { transform: translateY(-125vh) rotate(var(--r)); opacity: 0; }
}

.auth-corner { position: fixed; top: 14px; right: 16px; z-index: 3; }
.auth-shell {
  position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 56px 16px 28px;
}
.auth-foot { margin: 0; color: var(--muted); font-size: 13px; text-align: center; animation: fade-up .6s ease .9s both; }

.auth-card {
  width: 100%; max-width: 430px; padding: clamp(24px, 6vw, 36px); border-radius: 30px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.2); backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
  box-shadow: var(--soft);
  animation: card-in .8s cubic-bezier(.2, .9, .25, 1.15) both;
  view-transition-name: auth-card;
}
.auth-card.wide { max-width: 480px; }
@keyframes card-in { from { opacity: 0; transform: translateY(36px) scale(.95); } to { opacity: 1; transform: none; } }
.auth-card.shake { animation: shake .5s cubic-bezier(.36, .07, .19, .97) both; }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-9px); } 40%, 60% { transform: translateX(9px); }
}
.auth-card.leaving { animation: card-out .6s cubic-bezier(.5, 0, .75, 0) .15s both; }
@keyframes card-out { to { opacity: 0; transform: translateY(-24px) scale(1.04); filter: blur(4px); } }

/* логотип: квадрат з'являється, «+» закручується, «×» підстрибує й час від часу підморгує */
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 12px; text-decoration: none; color: var(--text); font-size: 22px; margin-bottom: 20px; }
.auth-logo b { color: var(--teal); }
.logo-anim { flex: none; overflow: visible; width: 56px; height: 56px; stroke-linecap: round; }
.logo-anim .la-bg { fill: #3fa58a; stroke: none; }
.logo-anim .la-plus { stroke: #fff; stroke-width: 6; fill: none; }
.logo-anim .la-times { stroke: #f6c945; stroke-width: 6; fill: none; }
.logo-anim .la-bg, .logo-anim .la-plus, .logo-anim .la-times { transform-box: fill-box; transform-origin: center; }
.logo-anim .la-bg { animation: logo-pop .6s cubic-bezier(.3, 1.6, .5, 1) .15s both; }
.logo-anim .la-plus { animation: plus-spin .8s cubic-bezier(.3, 1.4, .5, 1) .35s both; }
.logo-anim .la-times { animation: times-pop .6s cubic-bezier(.3, 1.8, .5, 1) .6s both, times-wink 5s ease-in-out 2s infinite; }
@keyframes logo-pop { from { transform: scale(.3) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes plus-spin { from { transform: rotate(-180deg) scale(0); } to { transform: none; } }
@keyframes times-pop { from { transform: scale(0); } to { transform: none; } }
@keyframes times-wink { 0%, 86%, 100% { transform: none; } 90% { transform: rotate(90deg) scale(1.2); } 95% { transform: rotate(90deg); } }
.auth-logo:hover .la-plus { animation: plus-spin .7s cubic-bezier(.3, 1.4, .5, 1) both; }

/* перемикач «Вхід | Реєстрація» з повзунком */
.auth-tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 999px; margin-bottom: 24px;
  background: var(--tile);
}
.auth-tabs a {
  position: relative; z-index: 1; text-align: center; padding: 9px 12px; border-radius: 999px;
  font-weight: 700; font-size: 15px; color: var(--muted); text-decoration: none; transition: color .3s;
}
.auth-tabs a[aria-current="page"] { color: var(--text); }
.auth-tabs-pill {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px); border-radius: 999px; background: var(--surface);
  box-shadow: var(--soft-sm);
  transition: transform .45s cubic-bezier(.3, 1.3, .5, 1); view-transition-name: auth-tab;
}
.auth-tabs.is-right .auth-tabs-pill { transform: translateX(100%); }
.auth-tabs.go-right .auth-tabs-pill { transform: translateX(100%); }
.auth-tabs.go-left .auth-tabs-pill { transform: none; }

/* поява елементів по черзі */
.stagger > * { animation: fade-up .55s cubic-bezier(.2, .8, .3, 1) both; }
.stagger > *:nth-child(1) { animation-delay: .30s; }
.stagger > *:nth-child(2) { animation-delay: .38s; }
.stagger > *:nth-child(3) { animation-delay: .46s; }
.stagger > *:nth-child(4) { animation-delay: .54s; }
.stagger > *:nth-child(5) { animation-delay: .62s; }
.stagger > *:nth-child(6) { animation-delay: .70s; }
.stagger > *:nth-child(7) { animation-delay: .78s; }
.stagger > *:nth-child(n+8) { animation-delay: .86s; }
@keyframes fade-up { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
#login-form > .field, #step-1 > * { animation: fade-up .5s cubic-bezier(.2, .8, .3, 1) both; }
#login-form > :nth-child(1), #step-1 > :nth-child(1) { animation-delay: .62s; }
#login-form > :nth-child(2), #step-1 > :nth-child(2) { animation-delay: .70s; }
#login-form > :nth-child(3), #step-1 > :nth-child(3) { animation-delay: .78s; }
#step-1 > :nth-child(4) { animation-delay: .86s; }
#step-1 > :nth-child(5) { animation-delay: .94s; }

.auth-title { font-size: clamp(26px, 6vw, 32px); margin: 0 0 6px; text-align: center; }
.auth-sub { margin: 0 0 20px; color: var(--muted); text-align: center; font-size: 15.5px; line-height: 1.5; }
.wave { display: inline-block; transform-origin: 70% 70%; animation: wave 2.4s ease-in-out 1.2s 2; }
@keyframes wave { 0%, 60%, 100% { transform: none; } 10%, 30% { transform: rotate(16deg); } 20%, 40% { transform: rotate(-10deg); } }
.auth-switch { text-align: center; margin: 20px 0 0; color: var(--muted); font-size: 15px; }
.auth-switch a { color: var(--teal); font-weight: 700; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.forgot { font-size: 14px; }
.forgot summary { cursor: pointer; color: var(--teal); font-weight: 650; list-style: none; }
.forgot summary::-webkit-details-marker { display: none; }
.forgot p { margin: 8px 0 0; color: var(--muted); max-width: 300px; }
.perks { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; padding: 0; margin: 0 0 20px; }
.perks li {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 13.5px; font-weight: 650;
  background: var(--accent-soft); color: var(--text);
}
.perks li span { display: inline-block; animation: perk-bob 3s ease-in-out infinite; }
.perks li:nth-child(2) span { animation-delay: .4s; }
.perks li:nth-child(3) span { animation-delay: .8s; }
.perks li:nth-child(4) span { animation-delay: 1.2s; }
@keyframes perk-bob { 0%, 100% { transform: none; } 50% { transform: translateY(-3px) scale(1.12); } }
.step-label { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.step { border: 0; padding: 0; margin: 0; min-width: 0; }
.step.from-right { animation: step-r .4s cubic-bezier(.2, .8, .3, 1) both; }
.step.from-left { animation: step-l .4s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes step-r { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes step-l { from { opacity: 0; transform: translateX(-40px); } to { opacity: 1; transform: none; } }
.steps span { transition: background .4s; }

/* поля з іконкою */
.input-ico { position: relative; }
.input-ico > svg {
  position: absolute; left: 15px; top: 23px; transform: translateY(-50%); width: 19px; height: 19px; stroke-width: 2;
  color: var(--muted); pointer-events: none; transition: color .25s, transform .25s; z-index: 1;
}
.input-ico input { padding-left: 46px; transition: box-shadow .25s, border-color .25s; }
.input-ico:focus-within > svg { color: var(--teal); transform: translateY(-50%) scale(1.12); }
.auth-card input:focus {
  outline: none; border-color: var(--teal);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 22%, transparent);
}

/* кнопка: відблиск, завантаження, успіх */
.auth-submit { position: relative; overflow: hidden; justify-content: center; min-height: 50px; font-size: 16.5px; }
.auth-submit::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .45), transparent); transform: skewX(-20deg);
}
.auth-submit:hover::after { animation: shine .9s ease; }
@keyframes shine { to { left: 130%; } }
.auth-submit .spinner {
  display: none; width: 20px; height: 20px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--on-teal) 35%, transparent); border-top-color: var(--on-teal); animation: spin .8s linear infinite;
}
.auth-submit.is-loading .label { display: none; }
.auth-submit.is-loading .spinner { display: block; }
.auth-submit.is-done { animation: done-pop .45s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes done-pop { 50% { transform: scale(1.06); } }
.auth-card .alert { animation: fade-up .35s ease both; }

@media (max-width: 480px) {
  .auth-shell { padding-top: 64px; justify-content: flex-start; }
  .auth-card { border-radius: 24px; }
  .auth-logo { font-size: 20px; }
}

/* Закритий доступ (/lernraum, site/lernraum.js): замок, що труситься на «ні» й відкривається на «так» */
.lock-badge { width: 76px; height: 76px; margin: -4px auto 14px; border-radius: 22px; display: grid; place-items: center;
  background: var(--accent-soft); animation: lock-in .6s cubic-bezier(.3, 1.6, .5, 1) .2s both; }
.lock-badge svg { width: 44px; height: 44px; overflow: visible; }
.lock-badge .lock-body { fill: var(--teal); }
.lock-badge .lock-hole { fill: var(--surface); }
.lock-badge .lock-shackle { fill: none; stroke: var(--text); stroke-width: 4.5; stroke-linecap: round;
  transform-box: fill-box; transform-origin: 100% 100%; transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.lock-badge.unlocked { background: rgba(224, 173, 31, .18); }
.lock-badge.unlocked .lock-shackle { transform: translateY(-5px) rotate(28deg); }
.lock-badge.unlocked .lock-body { fill: var(--yellow); }
.lock-badge.jiggle { animation: lock-jiggle .5s ease both; }
@keyframes lock-in { from { opacity: 0; transform: scale(.4) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes lock-jiggle { 0%, 100% { transform: none; } 20% { transform: rotate(-12deg); } 40% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 80% { transform: rotate(3deg); } }
.lock-view[hidden] { display: none; }
.lock-view .btn-block + .btn-block { margin-top: 10px; }
.lock-note { margin: 12px 0 0; text-align: center; color: var(--muted); font-size: 13.5px; }
.lock-help { margin-top: 12px; text-align: center; }
.lock-help p { margin-left: auto; margin-right: auto; }
.lock-who { margin: 22px 0 0; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--teal); font-weight: 700; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }

/* хто вимкнув анімації в системі — бачить усе одразу і без руху */
@media (prefers-reduced-motion: reduce) {
  .blob, .sym, .wave, .perks li span, .logo-anim *, .auth-card, .auth-card.leaving, .auth-foot,
  .stagger > *, .lock-badge, .lock-badge.jiggle, #login-form > .field, #step-1 > *, .step.from-left, .step.from-right, .auth-card .alert { animation: none !important; }
  .sym { opacity: var(--o); bottom: auto; top: calc(var(--x) * .9); }
  .auth-tabs-pill, .lock-badge .lock-shackle { transition: none; }
}

/* Довгі німецькі слова (neunhundertneunundneunzigtausend…) переносяться, а не розпирають сторінку на телефоні. */
.prose { overflow-wrap: break-word; padding: clamp(22px, 5vw, 44px); }

/* =====================================================================
   Нижня панель на телефоні — як у Lernraum: іконка + коротка назва,
   активний розділ підсвічений, «Ще» відкриває знизу вікно з рештою розділів.
   ===================================================================== */
.bottom-nav, .more-sheet { display: none; }
@media (max-width: 600px) {
  .bottom-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px;
    height: calc(68px + env(safe-area-inset-bottom, 0px));
    padding: 0 6px env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottom-nav > a, .bottom-nav > button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    min-width: 0; height: 58px; align-self: center; padding: 6px 2px; box-sizing: border-box;
    border: 0; border-radius: 14px; background: none; cursor: pointer;
    color: var(--muted); text-decoration: none; font-family: inherit; font-size: 11.5px; font-weight: 650; line-height: 14px;
    -webkit-tap-highlight-color: transparent; transition: background .18s, color .18s;
  }
  .bottom-nav span { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .bottom-nav svg { width: 22px; height: 22px; stroke-width: 2.1; transition: transform .2s ease; }
  .bottom-nav [data-bn="more"] svg { fill: currentColor; }
  .bottom-nav > .active { background: var(--accent-soft); color: var(--teal); }
  .bottom-nav > .active svg { animation: bn-pop .35s ease; }
  .bottom-nav > :active svg { transform: scale(.9); }
  /* Сторінка не ховається під панеллю */
  .has-bottom-nav { padding-bottom: calc(68px + env(safe-area-inset-bottom, 0px)); }
  .has-bottom-nav .toast { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }

  .more-sheet {
    display: block; width: min(480px, calc(100% - 24px)); max-height: 85dvh; box-sizing: border-box;
    margin: auto auto max(12px, env(safe-area-inset-bottom)); padding: 0; border: 1px solid var(--line); border-radius: 24px;
    background: var(--surface); color: var(--text); box-shadow: 0 12px 50px rgba(0, 0, 0, .22); overflow: auto;
  }
  .more-sheet:not([open]) { display: none; }
  .more-sheet[open] { animation: sheet-up .28s cubic-bezier(.2, .8, .3, 1); }
  .more-sheet::backdrop { background: rgba(28, 27, 25, .38); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
  .sheet-body { padding: 18px 18px 20px; }
  .more-sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
  .more-sheet h2 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
  .more-sheet header .icon-btn { font-size: 24px; line-height: 1; color: var(--text); }
  .sheet-group { margin: 14px 4px 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .sheet-links { display: grid; gap: 8px; }
  .sheet-links a {
    display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 16px;
    background: var(--bg); color: var(--text); text-decoration: none; font-size: 16px; font-weight: 600;
  }
  .sheet-links a small { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
  .sheet-links a svg { width: 22px; height: 22px; color: var(--teal); }
  .sheet-links a[aria-current="page"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
  .sheet-num {
    display: grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 11px;
    background: var(--accent); color: var(--on-teal); font-weight: 800; font-size: 16px;
  }
}
@keyframes bn-pop { 50% { transform: translateY(-3px) scale(1.12); } }
@keyframes sheet-up { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .bottom-nav > .active svg, .more-sheet[open] { animation: none; }
}

/* =====================================================================
   «Тренажер»: план на сьогодні, Kopfrechnen і тиждень на головній, значки модулів,
   смужка уроків, а також уточнення, що мають іти після загальних правил вище.
   ===================================================================== */
/* Колір модуля для тексту: темніший на світлому тлі, світліший на темному */
[class*="accent-"], .lessons { --accent-ink: color-mix(in srgb, var(--accent) 55%, var(--text)); }

/* ---------- загальне ---------- */
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-edge); }

.icon-btn, .user-chip { box-shadow: var(--soft-sm); }
.user-chip.active { box-shadow: inset 0 0 0 2px var(--teal); }

.tabs, .seg { background: var(--tile); box-shadow: none; }
.tabs button[aria-selected="true"], .seg button[aria-pressed="true"] { box-shadow: var(--soft-sm); }
.stat, .badge, .choice { box-shadow: var(--soft-sm); border-radius: 18px; }

/* ---------- головна: план на сьогодні ---------- */
.today { margin: 8px 0 44px; }
.today-grid { display: flex; flex-wrap: wrap; gap: 22px; align-items: stretch; }
.today-plan { flex: 999 1 520px; min-width: 0; padding: clamp(20px, 4vw, 30px); }
.today-side { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.tp-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.tp-head h1 { margin: 2px 0 4px; font-size: clamp(28px, 3.6vw, 40px); line-height: 1.1; }
.tp-hello { margin: 0; color: var(--muted); font-size: 15px; }
.tp-ring { width: 96px; height: 96px; flex: none; }
.tp-ring circle { fill: none; stroke-width: 10; }
.tp-ring-bg { stroke: var(--tile); }
.tp-ring-fg { stroke: var(--teal); stroke-linecap: round; transition: stroke-dasharray .4s ease; }
.tp-ring text { font: 800 22px Inter, system-ui, sans-serif; fill: var(--text); }
.tp-list { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 10px; }
.tp-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 16px; background: var(--bg); }
.tp-item.is-extra { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.tp-item.is-extra .tp-mark { border-style: dashed; }
.tp-item.is-current { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--teal); }
.tp-mark {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px;
  border: 2px solid var(--line); color: var(--muted); font-weight: 800; font-size: 14px; box-sizing: border-box;
}
.tp-mark svg { width: 16px; height: 16px; stroke-width: 3.2; }
.is-done .tp-mark { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.is-current .tp-mark { background: var(--surface); border-color: var(--teal); color: var(--ink); }
.tp-text { flex: 1; min-width: 0; color: var(--text); text-decoration: none; line-height: 1.35; }
.tp-text small { display: block; font-size: 13.5px; color: var(--muted); }
.is-done .tp-text { color: var(--muted); }
a.tp-text:hover b, a.tp-text:hover s { text-decoration: underline; }
.tp-count { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--muted); }
.tp-go {
  flex: none; padding: 10px 18px; border-radius: 12px; border: 0; background: var(--btn); color: var(--btn-text);
  font: inherit; font-size: 15px; font-weight: 800; text-decoration: none; cursor: pointer; box-shadow: 0 3px 0 var(--btn-edge);
}
.tp-go:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--btn-edge); }
@media (max-width: 520px) {
  .tp-ring { width: 72px; height: 72px; }
  .tp-item { flex-wrap: wrap; }
  .tp-item .tp-text { flex-basis: calc(100% - 46px); }
  .tp-item .tp-go, .tp-item .tp-count { margin-left: 46px; }
  .tp-item .tp-count + .tp-go { margin-left: auto; }
}

/* усний рахунок */
.kopf { background: var(--kr-bg); color: var(--kr-text); padding: 22px 24px; }
.kopf .kicker { color: #f2c94c; }
.kr-task { margin: 10px 0 0; }
.kr-task span { display: block; font-family: var(--mono); font-size: 38px; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.kr-task small { display: block; margin-top: 4px; font-size: 13.5px; color: var(--kr-muted); overflow-wrap: anywhere; }
.kr-form { display: flex; gap: 8px; margin-top: 14px; }
.kr-form input {
  flex: 1; min-width: 0; min-height: 48px; border-radius: 12px; border: 2px solid var(--kr-accent); background: var(--kr-field);
  color: var(--kr-text); font: 700 22px var(--mono); padding: 0 14px; box-sizing: border-box; box-shadow: none;
}
.kr-form input::placeholder { color: var(--kr-muted); }
.kr-form input:focus { outline: 3px solid #f2c94c; outline-offset: 1px; }
.kr-form button {
  min-height: 48px; min-width: 64px; padding: 0 16px; border-radius: 12px; border: 0; background: var(--kr-accent);
  color: var(--kr-on-accent); font: inherit; font-weight: 800; cursor: pointer;
}
.kr-note { margin: 10px 0 0; min-height: 1.4em; font-size: 14px; font-weight: 650; color: var(--kr-muted); }
.kr-note.ok { color: var(--kr-accent); }
.kr-note.miss { color: #f2c94c; }

/* тиждень */
.week { padding: 20px 24px; }
.wk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.wk-head span { font-size: 13px; color: var(--muted); }
.wk-bars { display: flex; align-items: flex-end; gap: 8px; height: 72px; }
.wk-bar { flex: 1; height: var(--h); min-height: 4px; border-radius: 6px; background: var(--heat-2); }
.wk-bar.is-today { background: var(--yellow); }
.wk-bar.is-future, .wk-bar[style*="--h:0%"] { background: var(--tile); }
.wk-labels { display: flex; gap: 8px; margin-top: 6px; font-size: 11.5px; color: var(--muted); text-align: center; }
.wk-labels span { flex: 1; }
.wk-labels .is-today { color: var(--text); font-weight: 800; }

/* ---------- модулі ---------- */
@media (max-width: 380px) { .modules { grid-template-columns: 1fr; } }
.mod-sym {
  display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 16px;
  background: var(--accent-soft); color: var(--accent-ink); font: 700 17px var(--mono); letter-spacing: -.03em;
}
.mod-text { flex: 1; min-width: 0; }
.mod-pct { display: block; font: 700 15px var(--mono); color: var(--accent-ink); }
.mod.soon .mod-sym { background: var(--tile); color: var(--muted); }
.mod.soon h3 { color: var(--muted); }

/* ---------- сторінка модуля й список уроків ---------- */
.lesson.is-done .l-num { background: var(--teal); color: var(--on-teal); }

/* ---------- урок ---------- */
.lesson-strip { display: flex; align-items: center; gap: 12px; margin: 0 0 18px; }
.ls-bars { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 5px; }
.ls-bars a { display: block; height: 8px; border-radius: 4px; background: var(--tile); }
.ls-bars a.is-done { background: var(--teal); }
.ls-bars a.cur { background: var(--text); }
.ls-bars a:hover { transform: scaleY(1.4); }
.ls-count { font: 700 13px var(--mono); color: var(--muted); }

.prose h1 { font-size: clamp(30px, 5vw, 42px); }
.prose code, .prose pre { font-family: var(--mono); background: var(--tile); }
.done-btn {
  width: 100%; justify-content: center; min-height: 54px; font-size: 17px; border-radius: 16px;
  background: var(--btn); color: var(--btn-text); box-shadow: 0 4px 0 var(--btn-edge);
}

/* ---------- нижня панель і вікно «Ще» ---------- */
@media (max-width: 600px) {
  .bottom-nav { box-shadow: 0 -8px 24px rgba(42, 40, 36, .06); border-top: 1px solid var(--line); }
  .bottom-nav > .active { background: var(--btn); color: var(--btn-text); }
  .sheet-links a { border-radius: 14px; }
}

/* =====================================================================
   Перемикач мови UA / DE (build.mjs → langSwitch, логіка — setLang у site/account.js).
   Повзунок під обраною кнопкою переїжджає з пружинкою; рух — у site/motion.css.
   ===================================================================== */
.lang-switch {
  position: relative; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px;
  background: var(--tile); flex: none; isolation: isolate;
}
.lang-switch button {
  position: relative; z-index: 1; font: inherit; font-size: 13px; font-weight: 750; letter-spacing: .06em;
  min-width: 38px; height: 32px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent;
  color: var(--muted); cursor: pointer; transition: color .25s ease;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { color: var(--btn-text); }
.lang-switch .ls-knob {
  position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px;
  background: var(--btn); box-shadow: 0 2px 0 var(--btn-edge);
}
.lang-switch[data-lang-now="de"] .ls-knob { transform: translateX(100%); }
.lang-switch-wide { display: grid; width: 100%; }
.lang-switch-wide button { height: 40px; font-size: 15px; }
.sheet-lang { margin-top: 2px; }
.auth-corner { display: flex; align-items: center; gap: 8px; }
.auth-corner .lang-switch { background: var(--surface); box-shadow: var(--soft-sm); }
@media (max-width: 330px) { .hide-xs { display: none; } }

/* Мова сайту в налаштуваннях профілю: дві великі картки */
.lang-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lang-cards button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; border-radius: 16px;
  border: 0; background: var(--tile); color: var(--text); font: inherit; text-align: left; cursor: pointer;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .25s ease, background .25s ease, transform .2s ease;
}
.lang-cards button b { font-size: 16px; }
.lang-cards button small { color: var(--muted); font-size: 13px; }
.lang-cards button .lc-code { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: var(--ink); }
.lang-cards button[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }

/* Коло, що накриває сторінку під час зміни мови (і розходиться на новій сторінці) */
.lang-wipe {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; pointer-events: none;
  background: var(--teal); color: var(--on-teal);
  clip-path: circle(var(--wipe-r, 150vmax) at var(--wipe-x, 50%) var(--wipe-y, 50%));
}
.lang-wipe span { font-size: clamp(32px, 8vw, 64px); font-weight: 800; letter-spacing: -.01em; }
