/* Страницы входа и приглашения */

.auth-layout {
  display: grid;
  grid-template-columns: minmax(400px, 1fr) minmax(0, 1.1fr);
  min-height: 100dvh;
}

.auth-side {
  display: flex;
  flex-direction: column;
  padding: 28px 40px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  margin: auto;
  padding: 32px 0;
}
.auth-title {
  font-size: 30px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.auth-subtitle {
  margin-top: 10px;
  font-size: 16px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}
.auth-subtitle b {
  color: var(--text);
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 28px;
}
.auth-cta {
  margin-top: 28px;
}
.input-lg {
  height: 48px;
  font-size: 15px;
}
.auth-fine {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-2);
}
.auth-footer {
  font-size: 12px;
  color: var(--text-3);
}
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 24px;
  font-size: 14px;
}
.auth-mail-badge {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: var(--blue-50);
  color: var(--blue);
}
.auth-notice {
  margin-top: 20px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: var(--red-50);
  color: var(--red-600);
  font-size: 13px;
}
.auth-dev {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #fff7e0;
  color: #7a5a00;
  font-size: 13px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
  color: var(--text-3);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ----- Поле кода: одно настоящее поле поверх шести «ячеек» ----- */
.code-field {
  position: relative;
}
.code-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  caret-color: transparent;
  font-size: 16px; /* чтобы iOS не зумил страницу */
  cursor: text;
}
.code-cells {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  pointer-events: none;
}
.code-cell {
  display: grid;
  place-items: center;
  height: 56px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
  font-size: 24px;
  font-weight: 600;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.code-field.focused .code-cell.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-100);
}
.code-field.focused .code-cell.active:empty::after {
  content: '';
  width: 2px;
  height: 24px;
  background: var(--blue);
  animation: blink 1s steps(1) infinite;
}
.code-field.has-error .code-cell {
  border-color: var(--red);
}
.code-field.shake {
  animation: shake 0.35s;
}
@keyframes blink {
  50% {
    opacity: 0;
  }
}
@keyframes shake {
  20%,
  60% {
    transform: translateX(-6px);
  }
  40%,
  80% {
    transform: translateX(6px);
  }
}

/* ----- Иллюстрация справа ----- */
.auth-art {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 40px;
  overflow: hidden;
  background: linear-gradient(160deg, #eef1ff 0%, #f6f3ff 55%, #fff6e6 100%);
}
.art-board {
  position: relative;
  flex: none;
  width: 560px;
  height: 420px;
  border-radius: 16px;
  background-color: var(--canvas-bg);
  background-image: radial-gradient(circle, var(--grid-dot) 1px, transparent 1.4px);
  background-size: 22px 22px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.art-toolbar {
  position: absolute;
  left: 12px;
  top: 50%;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  transform: translateY(-50%);
}
.art-tool {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
}
.art-tool.active {
  background: var(--blue-50);
  color: var(--blue);
}
.art-drawing {
  position: absolute;
  left: 40px;
  top: 10px;
}
.art-drawing path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.art-stroke {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: art-draw 7s ease-in-out infinite;
}
.art-stroke-2 {
  animation-delay: 2.2s;
}
.art-cursor {
  position: absolute;
  left: 40px;
  top: 10px;
  display: flex;
  align-items: flex-start;
  offset-anchor: 2px 1px;
  offset-rotate: 0deg;
  animation: art-move 7s ease-in-out infinite;
}
.art-cursor-1 {
  offset-path: path('M80 120c20-30 60-40 80-10s-10 60 20 70 60-40 90-30');
}
.art-cursor-2 {
  offset-path: path('M300 330c25-25 55-25 70 0s45 25 70 0');
  animation-delay: 2.2s;
}
.art-label {
  margin: 14px 0 0 -2px;
  padding: 2px 8px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.art-cursor-1 .art-label {
  background: #e5484d;
}
.art-cursor-2 .art-label {
  background: #30a46c;
}
@keyframes art-draw {
  0% {
    stroke-dashoffset: 1;
    opacity: 1;
  }
  45%,
  85% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: 0;
    opacity: 0;
  }
}
@keyframes art-move {
  0% {
    offset-distance: 0%;
  }
  45%,
  100% {
    offset-distance: 100%;
  }
}
.art-caption {
  max-width: 460px;
  text-align: center;
}
.art-caption h2 {
  font-size: 24px;
  letter-spacing: -0.01em;
}
.art-caption p {
  margin-top: 8px;
  color: var(--text-2);
  font-size: 15px;
}

/* ----- Приглашение ----- */
.invite-board {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}
.invite-board-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 10px;
  background: var(--blue-50);
  color: var(--blue);
}
.invite-board-name {
  font-weight: 600;
  font-size: 16px;
  overflow-wrap: anywhere;
}
.invite-board-owner {
  font-size: 13px;
  color: var(--text-2);
}

@media (max-width: 960px) {
  .auth-layout {
    grid-template-columns: 1fr;
  }
  .auth-art {
    display: none;
  }
}
@media (max-width: 480px) {
  .auth-side {
    padding: 20px 16px;
  }
  .auth-title {
    font-size: 26px;
  }
  .code-cells {
    gap: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .art-stroke,
  .art-cursor {
    animation: none;
  }
  .art-stroke {
    stroke-dashoffset: 0;
  }
  .art-cursor {
    offset-distance: 100%;
  }
}
