@import url("site-bg.css");

:root {
  --bg: #d5d5d5;
  --orange-2: #ef8f3f;
  --dark: #171717;
  --light: #ffffff;
  --card-a: #efb07b;
  --card-b: #f18f3c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
}

body {
  display: flex;
  justify-content: center;
}

body.modal-open .screen {
  filter: blur(4px) saturate(.96);
  transform: scale(.995);
  transition: filter .28s ease, transform .28s ease;
}

.screen {
  width: min(100vw, 402px);
  min-height: 100dvh;
  position: relative;
  overflow: hidden;
  padding: 26px 0 24px;
  background:
    linear-gradient(150deg, transparent 55%, rgba(239, 143, 63, 0.62) 56%, transparent 57%) 0 170px/180px 180px,
    linear-gradient(150deg, transparent 55%, rgba(239, 143, 63, 0.55) 56%, transparent 57%) -20px 400px/220px 220px,
    linear-gradient(150deg, transparent 55%, rgba(239, 143, 63, 0.5) 56%, transparent 57%) 20px 680px/260px 260px,
    var(--bg);
  animation: pageIn .45s ease both;
}

.intro-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 10%, rgba(239, 143, 63, 0.26), transparent 35%),
    radial-gradient(circle at 15% 80%, rgba(239, 143, 63, 0.14), transparent 35%),
    radial-gradient(circle at 90% 70%, rgba(239, 143, 63, 0.14), transparent 35%);
  opacity: .86;
}

@media (prefers-reduced-motion: reduce) {
  .intro-glow,
  .screen,
  .card,
  .top-pill,
  .title,
  .subtitle,
  .continue,
  .terms,
  .returning-screen,
  .returning-loader-ring,
  .returning-loader-bolt,
  .returning-dots span {
    animation: none !important;
  }
}

.top-pill {
  width: 132px;
  height: 26px;
  margin: 0 auto 18px;
  border-radius: 999px;
  background: rgba(239, 143, 63, 0.5);
  filter: blur(6px);
  animation: fadeDown .8s .05s both;
}

.title {
  margin: 0;
  padding: 0 32px;
  text-align: center;
  color: var(--dark);
  line-height: 1.08;
  letter-spacing: 0.2px;
  font-size: 27px;
  font-weight: 400;
  animation: fadeDown .8s .1s both;
}

.title span {
  display: block;
}

.title b {
  font-weight: 500;
  color: #f07d2d;
}

.separator {
  margin-top: 14px;
  width: 100%;
  height: 1px;
  background: #ef8f3f;
  animation: fadeDown .8s .16s both;
}

.subtitle {
  margin: 10px 0 12px;
  text-align: center;
  color: #535353;
  font-size: 14px;
  font-weight: 300;
  animation: fadeDown .8s .2s both;
}

.card {
  width: min(100% - 40px, 320px);
  margin: 0 auto;
  border-radius: 30px;
  padding: 16px 16px 16px;
  background: linear-gradient(160deg, var(--card-a) 0%, var(--card-b) 95%);
  color: var(--light);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
  animation: cardIn .65s .24s cubic-bezier(.2,.8,.25,1) both;
}

.avatar-wrap {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  margin: 0 auto 14px;
  border: 1px solid #f5dec6;
  display: grid;
  place-items: center;
}

.avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 24%, #efb27a 0 13px, transparent 14px),
    radial-gradient(ellipse at 50% 100%, #efb27a 0 24px, transparent 25px);
}

.avatar.has-photo {
  background: none;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.avatar.has-photo .avatar-img {
  display: block;
}

.name {
  width: 136px;
  height: 34px;
  margin: 0 auto 12px;
  border-radius: 99px;
  border: 1px solid #f7e2cf;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 1px;
}

.form-row {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  column-gap: 10px;
  margin-bottom: 12px;
}

.form-row label {
  font-size: 13px;
  font-weight: 400;
  letter-spacing: .6px;
}

.field,
.select-wrap {
  height: 35px;
  border-radius: 999px;
  border: 1px solid #f8e3cf;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 300;
}

.field input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #fff;
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .4px;
  font-variant-numeric: tabular-nums;
}


.field input::placeholder {
  color: rgba(255, 255, 255, 0.8);
}

.field small,
.select-wrap small {
  font-size: 15px;
  flex: 0 0 auto;
}

.goal-select {
  position: relative;
  width: 100%;
}

.goal-trigger {
  width: 100%;
  height: 35px;
  border-radius: 999px;
  border: none;
  background: #ececec;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  transition: box-shadow .2s ease, transform .2s ease;
}

.goal-trigger small {
  color: #202020;
  font-size: 20px;
  line-height: 1;
  transition: transform .2s ease;
}

.field:focus-within,
.goal-trigger:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.goal-menu {
  margin: 0;
  padding: 8px;
  list-style: none;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px);
  transition: max-height .25s ease, opacity .2s ease, transform .2s ease;
}

.goal-menu li {
  border-radius: 10px;
  padding: 10px 12px;
  color: #333;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}

.goal-menu li:hover,
.goal-menu li.active {
  background: #f08f3f;
  color: #fff;
}

.goal-select.open .goal-menu {
  max-height: 260px;
  opacity: 1;
  transform: translateY(0);
}

.goal-select.open .goal-trigger small {
  transform: rotate(180deg);
}

.continue {
  margin: 22px auto 8px;
  display: block;
  width: min(100% - 40px, 320px);
  height: 58px;
  border: none;
  border-radius: 999px;
  background: #f3903f;
  color: var(--light);
  font-size: 30px;
  font-weight: 400;
  letter-spacing: 0.5px;
  transition: transform .15s ease, box-shadow .15s ease, background .2s ease;
  animation: fadeUp .8s .35s both;
}

.continue:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(243, 144, 63, 0.35);
}

.continue:active {
  transform: translateY(0);
}

.continue.done {
  background: #db7f34;
}


.terms {
  margin: 0;
  text-align: center;
  font-size: clamp(12px, 3.5vw, 16px);
  color: #5c5c5c;
  padding: 0 18px;
  animation: fadeUp .8s .45s both;
}

.terms a {
  color: #ef7d2d;
  font-weight: 600;
  text-decoration: none;
}

.terms-card {
  max-height: none;
  padding: 20px 20px 18px;
}

.terms-content {
  margin-bottom: 6px;
}

.terms-actions {
  margin-top: 24px;
}

.terms-text {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 400;
}

.terms-text:last-of-type {
  margin-bottom: 20px;
}

.back-button {
  margin-top: 0;
  font-size: 18px;
}

.dev-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(16, 16, 16, 0.28);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 50;
}

.dev-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.dev-modal {
  width: min(88vw, 340px);
  border-radius: 24px;
  padding: 20px 18px 18px;
  text-align: center;
  color: #fff;
  background: linear-gradient(160deg, #efb07b 0%, #f18f3c 95%);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 14px 24px rgba(0, 0, 0, 0.2);
  transform: translateY(10px) scale(.96);
  opacity: 0;
}

.dev-overlay.show .dev-modal {
  animation: modalIn .35s cubic-bezier(.2,.8,.25,1) forwards;
}

.dev-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
}

.dev-text {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 500;
}

.dev-close {
  margin-top: 16px;
  width: 100%;
  height: 44px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #e2782e;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
}

.shake {
  animation: shake .24s linear;
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

@keyframes pageIn {
  from { opacity: 0; transform: scale(.985); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeDown {
  from { opacity: 0; transform: translateY(-12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes glowPulse {
  0% { opacity: .8; }
  50% { opacity: 1; }
  100% { opacity: .8; }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

body.welcome-booting #welcome-screen,
body.welcome-booting #returning-screen {
  visibility: hidden;
  pointer-events: none;
}

/* —— Уже зарегистрирован: экран перенаправления —— */
body.returning-active .intro-glow {
  opacity: 1;
  animation: glowPulse 2.4s ease-in-out infinite;
}

.returning-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    linear-gradient(150deg, transparent 55%, rgba(239, 143, 63, 0.45) 56%, transparent 57%) 50% 30%/200px 200px,
    var(--bg);
  animation: pageIn 0.4s ease both;
}

.returning-screen[hidden] {
  display: none;
}

.returning-card {
  width: min(100%, 320px);
  padding: 28px 22px 26px;
  border-radius: 30px;
  text-align: center;
  color: var(--light);
  background: linear-gradient(165deg, var(--card-a) 0%, var(--card-b) 100%);
  border: 1px solid rgba(255, 255, 255, 0.32);
  box-shadow:
    0 14px 36px rgba(0, 0, 0, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  animation: cardIn 0.55s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

.returning-avatar {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 2px solid rgba(255, 255, 255, 0.45);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeDown 0.6s 0.1s both;
}

.returning-avatar:not(.has-photo)::after {
  content: "👤";
  font-size: 28px;
  opacity: 0.85;
}

.returning-avatar.has-photo .returning-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.returning-avatar-img {
  display: none;
}

.returning-loader {
  position: relative;
  width: 58px;
  height: 58px;
  margin: 4px auto 18px;
}

.returning-loader-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.28);
  border-top-color: #fff;
  border-right-color: rgba(255, 255, 255, 0.75);
  animation: returningSpin 0.85s linear infinite;
  box-shadow: 0 0 18px rgba(255, 255, 255, 0.2);
}

.returning-loader-bolt {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 20px;
  line-height: 1;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
  animation: returningBolt 1.2s ease-in-out infinite;
}

.returning-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.04em;
  animation: fadeDown 0.65s 0.15s both;
}

.returning-name {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.12em;
  opacity: 0.95;
  animation: fadeDown 0.65s 0.22s both;
}

.returning-text {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 300;
  line-height: 1.45;
  opacity: 0.88;
  animation: fadeUp 0.65s 0.28s both;
}

.returning-dots {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  height: 10px;
}

.returning-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  animation: returningDot 1.1s ease-in-out infinite;
}

.returning-dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.returning-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes returningSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes returningBolt {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  50% {
    transform: translate(-50%, -52%) scale(1.08);
    opacity: 0.85;
  }
}

@keyframes returningDot {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-5px);
    opacity: 1;
  }
}

@media (max-width: 480px) {
  .screen,
  .card,
  .top-pill,
  .title,
  .subtitle,
  .continue,
  .terms {
    animation-duration: .24s !important;
  }

  .screen {
    background:
      linear-gradient(150deg, transparent 55%, rgba(239, 143, 63, 0.35) 56%, transparent 57%) 0 220px/220px 220px,
      var(--bg);
  }

  .intro-glow {
    opacity: .45;
  }
}
