:root {
  /* ── Цвета (единая палитра с лендингом) ───────────────────── */
  --bg:            #f8f7f3;   /* тёплый off-white */
  --bg-deep:       #f1efe7;
  --surface:       #ffffff;
  --paper:         rgba(255, 255, 255, 0.92);
  --paper-strong:  #ffffff;

  /* Текст */
  --ink:           #0d1020;   /* псевдоним --text для совместимости с лендингом */
  --text:          #0d1020;
  --muted:         #5b6480;
  --muted-soft:    #8a90a8;

  /* Линии */
  --line:          rgba(13, 16, 32, 0.08);
  --line-mid:      rgba(13, 16, 32, 0.12);

  /* Акценты */
  --violet:        #7d39eb;
  --violet-deep:   #5020bc;
  --lime:          #c6ff33;
  --lime-deep:     #b6f100;

  /* Зелёные (формы, фокус) */
  --green-ink:     #52620e;
  --green-line:    rgba(129, 168, 0, 0.26);
  --green-ring:    rgba(198, 255, 51, 0.34);
  --green-wash:    rgba(198, 255, 51, 0.14);

  /* Дополнительные акценты */
  --accent-1:      #c6ff33;
  --accent-2:      #5ac3ff;
  --accent-3:      #ff7a59;
  --accent-4:      #9e77ff;

  /* ── Типографика ───────────────────────────────────────────── */
  --sans:   "Inter", system-ui, -apple-system, sans-serif;
  --serif:  "Cormorant Garamond", "Times New Roman", serif;
  --mono:   "JetBrains Mono", ui-monospace, monospace;

  --t-xs:   11px;
  --t-sm:   13px;
  --t-base: 16px;
  --t-md:   19px;
  --t-lg:   24px;
  --t-xl:   32px;

  /* ── Отступы ───────────────────────────────────────────────── */
  --s-1: 4px;  --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 24px; --s-6: 32px;  --s-7: 48px;  --s-8: 64px;

  /* ── Шелл ──────────────────────────────────────────────────── */
  --shell: min(1240px, calc(100vw - 40px));

  /* ── Тени ──────────────────────────────────────────────────── */
  --shadow-xs:          0 4px 12px rgba(13, 16, 32, 0.04);
  --shadow-sm:          0 10px 24px rgba(13, 16, 32, 0.06);
  --shadow-md:          0 18px 44px rgba(13, 16, 32, 0.08);
  --shadow-lg:          0 28px 60px rgba(13, 16, 32, 0.12);
  --shadow-soft:        0 18px 44px rgba(13, 16, 32, 0.08);
  --shadow-violet:      0 28px 70px rgba(80, 32, 188, 0.22);
  --shadow-glow-lime:   0 0 0 1px rgba(198, 255, 51, 0.4), 0 18px 40px rgba(182, 241, 0, 0.32);
  --shadow-glow-violet: 0 0 0 1px rgba(125, 57, 235, 0.36), 0 18px 40px rgba(80, 32, 188, 0.32);

  /* ── Радиусы ───────────────────────────────────────────────── */
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;

  /* ── Кнопки ────────────────────────────────────────────────── */
  --button-height:    48px;
  --button-padding-x: 18px;
  --button-font-size: 14px;
  --button-radius:    999px;

  /* ── Движение ──────────────────────────────────────────────── */
  --transition:  220ms ease;
  --ease-out:    cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast:      160ms;
  --t-base-d:    220ms;
  --t-slow:      360ms;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--t-base);
  line-height: 1.65;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 92% -4%, rgba(125, 57, 235, 0.06), transparent 40rem),
    radial-gradient(circle at -4% 6%,  rgba(198, 255, 51, 0.08), transparent 30rem);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Сетка-подложка для admin/student страниц */
body[data-grid="light"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(to right,  rgba(13, 16, 32, 0.032) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(13, 16, 32, 0.032) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

body[data-grid="light"]::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 14% 12%, rgba(255, 255, 255, 0.7),  transparent 18rem),
    radial-gradient(circle at 96%  2%, rgba(255, 255, 255, 0.38), transparent 14rem);
  pointer-events: none;
}

/* ── Animated grid overlay (shared) ──────────────────────────── */
.bg-grid {
  position: fixed;
  inset: -5% -5% -5% -5%;
  width: 110%; height: 110%;
  z-index: 0;
  pointer-events: none;
  color: rgba(13,16,32,0.07);
  mask-image: radial-gradient(ellipse 80% 60% at 50% 35%, #000 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 35%, #000 30%, transparent 80%);
  animation: bg-grid-drift 28s linear infinite;
  will-change: transform;
}
.bg-grid path { stroke: currentColor; fill: none; }
.bg-grid__squares rect { fill: rgba(125,57,235,0.07); }
.bg-grid__squares rect:nth-child(3n) { fill: rgba(198,255,51,0.18); }
.bg-grid__squares rect:nth-child(5n) { fill: rgba(13,16,32,0.04); }
@keyframes bg-grid-drift {
  from { transform: translate3d(0,0,0); }
  to   { transform: translate3d(-40px,-40px,0); }
}

a { color: inherit; text-decoration: none; }

button, input, a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button, input { border: 0; }

.shell { width: var(--shell); margin: 0 auto; }

/* ── Бренд ─────────────────────────────────────────────────────── */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.04em;
  background: var(--ink);
  box-shadow: 0 4px 14px rgba(13,16,32,0.22);
}

.brand-copy { display: grid; gap: 1px; line-height: 1; }
.brand-copy strong,
.brand-copy span {
  display: block;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

/* ── Eyebrow ───────────────────────────────────────────────────── */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.eyebrow-mark {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  color: var(--text);
}

/* ── Кнопки ────────────────────────────────────────────────────── */
.button {
  height: var(--button-height);
  min-height: var(--button-height);
  padding: 0 var(--button-padding-x);
  border-radius: var(--button-radius);
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: var(--button-font-size);
  font-weight: 700;
  transition:
    transform 220ms var(--ease-out),
    box-shadow 220ms var(--ease-out),
    background-color var(--transition),
    border-color var(--transition),
    color var(--transition),
    scale 160ms var(--ease-out);
  touch-action: manipulation;
  cursor: pointer;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  outline: none;
}

.button:active { scale: 0.97; }

.button:focus-visible {
  box-shadow:
    0 0 0 4px var(--green-ring),
    0 18px 34px rgba(182, 241, 0, 0.18);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.button-outline {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.button-outline:hover {
  border-color: rgba(125, 57, 235, 0.32);
  background: rgba(255, 255, 255, 1);
}

.button-fill {
  color: #08100a;
  background: linear-gradient(135deg, #edffac 0%, var(--lime) 45%, var(--lime-deep) 100%);
  box-shadow: 0 18px 34px rgba(182, 241, 0, 0.22);
}

.button-fill:hover { box-shadow: var(--shadow-glow-lime); }

.button-dark {
  color: #fff;
  background: linear-gradient(135deg, #111 0%, var(--violet) 68%, #8a5dfd 100%);
  box-shadow: 0 18px 34px rgba(80, 32, 188, 0.22);
}

.button-dark:hover { box-shadow: var(--shadow-glow-violet); }

.button-ink {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 24px rgba(13,16,32,0.18);
}

.button-ink:hover {
  background: var(--violet);
  box-shadow: 0 14px 32px rgba(80,32,188,0.28);
  transform: translateY(-1px);
}

/* ── Icon chip ─────────────────────────────────────────────────── */
.icon-chip {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #f7ffda, #ffffff);
  border: 1px solid rgba(129, 168, 0, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.icon-chip svg { width: 18px; height: 18px; color: var(--green-ink); }

/* ── Поля ввода ────────────────────────────────────────────────── */
.field { display: grid; gap: 10px; }
.field-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field-control { position: relative; }

.input {
  width: 100%;
  min-height: 60px;
  padding: 0 18px;
  border-radius: 18px;
  border: 1px solid rgba(129, 168, 0, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.84);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input::placeholder { color: #8a90a3; }

.input:focus {
  outline: none;
  border-color: var(--green-line);
  box-shadow:
    0 0 0 5px rgba(198, 255, 51, 0.2),
    0 12px 28px rgba(129, 168, 0, 0.08);
}

.input--with-action { padding-right: 56px; }

.field-action {
  position: absolute;
  top: 50%;
  right: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  transform: translateY(-50%);
}

.field-action:hover,
.field-action:focus-visible {
  background: var(--green-wash);
  color: var(--green-ink);
  outline: none;
}

/* ── Чекбоксы ──────────────────────────────────────────────────── */
.checkbox-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 15px;
}

.checkbox-control input { position: absolute; opacity: 0; pointer-events: none; }

.checkbox-box {
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  border-radius: 8px;
  border: 1px solid rgba(129, 168, 0, 0.24);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  display: grid;
  place-items: center;
  transition:
    border-color var(--transition),
    background-color var(--transition),
    box-shadow var(--transition);
}

.checkbox-control input:checked + .checkbox-box {
  border-color: transparent;
  background: linear-gradient(135deg, #20310b 0%, var(--lime) 58%, var(--lime-deep) 100%);
  box-shadow: 0 10px 18px rgba(129, 168, 0, 0.18);
}

.checkbox-control input:focus-visible + .checkbox-box {
  border-color: var(--green-line);
  box-shadow: 0 0 0 4px rgba(198, 255, 51, 0.24);
}

.checkbox-control input:checked + .checkbox-box::after {
  content: "";
  display: block;
  width: 10px;
  height: 6px;
  border: 2px solid #08100a;
  border-top: 0;
  border-right: 0;
  transform: rotate(-45deg) translateY(-1px);
}

/* ── Текстовые ссылки ──────────────────────────────────────────── */
.text-link {
  display: inline-flex;
  align-items: center;
  color: var(--violet);
  font-weight: 700;
  white-space: nowrap;
  transition: color var(--transition);
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--violet-deep);
  outline: none;
}

/* ── Визуально скрытые ─────────────────────────────────────────── */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Reveal-анимации ───────────────────────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .reveal {
    opacity: 0;
    transform: translateY(20px);
    transition:
      opacity 640ms var(--ease-out),
      transform 640ms var(--ease-out);
    transition-delay: calc(var(--reveal-i, 0) * 80ms);
  }
  .reveal.is-visible { opacity: 1; transform: none; }
}

@keyframes ar-fill-bar {
  from { width: 0; }
  to   { width: var(--fill, 0%); }
}

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}
