:root {
  color-scheme: dark;
  --bg: #071019;
  --panel: #0d1a26;
  --panel-2: #102233;
  --text: #eef7ff;
  --muted: #8aa4b8;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #35d3ff;
  --accent-2: #27f2aa;
  --danger: #ff4f66;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  background:
    radial-gradient(circle at 50% 0%, rgba(53, 211, 255, 0.18), transparent 34rem),
    linear-gradient(180deg, #071019 0%, #09141f 100%);
  color: var(--text);
  overflow: hidden;
}

button,
input {
  font: inherit;
}

.app-shell {
  position: relative;
  width: min(100vw, 540px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
  opacity: 0;
  pointer-events: none;
  transform: translateY(18px) scale(0.98);
  transition:
    opacity 420ms ease,
    transform 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.screen-active {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  margin-top: 22px;
  text-align: center;
  font-size: 34px;
  letter-spacing: 0;
}

h2 {
  font-size: 28px;
  line-height: 1.13;
  letter-spacing: 0;
}

.lead {
  margin-top: 14px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

.intro-text {
  margin-top: 8px;
  text-align: center;
  color: var(--muted);
  opacity: 0;
  transform: translateY(8px);
  animation: fadeUp 700ms ease 480ms forwards;
}

.logo-mark {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto;
  border-radius: 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: logoPulse 1900ms ease-in-out infinite;
}

.logo-mark img,
.small-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 34px;
  color: var(--muted);
  font-weight: 700;
}

.small-logo {
  position: relative;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
  background: var(--panel);
}

.bottom-form {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.phone-box {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(13, 26, 38, 0.92);
}

.country-flag {
  min-width: 30px;
  font-size: 23px;
}

.phone-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 18px;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  cursor: pointer;
  color: #061018;
  font-weight: 800;
  transition:
    transform 160ms ease,
    opacity 160ms ease;
}

.primary-button {
  min-height: 58px;
  border-radius: 20px;
  background: linear-gradient(145deg, var(--accent), var(--accent-2));
}

.primary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.primary-button:active,
.secondary-button:active,
.icon-button:active {
  transform: scale(0.98);
}

.otp-wrap {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 34px;
}

.otp-hidden {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.01;
  border: 0;
}

.otp-box {
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(13, 26, 38, 0.94);
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
}

.otp-box.filled {
  border-color: rgba(53, 211, 255, 0.55);
  background: rgba(16, 34, 51, 0.96);
}

.otp-wrap.error .otp-box {
  border-color: var(--danger);
  color: var(--danger);
}

.otp-wrap.shake {
  animation: shake 420ms ease;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

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

.profile-panel,
.key-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 26, 38, 0.92);
  box-shadow: var(--shadow);
}

.profile-panel {
  padding: 18px;
}

.profile-panel strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.secondary-button {
  min-height: 54px;
  margin: 14px 0;
  border-radius: 18px;
  background: #eef7ff;
}

.key-block {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.key-block code {
  display: block;
  max-height: 90px;
  margin-top: 8px;
  overflow: auto;
  overflow-wrap: anywhere;
  color: #cdefff;
  font-size: 13px;
  line-height: 1.45;
}

.icon-button {
  min-height: 44px;
  border-radius: 14px;
  background: rgba(53, 211, 255, 0.95);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  max-width: min(90vw, 420px);
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(238, 247, 255, 0.94);
  color: #071019;
  font-size: 14px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

@keyframes logoPulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-7px);
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-1px);
  }
  20%,
  80% {
    transform: translateX(3px);
  }
  30%,
  50%,
  70% {
    transform: translateX(-6px);
  }
  40%,
  60% {
    transform: translateX(6px);
  }
}

@media (min-width: 760px) {
  body {
    overflow: auto;
  }

  .app-shell {
    min-height: 720px;
  }
}

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