/* Стиль miriada.space: тёплый песочный фон, терракотовый акцент, Caprasimo в заголовках, Figtree в тексте.
   Шрифты свои (CSP: только 'self'), как и у лендинга — только латиница: кириллица идёт системным шрифтом. */

@font-face {
  font-family: "Caprasimo";
  src: url("fonts/caprasimo-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #f5ead8;
  --surface: #ebddc5;
  --text: #201e1d;
  --accent: #c67139;
  --divider: color-mix(in srgb, #201e1d 16%, transparent);
  --n100: #f9f4ed;
  --n200: #eee7db;
  --n300: #dcd3c4;
  --n700: #645c50;
  --n800: #474238;
  --a100: #fff2eb;
  --a200: #ffe1d0;
  --a600: #b2622d;
  --a700: #8c491a;
  --g200: #e1eecc;
  --g700: #56633f;
  --err: #a8322a;
  --err-bg: #fbe3dc;
  --fh: "Caprasimo", system-ui, sans-serif;
  --fb: "Figtree", system-ui, sans-serif;
  --sh-md: 0 3px 10px color-mix(in srgb, #2e2b25 16%, transparent);
  --sh-lg: 0 18px 44px color-mix(in srgb, #2e2b25 26%, transparent);
  --ease: cubic-bezier(.2, .8, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.6 var(--fb);
  -webkit-font-smoothing: antialiased;
}

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); }

a { color: var(--a700); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Каркас ---------- */

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 16px 40px;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font: 400 28px var(--fh);
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  position: relative;
  flex: none;
}
.dot::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  opacity: .5;
  animation: ping 2.6s infinite;
}
@keyframes ping { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.6); opacity: 0; } }

.card {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin-top: 36px;
  background: var(--n100);
  border-radius: 28px;
  padding: 32px 28px;
  box-shadow: var(--sh-lg);
}

/* Маскот лендинга выглядывает из-за правого верхнего угла карточки и покачивается, как на miriada.space. */
.mascot {
  position: absolute;
  top: -78px;
  right: -34px;
  width: 104px;
  height: auto;
  filter: drop-shadow(0 14px 16px rgba(46, 43, 37, .28));
  pointer-events: none;
  user-select: none;
  animation: mfloat 6s ease-in-out infinite;
}
@keyframes mfloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}
.card > h1:first-of-type { padding-right: 56px; }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 18px;
  color: var(--n700);
  font-size: 14px;
}
.foot a { color: var(--n700); }
.foot a:hover { color: var(--accent); }

h1 {
  font: 400 clamp(28px, 6vw, 36px)/1.15 var(--fh);
  letter-spacing: -.015em;
  margin: 0 0 18px;
  text-wrap: balance;
}
h2 { font: 400 21px/1.25 var(--fh); margin: 0 0 14px; }
p { margin: 0 0 12px; text-wrap: pretty; }

.group + .group {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--divider);
}

.muted { color: var(--n700); }
.small { font-size: 14px; }

/* ---------- Формы ---------- */

.flow-form { display: flex; flex-direction: column; gap: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }

.field input {
  font: 400 16px/1.4 var(--fb);
  padding: 13px 18px;
  border: 1px solid var(--n300);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  transition: border-color .2s, box-shadow .2s;
}
.field input:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--n300)); }
.field input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field input:disabled { background: var(--n200); color: var(--n700); }

.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }

/* Кнопки — «таблетки» лендинга: основная терракотовая с бликом, вторичная контурная. */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: 400 17px/1.1 var(--fh);
  padding: 15px 28px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--bg);
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 70%, transparent);
  transition: background .2s, transform .25s var(--ease), box-shadow .25s;
}
.btn:hover {
  background: var(--a600);
  transform: translateY(-2px);
  box-shadow: 0 14px 28px -8px color-mix(in srgb, var(--accent) 80%, transparent);
}
.btn:active { transform: scale(.98); }
.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -70%;
  width: 50%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .35), transparent);
  transform: skewX(-20deg);
  animation: shine 4.5s 1.5s infinite;
}
@keyframes shine { 0%, 60% { left: -70%; } 100% { left: 130%; } }

.btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--divider);
  box-shadow: none;
}
.btn.secondary::after { content: none; }
.btn.secondary:hover { background: color-mix(in srgb, var(--text) 7%, transparent); }

.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn:disabled::after { content: none; }

.actions { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.actions .btn { flex: 1; }

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 20px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--divider);
  font-size: 15px;
  font-weight: 600;
}

/* ---------- Сообщения ---------- */

.messages { list-style: none; padding: 0; margin: 0 0 4px; display: flex; flex-direction: column; gap: 8px; }
.msg {
  padding: 10px 16px;
  border-radius: 14px;
  font-size: 15px;
  background: var(--a100);
  color: var(--a700);
}
.msg-error { background: var(--err-bg); color: var(--err); }
.msg-success { background: var(--g200); color: var(--g700); }

/* ---------- TOTP, резервные коды, профиль, согласие ---------- */

.node-img { margin: 0; text-align: center; }
.node-img img {
  max-width: 220px;
  height: auto;
  background: #fff;
  padding: 12px;
  border-radius: 18px;
  box-shadow: var(--sh-md);
}
.node-img figcaption { font-size: 14px; color: var(--n700); margin-top: 8px; }

.node-text code, .codes code {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 15px;
  word-break: break-all;
}
.node-text > code {
  display: block;
  background: var(--surface);
  padding: 10px 14px;
  border-radius: 12px;
}

.codes {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.codes li { background: var(--surface); border-radius: 12px; padding: 8px 12px; text-align: center; }

.scopes {
  list-style: none;
  padding: 14px 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--n200);
  border-radius: 18px;
}

.profile {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 18px;
  margin: 0 0 12px;
  padding: 16px 18px;
  background: var(--n200);
  border-radius: 18px;
  font-size: 15px;
}
.profile dt { color: var(--n700); }
.profile dd { margin: 0; overflow-wrap: anywhere; font-weight: 600; }

/* inline-block + nowrap: плашка переносится целиком, а не по буквам (у dd overflow-wrap: anywhere для длинных email). */
.badge {
  display: inline-block;
  white-space: nowrap;
  overflow-wrap: normal;
  font: 600 11px var(--fb);
  padding: 4px 10px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.badge.ok { background: var(--g200); color: var(--g700); }
.badge.warn { background: var(--a200); color: var(--a700); text-decoration: none; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .card { padding: 26px 20px; border-radius: 24px; margin-top: 44px; }
  .mascot { width: 78px; top: -60px; right: -6px; }
  .card > h1:first-of-type { padding-right: 48px; }
  .brand { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
